:root{
  --bg:#080808;--panel:#101010;--panel2:#161616;--panel3:#1d1d1d;--line:#2a2a2a;
  --text:#eeeeee;--sub:#c7c7c7;--muted:#8b8b8b;--accent:#d8d8d8;
  --left:#54a7ff;--right:#ff6f91;--none:#9a9a9a;--lock:#b69cff;
  font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;width:100%;min-height:100%;background:radial-gradient(circle at 50% -20%,#202020 0,#080808 44%,#030303 100%);color:var(--text);overscroll-behavior:none}
body{touch-action:pan-y}button,input,select{font:inherit;color:inherit}button{border:1px solid var(--line);background:#171717;border-radius:11px;min-height:38px;padding:8px 12px;cursor:pointer}button:hover{background:#202020}button:active{transform:translateY(1px)}button.primary{background:#2c2c2c;border-color:#5a5a5a;font-weight:700}button:disabled{opacity:.45;cursor:not-allowed}
input,select{background:#0b0b0b;border:1px solid var(--line);border-radius:10px;min-height:38px;padding:7px 9px;outline:none}input[type=range]{width:100%;padding:0;border:0;accent-color:#bdbdbd}.wrap{width:min(1220px,100%);margin:0 auto;padding:14px clamp(8px,2vw,18px) 22px}
header{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:10px}h1{font-size:clamp(19px,3vw,25px);margin:0;line-height:1.15}.badge{display:inline-flex;border:1px solid var(--line);background:#111;color:var(--sub);border-radius:999px;padding:6px 10px;font-size:12px;white-space:nowrap}.hint{font-size:13px;color:var(--muted);line-height:1.45}
.card{background:linear-gradient(180deg,#121212,#090909);border:1px solid #222;border-radius:18px;box-shadow:0 18px 60px rgba(0,0,0,.45);overflow:hidden;margin-bottom:12px}.upload{display:grid;grid-template-columns:1fr auto;gap:10px;align-items:center;padding:12px}.drop{display:flex;gap:12px;align-items:center;min-height:66px;border:1px dashed #3a3a3a;background:#0a0a0a;border-radius:14px;padding:12px;cursor:pointer}.drop.drag{border-color:#aaa;background:#171717}.dropIcon{width:36px;height:36px;border-radius:11px;background:#181818;border:1px solid #343434;display:grid;place-items:center;color:#ddd;font-weight:800;flex:0 0 auto}.drop strong{display:block;margin-bottom:2px}.drop small{color:var(--muted);line-height:1.35}#fileInput{display:none}.status{padding:0 12px 12px;color:var(--muted);font-size:13px;line-height:1.45;white-space:pre-wrap}.status.err{color:#ff9db1}.status.ok{color:#d0d0d0}.status.warn{color:#f0dca8}.parseLog{display:block;width:calc(100% - 24px);min-height:72px;margin:0 12px 12px;padding:9px;border:1px solid #3a3a3a;border-radius:10px;background:#080808;color:var(--sub);font-size:13px;line-height:1.45;resize:vertical}.playerCard{display:none}.playerCard.ready{display:block}.playerTop{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 12px;border-bottom:1px solid #222;background:#0c0c0c}.titleBox{min-width:0}.titleBox strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.titleBox small{display:block;color:var(--muted);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.stats{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.stat{font-size:12px;color:#ccc;background:#111;border:1px solid #2a2a2a;border-radius:999px;padding:4px 8px}
.stageWrap{position:relative;background:#05070c;touch-action:none;user-select:none;overflow:hidden}.stageInner{position:relative;width:100%;height:auto;background:#05070c}canvas{display:block;width:100%;height:auto;aspect-ratio:16/9;background:#05070c;touch-action:none}.stageWrap:fullscreen{width:100vw;height:100vh;border-radius:0;background:#05070c}.stageWrap:fullscreen .stageInner{width:100vw;height:100vh}.stageWrap:fullscreen canvas{width:100vw;height:100vh;aspect-ratio:auto}.stageWrap:-webkit-full-screen{width:100vw;height:100vh;border-radius:0}.stageWrap:-webkit-full-screen .stageInner{width:100vw;height:100vh}.stageWrap:-webkit-full-screen canvas{width:100vw;height:100vh;aspect-ratio:auto}@media (orientation:portrait){.stageWrap.landscapeFallback:fullscreen .stageInner{position:absolute;left:50%;top:50%;width:100vh;height:100vw;transform:translate(-50%,-50%) rotate(90deg)}.stageWrap.landscapeFallback:fullscreen canvas{width:100vh;height:100vw}.stageWrap.landscapeFallback:-webkit-full-screen .stageInner{position:absolute;left:50%;top:50%;width:100vh;height:100vw;transform:translate(-50%,-50%) rotate(90deg)}.stageWrap.landscapeFallback:-webkit-full-screen canvas{width:100vh;height:100vw}}
.corner,.fsLeft{position:absolute;z-index:5;display:flex;gap:7px}.corner{right:8px;top:8px}.fsLeft{left:8px;top:8px;display:none}.stageWrap:fullscreen .fsLeft,.stageWrap:-webkit-full-screen .fsLeft{display:flex}.corner button,.fsLeft button{background:rgba(0,0,0,.72);backdrop-filter:blur(8px);border-color:#3a3a3a;min-height:34px;padding:7px 10px;border-radius:10px}.controls{padding:11px;display:grid;gap:10px;background:#0a0a0a}.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.row.tight{gap:6px}.row label{color:var(--sub);font-size:13px}.grow{flex:1 1 230px}.timeInput{width:100px}.rateInput{width:76px}.delayInput{width:86px}.volumeInput{width:140px}.sep{width:1px;height:24px;background:#2a2a2a;margin:0 1px}.mediaName{color:var(--muted);font-size:13px;min-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.stageWrap:fullscreen .fsLeft,.stageWrap:-webkit-full-screen .fsLeft{align-items:center}
@media (max-width:760px){.wrap{padding:10px 8px 16px}header{display:block}.badge{margin-top:8px}.upload{grid-template-columns:1fr}.playerTop{display:block}.stats{justify-content:flex-start;margin-top:7px}.row{align-items:stretch}.row>button{flex:1 0 auto}.timeInput{width:86px}.rateInput{width:70px}.delayInput{width:80px}.volumeInput{width:100%}.sep{display:none}}

/* Play/Edit mode shell */
.playModeBar{display:none;align-items:center;gap:12px;padding:8px 12px;border-bottom:1px solid #222;background:#0a0a0a;min-height:44px}
.playModeBar label{display:inline-flex;align-items:center;gap:7px;font-size:13px;color:#ddd;user-select:none}
.playModeBar input{min-height:auto;width:18px;height:18px;padding:0}
body[data-mode="play"] .playModeBar{display:flex}
body[data-mode="play"] .playerTop .stats,
body[data-mode="play"] .controls,
body[data-mode="play"] .fsLeft,
body[data-mode="play"] .corner{display:none!important}
body[data-mode="play"] .stageWrap{touch-action:none;cursor:default}
body[data-mode="play"] .stageInner{transform:none!important}
body[data-mode="play"] canvas{transform:none!important}

/* Custom chart viewport: canvas keeps its authored geometry; only its surrounding
   presentation changes. This is intentionally separate from the backing-store size. */
.ratioInput{width:82px}
.stageWrap.customStageRatio .stageInner{aspect-ratio:var(--mil-stage-ratio,16/9);height:auto}
.stageWrap.customStageRatio canvas{height:100%;aspect-ratio:auto}
.packageChartChooser{display:flex;align-items:center;gap:10px;padding:0 12px 12px;color:var(--sub);font-size:13px}
.packageChartChooser[hidden]{display:none}
.packageChartChooser select{min-width:0;flex:1}
@media(max-width:760px){.packageChartChooser{align-items:stretch;flex-direction:column;gap:6px}}
