/* ============================================================
   Psyop theme — white / black / signature red.
   Display: New Heterodox Mono (UPPERCASE)   Body: Ft Calhern
   Licensed Psyop fonts, self-hosted in assets/fonts/.
   ============================================================ */
@font-face {
  font-family: 'New Heterodox Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/new-heterodox-mono-400.woff2') format('woff2'),
       url('fonts/new-heterodox-mono-400.woff') format('woff');
}
@font-face {
  font-family: 'New Heterodox Mono'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/new-heterodox-mono-700.woff2') format('woff2'),
       url('fonts/new-heterodox-mono-700.woff') format('woff');
}
@font-face {
  font-family: 'Ft Calhern'; font-style: normal; font-weight: 300; font-display: swap;
  src: url('fonts/ft-calhern-300.woff2') format('woff2'),
       url('fonts/ft-calhern-300.woff') format('woff');
}
@font-face {
  font-family: 'Ft Calhern'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/ft-calhern-500.woff2') format('woff2'),
       url('fonts/ft-calhern-500.woff') format('woff');
}
/* ---- Light theme (default) ---- */
:root {
  --bg: #ffffff;
  --ink: #000000;
  --muted: #9d9d9d;
  --line: #e6e6e6;
  --line-strong: #000000;
  --card: #ffffff;
  --soft: #f5f5f5;
  --red: #ff0000;
  --red-tint: #fff0f0;
  --raised: #ffffff;          /* small badges that sit above --soft */
  --slot-hover: #ffffff;
  --seed3-border: #f3b6b6;
  --text-2: #222222;          /* body list text */
  --nav-bg: rgba(255,255,255,.92);
  --bar-bg: rgba(255,255,255,.95);
  --connector: #cfcfcf;       /* bracket connector lines (read by JS) */
  --hint: #8a8a8a;            /* group card meta line */
  --gold: #c79a1e;            /* champion outline */
  --card-accent: #000000;     /* selected/winning card accent (Step 2/3) */
  --card-accent-bg: #f0f0f0;
  --radius: 3px;
  --mono: 'New Heterodox Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --sans: 'Ft Calhern', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}
/* ---- Dark theme ---- */
:root[data-theme="dark"] {
  --bg: #000000;
  --ink: #f1f1f1;
  --muted: #7c7c7c;
  --line: #2a2a2a;
  --line-strong: #d4d4d4;
  --card: #0b0b0b;
  --soft: #171717;
  --red: #ff0000;
  --red-tint: #2a0d0d;
  --raised: #242424;
  --slot-hover: #232323;
  --seed3-border: #5e2424;
  --text-2: #d8d8d8;
  --nav-bg: rgba(0,0,0,.82);
  --bar-bg: rgba(0,0,0,.88);
  --connector: #3a3a3a;
  --hint: #a6a6a6;
  --gold: #ecc44f;
  --card-accent: #f1f1f1;     /* off-white accent on dark */
  --card-accent-bg: #262626;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-weight: 300;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--red); }
a:hover { color: var(--red); }
.container { width: 100%; max-width: 2400px; margin: 0 auto; padding: 28px 96px; }
@media (max-width: 900px) {
  .container { padding-left: 24px; padding-right: 24px; }
  .bracket-wrap { padding-left: 24px; padding-right: 24px; }
}
/* Nav label abbreviations: full on desktop, short on mobile */
.nav .t-short { display: none; }
@media (max-width: 760px) {
  .nav #brandName { display: none; }
  .nav .t-full { display: none; }
  .nav .t-short { display: inline; }
}
.row { display: flex; gap: 16px; flex-wrap: wrap; }

/* Display type */
h1, h2, h3, h4, .mono { font-family: var(--mono); text-transform: uppercase; letter-spacing: .02em; font-weight: 700; }
h1 { font-size: clamp(34px, 6.4vw, 76px); line-height: .98; margin: 0 0 14px; }
h2 { font-size: clamp(20px, 3vw, 30px); margin: 0; }
h3 { font-size: 16px; margin: 0 0 4px; }
h4 { font-size: 14px; margin: 0 0 8px; }

/* Top nav */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 22px;
  padding: 14px 28px;
  background: var(--nav-bg); backdrop-filter: blur(6px);
}
/* Separator as a pseudo-element: Firefox drops a `border` on a backdrop-filtered
   element, so paint the hairline independently of the blur. */
.nav::after {
  content: ''; position: absolute; left: 28px; right: 28px; bottom: 0; height: 1px;
  background: var(--line); pointer-events: none;   /* light hairline (#e6e6e6 ≈ rgba(0,0,0,.1)), inset like psyopimg.com */
}
.nav .brand {
  font-family: var(--mono); font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  display: flex; align-items: center; gap: 9px; border: 0;
}
.nav .brand .mark { width: 12px; height: 12px; background: var(--red); display: inline-block; border-radius: 50%; }
.nav a.tab {
  font-family: var(--sans); text-transform: uppercase; font-size: 12px; letter-spacing: .04em; line-height: .9;
  color: var(--muted); border: 0; border-bottom: 2px solid transparent; padding: 4px 0; font-weight: 500;
}
.nav a.tab.active, .nav a.tab:hover { color: var(--ink); }
.nav a.tab.active { border-bottom-color: var(--red); }
.nav .brand { flex: 1; }
.nav .navtabs { display: flex; gap: 26px; }
.nav .navright { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: var(--radius); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .ico-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-light { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-dark { display: block; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); text-transform: uppercase; font-size: 12px; letter-spacing: .08em; font-weight: 700;
  border: 1px solid var(--ink); background: var(--bg); color: var(--ink);
  padding: 11px 18px; border-radius: var(--radius); cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .05s ease;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: #d60000; border-color: #d60000; color: #fff; }
.btn.slack { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.slack:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .35; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--bg); color: var(--ink); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 18px 20px; }
.muted { color: var(--muted); }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
  border: 1px solid var(--ink);
}
code { font-family: var(--mono); font-size: .9em; background: var(--soft); padding: 1px 5px; border-radius: 3px; }

/* Unified centered subheaders (sans) under each step */
.subhead { font-family: var(--sans); font-size: 14px; color: var(--muted); text-align: center; max-width: 680px; margin: 4px auto 26px; line-height: 1.5; }
.subhead b { color: var(--ink); }

/* Section titles */
.section-title { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 44px 0 16px; padding-top: 18px; border-top: 1px solid var(--line-strong); }
.section-title:first-child { border-top: 0; padding-top: 0; }
.section-title h2 { margin: 0; }

/* Group picker */
.groups-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.groups-grid .group { flex: 1 1 360px; max-width: 480px; }
.group h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.team {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; margin: 7px 0; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--soft); cursor: grab; user-select: none;
}
.team.dragging { opacity: .4; }
.team.over { border-color: var(--red); }
.team .pos {
  width: 24px; height: 24px; flex: none; border-radius: 2px;
  font-family: var(--mono); font-weight: 700; font-size: 12px;
  display: grid; place-items: center; background: var(--raised); border: 1px solid var(--line); color: var(--muted);
}
.team[data-pos="1"] .pos { background: var(--red); color: #fff; border-color: var(--red); }
.team[data-pos="2"] .pos { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.team[data-pos="3"] .pos { background: var(--bg); color: var(--ink); border-color: var(--ink); }
.team img.flag { width: 26px; height: 18px; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px var(--line); }
.team .nm { font-weight: 400; white-space: nowrap; }
.seed { font-family: var(--mono); font-size: 9px; letter-spacing: .02em; padding: 1px 4px; border-radius: 2px; border: 1px solid var(--line); color: var(--muted); }
.team .seed { margin-left: 0; }
/* Pot badges (everywhere): monochrome — darker/filled = lower pot (bigger underdog) */
.seed.s1 { color: var(--ink); border-color: var(--ink); background: transparent; opacity: .4; }
.seed.s2 { color: var(--ink); border-color: var(--ink); background: transparent; opacity: .62; }
.seed.s3 { color: var(--ink); border-color: var(--ink); background: transparent; opacity: .85; }
.seed.s4 { color: var(--bg); border-color: var(--ink); background: var(--ink); opacity: 1; }
.team .grip { margin-left: auto; display: flex; gap: 2px; }
.team .grip .mv {
  font-family: var(--mono); border: 1px solid var(--line); background: var(--soft); color: var(--ink);
  width: 22px; height: 22px; border-radius: 2px; cursor: pointer; line-height: 1; padding: 0;
}
.team .grip .mv:hover { background: var(--ink); color: var(--bg); }

/* Knockout reach picker */
.round-block { margin-top: 14px; }
.round-block h4 { display: flex; align-items: center; gap: 10px; }
.round-block .need { font-family: var(--mono); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--soft); cursor: pointer; font-size: 13px; font-weight: 400;
}
.chip:hover { border-color: var(--ink); }
.chip img { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; }
.chip.sel { border-color: var(--red); background: var(--red-tint); color: var(--red); font-weight: 700; }
.chip.disabled { opacity: .35; cursor: not-allowed; }
/* Pre-kickoff placeholder on the Standings page (before lockAt). */
.prekick { max-width: 560px; margin: 60px auto; text-align: center; }
.prekick[hidden] { display: none; }
.prekick .prekick-kicker { font-family: var(--mono); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--muted); }
.prekick .prekick-title { font-size: 22px; margin: 12px 0 10px; }
.prekick .prekick-msg { font-family: var(--sans); font-size: 15px; color: var(--muted); line-height: 1.5; margin: 0; }

.count-ok { color: var(--red); font-weight: 700; }
.count-bad { color: var(--muted); }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
th { font-family: var(--mono); color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
#board th, #board td { text-align: center; }   /* centered leaderboard columns */
#board .rank { width: auto; }
tbody tr:hover { background: var(--soft); }
tr.me { background: var(--red-tint); }
tr.me:hover { background: var(--red-tint); }
.rank { font-family: var(--mono); font-weight: 700; width: 44px; }
.rank.r1 { color: var(--red); }
.rank.r2, .rank.r3 { color: var(--ink); }
td b { font-weight: 700; }
.status { font-family: var(--mono); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.status.clinched { color: var(--red); }
.status.contender { color: var(--ink); }
.status.eliminated { color: var(--muted); }

/* Sticky submit bar */
.submitbar {
  position: sticky; bottom: 0; z-index: 15;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 600px; max-width: 100%;
  margin: 24px auto 0; padding: 16px 0;
  background: var(--bar-bg); backdrop-filter: blur(6px);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.submit-actions { display: flex; align-items: center; justify-content: space-evenly; gap: 12px 0; flex-wrap: wrap; width: 100%; }
.authrow { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 40px; margin-bottom: 8px; }
.authrow[hidden] { display: none; }
.authStatus { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--gold); }

/* ===== Locked / graded read-only self-grading view ===== */
:root { --ok: #1aa46a; }
:root[data-theme="dark"] { --ok: #34d399; }
/* Locked scoreboard: 3 divided segments INSIDE the original floating submit pill. */
.graded .submitbar { width: 720px; }
.lock-ticker { display: flex; align-items: stretch; width: 100%; font-family: var(--mono); }
.lock-ticker .lt-seg { flex: 1; display: flex; align-items: center; padding: 10px 26px; }
.lock-ticker .lt-seg + .lt-seg { border-left: 1px solid var(--line); }
.lock-ticker .lt-status { flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; text-transform: uppercase; letter-spacing: .1em; }
.lock-ticker .lt-locked { font-size: 12px; font-weight: 700; color: var(--ink); }
.lock-ticker .lt-live { display: inline-flex; align-items: center; gap: 7px; font-size: 10px; letter-spacing: .22em; color: var(--muted); }
.lock-ticker .lt-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: lt-pulse 1.8s ease-out infinite; }
.lock-ticker .lt-score { flex: 1; justify-content: center; align-items: baseline; gap: 7px; }
.lock-ticker #lockScore { font-size: 28px; font-weight: 800; color: var(--red); letter-spacing: .06em; font-variant-numeric: tabular-nums; line-height: 1; }
.lock-ticker .lt-pts { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.lock-ticker .lt-auth { align-items: center; justify-content: flex-end; }
.lock-ticker .lt-auth .authrow { margin: 0; min-height: 0; }
@keyframes lt-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,0,0,.55); } 70% { box-shadow: 0 0 0 7px rgba(255,0,0,0); } 100% { box-shadow: 0 0 0 0 rgba(255,0,0,0); } }

@media (max-width: 600px) {
  .graded .submitbar { width: 100%; }
  .lock-ticker { flex-direction: column; align-items: stretch; }
  .lock-ticker .lt-seg { justify-content: center; }
  .lock-ticker .lt-status { align-items: center; }
  .lock-ticker .lt-seg + .lt-seg { border-left: 0; border-top: 1px solid var(--line); }
}
.graded .submit-actions, .graded #valid, .graded .subhead { display: none; }
.graded .third-chip, .graded .match .slot { pointer-events: none; }
.graded .team { cursor: default; }
.team.correct { border-left: 3px solid var(--ok); }
.team.wrong { opacity: .45; }
.third-chip.correct { border-color: var(--ok); color: var(--ok); }
.third-chip.wrong { opacity: .4; }
.match .slot.win.correct { border-left-color: var(--ok); color: var(--ok); }
.half.right .slot.win.correct { border-right-color: var(--ok); }
.match .slot.win.wrong { opacity: .5; }
.champion.champ-correct { border-color: var(--ok); }
.champion.champ-correct .who { color: var(--ok); }
.champion.champ-wrong { opacity: .55; }
.submitbar #valid:empty { display: none; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.field input {
  background: var(--soft); border: 1px solid var(--line); color: var(--ink);
  padding: 9px 12px; border-radius: var(--radius); font-size: 14px; min-width: 160px; font-family: var(--sans);
}
.field input:focus { outline: none; border-color: var(--red); }
#valid { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
/* Notification: takes over the top nav bar for a few seconds */
.toast {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  min-height: 56px; padding: 0 28px;
  background: var(--bg); color: var(--ink);
  font-family: var(--mono); font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--line-strong);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--red); color: #fff; }
.scenario-note { font-size: 14px; }
ol, ul { color: var(--text-2); }

/* Thirds picker */
.thirds-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.third-chip {
  display: flex; flex: 0 1 240px; align-items: center; gap: 8px; padding: 8px 11px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--soft); color: var(--ink); cursor: pointer; font-size: 13px;
}
.third-chip:hover { border-color: var(--ink); }
.third-chip .g { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.third-chip img { width: 22px; height: 15px; object-fit: cover; border-radius: 2px; }
.third-chip .nm { flex: 1; white-space: nowrap; }
.third-chip .seed { margin-left: auto; }
.third-chip.sel { border-color: var(--card-accent); background: var(--card-accent-bg); color: var(--card-accent); font-weight: 700; }
.third-chip.sel .g { color: var(--card-accent); }
.third-chip.disabled { opacity: .4; cursor: not-allowed; }

/* Knockout bracket */
/* Full-bleed so the whole 32-team tree fits the viewport (with its own scroll if narrow). */
.bracket-wrap { overflow-x: auto; padding: 4px 96px 14px; width: 100vw; position: relative; left: 50%; margin-left: -50vw; }
.bracket { display: flex; align-items: stretch; justify-content: center; min-width: min-content; width: 100%; max-width: 1750px; margin: 0 auto; position: relative; }
.bracket-lines { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 0; }
.half { display: flex; flex: 1 1 0; justify-content: space-between; min-width: min-content; }
.half.right { flex-direction: row-reverse; }
.round { position: relative; display: flex; flex-direction: column; flex: 0 0 150px; width: 150px; padding: 0 6px; }
.round-label {
  font-family: var(--mono); text-transform: uppercase; font-size: 10px; letter-spacing: .07em;
  color: var(--muted); text-align: center; padding: 0 0 8px;
}
/* column labels are placed just above their top match by JS (positionRoundLabels) */
.round > .round-label { position: absolute; left: 6px; right: 6px; padding-bottom: 0; }
.round-body { flex: 1; display: flex; flex-direction: column; justify-content: space-around; padding-top: 24px; }
.match { position: relative; z-index: 1; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 5px 0; }
.match .slot {
  display: flex; align-items: center; gap: 7px; padding: 6px 9px; font-size: 12.5px;
  cursor: pointer; border-left: 3px solid transparent; min-height: 30px; min-width: 0;
}
.match .slot + .slot { border-top: 1px solid var(--line); }
.match .slot:hover { background: var(--slot-hover); }
.match .slot img { flex: none; width: 19px; height: 13px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); }
.match .slot .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match .slot.win { border-left-color: var(--card-accent); color: var(--card-accent); font-weight: 700; background: var(--card-accent-bg); }
.match .slot.dim { opacity: .5; }
.match .slot.empty { color: var(--muted); cursor: default; }
.half.right .slot { flex-direction: row-reverse; border-left: 0; border-right: 3px solid transparent; text-align: right; }
.half.right .slot.win { border-right-color: var(--card-accent); }
/* Final column: champion above; the Final + 3rd-place playoff share the central
   space (both fed by the semi-finals), which nudges the Final up off-centre. */
.final-col { display: flex; flex: 0 0 auto; flex-direction: column; justify-content: center; align-items: center; min-width: 184px; padding: 24px 10px 0; }
.fc-side { flex: 1 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; }
.fc-center { display: flex; flex-direction: column; align-items: center; width: 100%; gap: 8px; }
.final-col .round-label { color: var(--gold); padding-bottom: 0; }
.final-col .bronze-label { color: var(--bronze, #b07a3c); margin-top: 48px; }
.final-col .match { width: 100%; margin: 0; }
.champion {
  width: 100%; text-align: center; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 10px; background: var(--card);
  transform: scale(1.32); transform-origin: center;
}
.champion .cap { font-family: var(--mono); text-transform: uppercase; font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.champion .who { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 8px; font-family: var(--mono); text-transform: uppercase; font-weight: 700; font-size: 15px; }
.champion .who img { width: 30px; height: 20px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); }
.champion.set { border-color: var(--gold); }
.champion.set .who { color: var(--gold); }
