:root {
  color-scheme: light;
  font-family: 'Aptos', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #222039;
  background: #f8f7fc;
  --ink: #222039;
  --muted: #625c75;
  --purple: #6338cb;
  --deep-purple: #5128b6;
  --line: #e9e5f1;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-inline-size: 0; background: radial-gradient(ellipse 65% 360px at 54% -25px, #f0ebff, transparent 100%), #f8f7fc; }
button { font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid #8355e9; outline-offset: 3px; }
button:disabled, button[aria-disabled="true"] { cursor: default; }
.symbols { position: absolute; inline-size: 0; block-size: 0; overflow: hidden; }
.icon { flex: none; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.topbar { background: #fdfcff; border-bottom: 1px solid var(--line); padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right)); padding-top: env(safe-area-inset-top); }
.top-inner { max-width: 1120px; min-height: 74px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; font-size: 1.25rem; letter-spacing: -.05em; }
.brand-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: white; background: linear-gradient(140deg, #8254ef, #6033c8); box-shadow: 0 3px 8px #6338cb35; }
.brand-icon svg { width: 30px; height: 30px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.subtle-button, .primary-button, .hint-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 14px; border-radius: 11px; font-size: .875rem; font-weight: 700; }
.subtle-button { background: #fff; color: #4f4868; border: 1px solid #e5dfef; }
.subtle-button .icon { width: 18px; height: 18px; }
.install { background: #f1ebff; border-color: transparent; color: var(--deep-purple); }
.sound[aria-pressed="true"] { color: var(--deep-purple); }
.shell { max-width: 1160px; margin: auto; padding: 57px max(20px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.intro { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 21px; gap: 20px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.25rem, 5vw, 3.55rem); letter-spacing: -.077em; line-height: 1.04; font-weight: 780; }
h1 em { color: var(--purple); font-style: normal; }
.intro p { color: var(--muted); margin-top: 13px; line-height: 1.45; font-size: 1.025rem; }
.clef-control { display: inline-flex; align-items: stretch; align-self: flex-end; background: #eee9f7; border: 1px solid #e7e0f2; border-radius: 15px; padding: 4px; flex: none; gap: 3px; }
.clef-button { color: #51486c; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; min-height: 44px; padding: 7px 12px; border: 0; background: transparent; font-weight: 700; font-size: .875rem; white-space: nowrap; }
.clef-button[aria-pressed="true"] { background: white; color: var(--deep-purple); box-shadow: 0 1px 4px #39236619; }
.clef-icon { width: 16px; height: 25px; flex: none; }
.clef-suffix { margin-left: -3px; }
.view-control { display: flex; gap: 18px; border-bottom: 1px solid #e4dcef; margin-bottom: 17px; }
.view-control button { min-height: 44px; padding: 6px 5px; border: 0; border-bottom: 2px solid transparent; background: transparent; font-size: .9375rem; color: var(--muted); font-weight: 700; }
.view-control button[aria-pressed="true"] { color: var(--deep-purple); border-bottom-color: #7446dc; }
.workspace { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(275px, 1fr); gap: 22px; align-items: start; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 7px 27px #2e245a08, 0 1px 2px #2e245a08; }
.practice { padding: 26px 28px 20px; }
.round-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 13px; font-size: .875rem; font-weight: 650; color: var(--muted); }
.lesson-label { padding: 6px 11px; border-radius: 8px; color: var(--deep-purple); background: #f2ecff; }
.round-track { display: flex; gap: 5px; }
.round-track span { background: #ede8f4; height: 5px; flex: 1; border-radius: 99px; }
.round-track span.current { background: #ad90f1; }
.round-track span.correct { background: #7446dc; }
.round-track span.missed { background: #e39686; }
.practice h2 { font-size: clamp(1.6rem, 4vw, 2.05rem); font-weight: 780; letter-spacing: -.052em; line-height: 1.18; }
#prompt { text-align: center; margin: 26px 0 17px; }
.staff-field { min-height: 195px; display: grid; place-items: center; border: 1px solid #eee7fc; border-radius: 16px; background: radial-gradient(circle, #dcd0f5 1px, transparent 1.3px) 0 0 / 17px 17px, #f7f3ff; color: #352350; overflow: hidden; }
.staff { width: min(92%, 470px); display: block; overflow: visible; }
.staff-lines { fill: none; stroke: #776591; stroke-width: 1.15; }
.ledger-lines { fill: none; stroke: #51406b; stroke-width: 1.5; }
#staff-note { color: #6b3bd3; fill: currentColor; }
#staff-note path { fill: none; stroke: currentColor; stroke-width: 1.95; stroke-linecap: round; }
.staff-field[data-result="correct"] #staff-note { color: #197755; }
.staff-field[data-result="missed"] #staff-note { color: #a33e33; }
.answer-keys { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.answer-keys button { min-height: 57px; padding: 0 3px; border: 1px solid #e7e0f3; border-radius: 11px; background: #faf8ff; color: #372754; font-size: 1.22rem; font-weight: 750; box-shadow: 0 2px 0 #ede7f6; }
.answer-keys button:active:not([aria-disabled="true"]) { transform: translateY(1px); box-shadow: none; }
.answer-keys button.correct { color: #12613f; background: #e3f5e9; border-color: #b7e4c7; box-shadow: 0 2px 0 #ccebd7; }
.answer-keys button.missed { color: #99372f; background: #ffede8; border-color: #f5c8bf; box-shadow: 0 2px 0 #f6d8d1; }
.round-bottom { display: flex; flex-wrap: wrap; min-height: 52px; align-items: center; gap: 6px 12px; margin-top: 12px; }
.feedback { flex: 1 1 135px; color: var(--muted); font-size: .875rem; line-height: 1.45; }
.feedback:empty { flex-basis: 0; }
.feedback strong { color: var(--ink); }
.hint-button { margin-left: auto; padding-inline: 8px; border: 0; color: var(--deep-purple); background: transparent; }
.hint-button .icon { width: 18px; height: 18px; }
.primary-button { background: #6637ce; color: white; border: 1px solid transparent; }
.sidebar { display: grid; gap: 17px; }
.path { padding: 20px 17px 15px; }
.path-heading { display: flex; align-items: center; gap: 11px; margin: 0 6px 16px; }
.path-icon, .summary-icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: #eee6ff; color: var(--deep-purple); }
.path-heading h2 { font-size: 1.1rem; font-weight: 750; letter-spacing: -.027em; }
.path-heading p { margin-top: 3px; color: var(--muted); font-size: .875rem; }
.lessons { display: grid; gap: 3px; list-style: none; padding: 0; margin: 0; }
.lessons button { width: 100%; min-height: 51px; border: 1px solid transparent; padding: 6px 9px; border-radius: 11px; display: flex; align-items: center; gap: 9px; background: transparent; color: var(--ink); text-align: left; font-weight: 650; font-size: .875rem; }
.lessons button:disabled { color: #645d77; opacity: 1; }
.lessons button[aria-current="step"] { background: #f3edff; border-color: #ebe1ff; color: var(--deep-purple); }
.lesson-index { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #f0edf7; color: #645979; font-size: .8rem; font-weight: 750; flex: none; }
[aria-current="step"] .lesson-index { color: #fff; background: #6c40d1; }
.lesson-status { margin-left: auto; display: flex; align-items: center; color: #6f628a; flex: none; }
.lesson-status .icon { width: 16px; height: 16px; }
.lesson-status.done { color: #187551; }
.lesson-status.current { color: var(--deep-purple); font-size: .8rem; }
.tip { display: flex; align-items: flex-start; gap: 10px; padding: 15px 16px; border: 1px solid #eee2c9; border-radius: 17px; background: #fff8e9; }
.tip-icon { display: grid; place-items: center; color: #7f5416; background: #fcebc9; border-radius: 9px; flex: none; width: 32px; height: 32px; }
.tip-icon .icon { width: 18px; height: 18px; }
.tip h2 { margin: 0 0 3px; color: #5d3e16; font-size: .9375rem; }
.tip p { color: #6d542e; font-size: .875rem; line-height: 1.48; }
.summary { min-height: 426px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 13px; padding: 20px 0; }
.summary-icon { height: 58px; width: 58px; border-radius: 18px; margin-bottom: 5px; }
.summary-icon .icon { width: 31px; height: 31px; }
.score { color: var(--deep-purple); font-weight: 750; font-size: 1.25rem; }
#summary-text { max-width: 39ch; line-height: 1.45; color: var(--muted); }
.summary-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; margin-top: 7px; }
dialog { width: min(460px, calc(100% - 32px)); max-height: calc(100% - 32px); border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 23px; padding: 27px; box-shadow: 0 16px 60px #24133b40; }
dialog::backdrop { background: #22183774; }
dialog h2 { margin: 4px 50px 16px 0; letter-spacing: -.04em; }
dialog p { color: var(--muted); margin-top: 12px; line-height: 1.55; }
.close-dialog { position: absolute; top: 12px; right: 12px; width: 44px; padding: 0; }
#playback-settings { width: min(370px, calc(100% - 24px)); padding: 20px; }
.settings-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.settings-heading h2 { margin: 0; font-size: 1.2rem; }
.settings-heading button { border: 0; color: var(--deep-purple); }
.settings-tempo-label { display: block; text-align: center; color: var(--muted); font-size: .85rem; }
.tempo-stepper { display: grid; grid-template-columns: 48px minmax(0,1fr) 48px; align-items: center; gap: 12px; margin: 12px 0 24px; }
.tempo-stepper > button { height: 48px; border: 1px solid var(--line); border-radius: 13px; background: #faf7ff; color: var(--ink); font-size: 1.6rem; }
.tempo-stepper > div { text-align: center; min-width: 0; }
#tempo { width: 100%; max-width: 126px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: center; font: 650 2.5rem system-ui; color: var(--ink); background: transparent; appearance: textfield; -moz-appearance: textfield; }
#tempo::-webkit-inner-spin-button, #tempo::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.tempo-stepper span { display: block; color: var(--muted); font-size: .7rem; letter-spacing: .08em; }
.playback-switches { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 6px; }
.playback-switches label { position: relative; display: flex; min-width: 0; min-height: 44px; }
.playback-switches input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.playback-switches span { display: flex; align-items: center; justify-content: center; gap: 6px; flex: 1; border: 1px solid var(--line); border-radius: 10px; font-size: .78rem; color: var(--muted); pointer-events: none; }
.playback-switches span::before { content: ''; width: 6px; height: 6px; border: 1px solid currentColor; border-radius: 50%; }
.playback-switches input:checked + span { color: var(--deep-purple); background: #eee7fc; border-color: #eee7fc; font-weight: 650; }
.playback-switches input:checked + span::before { background: currentColor; }
.playback-switches input:focus-visible + span { outline: 3px solid #8355e9; outline-offset: 2px; }
#playback-settings .loop-range { margin-top: 14px; }
#playback-settings select { min-height: 44px; font: inherit; font-size: 1rem; padding: 4px; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: #faf7ff; }
.player { padding: 22px 24px; }
.player-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.player-heading h2 { font-size: clamp(1.4rem, 4vw, 1.95rem); letter-spacing: -.042em; line-height: 1.12; overflow-wrap: anywhere; }
.tune-type { margin-bottom: 5px; color: var(--deep-purple); font-size: .875rem; font-weight: 700; }
.library-link { text-decoration: none; }
.shell:has(#repertoire-view:not([hidden])) .intro > div:first-child { display: none; }
.tune-description { color: var(--muted); line-height: 1.45; font-size: .9rem; margin: 10px 0; }
.score-toolbar, .chart-views, #score-options { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.score-toolbar { justify-content: space-between; margin-bottom: 8px; }
.chart-views { gap: 4px; }
.chart-views button[aria-pressed="true"] { background: #eee7ff; color: var(--deep-purple); border-color: #ddd1f7; }
.score-staves { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 136px), 1fr)); gap: 3px 0; }
.score-measure { min-width: 0; padding: 0; border: 1px solid transparent; border-bottom-color: var(--line); border-radius: 8px; text-align: left; color: #352350; background: transparent; }
.score-measure.dense { grid-column: span 2; }
.score-measure[aria-current="true"] { background: #eee7ff; border-color: #ded1f7; box-shadow: inset 3px 0 #7950d8; }
.score-bar { display: block; width: 100%; max-height: 152px; }
.score-bar text { fill: currentColor; }
.score-bar .chord, .score-bar .note-label, .score-bar .measure-name { font-weight: 750; font-size: 15px; }
.score-bar .clef-number { font: 750 15px Georgia, serif; }
.score-bar .notation { color: #392859; fill: currentColor; }
.score-bar .notation.active { color: #5422c1; }
.score-bar .note-glow { opacity: 0; fill: #e4d6fc; }
.score-bar .active .note-glow { opacity: 1; }
.score-bar .note-label { display: none; }
.score-staves.labels .note-label { display: block; }
.player-transport { position: sticky; z-index: 3; bottom: 0; margin: 6px -10px -10px; padding: 7px 10px max(8px, env(safe-area-inset-bottom)); background: #fbf9ff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 -3px 12px #2414400a; }
.player-position, .player-actions, .loop-range { display: flex; align-items: center; gap: 6px; }
.player-position { min-height: 44px; }
.player-position .subtle-button { min-height: 42px; padding: 4px 8px; }
.player-position input { flex: 1; min-width: 0; align-self: stretch; accent-color: var(--purple); }
#bar-count { color: var(--muted); font-weight: 650; font-size: .8125rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.player-actions .primary-button { flex: 1; min-width: 0; padding-inline: 8px; }
.player-transport select { font: inherit; font-size: 1rem; min-height: 44px; border: 1px solid #e5dfef; border-radius: 10px; color: var(--ink); padding: 5px 4px; background: #fff; }
.check-option { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 2px; color: #50436a; font-size: .875rem; font-weight: 650; cursor: pointer; }
.check-option input { accent-color: var(--purple); width: 16px; height: 16px; margin: 0; }
.loop-option { padding: 0 7px; border-radius: 10px; background: #fff; border: 1px solid #e5dfef; }
.loop-range { justify-content: space-between; margin-top: 6px; }
.loop-range label { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .8125rem; }
.player-status, .score-source { color: var(--muted); line-height: 1.4; font-size: .875rem; }
.player-status:not(:empty), .score-source { display: block; margin-top: 4px; }
.score-source { margin-bottom: 7px; }
#chart-image { display: block; max-width: 100%; border: 1px solid var(--line); border-radius: 9px; }
.library-group { font-size: .875rem; color: var(--muted); margin: 14px 6px 5px; }
.variation-picker { display: flex; align-items: center; gap: 10px; margin: 12px 0; color: var(--muted); font-size: .875rem; font-weight: 650; }
.variation-picker .subtle-button { min-width: 44px; min-height: 44px; padding: 6px; font-size: 1.25rem; }
.variation-picker output { min-width: 24px; text-align: center; color: var(--ink); font-size: 1rem; font-variant-numeric: tabular-nums; }
.variation-picker button:disabled { opacity: .35; cursor: default; }
.tune-button { display: block; text-align: left; width: 100%; min-height: 45px; padding: 8px 9px; border: 1px solid transparent; border-radius: 10px; color: var(--ink); background: transparent; font-size: .9375rem; font-weight: 650; overflow-wrap: anywhere; }
.tune-button[aria-current="true"] { background: #f3edff; border-color: #ebe1ff; color: var(--deep-purple); }
.import-area { position: relative; margin: 15px 5px 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.import-area:focus-within .file-button { outline: 3px solid #8355e9; outline-offset: 3px; }
.file-button { cursor: pointer; }
#import-help, #import-status { color: var(--muted); margin-top: 10px; font-size: .875rem; line-height: 1.45; }
#import-status:empty { display: none; }
@media (hover: hover) {
  .subtle-button:hover, .clef-button:hover:not([aria-pressed="true"]), .hint-button:hover { background: #eee6fc; }
  .primary-button:hover { background: #5126b8; }
  .answer-keys button:hover:not([aria-disabled="true"]), .lessons button:hover:not(:disabled):not([aria-current]) { border-color: #b49ae8; background: #f4eeff; }
  .tune-button:hover, .file-button:hover { background: #f4eeff; }
  .score-measure:not([aria-current="true"]):hover { background: #f7f2ff; }
}
@media (max-width: 950px) {
  .intro { align-items: flex-start; flex-direction: column; }
  .clef-control { align-self: flex-start; }
}
@media (max-width: 700px) {
  .shell { padding-top: 28px; }
  .top-inner { min-height: 63px; }
  .intro { gap: 14px; margin-bottom: 8px; }
  .intro p { margin-top: 9px; }
  .clef-control { align-self: stretch; }
  .clef-button { flex: 1; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .practice { border-radius: 19px; padding: 16px 15px 11px; }
  .round-meta { margin-bottom: 10px; }
  #prompt { margin: 19px 0 13px; }
  .staff-field { min-height: 146px; border-radius: 13px; }
  .answer-keys { margin-top: 12px; gap: 5px; }
  .answer-keys button { min-height: 49px; border-radius: 8px; }
  .round-bottom { margin-top: 8px; }
  .path { border-radius: 19px; }
  .summary { min-height: 307px; }
  .player { padding: 15px; border-radius: 19px; }
  .score-staves { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 380px) {
  .shell { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .topbar { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .long-install { display: none; }
  .sound span { display: none; }
  .top-actions { gap: 5px; }
  .subtle-button { padding-inline: 10px; }
}
