/* PianoMaster — 深色演奏台 */

:root {
  --bg: #070910;
  --panel: rgba(255, 255, 255, 0.038);
  --panel-hi: rgba(255, 255, 255, 0.07);
  --panel-solid: #151c2e;
  --line: rgba(148, 163, 184, 0.18);
  --line-soft: rgba(148, 163, 184, 0.1);
  --text: #eaf0fa;
  --text-dim: #a6b4cd;
  --text-faint: #7c8ca7;
  --rh: #38bdf8;
  --rh-soft: rgba(56, 189, 248, 0.16);
  --lh: #fbbf24;
  --lh-soft: rgba(251, 191, 36, 0.16);
  --ok: #34d399;
  --bad: #f87171;
  --kb-h: clamp(92px, 15vh, 140px);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 50% -10%, #16203a 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 110%, #1a1430 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 关键：整页四行网格。控制栏与导航条是 auto，永远拿得到自己的高度，
   中间的舞台用 minmax(0,1fr) 吸收剩余空间——绝不会把下面的控件挤出屏幕。 */
.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}
/* 网格项默认 min-width:auto，内容一长就把整列撑得比视口还宽（顶栏最容易中招）。 */
.app > * { min-width: 0; }

/* 所有 canvas 都用「相对定位容器 + 绝对定位画布」。
   canvas 若用 height:100%，Safari 在嵌套 grid 里可能解析失败而退回位图尺寸，
   于是 resize→变大→再 resize 形成反馈循环，把整个布局撑爆。 */
.waterfall-wrap, .keyboard-wrap, .minimap-wrap { position: relative; overflow: hidden; min-width: 0; }
.waterfall-wrap > canvas,
.keyboard-wrap > canvas,
.minimap-wrap > canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

/* ═══════════════ 顶栏 ═══════════════ */

.topbar {
  display: flex; align-items: center; gap: 14px;
  height: 52px; padding: 0 14px; overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(21,28,46,0.92), rgba(13,18,32,0.7));
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.2px; white-space: nowrap; }
.brand .logo { font-size: 19px; filter: drop-shadow(0 0 8px rgba(56,189,248,0.45)); }

.song-select {
  flex: 0 1 auto; min-width: 0;
  background: var(--panel-solid); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 11px; font-family: var(--font); font-size: 13.5px;
  font-weight: 600; max-width: 300px; cursor: pointer;
}
.song-sub { color: var(--text-faint); font-size: 12px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar-right { display: flex; align-items: center; gap: 9px; margin-left: auto; flex: none; }
.pos-readout {
  display: flex; align-items: baseline; gap: 4px;
  font-family: var(--mono);
  background: rgba(56,189,248,0.09); border: 1px solid rgba(56,189,248,0.24);
  border-radius: 9px; padding: 5px 11px;
}
.pos-readout b { font-size: 16px; color: var(--rh); min-width: 26px; text-align: right; }
.pos-readout i { font-style: normal; font-size: 10px; color: var(--text-faint); }

#btnMidi .led {
  width: 7px; height: 7px; border-radius: 50%; background: #64748b;
  display: inline-block; margin-right: 7px; vertical-align: 1px;
}
#btnMidi.active .led { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* ═══════════════ 舞台 ═══════════════ */

.stage { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 0; overflow: hidden; }
.playfield { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) var(--kb-h); min-height: 0; min-width: 0; overflow: hidden; }
.keyboard-wrap { background: linear-gradient(180deg, #0a0e18, #070910); border-top: 1px solid rgba(148,163,184,0.12); }

.hud { position: absolute; top: 11px; left: 13px; display: flex; gap: 7px; flex-wrap: wrap; pointer-events: none; z-index: 2; }
.hud-chip {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: rgba(10,14,25,0.75); border: 1px solid var(--line);
  color: var(--text-dim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hud-chip.section { color: var(--text); font-weight: 600; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-chip.hand-r { color: var(--rh); border-color: rgba(56,189,248,0.35); background: var(--rh-soft); }
.hud-chip.hand-l { color: var(--lh); border-color: rgba(251,191,36,0.35); background: var(--lh-soft); }
.hud-chip.off { opacity: 0.28; }

.judge-hud {
  position: absolute; top: 11px; right: 13px; min-width: 152px; z-index: 2;
  background: rgba(10,14,25,0.82); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); pointer-events: none;
}
.jrow { display: flex; justify-content: space-between; gap: 14px; font-size: 11px; color: var(--text-faint); padding: 2px 0; }
.jrow b { font-family: var(--mono); color: var(--text); font-size: 13px; }

.wait-badge {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 9px;
  background: rgba(248,250,252,0.95); color: #0b1020; font-weight: 650; font-size: 13px;
  padding: 8px 16px; border-radius: 999px; box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.wait-badge .pulse { width: 8px; height: 8px; border-radius: 50%; background: #0ea5e9; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.72); } }

.start-veil {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 6;
  background: radial-gradient(680px 440px at 50% 45%, rgba(13,18,32,0.9), rgba(7,9,16,0.97));
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); overflow: auto;
}
.start-veil.hidden { display: none; }
.veil-card { text-align: center; max-width: 560px; padding: 24px; }
.veil-card h2 { margin: 0 0 16px; font-size: 21px; letter-spacing: 0.4px; }
.veil-how { color: var(--text-dim); line-height: 1.9; margin: 0 0 12px; font-size: 13.5px; }
.veil-legend { color: var(--text-dim); font-size: 13px; margin: 0 0 24px; }
.veil-legend .sep { margin: 0 8px; color: var(--text-faint); }
.veil-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.veil-tip { color: var(--text-faint); font-size: 12px; margin: 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin: 0 5px 0 12px; vertical-align: -1px; }
.veil-legend .dot:first-child { margin-left: 0; }
.dot.r { background: var(--rh); } .dot.l { background: var(--lh); }

/* ═══════════════ 侧栏 ═══════════════ */

.sidebar { border-left: 1px solid var(--line); background: rgba(11,15,26,0.6); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.side-tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.stab {
  flex: 1; background: none; border: none; color: var(--text-faint);
  padding: 11px 8px; font-size: 12.5px; font-family: var(--font); cursor: pointer;
  border-bottom: 2px solid transparent;
}
.stab:hover { color: var(--text-dim); }
.stab.active { color: var(--text); border-bottom-color: var(--rh); }
.side-panel { overflow-y: auto; padding: 10px; flex: 1; min-height: 0; }
.side-hint { font-size: 11.5px; color: var(--text-faint); padding: 2px 4px 10px; line-height: 1.6; }

.section-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.section-item {
  border: 1px solid var(--line-soft); border-radius: 10px; padding: 9px 10px;
  background: rgba(255,255,255,0.028); cursor: pointer; transition: border-color .15s, background .15s;
}
.section-item:hover { border-color: rgba(56,189,248,0.4); background: rgba(255,255,255,0.055); }
.section-item.current { border-color: var(--rh); background: rgba(56,189,248,0.1); }
.section-item.looping { border-color: var(--ok); }
.si-head { display: flex; align-items: center; gap: 8px; }
.si-name { font-size: 12.5px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-range { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.si-loop { background: none; border: 1px solid var(--line); color: var(--text-faint); border-radius: 6px; width: 24px; height: 24px; cursor: pointer; font-size: 12px; line-height: 1; flex: none; }
.si-loop:hover, .si-loop.on { color: var(--ok); border-color: var(--ok); }
.si-diff { display: flex; gap: 2px; margin-top: 5px; }
.si-diff i { width: 12px; height: 3px; border-radius: 2px; background: rgba(148,163,184,0.2); }
.si-diff i.on { background: linear-gradient(90deg, var(--rh), var(--lh)); }
.si-tip { font-size: 11.5px; color: var(--text-dim); line-height: 1.7; margin-top: 6px; display: none; }
.section-item.current .si-tip, .section-item.open .si-tip { display: block; }

.info-block { font-size: 12.5px; color: var(--text-dim); line-height: 1.8; }
.info-block h4 { color: var(--text); font-size: 12.5px; margin: 15px 0 6px; }
.info-block h4:first-child { margin-top: 0; }
.info-block dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; }
.info-block dt { color: var(--text-faint); }
.info-block dd { margin: 0; }
.info-block a { color: var(--rh); }
.info-block ul { margin: 4px 0; padding-left: 16px; }
.info-block li { margin-bottom: 4px; }
.badge-license {
  display: inline-block; font-size: 10.5px; padding: 2px 7px; border: 1px solid var(--line);
  border-radius: 5px; color: var(--text-faint); line-height: 1.6; margin: 4px 6px 4px 0;
}

/* ═══════════════ 导航条 ═══════════════ */

.navbar { position: relative; height: 44px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(9,12,22,0.9); }
.minimap-wrap { height: 44px; cursor: pointer; }
.nav-hint {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--text-faint); pointer-events: none;
  background: rgba(9,12,22,0.88); border: 1px solid var(--line-soft);
  padding: 3px 8px; border-radius: 6px; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}

/* ═══════════════ 控制栏 ═══════════════ */

.controls {
  display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px;
  background: linear-gradient(180deg, rgba(16,22,38,0.85), rgba(9,12,22,0.98));
}

/* 每个功能是一张有边框的卡片——不靠留白分组，一眼就能看出这是几个东西 */
.ctl {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px;
}
.ctl-head { display: flex; align-items: baseline; gap: 8px; }
.ctl-title { font-size: 11px; color: var(--text-dim); letter-spacing: 0.5px; white-space: nowrap; }
.ctl-state { font-size: 10.5px; color: var(--text-faint); font-family: var(--mono); }

/* — 传输 — */
.transport { gap: 6px; }
.tbtn, .playbtn, .stepbtn {
  display: grid; place-items: center; cursor: pointer; border: 1px solid var(--line);
  background: rgba(255,255,255,0.05); color: var(--text); border-radius: 9px;
  transition: background .13s, border-color .13s, transform .07s;
}
.tbtn { width: 36px; height: 36px; }
.tbtn svg { width: 15px; height: 15px; fill: currentColor; }
.tbtn:hover, .stepbtn:hover { background: rgba(255,255,255,0.11); border-color: rgba(148,163,184,0.34); }
.tbtn:active, .playbtn:active, .stepbtn:active { transform: translateY(1px); }
.playbtn {
  width: 52px; height: 40px; border-color: transparent;
  background: linear-gradient(135deg, #0ea5e9, #0369a1);
  box-shadow: 0 3px 14px rgba(14,165,233,0.32);
}
.playbtn svg { width: 18px; height: 18px; fill: #fff; }
.playbtn:hover { background: linear-gradient(135deg, #38bdf8, #0284c7); }
.playbtn.on { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 3px 14px rgba(245,158,11,0.32); }

.jump { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); margin-left: 4px; padding-left: 10px; border-left: 1px solid var(--line-soft); }
.jump .of { color: var(--text-faint); font-family: var(--mono); font-size: 11px; }

input[type="number"] {
  width: 58px; background: rgba(0,0,0,0.3); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 6px 8px; font-family: var(--mono); font-size: 13px; text-align: center;
}
input[type="number"]:focus { outline: none; border-color: var(--rh); box-shadow: 0 0 0 3px rgba(56,189,248,0.16); }
input[type="number"]::-webkit-inner-spin-button { opacity: 0.3; }

/* — 速度（整条里最显眼的一块）— */
.tempo {
  gap: 8px;
  border-color: rgba(56,189,248,0.34);
  background: linear-gradient(180deg, rgba(56,189,248,0.1), rgba(56,189,248,0.035));
}
.tempo .ctl-title { color: var(--rh); font-weight: 600; font-size: 12px; }
.tempo input[type="range"] { width: 104px; flex: none; }
.tempo-read { font-family: var(--mono); color: var(--text); line-height: 1; min-width: 46px; text-align: right; }
.tempo-read b { font-size: 21px; font-weight: 700; }
.tempo-read i { font-style: normal; font-size: 12px; color: var(--text-dim); }
.tempo-bpm { font-family: var(--mono); font-size: 12px; color: var(--rh); min-width: 50px; opacity: 0.85; }
.stepbtn { width: 28px; height: 28px; font-size: 17px; line-height: 1; flex: none; font-family: var(--mono); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; flex: 1; min-width: 90px;
  height: 8px; border-radius: 5px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--rh) var(--fill, 40%), rgba(148,163,184,0.22) var(--fill, 40%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #f8fafc; border: 3px solid var(--rh); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.55);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #f8fafc; border: 3px solid var(--rh); cursor: pointer;
}
output { font-family: var(--mono); font-size: 12px; color: var(--text); min-width: 52px; }

.chips { display: flex; gap: 5px; }
.chip {
  flex: 1; background: rgba(255,255,255,0.05); border: 1px solid var(--line-soft); color: var(--text-dim);
  border-radius: 7px; padding: 4px 0; font-size: 11px; cursor: pointer; font-family: var(--font);
  transition: background .13s, color .13s, border-color .13s;
}
.chip:hover { color: var(--text); border-color: var(--line); background: rgba(255,255,255,0.1); }
.chip.on { background: var(--rh-soft); border-color: rgba(56,189,248,0.5); color: var(--rh); font-weight: 600; }

/* 预备拍倒数 */
.countin {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center;
  pointer-events: none; background: rgba(7,9,16,0.35);
}
.countin b {
  font-family: var(--mono); font-size: clamp(56px, 12vh, 96px); font-weight: 700;
  color: #f8fafc; text-shadow: 0 6px 40px rgba(56,189,248,0.5); line-height: 1;
}
.countin span { display: block; font-size: 13px; color: var(--text-dim); margin-top: 10px; text-align: center; }

/* — 手 — */
.hands { gap: 10px; }
.seg { display: flex; background: rgba(0,0,0,0.28); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.segbtn {
  flex: 1; background: none; border: none; color: var(--text-dim); padding: 7px 14px;
  font-size: 13px; cursor: pointer; font-family: var(--font); transition: background .13s, color .13s;
}
.segbtn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.segbtn.active { background: rgba(56,189,248,0.2); color: var(--rh); font-weight: 600; }
.segbtn[data-hand="L"].active { background: rgba(251,191,36,0.2); color: var(--lh); }

.switch { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); cursor: pointer; user-select: none; }
.switch input {
  appearance: none; -webkit-appearance: none; width: 34px; height: 19px; border-radius: 10px;
  background: rgba(148,163,184,0.26); position: relative; cursor: pointer; transition: background .15s; flex: none;
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  border-radius: 50%; background: #cbd5e1; transition: transform .15s;
}
.switch input:checked { background: var(--rh); }
.switch input:checked::after { transform: translateX(15px); background: #fff; }

/* — 循环 — */
.loop { gap: 5px; }
.loop input[type="number"] { width: 46px; padding: 6px 4px; }
.loop .dash { color: var(--text-faint); }
.loop .ctl-state { margin-left: 3px; }

/* — 快捷键提示条（顺便把第二行填满）— */
.hints {
  background: none; border: none; padding: 6px 2px; gap: 3px;
  font-size: 11.5px; color: var(--text-faint); flex-wrap: wrap;
  flex: 0 1 auto; min-width: 0;
}
.hints kbd {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-dim);
  background: rgba(255,255,255,0.07); border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 6px; margin: 0 3px;
}
.hints .hsep { margin: 0 7px; opacity: 0.5; }

/* — 设置 — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 14px; font-size: 13px; font-family: var(--font);
  cursor: pointer; transition: background .13s, border-color .13s, transform .07s; white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(148,163,184,0.36); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255,255,255,0.07); }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 7px; }
.btn.icon { padding: 7px 11px; }
.btn.wide { width: 100%; }
.btn.solid { background: rgba(56,189,248,0.2); border-color: rgba(56,189,248,0.5); color: var(--rh); font-weight: 600; }
.btn.solid:hover { background: rgba(56,189,248,0.3); }
.btn.primary { background: linear-gradient(135deg, #0ea5e9, #0284c7); border-color: transparent; font-weight: 600; color: #fff; }
.btn.primary:hover { background: linear-gradient(135deg, #38bdf8, #0ea5e9); }
.btn.big { padding: 12px 26px; font-size: 14.5px; border-radius: 11px; }
.btn.active { border-color: var(--rh); color: var(--rh); background: var(--rh-soft); }
.btn.settings { padding: 7px 15px; font-size: 13px; font-weight: 600; background: rgba(255,255,255,0.09); border-color: rgba(148,163,184,0.3); }
.btn.settings .gear { width: 15px; height: 15px; fill: currentColor; }
.btn.settings:hover { background: rgba(56,189,248,0.18); border-color: rgba(56,189,248,0.5); color: var(--rh); }

/* ═══════════════ 设置面板 ═══════════════ */

.sheet-backdrop { position: fixed; inset: 0; background: rgba(4,6,12,0.6); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); z-index: 40; animation: fade .16s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(392px, 92vw); z-index: 41;
  background: #0f1523; border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  box-shadow: -24px 0 60px rgba(0,0,0,0.55);
  animation: slidein .2s cubic-bezier(.2,.8,.3,1);
}
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-head h3 { margin: 0; font-size: 16px; }
.sheet-body { overflow-y: auto; padding: 6px 18px 26px; flex: 1; min-height: 0; }

.sgroup { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.sgroup:last-child { border-bottom: none; }
.sgroup h4 { margin: 0 0 12px; font-size: 11px; color: var(--rh); letter-spacing: 1px; text-transform: uppercase; }
.srow { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; color: var(--text-dim); }
.srow:last-child { margin-bottom: 0; }
.slabel { min-width: 62px; flex: none; color: var(--text-dim); }
.srow select {
  background: rgba(0,0,0,0.3); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; font-size: 12.5px; font-family: var(--font); flex: 1; cursor: pointer;
}
.srow input[type="range"] { flex: 1; }
.srow.switch { align-items: flex-start; }
.srow.switch span { line-height: 1.45; padding-top: 1px; }
.srow.switch em { display: block; font-style: normal; font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.snote { font-size: 11px; color: var(--text-faint); line-height: 1.65; margin: 12px 0 0; }

/* ═══════════════ 弹窗 / 提示 ═══════════════ */

dialog.help {
  background: var(--panel-solid); color: var(--text); border: 1px solid var(--line);
  border-radius: 14px; padding: 24px 28px; max-width: 540px; box-shadow: 0 24px 70px rgba(0,0,0,0.65);
}
dialog.help::backdrop { background: rgba(5,7,13,0.74); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.help h3 { margin: 20px 0 10px; font-size: 13px; color: var(--rh); }
dialog.help h3:first-child { margin-top: 0; }
dialog.help table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
dialog.help td { padding: 4px 0; color: var(--text-dim); }
dialog.help td:first-child { font-family: var(--mono); color: var(--text); width: 140px; }
dialog.help ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-dim); line-height: 1.9; }
dialog.help .btn { margin-top: 20px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: rgba(20,27,45,0.97); border: 1px solid var(--line); color: var(--text);
  padding: 11px 20px; border-radius: 10px; font-size: 13px; z-index: 50;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}

/* ═══════════════ 自适应 ═══════════════ */

/* 矮屏：先压缩键盘和留白，保证控制栏完整可见 */
@media (max-height: 720px) {
  :root { --kb-h: clamp(84px, 13vh, 112px); }
  .controls { padding: 8px 12px; gap: 10px; }
  .ctl { padding: 6px 10px; }
  .veil-card h2 { margin-bottom: 10px; font-size: 19px; }
  .veil-how, .veil-legend { margin-bottom: 10px; }
  .veil-actions { margin-bottom: 10px; }
}
@media (max-height: 600px) {
  .navbar, .minimap-wrap { height: 38px; }
  .topbar { height: 48px; }
}

/* 窄屏 */
@media (max-width: 1180px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
}
@media (max-width: 1240px) { .hint-more { display: none; } }
@media (max-width: 900px) {
  .song-sub { display: none; }
  .brand-name { display: none; }
  .chips { display: none; }
}
@media (max-width: 900px) { .hints { display: none; } }
@media (max-width: 700px) {
  .jump { display: none; }
  .ctl.loop .ctl-state { display: none; }
}
