:root {
  --canvas: #141116; --surface: #1f1a23; --raised: #262029; --ink: #f3eef5; --muted: #b8acbe;
  --line: #352d3a; --control: #55495c; --accent: #f27d9c; --accent-hover: #f698b1; --accent-text: #2a121b;
  --live: #e5484d; --mod: #7dd3a8;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font: 15px/1.45 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex; flex-direction: column;
}
a { color: var(--accent); }
button, input, textarea { font: inherit; }

.top {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: .04em; }
.brand .accent { color: var(--accent); }
.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; letter-spacing: .05em; }
.badge.on { background: var(--live); color: #fff; }
.badge.off { background: var(--raised); color: var(--muted); }
.viewers { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }

.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 0; }
.stage { min-width: 0; overflow-y: auto; }
.player { position: relative; background: #000; aspect-ratio: 16 / 9; max-height: calc(100vh - 110px); width: 100%; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.offline {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 16px; background: radial-gradient(circle at center, #2a2030 0%, #000 75%);
}
.offline[hidden] { display: none; }
.offline.has-image { background-size: cover; background-position: center; }
.offline.has-image .offline-box {
  background: rgba(20, 17, 22, .72); border-radius: 10px; padding: 14px 22px;
  backdrop-filter: blur(2px);
}
.offline-title { font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.offline-sub { color: var(--muted); margin: 0; }
.countdown {
  font-size: clamp(34px, 8vw, 72px); font-weight: 800; margin: 4px 0 8px; letter-spacing: .02em;
  font-variant-numeric: tabular-nums; color: var(--accent);
}
.countdown[hidden] { display: none; }
.about { padding: 16px; }
.about h1 { font-size: 18px; margin: 0 0 4px; }
.about p { margin: 0; color: var(--muted); }

.chat { display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); min-height: 0; }
.chat-head { padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.messages { list-style: none; margin: 0; padding: 8px 6px; flex: 1; overflow-y: auto; min-height: 0; }
.msg { padding: 3px 8px; border-radius: 4px; word-wrap: break-word; overflow-wrap: anywhere; position: relative; }
.msg:hover { background: var(--raised); }
.msg .nick { font-weight: 700; margin-right: 6px; }
.msg .nick.mod::before { content: "MOD"; font-size: 10px; background: var(--mod); color: #062; border-radius: 3px; padding: 0 4px; margin-right: 4px; vertical-align: 1px; }
.msg .tools { display: none; position: absolute; right: 6px; top: 2px; gap: 4px; }
.msg:hover .tools { display: flex; }
.msg .tools button { background: var(--control); color: var(--ink); border: 0; border-radius: 4px; font-size: 11px; padding: 1px 6px; cursor: pointer; }
.sys { color: var(--muted); font-style: italic; font-size: 13px; padding: 3px 8px; }

.chat-foot { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; }
.input {
  flex: 1; min-width: 0; background: var(--canvas); color: var(--ink); border: 1px solid var(--control);
  border-radius: 6px; padding: 8px 10px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.btn {
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 6px; padding: 8px 14px;
  font-weight: 700; cursor: pointer; white-space: nowrap; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--control); }
.btn.google { background: #fff; color: #1f1f1f; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.err { color: #ff9b9b; font-size: 13px; margin: 0; min-height: 1em; }
.linklike { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; padding: 0; }

.studio {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
}
.studio::backdrop { background: rgba(0, 0, 0, .6); }
.studio-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.studio-head h2 { margin: 0; font-size: 18px; }
.studio-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.studio-sec:last-child { border-bottom: 0; }
.studio-sec h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fields { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.field .input { color: var(--ink); font-size: 15px; }
textarea.input { resize: vertical; }
.row { flex-wrap: wrap; align-items: center; }
.upload { align-self: flex-start; cursor: pointer; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.thumb { position: relative; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--raised); padding: 0; cursor: pointer; aspect-ratio: 16 / 9; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.active { border-color: var(--accent); }
.thumb.none { color: var(--muted); font-size: 13px; }
.thumb .del {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .7); color: #fff; cursor: pointer; line-height: 24px; padding: 0;
}

.logo {
  position: absolute; z-index: 2; pointer-events: none; display: flex; align-items: center;
  color: #fff; font-weight: 800; letter-spacing: .03em; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); opacity: .85;
}
.logo[hidden] { display: none; }
.logo.tl { top: 12px; left: 12px; }
.logo.tr { top: 12px; right: 12px; }
.logo.bl { bottom: 56px; left: 12px; }   /* above the video controls */
.logo.br { bottom: 56px; right: 12px; }
.logo.s { font-size: 13px; } .logo.s img { height: 28px; }
.logo.m { font-size: 18px; } .logo.m img { height: 44px; }
.logo.l { font-size: 26px; } .logo.l img { height: 68px; }
.logo img { width: auto; display: block; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .6)); }
.logo img[hidden] { display: none; }
.thumb.logo-thumb { background: repeating-conic-gradient(#3a3340 0 25%, #2a242e 0 50%) 0 0 / 16px 16px; }
.thumb.logo-thumb img { object-fit: contain; padding: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
select.input { appearance: auto; }
.recs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recs li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; background: var(--raised); border-radius: 8px; }
.recs .when { font-weight: 600; flex: 1; min-width: 150px; }
.recs .meta { color: var(--muted); font-size: 13px; }
.recs .live-dot { color: var(--live); font-weight: 700; font-size: 13px; }
.recs .btn { padding: 4px 10px; font-size: 13px; }

.foot { display: flex; gap: 16px; justify-content: center; padding: 8px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

@media (max-width: 860px) {
  body { height: auto; min-height: 100%; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .stage { overflow: visible; }
  .player { max-height: none; }
  .chat { border-left: 0; border-top: 1px solid var(--line); height: 60vh; }
  .logo.s { font-size: 11px; } .logo.s img { height: 20px; }
  .logo.m { font-size: 14px; } .logo.m img { height: 30px; }
  .logo.l { font-size: 18px; } .logo.l img { height: 44px; }
  .logo.tl, .logo.tr { top: 8px; }
  .about { padding: 10px 16px; }
  .about h1 { font-size: 16px; }
  .about p { font-size: 14px; }
  .top { flex-wrap: wrap; row-gap: 6px; }
}

.gate { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gate[hidden] { display: none; }
.gate .btn { margin-top: 10px; }
#waiting[hidden] { display: none; }
