:root {
  color-scheme: dark;
  --base: #141219;
  --panel: #1c1923;
  --panel-hover: #24202c;
  --line: #352d3c;
  --ink: #f7f0ed;
  --muted: #bbb0bf;
  --gold: #f4c484;
  --green: #b7ddbb;
  --error: #ffaaa7;
  --radius: 17px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--base);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
#main:focus, h1:focus, h2:focus { outline: none; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.shell { width: min(1064px, calc(100% - 64px)); margin-inline: auto; }
.skip { position: absolute; left: 12px; top: -100px; z-index: 5; padding: 12px; background: var(--gold); color: var(--base); }
.skip:focus { top: 12px; }

.site-header { border-bottom: 1px solid #2b2532; }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 750; font-size: 20px; letter-spacing: -0.055em; }
.brand-accent { color: var(--gold); }
.install-button, .pill-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; min-height: 42px; background: transparent; border: 1px solid var(--line); border-radius: 10px;
  color: var(--muted); font-size: 13px; font-weight: 640;
}
.install-button:hover, .pill-button:hover { background: var(--panel-hover); color: var(--ink); }

.hero {
  position: relative; isolation: isolate; overflow: hidden; margin-top: 34px; min-height: 320px; border: 1px solid #4b3542; border-radius: 23px;
  padding: 43px 48px; display: flex; align-items: center;
  background: radial-gradient(ellipse at 87% 54%, #503040 0%, #30222f 44%, #231d29 77%);
}
.hero-content { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 760;
  letter-spacing: .16em; text-transform: uppercase; color: var(--gold);
}
.hero .eyebrow { padding: 7px 10px; background: #f4c48412; border: 1px solid #f4c48438; border-radius: 7px; }
.hero h1 { margin-top: 17px; font-size: clamp(45px, 6.2vw, 82px); line-height: .99; font-weight: 780; letter-spacing: -.08em; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero p { max-width: 370px; color: #e2d1d9; font-size: 16px; line-height: 1.6; margin-top: 19px; }
.hero-art { position: absolute; z-index: 0; top: 0; bottom: 0; right: 0; width: 60%; height: 100%; pointer-events: none; }

.exercise-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 15px; }
.exercise-heading h2 { font-size: 25px; font-weight: 730; letter-spacing: -.045em; }
.exercise-count { color: var(--muted); font-size: 12px; font-weight: 660; letter-spacing: .1em; text-transform: uppercase; }
.exercise-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.gold { --tone: #f4c484; --tile: #3a2d26; }
.pink { --tone: #f5aebd; --tile: #402938; }
.green { --tone: #afe0c3; --tile: #293934; }
.purple { --tone: #ccb7f9; --tile: #352b47; }
.blue { --tone: #a9c9f5; --tile: #283347; }
.orange { --tone: #f3b599; --tile: #3b2d31; }
.exercise-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; min-height: 154px; padding: 17px 20px 19px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); transition: background .15s, border-color .15s;
}
.exercise-card:hover { background: var(--panel-hover); border-color: var(--tone); }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.tile {
  display: inline-grid; place-items: center; flex: none; width: 39px; height: 39px;
  border-radius: 10px; background: var(--tile); color: var(--tone);
}
.card-arrow { color: #ac9bb3; }
.exercise-card:hover .card-arrow { color: var(--tone); }
.exercise-card h3 { font-size: 17px; font-weight: 710; letter-spacing: -.022em; }
.exercise-card p { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.functional { margin-left: 6px; vertical-align: .15em; color: var(--tone); font-size: 9px; font-weight: 720; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.site-footer {
  display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid #2b2532;
  margin-top: 32px; padding-block: 18px max(22px, env(safe-area-inset-bottom)); font-size: 12px; color: var(--muted);
}
.site-footer a:hover { color: var(--gold); text-decoration: underline; }
.footer-credits { display: grid; gap: 5px; text-align: right; }
.footer-button { justify-self: end; background: none; border: 0; min-height: 34px; padding: 0; color: var(--gold); }
.footer-button:hover { text-decoration: underline; }
.piano-picker { margin-block: 14px 8px; }

.inner { max-width: 740px; margin: 28px auto 0; }
.back-link { display: inline-flex; align-items: center; min-height: 42px; gap: 7px; color: var(--muted); font-size: 14px; }
.back-link:hover { color: var(--gold); }
.page-title { display: flex; gap: 13px; align-items: center; margin: 17px 0 8px; }
.page-title .tile { width: 44px; height: 44px; }
.page-title h1 { font-size: clamp(31px, 6vw, 48px); line-height: 1.08; font-weight: 760; letter-spacing: -.062em; }
.lede { color: var(--muted); font-size: 15px; line-height: 1.55; }
.surface { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 23px; margin-top: 23px; }
.surface h2 { font-size: 20px; font-weight: 720; letter-spacing: -.035em; }
.settings-form { display: grid; gap: 17px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; align-content: start; gap: 7px; min-width: 0; color: var(--ink); font-size: 14px; font-weight: 670; }
.field select, .field input {
  width: 100%; min-height: 46px; color: var(--ink); background: #15121b;
  border: 1px solid #4b4052; border-radius: 9px; padding: 8px 10px; font-size: 16px; font-weight: 520;
}
.field small { font-size: 12px; color: var(--muted); font-weight: 450; line-height: 1.4; }
fieldset { margin: 0; min-inline-size: 0; padding: 0; border: 0; }
legend { margin: 0 0 8px; padding: 0; font-size: 14px; font-weight: 670; }
.disclosure { border: 1px solid var(--line); border-radius: 11px; background: #19161f; }
.disclosure summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 46px;
  padding: 11px 13px; list-style: none; cursor: pointer; font-size: 14px; font-weight: 660;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after { content: "+"; color: var(--gold); font-size: 19px; font-weight: 480; line-height: 1; }
.disclosure[open] summary::after { content: "−"; }
.disclosure[open] > summary { border-bottom: 1px solid var(--line); }
.disclosure-body { padding: 14px; display: grid; gap: 13px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.check {
  position: relative; display: flex; align-items: center; min-height: 44px; gap: 9px; padding: 8px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); font-size: 13px; line-height: 1.3; cursor: pointer;
}
.check:has(input:checked) { border-color: #786047; color: var(--ink); }
.check input { accent-color: var(--gold); width: 17px; height: 17px; flex: none; margin: 0; }
.custom-row { display: flex; align-items: stretch; gap: 5px; }
.custom-row .check { flex: 1; }
.preview-choice { min-width: 44px; padding-inline: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--gold); }
.form-error { color: var(--error); font-size: 13px; line-height: 1.4; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 16px;
  border: 1px solid #504355; border-radius: 10px; background: #25202c; color: var(--ink); font-size: 14px; font-weight: 710;
}
.button:hover:not(:disabled) { background: #332a3b; }
.button.primary { border-color: var(--gold); background: var(--gold); color: #251b20; }
.button.primary:hover:not(:disabled) { background: #ffdaa6; border-color: #ffdaa6; }
.button:disabled { opacity: .45; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.form-actions .primary { min-width: 150px; }
.inline-note { color: var(--muted); font-size: 13px; line-height: 1.45; }
.text-button { min-height: 44px; padding: 5px 0; background: none; border: 0; color: var(--muted); font-size: 14px; }
.text-button:hover { color: var(--gold); }
.text-button + .text-button { margin-left: 12px; }

.quiz-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.quiz-top .page-title { margin-bottom: 0; }
.counter { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }
.counter strong { color: var(--ink); }
.listen { display: grid; gap: 14px; padding: 17px; background: #241d28; }
.listen-head { display: flex; justify-content: space-between; align-items: center; gap: 9px; }
.listen-head h2 { font-size: 19px; }
.quiz-progress { width: 100%; height: 4px; appearance: none; border: 0; border-radius: 4px; background: #493748; overflow: hidden; }
.quiz-progress::-webkit-progress-bar { background: #493748; }
.quiz-progress::-webkit-progress-value { background: var(--gold); }
.quiz-progress::-moz-progress-bar { background: var(--gold); }
.status { min-height: 20px; color: #e2d2dd; font-size: 13px; }
.answer-section { margin-top: 19px; }
.answer-section h2 { margin-bottom: 9px; font-size: 17px; }
.answer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.answer { min-width: 0; overflow-wrap: anywhere; padding: 9px 6px; line-height: 1.3; }
.answer:disabled { opacity: .68; }
.answer.correct { background: #273b33; color: var(--green); border-color: #6c9e7b; opacity: 1; }
.answer.wrong { background: #442831; color: var(--error); border-color: #a65e6b; opacity: 1; }
kbd { font-family: inherit; font-size: .77em; font-weight: 520; opacity: .8; }
.part-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.part-tab { min-width: 44px; }
.part-tab[aria-current="true"] { border-color: var(--gold); color: var(--gold); }
.part-tab.solved { background: #273b33; color: var(--green); }
.quiz-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 17px; }
.quiz-end .text-button { margin-right: 10px; }
.quiz-end .disclosure { flex-basis: 100%; }
.results-card { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 24px; background: radial-gradient(ellipse at 100% 50%, #3a2837, var(--panel) 70%); }
.score-badge {
  display: grid; place-items: center; flex: none; min-width: 105px; min-height: 105px; border-radius: 18px;
  border: 1px solid #9c7151; background: #453128; color: var(--gold); padding: 10px;
  font-size: 35px; line-height: 1; font-weight: 770; letter-spacing: -.06em; font-variant-numeric: tabular-nums;
}
.results-card .eyebrow { margin-bottom: 6px; }
.results-card p { margin-top: 6px; color: var(--muted); line-height: 1.5; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.results-table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.results-table th, .results-table td { padding: 10px 5px; border-bottom: 1px solid var(--line); }
.results-table th { color: var(--muted); font-size: 12px; font-weight: 660; }
.results-table td:first-child, .results-table th:first-child { text-align: left; }
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-actions { margin-top: 17px; }
.dialog { width: min(440px, calc(100% - 32px)); background: var(--panel); color: var(--ink); border: 1px solid #564355; border-radius: 18px; padding: 23px; }
.dialog::backdrop { background: #0e0b10c9; }
.dialog form { position: relative; }
.dialog h2 { margin: 9px 30px 8px 0; font-size: 25px; letter-spacing: -.04em; }
.dialog p, .dialog li { color: var(--muted); line-height: 1.55; font-size: 14px; }
.dialog li + li { margin-top: 9px; }
.dialog .close { position: absolute; right: -6px; top: -6px; height: 42px; width: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--base); font-size: 22px; }

@media (max-width: 890px) {
  .exercise-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding-inline: 35px; }
}
@media (max-width: 590px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 65px; }
  .brand { font-size: 19px; gap: 8px; }
  .hero { padding: 22px; min-height: 246px; margin-top: 19px; border-radius: 17px; }
  .hero h1 { font-size: clamp(40px, 10vw, 56px); }
  .hero p { max-width: 250px; margin-top: 14px; font-size: 14px; }
  .hero-art { width: 100%; right: -34%; opacity: .36; }
  .exercise-heading { margin: 24px 0 11px; }
  .exercise-heading h2 { font-size: 22px; }
  .exercise-count { font-size: 10px; }
  .exercise-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .exercise-card { display: grid; align-items: center; grid-template-columns: 39px minmax(0, 1fr); gap: 11px; min-height: 74px; padding: 11px 34px 11px 12px; border-radius: 12px; }
  .card-arrow { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
  .exercise-card h3 { font-size: 15px; }
  .exercise-card p { margin-top: 3px; font-size: 12px; }
  .site-footer { margin-top: 24px; }
  .inner { margin-top: 13px; }
  .surface { padding: 14px; margin-top: 16px; }
  .page-title { margin-top: 9px; gap: 9px; }
  .page-title .tile { width: 38px; height: 38px; }
  .fields { gap: 8px; }
  .answer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .disclosure-body { padding: 10px; }
  .results-table { font-size: 13px; }
}
@media (max-width: 350px) {
  .check-grid { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

.header-actions { display: flex; align-items: center; gap: 8px; }
.history-link {
  display: inline-flex; align-items: center; min-height: 42px; padding: 8px 10px;
  border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 700;
}
.history-link:hover, .history-link[aria-current="page"] { color: var(--gold); background: var(--panel-hover); }
.history-filter { margin-top: 20px; max-width: 260px; }
.history-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.history-stats > div { display: grid; gap: 5px; padding: 14px; }
.history-stats strong { color: var(--gold); font-size: clamp(20px, 5vw, 28px); line-height: 1; font-variant-numeric: tabular-nums; }
.history-stats span, .chart-title > span, .chart-dates { color: var(--muted); font-size: 12px; }
.chart-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 5px 12px; }
.history-chart { display: block; width: 100%; max-height: 225px; margin-top: 12px; overflow: visible; }
.history-chart text { font-size: 13px; fill: var(--muted); }
.chart-gridline { stroke: #4a3b50; stroke-width: 1; }
.chart-series { stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; fill: none; }
.chart-point { fill: var(--gold); stroke: var(--panel); stroke-width: 1; }
.chart-dates { display: flex; justify-content: space-between; gap: 12px; margin-left: 9%; }
.history-sessions { margin-top: 24px; }
.history-sessions h2 { margin-bottom: 6px; font-size: 21px; letter-spacing: -.035em; }
.history-list { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.history-entry {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: var(--panel);
}
.history-entry:hover { background: var(--panel-hover); border-color: #786047; }
.history-entry div { display: grid; gap: 4px; }
.history-entry span { color: var(--muted); font-size: 12px; line-height: 1.3; }
.history-entry-score { text-align: right; flex-shrink: 0; }
.history-entry-score > strong { color: var(--gold); font-variant-numeric: tabular-nums; }
.history-entry .trend.up { color: var(--green); }
.history-entry .trend.down { color: var(--error); }
.history-empty { display: grid; justify-items: start; gap: 12px; }
.history-empty p { color: var(--muted); font-size: 14px; }
#save-status:empty { display: none; }

@media (max-width: 420px) {
  .header-actions { gap: 4px; }
  .install-button { padding-inline: 9px; }
  .history-entry { padding: 10px; }
  .history-stats > div { padding: 10px; }
}

@media (max-width: 340px) {
  .install-button span { display: none; }
}
