/* 民乐调音器 · 节拍器 —— 国风浅色主题（宣纸/竹青/朱砂），移动端优先 */
:root {
  --bg: #F7F2E7;
  --bg-soft: #EFE8D8;
  --card: #FFFDF6;
  --card-edge: #E4DAC4;
  --text: #35301F;
  --text-dim: #857B62;
  --text-faint: #A99E82;
  --red: #C2452F;        /* 朱砂 */
  --red-deep: #A03422;
  --green: #3E8E5C;      /* 准音：此刻准了（高亮） */
  --green-dim: #8FB693;  /* 准音：这个音以前调过（历史标记，别和「此刻准了」抢） */
  --gold: #B8894A;
  --bamboo: #5F8C5A;     /* 竹青 */
  --bamboo-deep: #48714A;
  --ink: #2F2A20;
  --serif: "Kaiti SC", "STKaiti", "KaiTi", "Noto Serif SC", "SimSun", serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 整页锁定一屏：调音时不需要上下滑动，所有区块按弹性比例分屏 */
html { background: var(--bg); height: 100%; }
html, body { overflow: hidden; }
/* ---------- 当成 App 用：禁掉浏览器的「手势放大」 ----------
   三件事一起做，缺一件在部分机型上就会漏：
   1) meta viewport 写 maximum-scale=1 / user-scalable=no（见 index.html）
   2) touch-action: manipulation —— 关掉「双击缩放」这个浏览器自带的判定，
      但保留单击与滑动，所以按钮点击手感不受影响（比 none 安全，none 会让长按滚动全废）
   3) user-select: none —— 连点两下时浏览器会顺手把附近的字选中，
      选中态一出现页面就会泛蓝，像出了故障；输入框单独放开。
   双指捏合由 app.js 里的 touchmove 拦截兜底（安卓 Chrome 会忽略 meta 那层）。 */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-user-select: none; user-select: none; }
input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }
body {
  background:
    radial-gradient(90% 30% at 50% 0%, #FBF7EC 0%, transparent 70%),
    repeating-linear-gradient(0deg, rgba(140,120,80,0.025) 0 2px, transparent 2px 5px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  height: 100%;
  overscroll-behavior: none;
}
#app {
  max-width: 520px; margin: 0 auto;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; overflow: hidden; overflow-x: clip;
}
.view[hidden] { display: none; }
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
/* hidden 属性优先于任何 display 声明（避免 .auto-follow 之类的 flex 规则把隐藏元素顶出来） */
[hidden] { display: none !important; }

.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(90, 70, 30, 0.06);
}

/* ---------- 首页 ---------- */
.hero { display: flex; align-items: center; gap: 18px; padding: 22px 6px 24px; }
.hero-seal {
  width: 64px; height: 64px; flex-shrink: 0;
  background: linear-gradient(160deg, #CE5540 0%, var(--red-deep) 100%);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 700; color: #FFF6EA;
  font-family: var(--serif);
  box-shadow: 0 6px 18px rgba(160, 52, 34, 0.25);
}
.hero-text h1 { font-size: 27px; font-weight: 700; letter-spacing: 4px; font-family: var(--serif); }
.hero-text p { margin-top: 6px; font-size: 12.5px; color: var(--text-dim); letter-spacing: 1px; }

.entry-grid { display: flex; flex-direction: column; gap: 16px; }
.entry-card {
  position: relative; overflow: hidden; cursor: pointer;
  background: linear-gradient(150deg, #FFFDF6 0%, #F9F3E2 100%);
  border: 1px solid var(--card-edge); border-radius: 20px;
  padding: 24px 22px;
  box-shadow: 0 3px 14px rgba(90,70,30,0.08);
}
.entry-card::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, rgba(95,140,90,0.10), transparent 70%);
}
.entry-card:first-child::after { background: radial-gradient(circle, rgba(194,69,47,0.10), transparent 70%); }
.entry-card:active { transform: scale(0.985); }
.entry-icon { width: 52px; height: 52px; color: var(--red); }
#cardMetro .entry-icon { color: var(--bamboo-deep); }
.entry-icon svg { width: 100%; height: 100%; }
.entry-name { margin-top: 14px; font-size: 21px; font-weight: 700; font-family: var(--serif); letter-spacing: 3px; }
.entry-desc { margin-top: 5px; font-size: 12.5px; color: var(--text-dim); }

.foot-note { text-align: center; font-size: 11.5px; color: var(--text-faint); margin-top: 24px; line-height: 1.8; }

/* ---------- 顶栏 ---------- */
.bar { display: flex; align-items: center; gap: 8px; padding: 2px 0 10px; flex-shrink: 0; }
.bar h2 { font-size: 18px; font-weight: 600; flex: 1; text-align: center; font-family: var(--serif); letter-spacing: 2px; }
.bar-slot { width: 40px; }
.back {
  width: 40px; height: 40px; border: 1px solid var(--card-edge); border-radius: 12px;
  background: var(--card); color: var(--text); font-size: 20px; cursor: pointer;
}
.icon-btn {
  width: 40px; height: 40px; border: 1px solid var(--card-edge); border-radius: 12px;
  background: var(--card); color: var(--text); font-size: 18px; cursor: pointer;
}

/* 乐器选择条 */
.inst-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px 8px; flex-shrink: 0; }
.inst-cur {
  font-size: 16px; font-weight: 700; color: var(--red-deep);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inst-switch {
  margin-left: auto; padding: 8px 16px; border-radius: 20px; cursor: pointer; white-space: nowrap; flex-shrink: 0;
  background: var(--card); border: 1px solid var(--bamboo);
  color: var(--bamboo); font-size: 13.5px; font-weight: 600;
}
.inst-switch:active { background: #E8EFE4; }
.auto-follow { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); cursor: pointer; white-space: nowrap; }
.auto-follow input { accent-color: var(--bamboo); }
.bar-switch {
  padding: 7px 16px; border-radius: 18px; cursor: pointer;
  background: var(--card); border: 1px solid var(--bamboo);
  color: var(--bamboo); font-size: 13px; font-weight: 600;
}
.bar-switch:active { background: #E8EFE4; }

.mic-warn {
  margin-bottom: 12px; padding: 12px 16px; border-radius: 14px;
  background: #F7E3DE; border: 1px solid #E0B7AC; color: #9C3A26; font-size: 12.5px; line-height: 1.7;
}

/* ---------- 调音主卡（乐器特写 + 读数 + 淡表盘，同一张卡内三层叠合） ---------- */
.tuner-card {
  position: relative; padding: 4px 10px 6px; margin-bottom: 8px; overflow: hidden;
  /* 卡片吃掉剩余高度，页面不需要滚动 */
  /* 1 1 0：高度只由父容器分配，不被卡片内容反向撑高。
     否则「按舞台高度算表盘宽 → 表盘变高 → 舞台变高 → 再算更宽」会自激放大。 */
  flex: 1 1 0; min-height: 0; display: flex; flex-direction: column;
}
.key-select {
  padding: 5px 6px; border-radius: 9px; flex-shrink: 1; min-width: 0; max-width: 118px;
  border: 1px solid var(--card-edge); background: var(--bg-soft); color: var(--gold); font-size: 12.5px;
}

/* 舞台：上下分栏 —— 乐器图（占满剩余高度）/ 读数 / 线性音分尺。
   全部用 flex 排版而不是绝对定位，图、字、尺各占各的，不会再互相压。 */
.stage {
  position: relative; flex: 1 1 0; min-height: 170px; width: 100%; min-width: 0;
  display: flex; flex-direction: column; justify-content: center;
}

/* —— 通用模式表盘：盘口朝上的量角器，整盘落在读数下方（仅通用调音模式） —— */
.gauge-bg {
  order: 2; position: relative; z-index: 0;
  width: 100%; margin: 4px auto 0;   /* 宽度由脚本按可用高度算，这里只做兜底 */
  pointer-events: none;
}
.gauge-bg svg { width: 100%; height: auto; display: block; }
/* 指针整组绕盘心旋转：transform-origin 的 px 在 SVG 里按用户坐标解析 */
#dialMark {
  transform-origin: 100px 124px;
  /* 这里原来用 cubic-bezier(.34, 1.3, .64, 1)：第二个控制点 1.3 > 1，
     等于每一次移动都会**冲过头再弹回来**。输入是 60ms 一帧的连续小抖动，
     于是指针永远在追目标、永远停不下来 —— 这就是「移来移去」的一大半来源。
     换成一阶线性：曲线落到哪，指针就平移到哪，落点即停，不再回弹。
     时长压到 120ms，比一帧略长，帧与帧之间不露阶跃感，也不拖。 */
  transition: transform .12s linear;
}
.tuner-card:not(.generic) .gauge-bg { display: none; }
/* 盘心读数：字号用用户单位，随表盘一起缩放，永远坐在弧心 */
#dialNote {
  /* 绝不能用楷体（--serif）：
     楷体粗体里，上标 ¹ 会被画成一道长斜杠 —— ♯c¹ 显示成「#c¹/」，
     右端凭空多一条斜杠；同时楷体没有 ♯ 字形，会回退成「#」，升号读不出来。
     这就是「通用调音器调音时有个斜杠、升号却看不到」的根因。
     与 .ro-note（大字读数）保持同一套字体，两处镜像才不会一个样一个不像。 */
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-weight: 700; font-size: 44px;
  fill: var(--ink); letter-spacing: 0;
}
#dialNote.idle { font-size: 26px; }
#dialNote.wide { font-size: 25px; letter-spacing: -.5px; }
#dialCents { font-size: 11.5px; fill: #8A826F; letter-spacing: .6px; }
/* 盘心大字上方的组别（小字一组 / 大字组）：只看 c、c¹、C 分不出八度组，
   这里用中文写全，字号小、颜色淡，不抢音名 */
#dialGrp {
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 9.5px; font-weight: 500; fill: #A99E82; letter-spacing: 1.6px;
}

/* —— 前景层：乐器特写（在剩余空间里居中，宽度由脚本按 crop 比例算） —— */
.fig-layer {
  flex: 0 1 auto; min-height: 0; position: relative; z-index: 1; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.figure-box { position: relative; max-width: 100%; }

/* —— 密集音位图（扬琴 60 音位）：图比舞台宽时横向滑动，宁可滑也不缩图 ——
   手机上按 1.6 倍显示，音名才从 7px 变到 11px 上下；放不下就让图溢出，
   舞台里做成横向滚动条，隐藏滚动条本身（否则会占掉一条 6px 的视觉高度）。 */
.fig-layer.pan {
  overflow-x: auto; overflow-y: hidden;
  justify-content: flex-start;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.fig-layer.pan::-webkit-scrollbar { display: none; }
.fig-layer.pan .figure-box { max-width: none; flex: 0 0 auto; }
/* 右侧渐隐 = 「右边还有」的提示。滑到头就把渐隐收掉，否则最后一列音名会被糊掉一半。
   渐隐挂在 .stage 上而不是滚动容器里，滚动时位置才不会跟着图跑。 */
.stage.pan-edge::after {
  content: ''; position: absolute; z-index: 4; pointer-events: none;
  top: 0; right: 0; bottom: 0; width: 14px;
  background: linear-gradient(to right, rgba(255, 253, 246, 0), var(--card) 92%);
}
/* 光有渐隐还不够明显，配一个小箭头：告诉用户右边还有两列音位 */
.stage.pan-edge::before {
  content: '›'; position: absolute; z-index: 5; pointer-events: none;
  right: 3px; top: 46%; transform: translateY(-50%);
  font-size: 26px; line-height: 1; color: var(--text-faint); opacity: .8;
}
/* 渐隐只作用于线稿本身：标点必须保持清晰，不能被一起淡掉 */
.figure-box svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  -webkit-mask-image: linear-gradient(to bottom, #000 90%, rgba(0,0,0,.55) 97%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 90%, rgba(0,0,0,.55) 97%, transparent 100%);
}
/* 吹管孔位特写：最下面的孔也要看得清，不做底部渐隐 */
.figure-box .part-scene2.no-fade svg {
  -webkit-mask-image: none; mask-image: none;
}

/* —— 读数层：音名 + 音分，紧贴乐器图下方 —— */
.stage-read {
  position: relative; z-index: 2; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  pointer-events: none;
  padding: 2px 20px 0;
  /* 定高：音名长短、音分有没有数字，都不能改变这一块的高度。
     否则「点一下音位 → 读数变高 → 舞台重新居中 → 乐器图整体上下跳」。
     73 = 音名 41 + 音名与小字的间距 8 + 小字行 22 + 上下 2。 */
  height: 73px;
  /* 这一块就是「读数条」：准音稳住后整条换底色（见 .lk1 / .lk2）。
     align-self 让条子按自身内容定宽、居中，而不是被 flex 拉成一条通栏横幅；
     min-width 兜住宽度，免得 D 这种单字音名把条子压成一个方点。 */
  align-self: center; max-width: 100%;
  min-width: 210px; border-radius: 18px;
  transition: background .18s ease, box-shadow .18s ease;
}
/* 准音一级：连续稳住 0.6 秒，读数条淡绿 */
.stage-read.lk1 {
  background: #EAF3E7;
  box-shadow: inset 0 0 0 1px #B6D3B0;
}
.stage-read.lk1 .ro-note,
.stage-read.lk1 .ro-cents b,
.stage-read.lk1 .ro-cents span { color: #2F6B45; text-shadow: none; }
/* 准音二级：连续稳住 1.5 秒，整条实绿 + 勾 */
.stage-read.lk2 {
  background: var(--green);
  box-shadow: 0 8px 22px rgba(62, 142, 92, .28);
}
.stage-read.lk2 .ro-note,
.stage-read.lk2 .ro-cents b,
.stage-read.lk2 .ro-cents span { color: #FFF; text-shadow: none; }
.stage-read.lk2 .ro-grp { color: #D6E9D8; }
.lk-tick { font-size: 15px; font-weight: 700; margin-left: 1px; }
.stage-read.lk2 .lk-tick { color: #FFF; }
.ro-note.idle { opacity: .38; }
/* 等音双名（♯C-♭D4）比单名长一倍，收一档字号才不会顶出卡片 */
.ro-note.wide { font-size: 31px; line-height: 41px; }
.ro-note {
  /* 不能用楷体：楷体的粗体里，上标 ¹ 会被画成一条长斜杠（g¹ 看起来像 g/）。
     音名要用上标标小字组，必须换成系统无衬线字体，¹ ² ³ 才是正常的小上标。 */
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 41px; font-weight: 700;
  line-height: 41px; color: var(--ink); letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  /* 白色描边：字压在线稿上也读得清 */
  text-shadow: 0 0 3px #FCF8EE, 0 0 3px #FCF8EE, 0 0 7px #FCF8EE,
               0 0 12px rgba(252, 248, 238, .95), 0 0 20px rgba(252, 248, 238, .8);
}
.ro-note small { font-size: 17px; color: var(--text-dim); font-weight: 600; }
/* 组别明文（小字一组 / 大字组）：c、c¹、C 这三个写法只差大小写和一个小上标，
   光看音名分不出八度组，用户原话「识别不出来到底是小字组还是大字组」。
   所以在大字上方单起一行写清楚，只出现在通用模式（乐器模式有目标音位，不需要）。 */
.ro-grp {
  font-size: 12px; line-height: 1; letter-spacing: 2px;
  color: var(--text-faint); margin-bottom: 3px;
  text-shadow: 0 0 4px #FCF8EE, 0 0 8px rgba(252, 248, 238, .9);
}
.tuner-card:not(.generic) .ro-grp { display: none; }
.ro-cents {
  display: flex; align-items: baseline; gap: 6px;
  /* 音名（41px 大字）与这一行小字之间留出呼吸位：
     原来 margin-top 只有 2px，「请发声」几乎贴着音名的下缘。 */
  margin-top: 8px;
  min-height: 22px;   /* 音分为空（刚点音位还没读数）时也别塌下去 */
}
.ro-cents b {
  font-size: 19px; font-weight: 700; line-height: 1.15;
  color: var(--text); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 3px #FCF8EE, 0 0 3px #FCF8EE, 0 0 8px rgba(252, 248, 238, .95);
}
.ro-cents b.ok { color: var(--green); }
.ro-cents b.idle { opacity: .3; }
.ro-cents span {
  font-size: 11.5px; color: var(--text-dim);
  text-shadow: 0 0 3px #FCF8EE, 0 0 3px #FCF8EE, 0 0 8px rgba(252, 248, 238, .95);
}
.ro-cents span.ok { color: var(--green); }

.chips {
  display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 2px 0;
  position: relative; z-index: 3; flex-shrink: 0;
  /* 一行放 8 个音位；音位再多（扬琴 37 音）限高滚动，不把卡片撑爆 */
  max-height: 96px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
/* 音位数量适中（≤10 个）时排成**单行横向滑动**，不换行。
   二胡 C 调有 9 个音位（2 3 4 5 6 7 高1 高2 高3），换行成两排会把卡片撑高、
   而且第二排只剩一两个显得很散。单行滑动更整齐，也方便顺着音阶顺序看。
   音位特别多的乐器（扬琴 37 音、古筝）仍走上面的多行滚动。 */
.chips.one-row {
  flex-wrap: nowrap; max-height: none; overflow-y: hidden;
  overflow-x: auto; scrollbar-width: none;
  justify-content: flex-start;
}
.chips.one-row::-webkit-scrollbar { display: none; }
.chips.one-row .chip { flex: 0 0 auto; }
/* 仅在真的溢出时才在底部做渐隐，提示还能往下滑（否则会误伤最后一行） */
.chips.scrollable {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent 100%);
}
.chips:empty { display: none; }
.chip {
  padding: 4px 8px; border-radius: 14px;
  background: var(--bg-soft); border: 1px solid var(--card-edge);
  font-size: 10.5px; color: var(--text-dim); cursor: pointer;
  font-variant-numeric: tabular-nums; line-height: 1.3;
}
.chip.active { background: var(--red); border-color: var(--red); color: #FFF6EA; }
/* 「以前调过」只用淡绿 + 一个小勾，别用和「此刻准了」同样亮的绿 ——
   两套绿混在一起时，用户分不清是历史还是当下。 */
.chip.tuned { border-color: var(--green-dim); color: var(--green-dim); }
.chip.tuned::after { content: '✓'; margin-left: 3px; font-size: 9px; opacity: .85; }
.chip.tuned.active { background: var(--red); border-color: var(--red); color: #FFF6EA; }

.ro-foot {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 2px 0; font-size: 11px; color: var(--text-faint);
  font-variant-numeric: tabular-nums; position: relative; z-index: 3; flex-shrink: 0;
  /* 关键：这一行里「目标 xxx Hz」+「A4 = 442 Hz 乐团常用」并排，
     子项不给 flex 收缩就会把整页撑宽 → 卡片右侧被裁、音分尺看着偏斜。 */
  min-width: 0; overflow: hidden;
  text-shadow: 0 0 3px #F7F2E7, 0 0 4px #F7F2E7, 0 0 8px rgba(247, 242, 231, .95);
}

/* 音位条溢出的乐器：舞台收矮即可，布局本身是弹性的 */
.tuner-card.compact .stage { min-height: 150px; }

/* 通用调音（无乐器图）：音名与音分都搬进表盘盘心，DOM 读数只留给乐器模式 */
.tuner-card.generic .stage { justify-content: center; }
.tuner-card.generic .stage-read { display: none; }
.a4-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-faint);
  border: 1px solid var(--card-edge); border-radius: 12px; padding: 2px 9px;
  white-space: nowrap;
  flex: 0 1 auto; min-width: 0;
}
/* 窄屏只留「A4 = 442 Hz」，把「乐团常用」那个金标签收起，避免这一行被迫横向溢出 */
@media (max-width: 400px) {
  .a4-badge .a4-tag { display: none; }
}
.ro-foot > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A4 徽标单独一行居中：跟「实测/目标」不再抢同一行的宽度，卡片不会被横向撑开 */
.ro-foot-a4 { padding-top: 2px; }
.ro-foot-a4 .a4-badge { padding: 1px 8px; font-size: 10.5px; }
/* 通用模式原来把这一行藏了，结果「按多少赫兹在算」只有进设置才看得到 ——
   用户调到一半才发现基准是 442 而不是 440，就会怀疑测不准。主页面必须常显。
   卡片上方本来就空着一大片（表盘居中偏下），A4 挪到右上角当状态签，一眼看得见；
   做成可点的：点它直接进设置改基准。 */
.tuner-card.generic .ro-foot-a4 {
  display: block; position: absolute; top: 6px; right: 8px; z-index: 3;
  margin: 0; padding: 0;
}
.tuner-card.generic .ro-foot-a4 .a4-badge {
  cursor: pointer; font-size: 11.5px; color: var(--text-dim);
  border-color: #DCCFB0; background: rgba(255, 253, 246, .82);
}
.tuner-card.generic .ro-foot-a4 .a4-badge:active { background: rgba(184, 137, 74, .12); }
.a4-tag {
  font-size: 10px; color: var(--gold); letter-spacing: .4px;
  padding-left: 6px; border-left: 1px solid var(--card-edge);
}

/* ---------- 控制区 ---------- */
.ctrl { display: flex; gap: 10px; padding-top: 2px; flex-shrink: 0; }
.ctrl button { flex: 1; padding: 12px 0; font-size: 14.5px; font-weight: 600; border-radius: 22px; cursor: pointer; letter-spacing: 1.5px; }
.btn-primary {
  background: linear-gradient(160deg, #D15B44 0%, var(--red-deep) 100%);
  color: #FFF6EA; border: none;
  box-shadow: 0 6px 18px rgba(160, 52, 34, 0.28);
}
.btn-primary.listening { background: linear-gradient(160deg, #8C8570 0%, #6E6852 100%); box-shadow: none; }
.btn-ghost { background: transparent; color: var(--bamboo-deep); border: 1.5px solid var(--bamboo); }

/* ---------- 打赏入口 ---------- */
/* 定位：想支持的人一眼能找到，但绝不能抢调音的注意力。
   所以做成一行无边框无背景的极淡小字，字号 10.5、灰到接近页脚，
   点按热区靠上下 padding 撑到 30px（不然 10px 的字手指点不准）。
   两页各一个，位置都在页脚附近，切页时不会跳来跳去。 */
.reward-entry {
  display: block; width: 100%; height: 100%; flex-shrink: 0;
  margin: 0; padding: 0;
  background: none; border: none; cursor: pointer;
  text-align: center; -webkit-appearance: none;
  transition: opacity .25s;
}
.reward-entry span {
  font-size: 10.5px; color: var(--text-faint);
  letter-spacing: .06em; opacity: .82;
}
/* 茶杯图标用 <i> 包着：某些安卓机把 emoji 排成彩色方块、基线还会往下掉，
   这里锁住字体栈与行高，免得那行小字被一个图标顶歪 */
.reward-entry .rw-ico {
  font-style: normal; font-size: 11px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  line-height: 1; vertical-align: -1px;
}
.reward-entry:hover { opacity: .75; }
.reward-entry:active { transform: scale(.98); }
/* 两页共用一条「底部通道」：固定 34px 高、紧贴上边距，
   这样不管乐器模式还是通用模式、卡片里塞了多少东西，入口都在同一位置。
   节拍器页把它推到最底（margin-top:auto），因为那里中间本来就有一大块留白。 */
.reward-row {
  flex-shrink: 0; height: 34px;
  display: flex; align-items: center; justify-content: center;
  margin-top: 3px;
}
#view-metro .reward-row { margin-top: auto; padding-bottom: 2px; }

/* ---------- 打赏弹窗 ---------- */
/* 弹窗走「居中弹入」，与底部上滑的 sheet 不是一套；
   遮罩用米白偏暖的深色（不是纯黑），和全站宣纸底放在一起不发青 */
.reward-mask {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 0 24px;
  background: rgba(28, 22, 14, .42);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.reward-card {
  position: relative; width: 100%; max-width: 300px;
  padding: 22px 22px 16px; text-align: center;
  background: var(--card);
  border: 1.5px solid rgba(184, 137, 74, .38);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(90, 70, 30, .22), inset 0 1px 0 rgba(255, 255, 255, .6);
  animation: rewardBounceIn .35s cubic-bezier(.34, 1.4, .64, 1);
}
@keyframes rewardBounceIn {
  0%   { transform: scale(.86); opacity: 0; }
  60%  { transform: scale(1.025); opacity: 1; }
  100% { transform: scale(1); }
}
/* 系统开了「减弱动态效果」就别弹了，直接出现 */
@media (prefers-reduced-motion: reduce) {
  .reward-card { animation: none; }
}
.reward-close {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border: none; border-radius: 50%;
  background: none; cursor: pointer;
  font-size: 14px; line-height: 1; color: var(--text-faint);
}
.reward-close:hover { background: rgba(138, 126, 104, .1); }
.reward-title {
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
  color: var(--text); font-family: var(--serif);
}
.reward-sub { margin-top: 3px; font-size: 11px; color: var(--text-dim); }
/* 二维码：容器 210 见方，图本身缩到 ~180 并用内边距撑出「静区」。
   原图四周白边太薄（几乎贴到边框），相机取景时容易因为缺静区识别失败；
   留 12px 白边既符合扫码规范，看着也更像一张实体的收款牌。 */
.reward-qr {
  width: 210px; height: 210px; margin: 14px auto 0;
  padding: 12px; box-sizing: border-box;
  border-radius: 16px; overflow: hidden;
  background: #fff; border: 2px solid rgba(184, 137, 74, .42);
}
.reward-qr img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* 金句：金棕色，稍加粗 —— 弹窗里唯一「有分量」的一行，
   负责解除金额压力（入口那句「喝杯茶」负责唤起） */
.reward-motto { margin-top: 12px; font-size: 12.5px; font-weight: 600; color: var(--gold); letter-spacing: .5px; }
.reward-tip { margin-top: 6px; font-size: 10px; line-height: 1.65; color: var(--text-faint); }
.reward-channels { margin-top: 8px; font-size: 10px; color: var(--text-faint); opacity: .72; }
/* 矮屏（横屏手机 / 小折叠）：二维码与留白同步收一档，否则卡片会顶出屏幕 */
@media (max-height: 560px) {
  .reward-card { padding: 16px 18px 12px; max-width: 262px; }
  .reward-qr { width: 150px; height: 150px; margin-top: 10px; }
  .reward-title { font-size: 14px; }
  .reward-motto { margin-top: 8px; font-size: 12px; }
  .reward-tip { margin-top: 4px; }
  .reward-channels { margin-top: 5px; }
}

/* ---------- 部件级渲染（弦轴 / 按孔 / 弦） ---------- */
/* ---------- 部件图 v6：乐器线稿 + 弦轴热区 + 按孔填充 ---------- */
.part-scene2 {
  position: relative; width: 100%; aspect-ratio: 300 / 220;
  border-radius: 14px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, rgba(246, 240, 226, 0.8) 0%, rgba(246, 240, 226, 0) 72%);
}
.part-scene2 svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.part-scene2 svg .peg { cursor: pointer; }

/* 弦轴：轴柄圆盘 + 十字手柄；选中亮朱砂，同时浮出顺时针扭矩箭头 */
.peg-hit { fill: transparent; stroke: none; }
.peg-body {
  fill: #FFFDF7; stroke: #4E7A5A; stroke-width: 1.4;
  transition: fill .14s ease, stroke .14s ease;
}
.peg-bar { stroke: #8CA98A; stroke-width: 1.2; stroke-linecap: round; transition: stroke .14s ease; }
.peg-arc { fill: none; stroke: var(--red); stroke-width: 1.5; stroke-linecap: round; opacity: 0; transition: opacity .16s ease; }
.peg-tip { fill: var(--red); stroke: none; opacity: 0; transition: opacity .16s ease; }
.peg-lb { font: 600 7px system-ui, -apple-system, sans-serif; fill: #7E8B79; transition: fill .14s ease; }
.peg.sel .peg-body { fill: var(--red); stroke: var(--red-deep); }
.peg.sel .peg-bar { stroke: #FFF1E8; }
.peg.sel .peg-arc, .peg.sel .peg-tip { opacity: .95; }
.peg.sel .peg-lb { fill: var(--red-deep); }
/* 拉弦：选中的音落在哪根弦上，那根弦就转朱砂加粗 */
.hu-str { transition: stroke .16s ease, stroke-width .16s ease, stroke-opacity .16s ease; }
.hu-str.sel { stroke: var(--red); stroke-width: 2.6; stroke-opacity: .95; }
/* 胡琴琴轴：锥形轴身 + 轴顶骨片；选中时整支转朱砂 */
.hu-axle { fill: #D7E7CF; stroke: #5E8A66; stroke-width: 1.1; transition: fill .14s ease, stroke .14s ease; }
.hu-axle-top { fill: #EFE7D2; stroke: #7A8F6A; stroke-width: 1; transition: fill .14s ease, stroke .14s ease; }
.peg.sel .hu-axle { fill: var(--red); stroke: var(--red-deep); }
.peg.sel .hu-axle-top { fill: #FFE6D8; stroke: var(--red-deep); }
.peg.tuned .hu-axle { fill: #DCEBD8; }
.peg.tuned .peg-body { fill: #F1F7EE; stroke: #8FB693; }
.peg.tuned.sel .peg-body { fill: var(--red); stroke: var(--red-deep); }
.peg.tuned .peg-lb { fill: #8FB693; }

/* 吹管按孔：全按填整圆（深竹青，不是纯黑），半孔只填左半 —— 一眼看得出是「虚按一半」 */
.hole-mark { pointer-events: none; }
.hole-fill, .hole-half { fill: #2E3F35; opacity: 0; transition: opacity .16s ease; }
.hole-mark[data-state="1"] .hole-fill { opacity: .9; }
.hole-mark[data-state="h"] .hole-half { opacity: .82; }

/* 古筝 21 弦：整条弦和筝首的弦轴点都是热区（弦太密，点更好按），
   选中拉粗变朱砂，调准转竹青 */
.str-line { stroke: #4E7A5A; transition: stroke .14s ease; }
.str-line.sel { stroke: var(--red); stroke-width: 3.6; }
.str-line.tuned:not(.sel) { stroke: #8FB693; }
.str-num { transition: fill .14s ease; }
.str-num.sel { fill: var(--red); }
.str-num.tuned:not(.sel) { fill: #6E9174; }
.str-hit { cursor: pointer; }

/* 弦 → 弦轴点的引线：比弦更淡，选中跟着亮，不然像断成两截 */
.gz-lead {
  stroke: #4E7A5A; stroke-width: 1.1; opacity: .55;
  transition: stroke .14s ease, opacity .14s ease, stroke-width .14s ease;
}
.gz-lead.sel { stroke: var(--red); opacity: .85; stroke-width: 1.5; }
.gz-lead.tuned:not(.sel) { stroke: #8FB693; opacity: .7; }

/* 筝首弦轴点：透明大圆负责好按，实心小圆负责看得清 */
.gz-hit { fill: transparent; stroke: none; cursor: pointer; pointer-events: all; }
.gz-lead-hit { stroke: transparent; stroke-width: 5; pointer-events: stroke; cursor: pointer; }
.gz-peg {
  fill: #FFFDF7; stroke: #8CA98A; stroke-width: 1;
  pointer-events: none; transition: fill .14s ease, stroke .14s ease;
}
.peg { cursor: pointer; }
.peg:hover .gz-peg { stroke: var(--red); }
.peg.sel .gz-peg { fill: var(--red); stroke: var(--red-deep); }
.peg.tuned .gz-peg { fill: #F1F7EE; stroke: #8FB693; }
.peg.tuned.sel .gz-peg { fill: var(--red); stroke: var(--red-deep); }

/* 扬琴音位：照手绘音位图 —— 只有码线 + 音名 + 短横，音名本身就是按钮 */
.yq-hit { fill: transparent; stroke: none; cursor: pointer; pointer-events: all; }
.yq-line { stroke: #8A7E68; stroke-opacity: .75; stroke-width: 1.05; stroke-linecap: round; }
.yq-rail { stroke: #8A7E68; stroke-opacity: .55; stroke-width: .8; stroke-linecap: round; }
.yq-name {
  pointer-events: none;
  transition: fill .14s ease;
  /* 音名压住短横：描一圈纸色，短横就不会从字里穿过去，像手写时留的空白 */
  paint-order: stroke;
  stroke: #FBF7EC; stroke-width: 1.6; stroke-linejoin: round;
}
.peg:hover .yq-name { fill: var(--red-deep); }
.peg.sel .yq-name { fill: var(--red); }
.peg.sel .yq-hit { fill: rgba(166, 58, 43, .09); }
.peg.tuned .yq-name { fill: #6E9174; }
.peg.tuned.sel .yq-name { fill: var(--red); }
.peg.tuned .yq-rail { stroke: #8FB693; stroke-opacity: .5; }

/* 线性音分尺（乐器模式替代摆针表盘，绝不横穿乐器图） */
.cents-bar {
  position: relative; z-index: 2; flex-shrink: 0;
  width: 100%; max-width: 340px; margin: 4px auto 0; padding: 0 4px;
}
.cents-bar svg { width: 100%; height: auto; display: block; }
#ribMark { transition: transform .16s ease-out; }

.part-hint {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  font-size: 11px; color: var(--text-faint); white-space: nowrap;
  background: rgba(253,251,243,.86); padding: 3px 10px; border-radius: 10px;
}

.part-scene { position: relative; width: 100%; height: 330px; overflow: hidden; }
.part-wood {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.28) 0%, rgba(255,255,255,0.05) 18%, rgba(0,0,0,0.12) 55%, rgba(0,0,0,0.3) 100%),
    repeating-linear-gradient(91deg, #7A4A22 0 12px, #8A5A2B 12px 21px, #6E421E 21px 30px, #93642F 30px 42px, #754821 42px 55px),
    #7A4A22;
}
.part-wood.dark {
  background:
    linear-gradient(90deg, rgba(0,0,0,0.3), rgba(255,255,255,0.04) 20%, rgba(0,0,0,0.35) 100%),
    repeating-linear-gradient(91deg, #2E2013 0 16px, #3A2A18 16px 27px, #241811 27px 40px),
    #2E2013;
}
.part-head {
  position: absolute; left: 0; right: 0; top: 0; height: 58px;
  background: linear-gradient(180deg, #241A0E 0%, #3A2A16 80%, rgba(58,42,22,0) 100%);
}
.part-pegk {
  position: absolute; top: 14px; width: 30px; height: 9px; transform: translateX(-50%);
  border-radius: 5px;
  background: linear-gradient(180deg, #C9A063, #6B4226);
  box-shadow: 0 2px 5px rgba(0,0,0,0.6);
}
.part-strline {
  position: absolute; top: 58px; bottom: 26px; width: 3px; transform: translateX(-50%);
  background: linear-gradient(90deg, #5E5648 0%, #FFF9EA 45%, #D8CDB0 55%, #5E5648 100%);
  box-shadow: 0 0 8px rgba(0,0,0,0.55);
  transition: width 0.12s;
}
.part-strline.thick { width: 5px; }
.part-scene.board .part-strline, .part-scene.fiddle .part-strline.v { top: 12px; bottom: 44px; }
.part-scene.board .part-strline { top: 14px; bottom: 48px; }
.part-dot-unit {
  position: absolute; transform: translateX(-50%);
  background: transparent; border: none; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 2;
}
.part-dot-unit.at-head { top: 20px; }
.part-dot-unit.at-mid { top: 42%; }
/* 旧版部件图圆点（已被 v4 取代，仅保留以兼容旧结构） */
.part-dot-legacy {
  min-width: 36px; height: 36px; padding: 0 7px; border-radius: 19px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(28, 24, 18, 0.88);
  border: 1px solid rgba(255,255,255,0.55);
  color: #F5EFE2; font-size: 14px; font-weight: 600;
  transition: transform 0.12s, background 0.15s;
}
.part-dot-unit.small .part-dot-legacy { min-width: 26px; height: 26px; font-size: 12px; border-radius: 14px; }
.part-dot-unit:hover .part-dot-legacy { transform: scale(1.12); }
.part-dot-unit.sel .part-dot-legacy {
  background: var(--red); color: #FFF6EA; border-color: var(--red);
  transform: scale(1.18);
  box-shadow: 0 0 18px rgba(194, 69, 47, 0.5);
}
.part-dot-unit.tuned .part-dot-legacy { background: var(--green-dim); color: #FFF; border-color: var(--green-dim); }
.part-dot-sub { font-size: 10px; color: rgba(255,255,255,0.85); white-space: nowrap; }
.part-bridge2 {
  position: absolute; left: 22%; right: 22%; bottom: 12px; height: 12px;
  border-radius: 4px; background: linear-gradient(180deg, #8A5A2B, #4A2A12);
  box-shadow: 0 4px 10px rgba(0,0,0,0.55);
}
.part-yueshan { position: absolute; left: 0; right: 0; bottom: 26px; height: 8px; background: linear-gradient(180deg, #E0D2AC, #9A8A60); opacity: 0.95; }
.part-yazi { position: absolute; bottom: 34px; width: 0; height: 0; transform: translateX(-50%);
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid #3A2412; opacity: 0.9; }

/* 吹管 */
.part-scene.wind { height: 240px; display: flex; align-items: center; }
.part-tube2 {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 4px;
  width: 92%; margin: 0 auto; height: 110px; padding: 14px 26px;
  border-radius: 26px;
  box-shadow: inset 0 -8px 18px rgba(0,0,0,0.35), inset 0 4px 10px rgba(255,255,255,0.14);
}
.part-tube2.bamboo { background: repeating-linear-gradient(90deg, #A8AE68 0 34px, #97A058 34px 58px, #8A9350 58px 90px), #A8AE68; border: 1px solid #4A5228; }
.part-tube2.darkbamboo { background: repeating-linear-gradient(90deg, #4E5A2E 0 34px, #424E28 34px 58px, #38421F 58px 90px), #4E5A2E; border: 1px solid #222A12; }
.part-tube2.wood { background: repeating-linear-gradient(90deg, #6B3018 0 30px, #7A3E20 30px 54px, #5C2A12 54px 84px), #6B3018; border: 1px solid #2E1608; }
.part-hole2-unit { position: relative; background: transparent; border: none; cursor: pointer; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.part-hole3 {
  width: 24px; height: 24px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4A3820, #140F08 75%);
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.9), 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 0.1s;
}
.part-hole2-unit:hover .part-hole3 { transform: scale(1.15); }
.part-hole3.tong { background: radial-gradient(circle at 35% 30%, #C9A063, #4A2E10 78%); }
.part-hole2-unit.sel .part-dot-legacy { background: var(--red); color: #FFF6EA; }
.part-hole2-unit.sel .part-hole3 { box-shadow: 0 0 0 3px var(--red), 0 0 22px rgba(194,69,47,0.6); }
.part-hole2-unit.tuned .part-hole3 { box-shadow: 0 0 0 3px var(--green-dim), 0 0 20px rgba(62,142,92,0.55); }
.part-hole2-unit.tuned .part-dot-legacy { background: var(--green-dim); color: #FFF; }

/* 笙 */
.part-scene.sheng { height: 330px; display: flex; flex-direction: column; justify-content: flex-end; }
.part-sheng-row { display: flex; justify-content: center; align-items: flex-end; gap: 16px; padding-bottom: 12px; }
.part-sheng-unit { background: transparent; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 0; }
.part-shengpipe { width: 17px; border-radius: 9px; background: linear-gradient(90deg, #5E6A38, #C8CE8A 50%, #5E6A38); box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.part-shengpipe.p0 { height: 130px; } .part-shengpipe.p1 { height: 165px; } .part-shengpipe.p2 { height: 190px; }
.part-sheng-unit.sel .part-shengpipe { box-shadow: 0 0 0 3px var(--red), 0 0 22px rgba(194,69,47,0.55); }
.part-sheng-unit.tuned .part-shengpipe { box-shadow: 0 0 0 3px var(--green-dim), 0 0 18px rgba(62,142,92,0.55); }
.part-shengdou { width: 68%; height: 24px; margin: 0 auto; border-radius: 13px; background: linear-gradient(180deg, #C24E3A, #7A2018); }

/* 鼓 */
.part-drum-row { display: flex; justify-content: space-around; width: 100%; padding: 14px 0; }
.part-scene:has(.part-drum-row) { height: 260px; display: flex; align-items: center; }
.part-drum-unit2 { background: transparent; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 0; }
.part-drumhead2 {
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #FBF5E4, #D9CBA4 68%, #A89868 100%);
  box-shadow: inset 0 -6px 14px rgba(0,0,0,0.25), 0 4px 14px rgba(0,0,0,0.35);
  border: 6px solid #8A2A1E;
}
.part-drum-unit2.sel .part-drumhead2 { box-shadow: 0 0 0 3px var(--red), 0 0 26px rgba(194,69,47,0.5); }
.part-drum-unit2.tuned .part-drumhead2 { border-color: var(--green-dim); }

/* 扬琴 / 定音鼓展示件 */
.part-yangqin {
  position: relative; width: 86%; height: 170px; margin: 10px auto;
  background: linear-gradient(180deg, #9A5A2E, #5C2E16);
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
  display: flex; flex-direction: column; justify-content: space-evenly; padding: 0 6%;
}
.part-course { height: 2px; background: linear-gradient(90deg, transparent, #E6DCC4 12%, #E6DCC4 88%, transparent); }
.part-timphead {
  width: 200px; height: 200px; margin: 6px auto; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #FBF5E4, #D9CBA4 68%, #A89868 100%);
  box-shadow: inset 0 -10px 24px rgba(0,0,0,0.25), 0 8px 24px rgba(0,0,0,0.3);
  border: 8px solid #B08A45;
}
.part-hint { text-align: center; font-size: 11.5px; color: var(--text-faint); margin-top: 8px; }

/* 列表缩略 */
.inst-photo { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.inst-thumb { width: 104px; height: 74px; flex-shrink: 0; overflow: hidden; border-radius: 10px; background: #E8E0CE; }
.inst-icon {
  width: 100%; height: 100%; border-radius: 10px;
  background: var(--bg-soft); display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700;
}

/* ---------- 节拍器 ---------- */
.scroll-card { padding: 10px 0 4px; overflow: hidden; }
/* 真机几何（stage 高 300）：轴销 y266、摆杆顶 y12、滑块行程 y64~236、木箱 y50~288 */
.pendulum-stage { position: relative; height: 300px; touch-action: none; }

/* 木箱：下宽上窄的梯形，刻度直接印在正面 */
.met-body {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  width: 148px; height: 244px;
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(90deg, rgba(122,96,56,.20) 0%, rgba(122,96,56,0) 20%,
                    rgba(255,255,255,.34) 45%, rgba(122,96,56,0) 72%, rgba(122,96,56,.20) 100%),
    linear-gradient(180deg, #EEE2C6 0%, #E1CEA8 44%, #D2BD94 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.55), inset 0 -4px 8px rgba(122,96,56,.16);
  z-index: 1;
}
/* 底座：横木，压住箱脚 */
.met-base {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 170px; height: 18px; border-radius: 4px 4px 6px 6px;
  background: linear-gradient(180deg, #D8C39A 0%, #B99D6E 55%, #A98C5E 100%);
  box-shadow: 0 3px 9px rgba(122,96,56,.26);
  z-index: 2;
}
/* 刻度：上慢下快（40 在上、208 在下），左右交错排，避开中间的摆杆 */
.met-scale { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.met-mark {
  position: absolute; transform: translateY(-50%);
  font-size: 9.5px; line-height: 1; font-weight: 600; letter-spacing: -.2px;
  color: #7A6440; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.met-mark::after {
  content: ''; position: absolute; top: 50%; width: 7px; height: 1px;
  background: rgba(122,96,56,.5);
}
.met-mark.l { right: calc(50% + 22px); text-align: right; }
.met-mark.l::after { right: -23px; }
.met-mark.r { left: calc(50% + 22px); }
.met-mark.r::after { left: -23px; }

/* 摆杆：绕箱底轴销转，顶端摆、底端不动 */
.pendulum {
  position: absolute; left: 50%; top: 12px; width: 5px; height: 254px;
  margin-left: -2.5px; transform-origin: 50% 100%;
  will-change: transform; z-index: 3;
}
.pend-arm {
  position: absolute; inset: 0; border-radius: 2px;
  background: linear-gradient(180deg, #DED0AE 0%, #BCA87E 45%, #8E7C57 100%);
  box-shadow: 0 0 0 .5px rgba(90,70,40,.3);
}
/* 杆头小尖：看得出是「指针在摆」 */
.pend-tip {
  position: absolute; left: 50%; top: -11px; transform: translateX(-50%);
  width: 0; height: 0; border-left: 4.5px solid transparent;
  border-right: 4.5px solid transparent; border-bottom: 12px solid #A9926A;
}
/* 滑块：位置＝当前速度，越往下越快 */
.pend-bob {
  position: absolute; left: 50%; width: 29px; height: 22px; border-radius: 4px;
  transform: translate(-50%, -50%);
  background: linear-gradient(160deg, #D25B41 0%, #C2452F 55%, var(--red-deep) 100%);
  box-shadow: 0 2px 5px rgba(150,50,30,.3), inset 0 1px 0 rgba(255,255,255,.28);
  cursor: ns-resize; z-index: 5;
}
.pend-bob::after {
  content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 7px; height: 7px; border-radius: 50%; background: rgba(255,246,234,.4);
}
/* 轴销：钉在箱底，摆杆从这里转，这里是「不动的」那一点 */
.met-axis {
  position: absolute; left: 50%; top: 266px; transform: translate(-50%, -50%);
  width: 13px; height: 13px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #F3E9CE 0%, #A9926A 55%, #7E6C48 100%);
  box-shadow: 0 0 0 2px rgba(122,96,56,.18), 0 1px 2px rgba(90,70,40,.3);
  z-index: 6;
}
/* 圆点模式：和摆锤区同高，切换时卡片高度、BPM 位置都不跳 */
.dots-stage {
  height: 300px; padding: 0 18px;
  display: flex; align-items: center; justify-content: center;
}
.beat-dots {
  display: flex; justify-content: center; align-items: center;
  gap: 16px; flex-wrap: wrap; max-width: 340px;
}
.beat-dot {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; color: var(--text-dim);
  font-variant-numeric: tabular-nums; line-height: 1;
  background: var(--bg-soft); border: 1.5px solid var(--card-edge);
  transition: transform 0.08s, background 0.08s, border-color 0.08s, color 0.08s;
}
.beat-dot.acc {
  width: 66px; height: 66px; font-size: 18px;
  color: var(--red); border-color: #E3C8BD;
}
.beat-dots.many .beat-dot { width: 38px; height: 38px; font-size: 12px; }
.beat-dots.many .beat-dot.acc { width: 46px; height: 46px; font-size: 13px; }
.beat-dot.on { background: var(--bamboo); border-color: var(--bamboo); color: #FFFDF6; transform: scale(1.12); }
.beat-dot.acc.on { background: var(--red); border-color: var(--red); color: #FFF6EA; }
.bpm-big { text-align: center; font-size: 44px; font-weight: 700; color: var(--ink); font-family: var(--serif); padding-bottom: 12px; }
.bpm-big span { font-size: 15px; color: var(--text-faint); margin-left: 8px; letter-spacing: 2px; }

.stat-row { display: flex; margin-bottom: 14px; }
.stat { flex: 1; text-align: center; padding: 12px 0; }
.stat + .stat { border-left: 1px solid var(--card-edge); }
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--text-faint); }

.metro-ctrl { padding: 16px 18px; margin-top: auto; }
.bpm-row { display: flex; align-items: center; justify-content: space-between; }
.bpm-mid { text-align: center; }
.bpm-mid b { font-size: 30px; font-variant-numeric: tabular-nums; }
.bpm-mid span { display: block; font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.round-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--card-edge); background: var(--bg-soft);
  color: var(--text); font-size: 20px; cursor: pointer;
}
.round-btn:active { background: var(--card-edge); }
#bpmSlider { width: 100%; margin: 16px 0 14px; accent-color: var(--bamboo); }
.metro-btns { display: flex; align-items: center; gap: 12px; }
.chip-btn {
  flex: 1; padding: 11px 0; border-radius: 14px;
  border: 1px solid var(--card-edge); background: var(--bg-soft);
  color: var(--text); font-size: 13.5px; cursor: pointer;
}
.play-btn {
  width: 68px; height: 68px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(160deg, #D15B44, var(--red-deep));
  color: #FFF6EA; font-size: 24px;
  box-shadow: 0 6px 18px rgba(160,52,34,0.35);
}
.play-btn.playing { background: linear-gradient(160deg, #8C8570, #6E6852); }
.chip-btn.wide { width: 100%; margin-top: 12px; }

/* ---------- 底部弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(40,32,18,0.42); z-index: 50;
}
.sheet {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: calc(100% - 28px); max-width: 460px; max-height: 82vh; overflow-y: auto;
  background: var(--card); border-radius: 20px; z-index: 60;
  padding: 20px 18px;
  box-shadow: 0 18px 48px rgba(60,45,20,0.3), 0 0 0 1px var(--card-edge);
  -webkit-overflow-scrolling: touch;
}
.sheet:not([hidden]) { animation: sheetIn .18s ease-out; }
@keyframes sheetIn {
  from { opacity: 0; transform: translate(-50%, -47%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { font-size: 17px; font-family: var(--serif); letter-spacing: 1px; }
.sheet-x { border: none; background: var(--bg-soft); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: var(--text-dim); }
.sheet-body { display: flex; flex-direction: column; gap: 10px; }

.opt-row {
  text-align: left; padding: 13px 16px; border-radius: 14px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--card-edge);
  color: var(--text); font-size: 15px; font-weight: 600; width: 100%;
}
.opt-row span { display: block; font-size: 11.5px; color: var(--text-faint); font-weight: 400; margin-top: 2px; }
.opt-row.accent { color: var(--red-deep); }
.opt-row.active { background: #EAF2E6; border-color: var(--bamboo); }
.opt-row.small { font-size: 13px; font-weight: 400; text-align: center; color: var(--text-dim); }

.set-label { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; }
.a4-row { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 8px 0; }
.a4-row b { font-size: 24px; font-variant-numeric: tabular-nums; }
.set-note { font-size: 11.5px; color: var(--text-faint); line-height: 1.7; }
.seg { display: flex; background: var(--bg-soft); border-radius: 12px; padding: 3px; }
.seg-btn {
  flex: 1; padding: 9px 0; border: none; border-radius: 10px; background: transparent;
  color: var(--text-dim); font-size: 14px; cursor: pointer;
}
.seg-btn.active { background: var(--card); color: var(--red-deep); font-weight: 600; box-shadow: 0 1px 4px rgba(90,70,30,0.15); }

.fork-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.fork-key {
  padding: 13px 0; border-radius: 12px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--card-edge);
  color: var(--text); font-size: 16px; font-weight: 600;
}
/* 12 个半音排一屏：升号键（黑键）淡一档，白键才是一眼能认的骨架。
   原先 .active 没写样式，按下后没有任何「正在响这个音」的反馈，这里补上。 */
.fork-key.acc { background: rgba(255, 253, 246, .5); color: var(--text-dim); font-weight: 500; }
.fork-key.active { background: var(--bamboo); border-color: var(--bamboo); color: #FFF; }
.fork-key:active { background: var(--bamboo); color: #FFF; }
.ts-group { font-size: 12px; color: var(--text-faint); margin-top: 6px; }
.ts-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ts-opt {
  flex: 1; min-width: 72px; padding: 10px 4px; border-radius: 12px; cursor: pointer; text-align: center;
  background: var(--bg-soft); border: 1px solid var(--card-edge); color: var(--text); font-size: 14px;
}
.ts-opt small { display: block; font-size: 10px; color: var(--text-faint); margin-top: 2px; }
.ts-opt.active { background: #EAF2E6; border-color: var(--bamboo); color: var(--bamboo-deep); }
.sound-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--card-edge);
}
.sound-row.active { background: #EAF2E6; border-color: var(--bamboo); }
.sound-row b { font-size: 15px; }
/* 试听按钮：三角形用 border 画，避开 ▶ 字形基线偏上的问题，几何上真正居中 */
.sound-row .play-tri {
  margin-left: auto; width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  border: 1px solid var(--card-edge); background: var(--card); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0; line-height: 0; overflow: hidden;
}
.sound-row .play-tri::before {
  content: ''; display: block; width: 0; height: 0;
  border-left: 10px solid var(--bamboo-deep);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  margin-left: 3px;   /* 三角重心偏左，右移一点才是视觉正中 */
}
