/* 键盘钢琴 · 深色主题（沿用本仓设计 tokens，与扫雷/棋类站同族） */
:root { --kbd-h: clamp(150px, 26vh, 215px); }
  body {
    --bgA: #1e3a5f;      --bgB: #0f172a;
    --card: #1e293b;     --panel: #0f172a;
    --glass: rgba(30, 41, 59, .85);
    --border: rgba(148,163,184,.15);
    --border2: rgba(148,163,184,.3);
    --accent: #10b981;   --accentH: #34d399;
    --btnText: #062a1e;
    --btn2: #334155;     --btn2h: #475569;
    --bad: #f87171;
    --text: #e2e8f0;     --muted: #94a3b8;
    --shadowBar: 0 8px 24px rgba(0,0,0,.35);
    --shadowPanel: 0 12px 40px rgba(0,0,0,.5);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  /* 触屏：消除双击缩放判定带来的点击延迟 */
  button, select, input { touch-action: manipulation; }
  body {
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    background: radial-gradient(1200px 800px at 50% -10%, var(--bgA) 0%, var(--bgB) 55%) fixed;
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: safe center;
    padding: 4px 12px;
    color: var(--text);
    user-select: none; -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  h1 {
    font-size: 19px; letter-spacing: 1px; margin-right: 6px; white-space: nowrap;
    background: linear-gradient(90deg, #34d399, #60a5fa);
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  .zl-home {
    font-style: italic; font-weight: 900; font-size: 18px; line-height: 1;
    white-space: nowrap; text-decoration: none; padding: 0 1px;
    background: linear-gradient(90deg, #34d399, #60a5fa);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    transition: filter .15s;
  }
  .zl-home:hover { filter: brightness(1.3) drop-shadow(0 0 6px var(--accent)); }

  /* ---------- 工具栏 ---------- */
  .toolbar {
    background: var(--glass); backdrop-filter: blur(6px);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 12px 16px; margin-bottom: 8px;
    display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
    max-width: 1100px; width: 100%;
    box-shadow: var(--shadowBar);
    font-size: 13px;
  }
  button.ui {
    font-size: 13px; padding: 7px 11px;
    background: var(--accent); color: var(--btnText); font-weight: 700;
    border: none; border-radius: 7px; cursor: pointer;
    transition: background .15s, transform .1s;
  }
  button.ui:hover { background: var(--accentH); }
  button.ui:active { transform: scale(.96); }
  button.ui.secondary { background: var(--btn2); color: var(--text); font-weight: 600; }
  button.ui.secondary:hover { background: var(--btn2h); }
  button.ui.on { background: var(--accent); color: var(--btnText); }
  button.ui:disabled { opacity: .45; cursor: not-allowed; transform: none; }
  button.ui.danger { background: #b91c1c; color: #fff; }
  button.ui.danger:hover { background: #dc2626; }
  button:focus-visible, input:focus-visible { outline: 2px solid var(--accentH); outline-offset: 2px; }

  /* 标注切换（分段按钮） */
  .seg { display: inline-flex; border: 1px solid var(--border2); border-radius: 7px; overflow: hidden; }
  .seg button { border-radius: 0 !important; }
  .seg button + button { border-left: 1px solid var(--border2); }
  .oct { display: inline-flex; align-items: center; gap: 6px; }
  .oct button { padding: 7px 10px; }
  #octShow {
    min-width: 30px; text-align: center; font-weight: 700;
    font-family: Consolas, monospace; color: var(--text);
  }
  .vol { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
  .vol input[type=range] { width: 92px; accent-color: var(--accent); cursor: pointer; }

  /* ---------- 舞台 ---------- */
  main { width: 100%; max-width: 1100px; display: flex; flex-direction: column; gap: 10px; }
  .stage { display: flex; flex-direction: column; gap: 10px; }
  .kb-frame {
    background: linear-gradient(#26344a, #1a2536);
    border: 1px solid var(--border2); border-radius: 14px;
    padding: 10px 10px 13px;
    box-shadow: var(--shadowPanel);
  }
  .felt {
    height: 5px; border-radius: 4px 4px 0 0;
    background: linear-gradient(#c53030, #7f1d1d);
    margin-bottom: 2px;
  }
  #kb {
    position: relative; display: flex;
    height: var(--kbd-h);
    touch-action: none;          /* 弹奏手势归页面，浏览器不抢 */
    user-select: none; -webkit-user-select: none;
  }
  .k { position: relative; cursor: pointer; }
  .k.w {
    background: linear-gradient(#fdfefe 0%, #eef2f7 82%, #dbe3ec 100%);
    border: 1px solid #8fa0b3; border-left: none;
    border-radius: 0 0 7px 7px;
    box-shadow: inset 0 -7px 9px -6px rgba(15,23,42,.5);
    transition: background .05s;
  }
  .k.w:first-child { border-left: 1px solid #8fa0b3; border-radius: 0 0 8px 8px; }
  .k.w.on {
    background: linear-gradient(#d9f5ea 0%, #b9e8d5 90%, #a3ddc6 100%);
    box-shadow: inset 0 3px 7px rgba(15,23,42,.28), inset 0 -6px 10px -6px rgba(16,185,129,.55);
  }
  .k.b {
    position: absolute; top: 0;
    z-index: 2; height: 62%;
    background: linear-gradient(#435062 0%, #2a3547 8%, #101623 78%, #05080e 100%);
    border: 1px solid #000; border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 5px 7px rgba(0,0,0,.55), inset 0 -9px 12px -8px rgba(255,255,255,.28);
    transition: background .05s;
  }
  .k.b.on {
    background: linear-gradient(#1d2736 0%, #0d1320 80%);
    box-shadow: inset 0 2px 5px rgba(0,0,0,.6), inset 0 -6px 10px -6px rgba(16,185,129,.6);
  }
  .lbl {
    position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
    font-size: 11px; line-height: 1; color: #5b6b80;
    pointer-events: none; white-space: nowrap;
  }
  .k.w.on .lbl { color: #2f6f57; }
  .k.b .lbl { color: #a9bad0; bottom: 7px; font-size: 10px; }
  .lbl.jp { font-size: 15px; font-weight: 700; color: #46566c; }
  .k.b .lbl.jp { color: #a9bad0; }
  .lbl i { position: absolute; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
  .lbl i.hi { top: -7px; }
  .lbl i.lo { bottom: -7px; }

  .key-hint { text-align: center; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
  .key-hint b { color: var(--text); font-family: Consolas, monospace; }

  /* ---------- 录音 / 曲目 ---------- */
  .panel {
    background: var(--glass);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 10px 16px;
    display: flex; flex-wrap: wrap; gap: 8px 26px; align-items: center;
    box-shadow: var(--shadowBar); font-size: 13px;
  }
  .pgroup { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .pgroup h2 { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: 1px; }
  .rec-time { font-family: Consolas, monospace; color: var(--accentH); min-width: 44px; font-size: 12.5px; }
  .chip { min-width: 64px; }

  /* ---------- 响应式 ---------- */
  @media (max-width: 640px) {
    :root { --kbd-h: clamp(132px, 21vh, 170px); }
    body { padding: 4px 8px; }
    .toolbar { padding: 8px 10px; gap: 8px 10px; }
    h1 { font-size: 17px; }
    .vol input[type=range] { width: 74px; }
    .kb-frame { padding: 7px 7px 10px; border-radius: 11px; }
    .panel { padding: 8px 10px; gap: 8px 16px; }
    .key-hint { font-size: 12px; }
    .lbl { font-size: 10px; bottom: 5px; }
    .lbl.jp { font-size: 13px; }
    .k.b .lbl { font-size: 9px; }
  }
  /* 触屏为主、且没有鼠标的设备：电脑键盘相关控件与提示无意义，收起 */
  @media (hover: none) and (pointer: coarse) {
    .oct, .key-hint { display: none; }
  }
