@font-face {
  font-family: "Bravura";
  src: url("../assets/fonts/bravura/Bravura.woff2") format("woff2");
  font-display: swap;
}

:root {
  --ink: #172b3a;
  --ink-soft: #4d6270;
  --paper: #f7f5ef;
  --surface: #fffdf8;
  --surface-muted: #edf1ee;
  --line: #d5ded8;
  --accent: #a93b25;
  --accent-soft: #fff0ea;
  --teal: #1b776c;
  --teal-dark: #14554e;
  --shadow: 0 18px 44px rgba(23, 43, 58, .11);
  font-family: "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: radial-gradient(circle at 8% 12%, #fff5dc 0, transparent 28%), linear-gradient(135deg, #f7f5ef 0%, #e7f0ed 100%);
  font-size: 16px;
}

button { font: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(27, 119, 108, .42); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }

.app-shell { width: min(100% - 40px, 1000px); margin: 0 auto; padding: 32px 0 48px; }
.app-header, .action-row, .results-actions { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.app-header { margin-bottom: 40px; }
.eyebrow, .kicker { margin: 0 0 8px; color: var(--teal); font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; font-family: "Trebuchet MS", sans-serif; }
h1 { font-size: clamp(2rem, 5vw, 3.3rem); line-height: 1.05; }
h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h3 { font-size: 1.15rem; }

.progress-block { width: min(240px, 32vw); flex: 0 0 auto; }
.progress-block > span { display: block; margin-bottom: 8px; color: var(--ink-soft); font-size: .9rem; font-weight: 700; text-align: right; }
.progress-track { height: 8px; overflow: hidden; border-radius: 99px; background: #d4dfdb; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 240ms ease; }
.instruction { max-width: none; margin: 14px 0 24px; color: var(--ink-soft); line-height: 1.55; }

.task-area { padding: 20px clamp(12px, 3vw, 30px); border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 253, 248, .9); box-shadow: var(--shadow); }
.task-question { margin: 0 0 16px; font-size: 1.15rem; font-weight: 700; line-height: 1.4; }
.option-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.option-button { width: 100%; min-height: 48px; padding: 10px 16px; border: 1px solid var(--line); border-bottom: 3px solid #b8c6bf; border-radius: 7px; color: var(--ink); background: var(--surface); text-align: left; cursor: pointer; }
.option-button:hover { border-color: var(--teal); background: #f1f8f5; }
.option-button[aria-pressed="true"] { border-color: var(--teal); background: #e2f2ee; font-weight: 700; }

/* Notationsfläche: Platz für Schlüssel, Vorzeichen, Hilfslinien und letzte Note einplanen; schmale Viewports scrollen horizontal. */
.notation-frame { overflow-x: auto; padding: 8px 0; }
.notation-frame svg { display: block; max-width: none; }

.action-row { align-items: flex-start; margin-top: 22px; }
.feedback { flex: 1; min-height: 1.5em; margin: 10px 0 0; color: var(--ink-soft); line-height: 1.5; }
.feedback.is-wrong { color: var(--accent); font-weight: 700; }
.primary-button, .secondary-button { min-height: 48px; padding: 0 20px; border: 0; border-radius: 7px; font-weight: 700; cursor: pointer; }
.primary-button { flex: 0 0 auto; color: #fffaf5; background: var(--accent); }
.primary-button:hover { background: #832e1d; }
.primary-button:disabled { opacity: .55; cursor: not-allowed; }
.secondary-button { color: var(--teal-dark); border: 2px solid var(--teal); background: transparent; }
.secondary-button:hover { color: #fff; background: var(--teal); }

.results-view { animation: rise-in 360ms ease both; }
.score-summary { margin: 12px 0 24px; color: var(--ink-soft); font-size: 1.1rem; }
.results-list { display: grid; gap: 10px; }
.result-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-left: 5px solid var(--teal); border-radius: 8px; background: var(--surface); }
.result-item.is-wrong { border-left-color: var(--accent); }
.result-number { color: var(--ink-soft); font-weight: 700; }
.result-points { font-weight: 700; white-space: nowrap; }
.result-solutions { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.result-solution-label { display: block; margin-bottom: 3px; color: var(--ink-soft); font-size: .8rem; font-weight: 700; }
.result-solution-body { min-height: 46px; padding: 5px 7px; border-radius: 5px; background: var(--surface-muted); }
.scorm-status { max-width: 520px; color: var(--ink-soft); font-size: .88rem; line-height: 1.5; }
.app-footer { padding: 0 20px 22px; color: var(--ink-soft); font-size: .8rem; text-align: center; }

.task-notation { overflow-x: auto; }
.notation-frame { display: flex; min-width: 0; overflow-x: auto; padding: 8px 0; justify-content: safe center; }
.rhythm-svg { display: block; max-width: none; flex: none; }
.rhythm-svg.is-single-measure { width: min(100%, 520px); height: auto; }
.barline { stroke: var(--ink); }
.tap-marker { font: 700 18px "Trebuchet MS", sans-serif; }
.tap-marker.is-hit { fill: var(--teal-dark); }
.tap-marker.is-missed { fill: var(--accent); }
.rhythm-controls { display: grid; justify-items: center; gap: 18px; margin: 18px auto 4px; max-width: 520px; }
.rhythm-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: 100%; }
.rhythm-actions .primary-button, .rhythm-actions .secondary-button { min-height: 50px; }
.rhythm-actions .primary-button:disabled, .rhythm-actions .secondary-button:disabled, .tap-button:disabled { opacity: .55; cursor: not-allowed; }
.tap-button { width: min(100%, 360px); min-height: 76px; border: 3px solid var(--teal-dark); border-radius: 12px; color: #fff; background: var(--teal); font-size: 1.35rem; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.tap-button:hover:not(:disabled), .tap-button.is-tapped { background: var(--teal-dark); transform: scale(.985); }
.countdown-display { min-height: 1.2em; margin: -8px 0; color: var(--accent); font-size: 2.4rem; font-weight: 700; line-height: 1.2; text-align: center; }
.run-status { min-height: 1.5em; margin: 0; color: var(--ink-soft); text-align: center; }
.result-title { font-weight: 700; }
.result-rhythm { overflow-x: auto; }
.playback-button { min-height: 42px; margin-top: 8px; padding: 0 14px; border: 2px solid var(--teal); border-radius: 7px; color: var(--teal-dark); background: transparent; font-weight: 700; cursor: pointer; }
.playback-button:hover { color: #fff; background: var(--teal); }
.playback-button:disabled { opacity: .6; cursor: wait; }
.extra-taps, .no-answer { margin: 8px 0 0; color: var(--ink-soft); line-height: 1.45; }
.no-answer { color: var(--accent); font-weight: 700; }

@media (max-width: 700px) {
  .rhythm-actions { flex-direction: column; }
  .rhythm-actions .primary-button, .rhythm-actions .secondary-button { width: 100%; }
}

[hidden] { display: none !important; }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 700px) {
  .app-shell { width: calc(100% - 28px); padding-top: 22px; }
  .app-header { align-items: flex-start; flex-direction: column; margin-bottom: 30px; }
  .progress-block { width: 100%; }
  .progress-block > span { text-align: left; }
  .action-row, .results-actions { align-items: stretch; flex-direction: column; gap: 8px; }
  .primary-button { width: 100%; }
}

@media (max-width: 600px) {
  .result-item { grid-template-columns: 24px minmax(0, 1fr); }
  .result-points { grid-column: 2; }
  .result-solutions { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
