/* ==========================================================================
   Bot Panel - site.css  ("Prime-time game show" backstage console)
   Load order: fonts > tokens > kit > site.  Built on tokens + kit; never redefines them.
   Logical properties only, so Arabic (RTL) and English (LTR) content lay out alike.

   Structure
   1. Base            (global: reset, type, focus, skip link, header, page frame)
   2. @scope layer    (components; the streamer console `.sc` subtree is excluded
                       so stream-admin.css keeps full control of its own buttons/cards/tabs)
   New shared components (safe for other pages to use):
     .page-header (+ .ph-icon .lede .page-actions)   .sect-head (+ .count)   .card.flush   .card.plain
     .tile (+ .feature)                                .monitor / .monitor-bar / .monitor-screen
     .onair-sign                                       .savebar               .toolbar-panel
     .table-wrap + table.stack (+ data-label on td)    .board / .rank         .chan-strip
   ========================================================================== */

/* Arabic glyphs inside <code>/mono text come from Cairo (joined letters), Latin stays monospace */
@font-face { font-family: 'CairoCode'; font-weight: 200 1000; font-display: swap; src: url(/fonts/cairo-arabic-wght-normal.woff2) format('woff2-variations'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC; }

/* ---------- 1. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; min-height: 100vh; background-color: var(--bg); color: var(--text);
  font: var(--fs-base)/var(--lh) var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--on-accent); }
img, svg { max-width: 100%; }
a { color: var(--accent-text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: #fff; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-5) 0; }
[hidden] { display: none !important; }
p { margin: 0 0 var(--sp-3); }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
h2 { font-weight: 700; font-size: var(--fs-md); line-height: 1.25; }
h3 { font-weight: 700; font-size: var(--fs-base); line-height: 1.3; }
* { scrollbar-color: var(--surface-3) transparent; scrollbar-width: thin; }

:focus { outline: none; }
:focus-visible { outline: 3px solid #e8917c; outline-offset: 2px; border-radius: 6px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .pill:focus-visible, .nav-toggle:focus-visible { outline: none; }

.skip-link { position: absolute; inset-inline-start: 12px; inset-block-start: -90px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 12px 18px; border-radius: var(--r-md); font: 800 var(--fs-base)/1 var(--font-display); text-decoration: none; transition: inset-block-start var(--dur-2) var(--ease); }
.skip-link:focus { inset-block-start: 12px; color: var(--on-accent); outline-offset: 3px; }

/* ---- header: slim stage-blue bar, gold bar marks where you are ---- */
.site-header { position: sticky; inset-block-start: 0; z-index: 40; border-block-end: 1px solid var(--line); }
.site-header::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(15, 14, 14, .88); -webkit-backdrop-filter: saturate(150%) blur(14px); backdrop-filter: saturate(150%) blur(14px); }
.nav-bar { max-inline-size: var(--content-w); margin-inline: auto; block-size: var(--header-h); padding-inline: var(--sp-5); display: flex; align-items: stretch; gap: var(--sp-4); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; white-space: nowrap; border-radius: var(--r-md); padding-inline-end: var(--sp-2); }
.brand:hover { color: var(--text); }
.brand-mark { display: inline-grid; place-items: center; inline-size: 34px; block-size: 34px; border-radius: 50%; background: var(--grad-accent); color: var(--on-accent); box-shadow: 0 3px 0 var(--accent-deep), 0 6px 14px rgba(205, 92, 69, .25), inset 0 1px 0 rgba(255, 255, 255, .6); margin-block-end: 3px; }
.brand-mark .i { inline-size: 18px; block-size: 18px; }
.brand-name { font: 800 1.45rem/1 var(--font-display); font-stretch: var(--stretch-display); letter-spacing: -.005em; }
.brand-name b { color: var(--accent-text); font-weight: 800; }
.nav-links { display: flex; align-items: stretch; flex: 1; min-inline-size: 0; gap: var(--sp-3); }
.nav-links ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: stretch; gap: 0; flex: 1; }
.nav-links li { display: flex; }
.nav-links a { position: relative; display: inline-flex; align-items: center; padding-inline: 13px; color: var(--text-2); text-decoration: none; font: 600 .9rem/1 var(--font); white-space: nowrap; border-radius: 0; transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease); }
.nav-links a:hover { color: var(--text); background: linear-gradient(180deg, transparent, rgba(224, 222, 219, .06)); }
.nav-links a:focus-visible { outline-offset: -4px; border-radius: var(--r-sm); }
.nav-links a[aria-current="page"] { color: var(--text); font-weight: 700; }
.nav-links a[aria-current="page"]::after { content: ""; position: absolute; inset-inline: 10px; inset-block-end: -1px; block-size: 4px; border-radius: 4px 4px 0 0; background: var(--grad-accent); box-shadow: 0 -4px 16px rgba(205, 92, 69, .5); }
.nav-end { display: flex; align-items: center; margin: 0; }
button.link { background: none; border: 1px solid var(--line-strong); color: var(--text-2); cursor: pointer; font: 600 .875rem/1 var(--font); min-block-size: 38px; padding-inline: 14px; border-radius: var(--r-pill); transition: all var(--dur-1) var(--ease); }
button.link:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
button.link:focus-visible { outline: 3px solid #e8917c; outline-offset: 2px; }
.nav-toggle { display: none; }
.nav-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(8, 7, 7, .66); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

@media (max-width: 1120px) {
  .nav-bar { padding-inline: var(--sp-4); }
  .js .nav-toggle { display: inline-flex; align-items: center; gap: 10px; align-self: center; margin-inline-start: auto; min-block-size: var(--touch); padding-inline: 16px 18px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: 700 .9rem/1 var(--font-display); font-stretch: 92%; cursor: pointer; transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
  .js .nav-toggle:hover { background: var(--surface-3); }
  .js .nav-toggle[aria-expanded="true"] { border-color: var(--accent); }
  .nav-toggle:focus-visible { outline: 3px solid #e8917c; outline-offset: 2px; }
  .bars { position: relative; inline-size: 18px; block-size: 14px; display: block; }
  .bars i { position: absolute; inset-inline: 0; block-size: 2px; border-radius: 2px; background: currentColor; transition: transform var(--dur-2) var(--ease), opacity var(--dur-1) var(--ease); }
  .bars i:nth-child(1) { inset-block-start: 0; } .bars i:nth-child(2) { inset-block-start: 6px; } .bars i:nth-child(3) { inset-block-start: 12px; }
  .nav-toggle[aria-expanded="true"] .bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .bars i:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] .bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  /* no-JS fallback: links simply wrap under the brand */
  html:not(.js) .nav-bar { block-size: auto; flex-wrap: wrap; padding-block: 8px; }
  html:not(.js) .nav-links { flex-basis: 100%; flex-wrap: wrap; } html:not(.js) .nav-links ul { flex-wrap: wrap; } html:not(.js) .nav-links a { min-block-size: var(--touch); }
  /* the sheet */
  .js .nav-links { position: fixed; inset-block: var(--header-h) 0; inset-inline-end: 0; inline-size: min(92vw, 400px); flex-direction: column; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-3) 0 var(--sp-5); overflow-y: auto; overscroll-behavior: contain;
    background: linear-gradient(180deg, var(--surface-2), var(--surface) 45%, var(--bg-raised)); border-inline-start: 1px solid var(--line-strong); box-shadow: -30px 0 60px rgba(0, 0, 0, .5);
    opacity: 1; translate: 0 0; visibility: visible; transition: opacity var(--dur-2) var(--ease), translate var(--dur-2) var(--ease), visibility 0s; }
  .js .nav-links[data-collapsed="true"] { opacity: 0; translate: 0 -10px; visibility: hidden; transition: opacity var(--dur-2) var(--ease), translate var(--dur-2) var(--ease), visibility 0s var(--dur-2); pointer-events: none; }
  .js .nav-links ul { flex-direction: column; flex: none; }
  .js .nav-links li { display: block; }
  .js .nav-links a { display: flex; inline-size: 100%; min-block-size: 56px; padding-inline: var(--sp-5); font: 800 1.45rem/1.1 var(--font-display); font-stretch: 88%; color: var(--text-2); border-block-end: 1px solid var(--line); }
  .js .nav-links a:hover { background: var(--accent-soft); color: var(--text); }
  .js .nav-links a[aria-current="page"] { color: var(--accent-text); background: linear-gradient(90deg, var(--accent-soft), transparent); }
  .js .nav-links a[aria-current="page"]::after { inset-inline: 0 auto; inset-block: 8px; inline-size: 5px; block-size: auto; border-radius: 0 5px 5px 0; box-shadow: 0 0 16px rgba(205, 92, 69, .6); }
  [dir=rtl] .js .nav-links a[aria-current="page"]::after { border-radius: 5px 0 0 5px; }
  .js .nav-end { padding-inline: var(--sp-5); }
  .js .nav-end .link { inline-size: 100%; min-block-size: var(--touch); }
}
@media (max-width: 560px) { .brand-name { font-size: 1.3rem; } }

/* ---- page frame ---- */
main { max-inline-size: var(--content-w); margin-inline: auto; padding: var(--sp-6) var(--sp-5) var(--sp-8); outline: none; min-inline-size: 0; }
main.guest { max-inline-size: none; padding: 0; }
@media (max-width: 600px) { main { padding: var(--sp-5) 16px var(--sp-7); } }

.muted { color: var(--muted); } .small { font-size: var(--fs-sm); } .mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
code { font-family: "CairoCode", var(--font-mono), monospace; background: rgba(10, 9, 9, .55); color: var(--accent-text); padding: 1px 7px; border-radius: 6px; font-size: .86em; direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; border: 1px solid var(--line); }
kbd { font-family: var(--font-mono); font-size: var(--fs-xs); background: var(--surface-3); border: 1px solid var(--line-strong); border-block-end-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--text); }
.eyebrow { display: none; }
[dir=auto], [dir=auto] * { line-height: 1.5; }
@media print { .site-header, .toast-region, .skip-link { display: none !important; } body { background: #fff; color: #000; } }
@media (min-width: 1700px) { :root { --content-w: 1560px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------- 2. Components ---------- */
@scope (body) to (.sc) {

/* ---- page header: display-type title, a short gold bar on the hairline ---- */
.page-header { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4) var(--sp-5); flex-wrap: wrap; margin-block-end: var(--sp-6); padding-block-end: var(--sp-5); border-block-end: 1px solid var(--line); }
.page-header::after { content: ""; position: absolute; inset-inline-start: 0; inset-block-end: -2px; inline-size: 88px; block-size: 3px; border-radius: 3px; background: var(--grad-accent); box-shadow: 0 0 18px rgba(205, 92, 69, .45); }
.page-header > div:first-child { min-inline-size: 0; }
.page-header h1 { font-weight: 800; font-stretch: var(--stretch-display); font-size: clamp(2.4rem, 6vw, 4rem); line-height: .98; letter-spacing: -.012em; text-wrap: balance; display: flex; align-items: center; flex-wrap: wrap; gap: .25em .5em; }
.page-header .lede, .page-header p { margin: var(--sp-3) 0 0; color: var(--text-2); max-inline-size: 62ch; font-size: var(--fs-md); line-height: 1.5; }
.page-header .page-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; padding-block-end: var(--buzzer-h); }
.page-header h1 .badge, .page-header h1 .tag { font-size: var(--fs-sm); font-family: var(--font); font-stretch: 100%; letter-spacing: 0; }
@media (max-width: 600px) { .page-header { margin-block-end: var(--sp-5); } .page-header .lede, .page-header p { font-size: var(--fs-base); } }

.sect-head { display: flex; align-items: baseline; gap: var(--sp-3); margin-block: var(--sp-6) var(--sp-3); }
.sect-head h2 { font-size: var(--fs-xl); font-weight: 800; font-stretch: var(--stretch-display); letter-spacing: -.005em; }
.sect-head .count { font: 800 var(--fs-xl)/1 var(--font-display); font-stretch: 82%; color: var(--accent-text); font-variant-numeric: tabular-nums; padding-inline: .5em; padding-block: .2em .12em; border: 2px solid rgba(205, 92, 69, .5); border-radius: 12px; align-self: center; min-inline-size: 2.2em; text-align: center; }
.sect-head .note { margin-inline-start: auto; color: var(--muted); font-size: var(--fs-sm); }
.page-header + .sect-head { margin-block-start: 0; }

/* ---- layout helpers ---- */
.row { display: flex; gap: var(--sp-5); flex-wrap: wrap; align-items: flex-start; margin-block-end: var(--sp-5); }
.grow { flex: 1 1 420px; min-inline-size: 0; }
@media (max-width: 480px) { .grow { flex-basis: 100%; } }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 0 var(--sp-5); }
.stack > * + * { margin-block-start: var(--sp-4); }
.actions { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; margin-block: var(--sp-4); padding-block-end: var(--buzzer-h); }
.toolbar { display: flex; gap: var(--sp-2) var(--sp-3); align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* ---- panels: .card is a calm panel, .set (kit) is the lit set piece, .plain is just a section ---- */
.card { position: relative; background: linear-gradient(180deg, rgba(34, 32, 32, .78), rgba(26, 25, 25, .78) 40%, rgba(21, 20, 20, .9)); border: 1px solid var(--line); border-radius: 20px 20px 28px 20px; padding: var(--sp-5) var(--sp-5) var(--sp-5); margin-block-end: var(--sp-5); box-shadow: 0 1px 0 rgba(224, 222, 219, .06) inset, 0 18px 40px rgba(0, 0, 0, .28); min-inline-size: 0; }
.card > :last-child { margin-block-end: 0; }
.card > h2 { margin-block-end: var(--sp-3); display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--fs-lg); font-weight: 800; font-stretch: 90%; }
.card.plain { background: none; border: 0; border-block-start: 1px solid var(--line-strong); border-radius: 0; box-shadow: none; padding-inline: 0; padding-block-start: var(--sp-4); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2, .card.flush > .card-head { padding: var(--sp-4) var(--sp-5) var(--sp-3); margin: 0; }
.card.flush > .table-wrap { margin: 0; padding-inline: var(--sp-3); }
.card.flush > .pager, .card.flush > p { padding-inline: var(--sp-5); }
.card.flush > .pager:last-child, .card.flush > p:last-child { padding-block-end: var(--sp-4); }
.card.flush > .empty-state { margin: var(--sp-2) var(--sp-5) var(--sp-5); }
.card.narrow { max-inline-size: 420px; margin: 10vh auto; }
.toolbar-panel { display: block; background: rgba(10, 9, 9, .35); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-3) var(--sp-4); margin-block-end: var(--sp-5); }
.toolbar-panel .inline { margin: 0; }
@media (max-width: 600px) { .card { padding: var(--sp-4); border-radius: 18px; } .card.flush { padding: 0; } .card.flush > h2 { padding-inline: var(--sp-4); } .card.flush > .table-wrap { padding-inline: var(--sp-2); } }

details.card > summary { cursor: pointer; list-style: none; position: relative; gap: .35em; flex-wrap: wrap; padding-inline-start: 32px; padding-block: 6px; min-block-size: var(--touch); display: flex; align-items: center; border-radius: var(--r-sm); font-weight: 600; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: ""; position: absolute; inset-inline-start: 6px; inset-block-start: 50%; inline-size: 9px; block-size: 9px; margin-block-start: -7px; border-inline-end: 3px solid var(--accent-text); border-block-end: 3px solid var(--accent-text); transform: rotate(-45deg); transition: transform var(--dur-2) var(--ease-spring); }
[dir=rtl] details.card > summary::before { transform: rotate(135deg); }
details.card[open] > summary::before { transform: rotate(45deg); margin-block-start: -9px; }
details.card[open] > summary { margin-block-end: var(--sp-3); }
details.card > summary:hover { color: #fff; }
details.card > summary b { font-family: var(--font-display); font-weight: 800; }

/* ---- empty states: say what to do next ---- */
.empty-state { text-align: center; padding: var(--sp-7) var(--sp-5); color: var(--text-2); border: 2px dashed var(--line-strong); border-radius: var(--r-lg); background: radial-gradient(60% 100% at 50% 0, rgba(205, 92, 69, .06), transparent 70%); }
.empty-state strong { display: block; font: 800 var(--fs-xl)/1.1 var(--font-display); font-stretch: var(--stretch-display); color: var(--text); margin-block-end: var(--sp-2); }
.empty-state p { margin: 0 auto var(--sp-3); max-inline-size: 46ch; }
.empty-state .btn { margin-block-start: var(--sp-2); }
.empty-state > :last-child { margin-block-end: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--sp-3); }
.stat { background: rgba(10, 9, 9, .4); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); min-inline-size: 0; }
.stat-label { display: block; font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.stat-value { display: block; font: 800 var(--fs-lg)/1.2 var(--font-display); overflow-wrap: anywhere; }

/* ---- buttons: the buzzer look (kit .buzz variables), with the old modifiers ---- */
.btn { --b-face: var(--grad-accent); --b-edge: var(--accent-deep); --b-ink: var(--on-accent);
  appearance: none; border: 0; cursor: pointer; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-block-size: var(--touch); padding: .62em 1.3em; border-radius: var(--r-md);
  font: 800 var(--fs-base)/1.1 var(--font-display); font-stretch: 92%; letter-spacing: .005em; text-decoration: none; text-align: center; color: var(--b-ink);
  background: var(--b-face); box-shadow: 0 var(--buzzer-h) 0 var(--b-edge), 0 calc(var(--buzzer-h) + 8px) 16px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .55);
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), filter var(--dur-2) var(--ease), background var(--dur-1) var(--ease); }
.btn:hover { filter: brightness(1.07); color: var(--b-ink); }
.btn:active { transform: translateY(calc(var(--buzzer-h) - 1px)); box-shadow: 0 1px 0 var(--b-edge), 0 3px 8px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn:focus-visible { box-shadow: 0 var(--buzzer-h) 0 var(--b-edge), var(--focus); }
.btn.small { min-block-size: 40px; padding: .4em .95em; font-size: var(--fs-sm); border-radius: var(--r-sm); --buzzer-h: 3px; }
.btn.danger { --b-face: linear-gradient(180deg, #e0795f, #cd5c45 60%, #a8442f); --b-edge: var(--bad-deep); --b-ink: #1c0a08; }
.btn.ok { --b-face: linear-gradient(180deg, #86bf9b, #5fa77a 60%, #4a8c60); --b-edge: var(--ok-deep); --b-ink: #0b1a12; }
/* ghost = flat, outlined: secondary actions. No buzzer edge, so a screen of them stays quiet */
.btn.ghost { --b-ink: var(--text); background: rgba(224, 222, 219, .04); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.ghost:hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); filter: none; }
.btn.ghost:active { transform: translateY(1px); box-shadow: inset 0 0 0 1px var(--accent); }
.btn.ghost:focus-visible { box-shadow: var(--focus); }
.btn.ghost.danger { --b-ink: var(--bad); background: transparent; box-shadow: inset 0 0 0 1px rgba(212, 97, 78, .55); }
.btn.ghost.danger:hover { background: var(--bad-soft); box-shadow: inset 0 0 0 1px var(--bad); }
.btn[disabled], .btn.disabled, .btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: grayscale(.4); pointer-events: none; }
.btn .i { inline-size: 1.1em; block-size: 1.1em; }
td .btn.small { --buzzer-h: 2px; }

/* ---- status: badge (state), pill (toggle), chip (choice) ---- */
.badge { display: inline-flex; align-items: center; gap: 7px; font: 700 var(--fs-xs)/1.4 var(--font); padding: 3px 11px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); vertical-align: middle; border: 1px solid var(--line); white-space: nowrap; }
td .badge, th .badge { margin-inline-start: var(--sp-2); }
.badge.on, .badge.off, .badge.warn { border-color: transparent; }
.badge.on::before, .badge.off::before, .badge.warn::before { content: ""; inline-size: 7px; block-size: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.off::before { border-radius: 2px; } .badge.warn::before { border-radius: 2px; transform: rotate(45deg); }
.badge.on { background: var(--ok-soft); color: var(--ok); } .badge.off { background: var(--bad-soft); color: var(--bad); } .badge.warn { background: var(--warn-soft); color: var(--warn); }

.pill { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: var(--r-pill); padding: 4px 13px 4px 11px; min-inline-size: 62px; min-block-size: 30px; white-space: nowrap; font: 800 var(--fs-xs)/1.2 var(--font-display); font-stretch: 100%; cursor: default; background: var(--surface-3); color: var(--text-2); transition: filter var(--dur-1) var(--ease), background var(--dur-1) var(--ease); }
.pill::before { content: ""; inline-size: 8px; block-size: 8px; border-radius: 50%; background: currentColor; opacity: .85; }
button.pill { cursor: pointer; }
button.pill::after { content: ""; position: absolute; inset: -7px -4px; }
button.pill:hover { filter: brightness(1.2); }
button.pill:active { transform: scale(.94); }
button.pill:focus-visible { outline: 3px solid #e8917c; outline-offset: 2px; }
.pill.on { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px rgba(95, 167, 122, .35); }
.pill.on::before { box-shadow: 0 0 8px currentColor; opacity: 1; }
.pill.off { background: rgba(224, 222, 219, .05); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.pill.off::before { background: transparent; box-shadow: inset 0 0 0 2px currentColor; }

.chip { position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); min-block-size: 44px; padding: 6px 16px 6px 12px; margin: 0 var(--sp-2) var(--sp-2) 0; margin-inline: 0 var(--sp-2); border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: rgba(10, 9, 9, .35); color: var(--text-2); font: 600 var(--fs-sm)/1.2 var(--font); cursor: pointer; transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.chip:has(input:focus-visible) { box-shadow: var(--focus); }
label.chip input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; position: relative; inline-size: 20px; min-inline-size: 20px; block-size: 20px; min-block-size: 20px; border: 2px solid var(--muted); border-radius: 7px; background: transparent; margin: 0; padding: 0; cursor: pointer; transition: all var(--dur-1) var(--ease); }
label.chip input[type=checkbox]::after { content: ""; position: absolute; inset: 2px 5px 4px 5px; border: solid var(--on-accent); border-width: 0 3px 3px 0; transform: rotate(40deg) scale(0); transition: transform var(--dur-2) var(--ease-spring); background: none; box-shadow: none; inline-size: auto; block-size: auto; border-radius: 0; }
label.chip input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
label.chip input[type=checkbox]:checked::after { transform: rotate(40deg) scale(1); }

/* ---- tabs: a segmented "key row"; active key is lit gold ---- */
.tabs:not(.sc-tabs) { display: flex; gap: 4px; margin-block-end: var(--sp-5); overflow-x: auto; padding: 5px; background: rgba(10, 9, 9, .5); border: 1px solid var(--line); border-radius: var(--r-lg); max-inline-size: 100%; inline-size: fit-content; box-shadow: inset 0 2px 8px rgba(0, 0, 0, .35); scrollbar-width: none; }
.tabs:not(.sc-tabs) a { display: inline-flex; align-items: center; gap: var(--sp-2); min-block-size: 44px; color: var(--text-2); text-decoration: none; padding: 0 var(--sp-4); border-radius: 14px; font: 700 var(--fs-base)/1 var(--font-display); font-stretch: 92%; white-space: nowrap; transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.tabs:not(.sc-tabs) a:hover { color: #fff; background: var(--surface-2); }
.tabs:not(.sc-tabs) a:focus-visible { outline: 3px solid #e8917c; outline-offset: -2px; }
.tabs:not(.sc-tabs) a.on, .tabs:not(.sc-tabs) a[aria-current] { color: var(--on-accent); background: var(--grad-accent); box-shadow: 0 2px 0 var(--accent-deep), inset 0 1px 0 rgba(255, 255, 255, .55); font-weight: 800; }
.tabs:not(.sc-tabs) a.on .badge { background: rgba(15, 14, 14, .16); color: var(--on-accent); border-color: transparent; }
.tabs .badge { font-size: var(--fs-xs); padding: 2px 8px; }
@media (max-width: 600px) { .tabs:not(.sc-tabs) { inline-size: 100%; } .tabs:not(.sc-tabs) a { flex: 1 1 auto; justify-content: center; padding-inline: var(--sp-3); } }

/* ---- tables: breathable, hover rows; stacked cards on phones (add class "stack" + data-label) ---- */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-inline: calc(var(--sp-2) * -1); padding-inline: var(--sp-2); }
.table-wrap.sticky { max-block-size: 70vh; overflow-y: auto; }
.table-wrap.sticky thead th { position: sticky; inset-block-start: 0; z-index: 2; }
#cmpLog { overflow-x: auto; }
table { inline-size: 100%; border-collapse: separate; border-spacing: 0; }
th { text-align: start; color: var(--muted); font: 700 var(--fs-sm)/1.2 var(--font); white-space: nowrap; background: rgba(15, 14, 14, .85); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border-block-end: 2px solid var(--line-strong); }
th, td { padding: 15px var(--sp-3); border-block-end: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background var(--dur-1) var(--ease); }
tbody tr:hover { background: linear-gradient(90deg, rgba(205, 92, 69, .07), rgba(205, 92, 69, .02)); }
tbody tr:hover > :first-child { box-shadow: inset 3px 0 0 var(--accent); }
[dir=rtl] tbody tr:hover > :first-child { box-shadow: inset -3px 0 0 var(--accent); }
tbody tr:last-child td, tbody tr:last-child th { border-block-end: 0; }
tbody th, th.rowhead { color: var(--text); background: none; font: 600 var(--fs-base)/1.4 var(--font); white-space: normal; text-align: start; -webkit-backdrop-filter: none; backdrop-filter: none; border-block-end: 1px solid var(--line); }
tr.dim td:not(:has(button, a)), tr.dim th { opacity: .62; }
table.cmd-table { table-layout: fixed; }
.cmd-table th:nth-child(1) { inline-size: 17%; } .cmd-table th:nth-child(2) { inline-size: 12%; } .cmd-table th:nth-child(4) { inline-size: 10%; } .cmd-table th:nth-child(5) { inline-size: 110px; } .cmd-table th:nth-child(6) { inline-size: 200px; }
@media (max-width: 720px) { table.cmd-table { table-layout: auto; } }
td.trunc { max-inline-size: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
td.nowrap .btn + .inline-form, td.nowrap .inline-form { margin-inline-start: var(--sp-1); }
td form { margin: 0; }
td.actions-cell { text-align: end; }
@media (max-width: 720px) {
  th, td { padding: 12px var(--sp-2); }
  table.stack, .stack tbody, .stack tr, .stack td, .stack th { display: block; }
  .stack thead { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-wrap:has(table.stack) { overflow-x: visible; margin-inline: 0; padding-inline: var(--sp-3); }
  .stack tr { padding: var(--sp-3) 0; border-block-end: 1px solid var(--line-strong); }
  .stack tbody tr:last-child { border-block-end: 0; }
  .stack th, .stack td { padding: 5px 0; border: 0; }
  .stack tbody th { font-size: var(--fs-md); font-weight: 700; padding-block-end: 8px; }
  .stack td { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); text-align: end; }
  .stack td::before { content: attr(data-label); flex: none; color: var(--muted); font: 600 var(--fs-sm)/1.3 var(--font); text-align: start; }
  .stack td:not([data-label])::before { content: none; }
  .stack td.trunc { max-inline-size: none; white-space: normal; display: flex; }
  .stack td.nowrap { white-space: normal; flex-wrap: wrap; justify-content: flex-end; }
  .stack tbody tr:hover { background: none; } .stack tbody tr:hover > :first-child { box-shadow: none; }
}

/* ---- leaderboard: podium numerals ---- */
.board .rank { font: 800 1.9rem/1 var(--font-display); font-stretch: 82%; color: var(--muted); font-variant-numeric: tabular-nums; inline-size: 3.2rem; }
.board tbody tr:nth-child(1) .rank { color: var(--gold-text); text-shadow: 0 0 22px rgba(205, 92, 69, .5); font-size: 2.6rem; }
.board tbody tr:nth-child(2) .rank { color: var(--text); font-size: 2.2rem; }
.board tbody tr:nth-child(3) .rank { color: var(--team-5); font-size: 2rem; }
.board .pts { font: 800 1.35rem/1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--gold-text); }
@media (max-width: 720px) { .board .rank { inline-size: auto; } }

/* ---- forms ---- */
form { margin: 0; }
label { display: block; margin-block-end: var(--sp-4); font: 700 var(--fs-sm)/1.35 var(--font); color: var(--text); }
label small, .help { display: block; font-weight: 400; font-size: var(--fs-sm); color: var(--muted); margin-block-start: 7px; line-height: 1.5; max-inline-size: 70ch; }
label small code { font-size: .92em; }
input, select, textarea { inline-size: 100%; min-block-size: var(--touch); background: rgba(10, 9, 9, .6); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 10px 14px; font: 400 var(--fs-base)/1.4 var(--font); margin-block-start: 7px; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .3); transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease), background var(--dur-1) var(--ease); }
input::placeholder, textarea::placeholder { color: #9a9692; opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: rgba(224, 222, 219, .38); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .3), 0 0 0 3px rgba(205, 92, 69, .35); background: rgba(10, 9, 9, .8); }
textarea { resize: vertical; line-height: 1.6; min-block-size: 100px; }
select { appearance: none; -webkit-appearance: none; padding-inline-end: 40px; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--accent-text) 50%), linear-gradient(135deg, var(--accent-text) 50%, transparent 50%); background-position: calc(100% - 21px) 52%, calc(100% - 15px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }
[dir=rtl] select { background-position: 15px 52%, 21px 52%; }
select option { background: var(--surface-2); color: var(--text); }
input[type=file] { padding: 8px; cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); }
input[type=file]::file-selector-button { margin-inline-end: 12px; padding: 7px 16px; border: 0; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text); font: 700 var(--fs-sm)/1 var(--font-display); cursor: pointer; box-shadow: 0 2px 0 #0b0a0a; }
input[type=number] { font-variant-numeric: tabular-nums; }
input[type=password], input[type=number], input[type=url] { direction: ltr; text-align: start; }
input[type=search] { appearance: none; -webkit-appearance: none; }
input[dir=auto], textarea[dir=auto] { text-align: start; }
input.input-validation-error, textarea.input-validation-error, select.input-validation-error, input:user-invalid, textarea:user-invalid { border-color: var(--bad); background: rgba(205, 92, 69, .08); }
.field-validation-error, .err { color: var(--bad); font-size: var(--fs-sm); font-weight: 600; }
.field-validation-error { display: block; margin-block-start: 6px; }
.err { margin-block-end: var(--sp-3); } .err:empty, .validation-summary-valid { display: none; }
.err ul { margin: 0; list-style: none; padding: var(--sp-3) var(--sp-4); background: var(--bad-soft); border: 1px solid rgba(212, 97, 78, .5); border-inline-start: 5px solid var(--bad); border-radius: var(--r-md); }
.err ul:empty { display: none; }

/* long forms: heading column on the left, fields on the right (settings-sheet layout) */
.form > .card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; background: none; border: 0; border-block-start: 1px solid var(--line-strong); border-radius: 0; box-shadow: none; padding: var(--sp-5) 0 var(--sp-3); margin: 0; }
.form > details.card { background: rgba(10, 9, 9, .3); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-3) var(--sp-4); display: block; margin-block-start: var(--sp-5); }
.form > .card > h2 { margin: 0 0 var(--sp-4); font-size: var(--fs-xl); font-weight: 800; font-stretch: var(--stretch-display); letter-spacing: -.005em; }
.form > .card > h2 .badge { font-stretch: 100%; }
@media (min-width: 960px) {
  .form > .card { grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); column-gap: var(--sp-7); padding-block: var(--sp-6) var(--sp-4); }
  .form > .card > h2 { grid-column: 1; grid-row: 1 / span 40; position: sticky; inset-block-start: calc(var(--header-h) + 20px); align-self: start; display: block; }
  .form > .card > h2 .badge { display: block; inline-size: fit-content; margin-block-start: var(--sp-3); }
  .form > .card > :not(h2) { grid-column: 2; }
}
.form > .card:first-child { border-block-start: 0; padding-block-start: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--sp-2) var(--sp-4); margin-block: var(--sp-2) var(--sp-3); }
.checks label.check { margin: 0; }

/* switch: native checkbox restyled (keeps semantics, keyboard, form posting) */
label.check { display: block; position: relative; padding: 11px 14px 11px 70px; padding-inline: 70px 14px; font: 500 var(--fs-base)/1.45 var(--font); margin-block-end: var(--sp-2); min-block-size: 48px; cursor: pointer; color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(10, 9, 9, .28); transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
label.check:hover { background: rgba(224, 222, 219, .05); border-color: var(--line-strong); }
label.check:has(input:checked) { border-color: rgba(205, 92, 69, .35); }
label.check > input[type=checkbox] { position: absolute; inset-inline-start: 14px; inset-block-start: 11px; margin: 0; }
label.check > input[type=hidden] { display: none; }
.inline label.check, td label.check, form.inline label.check { display: inline-block; margin: 0; }
input[type=checkbox], input[type=radio] { appearance: none; -webkit-appearance: none; flex: none; position: relative; inline-size: 44px; min-inline-size: 44px; block-size: 26px; min-block-size: 26px; margin: 0; padding: 0; border-radius: var(--r-pill); background: #0b0a0a; border: 1px solid var(--line-strong); cursor: pointer; box-shadow: inset 0 2px 5px rgba(0, 0, 0, .5); transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease); }
input[type=checkbox]::after { content: ""; position: absolute; inset-block-start: 2px; inset-inline-start: 2px; inline-size: 20px; block-size: 20px; border-radius: 50%; background: #b9b5af; transition: transform var(--dur-2) var(--ease-spring), background var(--dur-2) var(--ease); box-shadow: 0 2px 4px rgba(0, 0, 0, .5); }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent-deep); box-shadow: inset 0 2px 4px rgba(94, 40, 28, .45), 0 0 14px rgba(205, 92, 69, .3); }
input[type=checkbox]:checked::after { transform: translateX(18px); background: #e0dedb; }
[dir=rtl] input[type=checkbox]:checked::after { transform: translateX(-18px); }
input[type=checkbox]:hover { border-color: rgba(224, 222, 219, .45); }
input[type=checkbox]:focus-visible { box-shadow: var(--focus); }
input[type=radio] { inline-size: 24px; min-inline-size: 24px; block-size: 24px; min-block-size: 24px; border-radius: 50%; } input[type=radio]:checked { background: radial-gradient(var(--accent) 0 40%, transparent 45%), #0b0a0a; border-color: var(--accent); }

/* inline form groups */
.inline, .inline-form { display: inline-flex; gap: var(--sp-3); align-items: center; margin: 0; flex-wrap: wrap; }
form.inline, div.inline { display: flex; }
.inline-form { margin-inline-start: var(--sp-1); }
.inline input, .inline select { margin-block-start: 0; inline-size: auto; }
.inline input[type=text], .inline input[type=search], .inline input:not([type]), #sendText { flex: 1 1 220px; min-inline-size: 140px; }
.inline label { margin-block-end: 0; }
.inline label input, .inline label select { margin-block-start: 7px; }
.inline-form input { margin-block-start: 0; }

/* sticky save bar for long forms */
.savebar { position: sticky; inset-block-end: 0; z-index: 8; display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin: var(--sp-6) calc(var(--sp-5) * -1) 0; padding: var(--sp-3) var(--sp-5) calc(var(--sp-3) + var(--buzzer-h)); background: linear-gradient(180deg, rgba(15, 14, 14, 0), rgba(15, 14, 14, .94) 38%); border-block-start: 0; }
.savebar::before { content: ""; position: absolute; inset: 14px 0 0; z-index: -1; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); -webkit-mask: linear-gradient(180deg, transparent, #000 40%); mask: linear-gradient(180deg, transparent, #000 40%); }
.savebar .hint { color: var(--muted); font-size: var(--fs-sm); margin-inline-start: auto; }
@media (max-width: 600px) { .savebar { margin-inline: -16px; padding-inline: 16px; } .savebar .btn { flex: 1 1 auto; } .savebar .hint { display: none; } }

/* ---- flash + toasts ---- */
.flash { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); margin-block-end: var(--sp-5); border: 1px solid var(--line-strong); background: var(--surface-2); font-weight: 600; }
.flash::before { flex: none; inline-size: 24px; block-size: 24px; border-radius: 50%; display: inline-grid; place-items: center; font: 800 14px/1 var(--font-display); margin-block-start: 0; }
.flash.ok { background: var(--ok-soft); border-color: rgba(95, 167, 122, .5); } .flash.ok::before { content: "\2713"; background: var(--ok); color: #0b1a12; }
.flash.bad { background: var(--bad-soft); border-color: rgba(212, 97, 78, .55); } .flash.bad::before { content: "!"; background: var(--bad); color: #1c0a08; }
.toast-region { position: fixed; inset-inline-end: var(--sp-4); inset-block-end: var(--sp-4); z-index: 60; display: grid; gap: var(--sp-2); max-inline-size: min(420px, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; background: linear-gradient(180deg, var(--surface-3), var(--surface-2)); color: var(--text); border: 1px solid var(--line-strong); border-inline-start: 5px solid var(--accent); border-radius: var(--r-md) var(--r-md) var(--r-md) var(--r-sm); padding: var(--sp-3) var(--sp-4); font-weight: 600; box-shadow: var(--shadow-3); animation: toast-in var(--dur-2) var(--ease-spring) both; }
.toast.ok { border-inline-start-color: var(--ok); } .toast.bad { border-inline-start-color: var(--bad); } .toast.warn { border-inline-start-color: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---- DASHBOARD ---- */
.hero { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(220px, 340px); gap: var(--sp-6) var(--sp-7); align-items: center; padding: var(--sp-7) var(--sp-7) var(--sp-6); margin-block-end: var(--sp-5); border-radius: var(--r-xl) var(--r-xl) var(--r-xl) var(--r-lg); overflow: hidden;
  background: radial-gradient(70% 140% at 0% 0%, rgba(205, 92, 69, .13), transparent 60%), radial-gradient(60% 120% at 100% 100%, rgba(74, 127, 212, .12), transparent 60%), linear-gradient(180deg, var(--surface-2), var(--surface)); animation: hero-in .8s var(--ease) both; }
.hero[data-state="on"] { background: radial-gradient(70% 140% at 0% 0%, rgba(205, 92, 69, .2), transparent 60%), radial-gradient(60% 120% at 100% 100%, rgba(74, 127, 212, .12), transparent 60%), linear-gradient(180deg, var(--surface-2), var(--surface)); }
.hero::before { z-index: 3; }
.hero-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: .2em .5em; font: 800 clamp(2.6rem, 6vw, 4.6rem)/.95 var(--font-display); font-stretch: var(--stretch-display); letter-spacing: -.015em; margin: 0 0 var(--sp-3); }
.hero .badge { margin: 0; background: none; border: 0; padding: 0; font: 800 clamp(1.3rem, 2.4vw, 1.8rem)/1.2 var(--font-display); font-stretch: 90%; letter-spacing: 0; gap: .45em; }
.hero .badge::before { inline-size: .5em !important; block-size: .5em !important; }
.hero-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); margin: 0 0 var(--sp-4); }
.hero-meta div { display: flex; gap: var(--sp-2); align-items: baseline; }
.hero-meta dt { color: var(--muted); font-size: var(--fs-sm); font-weight: 600; } .hero-meta dd { margin: 0; font: 700 var(--fs-md)/1.2 var(--font-display); overflow-wrap: anywhere; }
.hero-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; padding-block-end: var(--buzzer-h); }
.hero-actions .btn { min-block-size: 52px; padding-inline: 1.7em; font-size: var(--fs-md); border-radius: var(--r-lg); --buzzer-h: 6px; }
.hero-msg { min-block-size: 1.5em; margin: var(--sp-2) 0 0; color: var(--text-2); }
.hero-chan { padding-inline-start: var(--sp-6); border-inline-start: 1px solid var(--line-strong); }
@media (max-width: 1100px) { .hero-chan { padding-inline-start: 0; border-inline-start: 0; border-block-start: 1px solid var(--line-strong); padding-block-start: var(--sp-4); } }
.hero-chan h3 { font: 700 var(--fs-sm)/1.3 var(--font); color: var(--muted); margin-block-end: var(--sp-3); }
.chan-strip { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chan-strip .tag { font-size: var(--fs-sm); padding: .45em 1em; background: rgba(10, 9, 9, .45); color: var(--text); border: 1px solid var(--line-strong); font-weight: 700; max-inline-size: 100%; overflow-wrap: anywhere; }
.chan-strip .tag::before { content: ""; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); flex: none; }
.chan-empty { color: var(--text-2); margin: 0; }
@media (max-width: 1100px) { .hero { grid-template-columns: auto minmax(0, 1fr); padding: var(--sp-6); } .hero-chan { grid-column: 1 / -1; } }
@media (max-width: 640px) { .hero { grid-template-columns: minmax(0, 1fr); padding: var(--sp-5) var(--sp-4); gap: var(--sp-5); border-radius: var(--r-lg); } .hero-actions .btn { flex: 1 1 auto; } }

/* the literal ON AIR sign: unlit when the bot is stopped, bulbs chase when live */
.onair-sign { --bulb: 8px; --gap: 22px; position: relative; display: grid; place-items: center; inline-size: 232px; aspect-ratio: 2 / 1; border-radius: 22px; margin: 14px; isolation: isolate;
  font: 800 2.7rem/1 var(--font-display); font-stretch: 82%; letter-spacing: .06em; color: #8d8a86; text-shadow: none; text-align: center;
  background: linear-gradient(180deg, #161515, #0e0d0d); box-shadow: inset 0 0 0 2px #2e2c2b, inset 0 8px 18px rgba(0, 0, 0, .55), 0 0 0 5px #0f0e0e, 0 0 0 7px #2e2c2b; transition: color .5s var(--ease), background .5s var(--ease), box-shadow .5s var(--ease); }
.onair-sign::before { content: ""; position: absolute; inset: -14px; border-radius: 28px; z-index: -1; pointer-events: none; opacity: .5;
  --bulbimg: radial-gradient(circle closest-side, #6f6c68 0 40%, transparent 100%);
  background: var(--bulbimg) top left / var(--gap) var(--bulb) repeat-x, var(--bulbimg) bottom left / var(--gap) var(--bulb) repeat-x, var(--bulbimg) top left / var(--bulb) var(--gap) repeat-y, var(--bulbimg) top right / var(--bulb) var(--gap) repeat-y; }
.hero[data-state="on"] .onair-sign { color: #fff; text-shadow: 0 0 6px #e8917c, 0 0 22px #cd5c45, 0 0 48px #cd5c45; background: linear-gradient(180deg, #a8442f, #a31a31); box-shadow: inset 0 0 0 2px #e0795f, inset 0 8px 18px rgba(0, 0, 0, .25), 0 0 0 5px #0f0e0e, 0 0 0 7px #cd5c45, 0 0 70px rgba(205, 92, 69, .5); }
.hero[data-state="on"] .onair-sign::before { opacity: 1; --bulbimg: radial-gradient(circle closest-side, #f0c4b8 0 35%, rgba(205, 92, 69, .75) 58%, transparent 100%); animation: bulbs 1.1s steps(2, jump-none) infinite; }
.hero[data-state="wait"] .onair-sign { color: #e0795f; text-shadow: 0 0 14px rgba(205, 92, 69, .6); animation: sign-flicker 1.2s steps(1) infinite; }
.hero[data-state="wait"] .onair-sign::before { opacity: .85; --bulbimg: radial-gradient(circle closest-side, #e0795f 0 35%, transparent 100%); }
@keyframes sign-flicker { 0%, 100% { opacity: 1; } 30% { opacity: .55; } 34% { opacity: 1; } 70% { opacity: .7; } }
@keyframes hero-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes sign-on { 0% { opacity: .2; } 8% { opacity: 1; } 14% { opacity: .3; } 22% { opacity: 1; } 28% { opacity: .5; } 36%, 100% { opacity: 1; } }
.hero[data-state="on"] .onair-sign span { animation: sign-on 1s steps(1) .5s both; }
@media (max-width: 640px) { .onair-sign { inline-size: 100%; max-inline-size: 230px; justify-self: center; margin-inline: 14px; font-size: 2.3rem; } }

.dash { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--sp-5); align-items: stretch; }
.dash > .monitor { display: flex; } .dash .monitor-screen { flex: 1; display: flex; flex-direction: column; } .dash .monitor .feed { flex: 1; min-block-size: 440px; }
.dash-side { display: grid; gap: var(--sp-5); min-inline-size: 0; }
@media (max-width: 1000px) { .dash { grid-template-columns: minmax(0, 1fr); } }

/* the chat "monitor": a bezel, a lit screen, scanlines */
.monitor { position: relative; padding: 10px; border-radius: 34px 34px 34px 22px; background: linear-gradient(155deg, #3a3836, #1a1919 35%, #262424 70%, #171616); box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, .16); min-inline-size: 0; }
.monitor-screen { position: relative; border-radius: 26px 26px 26px 14px; background: radial-gradient(120% 80% at 50% 0%, #141313, #080707 70%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), inset 0 0 70px rgba(74, 127, 212, .09); overflow: hidden; }
.monitor-screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px); border-radius: inherit; }
.monitor-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 14px 20px 12px; border-block-end: 1px solid rgba(224, 222, 219, .08); }
.monitor-bar h2 { margin: 0; font: 800 1.35rem/1 var(--font-display); font-stretch: 90%; display: flex; align-items: center; gap: .55em; }
.monitor-bar h2 .i { color: var(--accent); }
.monitor-bar .lamp { display: inline-flex; align-items: center; gap: .55em; font: 700 var(--fs-xs)/1 var(--font); color: var(--muted); }
.monitor-bar .lamp::before { content: ""; inline-size: 9px; block-size: 9px; border-radius: 50%; background: #4a4745; transition: all .4s var(--ease); }
.hero[data-state="on"] ~ .dash .monitor-bar .lamp { color: var(--ok); }
.hero[data-state="on"] ~ .dash .monitor-bar .lamp::before { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.feed { block-size: 440px; overflow-y: auto; padding: var(--sp-3) 20px; font-size: var(--fs-base); line-height: 1.55; position: relative; z-index: 1; }
.feed:focus-visible { outline-offset: -4px; }
.feed:empty::before { content: attr(data-empty); color: var(--muted); display: block; padding: var(--sp-7) 0; text-align: center; font: 700 var(--fs-md)/1.4 var(--font-display); }
.feed .line { padding: 5px 0; overflow-wrap: anywhere; }
.feed .line + .line { border-block-start: 1px solid rgba(224, 222, 219, .04); }
.feed .t { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; margin-inline-end: 2px; }
.feed .ch { color: #7ea2e0; font-size: var(--fs-xs); font-weight: 700; }
.feed .line b { font-weight: 800; }
.feed .line > span:last-child { color: var(--text); }
.feed .line.bot > span:last-child { color: var(--gold-text); }
.feed .line.support { background: var(--warn-soft); border-inline-start: 3px solid var(--warn); padding-inline-start: 10px; border-radius: 0 8px 8px 0; margin-block: 3px; }
.feed.mono { font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.6; }
.feed.mono .line { color: var(--text-2); }
.monitor form#sendForm { position: relative; z-index: 1; display: flex; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + var(--buzzer-h)); margin: 0; background: rgba(10, 9, 9, .6); border-block-start: 1px solid rgba(224, 222, 219, .08); }
form#sendForm select { inline-size: auto; min-inline-size: 130px; max-inline-size: 100%; margin: 0; } #sendText { margin: 0; }
@media (max-width: 600px) { .feed { block-size: 340px; padding-inline: 14px; } .monitor { border-radius: 26px 26px 26px 16px; padding: 7px; } form#sendForm select, form#sendForm .btn { flex: 1 1 100%; inline-size: 100%; } }

.logpanel { padding-block-end: var(--sp-3); }
.logpanel .feed { block-size: 240px; padding-inline: 0; background: rgba(10, 9, 9, .5); border: 1px solid var(--line); border-radius: var(--r-md); padding-inline: var(--sp-3); }

/* quick-link tiles */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.tile { --team: var(--team-2); position: relative; display: grid; grid-template-rows: auto 1fr; gap: var(--sp-3); padding: var(--sp-4); color: var(--text); text-decoration: none; background: linear-gradient(180deg, rgba(42, 40, 39, .75), rgba(26, 25, 25, .85)); border: 1px solid var(--line); border-radius: 18px 18px 26px 18px; min-block-size: 132px; transition: transform var(--dur-1) var(--ease), border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease); }
.tile:nth-child(3n+2) { border-radius: 18px 26px 18px 18px; }
.tile:hover { color: var(--text); border-color: color-mix(in srgb, var(--team) 70%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--team) 20%, var(--surface-3)), var(--surface)); }
.tile:active { transform: translateY(2px); }
.tile:focus-visible { outline: 3px solid #e8917c; outline-offset: 2px; border-radius: 18px; }
.tile .tile-icon { display: grid; place-items: center; inline-size: 44px; block-size: 44px; border-radius: 14px 14px 14px 6px; background: linear-gradient(160deg, color-mix(in srgb, var(--team) 72%, white), var(--team)); color: #140a08; box-shadow: 0 3px 0 color-mix(in srgb, var(--team) 55%, black); }
.tile .tile-icon .i { inline-size: 24px; block-size: 24px; }
.tile strong { display: block; font: 800 1.25rem/1.1 var(--font-display); font-stretch: 88%; margin-block-end: 3px; }
.tile span.tile-sub { display: block; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.4; }
.tile.feature { grid-column: 1 / -1; grid-template-rows: none; grid-template-columns: auto 1fr; align-items: center; min-block-size: 0; padding: var(--sp-4) var(--sp-5); background: var(--grad-accent); color: var(--on-accent); border: 0; border-radius: 26px 26px 26px 12px; box-shadow: 0 6px 0 var(--accent-deep), 0 16px 30px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .6); margin-block-end: 6px; }
.tile.feature:hover { color: var(--on-accent); background: var(--grad-accent); filter: brightness(1.06); }
.tile.feature:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--accent-deep), 0 4px 10px rgba(0, 0, 0, .4); }
.tile.feature .tile-icon { background: #0f0e0e; color: var(--accent); box-shadow: none; inline-size: 52px; block-size: 52px; border-radius: 50%; }
.tile.feature strong { font-size: 1.6rem; } .tile.feature span.tile-sub { color: #4a3300; font-weight: 500; }
.tile.feature:focus-visible { outline-offset: 4px; }
@media (max-width: 420px) { .tiles { grid-template-columns: minmax(0, 1fr); } .tile { min-block-size: 0; grid-template-rows: none; grid-template-columns: auto 1fr; align-items: center; } }

/* key/value facts (Settings) */
.facts { display: grid; gap: var(--sp-2); margin: 0 0 var(--sp-4); padding: var(--sp-3) var(--sp-4); background: rgba(10, 9, 9, .4); border: 1px solid var(--line); border-radius: var(--r-md); }
.facts div { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); align-items: baseline; }
.facts dt { color: var(--muted); font-size: var(--fs-sm); font-weight: 600; min-inline-size: 7.5rem; } .facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; min-inline-size: 0; }
.card-head { display: flex; align-items: center; gap: var(--sp-3); }
.card-head h2 { margin: 0; }

/* tag rows (JS-built meta lines) */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 6px 2px; }

/* ---- Quiz live rows + competition match ---- */
.live-row { display: grid; grid-template-columns: minmax(100px, 160px) 1fr auto; gap: var(--sp-3) var(--sp-4); align-items: center; padding: var(--sp-4) 0; border-block-end: 1px solid var(--line); }
.live-row:last-child { border-block-end: 0; }
.live-row > b { font: 800 1.35rem/1.1 var(--font-display); font-stretch: 88%; color: var(--accent-text); }
.live-row .meta { color: var(--muted); font-size: var(--fs-sm); }
@media (max-width: 600px) { .live-row { grid-template-columns: 1fr auto; } .live-row > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; } }
pre.code { background: rgba(10, 9, 9, .6); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); overflow: auto; font: var(--fs-sm)/1.6 var(--font-mono); white-space: pre; margin: 0; max-inline-size: 100%; color: var(--text-2); }

#cmpStatus { border-radius: var(--r-xl) var(--r-lg) var(--r-lg) var(--r-lg); background: radial-gradient(80% 160% at 50% -40%, rgba(205, 92, 69, .13), transparent 70%), var(--surface); }
#cmpStatus .big { font: 800 clamp(1.4rem, 3vw, 2rem)/1.25 var(--font-display); font-stretch: 90%; margin-block: var(--sp-3); }
.team { --team: var(--team-1); border-radius: var(--r-lg); border: 1px solid color-mix(in srgb, var(--team) 40%, transparent); border-block-start: 6px solid var(--team);
  background: linear-gradient(180deg, color-mix(in srgb, var(--team) 20%, var(--surface-2)), var(--surface) 55%); }
.team.t0 { --team: var(--team-1); } .team.t1 { --team: var(--team-2); }
.team h2 { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); font: 800 var(--fs-xl)/1.1 var(--font-display); font-stretch: 85%; }
.team .score { font-size: clamp(3rem, 7vw, 5rem); }
.team ul { list-style: none; margin: var(--sp-3) 0 0; padding: 0; max-block-size: 280px; overflow: auto; }
.team li { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); padding: 6px 0; border-block-end: 1px solid var(--line); }
.team li .x { display: flex; gap: var(--sp-1); flex: none; }
.team li .btn.small { min-block-size: 40px; min-inline-size: 44px; padding-inline: 10px; }
.team:empty { display: none; }
.row:has(> .team:empty):not(:has(> .team:not(:empty))) { display: none; }
.bar { block-size: 14px; background: #0b0a0a; border-radius: var(--r-pill); overflow: hidden; margin-block: var(--sp-2); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .5); }
.bar > i { display: block; block-size: 100%; background: var(--grad-accent); border-radius: inherit; box-shadow: 0 0 14px rgba(205, 92, 69, .5); transition: inline-size .9s linear, width .9s linear; }
.bar.steal > i { background: linear-gradient(180deg, #e0795f, #cd5c45); box-shadow: 0 0 14px rgba(205, 92, 69, .5); }
.big { font-size: var(--fs-lg); font-weight: 700; line-height: 1.35; }
.timer { display: inline-block; font: 800 var(--fs-xl)/1 var(--font-display); font-stretch: 85%; font-variant-numeric: tabular-nums; color: var(--gold-text); padding: .15em .5em; border: 2px solid rgba(205, 92, 69, .55); border-radius: 12px; background: rgba(10, 9, 9, .5); text-shadow: 0 0 18px rgba(205, 92, 69, .4); }

/* ---- auth / centred pages: a small stage ---- */
.stage { position: relative; min-block-size: 100vh; display: grid; place-items: center; padding: var(--sp-6) 16px; overflow: hidden; isolation: isolate; }
.stage::before { content: ""; position: absolute; inset-inline: -10%; inset-block: -30% auto; block-size: 90%; z-index: -1; pointer-events: none; background: conic-gradient(from 180deg at 50% 0%, transparent 40%, rgba(224, 222, 219, .09) 47%, transparent 50%, rgba(224, 222, 219, .09) 53%, transparent 60%); -webkit-mask: radial-gradient(70% 100% at 50% 0%, #000, transparent); mask: radial-gradient(70% 100% at 50% 0%, #000, transparent); }
main.guest .stage::after, .stage::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: -10%; block-size: 60%; z-index: -1; pointer-events: none; background: radial-gradient(50% 60% at 50% 100%, rgba(205, 92, 69, .12), transparent 70%); }
main:not(.guest) .stage { min-block-size: 0; padding-block: var(--sp-7); }
.stage-inner { inline-size: min(100%, 440px); display: grid; justify-items: center; gap: var(--sp-5); }
.stage-brand { display: flex; align-items: center; gap: 14px; color: var(--text); }
.stage-brand .brand-mark { inline-size: 54px; block-size: 54px; box-shadow: 0 5px 0 var(--accent-deep), 0 10px 26px rgba(205, 92, 69, .3), inset 0 1px 0 rgba(255, 255, 255, .6); }
.stage-brand .brand-mark .i { inline-size: 28px; block-size: 28px; }
.stage-brand .brand-name { font-size: clamp(2.6rem, 9vw, 3.6rem); }
.auth-card { inline-size: 100%; margin: 0; padding: var(--sp-6); border-radius: 30px 30px 30px 12px; background: linear-gradient(180deg, var(--surface-2), var(--surface) 50%); border: 1px solid var(--line-strong); box-shadow: var(--shadow-3); }
.auth-card.marquee::before { inset: -14px; border-radius: 40px; opacity: .9; }
.auth-card h1 { font: 800 var(--fs-xl)/1.05 var(--font-display); font-stretch: var(--stretch-display); margin-block-end: var(--sp-2); }
.auth-card p { color: var(--text-2); }
.auth-card .btn { inline-size: 100%; margin-block-start: var(--sp-2); font-size: var(--fs-md); min-block-size: 54px; border-radius: var(--r-lg); --buzzer-h: 6px; }
.auth-card form label { color: var(--text-2); }
.auth-card label input { min-block-size: 54px; font-size: var(--fs-md); margin-block-end: var(--sp-1); }
.auth-card form { margin-block-start: var(--sp-4); }
.auth-card .medal { display: grid; place-items: center; inline-size: 64px; block-size: 64px; border-radius: 50%; margin-block-end: var(--sp-4); background: linear-gradient(160deg, #86bf9b, var(--ok)); color: #0b1a12; box-shadow: 0 5px 0 var(--ok-deep), 0 10px 24px rgba(95, 167, 122, .3); }
.auth-card .medal.warn { background: linear-gradient(160deg, #e0795f, var(--warn)); color: #2b1d00; box-shadow: 0 5px 0 #a8690a, 0 10px 24px rgba(201, 149, 63, .3); }
.auth-card .medal .i { inline-size: 32px; block-size: 32px; stroke-width: 3; }
.stage-foot { color: var(--muted); font-size: var(--fs-sm); text-align: center; }
@media (prefers-reduced-motion: reduce) { .auth-card.marquee::before, .hero[data-state="on"] .onair-sign::before { animation: none; } }

/* ---- misc ---- */
ol.small, ol.muted { padding-inline-start: 22px; line-height: 1.7; }
ol li::marker { color: var(--accent-text); font-weight: 700; }
ol.step-list { counter-reset: step; list-style: none; padding: 0; margin: 0 0 var(--sp-5); display: grid; gap: var(--sp-3); }
.step-list li { counter-increment: step; position: relative; padding-inline-start: 46px; color: var(--text-2); font-size: var(--fs-base); line-height: 1.55; min-block-size: 34px; }
.step-list li::before { content: counter(step); position: absolute; inset-inline-start: 0; inset-block-start: -2px; inline-size: 34px; block-size: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-accent); color: var(--on-accent); font: 800 1rem/1 var(--font-display); box-shadow: 0 2px 0 var(--accent-deep); }
.step-list li b { color: var(--text); }
.note-warn { color: var(--warn); display: flex; gap: var(--sp-2); align-items: flex-start; }
.note-warn::before { content: "\26A0"; }
.pager { display: flex; gap: var(--sp-3); align-items: center; justify-content: space-between; flex-wrap: wrap; margin-block-start: var(--sp-4); padding-block-end: var(--sp-1); }
.pager .where { color: var(--muted); font-size: var(--fs-sm); }
.section-note { color: var(--muted); font-size: var(--fs-sm); }
::-webkit-scrollbar { inline-size: 10px; block-size: 10px; } ::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm); min-block-size: 1em; color: transparent !important; }

} /* end @scope */

/* ---- motion preferences ---- */
@media (prefers-reduced-motion: reduce) {
  .hero, .hero .onair-sign span, .hero[data-state="wait"] .onair-sign, .toast { animation: none !important; }
  .nav-links, .bars i, .btn, .tile { transition: none !important; }
}

/* ---- hosted site: landing + Twitch login ---- */
.twitch-btn { display: inline-flex; align-items: center; gap: .6rem; background: #9146ff; color: #fff; border: 0; padding: .85rem 1.4rem; border-radius: 999px; font-weight: 700; text-decoration: none; box-shadow: 0 10px 30px -10px rgba(145,70,255,.8); }
.twitch-btn:hover { background: #a56bff; }
.twitch-btn .i { inline-size: 1.25rem; block-size: 1.25rem; }
.tiny { font-size: .8rem; }
.dev-login { margin-block-start: 1.2rem; padding-block-start: 1rem; border-top: 1px dashed rgba(224, 222, 219,.25); display: grid; gap: .5rem; }
.dev-login input { padding: .6rem .9rem; border-radius: 10px; border: 1px solid rgba(224, 222, 219,.25); background: rgba(255,255,255,.06); color: inherit; font: inherit; }
.lp .lp-inner { max-inline-size: 72rem; inline-size: 100%; }
.lp .stage-brand { justify-content: flex-start; }
.lp-hero { max-inline-size: 46rem; margin-block: 2.5rem 3rem; display: grid; gap: 1.1rem; justify-items: start; }
.lp-eyebrow { display: block !important; color: #cd5c45; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; font-size: .78rem; margin: 0; }
.lp h1 { font-size: clamp(2.4rem, 7vw, 4.6rem); line-height: 1.02; margin: 0; }
.lp h1 em { font-style: normal; color: #cd5c45; }
.lp-lead { font-size: 1.15rem; color: rgba(224, 222, 219,.82); max-inline-size: 38rem; margin: 0; }
.lp-feats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.lp-feats article { padding: 1.2rem 1.3rem; border-radius: 18px; background: rgba(255,255,255,.05); border: 1px solid rgba(224, 222, 219,.14); }
.lp-feats h2 { font-size: 1.05rem; margin: 0 0 .4rem; color: #cd5c45; }
.lp-feats p { margin: 0; color: rgba(224, 222, 219,.78); }
.user-chip { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; }
.user-chip img { inline-size: 1.7rem; block-size: 1.7rem; border-radius: 50%; object-fit: cover; }
.user-chip .role { font-size: .7rem; padding: .1rem .5rem; border-radius: 999px; background: #cd5c45; color: #0f0e0e; text-transform: uppercase; letter-spacing: .06em; }
