: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; min-height: 60px; 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; }

/* ---- steps, stats, roles, record ---- */
.stepnum { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #2a2d38; font-size: 11px; margin-right: 6px; }
.tabs button.on .stepnum { background: var(--accent); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 6px; text-align: center; line-height: 1.25; }
.statn { font-weight: 700; font-size: 16px; }
.center-text { text-align: center; }
.center-text > * + * { margin-top: 8px; }
.roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.role { background: var(--panel2); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.role.mine { border-color: var(--c); box-shadow: 0 0 0 2px var(--c); }
.role.taken { opacity: .72; }
.rolepic { aspect-ratio: 16 / 9; background: #11131a center / cover no-repeat; display: grid; place-items: center; }
.roleinitial { font-size: 34px; font-weight: 800; color: var(--c); }
.rolebody { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rolename { font-weight: 700; font-size: 15px; color: var(--c); }
.roleholder { min-height: 26px; display: flex; align-items: center; }
.rolebody > button, .rolebody > select { width: 100%; }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px 3px 3px; }
.hero { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.heropic { aspect-ratio: 16 / 9; border-radius: 6px; background: #11131a center / cover no-repeat; }
.herotext { font-size: 18px; font-weight: 600; line-height: 1.3; }
button.big { padding: 12px 16px; font-size: 16px; font-weight: 700; }
.lineitem { display: flex; gap: 10px; align-items: flex-start; }
.linepic { width: 64px; aspect-ratio: 16 / 9; border-radius: 4px; background: #11131a center / cover no-repeat; flex: none; margin-top: 2px; }
.linetext { margin: 3px 0 6px; overflow-wrap: anywhere; }
details > summary { cursor: pointer; font-weight: 600; }
@media (max-width: 420px) { .stats { grid-template-columns: repeat(2, 1fr); } .roles { grid-template-columns: 1fr 1fr; } }

/* desktop: the page itself never scrolls; the stage and the side panel scroll on their own */
.room { grid-template-rows: auto minmax(0, 1fr); }
.main { grid-template-rows: minmax(0, 1fr); }
.side { grid-template-rows: auto minmax(0, 1fr); }
@media (min-width: 961px) { .room { height: 100vh; overflow: hidden; } }

/* multi-line captions from packs */
.sub, .herotext, .linetext, .item > div { white-space: pre-line; }

#updatebar { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; gap: 10px; align-items: center; background: #2a2140; border: 1px solid var(--accent2); padding: 8px 12px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.5); max-width: calc(100% - 32px); flex-wrap: wrap; }


/* waveform of the line being voiced */
.wave { width: 100%; height: 96px; display: block; background: #11131a; border-radius: 6px; }

/* waveform on each line */
.minwave { display: block; width: 100%; height: 28px; margin: 2px 0 6px; background: #11131a; border-radius: 4px; }

.tlzoom { margin: 0 0 6px; gap: 8px; }
.tlzoom .seg button { padding: 2px 8px; }

/* ⚙ settings window */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(5,6,10,.6); display: grid; place-items: center; padding: 16px; }
.modalcard { width: min(520px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modalhead { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.modalbody { overflow: auto; padding: 16px; }
.modalbody h3 { margin-top: 6px; }

/* surprise mode / reveal */
.reveal { border-color: #4b3a6b; background: linear-gradient(160deg, rgba(124,92,255,.12), rgba(255,77,109,.06)); }
.reveal.on { border-color: var(--ok); background: linear-gradient(160deg, rgba(62,207,142,.14), rgba(124,92,255,.08)); }
.revealtitle { font-weight: 800; font-size: 16px; }
.modalcard.revealpop { width: min(380px, 100%); padding: 28px 24px; text-align: center; gap: 10px; align-items: center; }
.revealbig { font-size: 56px; line-height: 1; animation: pop .6s ease-out; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }

/* watch together bar */
.syncbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: rgba(124,92,255,.14); border: 1px solid #4b3a6b; }
.syncbar .live { color: var(--accent); animation: pulse 1.2s infinite; }

/* landing / home */
.landing.wide { width: min(640px, 100%); }
.landing.wide > .card { padding: 18px; }
.logo.big { font-size: 30px; }
.logo.big .dot { width: 40px; height: 40px; }
.hero-title { font-size: clamp(26px, 5vw, 38px); line-height: 1.12; letter-spacing: -.02em; margin: 6px 0 0; }
.landing .tagline { font-size: 16px; margin: 0; }
button.discord.big, button.primary.big { width: 100%; padding: 13px; font-size: 16px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.step { display: flex; flex-direction: column; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.stepicon { font-size: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.footnote { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
