@font-face{font-family:DM Sans;src:url("assets/dm-sans.woff2") format("woff2");font-weight:100 1000;font-display:swap}
@font-face{font-family:Instrument Serif;src:url("assets/instrument-serif.woff2") format("woff2");font-style:normal;font-display:swap}
@font-face{font-family:Instrument Serif;src:url("assets/instrument-serif-italic.woff2") format("woff2");font-style:italic;font-display:swap}

:root {
  color-scheme: light;
  --bg: #f6f2e9;
  --card: #fffcf7;
  --paper: #fffdf8;
  --ink: #252320;
  --muted: #66615a;
  --line: #e3dbcf;
  --red: #a53a2c;
  --red-dark: #8c2e23;
  --red-wash: #f6e8e1;
  --green: #407457;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.5 var(--sans); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.icons { position: absolute; width: 0; height: 0; pointer-events: none; }
svg:not(.icons) { display: block; }
.button svg, .icon-tile svg, .footer svg, .page-preview p svg, .dropzone svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.container, .header-inner { width: min(100% - 96px, 1264px); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); background: var(--card); }
.header-inner { min-height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; }
.brand { display: inline-flex; width: fit-content; gap: 10px; align-items: center; font-size: 1.375rem; font-weight: 750; letter-spacing: -.065em; line-height: 1; }
.brand-accent { color: var(--red); }
nav { display: flex; align-items: stretch; gap: 35px; align-self: stretch; }
nav a, .nav-link { display: flex; align-items: center; position: relative; font-size: .875rem; font-weight: 650; color: var(--muted); white-space: nowrap; }
.nav-link { padding: 0; border: 0; background: none; }
nav a:hover, .nav-link:hover, .nav-current { color: var(--red); }
.nav-current::after { content: ""; height: 2px; background: var(--red); position: absolute; bottom: -1px; inset-inline: 0; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; color: var(--ink); background: transparent; font-size: .875rem; font-weight: 670; min-height: 38px; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s; }
.button:disabled { opacity: .38; }
.button-outline { padding: 0 15px; border-color: #cf9b8d; color: var(--red); min-height: 40px; }
.button-outline:hover, .button-subtle:hover, .button-square:not(:disabled):hover { background: var(--red-wash); border-color: #d4aa9f; }
.upload-button { justify-self: end; }
.intro { min-height: 235px; display: flex; justify-content: space-between; align-items: center; gap: 28px; padding: 31px 0 33px; }
.eyebrow { margin: 0 0 13px; display: flex; gap: 10px; align-items: center; color: var(--red); font-size: .75rem; letter-spacing: .16em; font-weight: 800; }
.eyebrow span { width: 24px; height: 1px; background: currentColor; }
h1, h2, p { margin: 0; }
.intro h1 { font: 400 clamp(4.2rem, 7vw, 6.4rem)/.89 var(--serif); letter-spacing: -.035em; }
.intro h1 em { color: var(--red); font-weight: 400; }
.intro-copy { color: var(--muted); margin-top: 19px; max-width: 540px; }
.intro-art { width: min(27vw, 282px); color: #a74e3c; margin: 24px 20px 0 0; opacity: .82; }
.intro-art svg { width: 100%; }
.workspace { display: grid; grid-template-columns: minmax(0, 2.55fr) minmax(290px, 1fr); gap: 22px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--card); min-width: 0; box-shadow: 0 1px 2px #38271408; }
.score-header, .score-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 19px; }
.score-identity, .panel-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.score-identity > div { min-width: 0; }
.score-identity h2 { overflow-wrap: anywhere; }
.icon-tile { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 9px; background: var(--red-wash); color: var(--red); }
.icon-tile svg { width: 19px; height: 19px; }
.panel h2 { font-size: 1.0625rem; line-height: 1.3; font-weight: 760; letter-spacing: -.022em; }
.score-identity p, .panel-heading p { margin-top: 3px; font-size: .875rem; color: var(--muted); }
.score-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.piece-files { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 9px 19px; border-top: 1px solid var(--line); background: #fbf7ef; }
.piece-files[hidden] { display: none; }
.piece-files > span { margin-right: 3px; color: var(--muted); font-size: .75rem; font-weight: 650; }
.piece-files .button { min-height: 31px; font-size: .8125rem; }
.octave-controls { display: flex; align-items: center; gap: 4px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 9px; background: #fbf7ef; }
.octave-controls > span { padding-inline: 5px; color: var(--muted); font-size: .75rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.octave-button { padding: 5px 8px; font-size: .75rem; white-space: nowrap; }
.button-subtle { border-color: var(--line); padding-inline: 12px; }
.button-subtle svg { width: 16px; height: 16px; color: var(--muted); }
.score-stage { position: relative; background: #eee7da; padding: clamp(13px, 2.2vw, 29px); border-block: 1px solid var(--line); }
.score-paper { background: var(--paper); min-height: 340px; border: 1px solid #e0d7c9; border-radius: 3px; box-shadow: 0 3px 8px #4b331414; padding: 24px 22px 14px; overflow: hidden; }
.notation { min-width: 0; overflow-x: auto; }
.notation > svg { width: 100%; height: auto; display: block; min-width: 470px; }
.notation .row-window { overflow: hidden; min-width: 470px; transition: height .32s ease; }
.notation .row-track { transition: transform .32s ease; will-change: transform; }
.notation .row-track > svg { width: 100%; height: auto; display: block; }
.notation .row-window.is-instant, .notation .row-window.is-instant .row-track { transition: none; }
@media (prefers-reduced-motion: reduce) { .notation .row-window, .notation .row-track { transition: none; } }
.notation svg :is(ellipse, path, polygon, polyline, rect) { stroke: currentColor; }
.notation g:is(.ending, .fing, .reh, .tempo) { font-weight: bold; }
.notation g:is(.dir, .dynam, .mNum) { font-style: italic; }
.notation g.placeholder { visibility: hidden; }
.notation .note { cursor: pointer; }
.notation .note:hover { color: var(--red); fill: var(--red); }
.notation .expected { color: #285780; fill: #285780; }
.notation .matched { color: var(--green); fill: var(--green); }
.notation .review-on-time { color: var(--green); fill: var(--green); }
.notation .playback { color: #286364; fill: #286364; }
.notation svg .note-focus { stroke: none; fill: #e1edf9; pointer-events: none; }
.notation .note-focus.matched-focus { fill: #e2eddf; }
.notation .note-focus.playback-focus { fill: #d4eae6; }
.notation svg .result-mark { color: var(--red-dark); }
.notation svg .result-mark.timing-mark, .notation [data-verdict="timing"] { color: #8a5700; fill: #8a5700; }
.notation svg .result-mark.correct-mark, .notation [data-verdict="correct"] { color: var(--green); fill: var(--green); }
.notation [data-verdict="missed"], .notation [data-verdict="wrong"] { color: var(--red-dark); fill: var(--red-dark); }
.notation .result-mark.pitch-only-mark, .notation [data-verdict="pitch-only"] { color: #46596c; fill: #46596c; }
.notation .result-mark.unassessable-mark, .notation [data-verdict="unassessable"] { color: #696969; fill: #696969; }
.notation .result-mark.unassessable-mark rect { stroke-dasharray: 28 34; }
.notation .result-mark.pitch-only-mark rect { stroke-width: 16; }
.notation svg .result-mark rect { fill: transparent; stroke: currentColor; stroke-width: 30; }
.notation svg .timing-mark rect { stroke-dasharray: 65 35; }
.notation svg .result-mark.is-selected rect { stroke-width: 44; }
.notation svg .result-mark text { font: 700 290px var(--sans); fill: currentColor; stroke: var(--paper); stroke-width: 44; paint-order: stroke; }
.score-message { text-align: center; color: var(--muted); margin-block: 66px; }
.score-review { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); background: #fbf7ef; }
.score-review p { margin: 0; color: var(--red-dark); font-size: .875rem; font-weight: 650; overflow-wrap: anywhere; }
.score-footer { padding-block: 12px; }
.page-controls, .note-controls { display: flex; align-items: center; gap: 9px; }
.page-controls span { color: var(--muted); font-size: .875rem; white-space: nowrap; font-weight: 650; min-width: 86px; text-align: center; }
.button-square { width: 34px; min-height: 34px; border-color: var(--line); }
.button-square svg, .button-text svg { width: 15px; height: 15px; }
.button-text { padding-inline: 7px; color: var(--muted); min-height: 34px; }
.button-text:not(:disabled):hover { color: var(--red); background: var(--red-wash); }
.practice-side { display: grid; gap: 16px; }
.practice-panel, .live-panel, .results-panel { padding: 18px; }
.settings { display: grid; gap: 13px; margin: 19px 0 16px; }
.bar-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 10px; }
.playback-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr)); align-items: end; gap: 10px; }
.field label { display: block; margin: 0 0 5px; font-size: .875rem; font-weight: 690; }
.field-hint { margin-top: 4px; color: var(--muted); font-size: .8125rem; }
.field select, .bpm-input { border: 1px solid var(--line); border-radius: 8px; min-height: 42px; padding: 0 12px; width: 100%; color: var(--ink); background-color: #fbf7ef; font-size: .9375rem; }
.field select { appearance: none; padding-right: 36px; background-repeat: no-repeat; background-position: right 12px center; background-size: 13px 13px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2366615a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); }
.bar-fields select { padding-right: 26px; background-position: right 8px center; }
.bpm-input { display: flex; align-items: center; gap: 9px; }
.bpm-input input { width: 100%; min-width: 0; padding: 5px 0; background: transparent; border: 0; color: var(--ink); }
.bpm-input span { font-size: .8125rem; color: var(--muted); }
.playback-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.playback-controls button:first-child { flex: 1; }
.playback-status { margin: 5px 0 0; font-size: .8125rem; color: var(--muted); }
.playback-status:empty { margin: 0; }
.playback-status + .listen-button { margin-top: 10px; }
.listen-button { width: 100%; min-height: 45px; background: var(--red); color: #fffaf3; }
.listen-button:hover:not(:disabled) { background: var(--red-dark); }
.listen-button.is-listening { background: var(--ink); }
.listen-button.is-listening:hover { background: #4c423a; }
.mic-state { display: flex; align-items: center; gap: 8px; margin-top: 11px; color: var(--muted); font-size: .8125rem; min-height: 20px; }
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: #a49b8e; flex: none; }
.state-dot.active { background: var(--green); }
.state-dot.error-dot { background: var(--red); }
.count { margin-left: auto; color: var(--red); font-weight: 800; }
.passage-progress { display: block; width: 100%; height: 7px; margin-top: 13px; accent-color: var(--red); }
.note-readout { display: grid; grid-template-columns: 1fr 1fr; margin-top: 15px; border: 1px solid var(--line); border-radius: 8px; background: #fbf7ef; }
.note-readout > div { padding: 9px 13px 8px; min-width: 0; }
.note-readout > div + div { border-left: 1px solid var(--line); }
.note-readout span { display: block; color: var(--muted); font-size: .8125rem; }
.note-readout strong { display: block; color: var(--red); font: 400 1.95rem/1.12 var(--serif); margin-top: 2px; }
.note-readout > div + div strong { color: var(--ink); }
.result-scores.has-overall > div:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
.result-scores.has-overall > div:nth-child(even) { border-left: 0; }
.result-scores.has-overall > div:nth-child(n+4) { border-top: 1px solid var(--line); }
.page-preview { padding: 13px 20px 6px; border-top: 1px solid var(--line); }
.page-preview p { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .875rem; color: var(--muted); }
.page-preview p svg { color: var(--red); }
.page-preview p strong { color: var(--ink); }
.page-preview .notation > svg { max-width: 640px; margin-inline: auto; }
.result-detail { color: var(--muted); font-size: .8125rem; margin-top: 10px; }
.take-comparison { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbf7ef; font-size: .8125rem; }
.take-comparison h3 { margin: 0 0 5px; font-size: .9375rem; }
.take-comparison p { margin: 0; color: var(--muted); }
.take-comparison table { width: 100%; border-collapse: collapse; text-align: right; font-variant-numeric: tabular-nums; }
.take-comparison :is(th, td) { padding: 4px 0 4px 6px; }
.take-comparison th:first-child { padding-left: 0; text-align: left; }
.take-comparison thead th { color: var(--muted); font-weight: 500; }
.take-comparison tbody tr { border-top: 1px solid var(--line); }
.result-list { list-style: none; padding: 0; margin: 10px 0 0; max-height: 240px; overflow: auto; }
.result-list li + li { border-top: 1px solid var(--line); }
.result-list button { display: flex; align-items: center; gap: 8px; justify-content: space-between; width: 100%; text-align: left; background: transparent; border: 0; padding: 9px 2px; color: var(--ink); font-size: .875rem; }
.result-list button:hover { color: var(--red); }
.result-list button span:last-child { color: var(--muted); }
.result-list .mistake-result span:last-child { color: var(--red-dark); font-weight: 650; }
.retry-button { width: 100%; margin-top: 12px; }
.coach { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.coach-button { width: 100%; }
.coach-button[aria-busy="true"] { opacity: .7; cursor: progress; }
.coach-result { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--red-wash); }
.coach-target { font-weight: 600; color: var(--red); font-size: .875rem; margin: 0; }
.coach-drill { margin: 6px 0 0; color: var(--ink); font-size: .9375rem; line-height: 1.45; }
.coach-source { margin: 6px 0 0; color: var(--muted); font-size: .75rem; }
.coach-jump { margin-top: 8px; }
.coach-error { margin: 8px 0 0; color: var(--red); font-size: .8125rem; }
.footer { min-height: 68px; display: flex; justify-content: space-between; flex-wrap: wrap; column-gap: 20px; row-gap: 6px; align-items: center; padding: 13px 1px; color: var(--muted); font-size: .8125rem; }
.footer span:first-child { display: flex; gap: 7px; align-items: center; }
.footer svg { width: 15px; height: 15px; color: var(--red); }
dialog { width: min(480px, 100% - 32px); padding: 23px; color: var(--ink); border: 1px solid var(--line); border-radius: 15px; background: var(--card); box-shadow: 0 18px 70px #2d23154d; }
dialog::backdrop { background: #30251d65; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
dialog h2 { font: 400 2.5rem/1.1 var(--serif); margin-bottom: 7px; }
dialog p, .help-steps { color: var(--muted); }
.help-steps { margin: 12px 0 0; padding-left: 24px; }
.help-steps li + li { margin-top: 10px; }
.help-steps strong { color: var(--ink); }
.dropzone { display: grid; justify-items: center; gap: 5px; padding: 21px 10px; margin: 17px 0 11px; text-align: center; background: #fbf7ef; border: 1px dashed #c18c7d; border-radius: 9px; cursor: pointer; }
.dropzone svg { color: var(--red); width: 24px; height: 24px; margin-bottom: 2px; }
.dropzone span, .dialog-hint { color: var(--muted); font-size: .875rem; }
.dropzone:hover, .dropzone.dragging { background: var(--red-wash); }
dialog:has(input[type=file]:focus-visible) .dropzone { outline: 2px solid var(--red); outline-offset: 3px; }
.error { color: var(--red); margin-top: 9px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 1000px) {
  .container, .header-inner { width: calc(100% - 48px); }
  .workspace { gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(268px, 1fr); }
  .score-paper { padding-inline: 12px; }
  .score-header, .score-footer { padding-inline: 12px; }
  .piece-files { padding-inline: 12px; }
}
@media (max-width: 760px) {
  .container, .header-inner { width: calc(100% - 32px); }
  .header-inner { min-height: 64px; grid-template-columns: 1fr auto; gap: 12px; }
  nav { display: none; }
  .intro { min-height: 0; padding: 29px 0 25px; gap: 12px; }
  .intro h1 { font-size: clamp(3.35rem, 11vw, 5.15rem); }
  .intro-copy { margin-top: 14px; }
  .intro-art { width: 26vw; margin: 5px 0 0; flex: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .practice-side { grid-template-columns: 1fr 1fr; align-items: start; }
  .results-panel { grid-column: 1 / -1; }
}
@media (max-width: 510px) {
  .intro-art { display: none; }
  .practice-side { grid-template-columns: 1fr; }
  .score-footer { gap: 5px; flex-wrap: wrap; }
  .page-controls, .note-controls { gap: 2px; }
  .button-text { padding-inline: 4px; }
  .score-stage { padding: 10px; }
  .score-paper { min-height: 310px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
.mobile-help { display: none; }
.help-downloads { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 17px; }
@media (max-width: 760px) {
  .mobile-help { display: inline-flex; min-height: 36px; }
}

/* Count-in overlay (4, 3, 2, 1) over the score */
.countdown { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 6px; background: #fffdf8cc; pointer-events: none; }
.countdown[hidden] { display: none; }
.countdown strong { font: 400 clamp(6rem, 22vw, 15rem)/.9 var(--serif); color: var(--red); font-variant-numeric: tabular-nums; }
.countdown span { font-size: clamp(.95rem, 1.6vw, 1.25rem); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* Count-in toggle */
.toggle-field { display: grid; grid-template-columns: auto 1fr; column-gap: 9px; align-items: center; font-size: .875rem; font-weight: 690; cursor: pointer; }
.toggle-field input { width: 18px; height: 18px; margin: 0; accent-color: var(--red); }
.toggle-field small { grid-column: 2; color: var(--muted); font-weight: 400; font-size: .8125rem; }

/* Full screen: the score panel fills the screen; 4 rows still fit vertically */
.score-panel:fullscreen { display: flex; flex-direction: column; width: 100vw; height: 100vh; border-radius: 0; border: 0; background: var(--card); overflow: auto; }
.score-panel:fullscreen .score-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.score-panel:fullscreen .score-paper { width: min(100%, calc((100vh - 290px) * 1.75)); margin-inline: auto; }
.score-panel:-webkit-full-screen { display: flex; flex-direction: column; width: 100vw; height: 100vh; background: var(--card); overflow: auto; }
.score-panel:-webkit-full-screen .score-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.score-panel:-webkit-full-screen .score-paper { width: min(100%, calc((100vh - 290px) * 1.75)); margin-inline: auto; }

.microphone-setup { display: grid; gap: 10px; padding-top: 12px; }
.microphone-diagnostics { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: .875rem; }
.microphone-diagnostics summary, #bar-review summary { cursor: pointer; font-weight: 650; }
.microphone-diagnostics .field, .microphone-diagnostics .button, .microphone-diagnostics .field-hint { margin-top: 10px; }
.microphone-diagnostics meter { display: block; width: 100%; height: 14px; }
.capture-details { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 5px 10px; margin-bottom: 0; }
.capture-details dt { color: var(--muted); }
.capture-details dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.notation-key { display: flex; flex-wrap: wrap; gap: 4px 9px; margin-top: 10px; }
.legend-correct { color: var(--green); }
.legend-timing, .result-list .result-timing span:last-child { color: #8a5700; }
.legend-wrong, .result-list :is(.result-wrong, .result-missed, .result-extra) span:last-child { color: var(--red-dark); }
#live-extra { color: var(--red-dark); margin-top: 10px; }
#bar-review { margin-top: 10px; }
