/* Torneo "Diego, más viejo que un bosque" · estilos compartidos (landing + app). Sin estilos en línea (CSP). */
:root {
  --bg0: #0a1b33;
  --bg1: #14396b;
  --card: #12294a;
  --line: #23406b;
  --line2: #3a5c8f;
  --muted: #8fa3c2;
  --text: #f4f7fb;
  --lime: #d6ff3d;
  --ink: #0a1b33;
  --coral: #ff6b4a;
  --coral2: #ff8c70;
  --nav: #0d2342;
  --display: 'Bricolage Grotesque', 'Manrope', system-ui, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg0);
  background-image: radial-gradient(120% 50% at 50% 0%, var(--bg1) 0%, var(--bg0) 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input { font-family: var(--body); }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.display { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; }
.lime { color: var(--lime); }
.muted { color: var(--muted); }

/* ---------- landing ---------- */
.hero { position: relative; max-width: 480px; margin: 0 auto; height: 100vh; height: 100dvh; min-height: 560px; overflow: hidden; }
.hero-top { position: absolute; left: 24px; right: 24px; top: 52px; z-index: 2; pointer-events: none; }
.pill {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lime);
}
.hero h1 { margin: 14px 0 0; font-family: var(--display); font-weight: 800; font-size: 42px; line-height: 1.02; letter-spacing: -0.02em; }
.stage { position: absolute; left: 0; right: 0; top: 170px; bottom: 96px; }
.stage canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: none; }
.hint { position: absolute; right: 24px; bottom: 112px; margin: 0; padding: 6px 12px; border-radius: 14px; background: rgba(10, 27, 51, 0.72); text-align: right; font-size: 14px; line-height: 1.35; font-weight: 700; color: var(--text); pointer-events: none; max-width: 190px; }
.hint b { color: var(--lime); font-family: var(--display); font-size: 18px; }
.cta {
  position: absolute; left: 24px; right: 24px; bottom: 28px; z-index: 3;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; border-radius: 28px; background: var(--lime); color: var(--ink);
  font-family: var(--display); font-weight: 800; font-size: 18px;
}
.cta svg, .btn svg { flex: none; }

/* ---------- app ---------- */
.shell { position: relative; max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.screen { position: relative; padding: 56px 24px 120px; }
.screen.nonav { padding-bottom: 190px; }
.back { position: absolute; left: 12px; top: 40px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; color: var(--text); background: none; border: 0; }
.screen.has-back { padding-top: 96px; }

.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lime); }
.title { margin: 6px 0 0; font-family: var(--display); font-weight: 800; font-size: 38px; line-height: 1; letter-spacing: -0.02em; }
.title.sm { font-size: 36px; line-height: 1.05; }
.lead { margin: 6px 0 0; font-size: 15px; line-height: 1.4; color: var(--muted); }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.badge { flex: none; height: 32px; padding: 0 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); display: flex; align-items: center; font-size: 13px; font-weight: 800; }

.tabs { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.tab { flex: 1 1 0; min-width: 72px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 13px; font-weight: 700; padding: 0 10px; }
.tab.on { background: var(--lime); border-color: var(--lime); color: var(--ink); font-weight: 800; }
.tab.off { color: var(--muted); }

.card { border-radius: 20px; background: var(--card); border: 1px solid var(--line); }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }

/* tablas de grupo */
.tbl { padding: 12px 0 2px; }
.tbl-head { display: flex; justify-content: space-between; align-items: center; padding: 0 16px 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.tbl-head .cols { display: flex; gap: 4px; }
.tbl-head .cols span:first-child { width: 28px; text-align: center; }
.tbl-head .cols span:last-child { width: 40px; text-align: right; }
.row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 18px 28px 40px; align-items: center; column-gap: 10px; min-height: 52px; padding: 0 16px; border-top: 1px solid var(--line); }
.row.me { background: rgba(214, 255, 61, 0.1); }
.row.rep { opacity: 0.75; }
.rank { font-family: var(--display); font-weight: 800; font-size: 18px; color: var(--muted); }
.rank.top { color: var(--lime); }
.pname { font-size: 16px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.me .pname { font-weight: 800; }
.psub { font-size: 12px; font-weight: 500; line-height: 1.3; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.psub.lime { color: var(--lime); font-weight: 700; }
.tag { font-size: 11px; font-weight: 700; color: var(--coral2); }
.v { text-align: center; font-family: var(--display); font-weight: 800; font-size: 20px; }
.dif { text-align: right; font-size: 15px; font-weight: 800; color: #c9d6ea; }
.dif.pos { color: var(--lime); }
.dif.neg { color: var(--coral2); }
.mv { display: flex; align-items: center; justify-content: center; }

.legend { display: flex; gap: 16px; margin-top: 16px; font-size: 12px; font-weight: 700; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.note { margin: 14px 0 0; font-size: 12px; line-height: 1.4; font-weight: 700; color: var(--muted); }
.section { margin: 24px 0 0; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* partidos */
.matches { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.match { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 12px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.match.next { border: 1.5px solid var(--lime); }
.match.dim { opacity: 0.7; }
.mnum { flex: none; width: 32px; height: 32px; border-radius: 16px; border: 2px solid var(--line2); color: var(--muted); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 15px; }
.match.next .mnum { border-color: var(--lime); color: var(--lime); }
.mnum.done { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.mteams { flex: 1; min-width: 0; font-size: 15px; line-height: 1.35; }
.mteams b { display: block; font-weight: 800; }
.mteams span { display: block; color: var(--muted); font-weight: 700; }
.mscore { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.01em; white-space: nowrap; }
.mbtn { flex: none; height: 36px; padding: 0 14px; border-radius: 18px; background: var(--lime); color: var(--ink); display: flex; align-items: center; font-size: 13px; font-weight: 800; }
.mwait { font-size: 13px; font-weight: 700; color: var(--muted); }
a.match { color: var(--text); }

/* marcador */
.sc { position: relative; padding: 18px 20px; height: 208px; display: flex; flex-direction: column; justify-content: space-between; border-radius: 24px; background: var(--card); border: 1px solid var(--line); }
.sc.mine { border: 1.5px solid var(--lime); }
.sc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sc-head b { font-size: 18px; font-weight: 800; }
.sc-head span { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.sc.mine .sc-head span { color: var(--lime); }
.sc-body { display: flex; align-items: center; justify-content: space-between; }
.num { font-family: var(--display); font-weight: 800; font-size: 96px; line-height: 1; min-width: 110px; text-align: center; }
.sc.mine .num { color: var(--lime); }
.step { width: 64px; height: 64px; border-radius: 32px; border: 1.5px solid var(--line2); background: var(--bg0); color: var(--text); display: flex; align-items: center; justify-content: center; }
.step.plus { border: 0; background: var(--text); color: var(--ink); }
.sc.mine .step.plus { background: var(--lime); }
.vs { position: relative; z-index: 2; width: 44px; height: 44px; margin: -22px auto; border-radius: 22px; background: var(--bg0); border: 1.5px solid var(--line2); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 15px; color: var(--muted); }

/* botones, formularios */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 56px; border: 0; border-radius: 28px; background: var(--lime); color: var(--ink); font-family: var(--display); font-weight: 800; font-size: 18px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.outline { background: transparent; border: 1.5px solid var(--lime); color: var(--lime); font-family: var(--body); font-size: 14px; height: 52px; border-radius: 26px; }
.btn.small { height: 44px; font-size: 14px; border-radius: 22px; font-family: var(--body); width: auto; padding: 0 18px; }
.btn.ghost { background: transparent; color: var(--muted); font-family: var(--body); font-size: 13px; height: 44px; width: auto; padding: 0 12px; text-decoration: underline; }
.dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(100%, 480px); padding: 12px 24px 24px; z-index: 5; background: linear-gradient(to top, var(--bg0) 60%, rgba(10, 27, 51, 0)); }
.dock .row2 { display: flex; gap: 10px; }
.dock .row2 .btn { width: auto; flex: 1; font-size: 17px; height: 52px; border-radius: 26px; }
.dock .row2 .btn.outline { flex: 0 0 140px; }
.field { display: block; min-width: 0; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.input { width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line2); background: var(--bg0); color: var(--text); padding: 0 14px; font-size: 16px; font-weight: 700; }
.input[disabled] { opacity: 0.6; }
.input.pin { letter-spacing: 0.2em; font-size: 18px; font-weight: 800; }
.fields { display: flex; gap: 10px; margin-top: 18px; }
.fields .field:first-child { flex: 1; }
.fields .field.narrow { width: 104px; }
.msg { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 700; line-height: 1.35; }
.msg.err { background: rgba(255, 107, 74, 0.14); border: 1px solid var(--coral2); color: #ffd0c5; }
.msg.ok { background: rgba(214, 255, 61, 0.1); border: 1px solid var(--lime); color: var(--text); }

/* jugadores (login y selector) */
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 20px; }
.chip { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); display: flex; align-items: center; gap: 10px; padding: 0 10px; font-size: 15px; font-weight: 700; text-align: left; min-width: 0; }
.chip.on { background: var(--lime); border-color: var(--lime); color: var(--ink); font-weight: 800; }
.chip.span2 { grid-column: 1 / -1; border-color: var(--line2); }
.chip .av { flex: none; width: 26px; height: 26px; border-radius: 13px; background: var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.chip.on .av { background: var(--ink); color: var(--lime); }
.chip.span2 .av { background: var(--bg0); border: 1.5px solid var(--lime); color: var(--lime); }
.chip .lock { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--lime); }
.chip.span2.on .lock { color: var(--ink); }
.pick { min-height: 52px; height: auto; padding: 6px 12px; justify-content: space-between; border-radius: 12px; }
.pick.on { background: rgba(214, 255, 61, 0.12); border: 1.5px solid var(--lime); color: var(--text); }
.pick b { display: block; font-size: 14px; font-weight: 700; line-height: 1.2; }
.pick.on b { font-weight: 800; }
.pick small { display: block; font-size: 11px; font-weight: 500; line-height: 1.2; color: var(--muted); }
.pick .ok { color: var(--lime); }
.summary { margin: 16px 0 0; font-size: 13px; line-height: 1.35; font-weight: 700; color: var(--muted); }

/* panel admin */
.info { display: flex; align-items: center; gap: 10px; min-height: 52px; margin-top: 20px; padding: 8px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--coral2); font-size: 13px; line-height: 1.3; font-weight: 700; }
.info.good { border-color: var(--lime); }
.ggrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.gcard { padding: 0 10px 6px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); min-width: 0; }
.gcard.warn { border-color: var(--coral2); }
.ghead { display: flex; align-items: center; justify-content: space-between; height: 40px; padding-left: 4px; font-family: var(--display); font-weight: 800; font-size: 16px; }
.gdel { width: 40px; height: 40px; border: 0; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.gp { display: flex; align-items: baseline; gap: 6px; height: 40px; padding: 0 4px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 700; line-height: 40px; overflow: hidden; white-space: nowrap; }
.gp .tag { font-size: 11px; }
.stackbtns { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.plist { margin-top: 10px; padding: 4px 0; }
.prow { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 0 12px 0 16px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.prow:first-child { border-top: 0; }
.prow small { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.addp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; margin-top: 10px; }

/* cuadro */
.sfs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.sf { padding: 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); min-width: 0; }
.sf h3 { margin: 0 0 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.team { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 48px; font-size: 14px; line-height: 1.25; font-weight: 700; color: #c9d6ea; }
.team.win { color: var(--text); font-weight: 800; }
.team div { min-width: 0; }
.sep { height: 1px; background: var(--line); margin: 6px 0; }
.sbox { flex: none; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 8px; background: var(--bg0); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 15px; color: var(--muted); }
.team.win .sbox { color: var(--lime); }
.conn { position: relative; height: 56px; margin: 0 auto; width: 74%; }
.conn::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 28px; border: 2px solid var(--line2); border-bottom: 0; border-radius: 0; }
.conn::after { content: ''; position: absolute; left: 50%; top: 28px; height: 28px; width: 2px; background: var(--line2); }
.final { padding: 16px 18px 20px; border-radius: 24px; background: var(--card); border: 1.5px solid var(--lime); }
.final-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lime); }
.final-head span:last-child { color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 700; }
.fteams { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.ft { flex: 1; min-height: 52px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px 8px; border-radius: 14px; border: 1.5px dashed var(--line2); font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.25; }
.ft.set { border-style: solid; border-color: var(--line); color: var(--text); }
.ft.win { border-color: var(--lime); color: var(--lime); font-weight: 800; }
.champ { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 22px; text-align: center; }
.champ .cup { width: 72px; height: 72px; border-radius: 36px; background: var(--lime); display: flex; align-items: center; justify-content: center; }
.champ .cup.off { background: var(--line); }
.champ b { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; }
.champ .who { font-size: 14px; font-weight: 700; color: var(--lime); }
.sform { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.sform .input { height: 40px; padding: 0 8px; text-align: center; font-size: 15px; }
.sform .btn { height: 40px; font-size: 13px; }
.empty { margin-top: 24px; padding: 20px; text-align: center; font-size: 15px; line-height: 1.45; color: var(--muted); }
.empty b { display: block; margin-bottom: 6px; color: var(--text); font-family: var(--display); font-size: 20px; }
.me-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--muted); }
.sub-form { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.sub-form .input { height: 44px; }

/* navegación */
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(100%, 480px); height: 84px; padding: 8px 12px 20px; display: flex; background: var(--nav); border-top: 1px solid var(--line); z-index: 6; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 800; color: var(--muted); }
.nav a.on { color: var(--lime); }

.loading { padding: 120px 24px; text-align: center; color: var(--muted); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.actions { display: flex; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1; width: auto; font-size: 16px; height: 52px; border-radius: 26px; }
.actions .btn.outline { flex: 0 0 140px; font-size: 14px; }

.coral { color: var(--coral2); }
.legend .lime, .legend .coral { display: inline-flex; align-items: center; gap: 6px; }
.champ .cup { color: var(--ink); }
.pair { margin-top: 20px; }
.mt { margin-top: 20px; }
