:root {
  --bg: #f5f7fb;
  --bg2: #eef2f8;
  --panel: #ffffff;
  --panel2: #f4f6fb;
  --line: #dbe2ee;
  --text: #1a2233;
  --muted: #6c7898;
  --accent: #f0a020;
  --accent2: #4a90e2;
  --good: #20a890;
  --bad: #e04a4a;
  --radius: 12px;
  font-size: 15px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(240,160,32,.08), transparent 60%),
    radial-gradient(1000px 700px at -10% 110%, rgba(74,144,226,.06), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #eef2f8 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
#app { display: grid; grid-template-columns: 300px 1fr; height: 100vh; height: 100dvh; }

/* 移动端抽屉遮罩:桌面不参与 grid 布局,窄屏才显示 */
.sb-mask { display: none; }

/* ---------- 侧栏折叠 ---------- */
.sidebar { min-width: 0; overflow: hidden; }
#app.sidebar-collapsed { grid-template-columns: 0 1fr; }
#app.sidebar-collapsed .sidebar { border-right-color: transparent; }
.icon-btn {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  transition: color .12s, border-color .12s, background .12s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); background: var(--bg2); }
.player-head-left { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }

/* ---------- 侧栏 ---------- */
.sidebar {
  background: linear-gradient(180deg, #ffffff, #f3f6fc);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
  box-shadow: 2px 0 6px rgba(20, 40, 80, .04);
}
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.brand-text { flex: 1; min-width: 0; }
.brand h1 { font-size: 17px; margin: 0; letter-spacing: .5px; color: var(--text); }
.brand-sub { font-size: 12px; color: var(--muted); }

.side-actions { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }
#search {
  width: 100%; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); outline: none;
}
#search:focus { border-color: var(--accent); }

.song-list { list-style: none; margin: 0; padding: 6px 10px; overflow-y: auto; flex: 1; }
.song-item {
  padding: 10px 12px; border-radius: 10px; cursor: pointer; margin-bottom: 4px;
  border: 1px solid transparent;
}
.song-item:hover { background: #f4f6fb; }
.song-item.active {
  background: linear-gradient(90deg, rgba(240,160,32,.14), rgba(240,160,32,.04));
  border-color: rgba(240,160,32,.4);
}
.song-item .si-name { font-size: 14px; line-height: 1.35; color: var(--text); }
.song-item .si-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.song-item.invalid .si-name { color: var(--bad); }
.song-count { padding: 10px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); background: #f9fafd; }

/* ---------- 主区 ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 18px 22px 16px; gap: 12px; }
.player-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.song-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.song-meta h2 { margin: 0; font-size: 22px; color: var(--text); }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 12px; color: var(--muted); background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px;
}

.view-toggle { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg { background: transparent; color: var(--muted); border: 0; padding: 8px 14px; cursor: pointer; font-size: 13px; }
.seg:hover { color: var(--text); }
.seg.active { background: var(--accent); color: #ffffff; font-weight: 600; }

.parse-error {
  background: rgba(224, 74, 74, .08); border: 1px solid rgba(224, 74, 74, .4);
  color: #b53636; border-radius: 10px; padding: 10px 14px; font-size: 13px;
}

/* ---------- 乐谱视区(保留米黄纸面) ---------- */
.score-viewport {
  position: relative; flex: 1; min-height: 180px; overflow: auto;
  background: linear-gradient(180deg, #fdf8ee, #f3ead8);
  border-radius: var(--radius); border: 1px solid #d8c9a8;
  color: #2a2113;
  box-shadow: 0 6px 20px rgba(40, 60, 100, .12);
}
.score-body { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px 24px; padding: 26px 28px; min-height: 100%; }
.bar-sep { width: 2px; align-self: stretch; background: #8a7650; margin: 0 5px; border-radius: 2px; }

.note {
  position: relative; width: 44px; flex: 0 0 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6px 0 5px; border-radius: 8px; user-select: none;
}
.note .glyph { font-size: 22px; font-weight: 700; line-height: 1.1; }
.note .sub { font-size: 10px; color: #7a6a45; margin-top: 2px; white-space: nowrap; }
.note .glyphwrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.note .dots { font-size: 12px; font-weight: 700; line-height: 1; z-index: 1; }
/* 上标(升号/高八度点):完全在圆圈外,不占位 */
.note .dots.top { position: absolute; top: -15px; }
/* 下标(低八度点):圆圈正下方独立一行(空则占位,保持各音符高度一致) */
.note .dots.low { margin-top: 1px; height: 12px; color: #1d6fd6; }
.note.rest .glyph { color: #9a8b68; }

/* 简谱视图:数字圆圈包裹(按键视图不套圈) */
.note:not(.keys-view) .glyph {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1;
  background: linear-gradient(180deg, #fffef8, #f1e6cf);
  border: 1.6px solid #a08a5c;
  color: #2a2113;
  box-shadow: 0 1px 2px rgba(60, 45, 20, .18);
}
.note.rest:not(.keys-view) .glyph {
  background: #f3ecdc; border-color: #c9ba96; color: #9a8b68;
}
.note.playing:not(.keys-view) .glyph {
  background: linear-gradient(180deg, #ffb84d, #f08a1e);
  border-color: #c96f10; color: #ffffff;
}
.note.played { background: rgba(74, 144, 226, .18); }
.note.playing { background: var(--accent); color: #ffffff; box-shadow: 0 4px 14px rgba(240,160,32,.5); transform: translateY(-2px); }
.note.playing .sub { color: #5a3c05; }
.note.unplayable { outline: 2px dashed var(--bad); }

.playhead {
  position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad);
  left: 0; pointer-events: none; box-shadow: 0 0 8px rgba(224, 74, 74, .8);
}

/* 指法视图 */
.note.keys-view { width: 64px; flex-basis: 64px; }
.note.keys-view .kcap {
  font-size: 16px; font-weight: 800; background: #2a2113; color: #ffe6b0;
  border-radius: 6px; padding: 2px 8px; margin-top: 3px;
}
.note.keys-view .mbits { font-size: 10px; margin-top: 2px; letter-spacing: 1px; }
.mbits .b-on { color: var(--bad); font-weight: 800; }
.mbits .b-off { color: #b7a882; }

/* ---------- 进度/控制 ---------- */
.progress-wrap { display: flex; align-items: center; gap: 12px; }
.progress {
  flex: 1; height: 8px;
  background: #e2e8f1; border-radius: 999px; overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(20, 40, 80, .08);
}
.progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  transition: width .08s linear;
}
.time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 14px; cursor: pointer; font-size: 14px;
  box-shadow: 0 1px 2px rgba(20, 40, 80, .04);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn:hover { border-color: var(--accent); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #ff8a18); color: #ffffff;
  border-color: transparent; font-weight: 700;
  box-shadow: 0 3px 10px rgba(240, 160, 32, .35);
}
.btn.primary svg { color: #ffffff; }
.btn.primary:disabled { filter: grayscale(.6) brightness(.85); cursor: not-allowed; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(20, 40, 80, .04); }
.btn.big { min-width: 120px; }
.btn.big span { letter-spacing: .5px; }
.ctl { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.ctl input[type=range] { width: 110px; accent-color: var(--accent); }
.ctl-val { width: 42px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.ctl select {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px;
}

/* ---------- 口琴 ---------- */
.harmonica {
  background:
    linear-gradient(180deg, #ffffff 0%, #fafbfd 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px 14px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow:
    0 1px 0 rgba(255,255,255,.9) inset,
    0 4px 16px rgba(20, 40, 80, .06),
    0 1px 2px rgba(20, 40, 80, .04);
}

/* 折叠态:整个口琴区隐藏(折叠按钮位于控制条) */
.harmonica-collapsed .harmonica { display: none; }

/* 三个调音鼠标按键 —— 定制鼠标 SVG 图标(左/中/右键位置分别高亮) */
.mods { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.mod {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #f5f7fb;
  border: 1px solid var(--line);
  font-size: 12.5px;
  transition: background .12s, border-color .12s, box-shadow .12s, transform .06s;
  overflow: hidden;
}
.mod .mouse-icon {
  width: 26px; height: 26px;
  flex: 0 0 auto;
  color: #4a5568;
  transition: color .15s, transform .15s;
}
.mod .mouse-icon .body {
  fill: #ffffff;
  stroke: #6b7280;
  stroke-width: 1.4;
}
.mod .mouse-icon .btn-line {
  stroke: #9aa4b2;
  stroke-width: 1.2;
}
.mod .mouse-icon .btn-divider {
  stroke: #9aa4b2;
  stroke-width: 1.2;
  stroke-dasharray: 1.5 1.5;
}
.mod .mouse-icon .btn-shape {
  fill: transparent;
  stroke: transparent;
  transition: fill .18s, stroke .18s;
}
.mod .mod-key { color: var(--text); font-weight: 600; flex: 1; min-width: 0; }
.mod .mod-off { color: var(--muted); font-size: 11.5px; font-family: monospace; }

/* 高亮态 —— 对应按键区变实心 + 微缩放 */
.mod.on#mod-left .mouse-icon { transform: scale(1.08); }
.mod.on#mod-left .mouse-icon .btn-left.btn-shape { fill: #d94646; stroke: #b53636; stroke-width: 1.4; }

.mod.on#mod-middle .mouse-icon { transform: scale(1.08); }
.mod.on#mod-middle .mouse-icon .btn-shape { fill: #d97706; stroke: #b45309; stroke-width: 1.4; }

.mod.on#mod-right .mouse-icon { transform: scale(1.08); }
.mod.on#mod-right .mouse-icon .btn-right.btn-shape { fill: #2563eb; stroke: #1e40af; stroke-width: 1.4; }

.mod.on#mod-left    { border-color: rgba(217, 70, 70, .4);  background: linear-gradient(90deg, rgba(217, 70, 70, .06),  #f5f7fb); }
.mod.on#mod-middle  { border-color: rgba(217, 119, 6, .4);  background: linear-gradient(90deg, rgba(217, 119, 6, .06),  #f5f7fb); }
.mod.on#mod-right   { border-color: rgba(37, 99, 235, .4);  background: linear-gradient(90deg, rgba(37, 99, 235, .06),  #f5f7fb); }

.mod.on#mod-left   .mod-key { color: #b53636; }
.mod.on#mod-middle .mod-key { color: #b45309; }
.mod.on#mod-right  .mod-key { color: #1e40af; }

.mod.on {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(20, 40, 80, .08);
}
.mod.on .mod-off { color: var(--text); font-weight: 600; }

/* 8 键口琴 —— 金属琴盒 */
.keys-wrap {
  position: relative;
  background:
    linear-gradient(180deg, #2a2418 0%, #1c1610 50%, #100a06 100%);
  padding: 14px 14px 12px;
  border-radius: 14px;
  border: 1px solid #3a2e1c;
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,.5),
    inset 0 1px 0 rgba(255,255,255,.05),
    0 4px 16px rgba(20, 40, 80, .15),
    0 1px 2px rgba(20, 40, 80, .1);
}
/* 顶部金属反光 */
.keys-wrap::before {
  content: "";
  position: absolute; left: 14px; right: 14px; top: 5px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
}
/* 左右两颗铆钉 */
.keys-wrap::after {
  content: "";
  position: absolute; left: 7px; top: 50%;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #d8c89a, #6a5a30);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.4),
    0 1px 2px rgba(0,0,0,.4);
  transform: translateY(-50%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.4),
    0 1px 2px rgba(0,0,0,.4),
    20px 0 0 -1px radial-gradient(circle at 30% 30%, #d8c89a, #6a5a30),
    calc(100% - 27px) 0 0 -1px radial-gradient(circle at 30% 30%, #d8c89a, #6a5a30);
}

.keys {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  position: relative;
}
.key {
  position: relative;
  height: 98px;
  border-radius: 10px 10px 7px 7px;
  cursor: pointer;
  background:
    linear-gradient(180deg, #ffffff 0%, #e8ecf2 45%, #c8cfdb 100%);
  color: #1a2030;
  border: 1px solid #8896ad;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  padding-bottom: 11px;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 -12px 14px rgba(0,0,0,.12),
    0 3px 0 #5a667e,
    0 5px 8px rgba(0,0,0,.3),
    inset 0 -3px 0 rgba(0,0,0,.05);
  transition: transform .06s, box-shadow .06s, background .06s, color .06s;
  user-select: none;
}
/* 琴键顶部高光 */
.key::before {
  content: "";
  position: absolute; left: 10%; right: 10%; top: 6px; height: 5px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0));
  border-radius: 3px;
}
/* 琴键底座分隔线 */
.key::after {
  content: "";
  position: absolute; left: 12%; right: 12%; bottom: 6px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,.2), transparent);
}
.key .kn {
  font-size: 24px;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
  position: relative; z-index: 1;
}
.key .kp {
  font-size: 10.5px; color: #5a667e;
  font-weight: 600;
  margin-top: 3px;
  position: relative; z-index: 1;
  letter-spacing: .3px;
}
.key.pressed {
  transform: translateY(4px);
  background: linear-gradient(180deg, #ffc869 0%, #ff8a18 60%, #d97706 100%);
  color: #2a1206;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.6),
    inset 0 -4px 0 rgba(0,0,0,.18),
    0 1px 0 #5a667e,
    0 0 22px rgba(255, 160, 32, .6);
}
.key.pressed .kp { color: #5a3c05; }
.key.pressed .kn {
  color: #2a1206;
  text-shadow: 0 1px 0 rgba(255,255,255,.4);
}

.manual-hint {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
  padding: 2px 4px 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.manual-hint::before {
  content: "💡";
  font-size: 13px;
  opacity: .8;
}
.manual-hint b { color: var(--text); font-weight: 700; }
.hint-mobile { display: none; }
.manual-hint code {
  background: #f4f6fb;
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--text);
  font-size: 12px;
}

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(20, 40, 80, .35); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 50;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(520px, 92vw); max-height: 88vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 24px; position: relative;
  box-shadow: 0 20px 50px rgba(20, 40, 80, .18);
}
.modal-card.wide { width: min(820px, 94vw); }
.modal-card h2 { margin: 0 0 14px; font-size: 19px; color: var(--text); }
.modal-x {
  position: absolute; right: 12px; top: 10px; background: transparent; border: 0;
  color: var(--muted); font-size: 24px; cursor: pointer;
}
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.help-grid h3 { font-size: 14px; color: var(--accent); margin: 12px 0 6px; }
.help-grid p, .help-grid li { font-size: 13.5px; line-height: 1.65; color: #3a455e; }
.help-grid code { background: var(--bg2); padding: 1px 6px; border-radius: 5px; color: var(--accent); }
.field { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.field input, .field textarea {
  width: 100%; margin-top: 5px; background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font: inherit;
  outline: none;
}
.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 160, 32, .25);
}
.field textarea { font-family: Consolas, monospace; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- 练习模式 ---------- */
.btn-practice.on {
  background: linear-gradient(135deg, var(--good), #17a08a);
  color: #ffffff; border-color: transparent; font-weight: 700;
  box-shadow: 0 3px 10px rgba(32, 168, 144, .35);
}
.btn-practice.on svg { color: #ffffff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.practice-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(32,168,144,.08), rgba(240,160,32,.08));
  border: 1px solid rgba(32, 168, 144, .35);
  border-radius: 12px; padding: 8px 14px;
}
.practice-bar[hidden] { display: none; }
.p-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.p-stat b { font-size: 15px; font-variant-numeric: tabular-nums; margin-right: 1px; }
.p-stat.ok b { color: var(--good); }
.p-stat.err b { color: var(--bad); }
.p-stat.miss b { color: #8a6d3b; }
.p-stat.acc b { color: var(--accent2); }
.p-stat.streak b { color: var(--accent); }
.p-opts { display: flex; align-items: center; gap: 14px; }
.p-status { font-size: 13px; font-weight: 600; color: var(--text); }
.p-status.err { color: var(--bad); }
.p-opts .ctl { font-size: 12.5px; gap: 5px; }
.p-opts .ctl input { width: auto; accent-color: var(--good); }

/* 练习音符格状态:目标 / 正确 / 错误 / 漏音 */
.note.p-target {
  outline: 2.5px solid var(--accent2); outline-offset: 1px;
  background: rgba(74, 144, 226, .16);
  animation: pPulse 1.1s ease-in-out infinite;
}
@keyframes pPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 144, 226, .35); }
  50% { box-shadow: 0 0 0 7px rgba(74, 144, 226, 0); }
}
.note.p-ok { background: rgba(32, 168, 144, .24) !important; }
.note.p-ok .glyph { color: var(--good) !important; }
.note.p-ok .sub { color: #1d7a6a !important; }
.note.p-err { background: rgba(224, 74, 74, .32) !important; animation: pErr .4s ease; }
.note.p-err .glyph { color: var(--bad) !important; }
.note.p-miss { background: rgba(138, 109, 59, .18) !important; }
.note.p-miss .glyph { color: #8a6d3b !important; }
@keyframes pErr { 0% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* ---------- 平板/窄屏 ---------- */
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  /* 覆盖桌面全局的折叠规则:手机端收起侧栏时主区仍占满整行 */
  #app.sidebar-collapsed { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .help-grid { grid-template-columns: 1fr; }

  /* 侧栏改为左侧抽屉弹窗:默认收起(滑出屏幕),展开时滑入+遮罩 */
  .sb-mask {
    display: block; position: fixed; inset: 0; z-index: 35;
    background: rgba(20, 40, 80, .38); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .25s ease;
  }
  #app:not(.sidebar-collapsed) .sb-mask { opacity: 1; pointer-events: auto; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 40;
    max-height: none; border-right: 0;
    box-shadow: 8px 0 30px rgba(20, 40, 80, .28);
    transform: translateX(-100%); transition: transform .25s ease;
  }
  #app:not(.sidebar-collapsed) .sidebar { transform: translateX(0); }
  body.sb-lock { overflow: hidden; }

  .main { padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); gap: 10px; }
  .hint-desktop { display: none; }
  .hint-mobile { display: inline; }
  /* 窄屏折叠按钮加大,便于拇指触控 */
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn svg { width: 19px; height: 19px; }
  .song-meta h2 { font-size: 19px; }
  .score-body { gap: 6px 12px; padding: 18px 14px; }
  .note { width: 38px; flex-basis: 38px; padding: 5px 0 4px; }
  .note:not(.keys-view) .glyph { width: 27px; height: 27px; font-size: 16px; }
  .note .dots.top { top: -13px; }
  .note.keys-view { width: 52px; flex-basis: 52px; }
  .note.keys-view .kcap { font-size: 14px; padding: 1px 6px; }
  .harmonica { padding: 12px 12px 10px; gap: 10px; }
  .key { height: 84px; }
  .controls { gap: 10px; }
  .ctl input[type=range] { width: 90px; }
  .practice-bar { padding: 8px 10px; gap: 8px; }
  .p-stats { gap: 10px; }
  /* iOS 输入框聚焦不缩放 */
  #search, .field input, .field textarea { font-size: 16px; }
  .song-item:active { background: #e9edf5; }
}

/* ---------- 手机 ---------- */
@media (max-width: 480px) {
  .brand { padding: 12px 14px 10px; }
  .song-meta h2 { font-size: 17px; }
  .badge { font-size: 11px; padding: 2px 8px; }
  .seg { padding: 7px 10px; font-size: 12.5px; }
  .view-toggle { border-radius: 8px; }
  .btn { padding: 8px 10px; font-size: 13px; border-radius: 8px; }
  .btn.big { min-width: 0; flex: 1; justify-content: center; }
  .controls { gap: 8px; }
  .ctl { font-size: 12px; }
  .ctl input[type=range] { width: 76px; }
  .score-body { gap: 5px 8px; padding: 14px 10px; }
  .note { width: 34px; flex-basis: 34px; }
  .note:not(.keys-view) .glyph { width: 24px; height: 24px; font-size: 14px; border-width: 1.4px; }
  .note .dots.top { top: -12px; font-size: 11px; }
  .note .dots.low { height: 11px; font-size: 11px; }
  .note .sub { font-size: 9px; }
  .bar-sep { margin: 0 3px; }
  .harmonica { padding: 10px 8px 8px; gap: 8px; border-radius: 12px; }
  .mods { gap: 5px; }
  .mod { padding: 7px 8px; gap: 6px; font-size: 11.5px; border-radius: 8px; }
  .mod .mouse-icon { width: 22px; height: 22px; }
  .keys { gap: 4px; }
  .key { height: 74px; border-radius: 8px 8px 6px 6px; padding-bottom: 8px; }
  .key .kn { font-size: 19px; }
  .key .kp { font-size: 9px; margin-top: 2px; }
  .manual-hint { font-size: 11.5px; line-height: 1.6; }
  .modal-card { padding: 16px 14px; border-radius: 14px; }
  .practice-bar { flex-direction: column; align-items: stretch; }
  .p-stats { justify-content: center; }
  .p-opts { justify-content: space-between; }
  .progress-wrap { gap: 8px; }
  .time { font-size: 11px; }
}

::selection { background: var(--accent); color: #ffffff; }