/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== DESIGN TOKENS ===== */
:root {
  --bg:       #080808;
  --surface:  #101010;
  --surface2: #181818;
  --border:   #2a2a2a;
  --text:     #EFEFEB;
  --muted:    #5C5C5C;

  /* Broadcast palette */
  --red:     #CC0000;
  --gold:    #F5C518;
  --blue:    #0057A0;
  --green:   #009A44;
  --cyan:    #00A8B0;
  --white:   #D8D8D8;

  --accent:  var(--red);
  --accent2: var(--gold);

  /* Test-card 7-band color bar */
  --color-bar: linear-gradient(to right,
    #F5C518 14.286%,
    #009A44 14.286% 28.571%,
    #00A8B0 28.571% 42.857%,
    #D8D8D8 42.857% 57.143%,
    #CC0000 57.143% 71.429%,
    #0057A0 71.429% 85.714%,
    #141414 85.714%
  );

  --radius:    3px;
  --radius-sm: 2px;

  --font-display: 'Bebas Neue', Impact, 'Arial Narrow', sans-serif;
  --font-ui:      'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  --font-mono:    'Share Tech Mono', 'Courier New', monospace;
}

/* ===== BASE ===== */
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.4;
  overflow-x: hidden;
}

/* ===== COLOR BAR ===== */
.color-bar {
  height: 8px;
  background: var(--color-bar);
  width: 100%;
  flex-shrink: 0;
}

/* ===== SECTIONS ===== */
.section {
  display: none;
  min-height: 100vh;
  padding: 1rem;
}
.section.active { display: flex; align-items: center; justify-content: center; }

/* ===== LANDING ===== */
.landing-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.logo {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 7vw, 5rem);
  letter-spacing: 0.06em;
  color: var(--text);
  text-align: center;
  line-height: 1;
  padding: 1.5rem 2rem 0;
  /* Underline in red */
  border-bottom: 4px solid var(--red);
  padding-bottom: 1.2rem;
  margin-bottom: 0;
}

.tagline {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.6rem 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.landing-card .form-group,
.landing-card .btn,
.landing-card .divider,
.landing-card .error-msg {
  margin-left: 2rem;
  margin-right: 2rem;
}
.landing-card .form-group { margin-top: 1rem; }
.landing-card .btn        { margin-top: 0.5rem; margin-bottom: 0.25rem; }
.landing-card .divider    { margin-top: 0.5rem; }
.landing-card .error-msg  { margin-bottom: 1rem; }

.landing-card > *:last-child { margin-bottom: 2rem; }

/* ===== FORMS ===== */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

input[type="text"] {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.7rem 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
input[type="text"]:focus { border-color: var(--red); border-left-color: var(--gold); }
input.code-input {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 1.6rem;
  text-align: center;
  border-left-color: var(--gold);
}

.divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  position: relative;
  margin-top: 0.75rem;
}
.divider::before, .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 28%;
  height: 1px;
  background: var(--border);
}
.divider::before { left: 0; }
.divider::after  { right: 0; }

.error-msg { color: var(--red); font-size: 0.85rem; text-align: center; font-weight: 600; }

/* ===== BUTTONS ===== */
.btn {
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  transition: opacity 0.12s, transform 0.1s;
  text-transform: uppercase;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
.btn-large { padding: 0.9rem 2rem; font-size: 1.35rem; }

.btn-primary {
  background: var(--red);
  color: #fff;
  border-bottom: 3px solid rgba(0,0,0,0.35);
}
.btn-primary:hover:not(:disabled) { opacity: 0.88; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--muted); background: var(--surface2); }

/* ===== LOBBY ===== */
#sec-lobby { align-items: flex-start; justify-content: center; padding: 2rem 1rem; }

.lobby-layout {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Top row: code on left, players+chat on right */
.lobby-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: start;
}

.lobby-code-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
}

.lobby-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  letter-spacing: 0.06em;
  color: var(--text);
  border-left: 4px solid var(--red);
  padding-left: 0.75rem;
}

.room-info-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 6px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 220px;
}

.room-code-big {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  letter-spacing: 0.25em;
  color: var(--gold);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: color 0.12s, text-shadow 0.12s;
}
.room-code-big:hover {
  color: #fff;
  text-shadow: 0 0 18px var(--gold);
}
.room-code-big:active { opacity: 0.7; }

.room-hint { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; }
.qr-image  { width: 150px; height: 150px; border: 2px solid var(--border); }
.room-url  { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); word-break: break-all; text-align: center; }

.copy-feedback {
  display: inline-block;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  animation: fade-in-out 2s ease forwards;
}
@keyframes fade-in-out {
  0%   { opacity: 0; transform: translateY(-4px); }
  15%  { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

.waiting-msg { color: var(--muted); font-size: 0.9rem; text-align: center; letter-spacing: 0.05em; }

/* ===== HOST CONFIG PANEL ===== */
.game-config {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.config-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  white-space: nowrap;
}

/* +/- rounds counter */
.rounds-ctrl {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.rounds-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: background 0.12s;
  line-height: 1;
}
.rounds-btn:hover { background: var(--surface2); }
.rounds-btn:active { background: var(--border); }
#playtime-val, #guesstime-val, #blur-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: var(--gold);
  min-width: 2.4rem;
  text-align: center;
  padding: 0 0.25rem;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  line-height: 2.2rem;
}

.config-unit {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 0.15rem;
}

/* Category multi-select toggle */
.cat-toggle {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.cat-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.cat-btn:hover { background: var(--surface2); color: var(--text); }
.cat-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Channel filter toggle */
.channel-toggle {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.channel-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  text-transform: capitalize;
  letter-spacing: 0.03em;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.channel-btn:hover { background: var(--surface2); color: var(--text); }
.channel-btn.active { background: var(--cyan); color: #000; border-color: var(--cyan); }

/* Video / Audio / Mix toggle */
.type-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.type-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.type-btn:last-child { border-right: none; }
.type-btn:hover { background: var(--surface2); color: var(--text); }
.type-btn.active { background: var(--red); color: #fff; }

.config-avail {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-align: right;
}

/* ===== FILTER PANEL ===== */
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.55rem 0.5rem;
  margin-bottom: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.filter-panel:empty { display: none; }

.fp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fp-title {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.fp-clear {
  background: none;
  border: none;
  color: var(--red);
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.03em;
}
.fp-clear:hover { text-decoration: underline; }

.fp-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.fp-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  min-width: 4.5rem;
  padding-top: 0.2rem;
  flex-shrink: 0;
}
.fp-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.fp-pill {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.fp-pill:hover { border-color: var(--text); color: var(--text); }
.fp-pill.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.fp-all {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--green);
  letter-spacing: 0.05em;
  padding: 0.15rem 0.1rem;
  align-self: center;
}
.fp-hint {
  font-size: 0.55rem;
  color: var(--muted);
  font-family: var(--font-ui);
  letter-spacing: 0.02em;
  font-weight: 400;
  text-transform: none;
}

/* ===== ROUND TYPE CONFIG LIST ===== */
.round-type-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
}
.round-type-list.two-col {
  grid-template-columns: repeat(2, 1fr);
}

/* --- Round config item (rci) --- */
.rci {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: opacity 0.15s, border-color 0.15s;
}
.rci.rci-off {
  opacity: 0.45;
}
.rci:not(.rci-off) {
  border-color: #3a3a3a;
}
.rci.rci-open:not(.rci-off) {
  border-color: var(--gold);
}

.rci-header {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.55rem;
  cursor: pointer;
  user-select: none;
}
.rci-header:hover .rci-name { color: var(--gold); }

.rci-identity {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.rci-name {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}
.rci-sub {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.03em;
  line-height: 1.3;
}

.rci-toggle {
  background: var(--border);
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.55rem;
  border-radius: 20px;
  cursor: pointer;
  min-width: 2.8rem;
  text-align: center;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.rci-toggle.on {
  background: var(--green);
  color: #000;
}
.rci-toggle:hover { opacity: 0.85; }

.rci-chevron {
  font-size: 0.7rem;
  color: var(--muted);
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.12s;
}
.rci-header:hover .rci-chevron { color: var(--text); }
.rci.rci-open .rci-chevron { color: var(--gold); }

/* Controls grid — shown only when round is enabled and expanded */
.rci-controls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 1px;
  border-top: 1px solid var(--border);
  background: var(--border);
}

.rci-ctrl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.4rem 0.5rem;
  background: var(--surface2);
}

.rci-ctrl-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  white-space: nowrap;
}

.rci-stepper {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.rci-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1rem;
  width: 1.9rem;
  height: 1.9rem;
  cursor: pointer;
  font-family: var(--font-mono);
  line-height: 1;
  transition: background 0.1s;
  flex-shrink: 0;
}
.rci-btn:hover:not(:disabled) { background: var(--surface2); }
.rci-btn:active:not(:disabled) { background: var(--border); }
.rci-btn:disabled { color: var(--muted); cursor: default; }

.rci-stepper-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--gold);
  min-width: 2.1rem;
  text-align: center;
  padding: 0 0.15rem;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  line-height: 1.9rem;
  white-space: nowrap;
}

.rci-unit {
  font-size: 0.62rem;
  color: var(--muted);
  margin-left: 0.1rem;
}

.players-heading {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}


.player-list { display: flex; flex-direction: column; gap: 0.4rem; }
.player-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.player-item.offline { opacity: 0.35; border-left-color: var(--border); }
.player-name { flex: 1; }
.kick-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  width: 1.6rem;
  height: 1.6rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.kick-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ===== LOBBY CHAT ===== */
.chat-heading { margin-top: 0.5rem; }
.chat-log {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  scroll-behavior: smooth;
}
.chat-msg {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  line-height: 1.3;
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
}
.chat-name {
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
}
.chat-text { color: var(--text); word-break: break-word; }
.chat-input-row {
  display: flex;
  gap: 0.4rem;
}
.chat-input-row input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 0.45rem 0.7rem;
}
.chat-input-row input:focus { outline: none; border-color: var(--gold); }

/* ===== GAME LAYOUT ===== */
#sec-game { align-items: flex-start; justify-content: center; padding: 0.5rem; position: relative; }

/* ===== ROUND INTRO OVERLAY ===== */
.round-intro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.round-intro-overlay.hidden { display: none; }

.round-intro-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
  padding: 2rem;
}
.round-intro-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.round-intro-label {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 8vw, 5rem);
  letter-spacing: 0.06em;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 60px rgba(245, 197, 24, 0.4);
}
.round-intro-qcount {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.round-intro-countdown {
  font-family: var(--font-display);
  font-size: clamp(4rem, 18vw, 10rem);
  color: #fff;
  line-height: 1;
  margin-top: 0.5rem;
  text-shadow:
    0 0 80px rgba(204, 0, 0, 0.8),
    0 0 24px rgba(204, 0, 0, 0.5);
  animation: count-pop 0.2s ease-out;
}

.game-layout {
  width: 100%;
  max-width: 1100px;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 0.75rem;
  align-items: start;
}
@media (max-width: 700px) {
  .game-layout { grid-template-columns: 1fr; }
}

.game-main { display: flex; flex-direction: column; gap: 0.6rem; }

.clip-counter {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ===== TV CABINET ===== */
/* Plastic body colour — dark warm charcoal, like a late-80s Sony/Philips */
:root {
  --tv-plastic: #1E1D1B;
  --tv-plastic-light: #2A2926;
  --tv-plastic-shadow: #111110;
  --tv-inset: #141312;
}

.tv-cabinet {
  display: flex;
  flex-direction: column;
  background: var(--tv-plastic);
  border-radius: 18px 18px 8px 8px;
  box-shadow:
    /* top highlight — light from above */
    inset 0 2px 0 rgba(255,255,255,0.09),
    inset 2px 0 0 rgba(255,255,255,0.04),
    inset -2px 0 0 rgba(0,0,0,0.35),
    inset 0 -3px 8px rgba(0,0,0,0.5),
    /* outer drop shadow */
    0 16px 48px rgba(0,0,0,0.85),
    0 4px 12px rgba(0,0,0,0.6);
}

.tv-top-strip {
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px 18px 0 0;
}
.tv-vent-holes {
  width: 40%;
  height: 4px;
  background: repeating-linear-gradient(
    to right,
    var(--tv-inset) 0px, var(--tv-inset) 3px,
    transparent 3px, transparent 6px
  );
  border-radius: 2px;
  opacity: 0.6;
}

.tv-mid-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}

/* ===== SIDE PANELS ===== */
.tv-side-panel {
  width: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
}

/* Speaker grille (left panel) */
.tv-speaker-grille {
  width: 24px;
  height: 80%;
  background: repeating-linear-gradient(
    to bottom,
    var(--tv-inset) 0px, var(--tv-inset) 2px,
    transparent 2px, transparent 5px
  );
  border-radius: 2px;
  opacity: 0.55;
  position: relative;
}
.tv-speaker-grille::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to right,
    transparent 0px, transparent 3px,
    rgba(0,0,0,0.3) 3px, rgba(0,0,0,0.3) 4px
  );
  border-radius: 2px;
}

/* Controls panel (right panel) */
.tv-controls-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.tv-led {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #001800;
  border: 1px solid #0a0a0a;
  box-shadow: 0 0 4px rgba(0,200,0,0.0);
}
/* LED glows when active — JS can toggle .tv-on on the cabinet */
.tv-cabinet.tv-on .tv-led {
  background: #00cc44;
  box-shadow: 0 0 6px rgba(0,200,60,0.8), 0 0 12px rgba(0,200,60,0.3);
}
.tv-dial {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #3A3835, #111);
  border: 1px solid #0a0a0a;
  box-shadow:
    0 2px 3px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.07);
  position: relative;
}
.tv-dial::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 1px;
}
.tv-button-row { display: flex; gap: 4px; }
.tv-btn-sm {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--tv-inset);
  border: 1px solid #0a0a0a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ===== MEDIA WRAPPER (THE SCREEN) ===== */
.media-wrapper {
  position: relative;
  flex: 1;
  background: #000;
  /* CRT screen corners — slightly rounded, more on x than y */
  border-radius: 10px / 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  /* Screen inset / bezel shadow */
  box-shadow:
    inset 0 0 0 2px #0a0a0a,
    inset 0 0 24px rgba(0,0,0,0.95),
    inset 0 0 4px rgba(0,0,0,0.8),
    0 0 0 3px rgba(0,0,0,0.6);
  /* Subtle phosphor bloom when active */
  filter: brightness(1.0) contrast(1.05);
}

.media-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Scanlines + vignette overlay */
.media-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    /* horizontal scanlines */
    repeating-linear-gradient(
      to bottom,
      transparent 0px, transparent 2px,
      rgba(0,0,0,0.10) 2px, rgba(0,0,0,0.10) 4px
    ),
    /* CRT vignette — edges darken */
    radial-gradient(
      ellipse 105% 105% at 50% 50%,
      transparent 42%,
      rgba(0,0,0,0.55) 100%
    );
  pointer-events: none;
  z-index: 20;
  border-radius: inherit;
}

/* Glass reflection sheen */
.media-wrapper::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 45%;
  background: linear-gradient(
    160deg,
    rgba(255,255,255,0.055) 0%,
    rgba(255,255,255,0.02) 40%,
    transparent 75%
  );
  pointer-events: none;
  z-index: 21;
  border-radius: inherit;
}

/* ===== TV BOTTOM STRIP ===== */
.tv-bottom-strip {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  gap: 12px;
  border-top: 1px solid var(--tv-plastic-shadow);
  background: var(--tv-inset);
}
.tv-brand-label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  color: #3A3835;
  flex: 1;
}
.tv-bottom-buttons { display: flex; gap: 6px; align-items: center; }
.tv-bb {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: #252320;
  border: 1px solid #0f0f0d;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.tv-bb-power {
  background: #1A1210;
  border-radius: 50%;
  width: 11px;
  height: 11px;
}

/* ===== TV STAND ===== */
.tv-stand {
  align-self: center;
  width: 30%;
  height: 10px;
  background: linear-gradient(to bottom, var(--tv-plastic-shadow), var(--tv-inset));
  border-radius: 0 0 6px 6px;
  position: relative;
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}
.tv-stand::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: -15%;
  right: -15%;
  height: 6px;
  background: var(--tv-inset);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.6);
}

/* ===== AUDIO PLAYER ===== */
.audio-player {
  position: absolute;
  inset: 0;
  background: #080808;
}

.audio-visualizer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.audio-reveal-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  animation: pop-in 0.25s ease-out;
}
.audio-reveal-img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
  border: 2px solid var(--border);
  box-shadow: 0 8px 48px rgba(0,0,0,0.8);
}
.audio-reveal-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 5vw, 2.6rem);
  letter-spacing: 0.08em;
  text-align: center;
  padding: 1rem;
}

/* ===== MEDIA CONTROLS ===== */
.media-controls {
  position: absolute;
  bottom: 0.6rem;
  right: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0,0,0,0.72);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  z-index: 10;
  transition: background 0.2s;
}
.media-controls:hover { background: rgba(0,0,0,0.92); }
.mute-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.volume-slider {
  width: 72px;
  height: 3px;
  accent-color: var(--gold);
  cursor: pointer;
  opacity: 0.8;
}
.volume-slider:hover { opacity: 1; }

/* ===== TELETEXT TIMER ===== */
.tv-timer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 22;               /* above scanlines */
  font-family: var(--font-mono);
  font-size: 1.05rem;
  line-height: 1;
  background: var(--red);
  color: #fff;
  padding: 0.28rem 0.6rem 0.32rem;
  border-radius: 0;          /* Teletext = hard rectangle, no softness */
  letter-spacing: 0.04em;
  pointer-events: none;
  user-select: none;
  /* Pixel-sharp rendering */
  -webkit-font-smoothing: none;
  image-rendering: pixelated;
  /* Right and bottom edges — inset shadow mimics Teletext block outline */
  box-shadow: 2px 2px 0 rgba(0,0,0,0.6);
}
.tv-timer.guessing {
  background: var(--gold);
  color: #000;
}
.tv-timer-s {
  font-size: 0.72em;
  opacity: 0.8;
  margin-left: 1px;
}
#tv-timer-mode {
  display: inline-block;
  width: 1.2em;
  text-align: center;
  opacity: 0.85;
}

/* Hard-cut blink when ≤ 3 s — classic Teletext flash, no fade */
@keyframes tt-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.tv-timer.urgent { animation: tt-blink 0.5s step-start infinite; }

/* ===== COUNTDOWN OVERLAY ===== */
.correct-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.78);
  z-index: 15;
  animation: correct-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.correct-check {
  font-size: min(18vw, 8rem);
  color: var(--green);
  line-height: 1;
  text-shadow: 0 0 40px rgba(0, 200, 80, 0.7);
  font-family: var(--font-display);
}
.correct-pts {
  font-family: var(--font-display);
  font-size: min(9vw, 3.5rem);
  color: var(--gold);
  letter-spacing: 0.08em;
  text-shadow: 0 0 20px rgba(245, 197, 24, 0.5);
}
.correct-wait {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 0.4rem;
}
@keyframes correct-pop {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10;
}
.countdown-number {
  font-family: var(--font-display);
  font-size: min(22vw, 11rem);
  color: #fff;
  text-shadow:
    0 0 80px rgba(204, 0, 0, 0.9),
    0 0 24px rgba(204, 0, 0, 0.6);
  animation: count-pop 0.2s ease-out;
  user-select: none;
  line-height: 1;
}
@keyframes count-pop {
  from { transform: scale(1.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ===== ANSWERED BAR ===== */
.answered-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.4rem;
}
.answered-chip {
  background: var(--green);
  color: #000;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
}

/* ===== ANSWER AREA ===== */
.answer-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.answer-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
}
.answer-status.hidden { display: none; }
.answer-status.correct    { background: rgba(0,154,68,0.18);  color: var(--green); border-left: 3px solid var(--green); }
.answer-status.locked     { background: rgba(204,0,0,0.15);   color: var(--red);   border-left: 3px solid var(--red); }
.answer-status.spectating { background: rgba(255,255,255,0.05); color: var(--muted); border-left: 3px solid var(--muted); }
.status-icon { font-size: 1rem; }

.input-row { display: flex; gap: 0.5rem; }
.input-row input {
  flex: 1;
  font-size: 1.1rem;
  padding: 0.8rem 1rem;
}
.input-row .btn { padding: 0.8rem 1.4rem; white-space: nowrap; }

.attempts-row { display: flex; align-items: center; gap: 0.6rem; }
.attempts-pips { display: flex; gap: 5px; }
.pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  transition: background 0.15s;
}
.pip.used { background: var(--border); }

/* ===== GUESS BANNER ===== */
.guess-banner {
  background: rgba(245, 197, 24, 0.1);
  border: 1px solid rgba(245, 197, 24, 0.35);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}
.guess-timer-num {
  font-variant-numeric: tabular-nums;
  color: #fff;
}

/* ===== WRONG FLASH ===== */
.wrong-flash {
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  animation: flash-in 0.25s ease-out;
}
.wrong-flash.hidden { display: none; }
@keyframes flash-in {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}

/* ===== REVEAL PANEL ===== */
.reveal-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.reveal-panel.hidden { display: none; }

@keyframes pop-in {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.reveal-answer-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.reveal-answer {
  font-family: var(--font-display);
  font-size: 2.8rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  line-height: 1;
}

.reveal-scores { display: flex; flex-direction: column; gap: 0.35rem; }
.reveal-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}
.reveal-score-row:last-child { border-bottom: none; }
.reveal-score-row .name { font-weight: 600; color: var(--text); }
.reveal-score-row .pts  { color: var(--gold); font-family: var(--font-mono); font-weight: 700; }

/* Reveal metadata tags */
.reveal-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0.3rem 0 0.6rem;
}
.reveal-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.tag-year    { color: var(--gold);  border-color: var(--gold); }
.tag-origin  { color: var(--muted); border-color: var(--border); }
.tag-network { color: var(--cyan);  border-color: var(--cyan); }
.tag-genre   { color: var(--green); border-color: var(--green); }
.tag-channel { color: var(--blue);  border-color: var(--blue); }

.reveal-wiki {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}
.reveal-wiki-text {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
}
.reveal-waiting {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-align: center;
}

/* ===== SCOREBOARD ===== */
.game-aside {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 0.5rem;
}
.game-aside::before {
  content: '';
  display: block;
  height: 6px;
  background: var(--color-bar);
}
.aside-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.scoreboard-list { display: flex; flex-direction: column; }
.btn-end-lobby {
  margin-top: auto;
  width: 100%;
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  opacity: 0.7;
  margin-top: 1rem;
}
.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.score-row:last-child { border-bottom: none; }
.score-row .rank  { color: var(--muted); font-size: 0.8rem; min-width: 1.4rem; }
.score-row .sname { flex: 1; padding: 0 0.5rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-row .pts   { font-family: var(--font-mono); color: var(--gold); font-weight: 700; font-size: 0.9rem; }
.score-row.me { background: rgba(204, 0, 0, 0.1); border-left: 2px solid var(--red); }

/* ===== GAME END ===== */
#sec-end { align-items: center; justify-content: center; }
.end-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  max-width: 460px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.trophy    { font-size: 3.5rem; text-align: center; padding: 1.5rem 2rem 0.5rem; }
.end-title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 0 2rem 1rem;
  border-bottom: 1px solid var(--border);
}
.end-scores {
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}
.end-score-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.end-score-row:last-child { border-bottom: none; }
.end-score-row:first-child { background: rgba(245, 197, 24, 0.08); }
.end-score-row .place { font-size: 1.2rem; min-width: 2rem; text-align: center; }
.end-score-row .name  { flex: 1; font-weight: 700; font-size: 1rem; }
.end-score-row .pts   { font-family: var(--font-mono); color: var(--gold); font-weight: 700; font-size: 1rem; }
.end-card .btn { margin: 1rem 1.5rem 1.5rem; }

/* ===== SHAKE ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.shake { animation: shake 0.38s ease-out; }

/* ===== ACTOR REVEAL ===== */
.actor-reveal-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: #000;
  padding: 0.75rem;
  overflow: hidden;
  z-index: 5;
}

.actor-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
}

.actor-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: clamp(90px, 18%, 130px);
  animation: actor-in 0.4s ease-out;
}

.actor-card.actor-card-new {
  animation: actor-in-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes actor-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes actor-in-pop {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

.actor-card-photo {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  object-position: top center;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  display: block;
}

.actor-card-photo-none {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--muted);
  width: 100%;
  aspect-ratio: 2/3;
}

.actor-card-name {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  line-height: 1.2;
  max-width: 100%;
}

.actor-card-pts {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--gold);
  text-align: center;
}

.actor-timers {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex-shrink: 0;
}

.actor-timer-next,
.actor-timer-total {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.6rem;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: border-color 0.2s, color 0.2s;
}

.actor-timer-next.urgent,
.actor-timer-total.urgent {
  border-color: var(--red);
  color: var(--red);
}

.actor-timer-val {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text);
  min-width: 1.5ch;
  text-align: right;
  transition: color 0.2s;
}

.actor-timer-next.urgent .actor-timer-val,
.actor-timer-total.urgent .actor-timer-val {
  color: var(--red);
}

.actor-timer-s {
  font-size: 0.65rem;
  color: var(--muted);
}

.actor-timer-label {
  white-space: nowrap;
}

.actor-points-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--gold);
  color: #000;
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  z-index: 10;
  white-space: nowrap;
}

.actor-points-label {
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Actor reveal config row visibility handled by JS (shows when actor round enabled) */
#actor-reveal-config-row { display: none; }

/* ===== UTIL ===== */
.hidden { display: none !important; }
