:root {
  --bg: #ffffff;
  --text: #121316;
  --muted: #6b6f78;
  --line: #e7e8ec;
  --dot: #d9dbe1;
  --ink: #15161a;
  --ink-text: #ffffff;
  --accent: #ffd84d;
  --online: #22c55e;
  --frame: linear-gradient(135deg, #f6d6a8, #f3e7c9 45%, #c9dcf3);
  --shadow: 0 18px 40px -18px rgba(20, 22, 30, 0.35);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f12;
    --text: #eceef2;
    --muted: #9599a3;
    --line: #23252b;
    --dot: #2a2d34;
    --ink: #f2f3f5;
    --ink-text: #111216;
    --accent: #d6a92a;
    --frame: linear-gradient(135deg, #6b5330, #4a4434 45%, #34465e);
    --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.eyebrow {
  margin: 0;
  font: 500 12px/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow .sub { margin-left: 8px; color: var(--muted); font-family: var(--sans); letter-spacing: 0; text-transform: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--muted); vertical-align: 1px; }
.dot.on { background: var(--online); box-shadow: 0 0 0 3px color-mix(in srgb, var(--online) 25%, transparent); }

.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.brand .mark { width: 22px; height: 22px; border-radius: 6px; background: var(--ink); clip-path: polygon(0 100%, 50% 0, 100% 100%, 70% 100%, 50% 55%, 30% 100%); }
.brand.light { color: #fff; }
.brand.light .mark { background: #fff; }

.pill, .outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
}
.pill { color: var(--ink-text); background: var(--ink); border: 0; }
.outline { border: 1px solid var(--text); }
.pill:hover, .outline:hover { opacity: 0.85; }

/* Landing */

.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px max(16px, 3vw);
  border-bottom: 1px solid var(--line);
}
.hero { max-width: 1240px; margin: 0 auto; padding: 32px 16px 64px; }
.hero-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
h1 { margin: 6px 0 0; font-size: clamp(32px, 5vw, 52px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.08; }
.mark-text { background: linear-gradient(transparent 62%, var(--accent) 62%, var(--accent) 88%, transparent 88%); }
.lede { max-width: 300px; margin: 0; color: var(--muted); text-align: right; }

.station { max-width: 900px; margin: 40px auto 0; }
.frame {
  position: relative;
  display: block;
  margin-top: 12px;
  aspect-ratio: 16 / 9;
  padding: 6px;
  border-radius: 18px;
  background: var(--frame);
  box-shadow: var(--shadow);
}
.frame video { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 13px; background: #0c0d10; }
.watching {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 2px 10px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  font: 12px/1.6 var(--mono);
  backdrop-filter: blur(6px);
}
.watching:empty { display: none; }
.caption {
  position: absolute;
  inset: auto 6px 6px;
  padding: 48px 20px 22px;
  border-radius: 0 0 13px 13px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}
.caption-label { display: block; font-size: 12px; opacity: 0.85; }
.caption-text { display: block; overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.progress { position: absolute; left: 26px; right: 26px; bottom: 16px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); overflow: hidden; opacity: 0; }
.progress.running { opacity: 1; }
.progress::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 30%; background: #ff9b3d; animation: sweep 2.4s ease-in-out infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .progress::after { animation: none; width: 100%; } }

.station-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 0 12px; }
.status { margin: 0; }
.status .muted { margin-left: 10px; }

@media (max-width: 720px) {
  .hero-head { flex-direction: column; align-items: flex-start; }
  .lede { text-align: left; }
  .caption-text { font-size: 15px; }
  .station-foot { padding: 0; }
  .status .muted { display: none; }
}

/* Room */

.room { position: fixed; inset: 0; overflow: hidden; color: #fff; background: #08090b; }
.room-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.room::before, .room::after { content: ""; position: absolute; left: 0; right: 0; pointer-events: none; }
.room::before { top: 0; height: 160px; background: linear-gradient(rgba(0, 0, 0, 0.55), transparent); }
.room::after { bottom: 0; height: 200px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.5)); }
.progress.top { inset: 0 0 auto; z-index: 3; height: 3px; border-radius: 0; }
.room-top { position: absolute; inset: 0 0 auto; z-index: 2; display: grid; grid-template-columns: 1fr minmax(0, 760px) 1fr; gap: 16px; padding: 16px 20px; }
.room-left { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.live { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.5); font: 12px/1.6 var(--mono); backdrop-filter: blur(8px); }
.live .sep { width: 1px; height: 12px; margin: 0 10px; background: rgba(255, 255, 255, 0.3); }
.room-prompt { text-align: center; }
.room-prompt .eyebrow { font-size: 11px; opacity: 0.8; }
.room-prompt-text { margin: 4px 0 0; font-size: clamp(16px, 2vw, 22px); line-height: 1.35; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5); overflow-wrap: anywhere; }
.close { justify-self: end; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, 0.45); font-size: 14px; }

.history-button { position: absolute; top: 50%; right: 20px; z-index: 2; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(8px); }

.pips { position: absolute; left: 20px; bottom: 20px; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.pip { width: clamp(150px, 16vw, 220px); margin: 0; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 12px; background: #000; }
.pip figcaption { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 10px; background: rgba(0, 0, 0, 0.6); font: 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.pip figcaption button { border: 0; background: none; color: #fff; font-size: 12px; }
.pip video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.ghost { padding: 5px 12px; border: 0; border-radius: 999px; color: #fff; background: rgba(0, 0, 0, 0.5); font: 12px var(--mono); backdrop-filter: blur(8px); }
.ghost.dark { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }

.prompt-bar { position: absolute; left: 50%; bottom: 28px; z-index: 2; display: flex; align-items: center; width: min(520px, calc(100% - 32px)); padding: 6px 6px 6px 18px; border-radius: 999px; background: rgba(255, 255, 255, 0.94); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); transform: translateX(-50%); }
.prompt-bar input { flex: 1; min-width: 0; padding: 8px 0; border: 0; outline: 0; color: #111; background: none; font: inherit; }
.prompt-bar button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; color: #fff; background: #8b8e96; }
.prompt-bar input:not(:placeholder-shown) + button { background: #111; }

.up-next { position: absolute; right: 20px; bottom: 20px; z-index: 2; width: min(340px, calc(100% - 40px)); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 14px; background: rgba(14, 15, 18, 0.72); backdrop-filter: blur(12px); }
.up-next-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border: 0; background: none; text-align: left; }
.up-next-head .eyebrow { font-size: 11px; }
.up-next-head .muted { flex: 1; font-size: 12px; }
.up-next-head .count { font: 12px var(--mono); }
.up-next-head .count:empty { display: none; }
.chevron { transition: transform 0.2s; }
.up-next:not(.open) .chevron { transform: rotate(180deg); }
.up-next:not(.open) .up-next-body { display: none; }
.up-next-body { max-height: 42vh; padding: 0 14px 12px; overflow-y: auto; }
.up-next .muted { color: rgba(255, 255, 255, 0.6); }
#queue { display: grid; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
#queue li { display: flex; gap: 10px; align-items: flex-start; }
#queue .vote { display: grid; justify-items: center; min-width: 38px; padding: 4px 0; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 8px; background: none; font: 11px var(--mono); line-height: 1.2; }
#queue .vote.voted { color: #111; background: #fff; }
#queue .text { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
#queue .by { display: block; color: rgba(255, 255, 255, 0.55); font-size: 12px; }
#queue .empty { color: rgba(255, 255, 255, 0.6); font-size: 13px; }

.drawer { position: absolute; top: 0; right: 0; bottom: 0; z-index: 4; display: flex; flex-direction: column; width: min(380px, 100%); color: var(--text); background: var(--bg); box-shadow: -20px 0 40px rgba(0, 0, 0, 0.3); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--line); }
.drawer-head .muted { margin: 2px 0 0; }
.history-list { flex: 1; display: grid; align-content: start; gap: 14px; margin: 0; padding: 16px 20px 24px; overflow-y: auto; list-style: none; }
.history-list .text { font-size: 14px; overflow-wrap: anywhere; }
.history-list .meta { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.history-list .empty { color: var(--muted); font-size: 14px; }

@media (max-width: 720px) {
  .room-top { grid-template-columns: 1fr auto; }
  .room-prompt { grid-column: 1 / -1; grid-row: 2; }
  .history-button { top: auto; bottom: 150px; right: 16px; }
  .pips { left: 16px; bottom: 150px; }
  .pip { width: 120px; }
  .prompt-bar { bottom: 84px; }
  .up-next { right: 16px; left: 16px; bottom: 16px; width: auto; }
}

/* Dialogs */

dialog { border: 0; padding: 0; color: var(--text); background: var(--bg); }
dialog::backdrop { background: rgba(8, 9, 11, 0.55); backdrop-filter: blur(4px); }
.sheet { width: min(380px, calc(100% - 32px)); border-radius: 18px; }
.sheet form { display: grid; gap: 10px; padding: 24px; }
.sheet h2 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.sheet .muted { margin: 0 0 4px; }
.sheet input { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--bg); font: inherit; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.toast { position: fixed; left: 50%; top: 20px; z-index: 10; max-width: calc(100% - 32px); margin: 0; padding: 8px 16px; border-radius: 999px; color: var(--ink-text); background: var(--ink); font-size: 14px; opacity: 0; pointer-events: none; transform: translate(-50%, -8px); transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
