@font-face {
  font-family: Playpen;
  src: url("./assets/fonts/PlaypenSans.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #38564e;
  --green: #426c56;
  --muted: #536753;
  --paper: #fbfaf0;
  --edge: #a7b4a3;
  --blue: #194d79;
  --plum: #795091;
  --rust: #a14a22;
  --yellow: #f6df82;
  --focus: #467a75;
  font-family: Playpen, "Comic Sans MS", sans-serif;
  color: var(--ink);
  background-color: #fdfdf9;
  background-image: linear-gradient(90deg, #83948817 1px, transparent 1px),
    linear-gradient(0deg, #83948817 1px, transparent 1px);
  background-size: 36px 36px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { width: min(910px, calc(100% - 2.5rem)); margin-inline: auto; }
h1, h2, p { margin: 0; }
button, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}
img { display: block; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { display: inline-block; padding: .5rem; color: var(--blue); background: white; }
.topbar {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 80px;
  border-bottom: 2px dashed #c5cebb;
}
.brand { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.mascot { object-fit: contain; width: clamp(37px, 6vw, 62px); height: auto; }
.wordmark {
  font-size: clamp(1.05rem, 3.1vw, 1.9rem);
  letter-spacing: -.055em;
  font-weight: 800;
  white-space: nowrap;
}
.wordmark span:nth-child(1) { color: var(--blue); }
.wordmark span:nth-child(2) { color: var(--plum); }
.wordmark span:nth-child(3) { color: var(--rust); }
.version {
  flex: none;
  padding: .12rem .34rem;
  color: #355765;
  background: #fff1bb;
  border: 1.5px solid #607c84;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 760;
  transform: rotate(-7deg);
  box-shadow: 1px 2px 0 #d9decf;
}
.outline-button, .mode-button, .mic-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 44px;
  padding: .45rem .8rem;
  border: 2px solid #b4c2b8;
  border-radius: 13px;
  background: #fffcf4;
  font-weight: 680;
  text-align: center;
}
.outline-button:hover, .mode-button:hover, .mic-button:hover { border-color: #739988; background: #f5f9f1; }
.startup-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: #e5ece15c;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
body:has(.startup-overlay:not([hidden])) { overflow: hidden; }
.startup-card {
  position: relative;
  width: min(100%, 330px);
  max-height: 100%;
  padding: clamp(1rem, 5vw, 1.5rem) clamp(.75rem, 5vw, 1.5rem) 1.6rem;
  overflow: auto;
  border: 2px solid #aabfb2;
  border-radius: 24px 28px 25px 23px;
  background: #fffdf4;
  box-shadow: 0 18px 54px #2f4b3f35;
  color: #355765;
  text-align: center;
}
.startup-version { position: absolute; top: 1rem; right: 1rem; }
.startup-mascot {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  margin-inline: auto;
  padding: 8px;
  border: 1px solid #d1dfce;
  border-radius: 49% 51% 46% 54%;
  background: #e6eedf;
}
.startup-mascot img { width: 100%; height: 100%; object-fit: contain; }
.startup-card h2 { margin: .55rem 0 1rem; font-size: clamp(1rem, 6vw, 1.65rem); line-height: 1.2; }
.startup-loading { width: min(100%, 210px); min-height: 43px; margin-inline: auto; }
#startup-status { margin-bottom: .35rem; color: #496354; font-size: .81rem; font-weight: 650; }
#startup-progress {
  display: block;
  width: 100%;
  height: 8px;
  appearance: none;
  border: 0;
  border-radius: 10px;
  accent-color: #729980;
  background: #e1e9e2;
}
#startup-progress::-webkit-progress-bar { border-radius: 10px; background: #e1e9e2; }
#startup-progress::-webkit-progress-value { border-radius: 10px; background: #729980; }
#startup-progress::-moz-progress-bar { border-radius: 10px; background: #729980; }
#startup-percent {
  display: block;
  margin-top: .25rem;
  color: #496354;
  font-size: .75rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.startup-start {
  margin-top: .65rem;
  padding-inline: 1.1rem;
  border-color: #9b8e5b;
  background: var(--yellow);
  box-shadow: 0 3px #cab96b46;
  font-size: .92rem;
}
.startup-start:hover { border-color: #9b8e5b; background: #f9e69e; }
.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
  width: min(100%, 410px);
  margin: clamp(1.15rem, 4vw, 2.4rem) auto 1.05rem;
}
.mode-button { min-height: 48px; padding-inline: .9rem; font-size: clamp(.83rem, 2.2vw, .98rem); }
.mode-button img { flex: none; }
.mode-button[aria-pressed="true"] { border-color: #789b89; background: #e4eedf; color: #345a48; }
.paper {
  position: relative;
  isolation: isolate;
  width: min(100%, 740px);
  margin-inline: auto;
  padding: clamp(1rem, 4vw, 2.25rem);
}
.paper-outline { z-index: -1; position: absolute; inset: 0; pointer-events: none; }
.paper-outline path { fill: var(--paper); stroke: var(--edge); stroke-width: 1.7; }
.header-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: .55rem;
  margin-left: auto;
}
.header-tools:has(#note-colors:not([hidden]))::before {
  content: "";
  order: 1;
  width: 1px;
  height: 28px;
  background: #b4c2b8;
}
.header-tools button {
  min-width: 52px;
  min-height: 48px;
  padding: .35rem;
  background: #fffdf6;
}
.header-tools #note-colors[aria-pressed="true"] { background: #e0efdf; border-color: #618d72; }
.mic-button { position: relative; order: 2; }
.mic-button[data-state="on"] { background: #e0efdf; border-color: #618d72; }
.mic-button[data-state="opening"] { background: #fff0be; }
.mic-button:is([data-state="on"], [data-state="opening"])::after {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #35775a;
  content: "";
}
.mic-button[data-state="opening"]::after { background: #a27822; }
.mic-button[data-state="disconnected"] { background: #fff1dc; border-color: #b98063; }
.mic-button .mic-disconnected {
  display: none;
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 20px;
  height: 20px;
  padding: 2px;
  border-radius: 50%;
  background: #fffdf8;
}
.mic-button[data-state="disconnected"] .mic-disconnected { display: block; }
.exercise-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .45rem .65rem;
}
.exercise-instruction {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: .85rem 0 .55rem;
  color: #4a5d50;
  font-size: .87rem;
  font-weight: 650;
  line-height: 1.55;
}
.exercise-instruction img { flex: none; width: clamp(44px, 8vw, 54px); height: auto; }
.round-progress { display: flex; align-items: center; justify-content: center; gap: .45rem; }
.round-position {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .24rem .65rem;
  border: 1px solid #c2b4ce;
  border-radius: 9px;
  background: #f2ebf6;
  color: #674582;
  font-size: .76rem;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}
.note-ready {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.note-ready-card {
  display: grid;
  justify-items: center;
  gap: .42rem;
  width: min(270px, calc(100vw - 2rem));
  padding: clamp(.85rem, 4vw, 1.4rem) 1rem;
  border: 2px solid #9ab29c;
  border-radius: 23px 28px 23px 25px;
  background: #fffef7f0;
  box-shadow: 0 10px 40px #35544330;
  text-align: center;
}
.note-ready-child { width: auto; height: clamp(64px, 17vh, 102px); }
.note-ready-card p {
  color: #496353;
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  font-weight: 750;
}
.note-ready-card b {
  display: grid;
  place-items: center;
  min-width: 62px;
  min-height: 65px;
  border: 1.5px solid #aa934d;
  border-radius: 14px 16px 14px 15px;
  background: #f2d875;
  color: #405848;
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
}
.unit-control {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: .4rem;
  min-height: 44px;
  padding: 0 .45rem;
  border: 1.5px solid #b7c3b4;
  border-radius: 11px;
  font-size: .79rem;
  color: var(--ink);
  background: #fffdf7;
}
.unit-control:hover { border-color: #739988; }
.unit-picker {
  width: min(480px, calc(100% - 1.5rem));
  max-height: min(680px, calc(100% - 1.5rem));
  padding: clamp(.75rem, 4vw, 1.35rem);
  border: 2px solid #b4c2b8;
  border-radius: 19px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 10px 30px #29423636;
}
.unit-picker::backdrop { background: #22392f54; }
.unit-picker h2 {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: .8rem;
  color: var(--plum);
  font-size: clamp(1.2rem, 5vw, 1.55rem);
}
.unit-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.unit-choice {
  justify-content: flex-start;
  gap: .42rem;
  min-height: 48px;
  padding: .35rem .42rem;
  font-size: .8rem;
  text-align: left;
}
.unit-icon { position: relative; display: block; flex: none; width: 29px; height: 29px; }
.unit-icon img { width: 100%; height: 100%; object-fit: contain; }
.unit-book-number {
  position: absolute;
  top: 34%;
  left: 52%;
  transform: translate(-50%, -50%) rotate(-8deg);
  color: #533c68;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}
.unit-choice-label { display: grid; line-height: 1.45; }
.unit-page { font-size: .69rem; color: var(--muted); }
.unit-control .unit-icon { width: 26px; height: 26px; }
.unit-choice:last-child { grid-column: 1 / -1; }
.unit-picker-footer { margin-top: .7rem; text-align: right; }
.unit-picker-footer button { font-size: .82rem; }
.challenge-stats {
  display: flex;
  align-items: stretch;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #c6d1c6;
  border-radius: 10px;
  background: #f9faf3;
}
.score-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 38px;
  padding: .25rem .58rem;
  border: 1px solid #bdcbb9;
  border-radius: 10px;
  background: #edf3e8;
  color: #425e50;
  font-size: .76rem;
  font-weight: 680;
  text-align: center;
}
.challenge-stats .score-count {
  min-width: 0;
  min-height: 36px;
  padding: .25rem .55rem;
  border: none;
  border-radius: 0;
  background: transparent;
  white-space: nowrap;
}
.challenge-stats img { flex: none; width: 18px; height: 18px; }
.score-count b { display: inline-block; min-width: 2ch; color: #366854; text-align: right; font-weight: 780; font-variant-numeric: tabular-nums; }
.note-timer {
  --timer-fill: #e1edf0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: .26rem;
  min-width: 58px;
  padding: .2rem .4rem;
  isolation: isolate;
  overflow: hidden;
  border-left: 1px solid #c6d1c6;
  color: #2d5869;
  font-size: .83rem;
}
.note-timer::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--timer-fill);
  transform: scaleX(var(--note-time-left, 100%));
  transform-origin: left;
}
.note-timer[data-timer-state="waiting"]::before { opacity: .54; }
.note-timer[data-timer-state="urgent"] {
  --timer-fill: #f2d59a;
  background: #fff8e8;
  color: #7a4c25;
}
.timer-value { min-width: 2.8ch; font-variant-numeric: tabular-nums; white-space: nowrap; }
.listening { width: min(100%, 490px); margin-inline: auto; }
.reading {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  align-items: center;
  column-gap: clamp(.4rem, 4vw, 2rem);
  min-height: clamp(126px, 29vw, 215px);
}
.diagram { margin: 0; justify-self: right; width: min(100%, 217px); }
.diagram-picture { position: relative; }
#fingering { width: 100%; height: auto; }
.success-mark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: celebrate .29s ease-out both;
}
.success-mark:not([hidden]) + #fingering { visibility: hidden; }
.diagram-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .34rem;
  min-height: 44px;
  margin: .3rem auto 0;
  padding: .25rem .45rem;
  border: 1px solid #becbb9;
  border-radius: 10px;
  background: #fffdf5;
  color: #426c56;
  font-size: .73rem;
  font-weight: 700;
}
.diagram-hint:hover { border-color: #739988; }
.diagram-hint img { flex: none; object-fit: contain; }
.diagram-hint[aria-pressed="true"] { border-color: #6e9a81; background: #e0ebdc; }

.pitch-reading { min-width: 0; text-align: center; }
.played-note {
  display: grid;
  place-items: center;
  min-height: 1.45em;
  color: var(--note-color, var(--plum));
  -webkit-text-stroke: 1px #48423f;
  paint-order: stroke fill;
  font-size: clamp(2.55rem, 6vw, 4.15rem);
  font-weight: 790;
  line-height: 1.35;
}
.played-note.monochrome { color: #414749; -webkit-text-stroke: 0; }
.frequency { font: 600 .83rem/1.5 system-ui, sans-serif; color: #536954; }
.meter { position: relative; margin: .85rem 0 0; }
.meter-track {
  position: relative;
  height: 19px;
  border-radius: 15px;
  border: 1px solid #b1bdac;
  background: linear-gradient(to right, #d3e6f0 17%, #e2eedb 33% 67%, #f8dfa7 83%);
}
.meter-center { position: absolute; inset: -4px auto -4px 50%; width: 2px; background: #5e816d; transform: translateX(-50%); }
.meter-marker {
  --needle-low: #aad0e1db;
  --needle-center: #a9ccb4e0;
  --needle-high: #efcc90db;
  position: absolute;
  top: 50%;
  left: var(--position, 50%);
  width: 18px;
  height: 26px;
  transform: translate(-50%, -50%);
  border: 2px solid #507d6b;
  border-radius: 6px;
  background: var(--needle-center);
  background: color-mix(in srgb, var(--needle-center), var(--needle-side, var(--needle-center)) var(--needle-tint, 0%));
  box-shadow: 0 1px 4px #2942362b;
  transition: left .21s ease-out, opacity .22s ease, background-color .24s ease, border-color .24s ease;
}
.listening[data-state="idle"] .meter-marker,
.listening[data-state="silent"] .meter-marker,
.listening[data-state="wrong"] .meter-marker { opacity: 0; }
.listening[data-state="success"] .meter-marker { border-color: #3e6b52; }
.meter-icons {
  display: flex;
  justify-content: space-between;
  margin: .35rem 0 .65rem;
}
.meter-icons img { object-fit: contain; opacity: .57; }
.meter-low, .meter-high { rotate: -90deg; }
.listening[data-state="low"] .meter-low,
.listening[data-state="high"] .meter-high,
.listening[data-state="good"] .meter-good {
  opacity: 1;
  transform: scale(1.16);
}
.listening:is([data-state="wrong"], [data-state="success"]) .meter-good { visibility: hidden; }
.meter-wrong { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); }
.hold { display: flex; gap: .8rem; align-items: center; }
.hold-track {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 13px;
  border: 1px solid #c4cfbf;
  border-radius: 999px;
  background: #e1e8d9;
  overflow: hidden;
}
.hold-track::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    #579bb6 0 28.333%,
    #d9a344 38.333% 61.667%,
    #689679 71.667% 100%
  );
  clip-path: inset(0 calc(100% - var(--hold-fill, 0%)) 0 0 round 0 999px 999px 0);
  transition: clip-path .1s linear;
}
#elapsed {
  flex: none;
  min-width: 6.5ch;
  padding: .25rem .55rem;
  border: 1px solid #bdcbb9;
  border-radius: 8px;
  background: #fffdf5;
  font-size: .8rem;
  font-weight: 690;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}
.error { margin-top: .7rem; color: #8b361f; text-align: center; font-size: .8rem; }
.challenge-score { width: min(100%, 490px); margin: 0 auto .4rem; border-bottom: 1px solid #d0d8c7; padding-bottom: .65rem; }
#staff { display: grid; place-items: center; }
#staff svg { display: block; width: min(100%, 425px); height: auto; overflow: visible; }
.next-action { display: flex; justify-content: center; margin-top: .75rem; }
.next-action .outline-button { min-height: 44px; font-size: .79rem; }
.round-result {
  display: grid;
  grid-template-columns: minmax(0, 210px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(.5rem, 4vw, 2rem);
  width: min(100%, 530px);
  min-height: 310px;
  margin-inline: auto;
  padding: clamp(.5rem, 3vw, 1.5rem);
  text-align: center;
}
.round-child { width: 100%; height: auto; }
.round-result h2 { color: #365d4c; font-size: clamp(1.65rem, 4vw, 2.15rem); }
.round-summary { display: flex; justify-content: center; margin: .45rem 0 .85rem; }
.replay-button { border-color: #b19b58; background: #fff0b4; }
.replay-button:hover { border-color: #a38b43; background: #ffeb9a; }
@keyframes celebrate {
  from { transform: scale(.9); }
  to { transform: scale(1); }
}
footer { text-align: center; margin: 1.25rem 0 .8rem; color: #546752; font-size: .79rem; }
@media (max-width: 520px) {
  body { width: calc(100% - 1.2rem); }
  .topbar { min-height: 63px; }
  .mode-switch { gap: .35rem; margin-top: 1rem; }
  .mode-button { padding-inline: .5rem; min-height: 44px; }
  .mode-button img { width: 21px; height: 21px; }
  .header-tools { gap: .3rem; }
  .header-tools button { min-width: 44px; min-height: 44px; }
  .mic-button > img:first-child { width: 28px; height: 28px; }
  .reading { grid-template-columns: minmax(0, 1.07fr) minmax(0, .93fr); }
  .score-count img { width: 18px; height: 18px; }
  .round-result { grid-template-columns: 1fr; justify-items: center; }
  .round-child { width: min(53%, 155px); }
}
@media (max-width: 355px) {
  .topbar { gap: .37rem; }
  .brand { gap: .3rem; }
  .mascot { width: 30px; }
  .wordmark { font-size: .91rem; }
}
@media (prefers-reduced-motion: reduce) {
  .meter-marker { transition: none; }
  .hold-track::before { transition: none; }
  .success-mark { animation: none; }
}
