:root {
  --bg: #0d0e12;
  --panel: #15171d;
  --panel-2: #1c1f27;
  --line: #262a34;
  --text: #e9e6df;
  --muted: #8d8f99;
  --accent: #ffb454;
  --live: #ff4d4d;
  --good: #7fd88f;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'Inter', system-ui, sans-serif;
  --chat-w: 340px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .02em; font-size: 17px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--live); box-shadow: 0 0 10px var(--live); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.top-right { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.viewers { color: var(--muted); font-family: var(--mono); font-size: 13px; }
#account button { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 4px 10px; }
#account .who { font-weight: 600; margin-right: 8px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--chat-w); height: calc(100vh - 52px); }
.stage { overflow-y: auto; padding: 16px 20px 40px; }

.player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; max-height: calc(100vh - 220px); margin: 0 auto; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.unmute {
  position: absolute; left: 14px; bottom: 14px; background: rgba(0,0,0,.72); color: #fff;
  border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 8px 14px; backdrop-filter: blur(4px);
}
.offair { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #ddd; font-family: var(--mono); }
.offair .bars { position: absolute; inset: 0; opacity: .18; background: linear-gradient(90deg, #c0c0c0 0 14.28%, #c0c000 0 28.57%, #00c0c0 0 42.85%, #00c000 0 57.14%, #c000c0 0 71.42%, #c00000 0 85.71%, #0000c0 0); }
.offair p { position: relative; }

.nowbar { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; padding: 14px 2px 4px; }
.now { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.now strong { font-size: 18px; }
.label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--bg); background: var(--accent); padding: 1px 6px; border-radius: 3px; }
.next .label { background: var(--line); color: var(--muted); }
.progress { width: 120px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }
#now-time, #next-time { font-family: var(--mono); font-size: 12px; }
.now-desc { margin: 4px 2px 18px; color: var(--muted); max-width: 75ch; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 8px 14px; border-bottom: 2px solid transparent; font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--text); border-color: var(--accent); }

.guide { list-style: none; margin: 0; padding: 0; }
.guide li { display: grid; grid-template-columns: 70px 1fr; gap: 12px; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.guide li.past { opacity: .45; }
.guide li.on { background: var(--panel-2); border-left: 3px solid var(--accent); }
.guide li.ident { display: none; }
.guide time { font-family: var(--mono); color: var(--muted); font-size: 13px; padding-top: 2px; }
.guide .t { font-weight: 600; }
.guide .d { color: var(--muted); font-size: 14px; }
.guide .series { font-family: var(--mono); font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: .1em; }

.suggest-form textarea { width: 100%; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 10px; font: inherit; resize: vertical; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
button[type="submit"], .primary { background: var(--accent); color: #1a1206; border: 0; border-radius: 6px; padding: 7px 16px; font-weight: 600; }
button.ghost { background: none; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 14px; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; }
.sortbar { display: flex; gap: 6px; margin: 18px 0 8px; }
.sortbar button { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 2px 12px; font-size: 13px; }
.sortbar button.on { color: var(--text); border-color: var(--muted); }
.suggestions { list-style: none; padding: 0; margin: 0; }
.suggestions li { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.vote { display: flex; flex-direction: column; align-items: center; background: var(--panel); border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 4px 0; height: fit-content; }
.vote.on { color: var(--accent); border-color: var(--accent); }
.vote b { font-family: var(--mono); color: var(--text); }
.sug-meta { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.status { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 1px 6px; border-radius: 3px; margin-left: 6px; border: 1px solid var(--line); }
.status.made { color: var(--good); border-color: var(--good); }
.status.considering { color: var(--accent); border-color: var(--accent); }
.response { margin-top: 6px; padding: 6px 10px; border-left: 2px solid #ffd479; background: var(--panel); font-size: 14px; }
.response::before { content: 'Claude: '; color: #ffd479; font-weight: 600; }
.prose { max-width: 70ch; color: #cfcbc3; }

.chat { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); min-height: 0; }
.chat-head { padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.messages { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 8px 12px; font-size: 14px; overflow-wrap: anywhere; }
.messages li { padding: 3px 0; }
.messages .name { font-weight: 700; }
.messages .badge { font-size: 10px; font-family: var(--mono); text-transform: uppercase; background: #ffd479; color: #111; border-radius: 3px; padding: 0 4px; margin-right: 5px; vertical-align: 1px; }
.messages .badge.mod { background: var(--good); }
.messages li.host { background: rgba(255, 212, 121, .07); margin: 2px -12px; padding: 5px 12px; }
.messages li.sys { color: var(--muted); font-style: italic; font-size: 13px; }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: inherit; }
.chat-form button:disabled { opacity: .5; }
.chat-note { min-height: 0; padding: 0 12px 8px; font-size: 12px; color: var(--live); }
.chat-note:empty { display: none; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px 18px; width: min(380px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(5,6,9,.7); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
dialog h2 { margin: 0; font-size: 20px; }
dialog .close { background: none; border: 0; color: var(--muted); font-size: 24px; line-height: 1; width: 32px; height: 32px; border-radius: 6px; margin-right: -8px; }
dialog .close:hover { color: var(--text); background: var(--panel-2); }
dialog label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
dialog input { display: block; width: 100%; margin-top: 6px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: inherit; }
dialog input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,180,84,.18); }
dialog .hint { margin: -8px 0 14px; font-size: 12px; color: var(--muted); }
dialog .wide { width: 100%; padding: 11px 16px; border-radius: 8px; margin-top: 4px; }
dialog .switch { margin: 14px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.error { color: var(--live); font-size: 13px; margin: 0 0 10px; }
.error:empty { display: none; }

@media (max-width: 900px) {
  /* phone order, Twitch-style: player, now/next, chat, then the tabs */
  .layout { display: flex; flex-direction: column; height: auto; }
  .stage { display: contents; }
  .player { order: 1; border-radius: 0; max-height: none; width: 100%; }
  .nowbar { order: 2; padding: 10px 16px 0; }
  .now-desc { order: 3; margin: 2px 0 10px; padding: 0 16px; }
  .chat { order: 4; border-left: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); height: 55vh; }
  .tabs { order: 5; padding: 0 10px; margin-top: 8px; }
  .tabpanel { order: 6; padding: 0 16px 24px; }
  .top-right .viewers { display: none; }
}
