:root {
    color-scheme: dark;
    font-family: "Segoe UI", system-ui, sans-serif;
    background: #111820;
    color: #e8edf2;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    --muted: #91a0ad;
    --line: #27333d;
    --panel: #18222c;
    --mint: #72d6b2;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 68% 0%, rgba(52, 104, 89, .14), transparent 38rem),
        #111820;
}

button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

.shell { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.song-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    padding-bottom: 12px;
}
.library-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
.library-shell > .topbar,
.library-shell > .hero,
.library-shell > .practice-library-tabs,
.library-shell > .footer { flex: 0 0 auto; }
.library-shell > .hero { padding: clamp(24px, 5vh, 58px) 0 clamp(18px, 3vh, 34px); }
.library-scroll-region {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.library-shell .practice-library-tabs { margin-bottom: 12px; }
.library-shell .library { padding-bottom: 24px; }
.library-shell .library-heading {
    position: sticky;
    top: 0;
    z-index: 2;
    margin-bottom: 12px;
    padding: 8px 0 12px;
    background: linear-gradient(180deg, #111820 78%, rgba(17, 24, 32, .94));
}
.library-shell .footer { margin-top: 8px; padding: 10px 0 2px; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(145, 160, 173, .13); }
.song-shell .topbar { height: 54px; flex: 0 0 auto; }
.brand { display: inline-flex; gap: 10px; align-items: center; font-weight: 700; font-size: 19px; letter-spacing: -.04em; }
.brand-mark { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; color: #10211c; background: var(--mint); font-weight: 800; }
.topbar-note, .eyebrow, .song-count { font-family: Consolas, monospace; font-size: 11px; letter-spacing: .12em; color: var(--muted); }
.hero { padding: 88px 0 70px; max-width: 760px; }
.eyebrow { margin: 0 0 15px; color: var(--mint); display: flex; gap: 9px; align-items: center; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--mint); box-shadow: 0 0 12px rgba(114, 214, 178, .6); }
h1, h2, p { margin-top: 0; }
.hero h1, .song-heading h1 { margin: 0; font-size: clamp(42px, 7vw, 72px); letter-spacing: -.065em; line-height: 1.04; }
.hero h1 span { color: #8c9aa6; }
.hero-copy { margin: 23px 0 0; max-width: 490px; color: #a4b0ba; line-height: 1.7; font-size: 16px; }
.library { padding-bottom: 72px; }
.library-heading, .tab-panel-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 20px; }
.library-heading .eyebrow, .tab-panel-heading .eyebrow { margin-bottom: 7px; }
.library-heading h2, .tab-panel-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.song-count { padding: 7px 10px; border: 1px solid var(--line); border-radius: 20px; }
.library-tools { display: flex; align-items: center; gap: 10px; }
.practice-library-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.practice-library-tabs button { min-height: 38px; padding: 0 15px; border: 1px solid #35424c; border-radius: 9px; color: #aebdc3; background: rgba(24, 34, 44, .72); cursor: pointer; }
.practice-library-tabs button:hover { border-color: #53636e; color: #e1ecea; }
.practice-library-tabs button.active { border-color: rgba(114, 214, 178, .55); color: #dff9ee; background: rgba(114, 214, 178, .12); }
.practice-library-tabs button:focus-visible { outline: 2px solid #d5fff0; outline-offset: 2px; }
.create-tab-button {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(114, 214, 178, .75);
    border-radius: 13px;
    color: #10211c;
    background: linear-gradient(145deg, #91e5c7, var(--mint));
    box-shadow: 0 5px 16px rgba(73, 193, 151, .2), inset 0 1px 0 rgba(255, 255, 255, .35);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.create-tab-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.create-tab-button:hover { transform: translateY(-2px); filter: brightness(1.05); box-shadow: 0 8px 20px rgba(73, 193, 151, .3); }
.create-tab-button:focus-visible { outline: 2px solid #d5fff0; outline-offset: 3px; }
.import-tab-button { position: relative; }
.import-tab-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.tab-json-importer { display: contents; }
.tab-midi-importer { display: contents; }
.midi-track-picker { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.midi-track-picker label { display: grid; gap: 5px; color: #a9b8bf; font-size: 11px; font-weight: 600; }
.midi-track-picker select { min-height: 38px; max-width: min(320px, 60vw); padding: 0 30px 0 11px; border: 1px solid #3b4c55; border-radius: 9px; color: #e1ecea; background: rgba(13, 21, 27, .72); }
.midi-track-picker select:focus-visible { outline: none; border-color: var(--mint); box-shadow: 0 0 0 3px rgba(114, 214, 178, .12); }
.score-edit-action { display: flex; justify-content: flex-end; margin: 0 0 4px; }
.editor-title {
    width: min(100%, 620px);
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #e8edf2;
    background: #18222c;
    font: inherit;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 700;
    letter-spacing: -.05em;
}
.score-editor {
    position: relative;
    flex: 0 0 auto;
    min-width: 0;
    margin: 0 0 7px;
    padding: 8px 14px 7px;
    overflow: hidden;
    border: 1px solid rgba(114, 214, 178, .24);
    border-radius: 14px;
    background:
        radial-gradient(ellipse at 0% 0%, rgba(114, 214, 178, .12), transparent 55%),
        linear-gradient(135deg, rgba(28, 42, 48, .96), rgba(20, 29, 37, .96));
    box-shadow: 0 12px 30px rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255, 255, 255, .035);
}
.score-editor::before { position: absolute; inset: 0 auto 0 0; width: 3px; content: ""; background: linear-gradient(180deg, #91e5c7, rgba(114, 214, 178, .16)); }
.score-editor-heading { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #e6f0ed; font-size: 14px; }
.editor-heading-copy { display: grid; gap: 3px; }
.editor-heading-actions { display: flex; align-items: center; gap: 8px; }
.editor-history-button {
    width: 32px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid #35424c;
    border-radius: 7px;
    color: #cde8dc;
    background: #202c36;
    cursor: pointer;
}
.editor-history-button:hover:not(:disabled) { border-color: var(--mint); background: #293943; }
.editor-history-button:focus-visible { outline: 2px solid #d5fff0; outline-offset: 2px; }
.editor-history-button:disabled { opacity: .38; cursor: default; }
.editor-history-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.editor-exit-button { min-height: 30px; padding: 0 10px; border: 1px solid rgba(114, 214, 178, .36); border-radius: 7px; color: #bcebd7; background: rgba(114, 214, 178, .08); font-size: 12px; cursor: pointer; }
.editor-exit-button:hover { border-color: var(--mint); background: rgba(114, 214, 178, .14); }
.editor-kicker { color: var(--mint); font: 10px Consolas, monospace; letter-spacing: .14em; }
.editor-collapse-button { width: 32px; height: 30px; padding: 0; display: inline-grid; place-items: center; border: 1px solid #35424c; border-radius: 7px; color: #dce4e9; background: #202c36; cursor: pointer; }
.editor-collapse-button:hover { background: #293943; border-color: #53636e; }
.editor-collapse-button svg { width: 17px; height: 17px; fill: none; stroke: var(--mint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.editor-collapse-button .chevron-up { transform: rotate(180deg); }
.editor-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding-top: 11px; }
.editor-tools .editor-field { display: grid; gap: 6px; color: #a9b8bf; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.editor-tools select { min-height: 38px; padding: 0 30px 0 11px; border: 1px solid #3b4c55; border-radius: 9px; color: #e1ecea; background: rgba(13, 21, 27, .72); transition: border-color .16s ease, box-shadow .16s ease; }
.editor-tools select:focus-visible, .editor-tempo:focus-visible { outline: none; border-color: var(--mint); box-shadow: 0 0 0 3px rgba(114, 214, 178, .12); }
.editor-tools select option { color: #e8edf2; background: #18222c; }
.editor-tempo-control { display: flex; align-items: end; gap: 7px; }
.editor-tempo-control label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.editor-tempo { width: 88px; min-height: 38px; padding: 0 10px; border: 1px solid #3b4c55; border-radius: 9px; color: #e1ecea; background: rgba(13, 21, 27, .72); }
.editor-tempo::-webkit-inner-spin-button,
.editor-tempo::-webkit-outer-spin-button { opacity: 1; }
.editor-tools .editor-mode { display: inline-flex; align-items: center; gap: 7px; color: #a4b0ba; font-size: 12px; }
.editor-icon-toggle { width: 38px; height: 38px; flex: 0 0 38px; display: inline-grid; place-items: center; padding: 0; border: 1px solid rgba(114, 214, 178, .38); border-radius: 11px; color: var(--mint); background: rgba(114, 214, 178, .08); cursor: pointer; transition: color .15s ease, background .15s ease, border-color .15s ease, transform .15s ease; }
.editor-icon-toggle:hover { transform: translateY(-1px); border-color: var(--mint); background: #293943; }
.editor-icon-toggle.erase-active { color: #ffd2cc; border-color: rgba(255, 119, 105, .68); background: rgba(115, 47, 43, .48); }
.editor-icon-toggle.erase-active:hover { background: rgba(143, 57, 52, .58); }
.editor-icon-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.import-tab-icon-button { width: 42px; min-width: 42px; padding: 0; }
.import-tab-icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.import-tab-error { flex-basis: 100%; margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.editor-export-button { min-height: 38px; display: inline-flex; align-items: center; gap: 8px; border-radius: 9px; }
.editor-export-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.editor-hint { margin: 10px 0 0; color: #91a0ad; font-size: 12px; line-height: 1.5; }
.editor-hint strong { color: #c9d8d5; }
.editor-error { margin: 8px 0 0; color: #ffb3a9; font-size: 12px; }
.song-search { width: min(230px, 42vw); min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; color: #e8edf2; background: #18222c; outline: none; }
.song-search:focus { border-color: rgba(114, 214, 178, .65); }
.song-search::placeholder { color: #788792; }
.song-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.song-card { min-height: 94px; padding: 18px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(24, 34, 44, .75); transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.song-card:hover { transform: translateY(-2px); border-color: rgba(114, 214, 178, .55); background: #1b2932; }
.card-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; color: var(--mint); background: rgba(114, 214, 178, .1); font-size: 20px; }
.song-card-copy { display: grid; gap: 5px; flex: 1; min-width: 0; }
.practice-card .song-card-copy { min-width: 0; }
.practice-sticking { display: block; overflow: hidden; color: #8ed8ba; font: 11px Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.practice-instructions {
    max-width: none;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid rgba(145, 160, 173, .16);
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    color: #aebdc3;
    background: rgba(24, 34, 44, .72);
    font-size: 13px;
}
.song-shell .practice-song-heading + .tab-panel {
    border-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.practice-instructions-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.practice-instructions-heading > span { color: var(--mint); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.practice-instructions-details { display: grid; gap: 8px; padding: 8px 0 2px; }
.practice-instructions-details[hidden] { display: none; }
.practice-instructions-details p { margin: 0; }
.practice-instructions strong { color: #e1ecea; }
.practice-instructions-toggle { min-height: 30px; padding: 3px 8px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid #35424c; border-radius: 7px; color: #aebdc3; background: rgba(24, 34, 44, .72); font: inherit; font-size: 11px; cursor: pointer; }
.practice-instructions-toggle:hover { border-color: var(--mint); color: #e1ecea; }
.practice-instructions-toggle:focus-visible { outline: 2px solid #d5fff0; outline-offset: 2px; }
.practice-instructions-toggle svg { width: 15px; height: 15px; fill: none; stroke: var(--mint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.practice-instructions-toggle .chevron-up { transform: rotate(180deg); }
.practice-sticking-guide { display: grid; gap: 8px; margin: 2px 0; }
.sticking-sequence { display: grid; grid-auto-columns: minmax(31px, 1fr); grid-auto-flow: column; width: fit-content; max-width: 100%; overflow-x: auto; gap: 4px; padding: 2px 1px 5px; }
.sticking-step { min-width: 31px; min-height: 36px; display: grid; place-items: center; align-content: center; gap: 1px; border: 1px solid #35424c; border-radius: 6px; background: rgba(24, 34, 44, .72); font-family: Consolas, monospace; }
.sticking-step small { color: #788792; font-size: 8px; line-height: 1; }
.sticking-step b { font-size: 14px; line-height: 1; }
.sticking-step.right-hand b, .right-hand-key { color: #8ed8ba; }
.sticking-step.left-hand b, .left-hand-key { color: #f0bf7a; }
.sticking-step.both-hands b { color: #e1ecea; }
.sticking-step.no-hand b { color: #667580; }
.sticking-legend { display: flex; flex-wrap: wrap; gap: 5px 14px; color: #89999f; font-size: 11px; }
.sticking-legend > span { display: inline-flex; align-items: center; gap: 4px; }
.sticking-legend b { font: 700 11px Consolas, monospace; }
.hand-sticking { font: 700 11px Consolas, monospace; paint-order: stroke; stroke: #12181d; stroke-width: 2px; stroke-linejoin: round; }
.hand-sticking-r { fill: #8ed8ba; }
.hand-sticking-l { fill: #f0bf7a; }
.loop-button.active { border-color: rgba(114, 214, 178, .62); color: #dff9ee; background: rgba(114, 214, 178, .12); }
.loop-button:focus-visible { outline: 2px solid #d5fff0; outline-offset: 2px; }
.song-title { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.song-subtitle { color: var(--muted); font-size: 13px; }
.card-arrow { color: #81919e; font-size: 18px; }
.message-card { min-height: 84px; border: 1px solid var(--line); border-radius: 12px; padding: 25px; color: #abb6bf; background: rgba(24, 34, 44, .7); display: flex; align-items: center; gap: 12px; }
.error-card { color: #ffb3a9; border-color: rgba(255, 119, 105, .28); }
.loader { width: 17px; height: 17px; border: 2px solid #40505a; border-top-color: var(--mint); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer { padding: 20px 0 30px; border-top: 1px solid rgba(145, 160, 173, .13); color: #778793; font-size: 12px; }
.detail-topbar { justify-content: space-between; }
.back-link { color: #aeb9c2; font-size: 14px; transition: color .15s ease; }
.back-link:hover { color: var(--mint); }
.song-heading { padding: 56px 0 30px; }
.song-shell .song-heading { flex: 0 0 auto; padding: 7px 0 6px; }
.song-shell .practice-song-heading { padding-bottom: 0; }
.song-heading h1 { font-size: clamp(36px, 5vw, 56px); }
.song-shell .song-heading h1 { font-size: clamp(28px, 4vw, 42px); }
.song-metadata { display: flex; gap: 10px; margin-top: 17px; font: 11px Consolas, monospace; letter-spacing: .08em; color: var(--muted); }
.song-metadata span { border: 1px solid var(--line); border-radius: 20px; padding: 7px 10px; }
.audio-file-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 1 1 260px;
    min-width: 0;
    color: #dce4e9;
    font-size: 13px;
}
.audio-file-option span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.audio-file-option input {
    width: 130px;
    min-width: 0;
    color: var(--muted);
    font-size: 0;
}
.audio-file-option input::file-selector-button {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid #35424c;
    border-radius: 7px;
    color: #dce4e9;
    background: #202c36;
    font: 12px "Segoe UI", system-ui, sans-serif;
    cursor: pointer;
}
.audio-local-note {
    color: var(--muted);
    font-size: 11px;
}
.audio-sync-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #a4b0ba;
    font-size: 12px;
}
.audio-sync-control output {
    min-width: 48px;
    color: #dce4e9;
    font: 11px Consolas, monospace;
    text-align: center;
}
.audio-sync-button {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid #35424c;
    border-radius: 6px;
    color: #dce4e9;
    background: #202c36;
    cursor: pointer;
}
.audio-sync-button:hover:not(:disabled) {
    border-color: #53636e;
    background: #293943;
}
.audio-sync-button:disabled {
    opacity: .48;
    cursor: not-allowed;
}
.player-panel, .tab-panel { border: 1px solid var(--line); border-radius: 14px; background: rgba(24, 34, 44, .82); }
.player-panel { padding: 18px 20px 12px; }
.transport { display: flex; flex-wrap: wrap; gap: 9px; }
.control-button { min-width: 91px; height: 39px; padding: 0 14px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; border: 1px solid #35424c; border-radius: 8px; color: #dce4e9; background: #202c36; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.control-button:hover:not(:disabled) { background: #293943; border-color: #53636e; }
.control-button.primary { color: #10211c; font-weight: 700; border-color: var(--mint); background: var(--mint); }
.control-button.primary:hover:not(:disabled) { background: #91e5c7; }
.control-button:disabled { opacity: .48; cursor: not-allowed; }
.progress-row { display: flex; align-items: center; gap: 14px; margin-top: 17px; }
.track-progress {
    appearance: none;
    width: 100%;
    height: 18px;
    margin: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.track-progress:disabled { cursor: not-allowed; opacity: .48; }
.track-progress::-webkit-slider-runnable-track {
    height: 5px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--mint) 0%, var(--mint) var(--progress), #34414b var(--progress), #34414b 100%);
}
.track-progress::-moz-range-track {
    height: 5px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--mint) 0%, var(--mint) var(--progress), #34414b var(--progress), #34414b 100%);
}
.track-progress::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -4.5px;
    border: 2px solid #10211c;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 3px rgba(114, 214, 178, .14);
}
.track-progress::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border: 2px solid #10211c;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 3px rgba(114, 214, 178, .14);
}
.playback-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 12px;
}
.playback-option, .subdivision-option, .speed-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #a4b0ba;
    font-size: 13px;
}
.midi-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #a4b0ba;
    font-size: 13px;
}
.subdivision-option select {
    min-height: 34px;
    padding: 0 28px 0 10px;
    border: 1px solid #35424c;
    border-radius: 7px;
    color: #dce4e9;
    background: #202c36;
}
.speed-option output { color: #dce4e9; font-variant-numeric: tabular-nums; }
.speed-slider {
    width: clamp(110px, 17vw, 180px);
    accent-color: var(--mint);
}
.playback-option input {
    width: 15px;
    height: 15px;
    accent-color: var(--mint);
}
.speed-select {
    min-height: 34px;
    padding: 0 28px 0 10px;
    border: 1px solid #35424c;
    border-radius: 7px;
    color: #dce4e9;
    background: #202c36;
}
.time-label { min-width: 42px; font: 11px Consolas, monospace; color: var(--muted); }
.playback-status { min-height: 16px; margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.tab-panel { margin: 20px 0 28px; overflow: hidden; }
.song-shell .tab-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    margin: 0 0 4px;
    overflow: visible;
}
.tab-panel-heading { align-items: center; margin: 0; padding: 19px 21px; border-bottom: 1px solid var(--line); }
.song-shell .tab-panel-heading { flex: 0 0 auto; padding: 6px 12px; }
.tab-legend { color: var(--muted); font-size: 12px; }
.score-heading-actions { display: flex; align-items: center; gap: 12px; }
.score-heading-icon-button {
    width: 36px;
    height: 36px;
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(114, 214, 178, .36);
    border-radius: 10px;
    color: #c9f3e3;
    background: rgba(114, 214, 178, .08);
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.score-heading-icon-button:hover { transform: translateY(-1px); border-color: var(--mint); background: rgba(114, 214, 178, .16); }
.score-heading-icon-button:focus-visible { outline: 2px solid #d5fff0; outline-offset: 3px; }
.score-heading-icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drum-kit-widget { position: relative; z-index: 8; flex: 0 0 auto; }
.drum-kit-trigger {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    border: 1px solid rgba(114, 214, 178, .36);
    border-radius: 10px;
    color: #c9f3e3;
    background: linear-gradient(145deg, rgba(114, 214, 178, .12), rgba(114, 214, 178, .045));
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.drum-kit-trigger:hover,
.drum-kit-trigger[aria-expanded="true"] {
    transform: translateY(-1px);
    border-color: rgba(114, 214, 178, .78);
    background: rgba(114, 214, 178, .15);
}
.drum-kit-trigger:focus-visible,
.drum-kit-close:focus-visible { outline: 2px solid #d5fff0; outline-offset: 3px; }
.drum-kit-trigger svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.drum-kit-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 12;
    width: min(360px, calc(100vw - 32px));
    padding: 13px 15px 11px;
    border: 1px solid rgba(114, 214, 178, .35);
    border-radius: 16px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(114, 214, 178, .12), transparent 60%),
        rgba(17, 26, 32, .98);
    box-shadow: 0 20px 55px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255, 255, 255, .035);
    backdrop-filter: blur(18px);
    animation: drum-kit-appear .16s ease-out both;
}
.drum-kit-popover-heading { display: flex; align-items: center; justify-content: space-between; color: #dce8e3; }
.drum-kit-popover-heading > div { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .03em; }
.drum-kit-live-indicator { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 11px rgba(114, 214, 178, .7); }
.drum-kit-close { width: 27px; height: 27px; border: 1px solid rgba(145, 160, 173, .2); border-radius: 8px; color: #c4cdd2; background: rgba(255, 255, 255, .035); font-size: 19px; line-height: 1; cursor: pointer; }
.drum-kit-close:hover { color: #fff; border-color: rgba(114, 214, 178, .5); }
.drum-kit-art { display: block; width: 100%; margin: 5px 0 0; overflow: visible; }
.drum-kit-stands { fill: none; stroke: #63747b; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drum-kit-part { color: #708088; fill: #26363d; stroke: #8a9aa0; stroke-width: 2; stroke-linejoin: round; cursor: pointer; transition: filter .12s ease, color .12s ease, fill .12s ease, stroke .12s ease; }
.drum-kit-part:focus-visible { filter: drop-shadow(0 0 5px rgba(213, 255, 240, .9)); outline: none; }
.drum-kit-part text, .drum-kit-labels text { fill: #98a7ab; stroke: none; font: 7px Consolas, monospace; letter-spacing: .08em; }
.drum-kit-cymbal { fill: #4a5750; stroke: #9caa85; }
.drum-kit-cymbal text { fill: #c1cca9; }
.drum-kit-crash { fill: #594b3d; stroke: #d3a976; }
.drum-kit-crash text { fill: #d9b786; }
.drum-kit-ride { fill: #3e4f55; stroke: #91b9bf; }
.drum-kit-ride text { fill: #acd0d1; }
.drum-kit-ride-bell { fill: #c0a76e; stroke: #f0d99d; stroke-width: 1.5; }
.drum-kit-other-cymbal { fill: #524257; stroke: #bc9bc4; }
.drum-kit-other-cymbal text { fill: #d7b8de; font-size: 6px; }
.drum-kit-hihat { color: #708088; }
.drum-kit-hihat-state { display: none; }
.drum-kit-hihat.is-closed .drum-kit-hihat-closed,
.drum-kit-hihat.is-open .drum-kit-hihat-open { display: initial; }
.drum-kit-hihat-closed { fill: #45574e; stroke: #93aa96; }
.drum-kit-hihat-open { fill: #506347; stroke: #bad17d; }
.drum-kit-pedal { fill: none; stroke: #93aa96; stroke-width: 1.7; }
.drum-kit-tom { fill: #343d46; stroke: #a0adb1; }
.drum-kit-snare { fill: #39414a; stroke: #c1b9a2; }
.drum-kit-kick { fill: #293943; stroke: #82a89c; }
.drum-kit-percussion { fill: #4b3b31; stroke: #b89a78; }
.drum-kit-part.is-active { color: #a7ffdb; fill: #78d6b3; stroke: #b2ffe2; filter: drop-shadow(0 0 7px rgba(114, 214, 178, .9)); }
.drum-kit-part.is-active text { fill: #eafff6; }
.drum-kit-part.is-active .drum-kit-ride-bell { fill: #f5e1a3; stroke: #fff4d1; }
.drum-kit-hint { margin: -4px 0 1px; color: #8fa19f; font-size: 11px; text-align: center; }
.drum-kit-error { margin: 6px 0 1px; color: #ffaaa0; font-size: 11px; text-align: center; }
@keyframes drum-kit-appear {
    from { opacity: 0; transform: translateY(-5px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.score-scroll {
    display: grid;
    gap: 12px;
    overflow-x: auto;
    padding: 6px 10px 8px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(22, 27, 32, 0.95), rgba(15, 19, 23, 0.92));
    border: 1px solid rgba(145, 160, 173, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}
.score-system-slot {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    min-width: 900px;
    aspect-ratio: 1120 / 216;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(28, 30, 32, .9), rgba(18, 24, 29, .95));
}
.score-system-slot.measures-per-system-1 { min-width: 0; }
.song-shell .score-system-slot { min-height: 270px; aspect-ratio: 1120 / 270; }
.drum-score { width: 100%; height: 100%; min-width: 0; }
.song-shell .score-scroll {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}
.drum-score {
    display: block;
    width: 100%;
    min-width: 0;
    height: 100%;
    border-radius: 12px;
    background: #1c1e20;
    box-shadow: 0 10px 24px rgba(1, 3, 5, 0.18);
}
.song-shell .drum-score {
    flex: 0 0 auto;
}
.drum-score.measures-per-system-1 {
    min-width: 0;
}
.score-system-slot.measures-per-system-1 .drum-score { min-width: 0; }
.score-paper {
    fill: #12181d;
    stroke: rgba(165, 179, 188, 0.18);
    stroke-width: 1;
}
.staff-line, .bar-line {
    stroke: rgba(214, 220, 224, 0.68);
    stroke-width: 1;
}
.bar-line {
    stroke: rgba(166, 176, 183, 0.9);
    stroke-width: 1.3;
}
.system-number, .measure-number, .section-marker, .time-signature {
    fill: #edf2f5;
    font-family: "Segoe UI", sans-serif;
}
.system-number { font-size: 11px; }
.measure-number { font-size: 10px; font-weight: 700; }
.section-marker { font-size: 10px; font-weight: 700; }
.time-signature { font-size: 13px; font-weight: 700; }
.playhead-line {
    stroke: rgba(114, 214, 178, 0.95);
    stroke-width: 2;
    stroke-linecap: round;
    filter: drop-shadow(0 0 10px rgba(114, 214, 178, 0.45));
}
.playhead-glow {
    fill: rgba(114, 214, 178, 0.14);
    stroke: rgba(114, 214, 178, 0.46);
    stroke-width: 1;
}
.measure-hit-area {
    fill: transparent;
    cursor: pointer;
    pointer-events: all;
}
.measure-hit-area:hover {
    fill: rgba(114, 214, 178, 0.035);
}
.measure-hit-area:focus {
    outline: none;
    stroke: rgba(114, 214, 178, 0.8);
    stroke-width: 1;
}
.measure-edit-area { cursor: crosshair; }
.measure-edit-area:hover { fill: rgba(114, 214, 178, .12); }
.measure-edit-area.erase-mode { cursor: not-allowed; }
.measure-edit-area.erase-mode:hover { fill: rgba(255, 119, 105, .12); }
.measure-add-control { cursor: pointer; }
.measure-add-control circle { fill: #202c36; stroke: var(--mint); stroke-width: 1.4; transition: fill .15s ease, stroke-width .15s ease; }
.measure-add-control path { fill: none; stroke: var(--mint); stroke-width: 1.5; stroke-linecap: round; pointer-events: none; }
.measure-add-control:hover circle, .measure-add-control:focus circle { fill: #315347; stroke-width: 2; }
.measure-add-control:focus { outline: none; }
.measure-add-control:focus circle { stroke: #d5fff0; }
.measure-menu-control, .measure-signature-adjust, .measure-remove-action { cursor: pointer; }
.measure-menu-control circle, .measure-signature-adjust circle {
    fill: #202c36;
    stroke: #6b837d;
    stroke-width: 1;
    transition: fill .15s ease, stroke .15s ease;
}
.measure-menu-control path {
    fill: none;
    stroke: #b7c8c3;
    stroke-width: 1.2;
    stroke-linecap: round;
    pointer-events: none;
}
.measure-menu-control:hover circle, .measure-menu-control:focus circle,
.measure-signature-adjust:hover circle, .measure-signature-adjust:focus circle {
    fill: #315347;
    stroke: var(--mint);
}
.measure-menu-control:focus, .measure-signature-adjust:focus { outline: none; }
.measure-menu-control:focus circle, .measure-signature-adjust:focus circle { stroke-width: 1.8; }
.measure-signature-menu { pointer-events: all; }
.measure-signature-menu > rect {
    fill: #172229;
    stroke: rgba(114, 214, 178, .65);
    stroke-width: 1;
    filter: drop-shadow(0 5px 9px rgba(0, 0, 0, .45));
}
.measure-signature-title {
    fill: var(--mint);
    font: 700 7px "Segoe UI", sans-serif;
    letter-spacing: .08em;
}
.measure-signature-label { fill: #a9b8bf; font: 8px "Segoe UI", sans-serif; }
.measure-signature-value {
    fill: #f0f7f4;
    font: 700 10px "Segoe UI", sans-serif;
    text-anchor: middle;
}
.measure-signature-adjust circle { stroke: rgba(114, 214, 178, .48); }
.measure-signature-adjust text {
    fill: #e6f0ed;
    font: 10px "Segoe UI", sans-serif;
    text-anchor: middle;
    pointer-events: none;
}
.measure-remove-action rect {
    fill: rgba(255, 119, 105, .12);
    stroke: rgba(255, 119, 105, .55);
    stroke-width: 1;
}
.measure-remove-action path {
    fill: none;
    stroke: #ff9a8f;
    stroke-width: 1.2;
    stroke-linecap: round;
    pointer-events: none;
}
.measure-remove-action text {
    fill: #ffc0b8;
    font: 700 8px "Segoe UI", sans-serif;
    pointer-events: none;
}
.measure-remove-action:hover rect, .measure-remove-action:focus rect {
    fill: rgba(255, 119, 105, .24);
    stroke: #ff9a8f;
}
.measure-remove-action:focus { outline: none; }
.measure-remove-action.disabled { cursor: not-allowed; opacity: .45; }
.note-hover-preview .note-preview-guide { stroke: rgba(114, 214, 178, .62); stroke-width: 1; stroke-dasharray: 3 3; }
.note-hover-preview .note-preview-head { fill: rgba(114, 214, 178, .36); stroke: #9af0d2; stroke-width: 1.5; }
.note-preview-label-bg { fill: #10211c; stroke: rgba(114, 214, 178, .7); stroke-width: .8; }
.note-preview-label { fill: #d8fff1; font-size: 9px; font-weight: 600; }
.note-head {
    fill: #f2f5f7;
    stroke: rgba(142, 154, 164, 0.15);
    stroke-width: 0.8;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.15));
}
.note-cross {
    fill: none;
    stroke: #f2f5f7;
    stroke-width: 1.9;
    stroke-linecap: round;
}
.coach-hit {
    fill: #54d89c !important;
    stroke: #54d89c !important;
    filter: drop-shadow(0 0 4px rgba(84, 216, 156, .72));
}
.coach-missed {
    fill: #f2c94c !important;
    stroke: #f2c94c !important;
    filter: drop-shadow(0 0 4px rgba(242, 201, 76, .65));
}
.coach-played-marker circle {
    fill: rgba(242, 86, 91, .2);
    stroke: #ff686d;
    stroke-width: 1.8;
}
.coach-played-marker path {
    fill: none;
    stroke: #ff686d;
    stroke-width: 1.7;
    stroke-linecap: round;
}
.coach-played-marker title { pointer-events: none; }
.hi-hat-head {
    fill: rgba(242, 245, 247, 0.12);
    stroke: #f2f5f7;
    stroke-width: 1.8;
}
.open-hi-hat-head { fill: none; }
.open-hi-hat-mark {
    fill: #12181d;
    stroke: #f2f5f7;
    stroke-width: 1.3;
}
.hi-hat-slash {
    stroke: #eaf0f4;
    stroke-width: 1.7;
    stroke-linecap: round;
}
.note-stem {
    stroke: rgba(220, 227, 232, 0.9);
    stroke-width: 1.4;
}
.rhythm-beam {
    stroke: rgba(220, 227, 232, 0.9);
    stroke-width: 4.5;
    stroke-linecap: square;
}
.grace-note-head { fill: #edf3f5; }
.grace-note-stem, .grace-note-flag, .grace-note-slash {
    fill: none;
    stroke: #edf3f5;
    stroke-width: 1.2;
    stroke-linecap: round;
}
.dynamic-mark {
    fill: #d7dfe5;
    font: italic 600 15px Georgia, serif;
}
.note-dot { fill: #eef2f5; stroke: none; }
.accent-mark {
    fill: none;
    stroke: #eef2f5;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.ghost-parentheses {
    fill: none;
    stroke: rgba(205, 214, 220, 0.88);
    stroke-width: 1.7;
    stroke-linecap: round;
}
.detail-loading { margin-top: 80px; }
.player-dock {
    z-index: 15;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid rgba(145, 160, 173, .24);
    border-radius: 16px;
    background: rgba(24, 34, 44, .96);
    box-shadow: 0 -12px 34px rgba(0, 0, 0, .28);
    backdrop-filter: blur(18px);
}
.player-dock-summary {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 10px;
}
.dock-play { width: 42px; min-width: 42px; height: 42px; border-radius: 50%; }
.dock-track-info { display: grid; flex: 1; min-width: 0; gap: 3px; }
.dock-track-info strong { overflow: hidden; color: #e8edf2; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.dock-track-info .playback-status { min-height: 0; margin: 0; }
.dock-time { color: #c3cdd5; font: 12px Consolas, monospace; white-space: nowrap; }
.dock-toggle {
    width: 38px;
    height: 38px;
    border: 1px solid #35424c;
    border-radius: 10px;
    color: #dce4e9;
    background: #202c36;
    font-size: 21px;
    cursor: pointer;
}
.dock-toggle:hover { border-color: var(--mint); }
.player-dock-content { padding: 0 14px 12px; }
.player-dock-content .progress-row { margin-top: 10px; }
.player-dock-content .playback-options { margin-top: 8px; }
.coach-panel {
    display: grid;
    gap: 7px;
    margin: 12px 0 10px;
    padding: 11px 13px;
    border: 1px solid rgba(114, 214, 178, .2);
    border-radius: 10px;
    background: rgba(13, 26, 29, .72);
}
.coach-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.coach-heading > div { display: grid; gap: 3px; }
.coach-heading > .coach-heading-actions { display: flex; flex-direction: row; align-items: center; gap: 7px; flex-shrink: 0; }
.coach-mode-toggle { display: inline-flex; align-items: center; gap: 6px; color: #b7c5c6; font-size: 12px; white-space: nowrap; cursor: pointer; }
.coach-mode-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--mint); }
.coach-mode-toggle:has(input:disabled) { cursor: not-allowed; opacity: .65; }
.coach-collapse-button {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid #35424c;
    border-radius: 8px;
    color: #dce4e9;
    background: #202c36;
    cursor: pointer;
}
.coach-collapse-button:hover { border-color: var(--mint); }
.coach-collapse-button:focus-visible { outline: 2px solid #d5fff0; outline-offset: 2px; }
.coach-collapse-button svg { width: 17px; height: 17px; fill: none; stroke: var(--mint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.coach-collapse-button .chevron-up { transform: rotate(180deg); }
.coach-heading strong { color: #dff9ee; font-size: 13px; }
.coach-heading span, .coach-status, .coach-hint, .coach-tolerance {
    color: #9eadae;
    font-size: 12px;
}
.coach-panel .control-button { min-width: 0; height: 34px; font-size: 12px; }
.coach-range { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.coach-range-start { height: 34px !important; }
.coach-input { display: flex; align-items: center; gap: 9px; color: #a4b0ba; font-size: 12px; }
.coach-input select {
    min-width: 0;
    max-width: 100%;
    min-height: 32px;
    padding: 0 9px;
    border: 1px solid #35424c;
    border-radius: 7px;
    color: #dce4e9;
    background: #202c36;
}
.coach-status, .coach-hint, .coach-summary { margin: 0; }
.coach-summary { color: #83e0b7; font-size: 12px; font-weight: 600; }
.coach-tolerance { justify-self: end; font-size: 11px; }
.coach-sensitivity { display: grid; grid-template-columns: auto minmax(100px, 1fr) auto; align-items: center; gap: 10px; color: #a4b0ba; font-size: 12px; }
.coach-sensitivity input { width: 100%; accent-color: var(--mint); }
.coach-sensitivity output { min-width: 54px; color: #dff9ee; text-align: right; }
.record-button { border-color: #9c4545; color: #ffdede; }
.record-button > span { color: #ff7777; font-size: 17px; }
.record-button:hover:not(:disabled) { border-color: #ff7777; }
.record-button.recording-active { border-color: #ff7777; background: rgba(156, 69, 69, .28); }
.record-button.recording-active > span { color: #ff7777; }
.recording-status { margin: 8px 0 0; color: #ffb1b1; font-size: 12px; }
.dock-error { min-height: 0; }
.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
#blazor-error-ui { display: none; position: fixed; inset: auto 0 0; padding: 12px 20px; color: #30211f; background: #ffb3a9; z-index: 20; }
#blazor-error-ui .reload { text-decoration: underline; }
#blazor-error-ui .dismiss { float: right; border: 0; background: transparent; cursor: pointer; }

@media (max-width: 600px) {
    .shell { width: min(100% - 32px, 1120px); }
    .library-shell { width: calc(100% - 32px); }
    .library-shell > .hero { padding: 22px 0 16px; }
    .library-shell .hero h1 { font-size: clamp(32px, 9vw, 48px); }
    .library-shell .hero-copy { margin-top: 12px; font-size: 14px; }
    .library-shell .library-heading { align-items: flex-start; gap: 12px; flex-direction: column; }
    .library-shell .library-tools { width: 100%; flex-wrap: wrap; }
    .library-shell .song-search { flex: 1 1 150px; width: auto; }
    .song-shell { width: calc(100% - 20px); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
    .topbar { height: 68px; }
    .song-shell .topbar { height: 48px; }
    .topbar-note { font-size: 9px; }
    .hero { padding: 66px 0 52px; }
    .library-heading { align-items: center; }
    .tab-panel-heading { align-items: start; gap: 12px; flex-direction: column; }
    .song-heading { padding-top: 40px; }
    .song-shell .song-heading { padding: 6px 0 5px; }
    .song-shell .tab-panel-heading { padding: 6px 10px; }
    .song-shell .tab-legend { font-size: 10px; }
    .song-shell .tab-panel-heading { align-items: flex-start; gap: 10px; }
    .score-heading-actions { flex-direction: column-reverse; align-items: flex-end; gap: 6px; }
    .song-shell .tab-legend { max-width: 180px; text-align: right; }
    .song-shell .score-scroll { padding: 10px 8px; }
    .song-shell .score-system-slot { min-height: 240px; aspect-ratio: auto; }
    .song-shell .score-system-slot.measures-per-system-1 { height: 195px; min-height: 195px; aspect-ratio: auto; }
    .song-shell .drum-score.measures-per-system-1 { height: 100%; }
    .player-dock-summary { gap: 8px; padding: 8px; }
    .player-dock-content { padding: 0 10px 10px; }
    .player-dock-content .transport { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
    .player-dock-content .control-button { min-width: 0; padding: 0 6px; font-size: 12px; }
    .player-dock-content .playback-options { justify-content: flex-start; gap: 10px 14px; }
    .player-dock-content .speed-option { width: 100%; justify-content: space-between; }
    .player-dock-content .speed-slider { flex: 1; }
    .audio-file-option { width: 100%; flex-basis: 100%; justify-content: space-between; }
    .audio-file-option input { width: 130px; }
    .audio-local-note { width: 100%; }
}

@media (max-height: 700px) {
    .library-shell > .hero { padding-top: 20px; padding-bottom: 14px; }
    .library-shell .hero h1 { font-size: clamp(30px, 4vw, 44px); }
    .library-shell .hero-copy { margin-top: 12px; font-size: 14px; }
    .song-shell {
        overflow-x: hidden;
        overflow-y: auto;
    }
}
