/* Royal Boudoir Theme (Variant 1 — cuckplay.ru) — 100dvh zero-scroll, burgundy velvet & antique gold */
:root {
  color-scheme: dark;
  --bg: #0f080c;
  --s1: #180e13;
  --s2: #24161e;
  --hover: #331f2a;
  --bd: rgba(212, 175, 55, 0.24);
  --bd-soft: rgba(212, 175, 55, 0.38);
  --text: #f7efe5;
  --dim: #b79fa8;
  --gold: #d4af37;
  --gold-bright: #f2d580;
  --acc: #cfa142;
  --acc-hover: #e3b859;
  --live: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --r-card: 14px;
  --r-sm: 8px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse 75% 65% at 38% 48%, rgba(112, 24, 48, 0.26), transparent 70%),
    radial-gradient(ellipse 45% 55% at 88% 82%, rgba(176, 108, 36, 0.16), transparent 68%),
    var(--bg);
  color: var(--text);
  font: 13px/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
[hidden] { display: none !important; }
a { color: var(--gold-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { outline-offset: 2px; }
:focus-visible { outline: 2px solid var(--gold); }

input, button, select {
  font: inherit;
  color: inherit;
  background: var(--s2);
  border: 1px solid var(--bd-soft);
  border-radius: var(--r-sm);
  padding: 6px 11px;
}
button { cursor: pointer; white-space: nowrap; transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease; }
button:hover:not(:disabled) { background: var(--hover); border-color: rgba(242, 213, 128, 0.55); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary, .btn-link.primary {
  background: linear-gradient(180deg, #e9c76e 0%, #c89435 55%, #a87520 100%);
  border-color: #f3d789;
  color: #1c0f06;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(255, 244, 210, 0.45) inset, 0 4px 14px rgba(0, 0, 0, 0.45);
}
button.primary:hover:not(:disabled), .btn-link.primary:hover {
  background: linear-gradient(180deg, #f3d582 0%, #d8a340 55%, #b88227 100%);
  border-color: #fbe4a4;
  text-decoration: none;
}
button.danger { color: #f87171; border-color: rgba(239, 68, 68, 0.4); background: transparent; }
button.danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.14); }
.ghost-btn { background: transparent; border-color: transparent; color: var(--dim); padding: 4px 8px; }
.ghost-btn:hover { background: var(--hover); color: var(--text); }
.btn-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--bd-soft);
  background: var(--s2);
  color: var(--text);
  font-size: 12px;
}
.error { color: #f87171; font-size: 12px; min-height: 1.2em; margin: 2px 0 0; }
.dim { color: var(--dim); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* /admin login */
#login { display: grid; place-items: center; height: 100dvh; padding: 20px; background: var(--bg); }
#login form {
  width: 100%;
  max-width: 340px;
  display: grid;
  gap: 12px;
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: var(--r-card);
  padding: 24px;
}
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand img { display: block; object-fit: contain; }
#login h1 { margin: 0; font: 700 20px/1.1 Georgia, "Palatino Linotype", "Times New Roman", serif; color: var(--gold-bright); letter-spacing: 0.01em; }
.login-back { font-size: 12px; color: var(--dim); text-align: center; }

/* App container: strict 100dvh flex column */
#app { display: none; flex-direction: column; height: 100dvh; overflow: hidden; }

/* Full-width 54px Royal Boudoir Top Header */
#bar {
  flex: none;
  height: 54px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 22px;
  background: linear-gradient(180deg, #1d1016 0%, #140b10 100%);
  border-bottom: 1px solid rgba(212, 175, 55, 0.32);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 20;
}
.bar-left, .bar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 700 21px/1 Georgia, "Palatino Linotype", "Times New Roman", serif;
  letter-spacing: 0.015em;
  white-space: nowrap;
  color: var(--gold-bright);
  text-shadow: 0 1px 10px rgba(212, 175, 55, 0.25);
}
.brand:hover { text-decoration: none; color: #fae3a2; }
.brand img { display: block; width: 28px; height: 26px; object-fit: contain; filter: drop-shadow(0 1px 5px rgba(212, 175, 55, 0.35)); }

/* Variant 1 Studio / Viewer mode segmented switch */
.mode-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 10px;
}
.mode-switch-btn {
  padding: 5px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
}
.mode-switch-btn.active {
  background: linear-gradient(180deg, #e7c46a 0%, #c18d30 100%);
  color: #1c0f06;
  font-weight: 700;
}
.bar-sep { width: 1px; height: 16px; background: rgba(212, 175, 55, 0.28); flex: none; }
.live-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); white-space: nowrap; }
.live-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.7); display: block; }
.bar-meta { font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
#status { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 26vw; }
#playLoginBtn, #adminPlayBtn { border-radius: 999px; padding: 7px 20px; font-size: 13px; letter-spacing: 0.01em; }
.timer-chip {
  font: 600 12px/1 ui-monospace, monospace;
  color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.42);
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}

/* Admin Settings Ribbon */
#adminPanel {
  flex: none;
  width: calc(100% - 32px);
  margin: 12px 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}
#adminPanel select, #adminPanel input, #adminPanel button { padding: 5px 9px; font-size: 12px; }
.ribbon-label { color: var(--dim); font-weight: 600; }
.ribbon-check { display: inline-flex; align-items: center; gap: 5px; color: var(--text); white-space: nowrap; font-size: 12px; }
.ribbon-check input { padding: 0; accent-color: var(--acc); }
.ribbon-range { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-size: 12px; }
.ribbon-range input { width: 64px; padding: 0; border: 0; background: transparent; accent-color: var(--acc); }
.ribbon-spectator { display: inline-flex; align-items: center; gap: 6px; }
#spectatorChannel { width: 150px; }
.ribbon-spacer { flex: 1; }
#stats { font: 11px ui-monospace, monospace; color: var(--dim); white-space: nowrap; }

/* MAIN ROOM: Variant 3 — Grand Canopy Bed Stage + Non-Overlapping Foreground Lounge */
#roomLayout {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 8px 16px 8px 12px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
}

body.studio-mode .canopy-post,
body.studio-mode .canopy-valance,
body.studio-mode .canopy-foreground-floor,
body.studio-mode .canopy-plaque {
  display: none !important;
}

.stage-column {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  justify-content: flex-start;
}
body.studio-mode .stage-column {
  gap: 12px;
  align-items: flex-start;
  justify-content: flex-start;
}

/* Four-Poster Canopy Bed Wrapper: maximizes 16:9 screen across almost all available width & height */
.canopy-stage {
  position: relative;
  flex: none;
  width: min(100%, calc((100dvh - 160px) * 16 / 9));
  max-width: 100%;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
body.studio-mode .canopy-stage {
  width: 100%;
  padding: 0;
}
.canopy-valance {
  position: relative;
  z-index: 6;
  width: calc(100% + 12px);
  margin-left: -6px;
  height: clamp(64px, 9.5vh, 106px);
  object-fit: fill;
  display: block;
  pointer-events: none;
  user-select: none;
  margin-bottom: -16px;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.85));
}
.canopy-post {
  position: absolute;
  top: -8px;
  bottom: -10px;
  height: calc(100% + 18px);
  width: 44px;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  z-index: 5;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.88));
}
.canopy-post-left { left: -4px; }
.canopy-post-right { right: -4px; transform: scaleX(-1); }

/* Dedicated bottom-left foreground floor zone — fills ONLY leftover space below the bed, NEVER overlaps video */
.canopy-foreground-floor {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  position: relative;
  pointer-events: none;
  user-select: none;
  z-index: 6;
  overflow: visible;
}
.canopy-table-left {
  position: absolute;
  left: -12px;
  bottom: -12px;
  height: calc(100% + 4px);
  max-height: 165px;
  width: auto;
  object-fit: contain;
  object-position: bottom left;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.9));
}
@media (max-height: 750px), (max-width: 960px) {
  .canopy-foreground-floor { display: none; }
}

/* Sleek 1.5px brushed antique-gold bed frame around the massive unobstructed 16:9 stream */
#playerCard {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #211116 0%, #140a0e 100%);
  border: 1.5px solid rgba(212, 175, 55, 0.72);
  border-radius: 6px;
  padding: 4px 4px 0;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(245, 220, 148, 0.18) inset,
    0 20px 54px rgba(0, 0, 0, 0.85),
    0 0 42px rgba(120, 24, 52, 0.22);
}
body.studio-mode #playerCard {
  border-width: 1px;
  border-color: var(--bd);
  border-radius: var(--r-card);
  padding: 10px 10px 0;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

/* Studio Director Strip inside #playerCard */
.studio-director-strip {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px;
  border-top: 1px solid var(--bd);
  flex-wrap: wrap;
}
.studio-stream-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.studio-quick-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.studio-quick-actions button { padding: 6px 12px; font-size: 12px; }
.studio-quick-actions button.is-paused { background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.5); color: #fcd34d; }

/* Studio Bottom Dock: Queue + Quick MemAlerts Test Pills */
.studio-bottom-dock {
  width: 100%;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 16px;
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: var(--r-card);
  flex-wrap: wrap;
}
.studio-dock-queue { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.studio-dock-player-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.studio-dock-player-row strong { font-size: 13px; }
.compact-btn { padding: 3px 8px !important; font-size: 11px !important; }
.studio-dock-memes {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--bd);
  flex-wrap: wrap;
}
.studio-quick-memes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.studio-quick-pill {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--s2);
  border: 1px solid var(--bd-soft);
}
.studio-quick-pill:hover { border-color: var(--acc); background: var(--hover); }

/* Studio 4-Tab Right Inspector (Variant 1) */
.studio-inspector {
  flex: none;
  width: min(440px, 40vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: var(--r-card);
}
.inspector-tabs {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--bd);
}
.inspector-tab {
  padding: 7px 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.inspector-tab:hover { color: var(--text); background: var(--s2); }
.inspector-tab.active {
  background: linear-gradient(180deg, #e7c46a 0%, #c18d30 100%);
  color: #1c0f06;
  border-color: #f3d789;
  font-weight: 700;
}
.inspector-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  overflow-y: auto;
}
.inspector-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin: 0 -14px;
}
.inspector-scroll table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; font-size: 12px; }
.inspector-scroll th, .inspector-scroll td { padding: 7px 14px; border-bottom: 1px solid rgba(38, 39, 46, 0.8); vertical-align: middle; }
.inspector-scroll th { position: sticky; top: 0; background: var(--s1); font-weight: 600; color: var(--dim); font-size: 11px; }
.inspector-scroll .num { text-align: right; }
.inspector-scroll .agent { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }

.studio-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 10px;
  font-size: 12px;
}
.studio-form .span-2 { grid-column: span 2; }
.studio-form label:not(.studio-toggle-row) { display: flex; flex-direction: column; gap: 4px; color: var(--dim); font-size: 11px; }
.studio-form input, .studio-form select { width: 100%; font-size: 12px; }
.studio-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.studio-divider::after { content: ""; flex: 1; height: 1px; background: var(--bd); }
.studio-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  background: var(--s2);
  border: 1px solid var(--bd);
  border-radius: 10px;
  cursor: pointer;
}
.studio-toggle-row span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.studio-toggle-row strong { font-size: 12px; color: var(--text); font-weight: 600; }
.studio-toggle-row small { font-size: 11px; }
.studio-toggle-row input[type="checkbox"] { width: 17px; height: 17px; flex: none; accent-color: var(--acc); padding: 0; }
.studio-stream-footer {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 8px;
  padding-top: 4px;
}
.studio-stream-footer button { padding: 9px 12px; font-size: 13px; font-weight: 600; }
.studio-issue-form { display: flex; gap: 6px; }
.studio-issue-form input[name="label"] { flex: 1; min-width: 0; }
.studio-issue-form input[name="minutes"] { width: 64px; font-family: ui-monospace, monospace; }
.subtab-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--bd); }
.studio-memes-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.studio-diag-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.studio-diag-grid button { font-size: 12px; padding: 7px 10px; }
#stage {
  width: 100%;
  min-height: 0;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  background: #060709;
  border-radius: 10px;
}
#screen, #nativeVideo, #spectatorStage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
canvas, #nativeVideo { display: block; object-fit: contain; background: #000; }
#stage.native #screen { opacity: 0; }
#stage.native #nativeVideo { pointer-events: none; }

#spectatorStage { z-index: 5; background: #0b0c10; }
.spectator-frame { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.spectator-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  gap: 8px;
}
.spectator-pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 999px;
  padding: 3px 10px;
}
.spectator-placeholder strong { font-size: 17px; }
.spectator-placeholder p { margin: 0; max-width: 440px; color: var(--dim); font-size: 13px; }

#noSignal {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  color: var(--dim);
  font-size: 13px;
  pointer-events: none;
}
#noSignal.blocked { background: #000; }

/* MemAlerts Overlay (bottom-left default; bottom-right for GTA VI Lucia quest) */
#memAlertOverlay {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 20;
  pointer-events: none;
  user-select: none;
}
#memAlertOverlay.lucia-pos {
  left: auto;
  right: 18px;
  bottom: 18px;
}

/* Pixel-accurate GTA VI Lucia Objective Popup */
.lucia-quest-card {
  width: min(392px, calc(100vw - 32px));
  border-radius: 0;
  border: 1.5px solid #090d1b;
  background: linear-gradient(
    122deg,
    rgba(35, 34, 68, 0.96) 0%,
    rgba(35, 34, 68, 0.96) 62%,
    rgba(17, 36, 86, 0.96) 62.25%,
    rgba(17, 36, 86, 0.96) 100%
  );
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  overflow: hidden;
  animation: luciaSlideIn 340ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.lucia-quest-card.lucia-preview-card {
  width: 100%;
  animation: none;
}
.lucia-quest-card.leaving {
  animation: luciaSlideOut 300ms cubic-bezier(0.4, 0, 1, 1) forwards;
}
.lucia-top-bar {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, #ff1fa9 0%, #e41ec4 100%);
  box-shadow: 0 1px 10px rgba(255, 31, 169, 0.55);
}
.lucia-inner {
  padding: 13px 16px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.lucia-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.lucia-avatar {
  width: 42px;
  height: 42px;
  flex: none;
  object-fit: cover;
  display: block;
  background: #d426a7;
  border: 1.5px solid #f048c6;
  border-radius: 0;
}
.lucia-title {
  font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Impact, sans-serif;
  font-weight: 800;
  font-size: 26px;
  line-height: 1.04;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.lucia-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 16px;
  line-height: 1.25;
  color: #eef1f8;
  font-weight: 500;
}
.lucia-plus {
  color: #ec28a7;
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
}
.lucia-heart {
  width: 16px;
  height: 16px;
  fill: #ee2ba8;
  flex: none;
  margin-right: 3px;
}
.lucia-desc {
  margin: 0;
  font-size: 16px;
  line-height: 1.38;
  color: #f0f3fa;
  font-weight: 400;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.lucia-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 15px;
  line-height: 1.34;
  color: #f0f3fa;
  min-width: 0;
}
.lucia-list li {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.lucia-list li::marker {
  color: #ee2ba8;
}

@keyframes luciaSlideIn {
  0% { opacity: 0; transform: translateX(48px) scale(0.97); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes luciaSlideOut {
  0% { opacity: 1; transform: translateX(0) scale(1); }
  100% { opacity: 0; transform: translateX(48px) scale(0.98); }
}

.meme-tile-lucia {
  grid-column: 1 / -1;
  flex-direction: row !important;
  justify-content: center;
  gap: 9px !important;
  min-height: 40px !important;
  padding: 7px 14px !important;
  border-radius: 999px !important;
  border-color: rgba(255, 31, 169, 0.72) !important;
  background: linear-gradient(90deg, rgba(84, 18, 66, 0.92) 0%, rgba(164, 24, 118, 0.72) 50%, rgba(44, 22, 84, 0.92) 100%) !important;
  box-shadow: 0 0 18px rgba(255, 31, 169, 0.28);
}
.meme-tile-lucia .meme-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #ff64c8;
}
.meme-tile-lucia .meme-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.meme-tile-lucia:hover:not(:disabled) {
  border-color: #ff64c8 !important;
  box-shadow: 0 0 24px rgba(255, 31, 169, 0.48);
}
.lucia-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.lucia-form > * { min-width: 0; max-width: 100%; }
.lucia-form label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; font-size: 12px; color: var(--dim); }
.lucia-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lucia-counter { font: 11px ui-monospace, monospace; color: var(--dim); white-space: nowrap; }
.lucia-form input, .lucia-form textarea { width: 100%; min-width: 0; max-width: 100%; }
.lucia-form textarea {
  font: inherit;
  color: var(--text);
  background: var(--s2);
  border: 1px solid var(--bd-soft);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  resize: vertical;
  min-height: 76px;
}
.lucia-preview-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; max-width: 100%; }
#luciaPreview { width: 100%; min-width: 0; max-width: 100%; overflow: hidden; }
.lucia-quest-card.lucia-preview-card { width: 100%; max-width: 100%; animation: none; }
.lucia-preview-label { font-size: 11px; color: var(--dim); }
.lucia-title.is-empty,
.lucia-desc.is-empty {
  opacity: 0.36;
}
.lucia-send-btn { background: #d91c99 !important; border-color: #ff1fa9 !important; color: #fff !important; }
.lucia-send-btn:hover:not(:disabled) { background: #ec28a7 !important; color: #fff !important; }
.mem-alert-card {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 350px;
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(16, 17, 22, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  animation: memPop 180ms ease-out;
}
@keyframes memPop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.mem-alert-badge { font-size: 24px; line-height: 1; flex: none; }
.mem-alert-media { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; flex: none; background: #000; }
.mem-alert-body { min-width: 0; }
.mem-alert-body strong { display: block; font-size: 13px; color: #fff; }
.mem-alert-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 11px; color: var(--dim); }
.mem-alert-eq { display: inline-flex; align-items: end; gap: 2px; height: 10px; }
.mem-alert-eq i { display: block; width: 2px; height: 4px; background: var(--acc); animation: eqBounce 0.55s ease-in-out infinite; }
@keyframes eqBounce { 0%, 100% { height: 3px; } 50% { height: 10px; } }

/* Stats, Keys, and Gamepad overlays */
#statsPanel {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 12;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  overflow: auto;
  margin: 0;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 14px;
  background: rgba(16, 17, 22, 0.92);
  border: 1px solid var(--bd-soft);
  border-radius: 10px;
  font-size: 12px;
  pointer-events: none;
}
#statsPanel dt { color: var(--dim); }
#statsPanel dd { margin: 0; font: 11px ui-monospace, monospace; color: #fff; }

#keys, #gamepadPanel {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 16;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  overflow: auto;
  padding: 14px 16px;
  background: rgba(18, 19, 25, 0.96);
  border: 1px solid var(--bd-soft);
  border-radius: 12px;
  font-size: 12px;
}
#gamepadPanel { width: min(360px, calc(100% - 24px)); }
.help-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.help-heading h2 { font-size: 14px; margin: 0; }
#closeKeys, #closeGamepadPanel { padding: 3px; background: transparent; border: 0; }
#closeKeys img, #closeGamepadPanel img { width: 14px; height: 14px; filter: invert(1); display: block; }
#keys dl { display: grid; grid-template-columns: repeat(3, auto); gap: 6px 14px; margin: 0; }
.bindings > div { display: flex; align-items: center; gap: 5px; }
#keys dd { margin: 0; color: var(--dim); }
kbd { display: inline-block; padding: 2px 6px; background: var(--s2); border: 1px solid var(--bd-soft); border-radius: 4px; color: #fff; font: 600 11px/1.3 system-ui, sans-serif; }
#allKeys summary { cursor: pointer; font-size: 11px; color: #a78bfa; padding-top: 8px; width: fit-content; }
#allKeys[open] summary { margin-bottom: 8px; }
#keys p { margin: 8px 0 0; color: var(--dim); font-size: 11px; }

.gp-status { margin: 0 0 10px; color: var(--text); line-height: 1.4; }
.gp-row { display: grid; gap: 4px; margin-bottom: 10px; }
.gp-row label { font-size: 11px; color: var(--dim); }
.gp-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.gp-actions button { font-size: 12px; padding: 6px 10px; }
.gp-hint { margin: 0; font-size: 11px; color: var(--dim); line-height: 1.35; }
.gp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--live); display: block; flex: none; }

/* Integrated 42px Carved Footboard Player Controls Bar */
.player-tools {
  flex: none;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 8px;
  background: linear-gradient(180deg, #271419 0%, #160a0e 100%);
  border-top: 1px solid rgba(212, 175, 55, 0.28);
}
.tools-left, .tools-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tools-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.canopy-plaque {
  display: inline-flex;
  align-items: center;
  padding: 4px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.22) 0%, rgba(128, 86, 24, 0.26) 100%);
  border: 1px solid rgba(212, 175, 55, 0.52);
  font: 700 11px/1.1 Georgia, "Palatino Linotype", "Times New Roman", serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  box-shadow: 0 1px 0 rgba(255, 240, 190, 0.2) inset;
}
.vol-group, .sens-group { display: flex; align-items: center; gap: 8px; }
.sens-group { padding-left: 12px; border-left: 1px solid var(--bd); }
.vol-group input[type="range"], .sens-group input[type="range"] {
  width: 104px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  accent-color: var(--acc);
}
.vol-group output, .sens-group output {
  font: 12px ui-monospace, monospace;
  color: var(--dim);
  min-width: 3.5ch;
}
.mini-icon { width: 16px; height: 16px; filter: invert(0.8); display: block; }
.mode-label { font-size: 12px; color: var(--dim); padding-right: 4px; }
.tool-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 12px;
  border-radius: var(--r-sm);
}
.tool-icon-btn:hover { background: var(--hover); color: var(--text); }
.tool-icon-btn[aria-expanded="true"] { background: var(--acc); color: #fff; }
.tool-icon-btn img { width: 16px; height: 16px; filter: invert(0.85); display: block; }

/* Fullscreen: true edge-to-edge 100% video + floating auto-hide bottom bar */
#playerCard:fullscreen,
#playerCard:-webkit-full-screen {
  position: relative;
  width: 100%;
  max-width: none;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #000;
}
#playerCard:fullscreen #stage,
#playerCard:-webkit-full-screen #stage {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  max-height: none;
  border-radius: 0;
}
#playerCard:fullscreen .player-tools,
#playerCard:-webkit-full-screen .player-tools {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 0 16px;
  background: rgba(12, 13, 18, 0.84);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
#playerCard:fullscreen .player-tools:hover,
#playerCard:fullscreen .player-tools:focus-within,
#playerCard:-webkit-full-screen .player-tools:hover,
#playerCard:-webkit-full-screen .player-tools:focus-within {
  opacity: 1;
}

/* Right 340px Sidebar: Top-Right Glass Panel + BIG Foreground Aristocrat Below */
#queueCard {
  position: relative;
  z-index: 5;
  flex: none;
  width: 340px;
  height: 100%;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: transparent;
  min-height: 0;
}

/* TOP PANEL: Tabbed [Очередь | Мемы] Glassmorphic Card */
.club-tabs-card {
  flex: 0 1 52%;
  min-height: 240px;
  max-height: 54%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(30, 16, 23, 0.94) 0%, rgba(19, 10, 15, 0.97) 100%);
  border: 1px solid rgba(212, 175, 55, 0.42);
  border-radius: var(--r-card);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
  overflow: hidden;
  position: relative;
  z-index: 6;
}

/* BOTTOM FOREGROUND ZONE: BIG Full-Body Aristocrat in Chesterfield Armchair */
.canopy-aristocrat-fg {
  flex: 1 1 48%;
  min-height: 210px;
  margin: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  user-select: none;
  overflow: visible;
  background: radial-gradient(circle at 55% 65%, rgba(178, 76, 42, 0.24), rgba(18, 9, 13, 0) 72%);
}
.canopy-aristocrat-img {
  display: block;
  height: calc(100% + 20px);
  max-height: 440px;
  width: auto;
  max-width: 112%;
  object-fit: contain;
  object-position: bottom center;
  margin-bottom: -10px;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.88));
}
.canopy-observer-tag {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(18, 9, 14, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.56);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.78);
  font: 600 11.5px/1.1 Georgia, "Palatino Linotype", "Times New Roman", serif;
  color: var(--gold-bright);
  white-space: nowrap;
}
.canopy-tag-sep { opacity: 0.55; }
.club-tab-bar {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid rgba(212, 175, 55, 0.24);
  background: rgba(12, 6, 9, 0.55);
}
.club-tab {
  padding: 11px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--dim);
  font: 600 13px/1 Inter, -apple-system, sans-serif;
  letter-spacing: 0.015em;
  border-bottom: 2px solid transparent;
}
.club-tab:hover {
  color: var(--text);
  background: rgba(212, 175, 55, 0.08);
}
.club-tab.active {
  color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(108, 22, 48, 0.45) 0%, rgba(74, 15, 34, 0.25) 100%);
  border-bottom-color: var(--gold-bright);
}
.club-tab-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Queue Tab Contents */
.rail-queue {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}
.rail-block { padding: 12px 16px; border-bottom: 1px solid rgba(212, 175, 55, 0.16); }
.rail-waiting { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-bottom: 0; }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rail-kicker {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-bright);
}
#liveDot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); display: block; }
.rail-timer, .rail-count { font: 600 12px ui-monospace, monospace; color: var(--dim); }

.current-player, .queue-person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(212, 175, 55, 0.16);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--gold-bright);
  font-size: 11px;
  font-weight: 700;
}
.queue-person strong { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-person small { color: var(--gold-bright); font-size: 12px; margin-left: 4px; }
.queue-person > div { display: flex; align-items: baseline; gap: 4px; min-width: 0; }

#waitingPlayers {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: seat;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#waitingPlayers:empty { flex: 0; }
#waitingPlayers li {
  counter-increment: seat;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 8px;
}
#waitingPlayers li:first-child { background: rgba(212, 175, 55, 0.12); }
#waitingPlayers li::before { content: counter(seat) "."; min-width: 1.5ch; font: 12px ui-monospace, monospace; color: var(--dim); }
#waitingPlayers [aria-current="true"] strong { color: var(--gold-bright); }
#emptyQueue { margin: 2px 0 0; font-size: 12px; color: var(--dim); }
.leave-btn { margin-top: 8px; align-self: flex-start; font-size: 12px; padding: 5px 10px; }

/* Pinned Lucia Quick CTA at bottom of Queue tab */
.club-lucia-footer {
  flex: none;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(212, 175, 55, 0.16);
}
.club-lucia-cta {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 31, 169, 0.65);
  background: linear-gradient(90deg, rgba(88, 18, 66, 0.94) 0%, rgba(154, 24, 112, 0.78) 55%, rgba(44, 22, 84, 0.94) 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(255, 31, 169, 0.25);
}
.club-lucia-cta:hover {
  border-color: #ff64c8;
  background: linear-gradient(90deg, rgba(112, 22, 82, 0.98) 0%, rgba(182, 28, 132, 0.88) 55%, rgba(56, 26, 102, 0.98) 100%);
  box-shadow: 0 4px 24px rgba(255, 31, 169, 0.45);
}
.club-lucia-cta img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #ff64c8;
  flex: none;
}
.club-lucia-cta span:nth-child(2) { flex: 1; text-align: left; }
.club-lucia-arrow { font-size: 18px; line-height: 1; color: #ff8cd7; }

/* Memes Tab Contents */
.rail-memes {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.rail-memes-title { margin: 0; font-size: 14px; font-weight: 700; color: var(--gold-bright); }
.cd-tag {
  font: 600 11px ui-monospace, monospace;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--s2);
  color: var(--dim);
}
.cd-tag[data-state="ready"] { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
.cd-tag[data-state="cooldown"] { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.cd-tag[data-state="off"] { background: rgba(239, 68, 68, 0.16); color: #f87171; }

.sender-field { display: grid; gap: 5px; margin-bottom: 10px; }
.sender-field span { font-size: 11px; color: var(--dim); }
.sender-field input { width: 100%; padding: 7px 10px; font-size: 12px; background: rgba(12, 6, 9, 0.72); border-radius: var(--r-sm); }

.mem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.meme-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 6px;
  background: rgba(36, 21, 29, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.26);
  border-radius: 10px;
  min-height: 66px;
}
.meme-tile:hover:not(:disabled) { border-color: var(--gold-bright); background: var(--hover); }
.meme-emoji { font-size: 21px; line-height: 1; }
.meme-thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
.meme-title { font-size: 11px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meme-cd { display: none; }
.mem-status { margin: 7px 0 0; min-height: 1.1em; font-size: 11px; color: var(--dim); }
.alerts-empty { margin: 0; font-size: 12px; color: var(--dim); grid-column: 1 / -1; }

/* Modals (Password + Add Alert) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 370px;
  background: var(--s1);
  border: 1px solid var(--bd-soft);
  border-radius: var(--r-card);
  padding: 18px 20px;
}
.modal-wide { max-width: 490px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.modal-desc { margin: 0 0 12px; font-size: 12px; color: var(--dim); line-height: 1.45; }
#spectatorLoginForm { display: grid; gap: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.modal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-form-grid label { display: grid; gap: 4px; font-size: 11px; color: var(--dim); }
.modal-form-grid .span-2 { grid-column: 1 / -1; }
.upload-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.upload-row input[type="file"] { font-size: 11px; padding: 4px; max-width: 170px; }

/* ADMIN 100dvh AIRY ROUNDED WORKSPACE */
#managementTitle, #playerLink { display: none; }
.management #managementTitle { display: block; margin: 0; font-size: 16px; font-weight: 700; }
.management #playerLink { display: inline-flex; border-radius: 999px; padding: 6px 14px; }
.management #adminHeaderMeta { display: inline !important; }
.management #roomLayout, .management .brand span, .management #liveBadge, .management #viewerCount,
.management #playLoginBtn, .management #playerLogoutBtn, .management #adminToggle, .management #passTimerPill,
.management #connect, .management #statsToggle, .management #latencyTest, .management #hidConnect,
.management #gamepadSelect, .management #stats, .management #manageLink, .management #status { display: none !important; }
.management .brand { gap: 0; }
.management .ribbon-spectator { display: inline-flex; }
body:not(.management) .ribbon-spectator, body:not(.management) .admin-only-sep { display: none; }

#accessPanel {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 12px 16px 16px;
  display: grid;
  grid-template-columns: 58% 42%;
  gap: 16px;
  overflow: hidden;
}
.admin-col { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.admin-left {
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: var(--r-card);
}
.admin-right { display: grid; grid-template-rows: 44% 56%; gap: 14px; }
.admin-split-top, .admin-split-bottom {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: var(--r-card);
}

.pane-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bd);
  flex-wrap: wrap;
}
.pane-head h2 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.pane-title-row { display: flex; align-items: center; gap: 8px; }
.mini-tag { font: 11px ui-monospace, monospace; padding: 2px 7px; border-radius: 999px; background: var(--s2); color: var(--dim); border: 1px solid var(--bd-soft); }
.tab-group { display: flex; gap: 4px; }
.tab-btn { background: transparent; border-color: transparent; color: var(--dim); font-weight: 600; padding: 5px 10px; border-radius: var(--r-sm); }
.tab-btn.active { color: var(--text); background: var(--s2); }
.compact-issue { display: flex; align-items: center; gap: 6px; }
.compact-issue input[name="label"] { width: 140px; }
.compact-issue input[name="minutes"] { width: 64px; font-family: ui-monospace, monospace; }

.issued-banner {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(139, 92, 246, 0.14);
  border-bottom: 1px solid var(--acc);
  font-size: 12px;
}
.issued-banner input { flex: 1; font: 12px ui-monospace, monospace; background: var(--bg); }
.pane-notice { flex: none; padding: 0 14px; font-size: 12px; color: var(--dim); }
.pane-notice:not(:empty) { padding: 6px 14px; border-bottom: 1px solid var(--bd); }
.pane-subhead { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px; font-size: 11px; }
.pane-subline { flex: none; padding: 7px 14px; font-size: 12px; color: var(--dim); border-bottom: 1px solid var(--bd); }

.pane-scroll { flex: 1; min-height: 0; overflow: auto; }
#accessPanel table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; font-size: 12px; }
#accessPanel th, #accessPanel td { padding: 7px 14px; border-bottom: 1px solid rgba(38, 39, 46, 0.8); vertical-align: middle; }
#accessPanel th { position: sticky; top: 0; background: var(--s1); font-weight: 600; color: var(--dim); font-size: 11px; }
#accessPanel .num { text-align: right; }
#accessPanel .agent { max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }
#accessPanel .more { margin: 8px 14px; }
.row-actions { display: inline-flex; align-items: center; gap: 5px; justify-content: flex-end; }
.row-actions button { padding: 4px 8px; font-size: 11px; }

.admin-queue-list { flex: 1; min-height: 0; overflow: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.admin-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: var(--s2);
  border: 1px solid var(--bd);
  border-radius: var(--r-sm);
  font-size: 12px;
}
.alerts-limits-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--bd);
  font-size: 11px;
  color: var(--dim);
  flex-wrap: wrap;
}
.alerts-limits-bar label { display: inline-flex; align-items: center; gap: 4px; }
.alerts-limits-bar input { width: 46px; padding: 3px 6px; font: 11px ui-monospace, monospace; }
.alerts-limits-bar button { padding: 4px 9px; font-size: 11px; }

.restream-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: 5px;
  background: #22c55e;
  vertical-align: middle;
}
.restream-dot[data-mode="slate"] { background: #f59e0b; }
.restream-dot[data-mode="error"] { background: var(--danger); }
.restream-pane { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.restream-status-card {
  padding: 12px 14px;
  background: var(--s2);
  border: 1px solid var(--bd);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.restream-status-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.restream-status-top strong { font-size: 14px; display: block; margin-bottom: 2px; }
.restream-error {
  font: 12px ui-monospace, monospace;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  word-break: break-word;
}
.restream-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; font-size: 12px; }
.restream-form .span-2 { grid-column: span 2; }
.restream-form label:not(.ribbon-check) { display: flex; flex-direction: column; gap: 4px; color: var(--dim); }
.restream-presets { grid-column: span 2; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; }
.restream-presets button { padding: 3px 8px; font-size: 11px; }
.restream-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 4px; }

@media (pointer: coarse) and (not (any-pointer: fine)) {
  .fine-pointer { display: none !important; }
  .sens-group { display: none !important; }
}
@media (max-width: 860px) {
  html, body {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }
  #app {
    height: auto;
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: visible;
  }
  #bar {
    height: auto;
    min-height: 48px;
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .bar-left, .bar-right { gap: 8px; flex-wrap: wrap; }
  .brand { font-size: 14px; gap: 7px; }
  .brand img { width: 18px; height: 18px; }
  .bar-sep, #liveBadge { display: none; }
  .bar-meta { font-size: 12px; }
  #playLoginBtn { padding: 6px 12px; font-size: 12px; }
  #status { display: none; }

  #adminPanel {
    width: auto;
    margin: 8px 12px 0;
    padding: 8px 10px;
    gap: 6px;
  }
  #spectatorChannel { width: 130px; max-width: 100%; }

  #roomLayout {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 10px 22px;
    gap: 14px;
    overflow: visible;
  }
  .canopy-stage { width: 100%; padding: 0 12px; }
  .canopy-post { width: 18px; top: -4px; bottom: -4px; height: calc(100% + 8px); }
  .canopy-valance { height: 40px; margin-bottom: -8px; }
  .canopy-foreground-floor { display: none; }
  .tools-center { display: none; }
  #playerCard {
    width: 100%;
    padding: 4px 4px 0;
  }
  .stage-column { width: 100%; align-items: stretch; justify-content: flex-start; }
  .studio-bottom-dock { padding: 10px 12px; }
  .studio-dock-memes { padding-left: 0; border-left: 0; padding-top: 8px; border-top: 1px solid var(--bd); width: 100%; }
  .studio-inspector { width: 100%; height: auto; overflow: visible; }
  .inspector-body { overflow: visible; }
  .inspector-scroll { margin: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .studio-form { grid-template-columns: 1fr; }
  .studio-form .span-2, .restream-presets { grid-column: span 1; }
  .studio-stream-footer { grid-template-columns: 1fr; }
  .studio-diag-grid { grid-template-columns: 1fr; }
  #stage {
    width: 100%;
    aspect-ratio: 16 / 9;
    flex: none;
  }
  .player-tools {
    height: auto;
    min-height: 40px;
    padding: 6px 2px;
    gap: 6px;
    flex-wrap: wrap;
  }
  .tools-left, .tools-right { gap: 6px; flex-wrap: wrap; }
  .vol-group input[type="range"] { width: 68px; }
  .sens-group, .mode-label { display: none !important; }
  .tool-icon-btn { padding: 5px 7px; font-size: 11px; }

  #memAlertOverlay { left: 8px; right: 8px; bottom: 8px; }
  #memAlertOverlay.lucia-pos { left: auto; right: 8px; bottom: 8px; max-width: calc(100% - 16px); }
  #memAlertOverlay.lucia-pos .lucia-quest-card { width: min(290px, calc(100vw - 32px)); }
  #memAlertOverlay.lucia-pos .lucia-inner { padding: 9px 11px 10px; gap: 6px; }
  #memAlertOverlay.lucia-pos .lucia-avatar { width: 32px; height: 32px; }
  #memAlertOverlay.lucia-pos .lucia-title { font-size: 18px; }
  #memAlertOverlay.lucia-pos .lucia-sub, #memAlertOverlay.lucia-pos .lucia-desc, #memAlertOverlay.lucia-pos .lucia-list { font-size: 12px; }
  .mem-alert-card { max-width: 100%; padding: 7px 10px; }
  #keys dl { grid-template-columns: repeat(2, auto); gap: 5px 10px; }

  #queueCard {
    width: 100%;
    height: auto;
    align-self: stretch;
    gap: 12px;
  }
  .club-tabs-card { flex: none; max-height: none; min-height: 0; overflow: visible; }
  .club-tab-pane, .rail-queue, .rail-waiting, .rail-memes { flex: none; overflow: visible; }
  .canopy-aristocrat-fg { flex: none; min-height: 0; padding: 8px 0 18px; }
  .canopy-aristocrat-img { height: auto; max-height: 260px; max-width: 90%; margin-bottom: 0; }
  .rail-block { padding: 12px 14px; }
  #memAlertsCard { padding: 12px 14px; }
  .mem-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .meme-tile { min-height: 60px; padding: 8px 4px; }

  #accessPanel {
    grid-template-columns: 1fr;
    padding: 8px 12px 24px;
    gap: 12px;
    overflow: visible;
  }
  .admin-col, .admin-right, .admin-split-top, .admin-split-bottom {
    display: flex;
    flex-direction: column;
    overflow: visible;
    height: auto;
  }
  .pane-head { padding: 10px 12px; }
  .tab-group { flex-wrap: wrap; width: 100%; }
  .compact-issue { width: 100%; flex-wrap: wrap; }
  .compact-issue input[name="label"] { flex: 1 1 120px; width: auto; min-width: 0; }
  .pane-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .restream-form { grid-template-columns: 1fr; }
  .restream-form .span-2, .restream-presets { grid-column: span 1; }
  .modal-form-grid { grid-template-columns: 1fr; }
  .modal-form-grid .span-2 { grid-column: span 1; }

  /* Full-viewport Lucia modal on mobile */
  #luciaModal {
    padding: 0;
    align-items: stretch;
    justify-items: stretch;
  }
  #luciaModal .modal-card {
    max-width: none;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  #luciaModal .lucia-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  #luciaModal .modal-actions {
    margin-top: auto;
    padding-top: 12px;
  }
  #luciaModal .modal-actions button {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
  }
}
@media (max-width: 440px) {
  #gamepadBtnLabel, #keysHelp span { display: none; }
  .vol-group output { display: none; }
  .vol-group input[type="range"] { width: 64px; }
}
