/* Trader Su Tournament: shared styles. Tokens per web/UI-SPEC.md; every colour, family and radius below resolves to a var. */
:root {
  --ground: #090B0D;
  --surface: #0F1316;
  --raised: #151A1E;
  --line: #232B31;
  --ink: #E6EBEE;
  --muted: #87939C;
  --accent: #36E2F0;
  --loss: #FF4054;
  --down: #E07A86;
  --accent-glow: rgba(54, 226, 240, 0.42);
  --accent-soft: rgba(54, 226, 240, 0.12);
  --loss-soft: rgba(255, 64, 84, 0.12);
  --on-accent: #090B0D;
  --glass: rgba(15, 19, 22, 0.62);
  --glass-line: rgba(230, 235, 238, 0.12);
  --tick: rgba(230, 235, 238, 0.5);
  --scrim-0: rgba(9, 11, 13, 0.94);
  --scrim-1: rgba(9, 11, 13, 0.72);
  --scrim-2: rgba(9, 11, 13, 0.2);
  --clear: rgba(9, 11, 13, 0);
  --s-hero: clamp(40px, 5.2vw, 84px);
  --s-h2: clamp(28px, 3vw, 46px);

  /* futurism (2026-10-23): Tektur, an engineered display face, over Golos Text; JetBrains Mono for every figure */
  --f-display: "Tektur", "Golos Text", sans-serif;
  --f-text: "Golos Text", sans-serif;
  --f-mono: "JetBrains Mono", monospace;

  --s12: 12px; --s14: 14px; --s16: 16px; --s18: 18px; --s21: 21px; --s28: 28px; --s38: 38px; --s50: 50px; --s66: 66px;
  --s-display: clamp(40px, 5.2vw, 84px);

  /* futurism: square frames. 2px only on flags, chips and the language switch */
  --r0: 2px;
  --r1: 2px;
  --r2: 0px;

  --gut: clamp(16px, 4.2vw, 64px);
  --max: 1400px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  /* the side rulers sit 36px outside the content edge (shown at 1100px and wider) */
  --rail-x: max(calc(var(--gut) - 30px), calc((100vw - var(--max)) / 2 + var(--gut) - 36px));
  --cl: 12px;   /* corner bracket arm */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--f-text); font-size: var(--s16); line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: var(--r1); }
.num, .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gut); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 20; background: var(--ground); border-bottom: 1px solid var(--glass-line); }
.nav .wrap { display: flex; align-items: center; gap: 28px; height: 68px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand b { font-family: var(--f-display); font-weight: 500; font-size: var(--s18); letter-spacing: .04em; }
.brand span { color: var(--muted); font-size: var(--s14); }
.nav-links { display: flex; gap: 24px; margin-left: auto; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: var(--s14); }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a { position: relative; padding: 4px 0; }
.nav-links a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--accent); }
.lang { display: flex; border: 1px solid var(--line); border-radius: var(--r1); overflow: hidden; }
.lang button { background: none; border: 0; padding: 6px 10px; font-size: var(--s12); color: var(--muted); cursor: pointer; font-family: var(--f-mono); }
.lang button[aria-pressed="true"] { background: var(--raised); color: var(--ink); }
.nav .btn { padding: 9px 16px; font-size: var(--s14); }
/* header ticket link: an outline, ink on glass, cyan on hover; the fill and the glow stay on the hero and closing buttons */
.nav .btn-nav { background: var(--glass); border-color: var(--muted); color: var(--ink); white-space: nowrap; }
.nav .btn-nav:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 860px) {
  .nav .wrap { gap: 12px; height: auto; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
  .nav-links { order: 3; width: 100%; margin-left: 0; gap: 18px; overflow-x: auto; }
  .nav .lang { margin-left: auto; }
  .brand span { display: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 22px; border-radius: var(--r1); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer;
  font-weight: 500; font-size: var(--s16); line-height: 1.2; transition: background-color .2s, border-color .2s, transform .15s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-buy {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 28px var(--accent-glow);
  animation: glow 3.2s ease-in-out infinite;
}
.btn-buy:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 44px var(--accent-glow); }
.btn-big { padding: 19px 28px; font-family: var(--f-display); font-weight: 500; font-size: var(--s16); text-transform: uppercase; letter-spacing: .03em; }
.btn-buy[disabled], .btn-buy[disabled]:hover { animation: none; box-shadow: none; background: var(--raised); border-color: var(--line); color: var(--muted); opacity: 1; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 1px var(--accent), 0 0 22px var(--accent-glow); } 50% { box-shadow: 0 0 0 1px var(--accent), 0 0 46px var(--accent-glow); } }
.btn-ghost { background: none; }
.btn-loss { background: var(--loss); border-color: var(--loss); color: var(--ink); }

/* ---------- type ---------- */
.display { font-family: var(--f-display); font-weight: 500; font-size: var(--s-display); line-height: .94; letter-spacing: -.005em; text-transform: uppercase; margin: 0; }
h2.h { font-family: var(--f-display); font-weight: 500; font-size: var(--s-h2); line-height: 1; letter-spacing: 0; text-transform: uppercase; margin: 0 0 32px; }
h3 { font-size: var(--s21); font-weight: 500; margin: 0 0 8px; line-height: 1.3; }
.lead { font-size: clamp(18px, 1.6vw, 21px); color: var(--muted); max-width: 40ch; margin: 0; }
p { margin: 0 0 14px; }
.small { font-size: var(--s14); }
.tiny { font-size: var(--s12); }

/* ---------- sections ---------- */
section.band { position: relative; padding: clamp(56px, 8vw, 112px) 0; border-top: 1px solid var(--line); }

/* ---------- status chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r1); font-size: var(--s12); font-weight: 500; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.active { color: var(--ink); border-color: var(--accent); }
.chip.active::before { content: ""; width: 6px; height: 6px; border-radius: var(--r1); background: var(--accent); }
.chip.total_loss, .chip.disqualified { color: var(--loss); border-color: var(--loss); background: var(--loss-soft); }
.chip.completed { color: var(--ink); }
.chip.registered { color: var(--ink); border-color: var(--muted); }
.chip.verify_failed { color: var(--loss); border-color: var(--loss); }
.chip.verifying::before { content: ""; width: 6px; height: 6px; border-radius: var(--r1); background: var(--accent); animation: beat 1.6s var(--ease) infinite; }
@keyframes beat { 0% { box-shadow: 0 0 0 0 var(--accent-glow); } 70%, 100% { box-shadow: 0 0 0 7px var(--clear); } }
@media (prefers-reduced-motion: reduce) { .chip.verifying::before { animation: none; } }
.xmark { display: inline-block; width: 1em; height: 1em; vertical-align: -.12em; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--s16); }
.table th { text-align: left; font-weight: 400; color: var(--muted); font-size: var(--s14); padding: 0 12px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table .r { text-align: right; }
.table tr.moving { transition: transform .3s var(--ease); }
.flag { display: inline-block; width: 20px; height: 15px; border-radius: var(--r0); vertical-align: -2px; object-fit: cover; }
.flag-code { font-family: var(--f-mono); font-size: var(--s12); color: var(--muted); }
.who { display: flex; align-items: center; gap: 10px; }
.pos { color: var(--accent); }
.neg { color: var(--down); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field label { font-size: var(--s14); color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r1);
  padding: 13px 14px; font-size: var(--s16); color: var(--ink);
}
.input:focus { border-color: var(--muted); outline: none; }
.input.bad { border-color: var(--loss); }
.hint { font-size: var(--s12); color: var(--muted); }
.err { color: var(--loss); font-size: var(--s14); min-height: 1em; }
.ok { color: var(--accent); font-size: var(--s14); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 40px 0 56px; color: var(--muted); font-size: var(--s14); }
.foot .wrap { display: grid; gap: 14px; }
.foot nav { display: flex; gap: 20px; flex-wrap: wrap; }
.foot p { max-width: 90ch; margin: 0; }

/* ---------- motion shared by the landing and the inner pages (2026-10-22) ---------- */
/* live dot: a slow pulse ring, the "this updates" signal of a trading screen */
.live { display: flex; align-items: center; gap: 8px; }
.live .dot { position: relative; flex: none; width: 7px; height: 7px; border-radius: var(--r1); background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.live .dot::after { content: ""; position: absolute; inset: 0; border-radius: var(--r1); border: 1px solid var(--accent); animation: ping 2.4s cubic-bezier(.2, .7, .2, 1) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: .9; } 70%, 100% { transform: scale(3.2); opacity: 0; } }
/* leaderboard rows enter once with a stagger; a row that changes rank slides (FLIP) and glows briefly */
.table.reveal tbody tr { opacity: 0; transform: translateY(12px); }
.table.reveal.go tbody tr { opacity: 1; transform: none; transition: opacity .5s var(--ease), transform .5s var(--ease); transition-delay: calc(var(--i, 0) * 60ms); }
.table tr.moved td { animation: moved 1.4s ease-out; }
@keyframes moved { from { background-color: var(--accent-soft); } to { background-color: var(--clear); } }
/* the big buy buttons on the landing hero and closing band: a soft light sweep on hover only */
.hero .btn-buy, .closing .btn-buy { position: relative; overflow: hidden; }
.hero .btn-buy::after, .closing .btn-buy::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 45%; pointer-events: none;
  background: linear-gradient(100deg, rgba(228, 236, 241, 0), rgba(228, 236, 241, .45), rgba(228, 236, 241, 0)); transform: translateX(-120%) skewX(-12deg); }
.hero .btn-buy:hover::after, .closing .btn-buy:hover::after { transition: transform .8s cubic-bezier(.2, .7, .2, 1); transform: translateX(260%) skewX(-12deg); }

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

/* ---------- glass + scene (round 4) ---------- */
.glass { position: relative; background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--r2);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
/* inner pages: the night desk photograph behind the top of the page, dimmed by a ground scrim */
.scene { position: absolute; left: 0; right: 0; top: 0; height: clamp(420px, 62vh, 640px); overflow: hidden; z-index: 0; pointer-events: none; }
.scene img { width: 100%; height: 100%; object-fit: cover; object-position: 78% 40%; opacity: .5; }
.scene .scrim { position: absolute; inset: 0; background: linear-gradient(180deg, var(--scrim-1) 0%, var(--scrim-1) 35%, var(--ground) 100%); }
.has-scene main, .has-scene .foot { position: relative; z-index: 1; }

/* ================= motion pass 2 (2026-10-23): smoothness across every page =================
   All of it lives under html.mo, which motion.js sets only when the visitor has not asked for reduced motion,
   so the reduced-motion page (and a page whose JS failed) is the finished, still page. Transform, opacity and
   clip-path only. Eases: --e-out for arrivals, --e-io for state changes. */
:root { --e-out: cubic-bezier(.16, 1, .3, 1); --e-io: cubic-bezier(.65, 0, .35, 1); }

/* smooth wheel scroll (Lenis) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: clip; }

/* header: floats clear over the landing photograph, turns to glass past 40px, steps aside on the way down */
.mo .nav { transition: transform .55s var(--e-out), background-color .4s ease, border-color .4s ease; }
.mo .nav.away { transform: translateY(-101%); }
.mo .nav:not(.solid):has(~ main > .hero:first-child) { background: var(--clear); border-bottom-color: var(--clear); -webkit-backdrop-filter: none; backdrop-filter: none; }
/* reading progress: a hairline under the header, drawn by --sp */
.mo .nav::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--accent); opacity: .7;
  transform-origin: 0 50%; transform: scaleX(var(--sp, 0)); pointer-events: none; }

/* reveals: a heading wipes up through its own mask; everything else rises and clears */
.mo .rv-h { clip-path: inset(-12% -4% 100% -4%); transform: translateY(.42em); }
.mo .rv-h.in { clip-path: inset(-12% -4% -24% -4%); transform: none; transition: clip-path 1.1s var(--e-out), transform 1.1s var(--e-out); }
.mo .rv { opacity: 0; transform: translateY(26px); }
.mo .rv.in { opacity: 1; transform: none; transition: opacity .9s var(--e-out), transform 1.1s var(--e-out); }
@media (min-width: 900px) { .mo .rv.in, .mo .rv-h.in { transition-delay: calc(var(--ri, 0) * 90ms); } }

/* FAQ and any <details>: the answer opens with its height (where the browser can animate to auto) */
@supports (interpolate-size: allow-keywords) {
  .mo { interpolate-size: allow-keywords; }
  .mo details::details-content { block-size: 0; overflow: clip; opacity: 0; transition: block-size .5s var(--e-out), opacity .4s ease, content-visibility .5s allow-discrete; }
  .mo details[open]::details-content { block-size: auto; opacity: 1; }
}

/* page to page: the content crossfades and settles, the header stays put (Chromium; elsewhere a normal load) */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .nav { view-transition-name: nav; }
  ::view-transition-old(root) { animation: vt-out .22s ease both; }
  ::view-transition-new(root) { animation: vt-in .5s var(--e-out) both; }
}
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* motion pass 2, judge round 9: no layout jump when a dialog stops the page scroll; paper shows every block */
html { scrollbar-gutter: stable; }
@media print { .mo .rv, .mo .rv-h { opacity: 1 !important; transform: none !important; clip-path: none !important; } }

/* ================= futurism (2026-10-23, Albert): an instrument, not a card deck =================
   Colour comes only from tokens; the geometry (corner brackets, ruler ticks, registration crosses) is drawn with
   masks over a token colour, so no gradient is ever painted as a surface. */

/* corner brackets: four 12px arms on the frame's corners, one mask over the tick colour */
.glass::before, .bracket::before { content: ""; position: absolute; inset: -1px; pointer-events: none; z-index: 1;
  border: 1px solid var(--tick);
  -webkit-mask: conic-gradient(at var(--cl) var(--cl), transparent 75%, black 0) 0 0 / calc(100% - var(--cl)) calc(100% - var(--cl));
  mask: conic-gradient(at var(--cl) var(--cl), transparent 75%, black 0) 0 0 / calc(100% - var(--cl)) calc(100% - var(--cl)); }
.bracket { position: relative; }

/* the side rulers: a hairline with a tick every 16px and a long tick every 128px, fixed while the page moves */
@media (min-width: 1100px) {
  body:not(:has(> main.adm))::before, body:not(:has(> main.adm))::after { content: ""; position: fixed; top: 0; bottom: 0; width: 13px; z-index: -1; pointer-events: none;
    background: var(--muted); opacity: .45; }   /* behind the pictures and panels: the bezel, not an overlay */
  body::before { left: var(--rail-x);
    -webkit-mask: linear-gradient(black, black) 0 0 / 1px 100% no-repeat, repeating-linear-gradient(black 0 1px, transparent 1px 16px) 0 0 / 5px 100% no-repeat, repeating-linear-gradient(black 0 1px, transparent 1px 128px) 0 0 / 13px 100% no-repeat;
    mask: linear-gradient(black, black) 0 0 / 1px 100% no-repeat, repeating-linear-gradient(black 0 1px, transparent 1px 16px) 0 0 / 5px 100% no-repeat, repeating-linear-gradient(black 0 1px, transparent 1px 128px) 0 0 / 13px 100% no-repeat; }
  body::after { right: var(--rail-x);
    -webkit-mask: linear-gradient(black, black) 100% 0 / 1px 100% no-repeat, repeating-linear-gradient(black 0 1px, transparent 1px 16px) 100% 0 / 5px 100% no-repeat, repeating-linear-gradient(black 0 1px, transparent 1px 128px) 100% 0 / 13px 100% no-repeat;
    mask: linear-gradient(black, black) 100% 0 / 1px 100% no-repeat, repeating-linear-gradient(black 0 1px, transparent 1px 16px) 100% 0 / 5px 100% no-repeat, repeating-linear-gradient(black 0 1px, transparent 1px 128px) 100% 0 / 13px 100% no-repeat; }
  /* the position mark: a short cyan bar on the left ruler that rides the scroll (CSS scroll timeline, no JS) */
  body:not(:has(> main.adm)) > main::before { content: ""; position: fixed; z-index: -1; left: var(--rail-x); top: 0; width: 13px; height: 2px; pointer-events: none;
    background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); transform: translateY(120px); }
  @supports (animation-timeline: scroll()) {
    body:not(:has(> main.adm)) > main::before { animation: railmark linear both; animation-timeline: scroll(root); }
  }
  /* registration crosses where a section line meets each ruler */
  section.band::before, section.band::after { content: ""; position: absolute; top: -7px; width: 13px; height: 13px; pointer-events: none; z-index: 2;
    background: var(--tick);
    -webkit-mask: linear-gradient(black, black) 50% 0 / 1px 100% no-repeat, linear-gradient(black, black) 0 50% / 100% 1px no-repeat;
    mask: linear-gradient(black, black) 50% 0 / 1px 100% no-repeat, linear-gradient(black, black) 0 50% / 100% 1px no-repeat; }
  section.band::before { left: calc(var(--rail-x) - 6px); }
  section.band::after { right: calc(var(--rail-x) - 6px); }
}
@keyframes railmark { from { transform: translateY(120px); } to { transform: translateY(calc(100vh - 24px)); } }

/* instrument readouts: a lowercase label over a figure, cells on hairlines, inside definition lists */
.tele { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--glass-line); border-bottom: 1px solid var(--glass-line); }
.tele > div { padding: 10px 14px 11px; min-width: 0; }
.tele > div + div { border-left: 1px solid var(--glass-line); }
.tele dt { font-size: var(--s12); color: var(--muted); line-height: 1.2; margin-bottom: 4px; }
.tele dd { margin: 0; font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* header controls: the ticket link and the brand set in the engineered face */
.lang { border-radius: var(--r0); }
.nav .btn-nav { font-family: var(--f-display); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; font-size: var(--s14); padding: 9px 16px; }

/* leaderboard hard-deck bar: from the floor (red tick, left) to the balance, start marked in the middle */
.deck { display: block; position: relative; height: 7px; margin-top: 6px; margin-left: auto; width: min(140px, 100%); }
.deck::before { content: ""; position: absolute; left: 0; right: 0; top: 3px; height: 1px; background: var(--line); }
.deck b { position: absolute; left: 0; top: 2px; height: 3px; width: calc(var(--u, 0) * 100%); background: var(--muted); }
.deck.up b { background: var(--accent); }
.deck.dn b { background: var(--down); }
.deck i { position: absolute; top: 0; width: 1px; height: 7px; background: var(--ink); left: calc(var(--s, .5) * 100%); }
.deck i.f { left: 0; background: var(--loss); }

/* one voice for every heading and button (judge round 10): Tektur 500 capitals; the hero and closing CTAs keep their size */
.sub-h, .dm-head h2 { font-family: var(--f-display); font-weight: 500; text-transform: uppercase; letter-spacing: .01em; line-height: 1.15; text-wrap: balance; }
.btn { font-family: var(--f-display); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; font-size: var(--s14); }
.btn-big { font-size: var(--s16); }
/* phones: two header rows at most, the ticket link on the brand row, links and language below */
@media (max-width: 600px) {
  .nav .wrap { gap: 10px 12px; }
  .nav .btn-nav { order: 2; margin-left: auto; font-size: var(--s12); padding: 8px 10px; }
  .nav-links { order: 3; width: auto; flex: 1 1 auto; min-width: 0; gap: 16px; }
  .nav .lang { order: 4; margin-left: 0; }
}
