/* 识谱练习器：一屏内完成，题干在上、选项在下、反馈紧贴选项。
   色板与圆角沿用 static/styles.css 的 token，不新开一套视觉。 */

/* ---------- 页面骨架 ---------- */
.nr-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 0 8px;
}

.nr-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.nr-group {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font: 600 12.5px/1.2 inherit;
  cursor: pointer;
  min-height: 44px;
  transition: background .12s, border-color .12s, color .12s;
}

.nr-group:hover { border-color: #c7d2fe; color: var(--accent); }

.nr-group.is-active {
  background: var(--accent-soft);
  border-color: #c7d2fe;
  color: var(--accent);
}

/* ---------- 练习区 ---------- */
.nr-stage {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}

.nr-card-wrap:empty { display: none; }
.nr-stage:not(.is-started) .nr-actions,
.nr-stage:not(.is-started) .nr-feedback,
.nr-stage:not(.is-started) .nr-meta { display: none; }

.nr-card-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  min-height: 0;
  align-items: center;
}

.nr-card {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
}

.nr-staff { stroke: #d8cfbe; stroke-width: 1.2; }
.nr-ledger { stroke: var(--accent); stroke-width: 1.8; }
.nr-clef { font-family: Georgia, serif; font-size: 100px; fill: var(--ink); }
.nr-head { fill: var(--ink); }
.nr-head-open { fill: none; stroke: var(--ink); stroke-width: 1.8; }
.nr-stem { stroke: var(--ink); stroke-width: 1.8; }
.nr-flag { fill: none; stroke: var(--ink); stroke-width: 1.8; }
.nr-dot { fill: var(--ink); }
.nr-accidental {
  font-family: Georgia, serif; font-size: 24px; fill: var(--ink); text-anchor: middle;
}
.nr-label {
  font-family: var(--mono); font-size: 14px; fill: var(--muted); text-anchor: middle;
}
.nr-rest { fill: var(--ink); }
.nr-rest-stroke {
  fill: none; stroke: var(--ink); stroke-width: 2.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* 指位网格 */
.nr-grid { display: block; width: 100%; max-width: 380px; height: auto; }
.nr-grid-head {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  fill: var(--muted); text-anchor: middle;
}
.nr-grid-side {
  font-family: var(--mono); font-size: 11px; fill: var(--muted); text-anchor: end;
}
.nr-grid-cell { fill: #f2eee4; stroke: none; transition: fill .16s; }
.nr-grid-cell.is-on { fill: var(--accent); }

/* ---------- 计时条 ---------- */
.nr-timer {
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 0 12px;
}
.nr-timer i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(1);
}
.nr-timer.is-urgent i { background: var(--warm); }
.nr-timer[hidden] { display: none; }

/* ---------- 选项 ---------- */
.nr-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.nr-choice {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: 600 15px/1.3 inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color .12s, background .12s, transform .12s;
}

.nr-choice:hover:not(:disabled) { transform: translateY(-1px); border-color: #c7d2fe; }
.nr-choice:disabled { cursor: default; }

.nr-choice-key {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #f2eee4;
  color: var(--muted);
  font: 700 11px/1 var(--mono);
}

.nr-choice.is-correct {
  border-color: var(--good);
  background: var(--good-soft);
  color: #0b5f58;
}
.nr-choice.is-correct .nr-choice-key { background: var(--good); color: #fff; }

.nr-choice.is-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: #8f1d1d;
}
.nr-choice.is-wrong .nr-choice-key { background: var(--danger); color: #fff; }

/* ---------- 反馈 ---------- */
.nr-feedback {
  min-height: 22px;
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}
.nr-feedback.is-ok { color: var(--good); }
.nr-feedback.is-bad { color: var(--danger); }
.nr-feedback.is-timeout { color: var(--warm); }

/* ---------- 统计与操作 ---------- */
.nr-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.nr-stat b {
  margin-left: 4px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  margin-right: 5px;
}

.nr-actions { margin-top: 12px; }

.nr-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 14px;
  font: 600 12.5px/1.2 inherit;
  cursor: pointer;
  min-height: 38px;
}
.nr-btn:hover { border-color: #c7d2fe; color: var(--accent); }
.nr-btn-ghost { color: var(--muted); }

/* ---------- 移动端 ---------- */
@media (max-width: 620px) {
  .nr-stage { padding: 14px 12px 12px; }
  .nr-choices { gap: 8px; }
  .nr-choice { min-height: 48px; font-size: 14px; padding: 8px 10px; }
  .nr-card-wrap:empty { display: none; }
.nr-stage:not(.is-started) .nr-actions,
.nr-stage:not(.is-started) .nr-feedback,
.nr-stage:not(.is-started) .nr-meta { display: none; }

.nr-card-wrap { min-height: 0; }
  .nr-meta { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .nr-choice, .nr-group, .nr-grid-cell { transition: none; }
  .nr-choice:hover:not(:disabled) { transform: none; }
}

/* ---------- 练法说明 ---------- */
.nr-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-width: 720px;
}
.nr-step {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}
.nr-step-num {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .06em;
}

/* ---------- 板块入口卡片 ---------- */
.nr-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.nr-card-item a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.nr-card-item a:hover {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: var(--shadow);
}
.nr-card-title { font-size: 16px; font-weight: 700; }
.nr-card-sub { font-size: 12.5px; line-height: 1.55; color: var(--muted); }

.nr-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.nr-start {
  grid-column: 1 / -1;
  justify-content: center;
  min-height: 48px;
  font-size: 15px;
  border-color: #c7d2fe;
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- 节奏打拍 ---------- */
.nr-rhythm-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.nr-rhythm-bpm {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.nr-rhythm-bpm input { width: 120px; accent-color: var(--accent); }
.nr-rhythm-bpm b { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.nr-rhythm-modes { display: flex; gap: 8px; }

.nr-rhythm-track {
  display: flex;
  gap: 8px;
  padding: 16px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.nr-beat {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border-radius: 10px;
  background: #f2eee4;
}
.nr-beat-syl { font-size: 15px; font-weight: 700; color: var(--ink); }
.nr-beat-num { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.nr-rhythm-runner {
  position: relative;
  height: 10px;
  margin: 0 0 14px;
}
.nr-rhythm-runner i {
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--accent);
}
.nr-rhythm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.nr-btn-primary {
  background: var(--accent-soft);
  border-color: #c7d2fe;
  color: var(--accent);
}

/* ---------- 视奏 / 唱谱 ---------- */
.nr-sol-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.nr-score-host {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 160px;
}
.nr-score-host svg { display: block; width: 100%; height: auto; }
.nr-sight-status { margin: 0; font-size: 12.5px; color: var(--muted); }

@media (max-width: 620px) {
  .nr-beat { padding: 8px 2px; }
  .nr-beat-syl { font-size: 13px; }
}

.nr-score-meta {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 认谱对照页 ---------- */
.rn-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.rn-quiz { margin-left: auto; }

.rn-board {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px 14px;
  overflow-x: auto;
}
.rn-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 10px;
}
.rn-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 6px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.rn-card:hover { transform: translateY(-2px); border-color: #c7d2fe; box-shadow: var(--shadow); }
.rn-card.is-revealed { border-color: var(--accent); }
.rn-mini { display: block; width: 100%; height: auto; }
.rn-name { margin: 4px 0 0; font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--ink); }
.rn-solfa { margin: 1px 0 0; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.rn-pos { margin: 2px 0 0; font-family: var(--mono); font-size: 10.5px; color: #9a9484; }

.rn-line { stroke: #d8cfbe; stroke-width: 1.2; }
.rn-ledger { stroke: var(--accent); stroke-width: 1.8; }
.rn-clef-mini { font-family: Georgia, serif; font-size: 34px; fill: var(--ink); text-anchor: middle; }
.rn-head { fill: var(--ink); }
.rn-stem { stroke: var(--ink); stroke-width: 1.7; }

.rn-card.is-revealed .rn-head { fill: var(--accent); }
.rn-card:hover .rn-head { fill: var(--accent); }

.rn-board.rn-hide-name .rn-name,
.rn-board.rn-hide-solfa .rn-solfa,
.rn-board.rn-hide-pos .rn-pos { display: none; }

/* 遮挡自测：先全藏，点过才显示 */
.rn-board.rn-quiz .rn-name,
.rn-board.rn-quiz .rn-solfa,
.rn-board.rn-quiz .rn-pos { opacity: 0; }
.rn-board.rn-quiz .rn-card.is-revealed .rn-name,
.rn-board.rn-quiz .rn-card.is-revealed .rn-solfa,
.rn-board.rn-quiz .rn-card.is-revealed .rn-pos { opacity: 1; }

@media (max-width: 760px) {
  .rn-quiz { margin-left: 0; }
}

/* 认谱卡片：沿用指法页的手指分色（UI-SPEC「指法分组底色」） */
.rn-card.fbf-0 { border-color: #dfe3fb; }
.rn-card.fbf-1 { border-color: #d9e8f3; }
.rn-card.fbf-2 { border-color: #d9ebe0; }
.rn-card.fbf-3 { border-color: #f2e4cd; }
.rn-card.fbf-4 { border-color: #f2ddd6; }
.rn-card.fbf-0 { background: #eef0ff; }
.rn-card.fbf-1 { background: #e6f0f8; }
.rn-card.fbf-2 { background: #e8f4ea; }
.rn-card.fbf-3 { background: #fdf3e2; }
.rn-card.fbf-4 { background: #f9ece8; }

/* 认谱：按弦分组的标题 */
.rn-group-sec { margin-bottom: 18px; }
.rn-group-sec:last-child { margin-bottom: 0; }
.rn-group-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.rn-group-count {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--muted);
}

