:root {
  color-scheme: light;
  --navy: #1b1a6e;
  --indigo: #4a3bd6;
  --ink: #1d1b4f;
  --muted: #5d5a8a;
  --bg: #eef0ff;
  --card: #ffffff;
  --line: #d9dcf5;
  --ok: #1fa64a;
  --near: #f2a20c;
  --bad: #e23b3b;
  --yellow: #ffd21f;
  --pitch: #1e9a3a;
  --lime: #4fd65a;
  --font: "Baloo 2", ui-rounded, "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--navy);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font-family: inherit; }
button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ------------------------------ Juego ------------------------------ */
#app { height: 100%; display: flex; flex-direction: column; max-width: 1100px; margin: 0 auto; background: var(--bg); }
.stage { position: relative; flex: 0 0 auto; height: 47vh; min-height: 250px; max-height: 520px; background: #241f7a; overflow: hidden; }
#cv { display: block; width: 100%; height: 100%; }
.panel {
  flex: 1 1 auto; overflow-y: auto; padding: 12px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(180deg, #e6e8ff, var(--bg) 120px);
}
@media (min-aspect-ratio: 5/4) {
  #app { flex-direction: row; }
  .stage { flex: 1 1 56%; height: 100%; max-height: none; }
  .panel { flex: 1 1 44%; justify-content: center; }
}

/* Barra de arriba */
.bar {
  position: absolute; top: calc(6px + env(safe-area-inset-top, 0px)); left: 6px; right: 6px;
  display: flex; align-items: center; gap: 6px; padding: 5px;
  border-radius: 20px; background: linear-gradient(180deg, #ffe45c, #ffc61a);
  box-shadow: 0 4px 0 #d79a00, 0 6px 14px rgba(10, 8, 60, .35);
}
.bar-btn {
  flex: 0 0 auto; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: #fff; color: var(--ink); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .15);
}
.bar-btn svg { width: 22px; height: 22px; }
.bar-t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.05; }
.bar-t b { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-t span { font-size: 13px; font-weight: 700; color: #6b4b00; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score {
  flex: 0 0 auto; display: grid; grid-template-columns: auto auto auto; align-items: center; column-gap: 5px; row-gap: 3px;
  padding: 3px 9px; border-radius: 14px; background: var(--navy); color: #fff; font-weight: 800; line-height: 1;
}
.score:empty { display: none; }
.score .tm { font-size: 11px; letter-spacing: .03em; opacity: .9; display: flex; align-items: center; gap: 4px; }
.score .tm i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.score .n { font-size: 18px; text-align: right; }
.score .pips { display: flex; gap: 3px; }
.pips i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .25); }
.pips i.gol { background: var(--lime); }
.pips i.fail { background: var(--bad); }
.pips i.cur { box-shadow: 0 0 0 2px var(--yellow); }
.score.solo { grid-template-columns: auto; justify-items: center; padding: 4px 9px; }
.score.solo .tm { font-size: 14px; }

/* Tarjeta de pregunta */
.meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.turn { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 12px; color: #fff; background: var(--indigo); }
.turn.keep { background: #e2408a; }
.cat { border-radius: 999px; padding: 3px 12px; font-size: 14px; color: #fff; background: var(--c, var(--indigo)); white-space: nowrap; }
.timer { height: 12px; border-radius: 99px; background: #dcdcf4; overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #ff4f6d, #ffb43c 45%, #3ed16a); transform-origin: left; }
.timer.hurry i { animation: blink .4s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }
.q { margin: 2px 0 0; font-size: clamp(21px, 5.4vw, 30px); line-height: 1.15; font-weight: 800; text-wrap: balance; }
.say {
  float: right; margin: 0 0 4px 8px; width: 46px; height: 46px; border: 0; border-radius: 50%; font-size: 22px; cursor: pointer;
  background: #fff; box-shadow: 0 3px 0 var(--line), inset 0 0 0 3px var(--line);
}
.say:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line), inset 0 0 0 3px var(--line); }
.q .big { display: block; margin-top: 4px; font-size: 1.4em; color: var(--indigo); letter-spacing: .01em; word-break: break-word; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt {
  position: relative; min-height: 64px; border: 3px solid var(--line); border-radius: 18px; background: var(--card);
  color: var(--ink); font: 800 clamp(17px, 4.6vw, 23px)/1.1 var(--font); padding: 8px 8px 8px 34px; cursor: pointer;
  box-shadow: 0 5px 0 var(--line); touch-action: manipulation; text-align: center;
  animation: pop .28s cubic-bezier(.3, 1.6, .5, 1) both;
}
.opt:nth-child(2) { animation-delay: .04s; } .opt:nth-child(3) { animation-delay: .08s; } .opt:nth-child(4) { animation-delay: .12s; }
.opt::before {
  content: attr(data-l); position: absolute; left: 7px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  font-size: 14px; color: #fff; background: var(--lc);
}
.opt[data-l="A"] { --lc: #4a3bd6; } .opt[data-l="B"] { --lc: #e2408a; } .opt[data-l="C"] { --lc: #14a37f; } .opt[data-l="D"] { --lc: #e8850c; }
.opt:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.opt:disabled { cursor: default; }
.opt.ok { background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 5px 0 #157a35; }
.opt.near { background: var(--near); border-color: var(--near); color: #fff; box-shadow: 0 5px 0 #b77800; }
.opt.bad { background: var(--bad); border-color: var(--bad); color: #fff; box-shadow: 0 5px 0 #a32727; }
.opt.ok::before, .opt.near::before, .opt.bad::before { background: rgba(255, 255, 255, .3); }
.opt.dim { opacity: .45; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.fb { border-radius: 16px; padding: 10px 14px; font-weight: 700; font-size: 17px; line-height: 1.3; animation: pop .25s ease-out both; }
.fb b { display: block; font-size: 21px; }
.fb.good { background: #defbe6; color: #0f5f2a; }
.fb.meh { background: #fff1d3; color: #7a4b00; }
.fb.bad { background: #fde4e4; color: #8a1d1d; }

.btn {
  border: 0; border-radius: 18px; padding: 12px 18px; min-height: 58px; background: var(--indigo); color: #fff;
  font: 800 21px var(--font); box-shadow: 0 5px 0 #2f2496; cursor: pointer; touch-action: manipulation;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #2f2496; }
.btn.gold { background: linear-gradient(180deg, #ffe45c, #ffc61a); color: var(--ink); box-shadow: 0 5px 0 #d79a00; }
.btn.gold:active { box-shadow: 0 2px 0 #d79a00; }
.btn.alt { background: #fff; color: var(--ink); box-shadow: 0 5px 0 var(--line); border: 3px solid var(--line); }
.btn.alt:active { box-shadow: 0 2px 0 var(--line); }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row .btn { flex: 1 1 140px; font-size: 19px; }
.row .btn.wide { flex-basis: 100%; }
h2 { margin: 0; font-size: clamp(26px, 7vw, 36px); line-height: 1.02; font-weight: 800; }
.lede { margin: 0; font-size: 17px; line-height: 1.35; color: var(--muted); font-weight: 600; }
.note { margin: 0; font-size: 15px; color: var(--muted); font-weight: 600; }
.stars { display: flex; gap: 6px; }
.stars i, .mstars i {
  width: 44px; height: 44px; display: inline-block;
  background: var(--yellow); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  animation: starIn .45s cubic-bezier(.3, 1.8, .5, 1) both;
}
.stars i:nth-child(2) { animation-delay: .15s; } .stars i:nth-child(3) { animation-delay: .3s; }
.stars i.off, .mstars i.off { background: #cfd2ea; }
@keyframes starIn { from { transform: scale(0) rotate(-40deg); } }
.tally { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tally div { border-radius: 14px; padding: 8px; text-align: center; font-weight: 700; color: #fff; }
.tally b { display: block; font-size: 28px; line-height: 1; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; font-weight: 800; }
.vs .team { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 16px; line-height: 1.1; }
.vs .vsx { font-size: 26px; color: var(--muted); }
.vs .big { font-size: 44px; line-height: 1; }
.shirt { width: 54px; height: 50px; }
.how { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-weight: 700; font-size: 16px; line-height: 1.3; }
.how li { display: flex; gap: 8px; align-items: flex-start; background: #fff; border-radius: 14px; padding: 8px 10px; }
.how li span { font-size: 20px; }
.reto-how { margin: 0; font-size: 14px; color: var(--muted); font-weight: 700; text-align: center; }
@media (prefers-reduced-motion: reduce) {
  .opt, .fb, .stars i, .mstars i { animation: none; }
  .opt:active, .btn:active { transform: none; }
}

/* ------------------------------ Menú ------------------------------ */
.menu {
  position: fixed; inset: 0; overflow-y: auto; color: #fff; z-index: 5;
  background:
    radial-gradient(160px 160px at 6% 0, rgba(255, 251, 224, .5), transparent 70%),
    radial-gradient(160px 160px at 94% 0, rgba(255, 251, 224, .5), transparent 70%),
    linear-gradient(180deg, #15135a 0, #3b2fc0 600px, #1f7a6a 1000px, #1e7a33 1300px, #1e7a33 100%);
  background-attachment: local;
}
.menu-in { max-width: 640px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px calc(26px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
.m-top { display: flex; justify-content: space-between; gap: 8px; }
.chip {
  border: 0; border-radius: 999px; padding: 4px 14px; min-height: 40px; background: rgba(255, 255, 255, .95); color: var(--ink);
  font: 800 15px var(--font); box-shadow: 0 3px 0 rgba(0, 0, 0, .2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip svg { width: 20px; height: 20px; }
.logo { display: block; width: min(64vw, 260px); height: auto; margin: -4px auto -10px; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .35)); }
.logo .spin { transform-origin: 130px 92px; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .logo .spin { animation: none; } }
.menu h1 {
  margin: 0; text-align: center; font-size: clamp(44px, 13vw, 66px); line-height: .92; font-weight: 800; color: #fff;
  -webkit-text-stroke: 9px #120f4a; paint-order: stroke fill; text-shadow: 0 6px 0 #120f4a;
}
.menu h1 span { color: var(--yellow); }
.m-lede { margin: 0; text-align: center; font-size: 17px; line-height: 1.3; font-weight: 700; color: #e8e6ff; }
.m-row { display: flex; gap: 10px; }
.m-row .btn { flex: 1 1 0; }
.menu .reto-how { color: #e8e6ff; }
.m-sec { background: rgba(9, 8, 52, .42); border-radius: 22px; padding: 12px; display: flex; flex-direction: column; gap: 10px; backdrop-filter: blur(2px); }
.m-sec h3 { margin: 0; display: flex; justify-content: space-between; align-items: center; font-size: 22px; line-height: 1; }
.m-sec h3 small { font-size: 16px; background: rgba(0, 0, 0, .3); border-radius: 999px; padding: 4px 10px; }
.m-sub { margin: -4px 0 0; font-size: 14px; font-weight: 700; color: #d6d3ff; }
.cup { border-radius: 18px; padding: 10px; background: var(--cupbg); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18); }
.cup.locked { filter: saturate(.35) brightness(.8); }
.cup-h { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; margin-bottom: 8px; }
.cup-h .ic { font-size: 24px; }
.cup-h .tr { margin-left: auto; font-size: 22px; }
.matches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.match {
  position: relative; border: 0; border-radius: 16px; padding: 8px 4px 6px; background: linear-gradient(180deg, #fff, #ecebff); color: var(--ink);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .25); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 102px;
}
.match:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.match .shirt { width: 34px; height: 32px; }
.match b { font-size: 14px; line-height: 1.05; text-align: center; }
.match small { font-size: 12px; font-weight: 700; color: var(--muted); line-height: 1; }
.match.next { box-shadow: 0 0 0 4px var(--yellow), 0 4px 0 rgba(0, 0, 0, .25); animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px var(--yellow), 0 0 22px 4px rgba(255, 210, 31, .65); } }
.match:disabled { cursor: default; background: rgba(255, 255, 255, .25); color: #fff; box-shadow: none; }
.match:disabled small { color: #e8e6ff; }
.match .lock { font-size: 26px; line-height: 32px; }
.mstars { display: flex; gap: 2px; }
.mstars i { width: 16px; height: 16px; animation: none; }
.subjects { display: flex; flex-wrap: wrap; gap: 6px; }
.subj {
  border: 0; border-radius: 999px; padding: 6px 12px; min-height: 40px; font: 800 15px var(--font); cursor: pointer;
  background: rgba(255, 255, 255, .16); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
}
.subj.on { background: #fff; color: var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.kits { display: flex; gap: 10px; flex-wrap: wrap; }
.kit { border: 0; width: 48px; height: 46px; border-radius: 14px; padding: 4px; background: rgba(255, 255, 255, .14); cursor: pointer; }
.kit svg { width: 100%; height: 100%; }
.kit.on { background: #fff; box-shadow: 0 0 0 3px var(--yellow); }
.ages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ages .btn { padding: 8px 4px; font-size: 26px; min-height: 56px; }
.ages .btn small { display: block; font-size: 12px; font-weight: 700; opacity: .85; line-height: 1; }
.m-foot { text-align: center; font-size: 14px; font-weight: 700; color: #cfeccf; margin: 0; }

/* Rediseño nov. 2026: ilustración de plastilina (balón portero) en lugar del logo dibujado. */
.logo.arte { width: min(88vw, 360px); margin: -6px auto -18px; filter: none; }
@media (orientation: landscape) and (max-height: 500px) { .logo.arte { width: auto; height: 26vh; } }
