/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --bg: #08080b;
  --s1: #101015;
  --s2: #16161d;
  --s3: #1e1e27;
  --s4: #272732;
  --line: rgba(255, 255, 255, 0.06);
  --line2: rgba(255, 255, 255, 0.11);
  --text: #f3f3f5;
  --mute: #8d8d9b;
  --dim: #5b5b68;

  --acc: #d4ff3a;
  --acc-rgb: 212, 255, 58; /* same color, for rgba(var(--acc-rgb), .x) */
  --acc-ink: #0a0a0d;
  --acc-soft: rgba(var(--acc-rgb), 0.1);
  --acc-line: rgba(var(--acc-rgb), 0.35);
  --bad: #ff5a6e;
  --bad-rgb: 255, 90, 110;
  --bad-soft: rgba(var(--bad-rgb), 0.1);
  --warn: #ffb648;
  --warn-soft: rgba(255, 182, 72, 0.1);
  --violet: #a78bfa;
  --violet-rgb: 167, 139, 250;

  --r-lg: 22px;
  --r: 14px;
  --r-sm: 10px;

  --f-display: 'Unbounded', 'Segoe UI', sans-serif;
  --f-body: 'Onest', 'Segoe UI', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', Consolas, monospace;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

/* ==========================================================================
   Color themes (Настройки → Тема). Only the palette changes; "neon" is :root above.
   ========================================================================== */
:root[data-theme='sunset'] {
  --bg: #0c0807;
  --s1: #15100e;
  --s2: #1c1513;
  --s3: #261c19;
  --s4: #312522;
  --text: #f7f1ee;
  --mute: #a3938d;
  --dim: #6b5d58;
  --acc: #ff8a4c;
  --acc-rgb: 255, 138, 76;
  --acc-ink: #170905;
  --bad: #ff4f7b;
  --bad-rgb: 255, 79, 123;
  --warn: #ffc94d;
  --violet: #f472b6;
  --violet-rgb: 244, 114, 182;
}
:root[data-theme='ice'] {
  --bg: #060a10;
  --s1: #0d131c;
  --s2: #121a26;
  --s3: #1a2432;
  --s4: #232f40;
  --text: #eef5fb;
  --mute: #8a9bb0;
  --dim: #56677c;
  --acc: #4de1ff;
  --acc-rgb: 77, 225, 255;
  --acc-ink: #031018;
  --bad: #ff5f7e;
  --bad-rgb: 255, 95, 126;
  --warn: #ffc65c;
  --violet: #8b9cff;
  --violet-rgb: 139, 156, 255;
}
:root[data-theme='rose'] {
  --bg: #0d090c;
  --s1: #161015;
  --s2: #1d151c;
  --s3: #271d26;
  --s4: #322631;
  --text: #f9f1f6;
  --mute: #a7939f;
  --dim: #6e5c67;
  --acc: #ff9cc6;
  --acc-rgb: 255, 156, 198;
  --acc-ink: #1a0911;
  --bad: #ff6b5e;
  --bad-rgb: 255, 107, 94;
  --warn: #ffc76b;
  --violet: #c4a5ff;
  --violet-rgb: 196, 165, 255;
}
:root[data-theme='mint'] {
  --bg: #060b0a;
  --s1: #0d1513;
  --s2: #121c1a;
  --s3: #1a2724;
  --s4: #23322e;
  --text: #eefaf6;
  --mute: #8aa59d;
  --dim: #566e67;
  --acc: #43f0b0;
  --acc-rgb: 67, 240, 176;
  --acc-ink: #03140e;
  --bad: #ff5f73;
  --bad-rgb: 255, 95, 115;
  --warn: #ffc95c;
  --violet: #6fc3ff;
  --violet-rgb: 111, 195, 255;
}
:root[data-theme='gold'] {
  --bg: #0b0910;
  --s1: #13101a;
  --s2: #1a1622;
  --s3: #241e2e;
  --s4: #2e273a;
  --text: #f6f2fb;
  --mute: #9c94ab;
  --dim: #645c72;
  --acc: #ffc94a;
  --acc-rgb: 255, 201, 74;
  --acc-ink: #170f02;
  --bad: #ff5c7a;
  --bad-rgb: 255, 92, 122;
  --warn: #ff9a52;
  --violet: #b08cff;
  --violet-rgb: 176, 140, 255;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* clip (not hidden): the page itself can never be scrolled, not even by the browser bringing a focused
   element into view; only the scroll areas inside it (rules, chat, lists) scroll */
html, body { overflow: clip; }
body {
  margin: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.mono { font-family: var(--f-mono); }
.no-top { margin-top: 0; }
::selection { background: var(--acc); color: var(--acc-ink); }

/* Ambient background */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(var(--acc-rgb),  0.07), transparent 60%),
    radial-gradient(700px 500px at 100% 0%, rgba(var(--violet-rgb),  0.06), transparent 60%),
    var(--bg);
}
.backdrop::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--s4) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--s4); border-radius: 8px; }

/* ==========================================================================
   Stage: left rail (webcam slot + controls) | main (header + page)
   ========================================================================== */
/* 1920x1080 design canvas; fitStage() in app.js sets its size and scale to fill the window */
.stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; overflow: clip; }
/* position: fixed inside the transformed stage is relative to the stage, which is what we want */
.app { display: grid; grid-template-columns: 461px minmax(0, 1fr); height: 100%; }
.rail { display: flex; flex-direction: column; min-height: 0; }
/* Empty space the webcam covers on stream: exactly 461x251, flush with the screen edge */
.cam-slot { flex: none; width: 461px; height: 251px; }
body[data-cam="top"] .cam-slot { order: 0; }
body[data-cam="bottom"] .cam-slot { order: 2; }
body[data-cam="off"] .cam-slot { display: none; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0 20px 16px 16px; }

/* ==========================================================================
   Header
   ========================================================================== */
.top {
  flex: none;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px;
  padding: 14px 4px;
}
.top-right { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 12px; }
.chan { position: relative; }
.chan-led { position: absolute; right: 2px; bottom: 2px; width: 11px; height: 11px; border: 2px solid var(--bg); }
.logo { display: flex; align-items: center; gap: 12px; font: 700 17px var(--f-display); letter-spacing: -0.01em; }
.nav { display: flex; gap: 4px; padding: 4px; background: var(--s1); border: 1px solid var(--line); border-radius: 999px; }
.nav button {
  position: relative; border: 0; background: none; color: var(--mute);
  padding: 8px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  transition: color .2s, background .2s;
}
.nav button:hover { color: var(--text); }
.nav button.on { background: var(--s4); color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.nav-alert { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); display: none; }
.nav-alert.show { display: block; }

.chan {
  justify-self: end; display: flex; align-items: center; gap: 12px;
  background: none; border: 1px solid transparent; border-radius: 999px; padding: 4px; text-align: left;
  transition: background .2s, border-color .2s;
}
.chan:hover { background: var(--s1); border-color: var(--line); }
.chan-ava, .conn-ava {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--s3) center/cover; display: grid; place-items: center;
  font: 700 15px var(--f-display); color: var(--mute);
}
.chan-text { display: flex; flex-direction: column; line-height: 1.25; }
.chan-text b { font-weight: 600; font-size: 14px; }
.chan-text small { display: flex; align-items: center; gap: 6px; color: var(--mute); font-size: 12px; }
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--bad); display: inline-block; flex: none; }
.led.on { background: var(--acc); box-shadow: 0 0 0 3px rgba(var(--acc-rgb), .15); }
.led.wait { background: var(--warn); }

/* ==========================================================================
   Layout
   ========================================================================== */
.view { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 4px 8px; animation: viewIn .35s var(--ease); }
/* Text pages start under the logo like the settings; long text and inputs keep a readable width */
.view.narrow .page-head p, .view.narrow .step-body > p, .view.narrow .team-note { max-width: 760px; }
.view.narrow .input-lg { max-width: 560px; }
/* The main page never scrolls: tiles on top, the board fills the rest */
#view-giveaway { display: flex; flex-direction: column; gap: 14px; overflow: hidden; padding-bottom: 0; }
/* Pure fade: pages must not move when switching tabs */
@keyframes viewIn { from { opacity: 0; } }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.018), transparent 40%), var(--s1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card.pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0 auto 0 0; font: 600 16px var(--f-display); letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.count { font: 600 12px var(--f-body); color: var(--mute); background: var(--s3); padding: 2px 9px; border-radius: 99px; }

.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.eyebrow.ok { color: var(--acc); }

/* ==========================================================================
   Buttons & inputs
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 999px; padding: 11px 20px; font-weight: 600; font-size: 14px;
  background: var(--acc); color: var(--acc-ink);
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, opacity .2s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { box-shadow: 0 8px 28px -8px rgba(var(--acc-rgb), .55); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn-xl { padding: 18px 30px; font: 700 16px var(--f-display); letter-spacing: -0.01em; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-ghost { background: var(--s3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }
.btn-ghost:hover { background: var(--s4); box-shadow: inset 0 0 0 1px var(--line2); }
.btn-white { background: var(--text); color: var(--acc-ink); }
.btn-white:hover { box-shadow: 0 8px 28px -8px rgba(255,255,255,.4); }
.danger { color: var(--bad) !important; }
.link-btn { background: none; border: 0; color: var(--mute); font-weight: 600; font-size: 14px; padding: 6px 4px; }
.link-btn:hover { color: var(--text); }
.link-btn.danger:hover { color: var(--bad); }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--acc); color: var(--acc-ink); flex: none; }

input:not([type=checkbox]):not([type=radio]), textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line2); border-radius: var(--r-sm);
  padding: 10px 14px; outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus { border-color: var(--acc-line) !important; box-shadow: 0 0 0 4px var(--acc-soft); }
textarea { resize: vertical; line-height: 1.45; }
.input-lg { padding: 14px 16px !important; font-size: 16px; }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
::placeholder { color: var(--dim); }

/* Segmented control */
.seg { display: flex; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; }
.seg button { border: 0; background: none; color: var(--mute); padding: 5px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.seg button.on { background: var(--s3); color: var(--text); }

.search { display: flex; align-items: center; gap: 8px; color: var(--dim); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; }
.search input { border: 0 !important; background: none !important; padding: 7px 0 !important; width: 130px !important; box-shadow: none !important; font-size: 13px; }

/* Switches */
.switch { position: relative; flex: none; width: 46px; height: 28px; }
.switch input, .mini-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--s4); border-radius: 99px; transition: background .25s var(--ease); }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #c9c9d3; transition: transform .25s var(--ease), background .25s; }
.switch input:checked + span { background: var(--acc); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--acc-ink); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px var(--acc-soft); }

.mini-switch { position: relative; display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--mute); cursor: pointer; user-select: none; }
.mini-switch span { position: relative; width: 32px; height: 19px; background: var(--s4); border-radius: 99px; transition: background .2s; flex: none; }
.mini-switch span::after { content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 14px; height: 14px; border-radius: 50%; background: #c9c9d3; transition: transform .2s var(--ease), background .2s; }
.mini-switch input:checked + span { background: var(--acc); }
.mini-switch input:checked + span::after { transform: translateX(13px); background: var(--acc-ink); }
.mini-switch:has(input:checked) { color: var(--text); }

/* ==========================================================================
   Control panel: status + keyword | timer | main button
   ========================================================================== */
.control {
  flex: none; position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) 330px 330px; align-items: center;
  height: 176px; padding: 0 26px;
}
.control > * { position: relative; }
.control::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .6s;
  background: radial-gradient(700px 260px at 0% 0%, rgba(var(--acc-rgb), .13), transparent 70%);
}
.control.is-open::before { opacity: 1; }
.control.is-open { border-color: var(--acc-line); }
.ctl-kw { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding-right: 26px; }
.ctl-status { display: flex; align-items: center; gap: 14px; min-width: 0; white-space: nowrap; }
.ctl-hint { color: var(--mute); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.ctl-hint b { color: var(--text); }
.ctl-timer, .ctl-actions { height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 0 26px; border-left: 1px solid var(--line); }
.ctl-actions { gap: 8px; padding-right: 0; }
.eyebrow .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--acc); position: relative; }
.eyebrow .pulse::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--acc); animation: ping 1.6s var(--ease) infinite; }
@keyframes ping { to { transform: scale(3); opacity: 0; } }

/* Giant keyword: font size is fitted to the word length by fitKeyword() in app.js */
.kw {
  position: relative; display: flex; align-items: center; gap: 22px; cursor: text;
  height: 136px; padding: 0 48px 0 26px;
  background: var(--acc-soft); border: 1px dashed var(--acc-line); border-radius: 20px;
  color: var(--acc); transition: border-color .2s, background .2s;
}
.kw:hover { border-color: var(--acc); }
.kw .kw-label { flex: none; color: var(--mute); font-size: 13px; font-weight: 600; line-height: 1.25; letter-spacing: .06em; text-transform: uppercase; }
.kw input {
  flex: 1; min-width: 0; width: auto !important; text-align: left; color: var(--acc);
  font: 700 var(--kw-size, 96px)/1 var(--f-mono) !important; letter-spacing: -0.03em;
  background: none !important; border: 0 !important; padding: 0 0 0 16px !important; box-shadow: none !important;
  /* Glow as a filter: text-shadow gets clipped at the input's edge and draws a hard dark line on the left */
  filter: drop-shadow(0 0 22px rgba(var(--acc-rgb), .35));
}
.kw input::placeholder { color: var(--acc); opacity: .3; }
.kw-measure { position: fixed; left: -9999px; top: 0; visibility: hidden; white-space: pre; font: 700 100px/1 var(--f-mono); letter-spacing: -0.03em; }
.kw svg { position: absolute; top: 50%; right: 18px; transform: translateY(-50%); opacity: .55; }
.kw input:disabled { opacity: 1; }
.kw.locked { border-style: solid; border-color: var(--acc-line); background: linear-gradient(160deg, rgba(var(--acc-rgb), .16), rgba(var(--acc-rgb), .05)); }
.kw.locked svg { display: none; }

.timer-row { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.timer-row .kw-label { flex-basis: 100%; color: var(--mute); font-size: 13px; }
.timer-row .chips button { padding: 5px 11px; }
.countdown:not(.hidden) + .timer-row { margin-top: 4px; }
.cd-actions { display: flex; justify-content: center; gap: 14px; width: 100%; }
.tm-custom { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line2); border-radius: 99px; padding: 0 11px 0 2px; font-size: 13px; color: var(--mute); }
.tm-custom.on { border-color: var(--text); color: var(--text); }
.tm-custom input { width: 42px !important; border: 0 !important; background: none !important; box-shadow: none !important; padding: 5px 6px !important; font-size: 13px; text-align: center; }

.countdown { display: flex; flex-direction: column; align-items: center; gap: 0; }
.countdown span { font-size: 13px; color: var(--mute); }
.countdown b { font: 700 50px/1.05 var(--f-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.cd-bar { width: 100%; height: 6px; border-radius: 99px; background: var(--s3); overflow: hidden; margin-top: 8px; }
.cd-bar i { display: block; height: 100%; background: var(--acc); border-radius: 99px; transition: width .3s linear; }
.countdown.hot b { color: var(--bad); animation: blink 1s infinite; }
.countdown.hot .cd-bar i { background: var(--bad); }

.hero-sub { display: flex; justify-content: center; gap: 0 12px; flex-wrap: wrap; min-height: 30px; }
.btn:has(.btn-sub) { flex-direction: column; gap: 0; }
.btn-sub { display: block; margin-top: 3px; font-size: 13px; font-weight: 600; opacity: .7; }
#btnMain { width: 100%; padding: 20px 18px; font-size: 18px; white-space: normal; line-height: 1.2; }

/* ==========================================================================
   Prize card (left rail)
   ========================================================================== */
.rail .prize { order: 1; flex: 1; min-height: 0; margin: 16px 0 16px 16px; }
.prize { display: flex; flex-direction: column; gap: 16px; padding: 20px 22px 22px; overflow: hidden; }
.prize-head { display: flex; align-items: center; justify-content: space-between; }
.prize-head .eyebrow { color: var(--acc); }
.prize-head-actions { display: flex; align-items: center; gap: 6px; }
.prize-reset-ico { display: grid; place-items: center; }
.prize-img {
  position: relative; flex: 1; min-height: 120px; border-radius: 18px; overflow: hidden; cursor: pointer;
  display: grid; place-items: center;
  /* --prize-c is the CS2 rarity colour when the prize is a skin */
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--prize-c, var(--acc)) 22%, transparent), transparent),
    radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--prize-c, var(--violet)) 30%, transparent), transparent 60%),
    var(--s2);
  border-bottom: 3px solid var(--prize-c, var(--line)) !important;
  border: 1px solid var(--line); transition: border-color .2s;
}
.prize-img:hover, .prize-img.drag { border-color: var(--acc-line); }
.prize-img img { max-width: 88%; max-height: 88%; object-fit: contain; filter: drop-shadow(0 18px 40px rgba(0,0,0,.6)); }
.prize-img:not(.has-img) img { display: none; }
.prize-img.has-img .prize-img-empty { display: none; }
.prize-img-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--dim); padding: 20px; }
.prize-img-empty b { color: var(--text); font-size: 15px; }
.prize-img-empty small { font-size: 13px; line-height: 1.45; }
.prize-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.prize-text b { font: 700 26px/1.15 var(--f-display); letter-spacing: -0.03em; overflow-wrap: anywhere; }
.prize-text span { color: var(--mute); font-size: 15px; }
.prize-text.empty b { color: var(--dim); font-size: 18px; }
/* Several prizes: compact list under the big card */
.prize-list { display: flex; flex-direction: column; gap: 4px; max-height: 244px; overflow-y: auto; flex: none; padding: 4px 0; }
.prize-list:empty { display: none; }
.prize-row {
  display: grid; grid-template-columns: 18px 52px minmax(0, 1fr) 26px; align-items: center; gap: 10px;
  padding: 5px 6px 5px 8px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; transition: background .15s;
}
.prize-row:hover { background: var(--s2); }
.prize-row { position: relative; cursor: grab; }
.prize-row:active { cursor: grabbing; }
.prize-row.dragging { opacity: .35; }
/* Where the dragged prize will land */
.prize-row.drop-before::before, .prize-row.drop-after::after {
  content: ''; position: absolute; left: 6px; right: 6px; height: 3px; border-radius: 3px; background: var(--acc);
  box-shadow: 0 0 10px rgba(var(--acc-rgb), .6); pointer-events: none;
}
.prize-row.drop-before::before { top: -4px; }
.prize-row.drop-after::after { bottom: -4px; }
/* On hover the number turns into a grip, hinting the row can be dragged */
.prize-row:hover .pr-no { font-size: 0; }
.prize-row:hover .pr-no::before { content: '⠿'; font-size: 16px; color: var(--mute); }
.prize-row.shown { background: var(--s2); border-color: var(--line2); }
.pr-no { font: 700 13px var(--f-display); color: var(--dim); text-align: center; }
.prize-row.current .pr-no { color: var(--acc); }
.pr-thumb { width: 52px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--s3); border-bottom: 2px solid var(--prize-c); overflow: hidden; }
.pr-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pr-main { min-width: 0; display: flex; flex-direction: column; }
.pr-main b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-main small { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-main small b { font-size: 12px; color: var(--text); }
.prize-row.done .pr-main small { color: var(--acc); }
.prize-row.current .pr-main small { color: var(--warn); }
.pr-del { width: 26px; height: 26px; border-radius: 50%; border: 0; background: none; color: var(--dim); font-size: 12px; opacity: 0; transition: opacity .15s; }
.prize-row:hover .pr-del { opacity: 1; }
.pr-del:hover { background: var(--bad); color: #fff; }
.prize-add { flex: none; align-self: flex-start; border: 1px dashed var(--line2); background: none; color: var(--mute); border-radius: 99px; padding: 6px 14px; font-size: 13px; font-weight: 600; }
.prize-add:hover { color: var(--acc); border-color: var(--acc-line); }
.prize.editing .prize-list, .prize.editing .prize-add { display: none; }
.prize-form { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
/* While editing, the form takes the whole card */
.prize.editing .prize-img, .prize.editing .prize-text { display: none; }
.skin-search { position: relative; display: block; color: var(--dim); }
.skin-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
.skin-search input { padding-left: 36px !important; }
.skin-db { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: 12px; color: var(--dim); margin-top: -4px; }
.skin-db .link-btn { font-size: 12px; padding: 0; color: var(--mute); text-decoration: underline dotted; text-underline-offset: 3px; }
.skin-db .link-btn:hover { color: var(--acc); }
.skin-db .err { color: var(--bad); }
.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--s4); border-top-color: var(--acc); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.skin-results { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.skin-results:empty { display: none; }
.skin-results .hint { color: var(--dim); font-size: 13px; padding: 8px 2px; }
.skin {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 12px; text-align: left;
  padding: 6px 10px 6px 6px; border-radius: 12px; border: 1px solid transparent; background: var(--s2);
  box-shadow: inset 3px 0 0 var(--c, var(--dim));
}
.skin:hover { border-color: var(--line2); background: var(--s3); }
.skin:disabled { opacity: .5; }
.skin img { width: 64px; height: 48px; object-fit: contain; }
.skin b { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.skin small { color: var(--mute); font-size: 12px; }
.prize-or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 12px; }
.prize-or::before, .prize-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.prize-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--mute); }
.prize-form-actions { display: flex; justify-content: space-between; align-items: center; }

/* ==========================================================================
   Tiles
   ========================================================================== */
.tiles { flex: none; display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr 2fr; gap: 14px; }
.tile {
  position: relative; overflow: hidden;
  background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 12px 18px; display: flex; flex-direction: column; gap: 2px; height: 94px;
}
.tile-label { font-size: 13px; color: var(--mute); font-weight: 500; }
.tile-num { font: 700 30px/1.1 var(--f-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.tile-num.sm { font-size: 22px; }
.tile small { color: var(--dim); font-size: 12px; margin-top: auto; }
.tile.ok .tile-num { color: var(--acc); }
.tile.bad .tile-num { color: var(--bad); }
.tile-bar { margin-top: auto; height: 6px; border-radius: 99px; background: var(--s3); display: flex; overflow: hidden; gap: 2px; }
.tile-bar i { display: block; height: 100%; transition: width .6s var(--ease); }
#tBarOk { background: var(--acc); }
#tBarBad { background: var(--bad); }
.tile-wide { flex-direction: column; }
.tile-split { display: flex; gap: 28px; position: relative; z-index: 1; }
.tile-split > div { display: flex; flex-direction: column; gap: 4px; }
.spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 42%; }
.spark-line { fill: none; stroke: var(--violet); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-fill { fill: rgba(var(--violet-rgb), .12); }

/* ==========================================================================
   Board: people / shield / chat
   ========================================================================== */
.board { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
.side { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.people { display: flex; flex-direction: column; min-height: 0; }
.people-list { flex: 1; overflow-y: auto; padding: 0 10px 10px; }
.people-list:empty { display: none; }
.people .empty p { margin: 0; max-width: 440px; }
.people .empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }

.person {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: var(--r);
  transition: background .15s;
}
.person.new { animation: rowIn .4s var(--ease); }
@keyframes rowIn { from { opacity: 0; transform: translateY(-4px); } }
.person:hover { background: var(--s2); }
.ava {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font: 700 15px var(--f-display); color: var(--acc-ink);
  background: var(--c, var(--violet)) center/cover;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.ava.img { color: transparent; }
.p-main { min-width: 0; }
.p-name { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-name .nm { overflow: hidden; text-overflow: ellipsis; }
.p-sub { font-size: 13px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person.rejected .p-sub { color: #ff97a4; }
.person.rejected .p-name .nm { color: var(--mute); }
.badge { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: var(--s3); color: var(--mute); flex: none; }
.badge.sub { background: rgba(var(--violet-rgb), .16); color: var(--violet); }
.badge.mod { background: rgba(72, 214, 140, .14); color: #5fe0a0; }
.badge.vip { background: rgba(255, 110, 199, .14); color: #ff8bd2; }
.badge.win { background: var(--acc); color: var(--acc-ink); }

.status {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  padding: 5px 11px; border-radius: 99px; white-space: nowrap;
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.eligible { color: var(--acc); background: var(--acc-soft); }
.status.rejected { color: var(--bad); background: var(--bad-soft); }
.status.pending { color: var(--warn); background: var(--warn-soft); }
.status.pending::before { animation: blink 1s infinite; }
.status.error { color: var(--warn); background: var(--warn-soft); }
@keyframes blink { 50% { opacity: .2; } }

.p-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.person:hover .p-actions, .p-actions:focus-within { opacity: 1; }
.p-act { width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--s3); color: var(--mute); display: grid; place-items: center; text-decoration: none; }
.p-act:hover { background: var(--s4); color: var(--text); }
.p-act.bad:hover { color: var(--bad); }

.empty { text-align: center; padding: 70px 24px; color: var(--mute); }
.empty .big { font: 700 20px var(--f-display); color: var(--text); margin-bottom: 6px; letter-spacing: -0.02em; }
.empty svg { color: var(--dim); margin-bottom: 14px; }

/* Shield */
.shield-list { padding: 0 20px 18px; display: flex; flex-direction: column; gap: 12px; }
.sh-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; }
.sh-row b { font-variant-numeric: tabular-nums; }
.sh-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--s3); overflow: hidden; }
.sh-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--bad), #ff8a5b); border-radius: 99px; transition: width .6s var(--ease); }
.shield-empty { color: var(--mute); font-size: 14px; display: flex; gap: 12px; align-items: center; }
.shield-empty svg { color: var(--acc); flex: none; }

/* Chat */
.chat { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.shield { flex: none; max-height: 272px; display: flex; flex-direction: column; }
.shield .shield-list { overflow-y: auto; min-height: 0; }
/* "Показывать статистику" off: only names and the chat stay */
body.no-stats .tiles, body.no-stats #peopleFilter, body.no-stats .person .status, body.no-stats .person .p-sub, body.no-stats .shield { display: none; }
/* Scrolling is handled in app.js (stick to bottom / keep position), so the browser's own anchoring is off */
.chat-log { flex: 1; overflow-y: auto; overflow-anchor: none; padding: 0 8px 8px; font-size: 14px; }
.msg { position: relative; padding: 5px 12px; border-radius: 10px; line-height: 1.45; word-wrap: break-word; animation: fadeIn .25s linear; }
@keyframes fadeIn { from { opacity: 0; } }
.msg .t { color: var(--dim); font-size: 11.5px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.msg .n { font-weight: 700; }
.msg .badge { margin-right: 5px; vertical-align: 1px; padding: 1px 5px; font-size: 9.5px; }
/* Entry messages: a straight colour bar on the left (a separate element, so the rounded corners don't bend it) */
.msg.entry { background: var(--s2); }
.msg.entry::before { content: ''; position: absolute; left: 0; top: 5px; bottom: 5px; width: 3px; border-radius: 3px; background: var(--dim); }
.msg.entry.eligible { background: rgba(var(--acc-rgb), .05); }
.msg.entry.eligible::before { background: var(--acc); }
.msg.entry.rejected { background: rgba(var(--bad-rgb), .05); }
.msg.entry.rejected::before { background: var(--bad); }
/* Stats off: every keyword message looks the same, whether the check passed or not */
body.no-stats .msg.entry { background: rgba(var(--acc-rgb), .05); }
body.no-stats .msg.entry::before { background: var(--acc); }
.msg.winner-reply { background: rgba(var(--acc-rgb), .16); }
.msg.winner-reply::before { content: ''; position: absolute; left: 0; top: 5px; bottom: 5px; width: 3px; border-radius: 3px; background: var(--acc); }
.msg.action .x { font-style: italic; }
.chat-empty { color: var(--dim); text-align: center; padding: 40px 0; font-size: 14px; }
.chat-say { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-say input { border-radius: 999px !important; }
.chat-jump { position: absolute; left: 50%; bottom: 72px; transform: translateX(-50%); border: 0; background: var(--text); color: var(--acc-ink); font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 99px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.live-dot.on { background: var(--acc); animation: blink 2s infinite; }

/* Winner card (inline) */
.wcard {
  margin: 0 20px 12px; padding: 16px; border-radius: var(--r);
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(110deg, rgba(var(--acc-rgb), .16), rgba(var(--acc-rgb), .02) 60%), var(--s2);
  border: 1px solid var(--acc-line);
}
.wcard .ava { width: 52px; height: 52px; font-size: 19px; }
.wcard-main { flex: 1; min-width: 0; }
.wcard-main .eyebrow { color: var(--acc); }
.wcard-main b { display: block; font: 700 22px var(--f-display); letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wcard-main small { color: var(--mute); }
.wcard .ring-sm { flex: none; }

/* ==========================================================================
   Rules page
   ========================================================================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 24px; }
.page-head h1 { margin: 0 0 6px; font: 700 34px/1.1 var(--f-display); letter-spacing: -0.03em; }
.page-head p { margin: 0; color: var(--mute); }
.saved { font-size: 13px; font-weight: 600; color: var(--mute); display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: var(--s1); border: 1px solid var(--line); transition: color .2s; }
.saved::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--acc); }
.saved.saving::before { background: var(--warn); animation: blink .8s infinite; }
.saved.err::before { background: var(--bad); }

.section-title { font: 600 13px var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); margin: 34px 0 12px; }
#rulesForm > .section-title:first-child { margin-top: 0; }
.set-pane > .section-title:first-child, .pane-note + .section-title { margin-top: 0; }
.set-tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 26px; border: 1px solid var(--line); border-radius: 99px; background: var(--s1); }
.set-tabs button { border: 0; background: none; color: var(--mute); border-radius: 99px; padding: 8px 18px; font-weight: 600; font-size: 14px; }
.set-tabs button:hover { color: var(--text); }
.set-tabs button.on { background: var(--text); color: var(--acc-ink); }
.pane-note { margin: 0 0 22px; color: var(--mute); }
.rules-grid.gap-top { margin-top: 14px; }
.rule[hidden] { display: none; }
.inline-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; }
.radio-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
/* The real radio button is hidden inside its own card: positioned against the label, so focusing it
   never makes the browser scroll the page to some far-away spot */
.radio-cards label { position: relative; cursor: pointer; }
.radio-cards input { position: absolute; inset: 0; opacity: 0; margin: 0; pointer-events: none; }
.theme-dots { display: inline-block; width: 34px; height: 14px; margin-right: 8px; vertical-align: -2px; border-radius: 99px; background: linear-gradient(90deg, var(--a) 0 36%, var(--b) 36% 68%, var(--c) 68%); box-shadow: inset 0 0 0 1px var(--line2); }
.radio-cards span { display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line2); background: var(--bg); transition: border-color .2s, background .2s; }
.radio-cards small { color: var(--mute); font-size: 13px; }
.radio-cards i { font-style: normal; font-family: var(--f-mono); color: var(--text); }
.radio-cards input:checked + span { border-color: var(--acc); background: var(--acc-soft); }
.radio-cards input:focus-visible + span { box-shadow: 0 0 0 4px var(--acc-soft); }

.rules-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.rule {
  background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px;
  display: flex; flex-direction: column; gap: 16px; transition: border-color .25s, background .25s;
}
.rule.on { border-color: rgba(var(--acc-rgb), .22); background: linear-gradient(160deg, rgba(var(--acc-rgb), .05), transparent 50%), var(--s1); }
.rule-top { display: grid; grid-template-columns: 44px 1fr auto; gap: 16px; align-items: start; }
.rule-top b { font-size: 16px; font-weight: 700; display: block; margin-bottom: 3px; }
.rule-top p { margin: 0; color: var(--mute); font-size: 14px; }
.rule-ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--s3); color: var(--mute); transition: background .25s, color .25s; }
.rule.on .rule-ico, .rule.always .rule-ico { background: var(--acc-soft); color: var(--acc); }
.rule-body { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding-left: 60px; transition: opacity .25s; }
.rule-body.col { flex-direction: column; align-items: stretch; }
.rule:not(.on):not(.always) .rule-body { opacity: .35; pointer-events: none; }
.rule-note { color: var(--dim); font-size: 13px; padding-left: 60px; margin-top: -4px; }
.rule-note.warn { color: #d9b077; }
.rule-note.warn b { color: var(--text); }
.toggles { display: flex; flex-wrap: wrap; gap: 18px; padding-left: 60px; }
.hint-card p { line-height: 1.8; }
.hint-card .mono { color: var(--acc); }

.num { display: inline-flex; align-items: center; background: var(--bg); border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; }
.num button { width: 36px; height: 40px; border: 0; background: none; color: var(--mute); font-size: 18px; }
.num button:hover { color: var(--text); background: var(--s3); }
.num input { width: 64px !important; text-align: center; border: 0 !important; border-radius: 0 !important; background: none !important; padding: 8px 0 !important; font: 700 16px var(--f-body); box-shadow: none !important; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line2); background: none; color: var(--mute); border-radius: 99px; padding: 5px 11px; font-size: 13px; font-weight: 500; }
.chips button:hover { color: var(--text); border-color: var(--dim); }
.chips button.on { background: var(--text); color: var(--acc-ink); border-color: var(--text); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--mute); cursor: pointer; flex-basis: 100%; }
.check input { accent-color: var(--acc); width: 18px; height: 18px; margin: 1px 0 0; flex: none; }

.taglist { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border-radius: 99px; background: var(--s3); font-size: 14px; font-family: var(--f-mono); }
.tag button { width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--s4); color: var(--mute); display: grid; place-items: center; font-size: 12px; }
.tag button:hover { background: var(--bad); color: #fff; }
.tag-add { display: flex; gap: 10px; max-width: 520px; }

/* ==========================================================================
   Connect page
   ========================================================================== */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 20px; position: relative; padding-bottom: 30px; }
.step::before { content: ''; position: absolute; left: 21px; top: 48px; bottom: 6px; width: 2px; background: linear-gradient(var(--line2), transparent); }
.step:last-child::before { display: none; }
.step-n { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font: 700 17px var(--f-display); background: var(--s2); border: 1px solid var(--line2); }
.step:last-child .step-n { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.step-body { padding-top: 8px; min-width: 0; }
.step-body h3 { margin: 0 0 6px; font: 600 18px var(--f-display); letter-spacing: -0.02em; }
.step-body p { margin: 0 0 14px; color: var(--mute); }
.step-body .small { margin-top: 12px; }
.form-help { display: grid; grid-template-columns: 170px 1fr; gap: 0; margin: 8px 0 0; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.form-help dt, .form-help dd { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.form-help dt { color: var(--mute); font-family: var(--f-mono); font-size: 13px; background: var(--s2); }
.form-help dt:last-of-type, .form-help dd:last-of-type { border-bottom: 0; }
.copy-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.copy-box .mono { color: var(--acc); }

.connected { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; border-color: var(--acc-line); }
.connected .conn-ava { width: 64px; height: 64px; font-size: 22px; }
.conn-info { flex: 1; min-width: 200px; }
.conn-info h2 { margin: 6px 0 2px; font: 700 22px var(--f-display); letter-spacing: -0.02em; }
.conn-info p { margin: 0; }
.conn-actions { display: flex; gap: 10px; }
.alert { padding: 14px 18px; border-radius: var(--r); background: var(--bad-soft); border: 1px solid rgba(var(--bad-rgb), .3); color: #ffb3bd; margin-bottom: 24px; }

/* ==========================================================================
   Winner overlay
   ========================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; padding: 24px; overflow-y: auto;
  background: radial-gradient(800px 500px at 50% 45%, rgba(var(--acc-rgb), .10), transparent 70%), var(--bg);
  animation: fade .3s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.ov-stage { margin: auto; width: min(760px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; }
.ov-eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--acc); margin-bottom: 26px; }
.ov-close { position: fixed; top: 22px; right: 22px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line2); background: var(--s1); color: var(--mute); font-size: 16px; }
.ov-close:hover { color: var(--text); }

.reel-window {
  --h: 92px;
  position: relative; width: 100%; height: calc(var(--h) * 3); overflow: hidden;
  mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
}
.reel { will-change: transform; }
.reel-item {
  height: var(--h); display: flex; align-items: center; justify-content: center;
  font: 800 clamp(30px, 5.4vw, 54px) var(--f-display); letter-spacing: -0.04em; color: var(--dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 20px;
}
.reel-item.hot { color: var(--text); }
.reel-item.win { color: var(--acc); transition: color .3s; }
.reel-focus { position: absolute; left: 0; right: 0; top: var(--h); height: var(--h); border-top: 1px solid var(--acc-line); border-bottom: 1px solid var(--acc-line); background: linear-gradient(90deg, transparent, rgba(var(--acc-rgb), .06), transparent); pointer-events: none; }

.reveal { display: flex; flex-direction: column; align-items: center; gap: 0; animation: pop .7s cubic-bezier(.2,1.4,.3,1); width: 100%; }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
.reveal .ava { width: 112px; height: 112px; font-size: 40px; box-shadow: 0 0 0 6px var(--bg), 0 0 0 8px var(--acc), 0 20px 80px -10px rgba(var(--acc-rgb), .5); margin-bottom: 26px; }
.win-name { font: 800 clamp(40px, 7vw, 76px)/1 var(--f-display); letter-spacing: -0.05em; color: var(--acc); word-break: break-word; }
.win-meta { margin-top: 14px; color: var(--mute); font-size: 15px; }
/* Prize the winner takes: picture on a rarity-tinted tile + label, name, rarity/price */
.win-prize {
  display: grid; grid-template-columns: 148px minmax(0, 1fr); align-items: center; gap: 20px;
  width: min(580px, 100%); margin-top: 22px; padding: 10px 22px 10px 10px; text-align: left;
  border-radius: 20px; background: var(--s1); border: 1px solid var(--line2);
}
.win-prize.no-img { grid-template-columns: minmax(0, 1fr); padding-left: 22px; }
.wp-img {
  height: 104px; border-radius: 14px; display: grid; place-items: center; overflow: hidden;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--prize-c) 30%, transparent), transparent),
    var(--s2);
  border-bottom: 3px solid var(--prize-c);
}
.wp-img img { max-width: 90%; max-height: 90%; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(0,0,0,.6)); }
.wp-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wp-text small { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--acc); }
.wp-text b { font: 700 20px/1.2 var(--f-display); letter-spacing: -0.02em; color: var(--text); overflow-wrap: anywhere; }
.wp-text span { font-size: 14px; color: var(--mute); }
.win-card-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; color: var(--mute); font-size: 14px; text-decoration: none; border-bottom: 1px dashed var(--line2); padding-bottom: 2px; }
.win-card-link:hover { color: var(--acc); border-color: var(--acc-line); }
.win-row { display: flex; align-items: center; gap: 24px; margin-top: 30px; width: 100%; max-width: 560px; text-align: left; }
.ring { position: relative; width: 92px; height: 92px; flex: none; }
/* Only the progress ring is rotated (so it starts at 12 o'clock), not the ✓ icon inside it */
.ring > svg { transform: rotate(-90deg); }
.ring > svg circle { fill: none; stroke-width: 6; }
.ring .bg { stroke: var(--s3); }
.ring .fg { stroke: var(--acc); stroke-linecap: round; transition: stroke-dashoffset .3s linear, stroke .3s; }
.ring.late .fg { stroke: var(--bad); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 700 24px var(--f-display); font-variant-numeric: tabular-nums; }
.ring.late b { color: var(--bad); }
.ring-wrap { flex: none; width: 120px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ring-cap { font-size: 12px; font-weight: 600; color: var(--mute); text-align: center; line-height: 1.3; }
.ring-cap.late { color: var(--bad); }
.ring.done .fg { stroke: var(--acc); }
.replies { flex: 1; min-width: 0; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; min-height: 92px; max-height: 160px; overflow-y: auto; }
.replies .lbl { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); margin-bottom: 6px; display: block; }
.replies .r { padding: 3px 0; }
.replies .r .t { color: var(--dim); font-size: 12px; margin-right: 6px; }
.replies .waiting { color: var(--dim); }
.win-actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.win-actions .btn { white-space: normal; max-width: 100%; text-align: center; }
.win-status { margin-top: 18px; font-weight: 600; }
.win-status.ok { color: var(--acc); }
.win-status.bad { color: var(--bad); }
.win-prev { margin-top: 22px; color: var(--dim); font-size: 13px; }

/* Ball race (plinko) */
.overlay.racing .ov-stage { display: none; }
.overlay.racing { padding: 0; }
/* Full screen: the course is drawn over the whole screen (canvas), places float on top at the right */
.plinko { position: absolute; inset: 0; }
.plinko-board {
  position: absolute; inset: 0;
  background: radial-gradient(900px 600px at 40% 0%, rgba(var(--violet-rgb), .10), transparent 70%), var(--bg);
}
.plinko-board canvas { display: block; width: 100%; height: 100%; }
.plinko-side {
  position: absolute; top: 32px; right: 32px; width: 380px; max-height: calc(100% - 64px);
  display: flex; flex-direction: column; gap: 12px; padding: 22px 20px 18px;
  background: color-mix(in srgb, var(--s1) 90%, transparent); border: 1px solid var(--line2); border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
.plinko-side .ov-eyebrow { margin: 0; text-align: left; }
.plinko-side h3 { margin: 0; font: 700 32px var(--f-display); letter-spacing: -0.03em; }
.plinko-places { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.plinko-places li {
  display: grid; grid-template-columns: 30px 14px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px; background: var(--s2); border: 1px solid var(--line); font-size: 18px;
}
.plinko-places li i { width: 14px; height: 14px; border-radius: 50%; }
.plinko-places .pl-no { font: 700 18px var(--f-display); color: var(--dim); text-align: center; }
.plinko-places .pl-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plinko-places .pl-st { font-size: 15px; color: var(--mute); font-variant-numeric: tabular-nums; }
.plinko-places li.done .pl-st { color: var(--acc); font-weight: 700; }
.plinko-places li.first { border-color: var(--acc); background: linear-gradient(110deg, rgba(var(--acc-rgb), .16), transparent 70%), var(--s1); }
.plinko-places li.first .pl-no { color: var(--acc); }
.plinko-info { color: var(--dim); font-size: 12px; }
.radio-cards.two { grid-template-columns: repeat(2, 1fr); }

/* Lists that change all the time (new chat message, new entry): keep their layout and painting
   to themselves, so an update doesn't make the browser rework the whole page */
.chat-log, .people-list, .shield-list, .skin-results, .plinko-places, .prize-list { contain: content; }
.reel { will-change: transform; }

.viewer-bar { font-size: 13px; color: var(--mute); padding: 8px 14px; border-radius: 99px; background: var(--s1); border: 1px solid var(--line); }
.viewer-bar b { color: var(--text); }
.viewer-bar .link-btn { padding: 0; font-size: 13px; }

/* Admin page */
.admin-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.admin-kpis .card { padding: 16px 20px; }
.admin-kpis b { display: block; font: 700 28px var(--f-display); letter-spacing: -0.02em; }
.admin-kpis span { color: var(--mute); font-size: 13px; }
.admin-list { padding: 6px 0; }
.admin-row { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--line); }
.admin-row:first-child { border-top: 0; }
.admin-ava { width: 36px; height: 36px; border-radius: 50%; flex: none; background: var(--s3) center/cover; display: grid; place-items: center; color: var(--mute); font-weight: 700; }
.admin-who { flex: 1; min-width: 0; }
.admin-who b { display: flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-who small { display: block; color: var(--mute); font-size: 12px; margin-top: 2px; }
.admin-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--s3); color: var(--mute); }
.admin-tag.admin { background: var(--acc-soft); color: var(--acc); }
.admin-empty { padding: 18px 20px; color: var(--mute); margin: 0; }
.team-note { margin: 12px 0 0; font-size: 13px; }
/* Team moderators: the Twitch connection is the owner's business */
.helper-note { display: none; }
body[data-role=helper] .helper-note { display: block; margin: 0 0 24px; }
body[data-role=helper] .conn-actions, body[data-role=helper] #steps { display: none; }
@media (max-width: 640px) { .admin-kpis { grid-template-columns: 1fr; } .admin-row { flex-wrap: wrap; } }

/* Login page (server mode) — a normal page, not the scaled 1920x1080 stage */
body.login-page { width: auto; height: auto; min-height: 100vh; display: grid; place-items: center; overflow: auto; }
.login-card { width: min(460px, calc(100vw - 32px)); padding: 40px 36px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.login-card h1 { margin: 4px 0 0; font: 700 32px var(--f-display); letter-spacing: -0.03em; }
.login-card p { margin: 0; }
.login-card .btn { width: 100%; margin-top: 8px; }
.login-card .alert { margin: 0; text-align: left; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 70;
  padding: 13px 20px; border-radius: 14px; background: var(--text); color: var(--acc-ink); font-weight: 600;
  box-shadow: 0 16px 50px rgba(0,0,0,.5); animation: toastIn .35s var(--ease); max-width: calc(100vw - 32px);
}
.toast.err { background: var(--bad); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ==========================================================================
   Ролл tab: the game page without the prize panel
   ========================================================================== */
body.roll-mode .rail .prize { display: none; }
body:not([data-view="giveaway"]) .rail .prize { display: none; } /* the prize belongs to the giveaway page only */
body.roll-mode #reveal .ring-wrap { display: none; } /* a roll shows the winner's chat, but no reply timer */
.winners-row { display: none; align-items: center; justify-content: center; gap: 10px; color: var(--mute); font-size: 13px; white-space: nowrap; }
.winners-row .num button { width: 30px; height: 32px; }
.winners-row .num input { width: 44px !important; padding: 4px 0 !important; font-size: 14px; }
body.roll-mode .winners-row { display: flex; }
body.roll-mode #btnMain { padding: 14px 18px; }
