/* MARGENEZ — Hub de juegos */

body[data-page="juegos"] {
  overflow-x: hidden;
  padding-top: 0;
  --juegos-top-h: calc(
    max(var(--space-md), env(safe-area-inset-top, 0px)) +
    var(--space-md) +
    1.75rem +
    var(--space-md) +
    1px
  );
}

.juegos {
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(46, 111, 168, 0.12) 0%, transparent 55%),
    var(--bg);
}

.juegos__top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 100;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding:
    max(var(--space-md), env(safe-area-inset-top, 0px))
    max(var(--page-gutter), env(safe-area-inset-right, 0px))
    var(--space-md)
    max(var(--page-gutter), env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.juegos__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}

.juegos__back {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}

.juegos__back:hover {
  color: var(--text);
}

.juegos__main {
  flex: 1;
  width: min(52rem, 100%);
  margin: 0 auto;
  padding:
    calc(var(--juegos-top-h) + var(--space-xl))
    max(var(--page-gutter), env(safe-area-inset-right, 0px))
    var(--space-2xl)
    max(var(--page-gutter), env(safe-area-inset-left, 0px));
}

.juegos__header {
  margin-bottom: var(--space-xl);
  text-align: center;
}

.juegos__title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}

.juegos__deck {
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 32rem;
  margin: 0 auto;
}

.juegos__grid {
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 640px) {
  .juegos__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.juegos__card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.juegos__card:hover {
  border-color: color-mix(in srgb, var(--border) 70%, rgba(46, 111, 168, 0.35));
  box-shadow: var(--shadow-md);
}

.juegos__card-logo {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
}

.juegos__card-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(46, 111, 168, 0.12);
  color: rgba(46, 111, 168, 0.95);
}

.juegos__card-badge--new {
  background: rgba(34, 120, 80, 0.14);
  color: rgba(22, 100, 65, 0.95);
}

.juegos__card-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  line-height: 1.2;
}

.juegos__card-desc {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
  flex: 1;
}

.juegos__card-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.juegos__card-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.48rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.juegos__card-btn:hover {
  transform: translateY(-1px);
}

.juegos__card-btn--primary {
  border-color: rgba(46, 111, 168, 0.35);
  background: rgba(46, 111, 168, 0.14);
  color: rgba(46, 111, 168, 0.98);
}

.juegos__card-btn--primary:hover {
  background: rgba(46, 111, 168, 0.2);
}

.juegos__card-btn--ghost {
  border-color: var(--border);
  background: color-mix(in srgb, var(--bg) 92%, var(--surface));
  color: var(--text-secondary);
}

.juegos__card-btn--ghost:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--border) 55%, var(--text));
}

.juegos__card--369 .juegos__card-btn--primary {
  border-color: rgba(22, 100, 65, 0.35);
  background: rgba(22, 100, 65, 0.14);
  color: rgba(22, 100, 65, 0.98);
}

.juegos__card--369 .juegos__card-btn--primary:hover {
  background: rgba(22, 100, 65, 0.2);
}

.juegos__card--369 .juegos__card-logo {
  width: auto;
  height: auto;
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
  color: rgba(22, 100, 65, 0.95);
}

/* Tarjetas IA (Oráculo, Compatibilidad, Detective) */
.juegos__card--horoscopo {
  background:
    radial-gradient(ellipse 80% 60% at 0% 0%, rgba(107, 79, 168, 0.1) 0%, transparent 55%),
    var(--bg-elevated);
}

.juegos__card-badge--ai {
  background: rgba(107, 79, 168, 0.14);
  color: rgba(80, 55, 140, 0.95);
}

.juegos__card--horoscopo .juegos__card-logo,
.juegos__card--compat .juegos__card-logo {
  width: 3.5rem;
  height: 3.5rem;
}

.juegos__card--detective .juegos__card-logo {
  background: linear-gradient(145deg, #1a1428, #2a2240);
  border-radius: 12px;
  padding: 6px;
}

.juegos__card--solo .juegos__card-actions {
  grid-template-columns: 1fr;
}

.juegos__screen.juegos__hidden,
.juegos__screen[hidden] {
  display: none !important;
}
