:root { --bg:#0b0b10; --panel:#14141c; --text:#e8e6ef; }
* { box-sizing: border-box; }
html, body { height:100%; margin:0; background:var(--bg); color:var(--text); font-family:'Segoe UI',system-ui,sans-serif; overflow:hidden; }
#app { display:flex; height:100vh; height:100dvh; position:relative; }

#sidebar {
  width:300px; min-width:240px; background:var(--panel); display:flex; flex-direction:column;
  border-right:1px solid #26262f; position:absolute; left:0; top:0; bottom:0; z-index:50;
  transition:transform .25s; box-shadow:4px 0 16px rgba(0,0,0,.5);
}
body:not(.menu-open) #sidebar { transform:translateX(-105%); }
.sb-head { padding:18px 16px 10px; }
.sb-head h1 { margin:0; font-size:20px; letter-spacing:1px; }
.sb-head .sub { color:#8a8896; font-size:12px; margin:2px 0 10px; }
#ep-list { overflow-y:auto; flex:1; padding:4px 8px 20px; }
.group-h { font-size:11px; text-transform:uppercase; letter-spacing:2px; color:#74727f; padding:14px 8px 4px; }
.ep-item { padding:6px 10px; border-radius:6px; cursor:pointer; font-size:13.5px; color:#c9c7d4; display:flex; justify-content:space-between; gap:6px; }
.ep-item { content-visibility:auto; contain-intrinsic-size:auto 30px; }
.ep-item:hover { background:#1e1e29; color:#fff; }
.ep-item.active { background:#3a2050; color:#fff; outline:1px solid #7a4a9a; }
.ep-item .ep-t { color:#8a8896; font-size:11.5px; text-align:right; }
.ep-item .ep-p { color:#6ee76e; font-size:10.5px; }
.ep-item.done .ep-n::after { content:" \2713"; color:#6ee76e; }

#stage-wrap { flex:1; display:flex; flex-direction:column; background:#050508; overflow:hidden; position:relative; min-width:0; }
#stage-area { flex:1; display:flex; align-items:center; justify-content:center; min-height:0; }
#scaler { position:relative; flex:none; }
#stage { position:relative; width:320px; height:180px; transform-origin:top left; background:#000; overflow:hidden; contain:strict; -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; touch-action:manipulation; }
#stage img, #stage canvas { position:absolute; }
#bg { left:0; top:0; width:320px; height:180px; }
#bg.px { image-rendering:auto; }
#stage.pxi #bg.px { image-rendering:pixelated; }
#cg-bottom, #cg-top, #portraits, #pics { position:absolute; inset:0; pointer-events:none; }
#cg-bottom img, #cg-top img, #portraits img, #pics img { transform-origin:0 0; will-change:transform; max-width:none; }
#tint { position:absolute; inset:0; background:#000; opacity:0; pointer-events:none; }
#ui, #text, #gp, #pcg, #finalhit, #cred { left:0; top:0; width:320px; height:180px; pointer-events:none; }
#pics-top { position:absolute; inset:0; pointer-events:none; }
#pics-top img { transform-origin:0 0; will-change:transform; max-width:none; }
#cred { z-index:17; }
#gp, #pcg, #finalhit, #cred { image-rendering:pixelated; }
#tl.locked #tl-head { background:#d9a0e8; box-shadow:0 0 6px #d9a0e8; }
#tl-lock { font-size:10.5px; letter-spacing:1.5px; color:#d9a0e8; border:1px solid #5a3a70; border-radius:3px; padding:1px 6px; }
#auto-btn.locked { color:#d9a0e8; border-color:#5a3a70; cursor:not-allowed; }

#titlecard { position:absolute; inset:0; z-index:15; background:#000; transition:opacity .8s; }
#tc-art { left:0; top:0; width:320px; height:180px; }
#transition { position:absolute; inset:0; background:#000; pointer-events:none; z-index:18; opacity:0; clip-path:polygon(50% 50%,50% -60%,-60% 50%,50% 160%); }
#transition.wipe { animation:diamondwipe .9s linear; }
@keyframes diamondwipe {
  0% { clip-path:polygon(50% 50%,50% -60%,-60% 50%,50% 160%); opacity:1; }
  49% { clip-path:polygon(50% 50%,50% -60%,-60% 50%,50% 160%); opacity:1; }
  50% { clip-path:polygon(50% 50%,160% 50%,50% -60%,160% 160%); opacity:1; }
  100% { clip-path:polygon(50% 50%,50% 160%,160% 50%,-60% 160%); opacity:1; }
}
#movie { position:absolute; inset:0; width:320px; height:180px; object-fit:contain; background:#000; z-index:30; }
#stage-ui { position:absolute; top:4px; right:4px; z-index:35; display:flex; gap:4px; opacity:.0; transition:opacity .2s; }
#stage:hover #stage-ui, #stage-ui.show { opacity:1; }
@media (hover:none) { #stage-ui { opacity:1; } }
#stage-ui .btn { font-size:9px; padding:2px 6px; }
body { touch-action:manipulation; }
.btn { background:rgba(20,20,28,.85); color:#d8d6e2; border:1px solid #3a3a48; border-radius:4px; padding:6px 12px; font-size:12.5px; cursor:pointer; }
@media (hover:none) { .btn { padding:8px 14px; font-size:14px; } }
.btn:hover { background:#26262f; color:#fff; }
.hidden { display:none !important; }
@media (max-width:860px) { #sidebar { width:80%; } }

#tl { flex:none; height:40px; display:flex; align-items:center; gap:10px; padding:0 10px; background:#0d0d14; border-top:1px solid #26262f; }
@media (hover:none) { #tl { height:48px; } #tl-bar { height:26px; } }
#tl .btn { padding:3px 10px; font-size:12px; }
#tl-bar { position:relative; flex:1; height:20px; background:#181822; border-radius:3px; cursor:pointer; touch-action:none; }
#tl-marks { position:absolute; inset:0; overflow:hidden; border-radius:3px; }
#tl-marks i { position:absolute; top:0; bottom:0; width:1px; background:#3c3a4c; }
#tl-marks i.l { top:11px; background:#8a6ab0; }
#tl-marks i.p { background:#fff; opacity:.7; }
#tl-marks i.bg { top:0; bottom:11px; background:#4a90e0; }
#tl-marks i.cg { top:0; bottom:11px; background:#e09a4a; }
#tl-marks i.mu { top:0; bottom:11px; background:#5ac878; }
#tl-marks i.mv { top:0; bottom:11px; background:#e05a5a; width:2px; }
#tl-marks i.sw { top:0; bottom:11px; background:#5ac8e0; width:2px; }
#tl-head { position:absolute; top:-3px; bottom:-3px; left:0; width:2px; background:#ff5fa8; box-shadow:0 0 6px #ff5fa8; pointer-events:none; will-change:transform; }
#tl.holding #tl-head { background:#e0b84a; box-shadow:0 0 6px #e0b84a; animation:tlhold 1s infinite; }
@keyframes tlhold { 50% { opacity:.35 } }
#tl-tip { position:absolute; bottom:26px; max-width:420px; background:#14141c; border:1px solid #3a3a48; padding:4px 8px; border-radius:4px; font-size:12px; pointer-events:none; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; z-index:60; }
#tl-pos { font-size:12px; color:#8a8896; min-width:86px; text-align:right; font-variant-numeric:tabular-nums; }
#lines { position:absolute; top:0; right:0; bottom:34px; width:360px; max-width:90%; background:rgba(16,16,24,.96); border-left:1px solid #26262f; z-index:40; display:flex; flex-direction:column; }
#ln-q { margin:8px; padding:6px 8px; background:#0b0b10; color:#e8e6ef; border:1px solid #3a3a48; border-radius:4px; }
#ln-list { overflow-y:auto; flex:1; padding:0 6px 10px; }
.ln { padding:4px 6px; font-size:12.5px; border-radius:4px; cursor:pointer; color:#bdbbc9; line-height:1.3; }
.ln { content-visibility:auto; contain-intrinsic-size:auto 26px; }
.ln:hover { background:#1e1e29; color:#fff; }
.ln.cur { background:#3a2050; color:#fff; }
.ln .n { color:#6a6878; font-size:10.5px; margin-right:6px; }
.ln b { color:#d9a0e8; margin-right:6px; font-weight:600; }
.ln.pb { border-top:1px solid #2a2a36; margin-top:4px; }
.group-h.chapter-h { font-size:13px; color:#d9a0e8; letter-spacing:3px; padding:18px 8px 6px; margin-top:6px; border-top:1px solid #2a2a36; border-bottom:1px solid #3a2050; }
.group-h.chapter-h:first-child { border-top:0; margin-top:0; }
.ep-item.ch-end { border-left:2px solid #d9a0e8; padding-left:8px; margin:3px 0; color:#e6c4f0; font-weight:600; }
#vol-wrap { position:relative; }
#vol { position:absolute; bottom:34px; right:0; width:220px; background:#14141c; border:1px solid #3a3a48; border-radius:6px; padding:10px 12px; z-index:70; display:flex; flex-direction:column; gap:8px; }
#vol label { display:flex; justify-content:space-between; align-items:center; gap:10px; font-size:12px; color:#c9c7d4; }
#vol input { width:120px; accent-color:#d9a0e8; }
#movie-ov { left:0; top:0; width:320px; height:180px; pointer-events:none; z-index:31; }

@keyframes miribob { from { transform:translateY(-1px); } to { transform:translateY(1px); } }
#portraits img.bob { animation:miribob 1.571s ease-in-out infinite alternate; }

#msgs { position:absolute; inset:0; z-index:24; pointer-events:none; }
#msgdim { position:absolute; inset:0; background:rgba(0,0,0,.5); }
.msgw { position:absolute; left:0; top:0; image-rendering:pixelated; transition:transform .5s cubic-bezier(.23,1,.32,1), opacity .5s cubic-bezier(.23,1,.32,1); transform-origin:0 0; }
#msgs.closing .msgw { transition:transform .35s cubic-bezier(.55,0,.68,.19), opacity .35s cubic-bezier(.55,0,.68,.19); }
#msgs.noanim .msgw { transition:none; }

#credits { position:absolute; inset:0; background:#000; z-index:26; overflow:hidden; cursor:pointer; }
.cred-col { position:absolute; left:0; top:0; width:320px; transform:translateY(190px); text-align:center; color:#fff; font-family:monospace; }
.ci { margin:0 auto; padding:2px 0; }
.ci-spr img { image-rendering:auto; display:block; margin:8px auto; max-width:280px; }
.ci-team .cn { font-size:11px; font-weight:bold; }
.ci-team .cu { font-size:8px; opacity:.8; }
.ci-team .cr { font-size:8px; opacity:.75; }
.ci-contrib .cn { font-size:10px; font-weight:bold; color:#fff; }
.ci-contrib .cr { font-size:8px; opacity:.75; }
.ci-song .sn { font-size:10px; font-weight:bold; }
.ci-song .sa { font-size:8px; opacity:.75; }
.ci-spec .sl { font-size:8px; opacity:.8; line-height:1.6; }
#pause-ind { position:absolute; top:4px; left:4px; z-index:34; display:none; font-size:7px; letter-spacing:1.5px; color:#fff; background:rgba(10,10,16,.7); border:1px solid #3a3a48; border-radius:2px; padding:1px 4px; pointer-events:none; }
body.paused #pause-ind { display:block; }
body.paused #stage, body.paused #stage * { animation-play-state:paused !important; }
#pause-btn.on { border-color:#ff5fa8; color:#ff5fa8; }
#tl #pause-btn { min-width:58px; }

/* ?capture: OBS browser source - the stage alone at a fixed 1920x1080, driven from a normal tab */
body.capture, body.capture #app { width:1920px; height:1080px; background:#000; cursor:none; }
body.capture #sidebar, body.capture #tl, body.capture #lines, body.capture #stage-ui, body.capture #pause-ind { display:none !important; }
body.capture #stage-wrap { background:#000; }
#cap-panel { margin-top:10px; padding:8px 10px; border:1px solid #3a3a48; border-radius:6px; background:#0f0f16; font-size:12px; }
#cap-panel.live { border-color:#7a4a9a; }
.cap-link { display:flex; align-items:center; gap:6px; cursor:pointer; color:#e6c4f0; }
#cap-st { color:#8a8896; margin:6px 0; font-variant-numeric:tabular-nums; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cap-btns { display:flex; gap:6px; }
.cap-btns .btn { padding:3px 10px; font-size:12px; }
#cap-panel:not(.live) .cap-btns .btn { opacity:.4; pointer-events:none; }
.ep-item.cap { box-shadow:inset 3px 0 0 #ff5fa8; }
#exp-panel { margin-top:10px; font-size:12px; }
#exp-body { margin-top:8px; padding:8px 10px; border:1px solid #3a3a48; border-radius:6px; background:#0f0f16; display:flex; flex-direction:column; gap:6px; }
#exp-body select, #exp-body input { width:100%; min-width:0; background:#14141c; color:#d8d6e2; border:1px solid #3a3a48; border-radius:4px; padding:4px 6px; font-size:12px; }
.exp-row { display:flex; gap:6px; }
.exp-row .btn { padding:3px 10px; font-size:12px; }
#exp-st { color:#8a8896; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
#exp-st a { color:#c9a6ff; }
body.capture #exp-panel { display:none !important; }
