:root {
  --bg:#0f1115; --panel:#171a21; --panel2:#1c2029; --line:#262b36; --text:#e6e8ec; --muted:#8b93a3;
  --accent:#7aa2f7; --good:#9ece6a; --warn:#e0af68; --bad:#f7768e; --blurple:#5865f2;
}
* { box-sizing:border-box; }
html, body { margin:0; height:100%; background:var(--bg); color:var(--text);
  font:14px/1.5 ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif; }
#app { height:100%; }
button { font:inherit; color:inherit; }
input, select { font:inherit; color:var(--text); background:#0b0d11; border:1px solid var(--line);
  border-radius:8px; padding:7px 10px; }
input:focus, select:focus { outline:2px solid var(--accent); outline-offset:-1px; }
.muted { color:var(--muted); } .small { font-size:12px; } .hide { display:none !important; }
.center { display:flex; align-items:center; justify-content:center; flex-direction:column; gap:14px;
  min-height:100%; padding:24px; text-align:center; }
.btn { background:var(--panel2); border:1px solid var(--line); border-radius:9px; padding:7px 13px;
  cursor:pointer; white-space:nowrap; }
.btn:hover { border-color:var(--accent); } .btn:disabled { opacity:.45; cursor:default; }
.btn.primary { background:var(--accent); border-color:var(--accent); color:#0b0d10; font-weight:600; }
.btn.discord { background:var(--blurple); border-color:var(--blurple); color:#fff; font-weight:600; padding:10px 18px; }
.btn.ghost { background:none; border-color:transparent; }
.btn.icon { padding:6px 9px; min-width:36px; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:20px; }
.logo { font-size:22px; font-weight:700; letter-spacing:-.02em; }
.err { color:var(--bad); }
.avatar { width:28px; height:28px; border-radius:50%; background:var(--panel2); object-fit:cover;
  display:inline-flex; align-items:center; justify-content:center; font-size:12px; font-weight:600;
  flex:none; border:2px solid transparent; }
.avatar.ok { border-color:var(--good); } .avatar.wait { border-color:var(--warn); }
.row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.spacer { flex:1; }
.pill { font-size:11px; padding:2px 8px; border-radius:99px; background:var(--panel2);
  border:1px solid var(--line); color:var(--muted); white-space:nowrap; }
.pill.acc { color:var(--accent); } .pill.warn { color:var(--warn); } .pill.good { color:var(--good); }

/* lobby */
.lobby { max-width:980px; margin:0 auto; padding:18px; }
.topbar { display:flex; align-items:center; gap:12px; padding:10px 0 18px; }
.rooms { display:grid; gap:12px; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); margin:12px 0 24px; }
.roomcard { background:var(--panel); border:1px solid var(--line); border-radius:12px; overflow:hidden;
  cursor:pointer; text-align:left; padding:0; }
.roomcard:hover { border-color:var(--accent); }
.roomcard .art { height:120px; background:#0b0d11 center/cover no-repeat; }
.roomcard .body { padding:10px 12px; }

/* room */
.room { display:grid; height:100%; grid-template-rows:auto 1fr; grid-template-columns:1fr 250px; }
.room > header { grid-column:1/-1; display:flex; align-items:center; gap:10px; padding:8px 12px;
  border-bottom:1px solid var(--line); background:var(--panel); min-height:48px; }
.room > header .name { font-weight:600; max-width:40vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.stage { position:relative; background:#000; min-height:0; min-width:0; overflow:hidden; }
.stage video { width:100%; height:100%; object-fit:contain; background:#000; display:block; }
.side { border-left:1px solid var(--line); background:var(--panel); overflow:auto; padding:10px; }
.viewer { display:flex; align-items:center; gap:8px; padding:6px 4px; border-radius:8px; }
.viewer .who { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.empty { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:12px; text-align:center; padding:20px; background:radial-gradient(circle at 50% 40%,#1a1e28,#07080b); }
.banner { position:absolute; top:12px; left:50%; transform:translateX(-50%); background:rgba(15,17,21,.88);
  border:1px solid var(--line); border-radius:99px; padding:6px 14px; font-size:13px; z-index:3; white-space:nowrap; }
.tapper { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; z-index:4;
  background:rgba(0,0,0,.45); }
.tapper.soft { inset:auto; left:50%; bottom:84px; transform:translateX(-50%); background:none; }
.controls { position:absolute; left:0; right:0; bottom:0; padding:28px 12px 10px; z-index:2;
  background:linear-gradient(transparent,rgba(0,0,0,.85)); transition:opacity .25s; }
.stage.idle .controls { opacity:0; } .stage.idle { cursor:none; }
.controls .btn { background:rgba(28,32,41,.85); }
.controls .btn.primary { background:var(--accent); }
.seek { position:relative; height:18px; cursor:pointer; margin-bottom:6px; touch-action:none; }
.seek .track { position:absolute; left:0; right:0; top:7px; height:4px; border-radius:2px; background:rgba(255,255,255,.2); }
.seek .buf { position:absolute; left:0; top:7px; height:4px; border-radius:2px; background:rgba(255,255,255,.35); }
.seek .fill { position:absolute; left:0; top:7px; height:4px; border-radius:2px; background:var(--accent); }
.seek .knob { position:absolute; top:3px; width:12px; height:12px; margin-left:-6px; border-radius:50%; background:#fff; }
.seek .tip { position:absolute; bottom:20px; transform:translateX(-50%); background:#000; padding:1px 6px;
  border-radius:4px; font-size:12px; pointer-events:none; }
.time { font-variant-numeric:tabular-nums; font-size:13px; }
.vol { width:90px; accent-color:var(--accent); }
.menu { position:absolute; bottom:64px; right:12px; background:var(--panel); border:1px solid var(--line);
  border-radius:10px; padding:10px; z-index:5; min-width:240px; max-height:60%; overflow:auto; }
.menu h4 { margin:6px 0; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
.menu button { display:block; width:100%; text-align:left; background:none; border:0; padding:6px 8px;
  border-radius:6px; cursor:pointer; }
.menu button:hover { background:var(--panel2); } .menu button.on { color:var(--accent); }

/* library drawer */
.drawer { position:fixed; top:0; right:0; bottom:0; width:min(760px,100%); background:var(--bg);
  border-left:1px solid var(--line); z-index:20; display:flex; flex-direction:column; }
.drawer > header { display:flex; gap:8px; align-items:center; padding:10px 12px; border-bottom:1px solid var(--line);
  flex-wrap:wrap; }
.tabs { display:flex; gap:4px; overflow-x:auto; }
.tabs button { background:none; border:0; border-bottom:2px solid transparent; color:var(--muted);
  padding:6px 10px; cursor:pointer; white-space:nowrap; }
.tabs button.on { color:var(--text); border-bottom-color:var(--accent); }
.grid { display:grid; gap:12px; grid-template-columns:repeat(auto-fill,minmax(118px,1fr)); padding:12px; overflow:auto; }
.poster { background:none; border:0; padding:0; text-align:left; cursor:pointer; }
.poster img, .poster .ph { width:100%; aspect-ratio:2/3; border-radius:8px; background:var(--panel2); object-fit:cover; display:block; }
.poster:hover img { outline:2px solid var(--accent); }
.poster .t { font-size:12px; margin-top:4px; line-height:1.3; overflow:hidden; display:-webkit-box;
  -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.detail { padding:14px; overflow:auto; }
.detail .top { display:flex; gap:14px; }
.detail .top img { width:140px; border-radius:10px; flex:none; aspect-ratio:2/3; object-fit:cover; background:var(--panel2); }
.eps { margin-top:12px; }
.ep { display:flex; gap:10px; align-items:center; padding:8px; border-radius:8px; cursor:pointer; }
.ep:hover { background:var(--panel2); }
.more { margin:0 12px 16px; }

.afk { position:fixed; inset:0; z-index:40; background:rgba(5,6,8,.72); display:flex; align-items:center; justify-content:center; }
.afk .card { text-align:center; max-width:360px; }
.afk .count { font-size:28px; font-weight:700; font-variant-numeric:tabular-nums; margin:6px 0 14px; }
.toasts { position:fixed; left:12px; top:58px; display:flex; flex-direction:column; gap:6px; z-index:30; pointer-events:none; }
.toast { background:rgba(23,26,33,.95); border:1px solid var(--line); border-radius:9px; padding:7px 12px;
  font-size:13px; max-width:340px; animation:fade 4s forwards; }
.toast.bad { border-color:#3d2730; color:var(--bad); }
@keyframes fade { 0%{opacity:0;transform:translateY(6px)} 8%{opacity:1;transform:none} 85%{opacity:1} 100%{opacity:0} }

@media (max-width:760px), (max-height:420px) {
  .room { grid-template-columns:1fr; grid-template-rows:auto 1fr auto; }
  .side { border-left:0; border-top:1px solid var(--line); max-height:28vh; }
  .vol { display:none; }
}
@media (max-height:300px) { .side, .room > header .opt { display:none; } }
