:root {
  color-scheme: dark;
  --bg: #121412;
  --panel: #1a1d19;
  --inset: #131613;
  --border: #30352c;
  --line: #2a2f27;
  --text: #f2f3ed;
  --muted: #a1a79a;
  --dim: #7c8577;
  --lime: #d5f67e;
  --lime-text: #182011;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse 850px 435px at 9% 0, #1c2118, transparent), var(--bg); color: var(--text); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, a, select, input[type="range"] { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .42; cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.frame { width: min(1280px, calc(100% - 96px)); margin-inline: auto; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

.site-header { height: 73px; border-bottom: 1px solid var(--line); background: #161915e8; }
.header-content { height: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; font-size: 21px; font-weight: 800; letter-spacing: -.75px; }
.brand-mark { display: flex; align-items: center; justify-content: center; gap: 3px; width: 35px; height: 35px; border-radius: 9px; background: var(--lime); box-shadow: 0 3px 12px #d5f62118; }
.brand-mark i { height: 17px; width: 4px; border-radius: 1px; background: #202719; }
.brand-mark i:first-child { height: 11px; margin-top: 6px; }
.brand-mark i:last-child { height: 14px; margin-top: 3px; }
.brand-period, .title-period { color: var(--lime); }
.top-nav { height: 100%; display: flex; gap: 33px; align-items: stretch; }
.top-nav a { position: relative; display: grid; align-content: center; color: var(--muted); white-space: nowrap; font-size: 13px; font-weight: 600; }
.top-nav a:hover, .top-nav a[aria-current] { color: var(--text); }
.top-nav a[aria-current]::after { content: ""; position: absolute; bottom: 0; inset-inline: 0; height: 2px; border-radius: 3px 3px 0 0; background: var(--lime); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 13px; border-radius: 8px; border: 1px solid transparent; background: transparent; font-size: 13px; font-weight: 650; white-space: nowrap; }
.button:hover:enabled, a.button:hover { filter: brightness(1.12); }
.button .icon { width: 16px; height: 16px; }
.primary { background: var(--lime); border-color: var(--lime); color: var(--lime-text); }
.import-trigger { justify-self: end; min-height: 40px; padding-inline: 14px; }
.subtler, .outline, .icon-button { background: #1b1f19; border-color: var(--border); }
.subtler { color: #d4d8ce; }
.icon-button { width: 38px; padding: 0; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding-block: 32px 25px; }
.page-intro h1 { font-size: clamp(31px, 4.3vw, 49px); font-weight: 800; line-height: 1.12; letter-spacing: -.057em; }
.page-intro p { color: var(--muted); margin-top: 10px; line-height: 1.5; }
.help-trigger { margin-bottom: 1px; }

.practice-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(288px, 29.6%); gap: 16px; align-items: stretch; }
.panel { border-radius: 15px; border: 1px solid var(--border); background: var(--panel); min-width: 0; box-shadow: 0 6px 24px #0001; }
.sheet-panel { display: flex; flex-direction: column; min-height: 347px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 20px 15px; }
.song-heading, .song-title-line, .transport { display: flex; align-items: center; gap: 10px; }
.song-heading { gap: 13px; min-width: 0; }
.song-title-line { flex-wrap: wrap; gap: 5px 10px; }
.song-title-line h2 { font-size: 23px; font-weight: 750; letter-spacing: -.035em; overflow-wrap: anywhere; }
.song-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 5px; }
.song-byline p { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.song-byline .text-link { font-size: 11px; }
.tile { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; flex: none; }
.tile.lime { color: var(--lime); background: #303a23; }
.tile.lavender { color: #c6bbfb; background: #353043; }
.tile.gold { color: #efc991; background: #403425; }
.tile.blue { color: #9ed6e0; background: #293a3c; }
.song-emblem { width: 48px; height: 48px; border-radius: 11px; }
.song-emblem .icon { width: 22px; height: 22px; }
.level { width: max-content; display: inline-block; padding: 4px 7px; border-radius: 5px; background: #2d3722; color: #cce994; font-size: 10px; font-weight: 700; }
.auto-button { background: #303822; border-color: #445032; color: var(--lime); padding-inline: 12px; }
.auto-button[aria-pressed="true"] { background: var(--lime); color: var(--lime-text); border-color: var(--lime); }
.sheet-area { margin-inline: 19px; border-radius: 9px; background: var(--inset); border: 1px solid #30342c; flex: 1; }
.sheet-topline { min-height: 41px; display: flex; align-items: center; justify-content: space-between; padding: 0 13px; border-bottom: 1px solid #272c24; color: var(--muted); font-size: 12px; }
.sheet-topline .icon { width: 15px; height: 15px; }
.sheet-label, .tempo-control { display: inline-flex; align-items: center; gap: 6px; }
.song-bpm { margin-left: 4px; padding-left: 9px; border-left: 1px solid var(--border); color: #c8d6bf; font: 500 11px var(--mono); white-space: nowrap; }
.tempo-control { color: #a9b19e; }
.tempo-control select { cursor: pointer; padding: 2px 3px; border: 0; background: var(--inset); color: #d4d8ce; font-family: var(--mono); font-size: 12px; }
.score { height: 164px; padding: 12px 15px; overflow: auto; scrollbar-width: thin; scrollbar-color: #424b3d transparent; color: #dadecf; font: 500 15px/1.8 var(--mono); }
.score-line { display: flex; flex-wrap: wrap; gap: 1px 5px; min-height: 28px; align-items: center; }
.note { display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; min-width: 18px; padding: 0 3px; line-height: 24px; }
.note.wait { color: var(--dim); }
.note.played { color: #77876b; }
.note.current { background: var(--lime); color: var(--lime-text); font-weight: 600; }
.note.incorrect { background: #fab3a8; color: #461a14; }
.load-error { color: #ffc3af; padding: 0 15px 12px; font-size: 12px; }
.sheet-foot { display: grid; grid-template-columns: minmax(100px, 1fr) 113px 133px; align-items: center; gap: 18px; padding: 14px 20px 15px; color: var(--muted); font-size: 11px; font-weight: 600; }
.progress-copy { display: flex; justify-content: space-between; gap: 7px; margin-bottom: 7px; }
.sheet-foot output { color: #dde4d4; font: 500 11px var(--mono); }
progress { display: block; width: 100%; height: 5px; border: 0; border-radius: 5px; background: #363d30; accent-color: var(--lime); appearance: none; overflow: hidden; }
progress::-webkit-progress-bar { background: #363d30; }
progress::-webkit-progress-value { background: var(--lime); border-radius: 5px; }
progress::-moz-progress-bar { background: var(--lime); border-radius: 5px; }
.accuracy, .next-note { display: flex; flex-direction: column; gap: 5px; min-height: 36px; justify-content: center; padding-left: 14px; border-left: 1px solid var(--line); }
.next-note output { color: var(--lime); overflow-wrap: anywhere; }

.library-preview { padding: 17px 16px 16px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; padding-inline: 2px; min-height: 22px; }
.panel-title h2, .piano-toolbar h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.panel-title h2 .icon, .piano-toolbar h2 .icon { color: var(--lime); }
.text-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--lime); font-weight: 600; width: fit-content; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.text-link .icon { width: 14px; height: 14px; }
.song-list { display: grid; gap: 7px; }
.song-row { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 8px 10px; background: #1e221d; border: 1px solid #2c3329; border-radius: 9px; }
.song-row:hover { background: #282f25; }
.song-row[aria-pressed="true"] { background: #262f20; border-color: #475739; }
.song-row-copy { display: grid; gap: 5px; flex: 1; min-width: 0; }
.song-row strong { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-row small { color: #abb2a2; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-row > .icon { color: #84907d; width: 15px; height: 15px; }
.song-row[aria-pressed="true"] > .icon { color: var(--lime); }

.piano-panel { margin-top: 16px; padding: 0 18px; }
.piano-toolbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; min-height: 57px; }
.piano-toolbar h2 span { color: var(--dim); font-weight: 500; font-size: 11px; margin-left: 1px; white-space: nowrap; }
.keyboard-switch { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--inset); }
.keyboard-switch .button { min-height: 29px; padding-inline: 11px; border-radius: 6px; color: var(--muted); font-size: 12px; }
.keyboard-switch .button[aria-pressed="true"] { color: var(--lime); background: #282f22; border-color: #3b492e; }
.piano-options { display: flex; justify-self: end; align-items: center; gap: 10px; }
.piano-options .button { min-height: 32px; }
.label-button { color: var(--muted); font-size: 12px; border-color: var(--border); }
.label-button[aria-pressed="true"] { color: var(--lime); background: #252e1f; border-color: #3b492e; }
.volume-control { display: flex; align-items: center; gap: 4px; border-left: 1px solid var(--border); padding-left: 6px; }
.sound-button { color: #c2c9bc; width: 32px; padding: 0; }
.volume-control input { width: 77px; height: 4px; accent-color: var(--lime); cursor: pointer; }
.piano-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: #495740 transparent; border-radius: 7px; }
.piano { position: relative; min-width: 810px; height: 167px; display: grid; grid-template-columns: repeat(36, 1fr); isolation: isolate; touch-action: pan-x; }
.piano-key { appearance: none; position: relative; display: flex; align-items: end; justify-content: center; min-width: 0; padding: 0 0 10px; border: 1px solid #b6bac0; border-radius: 0 0 5px 5px; font: 600 12px var(--mono); }
.white-key { background: linear-gradient(#d9dbd5, #f6f5f0 41%, #edeee8 83%, #d0d3c8); color: #4b5347; box-shadow: inset 0 -4px 1px #b9bdb4; }
.white-key:first-child { border-top-left-radius: 5px; }
.octave-key { border-left-color: #838b81; }
.black-key { position: absolute; z-index: 1; top: 0; left: var(--key-left); width: 1.83%; height: 62%; transform: translateX(-50%); border: 1px solid #101110; border-bottom: 2px solid #0a0b0a; border-radius: 0 0 5px 5px; background: linear-gradient(100deg, #20231f, #30342d 48%, #171a16 90%); color: #cbcec5; box-shadow: inset 0 -6px #10120f, 1px 3px 3px #070a0766; padding-bottom: 12px; font-size: 11px; }
.piano-key.hinted { background: linear-gradient(#a5c658, #e6ffa3 70%, #c4e768); color: #28351c; border-color: #849f52; box-shadow: inset 0 -5px #abc453; }
.piano-key.active { background: linear-gradient(#72953d, #b9ec63 65%, #a9d85a); color: #172312; box-shadow: inset 0 -2px #6d9439; }
.piano-key:focus-visible { z-index: 2; outline-offset: -3px; outline-color: #608e27; }
.piano.hide-labels .key-label { visibility: hidden; }
.computer-stage { padding: 13px 10px 15px; border: 1px solid var(--border); border-radius: 9px; background: var(--inset); }
.computer-keyboard { width: min(100%, 625px); margin-inline: auto; --key-gap: clamp(3px, .7vw, 7px); --key-width: calc((100% - 10 * var(--key-gap)) / 11); }
.computer-row { display: flex; column-gap: var(--key-gap); margin-bottom: var(--key-gap); padding-left: calc(var(--key-width) * .18); }
.computer-row:nth-child(2) { padding-left: calc(var(--key-width) * .52); }
.computer-row:nth-child(3) { padding-left: calc(var(--key-width) * .86); }
.computer-row:last-child { margin-bottom: 0; }
.computer-cap, .shift-cap { flex: 0 0 var(--key-width); min-width: 0; height: clamp(43px, 6vw, 54px); border: 1px solid #444c3f; border-radius: 7px; background: #262c24; box-shadow: 0 2px #080a08; }
.computer-cap { display: grid; grid-template-rows: 42% 1fr; }
.computer-cap:has(.hinted) { border-color: #98b753; }
.computer-key { display: grid; position: relative; grid-row: 2; place-items: center; min-width: 0; padding: 0; border: 0; border-radius: 0 0 6px 6px; background: transparent; color: var(--text); font: 600 clamp(12px, 1.5vw, 15px) var(--mono); touch-action: manipulation; }
.computer-key:only-child { grid-row: 1 / -1; align-content: end; padding-bottom: 6px; border-radius: 6px; }
.computer-key.shifted-key { grid-row: 1; border-radius: 6px 6px 0 0; box-shadow: inset 0 -1px #41483c; color: #b3bcaa; font-size: 11px; }
.computer-key:hover { background: #343e30; }
.computer-key:focus-visible { z-index: 1; outline-offset: -2px; }
.computer-key.hinted { color: var(--lime-text); background: var(--lime); }
.computer-key.active { color: var(--lime-text); background: #a4d153; }
.shift-cap { display: grid; align-content: end; justify-content: center; flex-basis: calc(var(--key-width) * 1.42); padding-bottom: 6px; color: var(--muted); font: 500 clamp(9px, 1.35vw, 12px) var(--mono); }
.shift-needed .shift-cap { color: var(--lime); border-color: #7b9750; background: #2e3a23; }
.shift-held .shift-cap { color: var(--lime-text); border-color: #98b753; background: #a4d153; }
.midi-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; color: var(--muted); font-size: 12px; }
.midi-toolbar .button { min-height: 31px; }
.midi-toolbar .button[aria-pressed="true"] { color: var(--lime); }
.midi-toolbar select { max-width: min(210px, 50vw); margin-left: 4px; }
.piano-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 43px; color: var(--muted); font-size: 11px; }
.piano-footer span { display: flex; align-items: center; gap: 6px; }
.piano-footer .icon { width: 15px; height: 15px; color: var(--dim); }
kbd { border: 1px solid #3d4735; border-radius: 4px; background: #232b1f; color: var(--lime); padding: 2px 5px; font: 500 .9em var(--mono); }
.hint-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); }
.site-footer { display: flex; justify-content: space-between; align-items: center; min-height: 65px; font-size: 11px; color: var(--dim); }
.site-footer a:hover { color: var(--lime); }
.site-footer .icon { width: 13px; height: 13px; }

.catalog { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.catalog-card { display: flex; flex-direction: column; gap: 14px; padding: 19px; }
.catalog-card .song-row { border: 0; background: transparent; padding: 0; }
.catalog-card .song-row:hover strong { color: var(--lime); }
.catalog-card .song-row strong { font-size: 17px; }
.catalog-card .tile { width: 48px; height: 48px; }
.catalog-card p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.catalog-links { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: auto; }
.lesson-progress { color: var(--lime); font: 500 12px var(--mono); white-space: nowrap; }
.lesson-layout { display: grid; grid-template-columns: minmax(220px, 27%) minmax(0, 1fr); gap: 15px; align-items: start; }
.lesson-sidebar { padding: 9px; }
.lesson-sidebar button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 11px; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 7px; }
.lesson-sidebar button:hover { background: #232920; }
.lesson-sidebar button[aria-pressed="true"] { border-color: #425238; background: #2b3623; }
.lesson-sidebar button > span:first-child { color: var(--lime); font: 500 12px var(--mono); width: 21px; flex: none; }
.lesson-panel { padding: 25px; }
.lesson-content { color: #d5d9d0; line-height: 1.7; max-width: 74ch; }
.lesson-content h1, .lesson-content h2, .lesson-content h3 { color: var(--text); line-height: 1.25; }
.lesson-content h2 { font-size: 17px; margin: 23px 0 7px; }
.lesson-content .lesson-heading { font-size: 28px; letter-spacing: -.045em; margin: 0 0 14px; }
.lesson-content p { margin-bottom: 8px; }
.lesson-content ul, .lesson-content ol { margin-top: 7px; padding-left: 24px; }
.lesson-content pre { background: var(--inset); border: 1px solid var(--border); padding: 10px 13px; border-radius: 7px; color: var(--lime); white-space: pre-wrap; }
.lesson-content code, .form-hint code { color: var(--lime); font-family: var(--mono); }
.lesson-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.lesson-actions .text-link { margin-left: auto; }

dialog { width: min(510px, calc(100% - 24px)); max-height: calc(100dvh - 28px); padding: 20px; margin: auto; border: 1px solid #485040; border-radius: 14px; background: #1e231c; color: var(--text); box-shadow: 0 22px 80px #0008; overflow: auto; }
dialog::backdrop { background: #060905ae; backdrop-filter: blur(3px); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 16px; }
.dialog-head h2 { font-size: 23px; letter-spacing: -.04em; }
.dialog-head p { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.4; }
.drop-zone { position: relative; display: grid; justify-items: center; gap: 6px; padding: 13px; min-height: 87px; background: #252e20; border: 1px dashed #687e50; border-radius: 9px; text-align: center; cursor: pointer; }
.drop-zone:hover, .drop-zone.dragging, .drop-zone:focus-within { border-color: var(--lime); }
.drop-zone .icon { color: var(--lime); }
.drop-zone small, .field span, .form-hint { color: var(--muted); font-size: 11px; }
.drop-zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.field { display: block; margin-top: 12px; margin-bottom: 6px; font-size: 12px; font-weight: 600; }
#import-name, #import-text { display: block; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--text); background: var(--inset); border: 1px solid var(--border); }
#import-text { font-family: var(--mono); resize: vertical; }
.form-hint { margin-top: 7px; line-height: 1.5; }
.form-error { color: #ffc3af; margin-top: 8px; font-size: 12px; }
.dialog-actions { margin-top: 16px; display: flex; justify-content: end; gap: 8px; }
.help-steps { display: grid; gap: 12px; color: #d5d9d0; line-height: 1.5; }

@media (max-width: 1000px) {
  .frame { width: calc(100% - 40px); }
  .practice-grid { grid-template-columns: minmax(0, 1fr) minmax(254px, 33%); }
  .sheet-head { padding-inline: 14px; }
  .sheet-area { margin-inline: 13px; }
  .sheet-foot { padding-inline: 14px; grid-template-columns: minmax(80px, 1fr) 99px 102px; gap: 9px; }
}

@media (max-width: 760px) {
  .frame { width: calc(100% - 28px); }
  .site-header { height: auto; }
  .header-content { grid-template-columns: 1fr auto; gap: 0 10px; padding-top: 11px; }
  .top-nav { order: 3; grid-column: 1 / -1; min-height: 44px; gap: 22px; }
  .brand { font-size: 19px; }
  .import-trigger { min-height: 36px; }
  .page-intro { padding-block: 22px 16px; align-items: start; }
  .page-intro p { margin-top: 6px; font-size: 12px; }
  .page-intro h1 { letter-spacing: -.055em; }
  .help-trigger { min-height: 34px; padding-inline: 8px; font-size: 11px; margin-top: 2px; }
  .practice-grid { display: contents; }
  #studio-view { display: flex; flex-direction: column; }
  .sheet-panel { min-height: 318px; }
  .song-title-line h2 { font-size: 19px; }
  .song-emblem { display: none; }
  .transport { gap: 5px; }
  .transport .button { min-height: 34px; padding-inline: 7px; font-size: 11px; }
  .transport .icon-button { width: 34px; }
  .score { height: 146px; }
  .sheet-foot { grid-template-columns: minmax(72px, 1.2fr) repeat(2, minmax(0, 1fr)); }
  .progress-copy output { white-space: nowrap; }
  .accuracy, .next-note { padding-left: 8px; }
  .piano-panel { padding-inline: 10px; }
  .piano-toolbar { grid-template-columns: 1fr auto; gap: 6px; padding-block: 10px; }
  .keyboard-switch { grid-row: 2; grid-column: 1 / -1; justify-self: start; }
  .piano { height: 145px; min-width: 1120px; }
  .piano-scroll { border-radius: 4px; }
  .piano-toolbar h2 span { display: none; }
  .piano-toolbar h2 { font-size: 13px; }
  .piano-options { gap: 5px; }
  .volume-control input { width: 49px; }
  .piano-footer { font-size: 10px; }
  .library-preview { order: 4; margin-top: 16px; }
  .catalog, .lesson-layout { grid-template-columns: 1fr; }
  .lesson-panel { padding: 16px; }
}
@media (max-width: 380px) {
  .header-content { column-gap: 7px; }
  .import-trigger { padding-inline: 9px; gap: 5px; font-size: 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .song-row, .top-nav a { transition: background-color .15s, color .15s, border-color .15s; }
}
