:root {
  --bg: #0f1015; --panel: #181a22; --panel2: #20232d; --line: #2c303c;
  --text: #e9eaf0; --muted: #9196a6; --accent: #ff4d6d; --accent2: #7c5cff; --ok: #3ecf8e; --warn: #ffb347;
  --radius: 10px; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: 7px 12px; transition: background .15s, border-color .15s; }
button:hover:not(:disabled) { border-color: #444a5a; background: #272b37; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #ff6680; }
button.discord { background: #5865f2; border-color: #5865f2; color: #fff; font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; }
button.small { padding: 3px 8px; font-size: 12px; }
button.rec { background: #3a1820; border-color: #6b2232; color: #ff8fa3; }
button.danger { color: #ff8fa3; }
input, select, textarea { background: #11131a; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; outline: none; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent2); }
input[type=range] { padding: 0; accent-color: var(--accent); }
input[type=color] { padding: 0; width: 28px; height: 28px; border: none; background: none; }
a { color: #a99bff; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* landing */
.center { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.landing { width: min(440px, 100%); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 26px; letter-spacing: -.02em; }
.logo .dot { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; }
.tagline { color: var(--muted); margin: 6px 0 20px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent2); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; overflow: hidden; object-fit: cover; }

/* room */
.room { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .12em; background: var(--panel2); padding: 4px 10px; border-radius: 6px; }
.members { display: flex; gap: 4px; }
.members .avatar { outline: 2px solid transparent; }
.members .avatar.off { opacity: .35; }
.members .avatar.recing { outline-color: var(--accent); }
.main { display: grid; grid-template-columns: minmax(0, 1fr) 420px; min-height: 0; }
.stage { padding: 16px; overflow: auto; min-width: 0; }
.side { border-left: 1px solid var(--line); background: var(--panel); display: grid; grid-template-rows: auto 1fr; min-height: 0; }
@media (max-width: 960px) {
  .main { grid-template-columns: 1fr; }
  .side { border-left: none; border-top: 1px solid var(--line); }
  .room { height: auto; min-height: 100%; }
}
.player { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; }
.player video { width: 100%; height: 100%; object-fit: contain; display: block; }
.player .empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); }
.subs { position: absolute; left: 0; right: 0; bottom: 6%; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; padding: 0 5%; }
.sub { background: rgba(0,0,0,.72); padding: 4px 12px; border-radius: 6px; font-size: clamp(14px, 2.2vw, 22px); text-align: center; border-left: 4px solid; }
.sub.mine { box-shadow: 0 0 0 2px var(--accent); }
.sub b { margin-right: 6px; }
.recbanner { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; gap: 10px; background: rgba(20,4,8,.85); border: 1px solid #6b2232; padding: 8px 12px; border-radius: 8px; }
.recdot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; flex: none; }
@keyframes pulse { 50% { opacity: .3; } }
.bar { height: 6px; background: #2a2d38; border-radius: 3px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); width: 0; }
.controls { display: flex; gap: 8px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.time { font-family: ui-monospace, Consolas, monospace; color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: transparent; }
.seg button.on { background: var(--accent2); color: #fff; }
.timeline { width: 100%; height: 110px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; display: block; }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
kbd { background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 11px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: none; border-radius: 0; background: transparent; padding: 11px 6px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.panel { overflow: auto; padding: 16px; min-height: 0; }
.list { display: flex; flex-direction: column; gap: 6px; }
.item { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.item.active { border-color: var(--accent); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #2a2d38; color: var(--muted); }
.pill.ok { background: rgba(62,207,142,.15); color: var(--ok); }
.pill.rec { background: rgba(255,77,109,.15); color: var(--accent); }
.lineedit { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.lineedit .times { display: flex; gap: 4px; align-items: center; }
.lineedit .times input { width: 78px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; padding: 4px 6px; }
.lineedit textarea { grid-column: 1 / -1; resize: vertical; min-height: 34px; padding: 5px 8px; }
.meter { height: 8px; background: #2a2d38; border-radius: 4px; overflow: hidden; }
.meter > div { height: 100%; background: linear-gradient(90deg, var(--ok), var(--warn) 70%, var(--accent)); width: 0; transition: width .05s; }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
label.check { display: flex; gap: 8px; align-items: center; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 50; pointer-events: none; width: min(420px, calc(100% - 32px)); }
#toast > div { background: #2a2d38; border: 1px solid var(--line); padding: 9px 14px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
#toast > div.err { border-color: #6b2232; color: #ffb3c0; }
