/* ============================================================
   CBSE Cluster VI Basketball — courtside fixtures interface

   Light is the default: a clean white sheet, the way a fixture list
   is read in a bright hall or printed for the notice board. Dark is
   there for a phone at courtside at night.

   The amber LED match plate stays dark in both. It is the one object
   every official reads off, so it should look the same either way.
   ============================================================ */

:root {
  --r:   12px;
  --r-s: 8px;

  --mono: "Azeret Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --pad: clamp(16px, 3.5vw, 34px);

  /* measured from the real header by app.js; this is the no-JS fallback */
  --rail-h: 58px;

  --ease: cubic-bezier(.2, .7, .3, 1);
}

/* ---------------------------------------------------------- light (default) */

:root,
html.theme-light {
  --night:   #FFFFFF;
  --panel:   #FFFFFF;
  --panel-2: #F5F7FA;
  --panel-3: #E6EAF0;
  --edge:    #E8ECF2;
  --edge-2:  #D2D9E3;

  --line:    #10151F;
  --dim:     #59637A;
  --dimmer:  #8A93A6;

  --led:      #FFC24A;
  --led-text: #8A5B00;
  --led-dim:  #C79A3E;
  --ball:     #E2571F;
  --ball-text:#C2410C;
  --teal:     #12A594;
  --teal-text:#0B7A6A;

  --plate-bg: #131A2A;
  --rail-bg:  rgba(255, 255, 255, .86);
  --foot-bg:  #F7F9FC;
  --glow:     rgba(226, 87, 31, .05);
  --grain:    transparent;
  --btn-ink:  #23180A;

  --shadow-s: 0 1px 2px rgba(16, 21, 31, .05);
  --shadow-m: 0 2px 6px rgba(16, 21, 31, .06), 0 10px 24px rgba(16, 21, 31, .05);
  --shadow-l: 0 4px 10px rgba(16, 21, 31, .07), 0 18px 44px rgba(16, 21, 31, .09);

  color-scheme: light;
}

/* ---------------------------------------------------------- dark */

html.theme-dark {
  --night:   #0D1220;
  --panel:   #151D30;
  --panel-2: #1D2740;
  --panel-3: #26324F;
  --edge:    rgba(239, 237, 228, .11);
  --edge-2:  rgba(239, 237, 228, .20);

  --line:    #EFEDE4;
  --dim:     #8D97B0;
  --dimmer:  #5D6885;

  --led:      #FFC24A;
  --led-text: #FFC24A;
  --led-dim:  #8A6A26;
  --ball:     #E2571F;
  --ball-text:#E2571F;
  --teal:     #6FD3C7;
  --teal-text:#6FD3C7;

  --plate-bg: #090D18;
  --rail-bg:  rgba(13, 18, 32, .92);
  --foot-bg:  #0A0E1A;
  --glow:     rgba(226, 87, 31, .10);
  --grain:    rgba(255, 255, 255, .014);
  --btn-ink:  #1A1305;

  --shadow-s: none;
  --shadow-m: 0 2px 10px rgba(0, 0, 0, .30);
  --shadow-l: 0 10px 40px rgba(0, 0, 0, .45);

  color-scheme: dark;
}

/* Nobody has chosen, but the device asks for dark. */
@media (prefers-color-scheme: dark) {
  html:not(.theme-light):not(.theme-dark) {
    --night:   #0D1220;
    --panel:   #151D30;
    --panel-2: #1D2740;
    --panel-3: #26324F;
    --edge:    rgba(239, 237, 228, .11);
    --edge-2:  rgba(239, 237, 228, .20);

    --line:    #EFEDE4;
    --dim:     #8D97B0;
    --dimmer:  #5D6885;

    --led-text: #FFC24A;
    --ball-text:#E2571F;
    --teal:     #6FD3C7;
    --teal-text:#6FD3C7;

    --plate-bg: #090D18;
    --rail-bg:  rgba(13, 18, 32, .92);
    --foot-bg:  #0A0E1A;
    --glow:     rgba(226, 87, 31, .10);
    --grain:    rgba(255, 255, 255, .014);

    --shadow-s: none;
    --shadow-m: 0 2px 10px rgba(0, 0, 0, .30);
    --shadow-l: 0 10px 40px rgba(0, 0, 0, .45);

    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--night);
  color: var(--line);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(1100px 520px at 50% -12%, var(--glow), transparent 62%),
    repeating-linear-gradient(90deg, var(--grain) 0 2px, transparent 2px 74px);
  background-attachment: fixed;
}

a { color: inherit; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--led); color: #1b1405; padding: 10px 16px;
  font-weight: 700; border-radius: 0 0 var(--r-s) 0;
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--led);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------------------------------------------------------- header rail */

.rail {
  position: sticky; top: 0; z-index: 40;
  background: var(--rail-bg);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--edge);
}

.rail-in {
  max-width: 1240px; margin: 0 auto;
  padding: 11px var(--pad);
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; margin-right: auto;
}
.brand-mark { color: var(--ball); display: flex; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt b {
  font-size: 15px; font-weight: 800;
  letter-spacing: .10em; text-transform: uppercase;
}
.brand-txt i {
  font-style: normal; font-size: 11px; color: var(--dim);
  letter-spacing: .07em; text-transform: uppercase;
}

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  text-decoration: none; padding: 7px 13px; border-radius: 100px;
  font-size: 13px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--dim);
  border: 1px solid transparent;
}
.nav a:hover { color: var(--line); background: var(--panel); }
.nav a.on { color: var(--line); border-color: var(--edge-2); background: var(--panel); }
.nav a.lit { color: var(--led-text); border-color: var(--led-dim); }

/* theme toggle — shows the icon of the mode it will switch you to */
.themebtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 100px; cursor: pointer;
  font-family: var(--sans); font-size: 12px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--dim); background: transparent;
  border: 1px solid var(--edge-2);
  transition: color .18s var(--ease), background .18s var(--ease),
              border-color .18s var(--ease);
}
.themebtn:hover { color: var(--line); background: var(--panel-2); }
.themebtn svg { flex: 0 0 auto; }

/* light now → offer dark → show the moon */
.themebtn .ico-sun { display: none; }
html.theme-dark .themebtn .ico-sun  { display: inline; }
html.theme-dark .themebtn .ico-moon { display: none; }

@media (prefers-color-scheme: dark) {
  html:not(.theme-light):not(.theme-dark) .themebtn .ico-sun  { display: inline; }
  html:not(.theme-light):not(.theme-dark) .themebtn .ico-moon { display: none; }
}

/* ---------------------------------------------------------- layout */

.wrap {
  max-width: 1080px; margin: 0 auto;
  padding: clamp(26px, 5vw, 52px) var(--pad) 80px;
}
.wrap.wide { max-width: 1400px; }

.crumb {
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dimmer); margin: 0 0 14px;
}
.crumb a { color: var(--dim); text-decoration: none; }
.crumb a:hover { color: var(--led-text); }

h1 {
  font-size: clamp(30px, 5.4vw, 50px);
  font-weight: 900; letter-spacing: -.022em; line-height: 1.02;
  margin: 0 0 12px;
}
h2 {
  font-size: 13px; font-weight: 800;
  letter-spacing: .17em; text-transform: uppercase;
  color: var(--dim); margin: 46px 0 16px;
  display: flex; align-items: center; gap: 12px;
}
h2::after {
  content: ""; flex: 1; height: 1px; background: var(--edge);
}
h3 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 8px; }

.lede {
  color: var(--dim); font-size: 17px; max-width: 62ch; margin: 0 0 8px;
}

/* ---------------------------------------------------------- LED plate
   The signature element. Every match in this tournament is called by its
   number, so the number is treated as the object, not a label. */

.plate {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 3.4em; padding: 5px 9px;
  font-family: var(--mono); font-weight: 700; font-size: 15px;
  letter-spacing: .04em; color: var(--led);
  background: var(--plate-bg);
  border: 1px solid var(--led-dim);
  border-radius: var(--r-s);
  box-shadow: inset 0 0 12px rgba(255, 194, 74, .13), 0 1px 0 rgba(0,0,0,.5);
  text-decoration: none;
  position: relative; overflow: hidden;
}
.plate::after {              /* LED scanline */
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.30) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
a.plate:hover { border-color: var(--led); box-shadow: inset 0 0 16px rgba(255,194,74,.26); }

.plate.sm { min-width: 2.8em; font-size: 12px; padding: 3px 7px; }
.plate.lg { min-width: 3.2em; font-size: 30px; padding: 10px 16px; }
.plate.mute { color: var(--dimmer); border-color: var(--edge); box-shadow: none; }
.plate.mute::after { opacity: .5; }

.plate-label {
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--dimmer);
  display: block; margin-bottom: 5px;
}

/* ---------------------------------------------------------- chips */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; white-space: nowrap;
  border: 1px solid var(--edge-2); color: var(--dim);
}
.chip.final    { color: var(--teal-text); border-color: var(--edge-2); }
.chip.live     { color: var(--ball-text); border-color: rgba(226, 87, 31, .55);
                 background: rgba(226, 87, 31, .10); }
.chip.ready    { color: var(--led-text); border-color: var(--led-dim); }
.chip.walkover { color: var(--dimmer); }
.chip.pending  { color: var(--dimmer); border-style: dashed; }
.chip.absent   { color: var(--ball-text); border-color: rgba(226,87,31,.4); }
.chip.present  { color: var(--teal-text); border-color: var(--edge-2); }

.dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.chip.live .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------------------------------------------------------- cards */

.card {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  padding: 22px;
  box-shadow: var(--shadow-s);
}

.grid { display: grid; gap: 14px; }
.grid.two   { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---------------------------------------------------------- category panels */

.cats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(292px, 1fr)); }

.cat {
  position: relative; display: block; text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  padding: 20px 20px 18px;
  overflow: hidden;
  box-shadow: var(--shadow-s);
  transition: box-shadow .22s var(--ease), transform .22s var(--ease),
              border-color .22s var(--ease);
}
.cat:hover {
  border-color: var(--edge-2);
  transform: translateY(-3px);
  box-shadow: var(--shadow-l);
}
.cat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--ball);
}
.cat.girls::before { background: var(--led); }

.cat-name {
  font-size: 27px; font-weight: 900; letter-spacing: -.02em; margin: 0 0 3px;
}
.cat-sub {
  font-size: 12px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--dim); margin: 0 0 18px;
}
.cat-stats {
  display: flex; gap: 22px; margin-bottom: 14px;
}
.cat-stat b {
  display: block; font-family: var(--mono); font-size: 21px;
  font-weight: 700; color: var(--line); line-height: 1.1;
}
.cat-stat span {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--dimmer);
}

.meter { height: 4px; background: var(--panel-3); border-radius: 100px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--teal); border-radius: 100px; }
.meter-txt {
  font-size: 11px; color: var(--dimmer); margin-top: 7px;
  letter-spacing: .06em; text-transform: uppercase;
}

.champ {
  margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--edge);
  font-size: 13px; color: var(--led-text); font-weight: 700;
}

/* ---------------------------------------------------------- match rows */

.mlist { display: flex; flex-direction: column; gap: 8px; }

.mrow {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 16px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--panel-3);
  border-radius: var(--r);
  padding: 14px 16px;
  text-decoration: none;
  box-shadow: var(--shadow-s);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease),
              transform .2s var(--ease);
}
.mrow:hover {
  border-color: var(--edge-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-m);
}
.mrow.is-live     { border-left-color: var(--ball); }
.mrow.is-ready    { border-left-color: var(--led); }
.mrow.is-final    { border-left-color: var(--teal); }
.mrow.is-walkover { opacity: .62; }

.mrow-teams { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.side {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 15px; color: var(--dim); min-width: 0;
}
.side-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side.won { color: var(--line); font-weight: 700; }
.side.won .side-name::before {
  content: "▸ "; color: var(--led-text);
}
.side.lost { color: var(--dimmer); }
.side.tbd  { color: var(--dimmer); font-style: italic; }
.side-score {
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  color: var(--line); margin-left: auto; padding-left: 12px;
}

.vs {
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--dimmer);
}

.mrow-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  text-align: right;
}
.mrow-when {
  font-family: var(--mono); font-size: 11px; color: var(--dim); white-space: nowrap;
}

/* ---------------------------------------------------------- tabs */

.tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 0 0 20px; padding-bottom: 14px;
  border-bottom: 1px solid var(--edge);
}
.tab {
  text-decoration: none; padding: 8px 14px; border-radius: var(--r-s);
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim); background: var(--panel); border: 1px solid var(--edge);
  display: inline-flex; align-items: center; gap: 8px;
}
.tab {
  transition: color .18s var(--ease), background .18s var(--ease),
              border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.tab:hover { color: var(--line); border-color: var(--edge-2); box-shadow: var(--shadow-s); }
.tab.on { color: var(--night); background: var(--led); border-color: var(--led); }
.tab small {
  font-family: var(--mono); font-size: 10px; opacity: .7; font-weight: 500;
}

/* ---------------------------------------------------------- forms */

label.fld { display: block; margin-bottom: 14px; }
label.fld > span {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 6px;
}

input[type=text], input[type=search], input[type=password],
input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 13px;
  background: var(--night); color: var(--line);
  border: 1px solid var(--edge-2); border-radius: var(--r-s);
  font-family: var(--sans); font-size: 15px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
input[type=text]:focus, input[type=search]:focus, input[type=password]:focus,
input[type=number]:focus, input[type=datetime-local]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--led-dim);
  box-shadow: 0 0 0 3px rgba(255, 194, 74, .22);
}
input[type=number] { font-family: var(--mono); }
input::placeholder { color: var(--dimmer); }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
                    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 13px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r-s); cursor: pointer;
  font-family: var(--sans); font-size: 13px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
  background: var(--led); color: var(--btn-ink);
  border: 1px solid var(--led); text-decoration: none;
  box-shadow: var(--shadow-s);
  transition: filter .18s var(--ease), box-shadow .18s var(--ease),
              transform .18s var(--ease), border-color .18s var(--ease),
              color .18s var(--ease);
}
.btn:hover { filter: brightness(1.06); box-shadow: var(--shadow-m); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-s); }
.btn.ghost {
  background: transparent; color: var(--line); border-color: var(--edge-2);
}
.btn.ghost:hover { border-color: var(--led-text); color: var(--led-text); filter: none; }
.btn.danger { background: transparent; color: var(--ball-text); border-color: rgba(226,87,31,.5); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

.searchbar { display: flex; gap: 9px; }
.searchbar input { flex: 1; }

.note {
  background: var(--panel); border: 1px solid var(--edge);
  border-left: 3px solid var(--led);
  border-radius: var(--r); padding: 14px 18px;
  font-size: 14px; color: var(--dim); margin: 18px 0;
}
.note b { color: var(--line); }
.note.warn { border-left-color: var(--ball); }
.note.ok   { border-left-color: var(--teal); }

/* ---------------------------------------------------------- match detail */

.duel { display: grid; gap: 12px; }

.duel-side {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px;
  background: var(--panel); border: 1px solid var(--edge);
  border-radius: var(--r); padding: 18px 20px;
}
.duel-side.won { border-color: var(--led-dim); background: var(--panel-2); }
.duel-side.won .duel-name { color: var(--led-text); }
.duel-side.lost { opacity: .58; }

.duel-name { font-size: 19px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 5px; }
.duel-name a { text-decoration: none; }
.duel-name a:hover { text-decoration: underline; }
.duel-meta { font-size: 12px; color: var(--dim); font-family: var(--mono); }
.duel-mgr { font-size: 13px; color: var(--dim); margin: 8px 0 0; }
.duel-mgr a { font-family: var(--mono); color: var(--led-text); text-decoration: none; }
.duel-mgr a:hover { text-decoration: underline; }
.duel-score {
  font-family: var(--mono); font-size: 40px; font-weight: 700;
  color: var(--line); line-height: 1;
}

.duel-split {
  text-align: center; font-size: 11px; letter-spacing: .3em;
  text-transform: uppercase; color: var(--dimmer);
}

/* ---------------------------------------------------------- path ribbon */

.path { display: flex; flex-direction: column; gap: 0; }

.step {
  display: grid; grid-template-columns: 74px 1fr auto; gap: 16px;
  align-items: center; padding: 13px 0;
  border-bottom: 1px solid var(--edge);
  text-decoration: none;
}
.step:hover .step-opp { color: var(--led-text); }
.step-round {
  font-size: 10px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--dimmer);
}
.step-opp { font-size: 15px; font-weight: 600; }
.step-sub { font-size: 12px; color: var(--dim); }
.step.won  .step-opp { }
.step.lost { opacity: .6; }

/* ---------------------------------------------------------- data table */

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; padding: 10px 12px;
  font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
  color: var(--dimmer); border-bottom: 1px solid var(--edge-2);
  background: var(--night);
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--edge); vertical-align: middle; }
.tbl tbody tr { transition: background .16s var(--ease); }
.tbl tbody tr:hover td { background: var(--panel-2); }
.tbl td.num { font-family: var(--mono); font-size: 13px; color: var(--dim); }
.tbl a { text-decoration: none; font-weight: 600; }
.tbl a:hover { color: var(--led-text); }

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* sort controls */
.sortbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 0 0 18px;
}
.sortbar-lbl {
  font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dimmer); margin-right: 4px;
}
.sortbar-dir { margin-left: auto; font-family: var(--mono); }

.resultline {
  color: var(--dim); font-size: 13px; margin: 0 0 12px;
  letter-spacing: .02em;
}

/* team manager cell */
.mgr-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.mgr-tel {
  font-family: var(--mono); font-size: 12px; color: var(--dim);
  text-decoration: none; white-space: nowrap;
}
.mgr-tel:hover { color: var(--led-text); text-decoration: underline; }
.tbl td .soft, .tbl td.soft {
  color: var(--dimmer); font-size: 12.5px; white-space: nowrap;
}

/* Wide enough that the tables fit: drop the scroll container so the column
   headings can stick to the viewport under the nav bar. Inside a horizontally
   scrollable box a sticky heading anchors to the table instead and ends up
   floating over the rows, so narrow screens keep a plain heading. */
@media (min-width: 900px) {
  .scroll { overflow: visible; }
  .tbl th {
    position: sticky; top: var(--rail-h); z-index: 2;
    background-clip: padding-box;
  }
}

/* ---------------------------------------------------------- bracket */

.bracket-tools {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px;
}

.bracket-scroll {
  overflow: auto; border: 1px solid var(--edge); border-radius: var(--r);
  background:
    linear-gradient(var(--panel), var(--panel));
  padding: 0 0 18px;
  max-height: 84vh;
}

.bracket-head {
  display: flex; position: sticky; top: 0; z-index: 3;
  background: var(--panel-2); border-bottom: 1px solid var(--edge-2);
}
.bracket-head span {
  flex: 0 0 auto; padding: 9px 12px;
  font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
  color: var(--dim); border-right: 1px solid var(--edge);
}

.bracket { position: relative; }

.bnode {
  position: absolute;
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: var(--r-s);
  padding: 5px 8px;
  font-size: 11.5px; line-height: 1.3;
  overflow: hidden;
  text-decoration: none;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.bnode { transition: border-color .18s var(--ease), box-shadow .18s var(--ease); }
.bnode:hover { border-color: var(--edge-2); box-shadow: var(--shadow-m); z-index: 4; }
.bnode-no {
  font-family: var(--mono); font-size: 9px; color: var(--led-dim); letter-spacing: .05em;
}
.bnode-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--dim); }
.bnode-t.won { color: var(--line); font-weight: 700; }
.bnode-t.bye { color: var(--dimmer); font-style: italic; }
.bnode.lit { border-color: var(--led); box-shadow: 0 0 0 1px var(--led-dim), 0 0 18px rgba(255,194,74,.18); }
.bnode.lit .bnode-t.won { color: var(--led-text); }

.blink { position: absolute; background: var(--edge-2); }
.blink.lit { background: var(--led); }

/* ---------------------------------------------------------- misc */

.rowbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}

.stats {
  display: grid; gap: 1px; background: var(--edge);
  border: 1px solid var(--edge); border-radius: var(--r); overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  box-shadow: var(--shadow-s);
}
.stat { background: var(--panel); padding: 15px 17px; }
.stat b {
  display: block; font-family: var(--mono); font-size: 24px; font-weight: 700; line-height: 1.1;
}
.stat span {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--dimmer);
}
.stat.led b  { color: var(--led-text); }
.stat.ball b { color: var(--ball-text); }
.stat.teal b { color: var(--teal-text); }

.empty {
  text-align: center; padding: 56px 20px; color: var(--dim);
  border: 1px dashed var(--edge-2); border-radius: var(--r);
}
.empty b { display: block; color: var(--line); font-size: 18px; margin-bottom: 6px; }

.kv { display: grid; grid-template-columns: 132px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt {
  font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--dimmer); padding-top: 3px;
}
.kv dd { margin: 0; color: var(--line); }
.kv dd a { color: var(--led-text); }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------- footer */

.foot {
  border-top: 1px solid var(--edge);
  background: var(--foot-bg);
  padding: 34px var(--pad) 44px;
  font-size: 13px; color: var(--dim);
}
.foot-in { max-width: 1240px; margin: 0 auto; display: grid; gap: 18px; }
.foot b { display: block; color: var(--line); font-weight: 700; margin-bottom: 3px; }
.foot span { display: block; }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-links a { color: var(--dim); text-decoration: none; }
.foot-links a:hover { color: var(--led-text); }
.foot-note { max-width: 60ch; color: var(--dimmer); font-size: 12px; margin: 0; }

/* ---------------------------------------------------------- responsive */

@media (max-width: 720px) {
  .rail-in { gap: 12px; padding: 10px var(--pad); }
  .brand-txt b { font-size: 13px; }
  .nav { width: 100%; }
  .nav a { padding: 6px 11px; font-size: 12px; }
  .mrow { grid-template-columns: auto 1fr; row-gap: 10px; }
  .mrow-meta { grid-column: 1 / -1; flex-direction: row; align-items: center;
               justify-content: flex-start; }
  .duel-side { grid-template-columns: 1fr; }
  .duel-score { font-size: 32px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
  .step { grid-template-columns: 60px 1fr; }
}

@media print {
  .rail, .foot, .nav, .btn, .bracket-tools, .tabs { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .mrow, .cat { background: #fff; border-color: #bbb; }
  .plate { color: #000; background: #fff; border-color: #666; box-shadow: none; }
  .plate::after { display: none; }
  a { color: #000; }
  .side, .side-name, .cat-name { color: #000; }
  .bracket-scroll { max-height: none; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
