/* =========================================================
   幼儿音乐节奏乐园 · 霓虹赛博风格样式表
   ========================================================= */

:root {
  /* —— 严格按视觉规范定义的配色 —— */
  --c-primary:   #d8f33f;   /* 主色 */
  --c-accent:    #32e24c;   /* 辅助色 */
  --c-highlight: #4bfbbd;   /* 强调色 CTA */
  --c-bg:        #14150e;   /* 页面背景 */
  --c-surface:   #22231a;   /* 卡片/表面 */
  --c-text:      #f1f2ee;   /* 正文文字 */
  --c-text-dim:  #abae98;   /* 次要文字 */
  --c-border:    #3e4030;   /* 描边 */

  --font-head: 'Poppins', 'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  --font-body: 'JetBrains Mono', 'Fira Code', ui-monospace, 'SFMono-Regular', 'Courier New', 'Microsoft YaHei', 'PingFang SC', monospace;

  --radius: 4px;
  --cut: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));

  --glow-p:   0 0 12px rgba(216, 243, 63,  .45), 0 0 26px rgba(216, 243, 63, .18);
  --glow-a:   0 0 12px rgba(50,  226, 76,  .40), 0 0 26px rgba(50,  226, 76,  .15);
  --glow-h:   0 0 12px rgba(75,  251, 189, .45), 0 0 26px rgba(75,  251, 189, .18);
  --edge: 0 0 0 1px var(--c-border);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

button { font-family: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font-family: inherit; }
:focus-visible { outline: 2px dashed var(--c-highlight); outline-offset: 3px; }

::selection { background: var(--c-primary); color: var(--c-bg); }

/* ============ 背景特效 ============ */
.bg-grid {
  position: fixed; inset: 0; z-index: -3;
  background-image:
    linear-gradient(rgba(62, 64, 48, .28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(62, 64, 48, .28) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 20%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 20%, #000 40%, transparent 100%);
}
.bg-scan {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg,
    rgba(20, 21, 14, 0) 0 2px,
    rgba(20, 21, 14, .22) 2px 3px,
    rgba(20, 21, 14, 0) 3px 6px);
  opacity: .55;
}
.bg-glow {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(600px 300px at 15% -5%, rgba(216, 243, 63, .10), transparent 65%),
    radial-gradient(700px 400px at 105% 15%, rgba(75, 251, 189, .08), transparent 65%),
    radial-gradient(900px 500px at 50% 120%, rgba(50, 226, 76, .07), transparent 70%);
}

/* ============ 页头 ============ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(20, 21, 14, .86);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 1px 0 rgba(216, 243, 63, .12), 0 10px 30px rgba(0, 0, 0, .35);
}
.header-inner {
  max-width: 1160px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  font-size: 26px; color: var(--c-bg);
  background: var(--c-primary);
  clip-path: var(--cut);
  box-shadow: var(--glow-p);
  animation: brandFloat 3.4s ease-in-out infinite;
}
.brand-name {
  display: block; font-family: var(--font-head);
  font-size: 19px; font-weight: 800; letter-spacing: .5px;
  color: var(--c-text);
  text-shadow: 0 0 14px rgba(216, 243, 63, .35);
}
.brand-en {
  display: block; font-size: 10px; letter-spacing: 3px;
  color: var(--c-text-dim); text-transform: uppercase;
}

.main-nav { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.nav-btn {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-family: var(--font-head); font-size: 14px; font-weight: 600;
  color: var(--c-text-dim);
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: color .2s, border-color .2s, box-shadow .2s, background .2s;
}
.nav-idx { font-size: 10px; color: var(--c-accent); letter-spacing: 1px; }
.nav-btn:hover { color: var(--c-text); border-color: var(--c-border); }
.nav-btn.is-active {
  color: var(--c-primary); background: rgba(216, 243, 63, .08);
  border-color: rgba(216, 243, 63, .5);
  box-shadow: var(--glow-p);
}
.nav-btn.is-active .nav-idx { color: var(--c-primary); }

.sound-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px; font-size: 11px; letter-spacing: 2px;
  color: var(--c-text-dim); border: 1px solid var(--c-border);
  border-radius: var(--radius); transition: all .2s;
}
.sound-btn:hover { color: var(--c-text); border-color: var(--c-highlight); }
.sound-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-highlight); box-shadow: 0 0 8px var(--c-highlight); }
.sound-btn.off .sound-dot { background: var(--c-border); box-shadow: none; }
.sound-btn.off { opacity: .6; }

/* ============ 主区 / 视图切换 ============ */
.site-main { max-width: 1160px; margin: 0 auto; padding: 28px 20px 60px; }

.view { display: none; }
.view.is-active { display: block; animation: viewIn .4s ease both; }

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.view-title {
  font-family: var(--font-head); font-size: clamp(24px, 4vw, 34px);
  font-weight: 800; letter-spacing: 1px;
  text-shadow: 0 0 18px rgba(216, 243, 63, .30);
}
.title-bar { color: var(--c-accent); margin-right: 10px; }
.view-sub { color: var(--c-text-dim); font-size: 12px; letter-spacing: 1px; margin-top: 6px; }

.tag {
  display: inline-block; font-size: 9px; letter-spacing: 2px;
  color: var(--c-bg); background: var(--c-accent);
  padding: 2px 7px; border-radius: var(--radius);
  vertical-align: 2px; margin-left: 6px; font-weight: 700;
}

/* ============ 按钮 ============ */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  font-family: var(--font-head); font-size: 15px; font-weight: 700; letter-spacing: .5px;
  border-radius: var(--radius);
  clip-path: var(--cut);
  transition: transform .12s, box-shadow .2s, background .2s, color .2s;
}
.btn:active { transform: translateY(2px) scale(.98); }
.btn-block { width: 100%; }

.btn-primary {
  color: var(--c-bg); background: var(--c-primary);
  box-shadow: var(--glow-p), var(--edge);
}
.btn-primary:hover { box-shadow: 0 0 18px rgba(216, 243, 63, .6), 0 0 40px rgba(216, 243, 63, .25), var(--edge); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  color: var(--c-text-dim); border: 1px solid var(--c-border); background: var(--c-surface);
}
.btn-ghost:hover { color: var(--c-highlight); border-color: var(--c-highlight); box-shadow: var(--glow-h); }

/* ============ 节奏游戏 ============ */
.song-picker { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.song-chip {
  position: relative; text-align: left;
  padding: 12px 16px 10px;
  min-width: 148px; flex: 1 1 140px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); clip-path: var(--cut);
  transition: all .2s;
}
.song-chip:hover { border-color: var(--c-highlight); }
.song-chip.is-active {
  border-color: var(--c-primary); background: rgba(216, 243, 63, .07);
  box-shadow: var(--glow-p);
}
.chip-name { display: block; font-family: var(--font-head); font-weight: 700; font-size: 16px; }
.chip-bpm { display: block; font-size: 11px; color: var(--c-highlight); letter-spacing: 1px; margin-top: 3px; }
.chip-en { display: block; font-size: 9px; color: var(--c-text-dim); letter-spacing: 2px; margin-top: 2px; }

.judge-legend { display: flex; gap: 8px; flex-wrap: wrap; }
.lg { font-size: 10px; letter-spacing: 1.5px; padding: 4px 8px; border: 1px solid var(--c-border); border-radius: var(--radius); }
.lg-perfect { color: var(--c-highlight); border-color: var(--c-highlight); box-shadow: 0 0 8px rgba(75,251,189,.25); }
.lg-good   { color: var(--c-primary); border-color: var(--c-primary); box-shadow: 0 0 8px rgba(216,243,63,.2); }
.lg-ok     { color: var(--c-accent); border-color: var(--c-accent); }
.lg-miss   { color: var(--c-text-dim); border-color: var(--c-border); }

.game-layout { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }

.hud {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); clip-path: var(--cut);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: rgba(20, 21, 14, .6); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 10px 12px;
}
.stat-label { display: block; font-size: 9px; letter-spacing: 2px; color: var(--c-text-dim); }
.stat-value {
  display: block; font-size: 26px; font-weight: 700; line-height: 1.2; margin-top: 2px;
  color: var(--c-primary); text-shadow: 0 0 12px rgba(216, 243, 63, .4);
  transition: transform .15s;
}
#comboVal { color: var(--c-highlight); text-shadow: 0 0 12px rgba(75,251,189,.5); }
#comboVal.hot { animation: comboHot .5s ease; }
.hud-tip { font-size: 11px; color: var(--c-text-dim); line-height: 1.7; }
.tip-hl { color: var(--c-highlight); font-weight: 700; }

.stage-frame { position: relative; }
.stage {
  position: relative; height: clamp(340px, 58vh, 520px);
  background:
    linear-gradient(180deg, rgba(216,243,63,.03), transparent 40%),
    var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: manipulation;
  cursor: pointer;
}
.stage-guide {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, transparent, var(--c-border) 20%, var(--c-border) 80%, transparent);
  transform: translateX(-50%);
}
.stage-bars { position: absolute; inset: 0; pointer-events: none; }
.beat-bar {
  position: absolute; left: 0; right: 0; height: 1px;
  background: rgba(62, 64, 48, .5);
}
.beat-bar.strong { background: rgba(216, 243, 63, .18); height: 2px; }

.stage-notes { position: absolute; inset: 0; pointer-events: none; }
.note {
  position: absolute; width: 30px; height: 30px;
  transform: translate(-50%, 0) rotate(45deg);
  border: 2px solid var(--c-primary);
  background: rgba(216, 243, 63, .10);
  box-shadow: 0 0 10px rgba(216, 243, 63, .35);
  transition: opacity .25s;
}
.note.clap { border-color: var(--c-accent); background: rgba(50, 226, 76, .10); box-shadow: 0 0 10px rgba(50, 226, 76, .35); }
.note-core {
  position: absolute; inset: 0; display: grid; place-items: center;
  transform: rotate(-45deg);
  font-size: 12px; color: var(--c-primary);
}
.note.clap .note-core { color: var(--c-accent); }

.note.hit-perfect { border-color: var(--c-highlight); background: rgba(75,251,189,.4); box-shadow: 0 0 16px var(--c-highlight); animation: noteFade .5s ease forwards; }
.note.hit-perfect .note-core { color: var(--c-bg); }
.note.hit-good { border-color: var(--c-primary); background: rgba(216,243,63,.4); box-shadow: 0 0 14px var(--c-primary); animation: noteFade .45s ease forwards; }
.note.hit-good .note-core { color: var(--c-bg); }
.note.hit-ok { border-color: var(--c-accent); background: rgba(50,226,76,.35); box-shadow: 0 0 12px var(--c-accent); animation: noteFade .4s ease forwards; }
.note.hit-miss { border-color: var(--c-border); background: rgba(171,174,152,.12); box-shadow: none; }
.note.hit-miss .note-core { color: var(--c-text-dim); }

.hit-line {
  position: absolute; left: 0; right: 0; bottom: 18%;
  height: 3px;
  background: var(--c-highlight);
  box-shadow: 0 0 14px var(--c-highlight), 0 0 34px rgba(75, 251, 189, .35);
  display: flex; align-items: center; justify-content: center;
  animation: hitLinePulse 1.2s ease-in-out infinite;
}
.hit-mid { position: absolute; color: var(--c-highlight); font-size: 15px; text-shadow: 0 0 10px var(--c-highlight); }

.countdown {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-head); font-size: clamp(60px, 14vw, 110px); font-weight: 800;
  color: var(--c-primary); text-shadow: 0 0 30px rgba(216, 243, 63, .6);
  pointer-events: none; z-index: 5;
}
.countdown.pop { animation: countPop .6s ease both; }

.fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.fx {
  position: absolute; transform: translate(-50%, 0);
  font-family: var(--font-head); font-weight: 800; font-size: 16px;
  letter-spacing: 1px; pointer-events: none;
  animation: floatUp .9s ease-out forwards;
  text-shadow: 0 0 12px currentColor;
  white-space: nowrap;
}
.fx.perfect { color: var(--c-highlight); font-size: 20px; }
.fx.good    { color: var(--c-primary); }
.fx.ok      { color: var(--c-accent); }
.fx.miss    { color: var(--c-text-dim); }
.fx.off     { color: var(--c-text-dim); font-size: 13px; }

.tap-guide {
  position: absolute; left: 0; right: 0; top: 12%;
  text-align: center; font-size: 14px; color: var(--c-text-dim);
  letter-spacing: 1px; z-index: 3; pointer-events: none;
  transition: opacity .4s;
  text-shadow: 0 0 10px rgba(0,0,0,.8);
}

.progress-track {
  height: 6px; margin-top: 8px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--c-accent), var(--c-primary), var(--c-highlight));
  box-shadow: 0 0 12px rgba(216, 243, 63, .6);
  transition: width .15s linear;
}

/* —— 结算 —— */
.result-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(10, 10, 7, .72);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  padding: 20px;
}
.result-overlay[hidden] { display: none !important; }
.result-card {
  width: min(420px, 100%);
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); clip-path: var(--cut);
  padding: 30px 26px 26px; text-align: center;
  transform: scale(.85); opacity: 0;
  box-shadow: 0 0 0 1px rgba(216,243,63,.2), 0 0 60px rgba(216,243,63,.12), 0 30px 60px rgba(0,0,0,.5);
}
.result-overlay.show .result-card { animation: popIn .4s cubic-bezier(.2,1.4,.4,1) forwards; }
.result-stars { font-size: 44px; letter-spacing: 8px; margin-bottom: 8px; }
.star { color: var(--c-border); }
.star.on { color: var(--c-primary); text-shadow: 0 0 16px rgba(216, 243, 63, .7); animation: starPop .5s ease both; }
.result-title { font-family: var(--font-head); font-size: 26px; font-weight: 800; text-shadow: 0 0 16px rgba(75,251,189,.4); }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.rs { background: rgba(20,21,14,.6); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 10px; }
.rs-label { display: block; font-size: 9px; letter-spacing: 2px; color: var(--c-text-dim); }
.rs-val { display: block; font-size: 22px; font-weight: 700; color: var(--c-highlight); margin-top: 2px; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ============ 自由演奏 ============ */
.fp-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); clip-path: var(--cut);
  padding: 18px; margin-bottom: 18px;
}
.fp-sec-head { margin-bottom: 14px; }
.fp-sec-head h3 { font-family: var(--font-head); font-size: 17px; font-weight: 700; }
.fp-desc { font-size: 11px; color: var(--c-text-dim); margin-top: 2px; }

.pad-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pad {
  position: relative; min-height: 108px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: rgba(20, 21, 14, .65);
  border: 1px solid var(--c-border); border-radius: var(--radius);
  clip-path: var(--cut);
  transition: transform .1s, box-shadow .15s, border-color .15s, background .15s;
  touch-action: manipulation;
}
.pad:hover { border-color: var(--c-primary); }
.pad-glyph { font-size: 30px; color: var(--c-primary); text-shadow: 0 0 12px rgba(216,243,63,.5); line-height: 1; }
.pad-name { font-family: var(--font-head); font-size: 14px; font-weight: 700; }
.pad-en { font-size: 9px; letter-spacing: 2px; color: var(--c-text-dim); }
.pad.lit {
  transform: translateY(3px) scale(.96);
  border-color: var(--c-primary);
  background: rgba(216, 243, 63, .14);
  box-shadow: var(--glow-p);
}
.pad:nth-child(4n+2) .pad-glyph, .pad:nth-child(4n+2).lit { color: var(--c-accent); text-shadow: 0 0 12px rgba(50,226,76,.5); }
.pad:nth-child(4n+2).lit { border-color: var(--c-accent); box-shadow: var(--glow-a); }
.pad:nth-child(4n+3) .pad-glyph { color: var(--c-highlight); text-shadow: 0 0 12px rgba(75,251,189,.5); }
.pad:nth-child(4n+3).lit { border-color: var(--c-highlight); box-shadow: var(--glow-h); }

.scale-row { display: flex; gap: 8px; }
.key {
  flex: 1; min-width: 0; height: 116px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 12px; gap: 8px;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  clip-path: var(--cut);
  background: linear-gradient(180deg, rgba(216,243,63,.10), rgba(20,21,14,.6) 40%);
  transition: transform .1s, box-shadow .15s, border-color .15s, background .15s;
  touch-action: manipulation;
}
.key:hover { border-color: var(--c-highlight); }
.key.root { border-color: var(--c-primary); box-shadow: inset 0 0 0 1px rgba(216,243,63,.3); }
.key-label { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--c-text); }
.key-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); box-shadow: 0 0 8px var(--c-accent); }
.key.root .key-dot { background: var(--c-primary); box-shadow: 0 0 8px var(--c-primary); }
.key.lit {
  transform: translateY(4px);
  border-color: var(--c-primary);
  background: linear-gradient(180deg, rgba(216,243,63,.28), rgba(20,21,14,.6) 55%);
  box-shadow: var(--glow-p);
}

.recorder { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rec-status { font-size: 12px; color: var(--c-text-dim); letter-spacing: .5px; }
.rec-on { animation: recBlink 1s steps(2, start) infinite; }
#playRecBtn.rec-on { color: var(--c-highlight); border-color: var(--c-highlight); box-shadow: var(--glow-h); animation: none; }

/* ============ 音乐知识角 ============ */
.k-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 18px; }
.k-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); clip-path: var(--cut);
  padding: 18px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.k-card:hover { border-color: var(--c-highlight); box-shadow: var(--glow-h); transform: translateY(-2px); }
.k-title { font-family: var(--font-head); font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.k-text { font-size: 13px; color: var(--c-text-dim); line-height: 1.8; }
.k-text strong { color: var(--c-highlight); font-weight: 700; }
.k-emoji { font-style: normal; }

.k-visual { display: flex; gap: 8px; margin-top: 14px; }
.k-visual span {
  flex: 1; text-align: center; padding: 10px 0;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  font-family: var(--font-head); font-weight: 700; font-size: 14px;
  background: rgba(20,21,14,.55);
}
.rhythm-vis span { color: var(--c-primary); }
.meter-vis span:first-child, .meter-vis span:nth-child(3) { color: var(--c-highlight); }
.meter-vis span:nth-child(2), .meter-vis span:nth-child(4) { color: var(--c-text-dim); }

.note-vis .nv { position: relative; font-size: 22px; color: var(--c-primary); text-shadow: 0 0 10px rgba(216,243,63,.4); }
.note-vis .nv i { position: absolute; left: 0; right: 0; bottom: -14px; font-style: normal; font-size: 10px; color: var(--c-text-dim); font-family: var(--font-body); }
.k-family { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.k-family span { padding: 7px 12px; border: 1px solid var(--c-border); border-radius: var(--radius); font-size: 13px; background: rgba(20,21,14,.55); }

.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.demo-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); clip-path: var(--cut);
  padding: 18px;
}
.demo-card h3 { font-family: var(--font-head); font-size: 17px; font-weight: 700; }
.demo-desc { font-size: 12px; color: var(--c-text-dim); margin: 4px 0 14px; }

.beat-dots { display: flex; justify-content: center; gap: 18px; margin: 10px 0 16px; }
.bd {
  width: 46px; height: 46px; display: grid; place-items: center;
  border: 1px solid var(--c-border); border-radius: 50%;
  font-family: var(--font-head); font-weight: 700; font-size: 17px;
  color: var(--c-text-dim); background: rgba(20,21,14,.6);
  transition: all .15s;
}
.bd.on { border-color: var(--c-primary); color: var(--c-bg); background: var(--c-primary); box-shadow: var(--glow-p); }
.bd.is-one { border-color: var(--c-highlight); }
.bd.is-one.on { border-color: var(--c-highlight); background: var(--c-highlight); box-shadow: var(--glow-h); }

.metro-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.metro-bpm { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 220px; }
.metro-bpm input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none; height: 4px;
  background: var(--c-border); border-radius: 2px; outline: none;
}
.metro-bpm input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 2px;
  background: var(--c-primary); box-shadow: var(--glow-p); cursor: pointer;
}
.metro-bpm input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border: 0; border-radius: 2px;
  background: var(--c-primary); box-shadow: var(--glow-p); cursor: pointer;
}
.bpm-readout { font-size: 22px; font-weight: 700; color: var(--c-highlight); min-width: 46px; text-align: right; }
.bpm-unit { font-size: 10px; color: var(--c-text-dim); letter-spacing: 1px; }

.instr-demo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.demo-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 6px 10px;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background: rgba(20,21,14,.6);
  transition: all .15s;
  touch-action: manipulation;
}
.demo-btn:hover { border-color: var(--c-highlight); }
.demo-glyph { font-size: 24px; color: var(--c-accent); text-shadow: 0 0 10px rgba(50,226,76,.4); line-height: 1; }
.demo-name { font-size: 11px; }
.demo-btn.lit { border-color: var(--c-primary); box-shadow: var(--glow-p); transform: translateY(2px); }
.demo-btn.lit .demo-glyph { color: var(--c-primary); }

.quiz-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); clip-path: var(--cut);
  padding: 20px;
}
.quiz-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.quiz-top h3 { font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.quiz-score { font-size: 13px; color: var(--c-highlight); font-weight: 700; }
.quiz-question { font-size: 16px; font-weight: 600; margin-bottom: 14px; line-height: 1.7; }
.quiz-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice {
  padding: 14px; font-size: 15px;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background: rgba(20,21,14,.6);
  transition: all .15s;
}
.choice:hover:not(:disabled) { border-color: var(--c-primary); box-shadow: var(--glow-p); }
.choice.correct { border-color: var(--c-highlight); color: var(--c-bg); background: var(--c-highlight); box-shadow: var(--glow-h); }
.choice.wrong { border-color: var(--c-text-dim); color: var(--c-text-dim); background: rgba(171,174,152,.1); }
.choice:disabled { cursor: default; }
.quiz-info {
  margin-top: 14px; font-size: 13px; color: var(--c-text-dim);
  line-height: 1.8; display: none; padding: 10px 12px;
  border-left: 3px solid var(--c-accent); background: rgba(50,226,76,.06);
}
.quiz-info.show { display: block; animation: viewIn .3s ease; }
.quiz-next { margin-top: 16px; }
.quiz-result { text-align: center; padding: 8px 0 4px; }
.quiz-stars { font-size: 38px; letter-spacing: 6px; margin-bottom: 6px; }

/* ============ 页脚 ============ */
.site-footer {
  border-top: 1px solid var(--c-border);
  padding: 22px 20px 34px; text-align: center;
  color: var(--c-text-dim); font-size: 12px;
}
.footer-mono { margin-top: 6px; font-size: 10px; letter-spacing: 2px; opacity: .8; }

/* ============ 动画 ============ */
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -70px) scale(1); }
}
@keyframes noteFade {
  0% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 0) rotate(45deg) scale(1.6); }
}
@keyframes countPop { 0% { opacity: 0; transform: scale(2.2); } 30% { opacity: 1; transform: scale(1); } 100% { opacity: .4; transform: scale(.85); } }
@keyframes hitLinePulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
@keyframes starPop { 0% { opacity: 0; transform: scale(0) rotate(-40deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes comboHot { 0%,100% { transform: scale(1); } 40% { transform: scale(1.35); } }
@keyframes recBlink { 50% { opacity: .45; } }
@keyframes brandFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.shake { animation: shakeX .4s ease; }
@keyframes shakeX { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .hud { flex-direction: row; flex-wrap: wrap; align-items: stretch; }
  .hud .stat-row { flex: 1; min-width: 200px; }
  .hud-tip { flex-basis: 100%; }
  .hud .btn { flex: 1; }
  .k-grid, .demo-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .site-main { padding: 20px 14px 50px; }
  .brand-name { font-size: 16px; }
  .brand-en { display: none; }
  .brand-mark { width: 38px; height: 38px; font-size: 22px; }
  .header-inner { gap: 10px; padding: 10px 12px; }
  .main-nav { margin-left: 0; order: 3; width: 100%; }
  .nav-btn { flex: 1; justify-content: center; padding: 9px 6px; font-size: 13px; }
  .sound-btn { margin-left: auto; }
  .view-head { align-items: flex-start; flex-direction: column; }
  .pad-grid { grid-template-columns: repeat(2, 1fr); }
  .pad { min-height: 92px; }
  .scale-row { overflow-x: auto; padding-bottom: 8px; }
  .key { min-width: 64px; height: 96px; }
  .instr-demo { grid-template-columns: repeat(4, 1fr); }
  .quiz-choices { grid-template-columns: 1fr; }
  .stage { height: 60vh; min-height: 340px; }
  .judge-legend { display: none; }
}
