/* ============================================================
   OothecaGames — sistema de diseño "Nocturne" (Claude Design)
   Tema oscuro por defecto: azul noche #141370, dorado #F6C21A,
   crema #F6F2E8, Playfair Display + Poppins. Tema claro
   conmutable vía [data-theme="light"] en <html>.
   Las tarjetas conservan el borde grueso con sombra dura del
   diseño clásico (petición expresa de Amin).
   ============================================================ */

:root {
  /* Tokens Nocturne (oscuro, por defecto) */
  --ground: #141370;
  --ground-2: #1e1c92;
  --text: #f6f2e8;
  --muted: rgba(246, 242, 232, 0.72);
  --accent: #f6c21a;
  --accent-2: #ffda6b;
  --on-accent: #141370;
  --surface: #1b1a85;
  --surface-soft: rgba(246, 242, 232, 0.055);
  --line: rgba(246, 242, 232, 0.2);
  --control-line: rgba(246, 242, 232, 0.3);
  --card-line: var(--accent);
  --shadow-col: rgba(0, 0, 0, 0.45);
  --green: #8fe3b0;
  --red: #ff7a6b;
  --purple: #c07ce0;

  /* Variables heredadas del diseño clásico, re-mapeadas al tema.
     Los estilos de cada juego las usan; cambian con el tema. */
  --blue: var(--accent);       /* titulares y protagonistas → dorado */
  --navy: #0e0d52;             /* paneles oscuros (forbidden, etc.) */
  --yellow: var(--accent);
  --yellow-2: var(--accent-2);
  --ink: var(--text);
  --bg: var(--ground);
  --white: var(--surface);

  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Poppins", Helvetica, Arial, sans-serif;

  --shadow: 6px 6px 0 var(--shadow-col);
  --shadow-sm: 3px 3px 0 var(--shadow-col);
  --border: 2.5px solid var(--card-line);
  --radius: 20px;
  --radius-ctl: 14px;
}

html[data-theme="light"] {
  --ground: #faf5e9;
  --ground-2: #fdfaf2;
  --text: #141370;
  --muted: rgba(20, 19, 112, 0.72);
  --on-accent: #141370;
  --surface: #ffffff;
  --surface-soft: rgba(20, 19, 112, 0.045);
  --line: rgba(20, 19, 112, 0.22);
  --control-line: rgba(20, 19, 112, 0.55);
  --card-line: #141370;
  --shadow-col: #141370;
  --green: #0a9944;
  --red: #d9331f;

  --blue: #1a1ab8;
  --navy: #141370;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 620px at 8% -10%, var(--ground-2), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, var(--ground-2), transparent 55%),
    var(--ground);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  /* Ojo: transicionar el atajo "background" con degradados + var() se
     atasca en Chromium; solo se anima el color de fondo. */
  transition: background-color 0.25s, color 0.25s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
html[data-theme="light"] a { color: var(--blue); }
*:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--on-accent); }

/* ---------- Cabecera de juego ---------- */

.game-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 22px 16px 40px;
  min-height: 100%;
  position: relative;
}

/* Botón de vuelta al panel de juegos (presente en todos los juegos) */
.back-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text);
  background: transparent;
  border: 2px solid var(--control-line);
  border-radius: 999px;
  padding: 8px 15px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
  z-index: 5;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }
.back-arrow { font-size: 14px; line-height: 1; }
@media (max-width: 560px) {
  .back-btn { padding: 8px 11px; }
  .back-label { display: none; }
}

.brand-eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
}
.brand-eyebrow a { color: inherit; text-decoration: none; }
.brand-eyebrow a:hover { color: var(--accent-2); }

.game-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  font-size: clamp(34px, 7.5vw, 58px);
  line-height: 1.02;
  letter-spacing: -1px;
  margin: 10px 0 4px;
}

.game-tagline {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 22px;
}

/* ---------- Botones ----------
   Regla del kit: contorno por defecto; solo la acción principal
   (.btn--big y .btn--blue) va rellena de dorado. */

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text);
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: var(--radius-ctl);
  padding: 11px 22px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.08s;
  text-decoration: none;
  text-align: center;
  min-height: 44px;
}
.btn:hover { background: rgba(246, 194, 26, 0.14); color: var(--text); }
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
html[data-theme="light"] .btn { color: var(--navy); }

.btn--big, .btn--blue {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.btn--big:hover, .btn--blue:hover { background: var(--accent-2); color: var(--on-accent); }
.btn--big { font-size: 17px; padding: 14px 32px; }

.btn--ghost {
  background: transparent;
  border-color: var(--control-line);
  color: var(--muted);
}
.btn--ghost:hover { border-color: var(--text); color: var(--text); background: transparent; }

.btn--small { font-size: 12px; padding: 8px 15px; min-height: 36px; }

/* ---------- Tarjetas y paneles ----------
   Borde grueso + sombra dura: herencia del diseño clásico. */

.card {
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.panel-navy {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
}

/* ---------- Controles de formulario ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
html[data-theme="light"] .field-label { color: var(--navy); }

select.control, input.control {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--control-line);
  border-radius: var(--radius-ctl);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s;
}
select.control:focus, input.control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(246, 194, 26, 0.18);
}
select.control option { background: var(--surface); color: var(--text); }

.controls-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

/* ---------- Temporizador ---------- */

.timer {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: clamp(36px, 8vw, 58px);
  color: var(--text);
  text-align: center;
  line-height: 1;
}
.timer.is-warning { color: var(--red); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* ---------- Marcador de equipos ---------- */

.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 18px 0;
}
.team {
  border: 2px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.team.is-active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.team-name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.team.is-active .team-name { color: var(--on-accent); }
.team-score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 40px;
  color: var(--accent);
  line-height: 1.1;
}
.team.is-active .team-score { color: var(--on-accent); }

/* ---------- Chips / badges ---------- */

.chip {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  background: transparent;
  color: var(--muted);
}
.chip--yellow {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.chip--blue {
  background: rgba(246, 194, 26, 0.16);
  border-color: transparent;
  color: var(--accent);
}
html[data-theme="light"] .chip--blue { background: rgba(20, 19, 112, 0.1); color: var(--navy); }

/* ---------- Feedback ---------- */

.feedback { text-align: center; font-weight: 600; font-size: 16px; min-height: 26px; }
.feedback.ok { color: var(--green); }
.feedback.ko { color: var(--red); }

/* ---------- Utilidades ---------- */

.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; align-items: center; }
.hidden { display: none !important; }
.mt { margin-top: 18px; }

/* Texto grande protagonista (palabra, tema, frase en juego) */
.stage-text {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  font-size: clamp(26px, 5.6vw, 46px);
  line-height: 1.15;
  letter-spacing: -0.5px;
  overflow-wrap: break-word;
}

/* ---------- Conmutador de tema (lo inyecta theme.js) ---------- */

.theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  background: transparent;
  border: 2px solid var(--control-line);
  border-radius: 999px;
  transition: border-color 0.15s;
  z-index: 6;
}
.theme-toggle:hover { border-color: var(--accent); }

/* ---------- Banner de cookies (lo inyecta theme.js) ---------- */

.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 620px;
  margin: 0 auto;
  background: var(--surface);
  border: 2px solid var(--card-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cookie-banner p { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.cookie-banner .row { justify-content: flex-end; }

/* ---------- Pie de página de marca (común a panel y juegos) ---------- */

.site-footer {
  margin-top: 64px;
  padding-top: 22px;
  text-align: center;
  position: relative;
  border-top: 1.5px solid var(--line);
}
.footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}
.footer-sub { font-size: 12.5px; margin-top: 5px; color: var(--muted); }
.footer-sub a, .footer-credit a { font-weight: 600; }
.footer-credit {
  font-size: 11.5px;
  margin-top: 5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

@media (max-width: 480px) {
  .game-shell { padding: 16px 10px 30px; }
  .card { padding: 16px; }
}
