:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #18202f;
  --muted: #627084;
  --line: #dfe6ef;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warm: #f59e0b;
  --blue: #2563eb;
  --danger: #b42318;
  --ok: #159447;
  --shadow: 0 16px 40px rgba(31, 42, 68, 0.09);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

.page-edit-controls {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 5px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 24px rgba(31, 42, 68, 0.14);
}

.page-edit-controls button {
  min-width: 70px;
  height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #f8fafc;
  color: #243247;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.page-edit-controls button:hover:not(:disabled) { border-color: #0f766e; background: #ecfdf5; }
.page-edit-controls button:disabled { cursor: not-allowed; opacity: 0.45; }
.page-edit-controls .page-save-button { background: #0f766e; border-color: #0f766e; color: #fff; }
.page-edit-controls .page-save-button:hover:not(:disabled) { background: #0b5f59; }
.page-edit-tools { display: flex; align-items: center; gap: 5px; }
.page-edit-tools[hidden] { display: none; }
.page-edit-tools button { min-width: 38px; padding: 0 8px; }
.page-edit-tools span { min-width: 70px; color: #526174; font-size: 12px; text-align: center; }
.page-save-status { position: absolute; top: 46px; right: 0; min-width: 140px; color: #0b5f59; font-size: 12px; font-weight: 700; text-align: right; }

body.layout-edit-mode { user-select: none; }
body.layout-edit-mode [data-layout-editable] {
  cursor: text;
  user-select: text;
  outline: 1px dashed rgba(15, 118, 110, 0.5);
  outline-offset: 3px;
}

body.layout-edit-mode [data-layout-editable]:hover,
body.layout-edit-mode [data-layout-editable].layout-selected {
  outline: 2px solid #0f766e;
  background: rgba(236, 253, 245, 0.72);
}

body.layout-edit-mode [data-layout-block] {
  position: relative;
  outline: 1px dashed #94a3b8;
  outline-offset: 3px;
}

body.layout-edit-mode [data-layout-block].layout-selected { outline: 2px solid #2563eb; }
.layout-drag-handle,
.layout-resize-handle { display: none; }

body.layout-edit-mode .layout-drag-handle,
body.layout-edit-mode .layout-resize-handle { display: grid; place-items: center; position: absolute; z-index: 40; }
body.layout-edit-mode .layout-drag-handle {
  top: 5px;
  right: 5px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #2563eb;
  border-radius: 5px;
  background: #fff;
  color: #1d4ed8;
  font-size: 16px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
}

body.layout-edit-mode .layout-drag-handle:active { cursor: grabbing; }
body.layout-edit-mode .layout-resize-handle {
  right: 3px;
  bottom: 3px;
  width: 18px;
  height: 18px;
  border: 0;
  border-right: 3px solid #2563eb;
  border-bottom: 3px solid #2563eb;
  background: transparent;
  cursor: nwse-resize;
  touch-action: none;
}

@media (max-width: 760px) {
  .page-edit-controls { top: 8px; right: 8px; }
  .page-edit-controls button { min-width: 58px; }
  .page-edit-tools span { display: none; }
  [data-layout-block].layout-user-sized { max-width: 100%; }
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #142136;
  color: #f8fbff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-copy {
  min-width: 0;
}

.brand strong {
  font-size: 18px;
  line-height: 1.25;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  font-size: 26px;
  font-weight: 700;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  max-width: 176px;
  margin-top: 4px;
  color: #b8c5d8;
  font-size: 12px;
  line-height: 1.45;
}

.login-card,
.status-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 16px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.sidebar label {
  color: #d5dfec;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

.option-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
}

.option-switch input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.option-switch span,
.option-switch b,
.option-switch small {
  display: block;
}

.option-switch b {
  color: var(--ink);
}

.option-switch small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 400;
}

.login-card input {
  margin-bottom: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
}

.segment {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 9px;
  background: transparent;
  color: #dce7f5;
  cursor: pointer;
}

.segment.active {
  background: #f8fbff;
  color: #142136;
}

.primary-button {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.secondary-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #f8fafc;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: #99b8d8;
  background: #eef6ff;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.score-command-group button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  border-radius: 6px;
  padding: 12px 14px;
  background: transparent;
  color: #dce7f5;
  text-align: left;
  cursor: pointer;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
}

.teacher-only {
  display: none !important;
}

body.teacher-mode .teacher-only {
  display: block !important;
}

body.teacher-mode .teacher-only[hidden] {
  display: none !important;
}

body.teacher-mode form.teacher-only.compact-form { display: grid !important; }
body.teacher-mode .view.teacher-only { display: none !important; }
body.teacher-mode .view.teacher-only.active { display: block !important; }

body.teacher-mode .student-only { display: none !important; }
.login-status { display: block; margin-top: 9px; color: #b8c5d8; font-size: 11px; line-height: 1.45; }
.session-badge { padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; color: #526174; font-size: 12px; font-weight: 800; white-space: nowrap; }
.session-badge.online { border-color: #86c5b8; background: #ecfdf5; color: #0b5f59; }

.status-card {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-card strong,
.status-card small {
  display: block;
}

.status-card small {
  margin-top: 2px;
  color: #b8c5d8;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--warm);
}

.status-dot.ok {
  background: var(--ok);
}

.status-dot.bad {
  background: var(--danger);
}

.workspace {
  padding: 28px;
  overflow: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
}

h3 {
  margin-bottom: 16px;
}

.topbar-actions {
  width: min(360px, 100%);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.overview-grid article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.overview-grid article {
  padding: 18px;
}

.overview-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.overview-grid strong {
  font-size: 28px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin: 8px 0 16px;
}

.section-heading p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}

.badge {
  white-space: nowrap;
  border: 1px solid #a7f3d0;
  color: #047857;
  background: #ecfdf5;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 16px;
}

.panel {
  padding: 18px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 10px 0 16px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}

.record-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.record-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.record-status strong {
  margin-left: auto;
  color: var(--ink);
}

.record-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #a9b5c6;
}

.record-dot.live {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(180, 35, 24, 0.12);
}

.score-panel {
  min-height: 260px;
}

.score-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.score-toolbar button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 6px;
  cursor: pointer;
}

.editor-status {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.editor-status strong,
.editor-status span {
  display: block;
}

.editor-status span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 4px;
}

.editor-status.loaded {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.editor-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.score-sheet {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px 18px 18px;
  overflow-x: auto;
  min-height: 420px;
  max-height: 720px;
  overflow-y: auto;
}

.score-system {
  min-width: 1040px;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef2f7;
}

.score-system:last-child {
  margin-bottom: 0;
  border-bottom: 0;
}

.staff-preview {
  position: relative;
  min-width: 1040px;
  height: 92px;
  background: #fff;
  padding: 18px 0 0;
}

.clef-symbol {
  position: absolute;
  left: 4px;
  top: 6px;
  font-size: 72px;
  line-height: 1;
  color: #111827;
  z-index: 2;
}

.green-guide {
  position: absolute;
  left: 82px;
  top: 0;
  bottom: -86px;
  width: 2px;
  background: #2f8c3a;
  z-index: 4;
}

.numbered-system {
  position: relative;
  min-width: 1040px;
  min-height: 100px;
  display: grid;
  grid-template-columns: 150px 1fr;
  column-gap: 0;
}

.numbered-left {
  position: relative;
  min-height: 88px;
}

.jianpu-key {
  position: absolute;
  left: 82px;
  top: 16px;
  color: #111827;
  font-size: 24px;
  font-weight: 900;
  z-index: 2;
}

.meter-caption {
  position: absolute;
  left: 58px;
  top: 48px;
  color: #111827;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 900;
  text-decoration: underline;
  z-index: 2;
}

.time-signature {
  position: absolute;
  left: 54px;
  top: 28px;
  display: grid;
  gap: 0;
  color: #111827;
  font-family: Georgia, serif;
  font-size: 27px;
  font-weight: 900;
  line-height: 0.9;
  z-index: 2;
}

.bar-lines {
  position: absolute;
  left: 150px;
  right: 0;
  top: 19px;
  height: 72px;
  pointer-events: none;
  z-index: 1;
}

.bar-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #111827;
}

.bar-line.end {
  width: 5px;
}

.staff-line {
  height: 1px;
  background: #111827;
  margin-bottom: 18px;
  margin-left: 0;
  width: 100%;
}

.note {
  position: absolute;
  font-size: 28px;
  color: #111827;
  user-select: none;
  z-index: 3;
}

.note-head {
  position: absolute;
  width: 18px;
  height: 12px;
  border-radius: 50%;
  background: #111827;
  transform: rotate(-18deg);
  z-index: 3;
}

.note-head::after {
  content: "";
  position: absolute;
  left: 14px;
  bottom: 5px;
  width: 2px;
  height: 46px;
  background: #111827;
  transform: rotate(18deg);
  transform-origin: bottom center;
}

.note-head.half {
  background: #fcfdff;
  border: 2px solid #111827;
}

.note-head.no-stem::after {
  display: none;
}

.ledger-line {
  position: absolute;
  width: 28px;
  height: 2px;
  background: #111827;
  z-index: 2;
}

.n1 { left: 170px; top: 64px; }
.n2 { left: 235px; top: 64px; }
.n3 { left: 300px; top: 46px; }
.n4 { left: 365px; top: 46px; }
.n5 { left: 480px; top: 28px; }

.rhythm-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.rhythm-cell {
  border: 1px solid #fde68a;
  border-radius: 6px;
  background: #fffbeb;
  color: #92400e;
  padding: 7px 9px;
  font-size: 13px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.form-grid .wide {
  grid-column: span 3;
}

.form-grid .primary-button {
  align-self: end;
}

.result-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.result-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.result-card strong {
  display: block;
  margin-bottom: 8px;
}

.result-card p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 10px;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.download-row a {
  border-radius: 6px;
  padding: 9px 11px;
  background: #eef6ff;
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 800;
}

.chord-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.chord-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.chord-item b {
  display: block;
  font-size: 20px;
  color: var(--accent);
}

.harmony-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.harmony-steps span { padding: 11px 14px; border-right: 1px solid var(--line); color: #617086; font-size: 13px; font-weight: 700; text-align: center; }
.harmony-steps span:last-child { border-right: 0; }
.harmony-steps span.active { background: #eaf7f5; color: #0b5f59; }

.harmony-source-band {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #fff;
}

.harmony-source-band > div { display: grid; gap: 2px; margin-right: auto; }
.harmony-source-band span { color: var(--muted); font-size: 12px; }
.file-command { position: relative; display: inline-flex; align-items: center; min-height: 38px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 5px; background: #f8fafc; color: #26364b; font-size: 13px; font-weight: 800; cursor: pointer; }
.file-command input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.harmony-settings {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.harmony-settings label { display: grid; gap: 5px; color: #56667a; font-size: 12px; font-weight: 700; }
.harmony-settings input, .harmony-settings select { width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; color: var(--ink); }
.harmony-settings .primary-button { align-self: end; min-height: 38px; }

.harmony-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  min-height: 620px;
  margin-top: 14px;
  border: 1px solid #cfd8e3;
  background: #fff;
}

.harmony-score-area { min-width: 0; border-right: 1px solid #cfd8e3; overflow: hidden; }
.harmony-toolbar { display: flex; justify-content: space-between; gap: 10px; padding: 9px 11px; border-bottom: 1px solid #d8e0e8; background: #f3f6f9; }
.harmony-toolbar > div { display: flex; gap: 5px; }
.harmony-toolbar button { min-width: 38px; min-height: 34px; padding: 5px 9px; border: 1px solid #c7d2df; border-radius: 5px; background: #fff; color: #1f3045; font-weight: 800; cursor: pointer; }
.harmony-toolbar button:disabled { opacity: .4; cursor: not-allowed; }
.harmony-export button { min-width: 112px; }
.harmony-candidate-tabs { display: flex; border-bottom: 1px solid #d6dee8; background: #fff; overflow-x: auto; }
.harmony-candidate-tabs button { min-width: 150px; padding: 10px 13px; border: 0; border-right: 1px solid #d6dee8; background: #fff; color: #5b6b7f; text-align: left; cursor: pointer; }
.harmony-candidate-tabs button strong, .harmony-candidate-tabs button span { display: block; }
.harmony-candidate-tabs button span { margin-top: 2px; font-size: 11px; }
.harmony-candidate-tabs button.active { box-shadow: inset 0 -3px #0f766e; color: #0b5f59; background: #f2fbf9; }

#harmonyScore { min-height: 460px; padding: 18px 16px; overflow: auto; background: #fff; }
.harmony-score-empty { display: grid; place-items: center; color: #8794a5; }
#harmonyScore svg { max-width: none; }
.harmony-chord-timeline { display: flex; gap: 5px; padding: 11px 12px; border-top: 1px solid #e1e7ee; border-bottom: 1px solid #e1e7ee; background: #fbfcfe; overflow-x: auto; }
.harmony-chord-timeline button { min-width: 76px; padding: 8px; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; color: #23334a; cursor: pointer; }
.harmony-chord-timeline button b, .harmony-chord-timeline button span { display: block; }
.harmony-chord-timeline button b { font: 700 18px Georgia, serif; }
.harmony-chord-timeline button span { margin-top: 2px; color: #718096; font-size: 10px; }
.harmony-chord-timeline button.selected { border-color: #0f766e; background: #eaf7f5; color: #0b5f59; }
.harmony-chord-timeline button.locked::after { content: "锁"; display: inline-block; margin-top: 3px; color: #9a6700; font-size: 10px; }

.harmony-track-list { display: grid; }
.harmony-track { display: grid; grid-template-columns: minmax(130px, 190px) 1fr auto; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #edf0f4; }
.harmony-track > div { display: grid; gap: 2px; }
.harmony-track span { color: #6a7889; font-size: 11px; }
.harmony-track em { color: #40536b; font-size: 12px; font-style: normal; }
.harmony-track button { border: 0; background: transparent; color: #0f766e; font-weight: 800; cursor: pointer; }
.harmony-track.reference { background: #fff9e9; }

.harmony-inspector { min-width: 0; background: #f8fafc; }
.inspector-heading { display: grid; gap: 3px; padding: 14px; border-bottom: 1px solid #d9e1e9; }
.inspector-heading span { color: #6d7c8f; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.inspector-heading strong { font-size: 17px; }
.harmony-lock { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid #e1e7ee; font-size: 13px; font-weight: 700; }
.harmony-explanation { min-height: 96px; padding: 13px 14px; color: #506176; font-size: 12px; line-height: 1.65; }
.rule-summary { display: grid; gap: 3px; padding: 11px 14px; border-top: 1px solid #d9e1e9; border-bottom: 1px solid #d9e1e9; background: #fff; }
.rule-summary span { color: #607084; font-size: 12px; }
.harmony-warnings { display: grid; gap: 7px; padding: 10px; }
.harmony-warning { padding: 9px; border-left: 3px solid #d19a00; background: #fff8dc; color: #695316; font-size: 11px; line-height: 1.5; cursor: pointer; }
.harmony-warning.error { border-left-color: #b42318; background: #fff0ee; color: #8e2018; }
.harmony-warning.ok { border-left-color: #159447; background: #edf9f1; color: #176b37; }

.harmony-library { margin-top: 14px; border: 1px solid #cfd8e3; background: #fff; }
.harmony-library-tabs { display: flex; border-bottom: 1px solid #c8d3df; background: #edf1f5; overflow-x: auto; }
.harmony-library-tabs button { padding: 9px 15px; border: 0; border-right: 1px solid transparent; background: transparent; color: #44566c; cursor: pointer; }
.harmony-library-tabs button.active { margin-bottom: -1px; border-color: #c8d3df; border-bottom: 1px solid #fff; background: #fff; color: #0b5f59; font-weight: 800; }
.harmony-library-groups { min-height: 98px; padding: 11px; }
.harmony-library-group { display: none; }
.harmony-library-group.active { display: block; }
.harmony-tool-row { display: flex; flex-wrap: wrap; gap: 6px; }
.harmony-tool-row > span { padding: 14px; color: #7a8797; font-size: 12px; }
.harmony-tool-row button { min-width: 84px; height: 64px; padding: 6px; border: 1px solid transparent; border-radius: 4px; background: #f8fafc; color: #1d2b3d; cursor: pointer; }
.harmony-tool-row button:hover:not(:disabled) { border-color: #86a79f; background: #edf8f5; }
.harmony-tool-row button:disabled { opacity: .38; cursor: not-allowed; }
.harmony-tool-row button b, .harmony-tool-row button span { display: block; }
.harmony-tool-row button b { font: 700 18px Georgia, serif; }
.harmony-tool-row button span { margin-top: 4px; color: #6a7889; font-size: 10px; }

.teacher-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: 86px 1fr 42px;
  gap: 10px;
  align-items: center;
  margin: 14px 0;
}

.bar-row b {
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
}

.bar-row em {
  color: var(--muted);
  font-style: normal;
}

.plain-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

audio {
  width: 100%;
  margin-top: 10px;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .topbar,
  .section-heading {
    flex-direction: column;
  }

  .overview-grid,
  .two-column,
  .form-grid,
  .teacher-grid,
.editor-actions {
    grid-template-columns: 1fr;
  }

  .form-grid .wide {
    grid-column: auto;
  }
}

.numbered-preview {
  position: relative;
  min-height: 58px;
  border: 0;
  background: transparent;
  padding: 0;
  color: #111827;
  font-weight: 800;
  line-height: 1;
}

.numbered-preview small {
  display: none;
  color: var(--muted);
  font-weight: 600;
  margin-top: 8px;
}

.jianpu-note {
  position: absolute;
  top: 22px;
  min-width: 24px;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 900;
  color: #111827;
}

.jianpu-note.long::after {
  content: "—";
  margin-left: 8px;
}

.jianpu-note.dotted::before {
  content: "·";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -18px;
  font-size: 24px;
}

.slur {
  position: absolute;
  top: 5px;
  height: 18px;
  border-top: 2px solid #111827;
  border-radius: 50% 50% 0 0;
  transform: skewX(-8deg);
}

/* Guided melody transcription */
.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.workflow-steps span {
  padding: 11px 14px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.workflow-steps span:last-child { border-right: 0; }
.workflow-steps span.active { background: #e9f8f3; color: #08755c; }

.melody-layout {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.capture-panel h3,
.element-library h3 { margin: 0 0 12px; font-size: 17px; }

.setting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.setting-grid label {
  display: grid;
  gap: 5px;
  color: #415166;
  font-size: 12px;
  font-weight: 700;
}

.setting-grid input,
.setting-grid select { min-width: 0; width: 100%; }

.tempo-control {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px 12px;
  align-items: center;
  margin: 16px 0;
  padding: 12px;
  background: #f4f7fb;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.tempo-control strong { grid-column: 1 / -1; font-size: 13px; color: #344256; }

.beat-lights { display: flex; gap: 6px; justify-content: flex-end; }
.beat-lights i { width: 12px; height: 12px; border-radius: 50%; background: #c7d0dc; transition: background .08s, transform .08s; }
.beat-lights i.active { background: #e84749; transform: scale(1.18); }
.beat-lights i:first-child.active { background: #078c70; }

.record-zone {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #ccd6e2;
  border-radius: 8px;
  background: #fff;
}

.record-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  border: 1px solid #d8444b;
  border-radius: 7px;
  background: #fff4f4;
  color: #aa2730;
  cursor: pointer;
}

.record-button span { font-size: 18px; }
.record-button b { font-size: 14px; }
.record-zone audio { width: 100%; }
.recording-security-help { display: grid; gap: 6px; padding: 10px; border: 1px solid #e4b85d; border-radius: 6px; background: #fff9e9; color: #694b0d; }
.recording-security-help[hidden] { display: none; }
.recording-security-help strong { font-size: 12px; line-height: 1.45; }
.recording-security-help span { color: #786440; font-size: 11px; line-height: 1.5; }
.recording-security-help a { display: inline-flex; align-items: center; justify-content: center; width: fit-content; min-height: 34px; margin-top: 2px; text-decoration: none; }
.upload-recording {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.upload-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.upload-heading h4 { margin: 0 0 4px; font-size: 15px; color: #1d3047; }
.upload-heading p { margin: 0; max-width: 520px; font-size: 12px; line-height: 1.6; color: #64748b; }
.upload-heading > span { flex: 0 0 auto; font-size: 11px; color: #64748b; }
.upload-recording form { display: grid; gap: 10px; }

.audio-drop-zone {
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 16px;
  border: 1px dashed #8fa5bd;
  border-radius: 7px;
  background: #f8fbff;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.audio-drop-zone:hover,
.audio-drop-zone.dragging { border-color: #176a9a; background: #edf7fc; }
.audio-drop-zone strong { font-size: 14px; color: #174d70; }
.audio-drop-zone span { margin-top: 3px; font-size: 12px; color: #64748b; }
.audio-drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-file-info { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 1px solid #d5dee8; border-radius: 6px; }
.upload-file-info > div { min-width: 0; display: grid; gap: 2px; }
.upload-file-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.upload-file-info span { font-size: 11px; color: #64748b; }
.upload-file-info button { width: 32px; height: 32px; padding: 0; border: 0; background: transparent; font-size: 20px; color: #64748b; cursor: pointer; }
.upload-recording audio { width: 100%; }

.score-workspace { min-width: 0; padding: 0; overflow: hidden; }
.score-workspace .score-toolbar { flex-wrap: wrap; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f7f9fc; }
.score-command-group { display: flex; flex: 0 1 auto; gap: 8px; max-width: 100%; overflow-x: auto; }
.score-view-controls { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; margin-left: auto; }
.score-workspace .editor-status { margin: 12px; }
.mode-confirmation {
  margin: 0 12px 12px;
  padding: 12px;
  border: 1px solid #b8c8d9;
  border-radius: 7px;
  background: #f8fbfe;
}
.mode-confirmation-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mode-confirmation-heading strong, .mode-confirmation-heading span { display: block; }
.mode-confirmation-heading strong { color: #183a5c; font-size: 14px; }
.mode-confirmation-heading div > span { margin-top: 2px; color: #64748b; font-size: 12px; }
.mode-confirmation-heading > span { padding: 3px 8px; border-radius: 4px; background: #fff1d6; color: #8b5a00; font-size: 11px; font-weight: 800; white-space: nowrap; }
.mode-confirmation-heading > span.confirmed { background: #def7ec; color: #08755c; }
.mode-candidate-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.mode-candidate-list button { min-width: 0; padding: 9px 10px; border: 1px solid #ccd7e4; border-radius: 6px; background: #fff; color: #263a50; text-align: left; cursor: pointer; }
.mode-candidate-list button:hover { border-color: #4d789e; }
.mode-candidate-list button.selected { border-color: #08755c; box-shadow: inset 0 0 0 1px #08755c; background: #effaf7; }
.mode-candidate-list strong, .mode-candidate-list span, .mode-candidate-list em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-candidate-list strong { font-size: 14px; }
.mode-candidate-list span { margin-top: 2px; color: #64748b; font-size: 11px; }
.mode-candidate-list em { margin-top: 5px; color: #08755c; font-size: 11px; font-style: normal; font-weight: 800; }
.mode-confirmation-controls { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(180px, 1fr) auto; gap: 8px; align-items: end; margin-top: 10px; }
.mode-confirmation-controls label { display: grid; gap: 4px; color: #52657a; font-size: 11px; font-weight: 700; }
.mode-confirmation-controls select { width: 100%; min-width: 0; }
.mode-confirmation-controls button { min-height: 38px; white-space: nowrap; }
.view-switch { display: flex; margin-left: auto; border: 1px solid #cbd5e1; border-radius: 6px; overflow: hidden; }
.view-switch button { border: 0; border-right: 1px solid #cbd5e1; border-radius: 0; min-width: 58px; }
.view-switch button:last-child { border-right: 0; }
.view-switch button.active { background: #173d67; color: #fff; }
.score-zoom-control { display: none; align-items: center; gap: 7px; color: #52657a; font-size: 11px; white-space: nowrap; }
.score-zoom-control input { width: 92px; padding: 0; accent-color: #075ee5; }
.score-zoom-control output { min-width: 36px; color: #173d67; font-weight: 800; }
.score-workspace:has(.view-standard) .score-zoom-control { display: flex; }

.score-canvas {
  min-height: 640px;
  max-height: 920px;
  overflow: auto;
  padding: 12px;
  border-top: 1px solid #eef1f5;
  border-bottom: 1px solid #eef1f5;
  background: #fff;
}

.score-canvas.empty { display: grid; place-items: center; color: #8190a3; }
.score-system-block { min-width: 760px; margin-bottom: 34px; padding-bottom: 12px; border-bottom: 1px solid #e5eaf0; }
.staff-system { position: relative; min-width: 920px; height: 196px; }
.vex-staff { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.vex-staff svg { display: block; overflow: visible; }
.vex-hit-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.vex-note-hit { position: absolute; height: 60px; padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: pointer; pointer-events: auto; }
.vex-note-hit:hover { background: rgba(7, 94, 229, .08); }
.vex-note-hit.selected { outline: 2px solid #075ee5; background: rgba(7, 94, 229, .11); }
.staff-lines { position: absolute; left: 156px; right: 28px; top: 72px; height: 49px; }
.staff-lines > i { display: block; height: 1px; margin-bottom: 11px; background: #202a36; }
.system-clef { position: absolute; left: 30px; top: 46px; width: 64px; text-align: center; font-family: "Times New Roman", serif; font-size: 76px; line-height: 1; }
.system-key { position: absolute; left: 92px; top: 78px; max-width: 42px; font: 700 19px Georgia, serif; letter-spacing: 0; }
.system-meter { position: absolute; left: 124px; top: 70px; display: grid; line-height: .86; font: 700 22px Georgia, serif; }
.measure-line { position: absolute; top: 72px; height: 49px; border-left: 1px solid #202a36; }
.ledger-line { position: absolute; width: 24px; border-top: 1px solid #283241; transform: translateX(-10px); pointer-events: none; }

.engraved-note {
  position: absolute;
  width: 28px;
  height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #101820;
  cursor: pointer;
  transform: translate(-10px, -12px);
  z-index: 2;
}

.engraved-note::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 13px;
  width: 14px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  transform: rotate(-18deg);
}

.engraved-note::after { content: ""; position: absolute; left: 17px; top: -13px; width: 2px; height: 30px; background: currentColor; }
.engraved-note.half::before { box-sizing: border-box; border: 2px solid currentColor; background: #fff; }
.engraved-note.whole::before { box-sizing: border-box; border: 2px solid currentColor; background: #fff; }
.engraved-note.whole::after { display: none; }
.engraved-note.eighth::after, .engraved-note.sixteenth::after { box-shadow: 5px 4px 0 -1px currentColor; }
.engraved-note.uncertain { color: #bd7a00; }
.engraved-note.selected { color: #075ee5; outline: 2px solid #a8c8ff; outline-offset: 3px; border-radius: 3px; }
.engraved-note.rest::before, .engraved-note.rest::after { display: none; }
.engraved-note > i { font-style: normal; font-size: 27px; }
.engraved-note small { position: absolute; top: 39px; left: 1px; font: italic 700 12px Georgia, serif; color: #23364d; }
.note-accidental { position: absolute; left: -10px; top: 8px; font: 700 18px Georgia, serif; }

.jianpu-system { position: relative; width: 100%; min-width: 100%; height: 108px; }
.jianpu-sign { position: absolute; left: 30px; top: 10px; font: 700 18px Georgia, serif; line-height: 1.7; }
.jianpu-measure-line { position: absolute; top: 8px; height: 62px; border-left: 1px solid #202a36; pointer-events: none; }
.jianpu-measure-line.terminal { border-left-width: 3px; }
.jianpu-item { position: absolute; top: 18px; z-index: 2; display: grid; grid-template-rows: 12px 31px auto 10px; justify-items: center; transform: translateX(-50%); min-width: 44px; height: 76px; padding: 0 4px; border: 0; background: transparent; color: #172231; cursor: pointer; }
.jianpu-core { position: relative; display: flex; align-items: baseline; justify-content: center; min-width: 24px; height: 28px; line-height: 28px; }
.jianpu-core b { font: 700 27px Georgia, serif; }
.jianpu-item.rest-group { justify-items: center; }
.jianpu-item.rest-group .jianpu-core b { font-size: 22px; white-space: pre; word-spacing: 16px; }
.jianpu-core small { position: absolute; right: 100%; top: 2px; font: 700 15px Georgia, serif; }
.jianpu-duration-dot { margin-left: 2px; font: 700 16px Georgia, serif; }
.jianpu-octave-dots { min-height: 10px; font: 700 10px/10px Georgia, serif; letter-spacing: 0; }
.jianpu-underlines { display: grid; gap: 2px; width: 21px; min-height: 2px; }
.jianpu-underlines i { display: block; width: 100%; border-top: 1.5px solid currentColor; }
.jianpu-system.standardized-rhythm .jianpu-underlines { visibility: hidden; }
.jianpu-extensions { position: absolute; left: 31px; top: 19px; display: flex; gap: 7px; font: 700 18px Georgia, serif; white-space: nowrap; }
.jianpu-item.selected { color: #075ee5; background: #eaf2ff; border-radius: 4px; }
.jianpu-rhythm-layer { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.jianpu-rhythm-layer line { stroke: #172231; stroke-width: 1.6; stroke-linecap: square; shape-rendering: geometricPrecision; }
.jianpu-rhythm-layer .shared-reduction-line { stroke-width: 1.8; }
.jianpu-connection-layer { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.jianpu-connection-layer path { fill: none; stroke: #172231; stroke-width: 1.5; stroke-linecap: round; }
.jianpu-connection-layer .jianpu-slur { stroke-width: 1.25; }
.view-staff .jianpu-system { display: none; }
.view-numbered .staff-system { display: none; }
.view-standard .jianpu-system { display: none; }
.view-standard .score-system-block { margin-bottom: 18px; }
.osmd-system-block { padding: 4px 10px 14px; }
.osmd-staff-wrap { position: relative; min-height: 176px; overflow: visible; background: #fff; }
.osmd-staff { position: relative; min-height: 176px; pointer-events: none; }
.osmd-staff svg { display: block; min-width: 100%; max-width: none; height: auto; overflow: visible; }
.view-standard .osmd-staff-wrap { min-height: 220px; }
.view-standard .osmd-staff { min-height: 220px; }
.view-both .osmd-staff-wrap { min-height: 188px; margin-bottom: 8px; }
.view-both .osmd-staff { min-height: 188px; }
.standard-score {
  position: relative;
  width: 100%;
  min-width: 960px;
  min-height: 680px;
  margin: 0;
  padding: 18px 24px 54px;
  background: #fff;
}
.standard-score svg { display: block; overflow: visible; }
.standard-score-loading { display: grid; min-height: 300px; place-items: center; color: #64748b; }
.standard-hit-layer { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.standard-note-hit {
  position: absolute;
  min-width: 38px;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}
.standard-note-hit:hover { outline: 2px solid rgba(7, 94, 229, .35); background: rgba(7, 94, 229, .08); }
.standard-note-hit.selected { outline: 3px solid #075ee5; background: rgba(7, 94, 229, .13); }

.note-inspector {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 10px 12px;
  background: #f4f7fb;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.note-inspector[hidden] { display: none; }
.note-inspector > span { align-self: center; color: #6a7889; font-size: 12px; }
.note-inspector > b { align-self: center; min-width: 34px; font-size: 18px; }
.note-inspector label { display: grid; gap: 3px; min-width: 96px; color: #627186; font-size: 11px; }
.note-inspector input { width: 96px; padding: 7px; }
.note-inspector input[readonly] { background: #edf1f5; color: #7a8797; cursor: not-allowed; }
.editor-footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px 12px; color: #5d6d80; font-size: 12px; }
.editor-footer > div { display: flex; gap: 8px; align-items: center; }
.editor-footer a { color: #075ee5; font-weight: 700; }
.score-export-actions { flex-wrap: wrap; justify-content: flex-end; }

.element-library { margin-top: 14px; padding: 0; overflow: hidden; }
.embedded-element-library { margin: 0; border-bottom: 1px solid #cfd8e3; background: #fff; }
.library-heading { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.library-heading { padding: 14px 16px 10px; background: #f8fafc; border-bottom: 1px solid #dce3eb; }
.library-heading h3 { margin-bottom: 3px; font-size: 16px; }
.library-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.library-heading > span { padding: 6px 9px; border: 1px solid #cbd5e1; border-radius: 5px; background: #f7f9fc; color: #42566f; font-size: 12px; }
.library-tabs { display: flex; gap: 0; margin: 0; padding: 0 10px; border-bottom: 1px solid #bfcbd8; background: #edf1f5; overflow-x: auto; }
.library-tabs button { padding: 9px 15px 8px; border: 0; border-right: 1px solid transparent; border-left: 1px solid transparent; background: transparent; color: #43556c; white-space: nowrap; cursor: pointer; }
.library-tabs button.active { margin-bottom: -1px; border-color: #bfcbd8; border-bottom: 1px solid #fff; background: #fff; color: #173d67; font-weight: 800; }
.notation-ribbon { min-height: 112px; padding: 10px 12px 12px; background: #fff; }
.element-group { display: none; align-items: stretch; gap: 0; overflow-x: auto; }
.element-group.active { display: flex; }
.tool-cluster { flex: 0 0 auto; min-width: 190px; padding: 0 12px; border-right: 1px solid #d7dee7; }
.tool-cluster:first-child { padding-left: 2px; }
.tool-cluster:last-child { border-right: 0; }
.tool-cluster.wide { min-width: 360px; }
.tool-cluster > p { margin: 0 0 7px; color: #637286; font-size: 11px; font-weight: 800; text-align: center; }
.tool-cluster > div { display: flex; align-items: stretch; gap: 4px; }
.tempo-ribbon-cluster { min-width: 190px; }
.tempo-ribbon-cluster > div { align-items: center; }
.tempo-ribbon-cluster label {
  display: flex;
  width: 112px;
  height: 42px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid #bfcbd8;
  border-radius: 4px;
  background: #fff;
  color: #24364b;
  font: 700 15px Georgia, "Times New Roman", serif;
}
.tempo-ribbon-cluster label:focus-within { border-color: #075ee5; box-shadow: 0 0 0 2px rgba(7, 94, 229, .12); }
.tempo-ribbon-cluster input {
  width: 58px;
  min-width: 0;
  padding: 5px 3px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #172231;
  font: 700 15px "Microsoft YaHei", sans-serif;
  text-align: center;
}
.element-group .tempo-apply-button { width: 52px; min-width: 52px; height: 52px; border-color: #9fb5cc; background: #f5f9fd; }
.element-group .tempo-apply-button:hover { border-color: #075ee5; background: #eaf2ff; }
.element-group .tempo-apply-button b { min-height: 20px; font: 800 17px "Microsoft YaHei", sans-serif; }
.element-group .tempo-apply-button span { margin-top: 0; }
.element-group button { width: 58px; min-width: 58px; height: 68px; padding: 5px 3px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #172231; cursor: pointer; }
.element-group button:hover { border-color: #9fb5cc; background: #eef5fb; }
.element-group button.current { border-color: #075ee5; background: #eaf2ff; color: #075ee5; }
.element-group button:disabled { cursor: not-allowed; opacity: .35; pointer-events: auto; }
.element-group button b { display: block; min-height: 29px; font: 700 23px Georgia, "Times New Roman", serif; }
.element-group button span { display: block; margin-top: 2px; color: #68778a; font-size: 10px; line-height: 1.2; }
.rhythm-pattern-cluster { min-width: 500px; }
.rhythm-pattern-cluster > div { flex-wrap: wrap; max-width: 570px; }
.rhythm-pattern-cluster button { width: 82px; min-width: 82px; }
.rhythm-pattern-cluster button b { font-size: 19px; white-space: nowrap; }
.rhythm-pattern-cluster button .rhythm-image {
  display: grid;
  width: 62px;
  height: 34px;
  min-height: 34px;
  margin: 0 auto;
  overflow: hidden;
  place-items: start center;
}
.rhythm-pattern-cluster button .rhythm-image img { display: block; width: 70px; height: auto; mix-blend-mode: multiply; }
.rhythm-pattern-cluster button .rhythm-image.uncropped { place-items: center; }
.rhythm-pattern-cluster button .rhythm-image.uncropped img { max-height: 38px; width: auto; max-width: 72px; object-fit: contain; }
.dynamics-cluster button b { font-style: italic; font-family: Georgia, "Times New Roman", serif; }
.rhythm-preview { display: grid; align-content: center; gap: 5px; min-width: 340px; padding: 10px 16px; color: #52657a; }
.rhythm-preview strong { color: #173d67; font-size: 13px; }
.rhythm-preview span { max-width: 520px; font-size: 12px; line-height: 1.55; }
.disabled-element-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 280px;
  padding: 7px 9px;
  border: 1px solid #b8c5d3;
  border-radius: 4px;
  background: #172231;
  color: #fff;
  box-shadow: 0 5px 16px rgba(15, 23, 42, .2);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}

/* Learning, assessment, and research workspace */
.learning-layout,
.assignment-layout,
.knowledge-layout,
.teaching-dashboard { display: grid; grid-template-columns: minmax(290px, .7fr) minmax(0, 1.3fr); gap: 14px; align-items: start; }
.learning-layout > *,
.assignment-layout > *,
.knowledge-layout > *,
.teaching-dashboard > * { min-width: 0; }
.resource-browser,
.resource-reader,
.submission-workspace,
.knowledge-query,
.knowledge-answer,
.insight-panel,
.rule-explanation-panel,
.research-workspace { padding: 16px; }
.panel-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.panel-title-row h3 { margin: 0 0 4px; font-size: 17px; }
.panel-title-row p { margin: 0; color: var(--muted); font-size: 12px; }
.icon-command { width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid var(--line); border-radius: 5px; background: #f8fafc; color: #26384e; font-size: 19px; cursor: pointer; }
.compact-form { display: grid; gap: 9px; margin-bottom: 14px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.compact-form label,
.assignment-create-form label,
.annotation-composer label { margin: 0; }
.compact-form input,
.compact-form textarea,
.assignment-create-form input,
.assignment-create-form textarea,
.annotation-composer input,
.annotation-composer select,
.annotation-composer textarea { margin-top: 5px; padding: 9px 10px; }
.compact-form input,
.compact-form select,
.compact-form textarea { width: 100%; min-width: 0; max-width: 100%; }
.file-picker { padding: 10px; border: 1px dashed #9fb0c2; border-radius: 6px; background: #f8fafc; color: #334a64; cursor: pointer; }
.file-picker input { margin-top: 7px; padding: 4px; border: 0; background: transparent; }
.resource-list,
.assignment-list,
.submission-list,
.annotation-list { display: grid; gap: 8px; }
.resource-row,
.assignment-row,
.submission-row,
.annotation-row { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); text-align: left; }
button.resource-row,
button.assignment-row,
button.submission-row { cursor: pointer; }
.resource-row:hover,
.assignment-row:hover,
.submission-row:hover,
.resource-row.active,
.assignment-row.active,
.submission-row.active { border-color: #77a9a2; background: #f0fdfa; }
.resource-row strong,
.assignment-row strong,
.submission-row strong,
.annotation-row strong { display: block; margin-bottom: 4px; font-size: 13px; }
.resource-row span,
.assignment-row span,
.submission-row span,
.annotation-row span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.parse-state { float: right; color: #0f766e !important; font-weight: 800; }
.resource-viewer { min-height: 420px; border: 1px solid var(--line); background: #f8fafc; }
.resource-viewer iframe { display: block; width: 100%; height: 520px; border: 0; background: #fff; }
.resource-image-preview { display: block; max-width: 100%; max-height: 620px; margin: 0 auto; object-fit: contain; }
.resource-text-preview { max-height: 520px; margin: 0; padding: 18px; overflow: auto; background: #fff; color: #25364a; font: 14px/1.75 "Microsoft YaHei", sans-serif; white-space: pre-wrap; }
.resource-preview-shell { display: grid; min-height: 520px; grid-template-rows: auto minmax(0, 1fr); background: #e9eef4; }
.resource-preview-toolbar { display: flex; align-items: center; gap: 7px; min-height: 48px; padding: 7px 10px; border-bottom: 1px solid var(--line); background: #fff; }
.resource-preview-toolbar strong { min-width: 110px; color: #263b52; font-size: 12px; text-align: center; }
.resource-preview-toolbar .icon-command { width: 34px; height: 34px; padding: 0; }
.resource-preview-spacer { flex: 1; }
.resource-preview-body { display: grid; min-height: 470px; grid-template-columns: 112px minmax(0, 1fr); overflow: hidden; }
.resource-preview-thumbnails { display: grid; align-content: start; gap: 8px; max-height: 650px; padding: 9px; overflow: auto; border-right: 1px solid #cbd5e1; background: #f8fafc; }
.resource-preview-thumbnail { position: relative; width: 100%; min-height: 72px; padding: 3px; border: 2px solid transparent; border-radius: 4px; background: #fff; cursor: pointer; }
.resource-preview-thumbnail:hover,
.resource-preview-thumbnail.active { border-color: #0f766e; }
.resource-preview-thumbnail img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; }
.resource-preview-thumbnail span { position: absolute; right: 4px; bottom: 4px; min-width: 20px; padding: 2px 4px; border-radius: 3px; background: rgba(15, 23, 42, .82); color: #fff; font-size: 10px; text-align: center; }
.resource-preview-stage { display: flex; align-items: flex-start; justify-content: center; max-height: 650px; padding: 18px; overflow: auto; }
.resource-preview-stage img { display: block; width: 100%; height: auto; max-width: none; background: #fff; box-shadow: 0 2px 12px rgba(15, 23, 42, .16); transition: width .15s ease; }
.resource-preview-loading { min-height: 500px; }
.resource-preview-error { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #fed7aa; background: #fff7ed; color: #9a3412; font-size: 12px; }
.resource-preview-error span { flex: 1; }
.annotation-composer { display: grid; grid-template-columns: 90px 140px minmax(220px, 1fr) 110px; gap: 8px; align-items: end; margin: 12px 0; }
.annotation-composer .annotation-content { min-width: 0; }
.annotation-composer button { margin-bottom: 0; }
.annotation-row.question { border-left: 3px solid #2563eb; }
.annotation-row.confused { border-left: 3px solid #b45309; }
.annotation-row.reply { margin-left: 22px; border-left: 3px solid #0f766e; background: #f0fdfa; }
.assignment-create-band { margin-bottom: 14px; padding: 14px; }
.assignment-create-form { display: grid; grid-template-columns: 1fr 240px; gap: 10px; align-items: end; }
.assignment-create-form .wide-field { grid-column: 1 / -1; }
.assignment-create-form button { width: 180px; }
.feedback-editor { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
body.teacher-mode .feedback-editor:not([hidden]) { display: block; }
.feedback-toolbar,
.feedback-actions { display: flex; align-items: end; gap: 10px; margin-bottom: 10px; }
.feedback-toolbar label { margin: 0; }
.feedback-toolbar input[type="number"] { width: 92px; margin-top: 5px; padding: 9px; }
.check-label { display: flex !important; align-items: center; gap: 6px; min-height: 38px; }
.check-label input { width: 17px; height: 17px; }
.feedback-actions { justify-content: flex-end; margin-top: 10px; }
.feedback-actions .primary-button { width: auto; }
.feedback-attachment-editor { margin-top: 12px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.feedback-attachment-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.feedback-attachment-heading h4,
.student-feedback-attachments h5 { margin: 0; font-size: 14px; }
.feedback-attachment-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.feedback-attachment-heading > span { flex: none; color: var(--muted); font-size: 11px; }
.feedback-attachment-controls { display: flex; align-items: center; gap: 8px; }
.feedback-attachment-picker { display: flex; min-width: 0; flex: 1; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px dashed #9fb0c2; border-radius: 6px; background: #f8fafc; color: #334a64; font-size: 13px; cursor: pointer; }
.feedback-attachment-picker input { width: min(360px, 70%); margin: 0; padding: 0; border: 0; background: transparent; font-size: 12px; }
.feedback-attachment-controls button { flex: none; margin: 0; }
.feedback-attachment-status { margin: 8px 0; color: var(--muted); font-size: 12px; }
.feedback-attachment-list,
.student-attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.feedback-attachment-list > .empty-state { grid-column: 1 / -1; padding: 12px; border: 1px dashed var(--line); border-radius: 6px; }
.feedback-attachment-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.feedback-attachment-card > a { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 9px; min-height: 56px; padding: 7px; color: var(--ink); text-decoration: none; }
.feedback-attachment-card > a:hover { background: #f0fdfa; }
.feedback-attachment-card img,
.feedback-pdf-icon { width: 44px; height: 42px; border-radius: 4px; object-fit: cover; background: #eef2f7; }
.feedback-pdf-icon { display: grid; place-items: center; color: #b42318; font-size: 12px; font-weight: 800; }
.feedback-attachment-card strong { overflow: hidden; font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.feedback-attachment-card > div { display: flex; min-height: 31px; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 7px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.feedback-attachment-card .icon-command { width: 26px; height: 26px; min-height: 26px; padding: 0; color: var(--danger); }
.student-feedback-attachments { margin-top: 14px; }
.student-feedback-attachments h5 { margin-bottom: 8px; }
.student-attachment-card > a { display: block; min-height: 0; padding: 8px; }
.student-attachment-card img { width: 100%; height: auto; max-height: 360px; margin-bottom: 8px; object-fit: contain; border: 1px solid #e2e8f0; background: #f8fafc; }
.student-attachment-card .feedback-pdf-icon { width: 100%; height: 120px; margin-bottom: 8px; font-size: 20px; }
.student-attachment-card strong { display: block; white-space: normal; }
.knowledge-library-manager { margin-bottom: 14px; padding: 16px; }
.knowledge-count { flex: none; padding: 5px 8px; border: 1px solid #a8d5cd; border-radius: 5px; background: #f0fdfa; color: #0b5f59; font-size: 12px; font-weight: 800; }
.knowledge-upload-form { display: grid; grid-template-columns: minmax(180px, .75fr) minmax(220px, 1fr) minmax(260px, 1fr) 140px; gap: 8px; align-items: end; }
.knowledge-upload-form label { min-width: 0; margin: 0; color: #334a64; font-size: 12px; font-weight: 700; }
.knowledge-upload-form input { width: 100%; min-width: 0; margin-top: 5px; padding: 9px 10px; }
.knowledge-file-picker { padding: 7px 9px; border: 1px dashed #9fb0c2; border-radius: 6px; background: #f8fafc; cursor: pointer; }
.knowledge-file-picker input { padding: 1px 0 0; border: 0; background: transparent; font-size: 11px; }
.knowledge-upload-form button { width: 100%; min-height: 39px; }
.knowledge-upload-status { margin: 9px 0; color: var(--muted); font-size: 12px; }
.knowledge-library-list { display: grid; gap: 6px; }
.knowledge-resource-item { display: grid; grid-template-columns: 78px minmax(0, 1fr) 92px; align-items: center; gap: 10px; min-height: 58px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.knowledge-resource-item > div { min-width: 0; }
.knowledge-resource-item strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-resource-item p { margin: 3px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-resource-state { padding: 4px 6px; border-radius: 4px; background: #ecfdf5; color: #0b6b57; font-size: 11px; font-weight: 800; text-align: center; }
.knowledge-resource-item.queued .knowledge-resource-state { background: #eff6ff; color: #1d4ed8; }
.knowledge-resource-item.needs_review .knowledge-resource-state,
.knowledge-resource-item.failed .knowledge-resource-state { background: #fff7ed; color: #9a3412; }
.knowledge-resource-item .secondary-button { width: 92px; min-height: 34px; padding: 6px 8px; font-size: 12px; }
.knowledge-query form { display: grid; gap: 10px; }
.knowledge-answer { min-height: 310px; }
.prose-output { margin-top: 12px; padding: 14px; border-left: 3px solid #0f766e; background: #f7fafc; color: #27394f; font-size: 14px; line-height: 1.75; white-space: pre-wrap; }
.citation-list { display: grid; gap: 6px; margin-top: 14px; }
.citation-list a { color: #075ee5; font-size: 12px; font-weight: 700; }
.student-feedback { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.student-feedback h4 { margin: 0 0 10px; }
.feedback-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.feedback-item > div { display: flex; justify-content: space-between; gap: 12px; }
.feedback-item p { margin: 8px 0; white-space: pre-wrap; }
.excellent-label { color: #8a4f00; font-weight: 700; }
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(90px, 1fr)); gap: 8px; }
.metric-strip article { padding: 10px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.metric-strip span,
.metric-strip strong { display: block; }
.metric-strip span { color: var(--muted); font-size: 11px; }
.metric-strip strong { margin-top: 4px; font-size: 21px; }
.research-workspace { min-height: 420px; }
.empty-state { margin: 0; padding: 24px 12px; color: var(--muted); text-align: center; font-size: 13px; }
.status-error { color: var(--danger) !important; }
.status-success { color: var(--ok) !important; }

@media (max-width: 1100px) {
  .knowledge-upload-form { grid-template-columns: 1fr 1fr; }
  .melody-layout { grid-template-columns: 1fr; }
  .harmony-settings { grid-template-columns: repeat(2, 1fr); }
  .harmony-workspace { grid-template-columns: 1fr; }
  .harmony-score-area { border-right: 0; }
  .harmony-inspector { border-top: 1px solid #cfd8e3; }
  .capture-panel { max-width: none; }
  .learning-layout,
  .assignment-layout,
  .knowledge-layout,
  .teaching-dashboard { grid-template-columns: 1fr; }
  .score-canvas { min-height: 720px; }
  .view-both .osmd-staff-wrap,
  .view-both .osmd-staff { min-height: 176px; }
}

@media (max-width: 640px) {
  .resource-preview-body { grid-template-columns: 1fr; }
  .resource-preview-thumbnails { display: flex; max-height: 104px; border-right: 0; border-bottom: 1px solid #cbd5e1; }
  .resource-preview-thumbnail { flex: 0 0 86px; }
  .resource-preview-stage { min-height: 390px; padding: 10px; }
  .resource-preview-toolbar strong { min-width: 86px; }
  .knowledge-upload-form { grid-template-columns: 1fr; }
  .knowledge-resource-item { grid-template-columns: 72px minmax(0, 1fr); }
  .knowledge-resource-item .secondary-button { grid-column: 1 / -1; width: 100%; }
  .feedback-attachment-heading,
  .feedback-attachment-controls { align-items: stretch; flex-direction: column; }
  .feedback-attachment-picker { align-items: flex-start; flex-direction: column; }
  .feedback-attachment-picker input { width: 100%; }
  .feedback-attachment-controls button { width: 100%; }
  .mode-candidate-list { grid-template-columns: 1fr; }
  .mode-confirmation-controls { grid-template-columns: 1fr; }
  .workflow-steps { grid-template-columns: 1fr 1fr; }
  .workflow-steps span:nth-child(2) { border-right: 0; }
  .workflow-steps span:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .setting-grid { grid-template-columns: 1fr; }
  .harmony-steps { grid-template-columns: 1fr 1fr; }
  .harmony-source-band { align-items: stretch; flex-direction: column; }
  .harmony-source-band > div { margin-right: 0; }
  .harmony-settings { grid-template-columns: 1fr; }
  .harmony-toolbar { align-items: stretch; flex-direction: column; }
  .score-workspace .score-toolbar { align-items: flex-start; }
  .score-command-group { flex-basis: 100%; }
  .score-view-controls { width: 100%; margin-left: 0; overflow-x: auto; }
  .view-switch { margin-left: auto; }
  .editor-footer { align-items: flex-start; flex-direction: column; }
  .library-heading { flex-direction: column; }
  .notation-ribbon { padding-inline: 8px; }
  .tool-cluster { padding-inline: 8px; }
  .score-canvas { padding: 8px; }
  .score-system-block { margin-bottom: 28px; }
  .jianpu-core b { font-size: 26px; }
  .annotation-composer,
  .assignment-create-form { grid-template-columns: 1fr; }
  .assignment-create-form .wide-field { grid-column: auto; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .feedback-toolbar { align-items: stretch; flex-direction: column; }
}
