:root {
  --cream: #fbf6ec;
  --paper: #fffdf8;
  --ink: #2b1140;
  --ink-soft: #5b4670;
  --purple: #6b2a8c;
  --pink: #ff3d7f;
  --yellow: #ffc727;
  --teal: #19b8a8;
  --kraft: #d9a868;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(43, 17, 64, 0.12);
  --head: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--head); line-height: 1.05; margin: 0 0 0.4em; }
h2 { font-size: clamp(2.1rem, 4.5vw, 3.2rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }

.eyebrow {
  font-family: var(--head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  color: var(--pink);
  margin-bottom: 0.5em;
}

/* Cabecera */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(16px, 4vw, 48px);
  background: rgba(251, 246, 236, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(43, 17, 64, 0.08);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { height: 52px; width: auto; }
.brand-word {
  font-family: var(--head);
  font-weight: 800;
  font-size: 1.9rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.nav { display: flex; gap: clamp(10px, 2.5vw, 28px); font-weight: 700; }
.nav a { text-decoration: none; padding: 6px 2px; border-bottom: 3px solid transparent; }
.nav a:hover, .nav a:focus-visible { border-color: var(--yellow); }

/* Portada */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: clamp(16px, 4vw, 56px);
  padding: clamp(32px, 6vw, 88px) clamp(16px, 5vw, 72px) clamp(40px, 6vw, 96px);
  max-width: 1280px;
  margin: 0 auto;
}
.hero::before, .hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(2px);
}
.hero::before { width: 340px; height: 260px; background: var(--teal); opacity: 0.18; left: -120px; top: -60px; }
.hero::after { width: 380px; height: 300px; background: var(--pink); opacity: 0.16; right: -140px; bottom: -40px; }
.hero h1 { font-size: clamp(2.6rem, 6.2vw, 4.6rem); }
.hero h1 span { color: var(--purple); }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--ink-soft); max-width: 34em; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 18px; }
.btn {
  display: inline-block;
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary { background: var(--yellow); box-shadow: 0 5px 0 var(--ink); }
.btn-ghost { background: var(--paper); box-shadow: 0 5px 0 var(--ink); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }

.badge-soon {
  display: inline-block;
  background: var(--paper);
  border: 2px dashed var(--purple);
  color: var(--purple);
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 0.95rem;
}

.hero-art { position: relative; min-height: 420px; }
.hero-sapo {
  position: relative;
  z-index: 2;
  width: min(78%, 400px);
  margin: 0 auto;
  filter: drop-shadow(0 18px 18px rgba(43, 17, 64, 0.18));
  animation: bob 3.2s ease-in-out infinite;
}
.hero-side {
  position: absolute;
  z-index: 1;
  width: 34%;
  bottom: 0;
  filter: drop-shadow(0 10px 12px rgba(43, 17, 64, 0.15));
}
.hero-left { left: 0; transform: rotate(-8deg); animation: bob 3.6s ease-in-out -1s infinite; }
.hero-right { right: 0; transform: rotate(7deg); animation: bob 3.9s ease-in-out -2s infinite; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@media (prefers-reduced-motion: reduce) { .hero-sapo, .hero-side { animation: none; } }

/* El Chisme */
.game { padding: clamp(24px, 5vw, 64px) clamp(16px, 5vw, 72px); }
.game-card {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 4vw, 56px);
  align-items: center;
  background: var(--ink);
  color: var(--cream);
  border-radius: 32px;
  padding: clamp(24px, 4.5vw, 56px);
  box-shadow: var(--shadow);
}
.game-card h2 { color: var(--yellow); font-size: clamp(2.6rem, 6vw, 4rem); }
.game-card .eyebrow { color: #ff8db4; }
.game-card em { color: #ffe08a; font-style: normal; font-weight: 700; }
.facts { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.facts li { background: rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 8px 16px; }
.facts strong { color: var(--yellow); }

.game-art { margin: 0; }
.tv-frame {
  background: #120719;
  border-radius: 20px;
  padding: 12px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
  aspect-ratio: 16 / 10;
}
.tv-screen {
  height: 100%;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 30%, #fff6e2, #f3e1bf);
  color: var(--ink);
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  padding: 4% 6%;
  overflow: hidden;
}
.tv-q { font-family: var(--head); font-weight: 800; text-align: center; font-size: clamp(0.95rem, 1.8vw, 1.35rem); margin: 0; }
.tv-screen img { height: 100%; min-height: 0; object-fit: contain; }
.tv-votes { margin: 0; font-weight: 800; background: var(--teal); color: #fff; border-radius: 999px; padding: 2px 14px; font-size: 0.9rem; }
.game-art figcaption { margin-top: 10px; font-size: 0.85rem; opacity: 0.7; text-align: center; }

/* Elenco */
.cast, .how { padding: clamp(40px, 6vw, 88px) clamp(16px, 5vw, 72px); max-width: 1280px; margin: 0 auto; }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 36px; }
.section-head p:last-child { color: var(--ink-soft); font-size: 1.1rem; }
.cast-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.cast-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 16px 16px 18px;
  box-shadow: var(--shadow);
  border-top: 8px solid var(--tint);
  text-align: center;
  transition: transform 0.2s ease;
}
.cast-card:hover { transform: translateY(-4px) rotate(-1deg); }
.cast-img {
  aspect-ratio: 1;
  border-radius: 16px;
  background: color-mix(in srgb, var(--tint) 18%, #fff);
  display: grid;
  place-items: center;
  padding: 8px;
  margin-bottom: 12px;
}
.cast-img img { max-height: 100%; width: auto; object-fit: contain; }
.cast-card h3 { margin-bottom: 0.25em; }
.cast-card p { font-size: 0.95rem; color: var(--ink-soft); margin: 0; }
.noscript { text-align: center; }

/* Pasos */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.steps li { background: var(--paper); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); position: relative; }
.step-n {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-family: var(--head);
  font-weight: 800;
  font-size: 1.5rem;
  margin-bottom: 12px;
}
.steps li:nth-child(2) .step-n { background: var(--pink); }
.steps li:nth-child(3) .step-n { background: var(--teal); }
.steps p { color: var(--ink-soft); margin: 0; }

/* Pie */
.foot { background: var(--ink); color: var(--cream); text-align: center; padding: 40px 16px 48px; margin-top: 40px; }
.foot-brand { font-family: var(--head); font-weight: 800; font-size: 2rem; color: var(--yellow); margin: 0; }
.foot-small { font-size: 0.85rem; opacity: 0.65; margin: 0; }

/* Tablet */
@media (max-width: 960px) {
  .cast-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Accesibilidad: enlace para saltar al contenido */
.skip { position: absolute; left: -999px; top: 8px; z-index: 20; background: var(--yellow); padding: 8px 14px; border-radius: 10px; font-weight: 700; }
.skip:focus { left: 8px; }

/* Idioma y boton Jugar en la cabecera */
.top-actions { display: flex; align-items: center; gap: 12px; }
.lang { display: inline-flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--paper); }
.lang button {
  font: 700 0.9rem var(--body);
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 6px 12px;
  cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.lang button:focus-visible { outline: 3px solid var(--pink); outline-offset: -3px; }
.btn-small { font-size: 1rem; padding: 7px 18px; box-shadow: 0 4px 0 var(--ink); }
.btn-play { background: var(--pink); color: #fff; }
.btn.on-dark { margin-top: 24px; border-color: var(--yellow); box-shadow: 0 5px 0 #000; color: var(--ink); }
.btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }

/* Expresiones de El Sapo en la portada */
.hero-sapo { transition: opacity 0.18s ease, scale 0.18s ease; }
.hero-sapo.swap { opacity: 0; scale: 0.94; }

/* Aparicion suave de secciones (solo con JavaScript) */
.js .reveal { opacity: 0; translate: 0 24px; transition: opacity 0.6s ease, translate 0.6s ease; }
.js .reveal.visible { opacity: 1; translate: 0 0; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; translate: none; transition: none; } }

/* Llamada final para jugar */
.play { padding: clamp(24px, 5vw, 64px) clamp(16px, 5vw, 72px); }
.play-card {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: clamp(16px, 4vw, 40px);
  align-items: center;
  background: linear-gradient(135deg, var(--yellow), #ffdf7a);
  border: 3px solid var(--ink);
  border-radius: 32px;
  padding: clamp(24px, 4vw, 44px);
  box-shadow: 0 8px 0 var(--ink);
}
.play-sapo { width: 100%; filter: drop-shadow(0 10px 10px rgba(43, 17, 64, 0.2)); }
.play-closed {
  background: var(--paper);
  border: 2px dashed var(--purple);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 700;
  color: var(--purple);
}
.game-open .play-closed { display: none; }
.play-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.play-option { background: rgba(255, 253, 248, 0.85); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
.play-option h3 { margin: 0; }
.play-option p { margin: 0; color: var(--ink-soft); }
.play-option .btn { margin-top: auto; text-align: center; }
.play-option .btn-primary { background: var(--pink); color: #fff; }
#room-code {
  font: 800 1.4rem var(--head);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.code-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.code-buttons .btn { flex: 1 1 140px; cursor: pointer; }
.code-error { color: #b0103f; font-weight: 700; margin: 0; }
.btn:disabled, .btn[aria-disabled="true"], #room-code:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: 0 5px 0 var(--ink); }
.sr-only, .brand.logo-completo .brand-word {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.tv-tag {
  position: absolute; top: 10px; left: 10px;
  font: 700 0.75rem var(--body); text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--ink); color: var(--cream); padding: 2px 8px; border-radius: 6px;
}
.tv-screen { position: relative; }

@media (max-width: 960px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
}

/* Celular: cabecera de una sola fila con el boton Jugar bien visible */
@media (max-width: 720px) {
  .top { padding: 8px 16px; gap: 8px; }
  .nav { display: none; }
  .brand-word { font-size: 1.5rem; }
  .brand-logo { height: 36px; }
  .top-actions { gap: 8px; }
  .lang button { padding: 5px 9px; font-size: 0.85rem; }
  .btn-small { font-size: 1.05rem; padding: 7px 20px; }

  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 12px; gap: 8px; }
  .hero h1 { font-size: 2.3rem; }
  .hero .lead { margin-inline: auto; font-size: 1rem; }
  .hero-art { min-height: 0; height: 210px; order: -1; max-width: 300px; width: 100%; margin: 0 auto; }
  .hero-sapo { width: auto; height: 100%; }
  .cta-row { justify-content: center; margin: 18px 0 14px; }
  .cta-row .btn { flex: 1 1 100%; text-align: center; }

  .game-card { grid-template-columns: 1fr; border-radius: 24px; }
  .cast-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cast-card { padding: 12px 10px 14px; }
  .cast-card h3 { font-size: 1.1rem; }
  .cast-card p { font-size: 0.85rem; }
  .steps { grid-template-columns: 1fr; }

  .play-card { grid-template-columns: 1fr; text-align: center; }
  .play-sapo { width: 140px; margin: 0 auto; }
  .play-options { grid-template-columns: 1fr; }
}
/* Ajustes finales */
.tv-screen { padding-top: 7%; }
.tv-tag { top: 8px; left: auto; right: 10px; }
.code-buttons .btn { flex: 1 1 100%; font-size: 1rem; padding: 10px 16px; }
.tv-screen { grid-template-rows: auto auto 1fr auto; padding-top: 3%; }
.tv-tag { position: static; justify-self: center; margin-bottom: 4px; }
