:root {
  color-scheme: dark;
  --bg:#0b0d10; --panel:#12161b; --panel2:#171c22; --line:#252b34; --line2:#343c47;
  --fg:#e9edf2; --dim:#98a2af; --mute:#66707d; --acc:#5ea0ff; --acc2:#2d5f9e;
  --ok:#55d68b; --warn:#f0b429; --err:#ff6b63; --r:10px;
  font:14px/1.5 ui-sans-serif,system-ui,"Segoe UI",-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;
}
* { box-sizing:border-box; }
html,body { margin:0; min-height:100%; background:var(--bg); color:var(--fg); }
body { -webkit-font-smoothing:antialiased; }
button,input,select { font:inherit; color:inherit; }
button { cursor:pointer; }
header {
  display:flex; align-items:center; gap:12px; padding:10px 16px;
  border-bottom:1px solid var(--line); background:linear-gradient(180deg,#12161b,#0e1216);
  position:sticky; top:0; z-index:20;
}
.brand { display:flex; align-items:baseline; gap:6px; letter-spacing:-.01em; }
.brand b { font-size:16px; }
.brand span { color:var(--dim); font-size:12px; letter-spacing:.08em; text-transform:uppercase; }
.header-sp { flex:1; }
.pill { padding:4px 10px; border-radius:999px; border:1px solid var(--line); font-size:12px; color:var(--dim); }
.pill.on { color:#06121f; background:var(--ok); border-color:var(--ok); font-weight:600; }
.pill.off { color:var(--mute); }
.btn {
  background:var(--panel2); border:1px solid var(--line); border-radius:7px; padding:7px 11px;
  transition:.15s; white-space:nowrap;
}
.btn:hover { border-color:var(--acc2); background:#1c232c; }
.btn.primary { background:var(--acc); border-color:var(--acc); color:#06121f; font-weight:650; }
.btn.primary:hover { background:#75afff; }
.btn.ghost { background:transparent; color:var(--dim); }
.btn.ghost:hover { color:var(--fg); }
.btn:disabled { opacity:.4; cursor:not-allowed; }

main {
  display:grid; grid-template-columns:minmax(0,1fr) 370px; gap:14px;
  padding:14px; align-items:start; max-width:1800px; margin:0 auto;
}
@media (max-width:1050px) { main { grid-template-columns:1fr; } aside { order:2; } }

.player-col { min-width:0; }
#stage {
  position:relative; aspect-ratio:16/9; background:#000; border:1px solid var(--line);
  border-radius:var(--r); overflow:hidden;
}
#stage:fullscreen { border-radius:0; border:0; width:100vw; height:100vh; aspect-ratio:auto; }
#stage video { width:100%; height:100%; display:block; background:#000; }
#stage canvas { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:3; }
#placeholder {
  position:absolute; inset:0; display:flex; flex-direction:column; gap:8px;
  align-items:center; justify-content:center; text-align:center; padding:20px;
  background:radial-gradient(circle at 50% 40%,#131922,#07090c 70%); color:var(--dim);
}
#placeholder b { font-size:17px; color:var(--fg); }
#placeholder span { font-size:12.5px; max-width:640px; }
.toast {
  position:absolute; left:12px; bottom:12px; z-index:6; max-width:80%;
  background:rgba(10,13,17,.9); border:1px solid var(--line2); border-radius:8px;
  padding:7px 11px; font-size:12.5px;
}
.toast.err { border-color:#6b2b2b; color:#ffd1cd; }
.nowbar { display:flex; gap:14px; align-items:flex-start; padding:10px 2px 4px; }
.now-main { min-width:0; flex:1; }
#nowTitle { font-weight:650; font-size:15px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.now-side { text-align:right; font-size:12px; min-width:160px; }
.muted { color:var(--mute); font-size:12px; }
.trackbar {
  display:flex; gap:12px; flex-wrap:wrap; align-items:center; padding:8px 2px 0;
  border-top:1px solid var(--line); margin-top:4px;
}
.trackbar label { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--dim); }
.trackbar select { max-width:210px; background:#0e1216; border:1px solid var(--line); border-radius:6px; padding:5px 7px; }
.trackbar .check { gap:5px; color:var(--fg); }

aside { display:flex; flex-direction:column; gap:12px; min-width:0; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:var(--r); padding:12px; }
.card h2 { margin:0 0 10px; font-size:13px; letter-spacing:.02em; display:flex; align-items:center; gap:8px; }
.card h2 .muted { font-weight:400; margin-left:auto; }
.row { display:flex; gap:7px; align-items:center; margin:7px 0; }
.row > input { flex:1; min-width:0; }
input[type=text], input[type=password], input:not([type]) {
  background:#0c1014; border:1px solid var(--line); border-radius:6px; padding:7px 9px; outline:none;
}
input:focus { border-color:var(--acc2); }
.hint { color:var(--mute); font-size:12px; margin:7px 0 0; }
.tabs { display:flex; gap:6px; margin-bottom:8px; }
.tab { flex:1; background:transparent; border:1px solid var(--line); border-radius:6px; padding:6px; color:var(--dim); }
.tab.on { color:var(--fg); border-color:var(--acc2); background:#17202b; }
.crumb { color:var(--mute); font-size:11.5px; margin:4px 0 2px; word-break:break-all; }
.filelist { list-style:none; margin:0; padding:0; max-height:300px; overflow:auto; border-top:1px solid var(--line); }
.filelist li { display:flex; gap:8px; align-items:center; padding:6px 4px; border-bottom:1px solid #1b2027; cursor:pointer; }
.filelist li:hover { background:#161c23; }
.filelist .ico { width:18px; text-align:center; color:var(--dim); }
.filelist .nm { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.filelist .sz { color:var(--mute); font-size:11px; }
.filelist li.dir .nm { color:#bcd4ff; }
.filebtn { position:relative; overflow:hidden; background:var(--panel2); border:1px solid var(--line); border-radius:7px; padding:7px 11px; color:var(--dim); }
.filebtn input { position:absolute; inset:0; opacity:0; cursor:pointer; }

.room-head { display:flex; gap:8px; align-items:center; }
.room-head b { font-size:18px; letter-spacing:.12em; }
.tag { font-size:11px; color:#06121f; background:var(--warn); border-radius:999px; padding:1px 7px; font-weight:650; }
.members { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0; }
.members span { font-size:12px; border:1px solid var(--line); border-radius:999px; padding:2px 8px; color:var(--dim); }
.members span.host { border-color:var(--warn); color:var(--warn); }
.offer { margin-top:10px; padding:9px; border:1px solid var(--acc2); border-radius:8px; background:#101a26; }
.offer .btn { margin-top:7px; }

.chat { display:flex; flex-direction:column; }
.chatlist { max-height:300px; overflow:auto; display:flex; flex-direction:column; gap:6px; padding:2px; }
.chatline { display:flex; gap:7px; font-size:12.5px; line-height:1.4; }
.chatline .who { color:var(--acc); flex:0 0 auto; max-width:90px; overflow:hidden; text-overflow:ellipsis; }
.chatline .txt { color:var(--fg); word-break:break-word; }
.chatline .at { color:var(--mute); font-variant-numeric:tabular-nums; flex:0 0 auto; cursor:pointer; }
.chatline.sys .txt { color:var(--mute); font-style:italic; }
.chat .row { margin-top:9px; }

.log summary { cursor:pointer; color:var(--dim); font-size:12px; }
#log { max-height:180px; overflow:auto; font:11.5px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace; color:var(--mute); margin-top:6px; white-space:pre-wrap; }
#log .warn { color:var(--warn); }
#log .error { color:var(--err); }

@media (max-width:600px) {
  header { padding:8px 10px; }
  header .btn { padding:6px 8px; }
  main { padding:8px; gap:10px; }
  #stage { border-radius:8px; }
  .nowbar { flex-direction:column; gap:2px; }
  .now-side { text-align:left; }
  .trackbar label { flex:1 1 45%; }
  .trackbar select { max-width:none; flex:1; }
}

.tab.disabled { opacity:.4; cursor:not-allowed; }
