/*
  Cointoss live pages.
  Brand: working direction "Flip" (cobalt, navy ink, whistle orange for live moments).
  Swap a direction by changing the brand tokens in the first two blocks.
*/

:root {
  color-scheme: light;
  /* Brand */
  --brand: #2448e0;
  --brand-strong: #15288f;
  --brand-soft: #eaf0ff;
  --brand-ink: #12203a;
  --live: #ff6b1a;
  --on-brand: #ffffff;
  /* Surfaces and text */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --ink: #12203a;
  --ink-2: #364259;
  --muted: #5a6579;
  --line: #e1e5ee;
  --line-strong: #cdd3df;
  /* States */
  --good: #127a4b;
  --good-soft: #e6f5ee;
  --warn: #9a5200;
  --warn-soft: #fff3e3;
  --bad: #c42b2b;
  --bad-soft: #fdecec;
  /* Shape and depth */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --e1: 0 1px 2px rgba(18, 32, 58, 0.06), 0 1px 1px rgba(18, 32, 58, 0.04);
  --e2: 0 1px 2px rgba(18, 32, 58, 0.05), 0 10px 28px -12px rgba(18, 32, 58, 0.22);
  --bar: #12203a;
  --bar-ink: #ffffff;
  --bar-muted: rgba(255, 255, 255, 0.72);
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --brand: #6f8bff;
    --brand-strong: #a9b9ff;
    --brand-soft: #1a2754;
    --on-brand: #0b1220;
    --bg: #0b1424;
    --surface: #111d33;
    --surface-2: #15233d;
    --ink: #eef2fa;
    --ink-2: #c8d0de;
    --muted: #a3aec3;
    --line: #24324d;
    --line-strong: #33446a;
    --good: #5cd39a;
    --good-soft: #12302a;
    --warn: #f2b15c;
    --warn-soft: #34270f;
    --bad: #ff8a80;
    --bad-soft: #3a1a1d;
    --e1: 0 1px 2px rgba(0, 0, 0, 0.35);
    --e2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.6);
    --bar: #0a1120;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: var(--bg); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-strong); }
h1, h2, h3, h4 { color: var(--ink); letter-spacing: -0.015em; }
h1 { font-size: 1.85rem; line-height: 1.15; margin: 0; font-weight: 750; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 2rem 0 0.75rem; font-weight: 700; }
h3 { font-size: 1rem; line-height: 1.35; margin: 1.25rem 0 0.5rem; font-weight: 650; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- App bar ---------- */
.bar { background: var(--bar); color: var(--bar-ink); }
.bar-inner { max-width: 76rem; margin: 0 auto; display: flex; align-items: center; gap: 0.5rem 1.5rem; padding: 0.7rem 1.25rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--bar-ink); text-decoration: none; font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; }
.brand:hover { color: var(--bar-ink); }
.brand img { width: 28px; height: 28px; display: block; }
.brand .org-sub { color: var(--bar-muted); font-weight: 500; font-size: 0.85rem; }
.bar nav { display: flex; gap: 0.15rem; flex-wrap: wrap; }
.bar nav a { color: var(--bar-muted); text-decoration: none; padding: 0.4rem 0.7rem; border-radius: 8px; font-weight: 550; font-size: 0.95rem; }
.bar nav a:hover { color: var(--bar-ink); background: rgba(255, 255, 255, 0.08); }
.bar nav a[aria-current="page"] { color: var(--bar-ink); background: rgba(255, 255, 255, 0.14); }
.bar .who { margin-left: auto; display: flex; gap: 0.75rem; align-items: center; color: var(--bar-muted); font-size: 0.88rem; }
.bar .who a, .bar .who button.link { color: var(--bar-ink); }
.bar .button.on-bar { background: var(--surface); color: var(--brand-ink); border-color: transparent; }

.banner { margin: 0; padding: 0.55rem 1rem; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); text-align: center; font-size: 0.92rem; font-weight: 550; }

/* ---------- League hero (public pages) ---------- */
.hero { background: linear-gradient(180deg, var(--bar) 0%, var(--bar) 62%, var(--bg) 62%); padding: 0.5rem 1.25rem 0; }
.hero-card { max-width: 76rem; margin: 0 auto; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--e2); padding: 1.5rem 1.75rem; display: flex; gap: 1rem 2rem; align-items: center; flex-wrap: wrap; border: 1px solid var(--line); }
.hero-card .eyebrow { color: var(--muted); font-size: 0.9rem; font-weight: 550; margin: 0 0 0.15rem; }
.hero-card h1 { font-size: 2.1rem; }
.next { margin-left: auto; background: var(--brand-soft); border-radius: var(--r); padding: 0.85rem 1.1rem; min-width: 16rem; }
.next .label { font-size: 0.85rem; color: var(--brand-strong); font-weight: 650; display: flex; align-items: center; gap: 0.45rem; }
.next .label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px rgba(255, 107, 26, 0.22); }
.next .when { font-size: 1.15rem; font-weight: 700; color: var(--ink); margin-top: 0.1rem; }
.next .where { font-size: 0.9rem; color: var(--ink-2); }

/* ---------- Page frame ---------- */
main { max-width: 76rem; margin: 0 auto; padding: 1.75rem 1.25rem 3.5rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head p { margin: 0.35rem 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Staff area: side menu + content. */
.shell { max-width: 76rem; margin: 0 auto; padding: 1.5rem 1.25rem 3.5rem; display: flex; flex-wrap: wrap; gap: 1.75rem; align-items: flex-start; }
.shell > main { padding: 0; margin: 0; flex: 999 1 36rem; min-width: 0; max-width: none; }
.side { flex: 1 1 13rem; max-width: 15rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--e1); padding: 0.75rem; }
.side .group { font-size: 0.78rem; font-weight: 650; color: var(--muted); padding: 0.75rem 0.6rem 0.3rem; }
.side .group:first-child { padding-top: 0.25rem; }
.side a { display: block; padding: 0.45rem 0.6rem; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 0.95rem; }
.side a:hover { background: var(--surface-2); color: var(--ink); }
.side a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); }
.side .sep { border-top: 1px solid var(--line); margin: 0.6rem 0.25rem; }

/* ---------- Surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--e1); padding: 1.25rem 1.35rem; }
.panel + .panel { margin-top: 1rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel.raised { box-shadow: var(--e2); }
.panel.callout { background: var(--brand-soft); border-color: transparent; box-shadow: none; }
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--e1); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.35rem; }
.card h3 { margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.card p { margin: 0; }
.card .go { margin-top: auto; padding-top: 0.5rem; font-weight: 600; }
.card.done { border-color: var(--line); }
.card.todo { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--e1); }
.card.spaced, .spaced { margin-bottom: 1rem; }
h2.flush { margin-top: 0; }

/* Key numbers in a row. */
.stats { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); margin: 0 0 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0.8rem 1rem; box-shadow: var(--e1); }
.stat dt { color: var(--muted); font-size: 0.85rem; }
.stat dd { margin: 0.15rem 0 0; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */
.table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--e1); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 650; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; }
.scroll { overflow-x: auto; }
tr.lead td { font-weight: 650; }
.rank { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--surface-2); font-size: 0.85rem; font-weight: 700; color: var(--ink-2); }
tr.lead .rank { background: var(--brand); color: var(--on-brand); }

/* ---------- Forms ---------- */
form.stack { display: grid; gap: 0.35rem; max-width: 34rem; }
form.stack label { font-weight: 600; font-size: 0.9rem; margin-top: 0.6rem; color: var(--ink-2); }
form.inline { display: inline; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { padding: 0.5rem 0.65rem; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); min-width: 0; min-height: 2.5rem; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
textarea { width: 100%; min-height: 10rem; font-family: var(--mono); font-size: 0.85rem; }
input[type="file"] { padding: 0.4rem; background: var(--surface-2); }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 2.5rem; padding: 0.5rem 1rem; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand); cursor: pointer; text-decoration: none; font-weight: 650; font-size: 0.95rem; box-shadow: 0 1px 1px rgba(18, 32, 58, 0.12); }
button:hover, .button:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
button.secondary, .button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--e1); }
button.secondary:hover, .button.secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--muted); }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--brand); font-weight: 500; text-decoration: underline; box-shadow: none; }
button.link:hover { background: none; color: var(--brand-strong); }
.score { width: 4.5rem; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- Messages and tags ---------- */
.flash { max-width: 76rem; margin: 1rem auto 0; padding: 0.8rem 1rem 0.8rem 2.6rem; border-radius: var(--r); background: var(--good-soft); color: var(--ink); border: 1px solid transparent; position: relative; font-weight: 500; }
.flash::before { content: ""; position: absolute; left: 1rem; top: 1.05rem; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--good); }
.flash.error { background: var(--bad-soft); }
.flash.error::before { background: var(--bad); }
.shell .flash, main .flash { margin: 0 0 1rem; }
.pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.78rem; font-weight: 650; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.brand { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.warnings { margin: 0; padding-left: 1.2rem; }
.warnings li { margin-bottom: 0.3rem; }
.warnings li.bad { color: var(--bad); }

/* ---------- Schedule ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin-bottom: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0.85rem 1rem; box-shadow: var(--e1); }
.filters label { display: grid; gap: 0.25rem; font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.day { margin-top: 1.75rem; }
.day > h2 { margin: 0 0 0.75rem; display: flex; align-items: baseline; gap: 0.75rem; }
.site { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--e1); margin-bottom: 1rem; overflow: hidden; }
.site > h3 { margin: 0; padding: 0.75rem 1.1rem; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 0.95rem; display: flex; justify-content: space-between; gap: 1rem; }
.game { display: grid; grid-template-columns: 6rem 1fr auto; gap: 0.25rem 1rem; padding: 0.75rem 1.1rem; border-bottom: 1px solid var(--line); align-items: center; }
.game:last-child { border-bottom: 0; }
.game .when { color: var(--muted); font-size: 0.88rem; line-height: 1.35; font-variant-numeric: tabular-nums; }
.game .when b { color: var(--ink); font-weight: 650; display: block; }
.game .teams { line-height: 1.45; }
.game .teams .meta { color: var(--muted); font-size: 0.85rem; }
.game .vs { color: var(--muted); padding: 0 0.15rem; }
.game .result { font-weight: 750; font-variant-numeric: tabular-nums; background: var(--surface-2); border-radius: 8px; padding: 0.25rem 0.6rem; min-width: 4.25rem; text-align: center; }
.game .result.final { background: var(--brand-ink); color: #fff; }
.game .result.off { font-weight: 600; color: var(--warn); background: var(--warn-soft); }
.win { font-weight: 700; }
.div-tag { display: inline-block; font-size: 0.78rem; font-weight: 700; color: var(--brand-strong); background: var(--brand-soft); border-radius: 6px; padding: 0.05rem 0.4rem; margin-right: 0.35rem; }

/* Staff schedule grid. */
.grid-table td { min-width: 9rem; font-size: 0.88rem; }
.grid-table td.open { color: var(--muted); background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-2) 6px 12px); }
.grid-table td.slot { font-weight: 650; white-space: nowrap; }

/* ---------- Brackets ---------- */
.bracket-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--e1); padding: 1rem 1.1rem; margin-bottom: 1.25rem; }
.bracket-wrap > h2 { margin: 0 0 0.75rem; display: flex; align-items: center; gap: 0.6rem; }
.bracket { display: flex; gap: 1.25rem; overflow-x: auto; padding-bottom: 0.25rem; }
.round { min-width: 14rem; display: flex; flex-direction: column; gap: 0.5rem; }
.round h4 { margin: 0; font-size: 0.8rem; color: var(--muted); font-weight: 650; }
.round-games { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 0.75rem; }
.match { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; font-size: 0.92rem; }
.match .side-row { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.65rem; }
.match .side-row + .side-row { border-top: 1px solid var(--line); }
.match .side-row.win { background: var(--brand-soft); color: var(--brand-strong); }
.match .seed { display: inline-block; min-width: 1.2rem; color: var(--muted); font-weight: 650; font-size: 0.8rem; }
.match .info { padding: 0.3rem 0.65rem; background: var(--surface-2); color: var(--muted); font-size: 0.8rem; border-top: 1px solid var(--line); }
.champion { margin-top: 0.9rem; display: inline-flex; align-items: center; gap: 0.6rem; background: var(--brand-ink); color: #fff; border-radius: 999px; padding: 0.4rem 0.9rem 0.4rem 0.45rem; font-weight: 650; }
.champion .medal { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--live); display: inline-grid; place-items: center; color: #fff; font-size: 0.8rem; font-weight: 800; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

/* ---------- Footer ---------- */
.foot { max-width: 76rem; margin: 0 auto; padding: 1.25rem 1.25rem 2.5rem; color: var(--muted); font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem; }
.foot img { width: 18px; height: 18px; }

/* ---------- Sign-in ---------- */
.auth { max-width: 26rem; margin: 3rem auto; }
.auth .panel { padding: 1.75rem; box-shadow: var(--e2); }
.auth h1 { margin-bottom: 0.5rem; }

/* ---------- Small screens ---------- */
@media (max-width: 40rem) {
  h1 { font-size: 1.5rem; }
  .hero-card { padding: 1.1rem 1.15rem; }
  .hero-card h1 { font-size: 1.55rem; }
  .next { margin-left: 0; width: 100%; min-width: 0; }
  .bar .who { width: 100%; margin-left: 0; justify-content: space-between; }
  .bar .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
  .game { grid-template-columns: 4.5rem 1fr auto; padding: 0.7rem 0.85rem; gap: 0.25rem 0.65rem; }
  .wide { display: none; }
  th, td { padding: 0.55rem 0.5rem; }
  .side { max-width: none; flex-basis: 100%; display: flex; gap: 0.25rem; overflow-x: auto; padding: 0.4rem; }
  .side .group, .side .sep { display: none; }
  .side a { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
a.card { color: inherit; text-decoration: none; transition: box-shadow 0.15s ease, border-color 0.15s ease; }
a.card:hover { border-color: var(--line-strong); box-shadow: var(--e2); color: inherit; }
a.card .go { color: var(--brand); }
.step-num { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; font-size: 0.8rem; font-weight: 750; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.card.done .step-num { background: var(--good); color: #fff; border-color: transparent; }
.card.todo .step-num { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.spaced-top { margin: 1rem 0 0.5rem; }
.panel.callout { margin-bottom: 1rem; }
@media (prefers-color-scheme: dark) {
  .game .result.final { background: var(--brand-soft); color: var(--ink); }
  .champion { background: var(--brand-soft); color: var(--ink); }
}
td a { text-decoration: none; font-weight: 600; }
td a:hover { text-decoration: underline; }
td .small { display: block; line-height: 1.3; margin-top: 0.15rem; }
