/* CBLOW Tracker — Sorteio de cartas
   Uma folha só. Cores tiradas das próprias cartas (preto quente, creme),
   tiers: ouro (Tier 1), prata (Tier 2), bronze (Tier 3). */

:root {
  --bg: #0c0a0a;
  --surface: #141112;
  --surface-2: #1b1718;
  --surface-3: #241f20;
  --line: #2a2425;
  --line-2: #3b3334;
  --text: #f1ebe6;
  --muted: #a69b96;
  --faint: #736965;
  --cream: #efe4d4;
  --cream-ink: #19130f;

  --t1: #e6c063;            /* ouro   */
  --t2: #b8c1cc;            /* prata  */
  --t3: #c48a5c;            /* bronze */
  --t1-soft: #e6c0631f;
  --t2-soft: #b8c1cc1c;
  --t3-soft: #c48a5c1f;

  --win: #74c48f;
  --loss: #e0766b;

  --pride: linear-gradient(90deg, #ff8a8a, #ffc27a, #f6e68a, #8fe0a6, #86c5ff, #c6a5ff);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Cinzel", Georgia, "Times New Roman", serif;

  --radius: 10px;
  --radius-sm: 6px;
  --gutter: 32px;
  --max: 1180px;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { display: block; max-width: 100%; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: min(var(--max), 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------- Topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: none; }
.brand img { width: 30px; height: 30px; object-fit: contain; }
.brand span { font: 600 14px/1 var(--font); letter-spacing: .2px; }
.brand b { color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 2px; }
.nav a {
  padding: 7px 12px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-3); }
.freshness { margin-left: auto; color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.freshness b { color: var(--muted); font-weight: 500; }

main { flex: 1; padding: 32px 0 72px; }
[hidden] { display: none !important; }

/* ---------- Tipografia de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font: 600 30px/1.15 var(--font); letter-spacing: -.5px; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 640px; }
.section { margin-top: 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font: 600 18px/1.3 var(--font); }
.section-head p { margin: 0; color: var(--faint); font-size: 13px; }
.eyebrow { color: var(--faint); font-size: 12px; font-weight: 500; letter-spacing: .6px; text-transform: uppercase; }

/* ---------- Controles base ---------- */
.segmented { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.segmented button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 6px;
  color: var(--muted); font-weight: 500; font-size: 14px; display: inline-flex; align-items: baseline; gap: 6px;
}
.segmented button small { color: var(--faint); font-size: 12px; }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 #ffffff0a inset; }
.segmented button[aria-pressed="true"] small { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 500; font-size: 14px;
}
.btn:hover { border-color: #4a4041; background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary {
  width: 100%; padding: 14px 18px; border: 0; border-radius: 8px;
  background: var(--cream); color: var(--cream-ink); font-weight: 600; font-size: 15px;
}
.btn-primary:hover { background: #fff4e4; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 6px 8px; }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > span { color: var(--faint); font-size: 12px; font-weight: 500; }
.select { position: relative; display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; height: 46px; }
.select:focus-within { border-color: var(--muted); }
.select img { width: 28px; height: 28px; object-fit: contain; flex: none; }
.select select { appearance: none; border: 0; background: transparent; width: 100%; height: 100%; padding-right: 18px; font-weight: 500; font-size: 14px; outline: none; min-width: 0; }
.select select option { background: var(--surface-2); color: var(--text); }
.select::after { content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }

.tier-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .3px; white-space: nowrap;
  border: 1px solid currentColor; line-height: 1.3;
}
.tier-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tier-chip.t1 { color: var(--t1); background: var(--t1-soft); border-color: #e6c06355; }
.tier-chip.t2 { color: var(--t2); background: var(--t2-soft); border-color: #b8c1cc4d; }
.tier-chip.t3 { color: var(--t3); background: var(--t3-soft); border-color: #c48a5c55; }
.tier-chip.r { color: var(--muted); background: #ffffff08; border-color: var(--line-2); }
.tier-chip.r::before { display: none; }

.wl { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.wl .w { color: var(--win); }
.wl .l { color: var(--loss); }
.wl .sep { color: var(--faint); font-weight: 400; margin: 0 1px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

.team { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.team img { width: 22px; height: 22px; object-fit: contain; flex: none; }
.team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rainbow i { font-style: normal; background: var(--pride); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Sortear ---------- */
.fan-pill { display: inline-flex; align-items: center; gap: 9px; padding: 7px 14px 7px 8px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface); position: relative; overflow: hidden; flex: none; }
.fan-pill::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--pride); opacity: .8; }
.fan-pill img { width: 24px; height: 24px; object-fit: contain; }
.fan-pill strong { font-weight: 700; font-size: 12.5px; letter-spacing: .5px; white-space: nowrap; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.mesa { display: grid; grid-template-columns: 360px minmax(0, 1fr); overflow: hidden; }
.controls { padding: 24px; display: grid; gap: 20px; align-content: start; border-right: 1px solid var(--line); }
.controls .segmented { width: 100%; }
.controls .segmented button { flex: 1; justify-content: center; }
.teams { display: grid; gap: 10px; }
.vs { justify-self: center; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: 1px; margin: -2px 0; }

.odds { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.odds-head { display: flex; justify-content: space-between; align-items: baseline; }
.odds-head b { font-weight: 600; font-size: 13px; }
.odds-head span { color: var(--faint); font-size: 12px; }
.odds-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.odds-row .name { font-weight: 600; }
.odds-row.t1 .name { color: var(--t1); } .odds-row.t2 .name { color: var(--t2); } .odds-row.t3 .name { color: var(--t3); }
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--muted); }
.t1 .bar i, .bar.t1 i { background: var(--t1); } .t2 .bar i, .bar.t2 i { background: var(--t2); } .t3 .bar i, .bar.t3 i { background: var(--t3); }
.odds-row .val { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.odds-row .val b { color: var(--text); font-weight: 600; }
.odds-note { margin: 2px 0 0; color: var(--faint); font-size: 12.5px; }
.odds-list { display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.odds-list .odds-row { grid-template-columns: 1fr 70px auto; }
.odds-list .odds-row .name { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stage {
  padding: 32px; display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 36px; align-items: start;
  background: radial-gradient(ellipse 70% 80% at 22% 45%, #1f1718 0%, transparent 70%), var(--surface);
}
.flip { width: 100%; aspect-ratio: 339 / 520; perspective: 1400px; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .7s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.flip.revealed .flip-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face.front { transform: rotateY(180deg); background: #000; box-shadow: 0 0 0 1px #ffffff14, 0 24px 60px -20px #000; }
.face.front img { width: 100%; height: 100%; object-fit: cover; }
.face.back {
  display: grid; place-items: center; align-content: center; gap: 16px;
  background:
    radial-gradient(circle at 50% 44%, #4a1a1f 0, transparent 52%),
    repeating-linear-gradient(45deg, #e6c0630a 0 1px, transparent 1px 16px),
    repeating-linear-gradient(-45deg, #e6c0630a 0 1px, transparent 1px 16px),
    linear-gradient(180deg, #2a0c10, #130607);
  border: 1px solid #6b4a2e;
  box-shadow: inset 0 0 0 8px #1a0809, inset 0 0 0 9px #e6c06352, 0 26px 60px -24px #000;
}
.face.back img { width: 100px; height: 100px; object-fit: contain; filter: drop-shadow(0 8px 20px #000); }
.face.back span { color: #e6c063b3; font: 700 12px/1 var(--display); letter-spacing: 3px; }
.flip.shuffling .flip-inner { animation: shuffle .55s ease-in-out; }
@keyframes shuffle { 0%, 100% { transform: none; } 25% { transform: translateX(-6px) rotate(-2deg); } 50% { transform: translateX(6px) rotate(2deg); } 75% { transform: translateX(-3px) rotate(-1deg); } }
.flip.glow-t1 .face.front { box-shadow: 0 0 0 1px #e6c06366, 0 0 48px -6px #e6c06355, 0 24px 60px -20px #000; }
.flip.glow-t2 .face.front { box-shadow: 0 0 0 1px #b8c1cc66, 0 0 48px -6px #b8c1cc4d, 0 24px 60px -20px #000; }
.flip.glow-t3 .face.front { box-shadow: 0 0 0 1px #c48a5c88, 0 0 56px -4px #c48a5c66, 0 24px 60px -20px #000; }

.result { display: grid; gap: 18px; align-content: start; min-width: 0; }
.result-empty { display: grid; gap: 20px; }
.result-empty .hint { margin: 0; color: var(--muted); font-size: 14px; }
.result-empty .hint b { color: var(--text); font-weight: 600; }
.faceoff { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }
.faceoff .side { display: grid; justify-items: center; text-align: center; gap: 8px; min-width: 0; }
.faceoff .side img { width: 76px; height: 76px; object-fit: contain; }
.faceoff .side b { font-size: 15px; font-weight: 600; line-height: 1.25; }
.faceoff .side span { color: var(--faint); font-size: 12px; }
.faceoff .vs-badge { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .5px; background: var(--surface-2); }
.tape { display: grid; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tape-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px 14px; font-size: 13.5px; border-bottom: 1px solid var(--line); background: #ffffff03; }
.tape-row:last-child { border-bottom: 0; }
.tape-row > :first-child { text-align: left; } .tape-row > :last-child { text-align: right; }
.tape-row .label { color: var(--faint); font-size: 12px; text-align: center; white-space: nowrap; }
.tape-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.h2h { margin: 0; color: var(--muted); font-size: 13px; }
.h2h b { color: var(--text); font-weight: 600; }

.recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.recent-item { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: left; color: inherit; }
.recent-item:hover { border-color: var(--line-2); background: var(--surface-2); }
.recent-item img.thumb { width: 58px; height: 89px; object-fit: cover; border-radius: 5px; box-shadow: 0 0 0 1px #ffffff14; }
.recent-item .ri-body { display: grid; gap: 5px; min-width: 0; }
.recent-item .ri-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--faint); }
.recent-item .ri-body > b { font-size: 15px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .ri-teams { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; flex-wrap: wrap; }
.recent-item .ri-teams .x { color: var(--faint); font-size: 11px; }
.recent-item .team.lost { opacity: .5; }
.recent-item .team img { width: 18px; height: 18px; }
.result-matchup { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.result-matchup .x { color: var(--faint); font-size: 11px; font-weight: 600; }
.result .card-name { margin: 6px 0 0; font: 700 30px/1.15 var(--display); letter-spacing: .3px; }
.result .effect { margin: 0; color: #d8cfc9; font-size: 16px; max-width: 520px; }
.bonus { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-2); flex-wrap: wrap; }
.bonus-label { color: var(--faint); font-size: 12px; font-weight: 500; }
.bonus-value { font-weight: 600; font-size: 15px; }
.bonus-value .letters { font: 700 20px/1 var(--display); letter-spacing: 3px; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.reroll { position: relative; }
.reroll-pop {
  position: absolute; left: 0; bottom: calc(100% + 8px); width: 300px; z-index: 5;
  padding: 12px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--line-2);
  box-shadow: 0 18px 40px -12px #000; display: none;
}
.reroll:hover .reroll-pop, .reroll:focus-within .reroll-pop { display: block; }
.reroll-pop p { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.reroll-pop ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; }
.reroll-pop li { display: flex; justify-content: space-between; gap: 10px; }

.history-block { padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mini-stats > div { background: var(--surface); padding: 10px 12px; min-width: 0; }
.mini-stats b { display: block; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.3; }
.mini-stats span { color: var(--faint); font-size: 12px; }
.team-records { display: grid; gap: 6px; font-size: 13.5px; }
.team-records .label { color: var(--faint); font-size: 12px; }
.team-records div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); font-size: 13px; justify-self: start; }
.link:hover { color: var(--text); text-decoration-color: var(--muted); }

.session { margin-top: 20px; padding: 14px 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.session > b { font-size: 13px; font-weight: 600; margin-right: 4px; }
.session-list { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.session-list button { border: 1px solid var(--line-2); background: var(--surface-2); padding: 4px 10px; border-radius: 99px; font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.session-list button:hover { color: var(--text); }
.session-list .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.session-list .dot.t1 { background: var(--t1); } .session-list .dot.t2 { background: var(--t2); } .session-list .dot.t3 { background: var(--t3); }

/* ---------- Cartas (coleção) ---------- */
.tier-group + .tier-group { margin-top: 36px; }
.tier-group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tier-group-head h2 { margin: 0; font: 600 16px/1.3 var(--font); }
.tier-group-head span { color: var(--faint); font-size: 13px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.tile { border: 0; background: transparent; padding: 0; text-align: left; display: grid; gap: 10px; color: inherit; }
.tile .art { border-radius: 10px; overflow: hidden; background: #000; box-shadow: 0 0 0 1px #ffffff12; transition: transform .2s ease, box-shadow .2s ease; aspect-ratio: 339 / 520; }
.tile .art img { width: 100%; height: 100%; object-fit: cover; }
.tile:hover .art { transform: translateY(-3px); box-shadow: 0 0 0 1px #ffffff30, 0 16px 30px -14px #000; }
.tile .meta { display: grid; gap: 2px; padding: 0 2px; }
.tile .meta b { font-weight: 600; font-size: 14px; line-height: 1.3; }
.tile .meta span { color: var(--faint); font-size: 12.5px; }
.tile .meta span em { font-style: normal; color: var(--muted); }

/* ---------- Estatísticas ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kpi { background: var(--surface); padding: 18px 20px; min-width: 0; }
.kpi .label { color: var(--faint); font-size: 12.5px; font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; line-height: 1.25; margin-top: 4px; }
.kpi .value small { font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.kpi .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.tier-compare { padding: 20px; display: grid; gap: 16px; }
.tc-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 150px; gap: 16px; align-items: center; }
.tc-row .name { font-weight: 600; font-size: 14px; }
.tc-row.t1 .name { color: var(--t1); } .tc-row.t2 .name { color: var(--t2); } .tc-row.t3 .name { color: var(--t3); }
.tc-bars { display: grid; gap: 5px; }
.tc-bar { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 10px; font-size: 12px; color: var(--faint); }
.tc-bar .bar { height: 8px; }
.tc-bar.expected .bar i { background: var(--line-2) !important; }
.tc-row .val { text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tc-row .val b { color: var(--text); font-size: 15px; font-weight: 600; }
.foot-note { margin: 10px 0 0; color: var(--faint); font-size: 12.5px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--faint); font-weight: 500; font-size: 12px; background: var(--surface); position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th[aria-sort] { color: var(--text); }
th[aria-sort="descending"]::after { content: " ↓"; } th[aria-sort="ascending"]::after { content: " ↑"; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--surface-2); }
.card-cell { display: flex; align-items: center; gap: 10px; }
.card-cell img { width: 26px; height: 40px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px #ffffff14; }
.card-cell b { font-weight: 600; }
.delta { font-size: 12px; margin-left: 4px; }
.delta.up { color: var(--t1); } .delta.down { color: var(--t2); }

.team-picker { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.team-picker button { border: 1px solid var(--line-2); background: var(--surface); padding: 6px 10px 6px 7px; border-radius: 99px; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 500; }
.team-picker button img { width: 22px; height: 22px; object-fit: contain; }
.team-picker button[aria-pressed="true"] { color: var(--text); border-color: var(--muted); background: var(--surface-3); }
.team-card { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0; overflow: hidden; }
.team-side { padding: 22px; border-right: 1px solid var(--line); display: grid; gap: 18px; align-content: start; }
.team-side .logo { width: 88px; height: 88px; object-fit: contain; }
.team-side h3 { margin: 0; font-size: 18px; font-weight: 600; }
.team-side dl { margin: 0; display: grid; gap: 10px; }
.team-side dl div { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.team-side dt { color: var(--faint); }
.team-side dd { margin: 0; font-weight: 600; text-align: right; }
.team-main { padding: 22px; display: grid; gap: 22px; align-content: start; min-width: 0; }
.highlights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.highlight { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); min-width: 0; text-align: left; color: inherit; }
.highlight img { width: 40px; height: 62px; object-fit: cover; border-radius: 4px; flex: none; }
.highlight .label { color: var(--faint); font-size: 12px; }
.highlight b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-list { display: grid; gap: 2px; }
.record-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 54px; gap: 14px; align-items: center; padding: 7px 8px; border-radius: 6px; font-size: 13.5px; border: 0; background: transparent; text-align: left; color: inherit; }
.record-row:hover { background: var(--surface-2); }
.record-row .name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.record-row .name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-row .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--faint); }
.record-row .dot.t1 { background: var(--t1); } .record-row .dot.t2 { background: var(--t2); } .record-row .dot.t3 { background: var(--t3); }
.pips { display: flex; gap: 3px; flex-wrap: wrap; }
.pips i { width: 14px; height: 6px; border-radius: 2px; background: var(--loss); opacity: .85; }
.pips i.w { background: var(--win); }
.record-row .wl { text-align: right; }
.subhead { margin: 0 0 6px; color: var(--faint); font-size: 12px; font-weight: 500; letter-spacing: .4px; text-transform: uppercase; }

/* ---------- Regras ---------- */
.rules { display: grid; gap: 16px; max-width: 880px; }
.rule { padding: 22px 24px; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; }
.rule .idx { color: var(--faint); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 2px; }
.rule h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.rule p { margin: 0; color: #d0c7c1; }
.rule p + p, .rule ul + p { margin-top: 10px; }
.rule p.muted { color: var(--muted); }
.rule p.faint { color: var(--faint); }
.rule ul { margin: 10px 0 0; padding-left: 18px; color: #d0c7c1; display: grid; gap: 6px; }
.tier-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.tier-col { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.tier-col b { display: block; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tier-col span { color: var(--muted); font-size: 13px; }
.tier-col.t1 { border-top: 2px solid var(--t1); } .tier-col.t2 { border-top: 2px solid var(--t2); } .tier-col.t3 { border-top: 2px solid var(--t3); }
.official { border-left: 2px solid var(--cream); }

/* ---------- Modal de carta ---------- */
dialog { padding: 0; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--text); width: min(940px, calc(100% - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
dialog::backdrop { background: #000000b8; backdrop-filter: blur(3px); }
.detail { display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.detail-art { padding: 24px; background: var(--surface-2); border-right: 1px solid var(--line); }
.detail-art img { position: sticky; top: 24px; }
.detail-art img { border-radius: 12px; width: 100%; box-shadow: 0 0 0 1px #ffffff14; }
.detail-body { padding: 24px 28px 28px; display: grid; gap: 20px; align-content: start; min-width: 0; }
.detail-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.detail-top h2 { margin: 8px 0 0; font: 700 26px/1.2 var(--display); }
.close { border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; font-size: 20px; line-height: 1; color: var(--muted); flex: none; }
.close:hover { color: var(--text); background: var(--surface-3); }
.detail-body .effect { margin: 0; color: #d8cfc9; font-size: 15.5px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.detail-grid > div { background: var(--surface); padding: 10px 12px; min-width: 0; }
.detail-grid b { display: block; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-grid span { color: var(--faint); font-size: 12px; }
.games { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.game { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 12px; font-size: 13px; border-bottom: 1px solid var(--line); }
.game:last-child { border-bottom: 0; }
.game .date { color: var(--faint); font-variant-numeric: tabular-nums; }
.game .teams-line { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.game .teams-line .team.lost { opacity: .5; }
.game .teams-line .x { color: var(--faint); font-size: 11px; }
.game .info { color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--muted); }
.empty-note { color: var(--faint); font-size: 13.5px; margin: 0; }

/* ---------- Rodapé ---------- */
footer { border-top: 1px solid var(--line); color: var(--faint); font-size: 12.5px; }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; padding: 18px 0; flex-wrap: wrap; }
footer a { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--cream); color: var(--cream-ink); padding: 10px 16px; border-radius: 8px; font-weight: 600; font-size: 14px; transition: .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsivo ---------- */
@media (max-width: 1020px) {
  .mesa { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .teams { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; }
  .vs { margin: 0 0 15px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  main { padding-top: 20px; }
  .topbar .wrap { height: auto; min-height: 56px; flex-wrap: wrap; gap: 4px 12px; padding: 8px 0; }
  .nav { order: 3; width: 100%; overflow-x: auto; margin: 0 -4px; }
  .nav a { padding: 6px 10px; flex: none; }
  .freshness { font-size: 11.5px; }
  .page-head h1 { font-size: 24px; }
  .controls { padding: 18px; }
  .teams { grid-template-columns: 1fr; }
  .vs { margin: -2px 0; }
  .stage { grid-template-columns: 1fr; padding: 18px; gap: 20px; }
  .stage.is-empty .flip { display: none; }
  .flip { width: min(260px, 72%); justify-self: center; }
  .result .card-name { font-size: 24px; }
  .faceoff .side img { width: 60px; height: 60px; }
  .recent { grid-template-columns: 1fr; }
  .fan-pill strong { font-size: 11.5px; }
  .detail { grid-template-columns: 1fr; }
  .detail-art { border-right: 0; border-bottom: 1px solid var(--line); display: flex; justify-content: center; padding: 18px; }
  .detail-art img { width: min(220px, 70%); }
  .detail-body { padding: 18px; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game { grid-template-columns: 1fr auto; }
  .game .date { grid-column: 1 / -1; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 22px; }
  .tc-row { grid-template-columns: 1fr; gap: 8px; }
  .tc-row .val { text-align: left; }
  .team-card { grid-template-columns: 1fr; }
  .team-side { border-right: 0; border-bottom: 1px solid var(--line); grid-template-columns: 72px 1fr; align-items: center; }
  .team-side .logo { width: 72px; height: 72px; }
  .team-side dl { grid-column: 1 / -1; }
  .highlights { grid-template-columns: 1fr; }
  .record-row { grid-template-columns: minmax(0, 1fr) auto; }
  .record-row .pips { display: none; }
  .tier-cols { grid-template-columns: 1fr; }
  .rule { grid-template-columns: 1fr; gap: 6px; padding: 18px; }
  .reroll-pop { width: min(300px, calc(100vw - 48px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
