:root {
  --bg: #0b0f0c;
  --panel: #131a15;
  --panel-2: #1a231c;
  --line: #26332a;
  --text: #e8efe9;
  --muted: #8fa595;
  --accent: #8cff6a;      /* swamp-glow green */
  --accent-ink: #0b1a07;
  --warn: #ff6a6a;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #18301c 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, system-ui, -apple-system, Segoe UI, sans-serif;
}

input, button { font: inherit; color: inherit; }
input[type="password"], input[type="url"], input:not([type]) {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
input:focus { border-color: var(--accent); }

.btn {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn.danger { border-color: #5a2a2a; color: var(--warn); }
.btn:disabled { opacity: .6; cursor: wait; }

.icon-btn {
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { border-color: var(--accent); }

/* ===== Join ===== */
.join-screen { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.join-card {
  width: min(420px, 100%);
  display: grid; gap: 14px;
  padding: 28px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 60px #0008, 0 0 0 1px #8cff6a10 inset;
}
.marquee {
  justify-self: center;
  font-size: 11px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--accent);
  border: 1px dashed #8cff6a66; border-radius: 99px; padding: 3px 12px;
}
.join-card h1 {
  margin: 0 0 6px; text-align: center;
  font: 400 64px/1 Creepster, Inter, sans-serif; letter-spacing: .04em;
  color: var(--accent);
  text-shadow: 0 0 18px #8cff6a55;
}
.join-card h1 span { display: block; font-size: 28px; color: var(--text); text-shadow: none; margin-top: 6px; }
.join-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.join-card label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.error { margin: 0; min-height: 1.2em; color: var(--warn); font-size: 14px; text-align: center; }

/* ===== Room ===== */
.room { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: relative; z-index: 30; /* keeps the viewer list above the chat */
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #0b0f0ccc; backdrop-filter: blur(6px);
}
.brand { font: 400 24px/1 Creepster, Inter, sans-serif; color: var(--accent); }
.brand span { color: var(--text); }
.viewers {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px;
  padding: 6px 12px; cursor: pointer; font-size: 13px; white-space: nowrap; flex: none;
}
.viewer-list {
  position: absolute; right: 16px; top: 100%; z-index: 20; margin-top: 6px;
  min-width: 180px; max-height: 50vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px; box-shadow: 0 10px 30px #0009;
}
.viewer-list div { padding: 4px 8px; }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  padding: 16px;
  max-width: 1600px; width: 100%; margin: 0 auto;
}
.stage-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
.stage video, .yt-wrap, .yt-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage video { object-fit: contain; background: #000; }
.click-shield { position: absolute; inset: 0; z-index: 2; }
.empty {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-content: center; text-align: center; gap: 6px;
  color: var(--muted);
}
.empty-icon { font-size: 48px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-6deg); } }
.live-badge {
  position: absolute; top: 12px; left: 12px; z-index: 4;
  background: #c0162acc; color: #fff; font-weight: 700; font-size: 12px;
  padding: 4px 8px; border-radius: 6px; letter-spacing: .05em;
}
.unlock {
  position: absolute; z-index: 6; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 14px 22px; border-radius: 99px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 17px;
  box-shadow: 0 0 40px #8cff6a66;
}

/* Fullscreen keeps reactions visible */
.stage:fullscreen { border-radius: 0; border: 0; aspect-ratio: auto; }
.stage:-webkit-full-screen { border-radius: 0; border: 0; aspect-ratio: auto; width: 100%; height: 100%; }

/* ===== Reactions ===== */
.reaction-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.float {
  position: absolute; bottom: -10px;
  display: flex; flex-direction: column; align-items: center;
  animation: rise var(--dur, 3s) ease-out forwards;
}
.float .e { font-size: 38px; filter: drop-shadow(0 2px 6px #000a); }
.float .n {
  font-size: 11px; font-weight: 600; color: #fff;
  background: #0008; padding: 1px 6px; border-radius: 99px; margin-top: 2px;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@keyframes rise {
  0%   { bottom: -10px; transform: translateX(0) scale(.6); opacity: 0; }
  10%  { opacity: 1; transform: translateX(0) scale(1.1); }
  50%  { transform: translateX(var(--sway, 20px)) scale(1); }
  80%  { opacity: 1; }
  100% { bottom: 80%; transform: translateX(calc(var(--sway, 20px) * -0.5)) scale(.9); opacity: 0; }
}

.reaction-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.reaction-bar button {
  font-size: 22px; line-height: 1;
  padding: 8px 10px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); cursor: pointer;
  transition: transform .08s;
}
.reaction-bar button:hover { border-color: var(--accent); }
.reaction-bar button:active { transform: scale(.88); }

/* ===== Controls ===== */
.controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.host-controls, .viewer-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.host-controls input[type="range"] { flex: 1; }
.viewer-controls #volume { width: 90px; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
input[type="range"] { accent-color: var(--accent); }

/* ===== Host panel ===== */
.host-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px;
}
.host-panel summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.source-row { display: grid; gap: 6px; margin-top: 12px; }
.source-row label { font-size: 13px; color: var(--muted); }
.source-row .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.source-row .row input { flex: 1; min-width: 180px; width: auto; }
.hint { font-size: 12px; color: var(--muted); }

/* ===== Chat ===== */
.chat {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  height: calc(100vh - 100px); position: sticky; top: 16px;
}
.messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.msg { word-wrap: break-word; overflow-wrap: anywhere; }
.msg .who { font-weight: 700; margin-right: 6px; }
.msg.system { color: var(--muted); font-size: 12px; font-style: italic; text-align: center; padding: 2px 0; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }

/* ===== Mobile ===== */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 10px; gap: 10px; }
  .chat { height: 55vh; position: static; }
  .brand { font-size: 20px; }
  .viewer-controls #volume { display: none; }
  .reaction-bar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .float .e { font-size: 30px; }
}

/* ===== GCCTV ===== */
.tv-bug {
  position: absolute; right: 14px; bottom: 12px; z-index: 4;
  font: 400 20px/1 Creepster, Inter, sans-serif; letter-spacing: .04em;
  color: #fff; opacity: .55; text-shadow: 0 1px 4px #000c;
  pointer-events: none;
}
.lower-third {
  position: absolute; left: 14px; bottom: 14px; z-index: 4; max-width: min(70%, 520px);
  display: grid; gap: 2px;
  padding: 10px 14px 10px 12px;
  background: linear-gradient(90deg, #0b0f0cee, #0b0f0cb0);
  border-left: 4px solid var(--accent); border-radius: 6px;
  animation: slide-in .5s ease-out;
  pointer-events: none;
}
.lower-third small { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.lower-third b { font-size: 17px; }
.lower-third span { color: var(--muted); font-size: 13px; }
.lower-third span:empty { display: none; }
@keyframes slide-in { from { transform: translateX(-30px); opacity: 0; } }
.time { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-controls .spacer { min-width: 4px; }
@media (max-width: 900px) {
  .lower-third { max-width: 85%; padding: 6px 10px; }
  .lower-third b { font-size: 14px; }
  .tv-bug { font-size: 15px; }
}

/* ===== Spaces ===== */
.space-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.space-btn {
  display: grid; justify-items: center; gap: 2px;
  padding: 14px 10px; border-radius: 12px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  transition: border-color .15s, transform .08s;
}
.space-btn:first-child { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.space-btn:hover { border-color: var(--accent); }
.space-btn:active { transform: scale(.97); }
.space-btn:disabled { opacity: .6; cursor: wait; }
.space-btn .space-icon { font-size: 26px; }
.space-btn b { font-size: 16px; }
.space-btn small { font-size: 12px; opacity: .75; }

.topbar { justify-content: flex-start; }
.topbar .viewers { margin-left: auto; }
.space-tabs { display: flex; gap: 4px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; }
.space-tab {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.space-tab:hover { color: var(--text); }
.space-tab.active { background: var(--accent); color: var(--accent-ink); }
.tab-meta { font-weight: 400; font-size: 12px; opacity: .8; margin-left: 2px; }
.tab-meta.live { color: #ff5a6e; font-weight: 700; opacity: 1; }
.space-tab.active .tab-meta.live { color: #8a0016; }

#go-tv { justify-self: center; margin-top: 6px; }
.tv-host { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tv-host b { color: var(--accent); }
.tv-host .row { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .topbar .brand { display: none; }
  .space-tab { padding: 6px 10px; font-size: 13px; }
}
@media (max-width: 380px) {
  .space-tab .tab-meta { display: none; }
}

/* ===== Vote to skip ===== */
.vote-bar { display: grid; grid-template-columns: minmax(0, 1fr); }
.vote-propose { justify-self: start; }
.vote-active {
  display: grid; gap: 8px;
  padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 0 24px #8cff6a22;
  animation: slide-in .35s ease-out;
}
.vote-q { overflow-wrap: anywhere; }
.vote-q i { font-style: normal; color: var(--accent); }
.vote-meter { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.vote-meter span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s; }
.vote-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vote-count, .vote-timer { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.vote-choice.chosen { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; flex-basis: 100%; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track {
  position: relative; width: 40px; height: 22px; flex: none;
  background: var(--bg); border: 1px solid var(--line); border-radius: 99px; transition: background .2s;
}
.toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: var(--muted); border-radius: 50%; transition: transform .2s, background .2s;
}
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); background: var(--accent-ink); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 900px) {
  .vote-row .spacer { display: none; }
  .vote-choice { flex: 1; }
}

/* ===== GCCTV lineup editor ===== */
.lineup { display: grid; gap: 10px; border-color: #8cff6a55; }
.lineup-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lineup-head b { color: var(--accent); font-size: 16px; }
.lineup-warning {
  margin: 0; padding: 8px 12px; border-radius: 8px;
  background: #3a2a0a; border: 1px solid #7a5a12; color: #ffd27a; font-size: 13px;
}
.lineup-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lu-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start;
  padding: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.lu-row.on-air { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.lu-row.has-error { border-color: var(--warn); }
.lu-num {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%;
  background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.lu-row.on-air .lu-num { background: var(--accent); color: var(--accent-ink); }
.lu-fields { display: grid; gap: 6px; min-width: 0; }
.lu-fields input { padding: 8px 10px; }
.lu-title { font-weight: 600; }
.lu-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.lu-type.bad { color: var(--warn); }
.lu-dur-label { display: inline-flex; align-items: center; gap: 6px; }
.lu-meta input.lu-dur { width: 84px; padding: 4px 8px; font-variant-numeric: tabular-nums; }
.lu-note { font-style: italic; }
.lu-err { color: var(--warn); font-size: 13px; }
.lu-err:empty { display: none; }
.lu-actions { display: grid; grid-template-columns: repeat(2, 36px); gap: 6px; }
.lu-actions .icon-btn:disabled { opacity: .35; cursor: default; }
.lu-actions .lu-air:not(:disabled) { color: var(--accent); }
.lu-actions .lu-del:hover { border-color: var(--warn); color: var(--warn); }
.lu-row.on-air::before {
  content: 'ON AIR'; grid-column: 1 / -1; justify-self: start;
  font-size: 10px; font-weight: 800; letter-spacing: .14em; color: var(--accent-ink);
  background: var(--accent); padding: 2px 8px; border-radius: 99px; margin-bottom: -4px;
}
.lineup-empty { margin: 0; text-align: center; padding: 10px; }
#lineup-add { justify-self: start; }
.lineup-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.lineup-status { font-size: 13px; color: var(--muted); }
.lineup-status.good { color: var(--accent); }
.lineup-status.warn { color: #ffd27a; }
.lineup-status.bad { color: var(--warn); }
.yt-measure { position: fixed; left: -10000px; top: 0; width: 200px; height: 200px; overflow: hidden; pointer-events: none; }
@media (max-width: 900px) {
  .lu-row { grid-template-columns: minmax(0, 1fr); }
  .lu-num { display: none; }
  .lu-actions { grid-template-columns: repeat(4, 1fr); }
  .lu-actions .icon-btn { width: 100%; }
  .lineup-foot .spacer { display: none; }
  .lineup-foot .btn { flex: 1; }
  .lineup-status { flex-basis: 100%; }
}

/* ===== Lineup: earlier versions ===== */
.btn.small { padding: 6px 10px; font-size: 13px; }
.lineup-head #lineup-restore { margin-left: auto; }
.lineup-head #lineup-mode { order: 3; flex-basis: 100%; }
.lineup-backups {
  display: grid; gap: 6px; padding: 10px; font-size: 14px;
  background: var(--bg); border: 1px dashed var(--line); border-radius: 10px;
  max-height: 260px; overflow-y: auto;
}
.lineup-backups p { margin: 0 0 4px; }
.backup-btn {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 8px 12px; border-radius: 8px; cursor: pointer; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
}
.backup-btn:hover { border-color: var(--accent); }
.backup-btn span { color: var(--muted); font-size: 13px; }
#lineup-save:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Captions ===== */
.captions {
  position: absolute; left: 50%; bottom: 9%; transform: translateX(-50%); z-index: 5;
  max-width: 82%; text-align: center; white-space: pre-line;
  font: 600 clamp(14px, 2.5vw, 28px)/1.3 Inter, system-ui, sans-serif;
  color: #fff; background: rgba(0, 0, 0, .74);
  padding: .2em .6em; border-radius: 6px; text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
.stage:has(.lower-third:not([hidden])) .captions { bottom: 96px; }
.cc-btn { font-size: 12px; font-weight: 800; letter-spacing: .03em; }
.cc-btn[aria-pressed="true"] { background: var(--accent); color: #0b0f0c; border-color: var(--accent); }
.cc-btn.unavailable { opacity: .45; text-decoration: line-through; }
.lu-cap-row { display: grid; gap: 4px; }
.lu-capnote { font-size: 12px; color: var(--muted); }
.lu-capnote:empty { display: none; }
.lu-capnote.bad { color: #ff8a80; }
.lu-cap-lab { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.icon-btn.shot-done { background: var(--accent); color: #0b0f0c; border-color: var(--accent); }

/* ===== Fullscreen: chat and emotes over the right third ===== */
.stage { --fs-pct: 33.333%; --fsw: clamp(260px, var(--fs-pct), 60%); }
.fs-panel { display: none; }
.stage.fs-open:not(.fs-collapsed) .fs-panel {
  display: flex; flex-direction: column;
  position: absolute; top: 0; right: 0; bottom: 0; width: var(--fsw); z-index: 12;
  background: rgba(8, 12, 9, .34); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  border-left: 1px solid rgba(255, 255, 255, .1);
}
.fs-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.fs-head .spacer { flex: 1; }
.fs-slot { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.fs-panel .chat {
  flex: 1; height: auto; position: static; min-height: 0;
  background: transparent; border: 0; border-radius: 0;
}
.fs-panel .messages { text-shadow: 0 0 3px #000, 0 1px 2px #000; }
.fs-panel .msg:not(.system) { background: rgba(0, 0, 0, .3); padding: 2px 8px; border-radius: 6px; }
.fs-panel .chat-form input { background: rgba(0, 0, 0, .42); }
.fs-panel .chat-form { border-top-color: rgba(255, 255, 255, .12); }
.fs-panel .reaction-bar { flex: none; padding: 8px 10px; gap: 4px; border-top: 1px solid rgba(255, 255, 255, .12); }
.fs-panel .reaction-bar button { font-size: 18px; padding: 5px 7px; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); }
.fs-show {
  display: none;
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); z-index: 12;
  width: 44px; height: 44px; border-radius: 22px; font-size: 20px; cursor: pointer;
  background: rgba(8, 12, 9, .78); color: #fff; border: 1px solid rgba(255, 255, 255, .25);
}
.stage.fs-open.fs-collapsed .fs-show { display: block; }
.fs-unread {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--accent); color: #0b0f0c; font: 700 11px/18px Inter, sans-serif;
}
/* keep the picture's own overlays clear of the panel */
.stage.fs-open:not(.fs-collapsed) .captions { left: calc((100% - var(--fsw)) / 2); max-width: calc(100% - var(--fsw) - 24px); }
.stage.fs-open:not(.fs-collapsed) .tv-bug { right: calc(var(--fsw) + 14px); }
.stage.fs-open:not(.fs-collapsed) .lower-third { max-width: calc(100% - var(--fsw) - 28px); }

/* Stand-in fullscreen for iPhone (and anywhere the real one isn't available) */
.stage.pseudo-fs {
  position: fixed; inset: 0; width: 100%; height: 100vh; height: 100dvh; z-index: 1000;
  border-radius: 0; border: 0; aspect-ratio: auto; max-height: none;
}
body.pseudo-fs-on { overflow: hidden; }
.stage.pseudo-fs .fs-head { padding-top: calc(8px + env(safe-area-inset-top)); padding-right: calc(10px + env(safe-area-inset-right)); }
.stage.pseudo-fs .fs-panel .chat-form { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.stage.pseudo-fs .fs-show { right: calc(12px + env(safe-area-inset-right)); }
.fs-hint {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 13;
  max-width: 80%; text-align: center; font-size: 13px; padding: 6px 12px; border-radius: 16px;
  background: rgba(8, 12, 9, .8); color: #fff; border: 1px solid rgba(255, 255, 255, .2);
  pointer-events: none;
}

.fs-panel .reaction-bar { flex-wrap: wrap; overflow: visible; }
.stage.pseudo-fs .fs-panel .reaction-bar { padding-right: calc(10px + env(safe-area-inset-right)); }

/* Drag the panel's left edge to change its width */
.fs-resize {
  position: absolute; left: -10px; top: 0; bottom: 0; width: 20px; z-index: 2;
  cursor: ew-resize; touch-action: none; display: flex; align-items: center; justify-content: center;
}
.fs-resize i {
  width: 4px; height: 44px; border-radius: 2px; background: rgba(255, 255, 255, .45);
  transition: background .15s, height .15s;
}
.fs-resize:hover i, .fs-resize:focus-visible i, .fs-resize.dragging i { background: var(--accent); height: 64px; }
.fs-resize:focus-visible { outline: none; }

/* "Remember me" */
.remembered { margin: 0; font-size: 13px; color: var(--muted); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.viewer-list .signout-btn { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; }

/* ===== Phones and small screens: the room fits the screen, so nothing needs scrolling =====
   Tabs stay at the top, the chat box and Send stay at the bottom; only the
   messages (and, for hosts, the control panels) scroll inside their own areas. */
@media (max-width: 900px), (max-height: 500px) and (orientation: landscape) {
  html:has(#room:not([hidden])), body:has(#room:not([hidden])) { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .room:not([hidden]) {
    position: fixed; left: 0; right: 0; top: var(--app-top, 0px);
    height: var(--app-h, 100dvh); min-height: 0; overflow: hidden;
  }
  .topbar { flex: none; padding-top: calc(8px + env(safe-area-inset-top)); }
  .layout {
    flex: 1; min-height: 0; overflow: hidden; max-width: none;
    display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 0;
  }
  .stage-col { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .stage { position: sticky; top: 0; z-index: 5; flex: none; }
  .reaction-bar { flex-wrap: nowrap; overflow-x: auto; flex: none; }
  .chat { flex: 1 1 0; min-height: 150px; height: auto; position: static; }
  .chat-form { flex: none; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .chat-form input { font-size: 16px; } /* iPhone zooms the page in on smaller text */
  /* a host editing the lineup gets the whole screen for it */
  .layout:has(#lineup:not([hidden])) .chat { display: none; }
  .layout:has(#lineup:not([hidden])) .stage-col { flex: 1 1 auto; }
}
/* Phone turned sideways: picture on the left, chat on the right */
@media (max-height: 500px) and (orientation: landscape) {
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 38%); grid-template-rows: minmax(0, 1fr); }
  .stage-col { flex: none; height: 100%; }
  .stage { max-height: calc(var(--app-h, 100dvh) - 120px); }
  .chat { min-height: 0; height: 100%; }
  .topbar { padding-top: 4px; padding-bottom: 4px; }
}

/* With the keyboard up, give the chat the room: keep the picture, tuck the buttons away */
@media (max-width: 900px), (max-height: 500px) and (orientation: landscape) {
  html.kb-open .stage-col > :not(.stage) { display: none; }
  html.kb-open .stage-col { flex: none; }
  html.kb-open .stage { aspect-ratio: auto; height: 112px; }
}
