: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; }
.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; }
.tempo-label { display: flex; align-items: flex-end; flex-direction: column; gap: 4px; color: var(--muted); font-size: .8125rem; font-weight: 700; flex: none; }
.tempo-label select { appearance: none; font: inherit; min-height: 44px; border: 1px solid #e5dfef; border-radius: 10px; color: var(--ink); padding: 8px 28px 8px 10px; background: #faf7ff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%235128b6' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") right 8px center / 14px no-repeat; }
.tune-description { color: var(--muted); line-height: 1.45; font-size: .9rem; margin: 11px 0 16px; }
.passage-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; margin-bottom: 10px; }
.passage-nav button:first-child { justify-self: start; }
.passage-nav button:last-child { justify-self: end; }
.passage-nav button:disabled { opacity: .5; }
#bar-count { text-align: center; color: var(--muted); font-weight: 650; font-size: .875rem; }
.score-staves { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)); gap: 7px; }
.score-bar { display: block; width: 100%; border: 1px solid #eee6fb; border-radius: 12px; color: #352350; background: #f7f3ff; }
.score-bar text { fill: currentColor; }
.score-bar .chord, .score-bar .note-label { font-weight: 750; font-size: 12px; }
.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-actions { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin-top: 12px; }
.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; }
.player-status, .score-source { color: var(--muted); line-height: 1.4; font-size: .875rem; }
.player-status:not(:empty), .score-source { display: block; margin-top: 7px; }
#real-book-chart { margin-top: 8px; }
#real-book-chart summary { padding: 10px 0; color: var(--deep-purple); font-weight: 700; cursor: pointer; }
#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; }
.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; }
}
@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; }
}
@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; }
}
