/* ==========================================================================
   Sit & Go bracket board.

   The first stylesheet in this project that is not css/styles.css, and split
   out for the same reason js/tournament-bracket.js is: the board is now a
   measured, two-sided layout with an SVG overlay, which is a different kind
   of thing from the screen chrome around it. The chrome — .tn-main, .tn-head,
   .tn-note, .tn-side, the ready popup — deliberately stays in styles.css,
   because it is shared with the dashboard card and is not what changed.

   LOADED AFTER styles.css, which matters: .tn-scroll and .tn-board are
   redefined here, and equal specificity means the later sheet wins. Do not
   reorder the two <link> tags.
   ========================================================================== */

/* ==================== §3 THE STATUS LINE ====================
   One line, three weights. The pill is the loudest thing in the header after
   the title, the stage is the readable middle, and the progress is the
   footnote you look at second — which is the hierarchy the old flat sentence
   ("Round of 16 • 16 players remaining") did not have. */
.tn-status {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px;
  margin-top: 6px;
}
.tn-status-pill {
  font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .18em;
  padding: 3px 10px; border-radius: 999px; align-self: center;
  color: #cbd5e1; background: rgba(148, 163, 184, .16);
  border: 1px solid rgba(148, 163, 184, .35);
}
/* Under way. The same red the live match card uses, so "LIVE" in the header
   and the pulsing card below it are recognisably the same fact. */
.tn-status[data-status="ROUND_OF_32"] .tn-status-pill,
.tn-status[data-status="ROUND_OF_16"] .tn-status-pill,
.tn-status[data-status="QUARTERFINALS"] .tn-status-pill,
.tn-status[data-status="SEMIFINALS"] .tn-status-pill,
.tn-status[data-status="FINAL"] .tn-status-pill {
  color: #fecaca; background: rgba(239, 68, 68, .2); border-color: rgba(239, 68, 68, .55);
}
.tn-status[data-status="REGISTERING"] .tn-status-pill,
.tn-status[data-status="FULL"] .tn-status-pill,
.tn-status[data-status="STARTING"] .tn-status-pill {
  color: #fde68a; background: rgba(245, 158, 11, .18); border-color: rgba(251, 191, 36, .5);
}
.tn-status[data-status="COMPLETED"] .tn-status-pill {
  color: #86efac; background: rgba(34, 197, 94, .16); border-color: rgba(34, 197, 94, .45);
}
.tn-status-stage {
  font-size: 15px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em;
  color: #e2e8f0;
}
.tn-status-sep { color: #475569; font-size: 12px; }
.tn-status-sep:empty { display: none; }
.tn-status-progress { font-size: 12px; font-weight: 700; color: #94a3b8; }
.tn-status-progress:empty { display: none; }

/* ==================== §4 THE STAGE LADDER ====================
   Six rungs across the top of the board. Deliberately small: it is an
   orientation aid, and anything with more presence would compete with the
   bracket it is describing. Scrolls inside itself rather than wrapping,
   because six rungs on two lines stop reading as a sequence. */
.tn-stages {
  grid-area: stages;
  display: flex; align-items: center; gap: 4px;
  overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
}
.tn-stages::-webkit-scrollbar { display: none; }
.tn-stage {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .16); background: rgba(24, 24, 27, .5);
  font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .14em;
  color: #64748b;
  transition: color var(--mo-dur-normal, 250ms) var(--mo-ease-standard, ease),
              border-color var(--mo-dur-normal, 250ms) var(--mo-ease-standard, ease),
              background-color var(--mo-dur-normal, 250ms) var(--mo-ease-standard, ease);
}
/* The chevrons between rungs. Drawn as a pseudo-element on the rung rather
   than as elements of their own, so the ladder has six children and not
   eleven — and so a rung can be styled without reaching past a separator. */
.tn-stage + .tn-stage::before {
  content: "";
  width: 10px; height: 1px; margin-left: -6px; margin-right: 2px;
  background: rgba(148, 163, 184, .3); flex: 0 0 auto;
}
.tn-stage-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto;
  background: currentColor; opacity: .5;
}
/* Completed: the same restrained green the winner seats use. */
.tn-stage[data-state="done"] {
  color: #4ade80; border-color: rgba(34, 197, 94, .3); background: rgba(34, 197, 94, .08);
}
.tn-stage[data-state="done"] .tn-stage-dot { opacity: 1; }
/* Current: the primary highlight, and the only rung with any glow. */
.tn-stage[data-state="current"] {
  color: #fde68a; border-color: rgba(251, 191, 36, .6); background: rgba(245, 158, 11, .14);
  box-shadow: 0 0 14px rgba(245, 158, 11, var(--mo-glow-subtle, .18));
}
.tn-stage[data-state="current"] .tn-stage-dot { opacity: 1; }
.tn-stage[data-state="upcoming"] { opacity: .65; }
@media (prefers-reduced-motion: reduce) { .tn-stage { transition: none; } }

/* ==================== §2 THE REGISTRATION PANEL ====================
   What the board area shows before there is a board. Belongs to the same
   dark/premium system as the bracket rather than reading as a placeholder,
   because for most of a tournament's life this IS the screen. */
/* The board is a three-track grid, so without this the panel drops into the
   left-hand track and sits a third of the way across the page instead of
   centred under the header. Same reason .tn-empty spans. */
.tn-board > .tn-reg { grid-column: 1 / -1; }
/* An explicit width, not max-width. `margin: 0 auto` on a grid item opts it
   out of stretch alignment, so a max-width alone leaves the panel at its
   fit-content size — which is however wide the longest line inside it happens
   to be, and looked like a small box adrift in a wide empty board. */
.tn-reg {
  width: min(560px, 100%); margin: 0 auto; padding: 40px 32px;
  text-align: center;
  border-radius: 18px;
  border: 1px solid rgba(251, 191, 36, .28);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(245, 158, 11, .1), rgba(2, 6, 23, 0) 70%),
    linear-gradient(160deg, rgba(30, 27, 20, .8), rgba(24, 24, 27, .82));
}
.tn-reg-label {
  font-size: 10px; font-weight: 900; text-transform: uppercase;
  letter-spacing: .28em; color: #fcd34d;
}
.tn-reg-count {
  margin-top: 14px;
  font-family: var(--mono); font-weight: 900; letter-spacing: .02em; color: #e2e8f0;
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
}
.tn-reg-now { font-size: 52px; line-height: 1; color: #fcd34d; }
.tn-reg-cap { font-size: 26px; color: #64748b; }
.tn-reg-of {
  margin-top: 6px;
  font-size: 10px; font-weight: 900; text-transform: uppercase;
  letter-spacing: .22em; color: #94a3b8;
}
.tn-reg-bar {
  margin-top: 22px; height: 8px; border-radius: 999px; overflow: hidden;
  background: rgba(15, 23, 42, .8); border: 1px solid rgba(148, 163, 184, .18);
}
/* The width is set inline by the renderer and transitions because the panel
   is patched, never rebuilt — a rebuilt element restarts its transition from
   scratch on every one of the ~1/second renders and would never appear to
   move. This is the Phase A diffing work paying off in a visible way. */
.tn-reg-fill {
  display: block; height: 100%; width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #fcd34d);
  transition: width var(--mo-dur-slow, 450ms) var(--mo-ease-standard, ease);
}
.tn-reg[data-full="1"] .tn-reg-fill { background: linear-gradient(90deg, #22c55e, #4ade80); }
@media (prefers-reduced-motion: reduce) { .tn-reg-fill { transition: none; } }
.tn-reg-foot { margin-top: 14px; font-size: 12px; font-weight: 700; color: #94a3b8; }

:root[data-theme="day"] .tn-status-stage { color: #1f2937; }
:root[data-theme="day"] .tn-status-progress { color: #475569; }
:root[data-theme="day"] .tn-stage { background: rgba(255, 255, 255, .7); color: #64748b; }
:root[data-theme="day"] .tn-stage[data-state="done"] { color: #15803d; background: rgba(34, 197, 94, .12); }
:root[data-theme="day"] .tn-stage[data-state="current"] { color: #92400e; background: rgba(245, 158, 11, .16); }
:root[data-theme="day"] .tn-reg {
  background: linear-gradient(160deg, rgba(255, 251, 235, .95), rgba(255, 255, 255, .88));
}
:root[data-theme="day"] .tn-reg-now { color: #b45309; }
:root[data-theme="day"] .tn-reg-label { color: #b45309; }
:root[data-theme="day"] .tn-reg-bar { background: rgba(226, 232, 240, .9); }

/* The board no longer sets min-width:max-content, so at desktop and laptop
   widths there is nothing to scroll and no scrollbar appears. overflow-x
   stays as the escape hatch below the floor .tn-col sets: a squeezed bracket
   would be unreadable long before it is unusable, so under about 1100px this
   scrolls rather than compressing to nothing. Stage-by-stage navigation for
   real phone widths is a later phase; this is the graceful part. */
.tn-scroll { grid-area: board; overflow-x: auto; padding-bottom: 8px; }

/* Three tracks: two halves that share whatever width is going, and a centre
   that takes what it needs. minmax(0,1fr) rather than 1fr because a grid
   track's default min-content floor would be the widest player name in the
   column, which is exactly the overflow this replaces.

   The three numbers below move TOGETHER, which is why they are tokens rather
   than three unrelated media queries: eight columns, a centre and their gaps
   all come out of one width, so shrinking the column while leaving the centre
   alone just moves the overflow somewhere less obvious. The ladder is set so
   the whole board fits without scrolling down to 1280px — a laptop — and
   below that .tn-scroll takes over rather than the cards compressing into
   nothing. */
.tn-board {
  --tnb-col: 96px;
  --tnb-centre: 230px;
  --tnb-colgap: 10px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
/* Tokens only. The typography that rides the same ladder is further down,
   AFTER the rules it overrides — a media query adds no specificity, so an
   override placed above its own base rule loses to it and does nothing. */
/* The rungs are keyed to where the BOARD's width actually changes, which is
   not where the viewport does: at 1500 the side panel drops below the bracket
   (see .tn-main in styles.css) and the board abruptly gains ~320px, so there
   is deliberately no rung there — the columns simply get wider. The next real
   squeeze is when the page itself runs out. */
/* 1150, not 1100. The base rung needs a ~1130px viewport to hold a 96px
   column once the centre and the gaps are paid for, so a rung at 1100 left
   1101-1129 running base tokens it could not afford — a thin band of widths
   where the board overflowed by a few pixels and nothing else on the page
   explained why. Measured, not guessed: see the arithmetic in the report. */
@media (max-width: 1150px) {
  .tn-board { --tnb-col: 78px; --tnb-centre: 196px; --tnb-colgap: 8px; gap: 10px; }
}
.tn-board > .tn-empty { grid-column: 1 / -1; text-align: center; padding: 40px 0; }

.tn-half { display: flex; gap: var(--tnb-colgap); min-width: 0; }
/* The mirror. The right half is emitted in round order like the left one, so
   the DOM still reads R32 -> SF on both sides and only the picture flips. */
.tn-half[data-side="right"] { flex-direction: row-reverse; }

.tn-col { flex: 1 1 0; min-width: var(--tnb-col); display: flex; flex-direction: column; }
/* The heading must never be what decides the board's width. "Quarterfinals"
   set at .18em is wider than the column it labels once the ladder squeezes,
   and overflowing inline text still counts toward scrollWidth — so the board
   grew a scrollbar for a WORD, with every card comfortably inside. The
   tracking drops with the ladder so it fits honestly; the ellipsis is the
   guarantee that it can never push the layout again whatever the label says.
   One line always: a head that wrapped in one column would push that column's
   nodes down and break the row alignment across the other seven. */
.tn-col-head {
  font-size: 9px; font-weight: 900; text-transform: uppercase;
  letter-spacing: .18em; color: #94a3b8; padding-bottom: 8px; flex: 0 0 auto;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tn-half[data-side="right"] .tn-col-head { text-align: right; }
/* The tracking rides the same ladder as the column width, so "Quarterfinals"
   still fits its own column at every step instead of being ellipsed away. */
@media (max-width: 1100px) { .tn-col-head { font-size: 8px; letter-spacing: .06em; } }
/* space-around across a stretched column is what lines a quarterfinal up with
   the middle of the two round-of-16 ties feeding it — the connectors are
   measured from the real rects either way, but the lines come out straight
   instead of dog-legged when the cards already sit where they belong. */
.tn-col-nodes {
  flex: 1; display: flex; flex-direction: column;
  gap: 6px; justify-content: space-around;
}

/* The centre is one area holding two matches that run at the same time, not a
   column of two rounds. Both are fed by the same pair of semifinals and that
   is what the connectors show. */
.tn-center {
  display: flex; flex-direction: column; justify-content: center;
  gap: 22px; width: var(--tnb-centre); padding: 0 4px;
}
.tn-center-slot { display: flex; flex-direction: column; gap: 6px; }
.tn-center .tn-col-head {
  text-align: center; padding-bottom: 0;
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
}
.tn-center-slot[data-slot="final"] .tn-col-head { color: #fcd34d; letter-spacing: .22em; }
.tn-center-slot[data-slot="third"] .tn-col-head { color: #d79b6a; }
/* The purse, from s.prizes — the same table the side panel's PRIZES list
   renders, never a second copy of the numbers (§6). Empty when the server
   sent no amount, and hidden rather than showing a bare zero. */
.tn-prize {
  font-family: var(--mono); font-size: 10px; font-weight: 900;
  letter-spacing: 0; color: #fcd34d;
}
.tn-prize:empty { display: none; }
.tn-center-slot[data-slot="third"] .tn-prize { color: #d79b6a; }
/* NOTE: the Final's own border/ground/glow lives on .tn-node[data-tier="5"]
   with the rest of the hierarchy. Do not re-add a
   `.tn-center-slot[...] .tn-node` rule for it — that selector is one class
   more specific and would silently beat the tier it belongs to. */

/* Cards sit above the connector layer. z-index 1 against the overlay's 0
   rather than pushing the overlay negative, which would drop it behind the
   board's own background and disappear.

   min-width:0 on both the card and the seat is load-bearing, not tidiness. A
   grid item's automatic minimum is its MIN-CONTENT width, so without it the
   seat refuses to be narrower than its longest player name, the card refuses
   to be narrower than the seat, and the column overflows — a horizontal
   scrollbar caused by one long name, at a width where every column had room
   to spare. The name is the part that gives; it already ellipses. */
.tn-node {
  position: relative; z-index: 1; min-width: 0;
  border-radius: 10px; padding: 7px;
  border: 1px solid rgba(148, 163, 184, .2); background: rgba(24, 24, 27, .65);
  display: grid; gap: 4px;
  transition: border-color var(--mo-dur-normal, 250ms) var(--mo-ease-standard, ease),
              box-shadow  var(--mo-dur-normal, 250ms) var(--mo-ease-standard, ease);
}
.tn-node.is-mine { border-color: rgba(0, 255, 255, .55); box-shadow: 0 0 14px rgba(0, 255, 255, .18); }

/* ---- ROUND HIERARCHY (§3) ----
   One number per round (data-tier, published by the renderer) rather than six
   round names repeated through the stylesheet. Deliberately escalates BORDER
   and GROUND rather than type size for tiers 1-3: those cards all sit in
   columns of the same width, so a larger font there would buy emphasis by
   spending the name's room — which is the exact width §1 freed up. Only the
   centre, which is 166-190px wide, escalates in size. */
.tn-node[data-tier="2"] { border-color: rgba(148, 163, 184, .28); }
.tn-node[data-tier="3"] {
  border-color: rgba(148, 163, 184, .38); padding: 8px;
  background: rgba(30, 30, 36, .72);
}
.tn-node[data-tier="3"] .tn-seat { min-height: 30px; }

/* Third place: premium, but unmistakably the junior of the two centre cards —
   bronze against the final's gold, smaller type, no glow. */
.tn-node[data-tier="4"] {
  padding: 9px; border-color: rgba(205, 127, 50, .5);
  background: linear-gradient(160deg, rgba(60, 35, 12, .6), rgba(24, 24, 27, .78));
}
.tn-node[data-tier="4"] .tn-seat { min-height: 32px; font-size: 12px; }

/* The Grand Final. The most important card on the board and the only one that
   carries a standing glow. */
.tn-node[data-tier="5"] {
  padding: 11px; border-width: 2px; border-color: rgba(251, 191, 36, .6);
  background: linear-gradient(160deg, rgba(80, 54, 4, .8), rgba(24, 24, 27, .8));
  box-shadow: 0 0 22px rgba(245, 158, 11, var(--mo-glow-subtle, .18));
}
.tn-node[data-tier="5"] .tn-seat { min-height: 38px; font-size: 13px; }

/* ---- LIVE (§4) ----
   The easiest thing on the board to find. A breathing border rather than a
   moving element: the Grand Final's own glow is standing and static, so a
   slow pulse reads as "this one is happening" without the two competing.
   Duration comes from the motion token the controller republishes, so
   reduced motion flattens it to 0ms; the media query below is the
   belt-and-braces the rest of this project uses alongside that. */
.tn-node.is-live {
  border-color: rgba(239, 68, 68, .75);
  animation: tnLivePulse var(--mo-dur-ambient, 5200ms) var(--mo-ease-standard, ease) infinite;
}
@keyframes tnLivePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(239, 68, 68, .18); border-color: rgba(239, 68, 68, .55); }
  50%      { box-shadow: 0 0 22px rgba(239, 68, 68, .42); border-color: rgba(239, 68, 68, .95); }
}
@media (prefers-reduced-motion: reduce) {
  .tn-node.is-live { animation: none; box-shadow: 0 0 16px rgba(239, 68, 68, .3); }
  .tn-node { transition: none; }
}

/* The one badge slot. Present on every card and empty on almost all of them,
   so going live is a text change on an element that already exists rather
   than a node appearing — which is what lets the border transition play. */
.tn-node-tag {
  justify-self: start; align-self: start;
  font-size: 8px; font-weight: 900; text-transform: uppercase; letter-spacing: .14em;
  padding: 2px 6px; border-radius: 999px; line-height: 1.4;
}
.tn-node-tag:empty { display: none; }
.tn-node.is-live .tn-node-tag {
  color: #fecaca; background: rgba(239, 68, 68, .22);
  border: 1px solid rgba(239, 68, 68, .5);
}
.tn-node[data-tier="5"] .tn-node-tag {
  justify-self: center;
  color: #fde68a; background: rgba(245, 158, 11, .18);
  border: 1px solid rgba(251, 191, 36, .55);
}

.tn-seat {
  display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden;
  padding: 4px 7px; border-radius: 7px; background: rgba(15, 23, 42, .55);
  font-size: 11px; color: #cbd5e1; min-height: 28px;
  transition: background-color var(--mo-dur-normal, 250ms) var(--mo-ease-standard, ease),
              color var(--mo-dur-normal, 250ms) var(--mo-ease-standard, ease),
              opacity var(--mo-dur-normal, 250ms) var(--mo-ease-standard, ease);
}
@media (prefers-reduced-motion: reduce) { .tn-seat { transition: none; } }

/* Winner: restrained, per §4 — a tint and a weight, not a bright fill. */
.tn-seat.is-winner { background: rgba(34, 197, 94, .13); color: #86efac; font-weight: 800; }
/* Eliminated: muted but still legible. Deliberately NOT struck through — a
   line through an already-ellipsed name costs the readability §2 ranks first,
   and the muting plus the winner's own marker already say who went out. Their
   run stays on the board, which is the point of §4's "never removed". */
.tn-seat.is-loser  { opacity: .5; color: #94a3b8; background: rgba(15, 23, 42, .35); }
/* Not broken UI — a slot whose occupant is decided by a match that has not
   happened yet, named after the tie that will fill it. */
.tn-seat.is-empty  { color: #64748b; font-style: italic; }
.tn-seat.is-champion { background: rgba(245, 158, 11, .2); color: #fde68a; }

.tn-seat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* Clickable seats only — driven by the same data-open-profile attribute the
   global click delegate reads, so this rule and that behaviour can never
   drift apart. Deliberately not the .pub-link class: that rule's `font:
   inherit` would reset this element's size/weight, and this bracket layout
   has no room to spare for that. */
.tn-seat-name[data-open-profile] { cursor: pointer; text-decoration: underline; text-decoration-color: rgba(148,163,184,.45); text-underline-offset: 2px; }
.tn-seat-name[data-open-profile]:hover { color: var(--cyan, #38bdf8); text-decoration-color: currentColor; }
/* The result of a settled tie. There is no scoreline in this payload (see the
   renderer's header), so this states the outcome instead. Only the winner
   carries it: the loser is already muted, and a second chip would spend the
   name's width to repeat what the first one said. */
.tn-seat-res {
  margin-left: auto; flex: 0 0 auto;
  font-size: 8px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em;
  color: #4ade80;
}
.tn-seat-res:empty { display: none; }
.tn-seat.is-champion .tn-seat-res { color: #fbbf24; }
/* In the narrow columns the word costs about twenty of the seventy pixels the
   name has — and it is the WINNER's name it takes them from, so spelling out
   the result truncated exactly the player you are trying to read while the
   loser beside them sat in full. So the narrow cards mark the result with a
   tick and the tint instead. The word stays in the DOM (font-size:0 hides it
   visually without removing it), so the result is still announced to a screen
   reader and still asserted by the suite — this is a rendering change, not a
   content one. Colour is never the only signal.

   Tiers 1-3 are every card that lives in one of the eight equal columns; only
   the centre pair, which is 170-230px wide, has room to spell it out. */
.tn-node[data-tier="1"] .tn-seat-res,
.tn-node[data-tier="2"] .tn-seat-res,
.tn-node[data-tier="3"] .tn-seat-res { font-size: 0; letter-spacing: 0; }
.tn-node[data-tier="1"] .tn-seat-res::after,
.tn-node[data-tier="2"] .tn-seat-res::after,
.tn-node[data-tier="3"] .tn-seat-res::after {
  content: "\2713"; font-size: 11px; font-weight: 900; letter-spacing: 0;
}

/* The face. Only the centre cards ask the host for one, so this collapses to
   nothing everywhere else without a rule per round. */
.tn-seat-face { display: contents; }
.tn-face { width: 26px; height: 26px; --ring: rgba(148, 163, 184, .55); }
.tn-node[data-tier="5"] .tn-face { width: 32px; height: 32px; --ring: rgba(251, 191, 36, .75); }
.tn-node[data-tier="4"] .tn-face { --ring: rgba(205, 127, 50, .7); }
.tn-seat.is-loser .tn-face { filter: grayscale(1); }

/* Mirrored seats put the name on the outer edge on both sides, so the two
   halves read symmetrically instead of one being a rotated copy. */
.tn-half[data-side="right"] .tn-seat { flex-direction: row-reverse; }
.tn-half[data-side="right"] .tn-seat-res { margin-left: 0; margin-right: auto; }

/* The connector layer. Absolutely positioned so it is out of the grid flow
   entirely — a grid item here would claim a column and shove the halves
   apart. Sized in real pixels by the renderer, so one user unit is one CSS
   pixel and the measured rects can be written straight in. */
.tn-links {
  position: absolute; left: 0; top: 0; z-index: 0;
  pointer-events: none; overflow: visible;
}
.tn-links path {
  fill: none;
  stroke: rgba(148, 163, 184, .34);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--mo-dur-slow, 450ms) var(--mo-ease-standard, ease);
}
@media (prefers-reduced-motion: reduce) { .tn-links path { transition: none; } }
/* §4: the path somebody actually travelled. An edge out of a decided tie is
   history; an edge out of an undecided one is still hypothetical, and the two
   should not look the same. Kept a shade, not a highlight — thirty-one of
   these light up over the course of a tournament. */
.tn-links path[data-advanced="1"] { stroke: rgba(74, 222, 128, .42); }

/* ==================== §4 THE ADVANCE CUE ====================
   Fired for ~900ms when a tie's winner goes from unset to set. Most of the
   work is already done by the transitions on .tn-seat — the loser fading to
   its muted state and the winner taking the green — because Phase A's
   patching keeps the elements alive long enough for them to play. This adds
   the two things a transition on a colour cannot say: that THIS card is the
   one that just changed, and which way the winner went.

   Deliberately short and small. A confirmation, not a cutscene. */
.tn-node[data-advancing="1"] {
  animation: tnAdvance var(--mo-dur-slow, 450ms) var(--mo-ease-standard, ease);
}
@keyframes tnAdvance {
  0%   { box-shadow: 0 0 0 rgba(74, 222, 128, 0); }
  35%  { box-shadow: 0 0 20px rgba(74, 222, 128, .5); }
  100% { box-shadow: 0 0 0 rgba(74, 222, 128, 0); }
}
/* A pulse running down the edge the winner just earned. The path is drawn
   parent -> child, so a dashoffset falling to zero travels toward the next
   round rather than back into the one just finished. */
.tn-links path[data-advancing="1"] {
  stroke: rgba(134, 239, 172, .95);
  stroke-width: 2;
  stroke-dasharray: 5 9;
  animation: tnFlow 800ms linear;
}
@keyframes tnFlow {
  from { stroke-dashoffset: 42; }
  to   { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  /* The state change still lands — it simply arrives rather than travelling. */
  .tn-node[data-advancing="1"] { animation: none; }
  .tn-links path[data-advancing="1"] { animation: none; stroke-dasharray: none; }
}
/* The losers' route into the third-place match. Dashed because it is a
   different kind of edge, not a weaker one — these two lines are the whole
   reason the third-place match is in the centre rather than in a column of
   its own pretending to happen afterwards. */
.tn-links path[data-kind="loser"] {
  stroke: rgba(148, 163, 184, .22);
  stroke-dasharray: 3 4;
}

/* Day theme. Each of these matches the specificity of the rule it is
   overriding plus the :root attribute, so the tier rules stay in charge of
   everything they are not explicitly given a light value for. */
:root[data-theme="day"] .tn-node { background: rgba(255, 255, 255, .75); color: #1f2937; }
:root[data-theme="day"] .tn-node[data-tier="3"] { background: rgba(255, 255, 255, .88); }
:root[data-theme="day"] .tn-node[data-tier="4"] {
  background: linear-gradient(160deg, rgba(253, 240, 226, .95), rgba(255, 255, 255, .88));
}
:root[data-theme="day"] .tn-node[data-tier="5"] {
  background: linear-gradient(160deg, rgba(255, 248, 219, .97), rgba(255, 255, 255, .9));
}
:root[data-theme="day"] .tn-seat { background: rgba(241, 245, 249, .9); color: #334155; }
:root[data-theme="day"] .tn-seat.is-winner { background: rgba(34, 197, 94, .18); color: #166534; }
:root[data-theme="day"] .tn-seat.is-loser { color: #64748b; background: rgba(241, 245, 249, .6); }
:root[data-theme="day"] .tn-seat.is-champion { background: rgba(245, 158, 11, .22); color: #92400e; }
:root[data-theme="day"] .tn-seat-res { color: #15803d; }
:root[data-theme="day"] .tn-seat.is-champion .tn-seat-res { color: #b45309; }
:root[data-theme="day"] .tn-node.is-live .tn-node-tag { color: #b91c1c; background: rgba(239, 68, 68, .14); }
:root[data-theme="day"] .tn-node[data-tier="5"] .tn-node-tag { color: #92400e; background: rgba(245, 158, 11, .16); }
:root[data-theme="day"] .tn-prize { color: #b45309; }
:root[data-theme="day"] .tn-center-slot[data-slot="third"] .tn-col-head,
:root[data-theme="day"] .tn-center-slot[data-slot="third"] .tn-prize { color: #9a5b2d; }
:root[data-theme="day"] .tn-links path { stroke: rgba(71, 85, 105, .3); }
:root[data-theme="day"] .tn-links path[data-kind="loser"] { stroke: rgba(71, 85, 105, .2); }
:root[data-theme="day"] .tn-links path[data-advanced="1"] { stroke: rgba(21, 128, 61, .45); }

/* Below the point where eight columns plus a centre stop fitting, the board
   keeps its shape and .tn-scroll takes over. Phase D replaces this with real
   stage-by-stage navigation; until then the bracket is intact and reachable
   rather than broken. */
/* ==================== STAGE MODE (<=980px) ====================
   The two-sided bracket needs about 981px to keep a readable column; below
   that it is a picture of a bracket rather than a bracket, so the board shows
   ONE stage at a time and the ladder above it becomes the tab bar.

   No second DOM. The columns already carry data-round, the renderer puts the
   active key on the board as data-stage, and these rules show the matching
   pair. Both halves of a round appear, stacked — they are the same round, and
   which side of the draw a tie sat on stops meaning anything once the
   two-sided picture is gone. */
@media (max-width: 980px) {
  /* The halves stop being layout and become pass-through, so every column is
     a direct child of the board and can be shown or hidden on its own. */
  .tn-half { display: contents; }
  .tn-board { display: block; }
  .tn-scroll { overflow-x: visible; }
  /* Connectors describe a geometry that is no longer on screen. */
  .tn-links { display: none; }

  .tn-col, .tn-center { display: none; }
  .tn-board[data-stage="R32"] .tn-col[data-round="R32"],
  .tn-board[data-stage="R16"] .tn-col[data-round="R16"],
  .tn-board[data-stage="QF"]  .tn-col[data-round="QF"],
  .tn-board[data-stage="SF"]  .tn-col[data-round="SF"] { display: flex; }
  .tn-board[data-stage="FINAL"] .tn-center { display: flex; }

  .tn-col { width: 100%; min-width: 0; }
  /* The tab bar already names the round; a heading per half would say it
     twice and split one list into two that are not different. */
  .tn-col-head { display: none; }
  .tn-col-nodes { gap: 10px; justify-content: flex-start; }
  .tn-center { width: 100%; gap: 16px; }
  .tn-center-slot { gap: 8px; }

  /* Not the desktop card shrunk — the desktop card given the room a phone
     actually has. */
  .tn-node { padding: 10px; }
  .tn-node[data-tier="5"] { padding: 12px; }
  .tn-seat { font-size: 13px; min-height: 36px; padding: 6px 10px; gap: 8px; }
  .tn-node[data-tier="5"] .tn-seat { font-size: 14px; min-height: 40px; }
  /* Width was the only reason the narrow tiers showed a tick instead of the
     word, and width is exactly what stage mode gives back. */
  .tn-node[data-tier="1"] .tn-seat-res,
  .tn-node[data-tier="2"] .tn-seat-res,
  .tn-node[data-tier="3"] .tn-seat-res { font-size: 9px; letter-spacing: .1em; }
  .tn-node[data-tier="1"] .tn-seat-res::after,
  .tn-node[data-tier="2"] .tn-seat-res::after,
  .tn-node[data-tier="3"] .tn-seat-res::after { content: none; }
  /* The mirror was for the right-hand half of a two-sided picture. There is
     no right-hand half here, so every seat reads the same way round. */
  .tn-half[data-side="right"] .tn-seat { flex-direction: row; }
  .tn-half[data-side="right"] .tn-seat-res { margin-left: auto; margin-right: 0; }

  /* The ladder is a control now, so its rungs are touch targets. */
  .tn-stages { gap: 6px; }
  .tn-stage { padding: 9px 14px; }
  .tn-stage[data-nav="off"] { opacity: .35; }
  /* Two different facts share this strip now: which stage the TOURNAMENT is
     on (data-state="current") and which one YOU are looking at
     (aria-selected). Given the same gold outline they were indistinguishable,
     and on the final tab you could not tell which of the two lit rungs you
     had tapped. Selection is the one you can act on, so it takes the solid
     fill and leaves the outline to mean "play is here". */
  .tn-stage[aria-selected="true"] {
    color: #1c1206; background: #fcd34d; border-color: #fcd34d;
    box-shadow: 0 0 14px rgba(245, 158, 11, .35);
  }
  .tn-stage[aria-selected="true"] .tn-stage-dot { background: #1c1206; opacity: 1; }
  .tn-reg { padding: 30px 20px; }
  .tn-reg-now { font-size: 44px; }
}

/* Phone. The card is the only thing on screen, so it gets the width. */
@media (max-width: 520px) {
  .tn-stage { padding: 8px 11px; letter-spacing: .08em; }
  .tn-stage + .tn-stage::before { width: 6px; margin-left: -4px; }
  .tn-reg { padding: 24px 16px; }
  .tn-reg-now { font-size: 38px; }
  .tn-reg-label { letter-spacing: .18em; }
}
