/* 13a0 — estilo vanilla. Tema escuro, estética esports. Custom properties. */
:root {
  --bg: #0c0e14;
  --bg2: #141822;
  --panel: #1a1f2b;
  --panel2: #222837;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #eef1f7;
  --muted: #8a93a6;
  --accent: #ff5c39;       /* laranja CS — reservado p/ CTA e vitória */
  --accent2: #ffb020;
  --green: #36d399;
  --yellow: #f5c542;
  --blue: #4aa8ff;
  --info: #4aa8ff;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, .05), 0 6px 20px rgba(0, 0, 0, .35);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --font: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, sans-serif;
  /* cores de tier (T1 = melhor → cor mais quente) */
  --t1: #ff5c39; --t2: #f5c542; --t3: #a855f7; --t4: #4aa8ff; --t5: #6b7280;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #1a2030 0%, var(--bg) 60%);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, .headline, .reveal h1, .logo, .tagline { text-wrap: balance; }
.avg-big, .scoreboard .score, .pcard .ovr, .stat-num { font-variant-numeric: tabular-nums; }
#app { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; min-height: 100%; }

button { font: inherit; cursor: pointer; border: none; color: inherit; background: none; appearance: none; -webkit-appearance: none; }
.btn {
  background: var(--accent); color: #1a0d08; font-weight: 700;
  padding: 14px 24px; border-radius: var(--radius); transition: transform .12s var(--spring), filter .15s var(--ease);
  letter-spacing: .2px;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--muted); font-weight: 600; padding: 8px 12px; }
.btn.ghost:hover { color: var(--text); }
.btn.secondary { background: var(--panel2); color: var(--text); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* foco visível para teclado (WCAG 2.4.7) */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
:focus:not(:focus-visible) { outline: none; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.brand { font-weight: 900; font-size: 22px; letter-spacing: -1px; }
.brand b { color: var(--accent); }
.langtoggle { display: flex; gap: 4px; }
.langtoggle button { padding: 6px 10px; border-radius: 8px; background: var(--panel); color: var(--muted); font-weight: 700; font-size: 13px; min-height: 40px; min-width: 40px; }
.langtoggle button.on { background: var(--accent); color: #1a0d08; }

/* bandeira como imagem (cross-platform; emoji de bandeira não renderiza no Windows) */
.flag-i {
  width: 22px; height: 16px; border-radius: 3px; object-fit: cover;
  vertical-align: -3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1);
  background: var(--panel2);
}
.flag-x { opacity: .5; }

/* HOME */
.home { text-align: center; min-height: calc(100dvh - 150px); display: flex; flex-direction: column; justify-content: center; }
/* draft centralizado como as demais telas (consistência vertical) */
.draft { min-height: calc(100dvh - 150px); display: flex; flex-direction: column; justify-content: center; }
.draft .section-h:first-child { margin-top: 0; }
.home .logo { font-size: 72px; font-weight: 900; letter-spacing: -4px; }
.home .logo b { color: var(--accent); }
.home .tagline { color: var(--muted); font-size: 18px; margin: 8px 0 36px; }
.home .actions { display: flex; flex-direction: column; gap: 12px; max-width: 360px; margin: 0 auto; }
.home .hint { color: var(--muted); font-size: 13px; margin-top: -4px; }

/* card de jogador */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.pcard {
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; text-align: center; position: relative;
  width: 100%; font: inherit; color: inherit; appearance: none; -webkit-appearance: none;
  box-shadow: var(--shadow-card);
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.pcard .flag, .pcard .nick, .pcard .role { display: block; }
.pcard.click { cursor: pointer; }
.pcard.click:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: 0 14px 34px rgba(0, 0, 0, .5); }
.pcard.disabled { opacity: .5; pointer-events: none; }
.pcard .nick { font-weight: 800; font-size: 18px; }
.pcard .flag { line-height: 0; margin: 4px 0 2px; }
.pcard .role { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.pcard .ovr {
  position: absolute; top: 8px; right: 10px; font-weight: 900; font-size: 20px; color: var(--accent2);
}
.pcard .ovr.hidden { color: var(--muted); background: var(--panel2); border-radius: 6px; padding: 2px 7px; font-size: 15px; }
.pcard.flex .role::after { content: ' ⚡'; }

/* badge de recorte */
.recorte { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.recorte .team { font-weight: 800; font-size: 19px; }
.recorte .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tierbadge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-weight: 800; font-size: 11px; color: #0c0e14; }
.t-T1 { background: var(--t1); } .t-T2 { background: var(--t2); }
.t-T3 { background: var(--t3); } .t-T4 { background: var(--t4); } .t-T5 { background: var(--t5); }

/* line tracker */
.line { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 16px 0; }
.slot { background: var(--bg2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 6px; text-align: center; }
.slot.filled { border-style: solid; border-color: var(--green); background: var(--panel); }
.slot .r { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.slot .n { font-weight: 700; font-size: 14px; margin-top: 4px; }
.slot .n.empty { color: var(--muted); }

.section-h { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 10px; }
.section-h h2 { font-size: 16px; font-weight: 800; letter-spacing: .2px; }

/* REVEAL */
.reveal { text-align: center; min-height: calc(100dvh - 150px); display: flex; flex-direction: column; justify-content: center; }
.reveal h1 { font-size: 36px; font-weight: 700; margin-bottom: 4px; }
.reveal .sub { color: var(--muted); margin-bottom: 20px; }
.avg-big { font-size: 76px; font-weight: 700; color: var(--accent2); line-height: 1; margin: 10px 0; animation: pop .6s var(--spring) both; }
@keyframes pop { from { transform: scale(.55); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.avg-label { color: var(--muted); text-transform: uppercase; letter-spacing: 2px; font-size: 12px; }
@keyframes flip { from { transform: rotateY(90deg); opacity: 0; } to { transform: rotateY(0); opacity: 1; } }
.pcard.reveal-anim { animation: flip .4s ease both; }

/* SIM — jornada vertical (Swiss → playoffs) */
.sim { min-height: calc(100dvh - 150px); display: flex; flex-direction: column; justify-content: center; max-width: 540px; margin: 0 auto; }
.sim-top { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 18px; }
.sim-h { font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--muted); }
.speedctl { display: inline-flex; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.spd { padding: 4px 9px; border-radius: 6px; font-size: 13px; color: var(--muted); min-height: 30px; line-height: 1; }
.spd.on { background: var(--panel2); color: var(--text); }
.journey { display: flex; flex-direction: column; gap: 22px; }
.jhead { display: flex; justify-content: space-between; align-items: center; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.jrecord { font-variant-numeric: tabular-nums; font-size: 15px; }
.jrecord .rw { color: var(--green); } .jrecord .rl { color: #ff6b6b; } .jrecord .rsep { color: var(--muted); margin: 0 2px; }
.jnode { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-card); margin-bottom: 8px; width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: border-color .15s var(--ease); }
.jnode.open { border-color: var(--line-strong); }
.jnode .jstate { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; font-weight: 800; font-size: 15px; }
.jnode.won { border-color: rgba(54, 211, 153, .32); }
.jnode.won .jstate { background: rgba(54, 211, 153, .15); color: var(--green); }
.jnode.lost { border-color: rgba(255, 107, 107, .3); }
.jnode.lost .jstate { background: rgba(255, 107, 107, .15); color: #ff6b6b; }
.jnode.final { background: linear-gradient(180deg, rgba(255, 176, 32, .12), var(--panel)); border-color: rgba(255, 176, 32, .5); }
.jnode.final .jstate { background: rgba(255, 176, 32, .18); color: var(--accent2); font-size: 18px; }
.jbody { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.jlabel { font-weight: 700; display: block; }
.jmeta { font-size: 12px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.jmeta b { color: var(--text); font-weight: 700; }
.jscore { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.node-maps { display: inline-flex; gap: 3px; }
.node-maps .md { width: 7px; height: 7px; border-radius: 2px; background: var(--line); }
.node-maps .md.w { background: var(--green); } .node-maps .md.l { background: #ff6b6b; }
.jnode.in { animation: nodeIn .45s var(--spring) both; }
@keyframes nodeIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
/* resumo expandido da série (partidas/rounds) */
.jdetails { margin: -4px 4px 12px; padding: 8px 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; animation: nodeIn .3s var(--ease) both; }
.mrow { display: grid; grid-template-columns: 1fr auto 22px; align-items: center; gap: 10px; padding: 5px 4px; font-size: 14px; color: var(--muted); }
.mrow + .mrow { border-top: 1px solid var(--line); }
.mrow b { color: var(--text); font-variant-numeric: tabular-nums; font-size: 16px; }
.mrow .mres { text-align: center; font-weight: 800; }
.mrow.w .mres { color: var(--green); } .mrow.l .mres { color: #ff6b6b; }
/* jogo AO VIVO: pulso, badge, barra de momentum, placar subindo, kill feed na OT */
.jnode.live { flex-direction: column; align-items: stretch; padding-bottom: 12px; border-color: var(--line-strong); }
.jnode.live .jrow { display: flex; align-items: center; gap: 14px; }
.jnode.live .jstate { background: rgba(255, 92, 57, .14); }
.jstate .pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.65); } }
.livetag { font-size: 9px; font-weight: 800; letter-spacing: 1px; color: #fff; background: #b3303a; padding: 2px 6px; border-radius: 5px; vertical-align: 2px; }
.jnode.live .jscore { color: var(--accent2); font-variant-numeric: tabular-nums; flex-direction: row; align-items: center; gap: 8px; }
.jnode.live .momentum { margin-top: 10px; height: 5px; background: #b3303a; border-radius: 3px; overflow: hidden; }
.jnode.live .momentum > div { height: 100%; background: var(--green); transition: width .12s linear; }
.mrow.live { color: var(--text); }
.mrow.live .live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
/* overtime: destaque dourado + selo OT + kill feed round a round */
.jnode.live.ot { border-color: rgba(255, 176, 32, .6); background: linear-gradient(180deg, rgba(255, 176, 32, .09), var(--panel)); }
.otbadge { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: #1a0d08; background: var(--accent2); padding: 1px 6px; border-radius: 5px; }
.otfeed { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-height: 70px; }
.otev { font-size: 13px; color: var(--muted); }
.otev.new { color: var(--text); font-weight: 600; animation: nodeIn .25s var(--ease) both; }
.sim-actions { text-align: center; margin-top: 24px; }
/* confete (vitória do Major) */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 1px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(106vh) rotate(720deg); } }

/* RESULT */
.result { text-align: center; min-height: calc(100dvh - 150px); display: flex; flex-direction: column; justify-content: center; }
.result .headline { font-size: 36px; font-weight: 700; margin: 12px 0; }
.result .headline.win { color: var(--accent2); }
.result .perfect { color: var(--accent); font-weight: 800; }
/* card do artefato de compartilhamento (não é output de terminal — é peça de marca) */
.sharecard { max-width: 360px; margin: 20px auto; border-radius: 16px; overflow: hidden; border: 1px solid var(--line-strong); background: linear-gradient(180deg, var(--panel2), var(--panel)); box-shadow: var(--shadow); }
.sharecard-h { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(255,92,57,.10), transparent); }
.sharebox { padding: 16px 18px; font-family: ui-monospace, 'Cascadia Code', monospace; white-space: pre-wrap; text-align: left; font-size: 15px; line-height: 1.7; letter-spacing: .5px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 40px; }
.foot a { color: var(--accent2); text-decoration: none; }

/* respeita quem prefere menos movimento (WCAG 2.3.3) — telas seguem funcionais, só sem animação */
@media (prefers-reduced-motion: reduce) {
  .pcard.reveal-anim { animation: none; }
  .avg-big { animation: none; }
  .jnode.in, .jdetails { animation: none; }
  .pulse, .mrow.live .live-dot { animation: none; }
  .jnode.live .momentum > div { transition: none; }
  .otev.new { animation: none; }
  .confetti { display: none; }
  .pcard.click:hover { transform: none; }
  .btn:active { transform: none; }
}

/* 5 cards no mobile: o card órfão da última linha ocupa a largura toda (evita alinhamento torto) */
@media (max-width: 480px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .cards > .pcard:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--green); color: #06281c; font-weight: 800; padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); }
