:root {
    color-scheme: dark;
    --bg: #101316;
    --panel: #f9f2e7;
    --panel-2: #fffaf1;
    --ink: #191817;
    --muted: #6f655b;
    --line: #d6c5ae;
    --dark: #14191f;
    --dark-2: #20262d;
    --dark-3: #2b333c;
    --text: #f7fbff;
    --accent: #2aa889;
    --accent-2: #e0a72f;
    --danger: #cf4d4d;
    --blue: #6fa8dc;
    --shadow: rgba(16, 19, 22, .18);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(42, 168, 137, .18), transparent 340px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 76px),
        var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, sans-serif;
    overflow-x: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
    color: inherit;
}

.page {
    width: calc(100vw - 24px);
    max-width: 1460px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 22px 0 32px;
}

.topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

h1 {
    margin: 0 0 6px;
    font-size: clamp(2rem, 4.5vw, 4.2rem);
    line-height: .95;
    letter-spacing: 0;
}

p {
    margin: 0;
    color: #bfd0cb;
    line-height: 1.7;
    max-width: 780px;
}

.status {
    min-width: min(360px, 100%);
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    background: rgba(20, 25, 31, .9);
    color: #dcece8;
    font-size: .94rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 14px;
    align-items: start;
}

.app>*,
.surface,
.staff-scroll,
.piano-scroll {
    min-width: 0;
}

.surface {
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    background: rgba(20, 25, 31, .88);
    box-shadow: 0 24px 52px rgba(0, 0, 0, .25);
    overflow: hidden;
}

.staff-panel {
    background: var(--panel);
    color: var(--ink);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 250, 241, .82);
}

.panel-head h2,
.tools h2,
.piano-head h2 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0;
}

.metric-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: .9rem;
}

.metric {
    padding: 6px 9px;
    border: 1px solid rgba(44, 35, 24, .12);
    border-radius: 999px;
    background: #fffdf8;
    white-space: nowrap;
}

.staff-scroll {
    overflow: auto;
    background:
        linear-gradient(90deg, rgba(214, 197, 174, .38) 1px, transparent 1px) 0 0 / 96px 100%,
        var(--panel);
}

.score-stage {
    position: relative;
    width: max(100%, calc(var(--slot-count, 16) * var(--slot-width, 68px) + 128px));
    min-height: 650px;
    padding: 34px 32px 64px 76px;
}

.staff {
    position: relative;
    height: 520px;
    outline: none;
}

.staff:focus-visible {
    box-shadow: 0 0 0 3px rgba(42, 168, 137, .42);
    border-radius: 8px;
}

.score-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(44, 35, 24, .12);
    background: #fff8ec;
}

.score-controls label {
    color: var(--muted);
}

.score-controls .field {
    margin-top: 0;
}

.context-bar {
    display: grid;
    grid-template-columns: minmax(160px, .8fr) minmax(0, 1.4fr);
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(44, 35, 24, .13);
    background: #f4eadb;
}

.context-bar[hidden] {
    display: none;
}

.context-summary {
    color: var(--ink);
    font-weight: 800;
    line-height: 1.35;
}

.context-controls {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(116px, 1fr) auto auto auto;
    gap: 8px;
    align-items: center;
}

.context-controls .text-btn {
    min-height: 36px;
}
}

.staff-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--ink);
    opacity: .85;
}

.ledger-line {
    position: absolute;
    width: 34px;
    height: 2px;
    background: var(--ink);
    transform: translateX(-50%);
    pointer-events: none;
    opacity: .82;
}

.clef {
    position: absolute;
    left: -54px;
    color: var(--ink);
    font-family: Georgia, serif;
    font-size: 6.8rem;
    line-height: 1;
    pointer-events: none;
}

.clef.treble {
    top: 50px;
}

.clef.bass {
    left: -49px;
    top: 278px;
    font-size: 5.1rem;
}

.grand-bar {
    position: absolute;
    left: 0;
    top: 20px;
    width: 4px;
    height: 430px;
    background: var(--ink);
    pointer-events: none;
}

.measure-line {
    position: absolute;
    top: 20px;
    width: 1px;
    height: 430px;
    background: rgba(25, 24, 23, .42);
}

.slot-hit {
    position: absolute;
    top: 0;
    height: 500px;
    border-radius: 8px;
    transform: translateX(-50%);
    border: 1px dashed transparent;
    background: transparent;
    transition: background .14s ease, border-color .14s ease;
}

.slot-hit:hover {
    background: rgba(42, 168, 137, .08);
    border-color: rgba(42, 168, 137, .34);
}

.slot-hit.selected {
    background: rgba(224, 167, 47, .15);
    border-color: rgba(224, 167, 47, .75);
}

.slot-hit.playing {
    background: rgba(111, 168, 220, .16);
    border-color: rgba(111, 168, 220, .72);
}

.playhead {
    position: absolute;
    top: 0;
    width: 3px;
    height: 506px;
    border-radius: 999px;
    background: var(--blue);
    box-shadow: 0 0 0 4px rgba(111, 168, 220, .18);
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
}

.playhead.active {
    opacity: 1;
}

.loop-marker {
    position: absolute;
    top: -18px;
    min-width: 44px;
    transform: translateX(-50%);
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(42, 168, 137, .96);
    color: #061512;
    font-size: .68rem;
    font-weight: 900;
    text-align: center;
    pointer-events: none;
    z-index: 5;
}

.loop-marker.end {
    background: rgba(224, 167, 47, .96);
}

.loop-range {
    position: absolute;
    top: -7px;
    height: 7px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(42, 168, 137, .28), rgba(224, 167, 47, .28));
    pointer-events: none;
}

.note-item {
    position: absolute;
    width: 42px;
    height: 38px;
    transform: translate(-50%, -50%);
    color: var(--ink);
    z-index: 4;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid transparent;
    appearance: none;
    padding: 0;
    background: transparent;
    touch-action: none;
}

.note-item.selected {
    border-color: rgba(224, 167, 47, .82);
    background: rgba(224, 167, 47, .16);
}

.note-item.multi-selected {
    border-color: rgba(42, 168, 137, .95);
    background: rgba(42, 168, 137, .16);
}

.note-item.dragging {
    cursor: grabbing;
    opacity: .82;
}

.note-item.playing {
    border-color: rgba(111, 168, 220, .95);
    background: rgba(111, 168, 220, .2);
}

.notehead {
    position: absolute;
    left: 7px;
    top: 8px;
    width: 25px;
    height: 18px;
    border: 3px solid var(--ink);
    border-radius: 50%;
    transform: rotate(-18deg);
    background: var(--panel);
}

.notehead.filled {
    background: var(--ink);
}

.stem {
    position: absolute;
    width: 3px;
    height: 54px;
    background: var(--ink);
    right: 9px;
    top: -36px;
    border-radius: 2px;
}

.stem.down {
    right: auto;
    left: 9px;
    top: 18px;
    height: 54px;
}

.flag {
    position: absolute;
    width: 18px;
    height: 16px;
    left: 0px;
    border-top: 3px solid var(--ink);
    border-radius: 0 12px 0 0;
    transform: skewY(24deg);
}

.stem.down .flag {
    right: auto;
    left: -6px;
    border-top: 0;
    border-bottom: 3px solid var(--ink);
    border-radius: 0 0 0 12px;
    transform: skewY(24deg);
}

.flag.f1 {
    top: 3px;
}

.flag.f2 {
    top: 13px;
}

.flag.f3 {
    top: 23px;
}

.flag.f4 {
    top: 33px;
}

.stem.down .flag.f1 {
    top: 34px;
}

.stem.down .flag.f2 {
    top: 24px;
}

.stem.down .flag.f3 {
    top: 14px;
}

.stem.down .flag.f4 {
    top: 4px;
}

.dot {
    position: absolute;
    right: -7px;
    top: 14px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ink);
}

.accidental-symbol {
    position: absolute;
    left: -11px;
    top: 2px;
    min-width: 10px;
    text-align: center;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

.tuplet-label {
    position: absolute;
    left: 50%;
    top: -22px;
    transform: translateX(-50%);
    min-width: 18px;
    padding: 1px 4px;
    border: 1px solid rgba(25, 24, 23, .25);
    border-radius: 999px;
    background: var(--panel);
    color: var(--ink);
    font-size: .68rem;
    font-weight: 900;
}

.tie-arc {
    position: absolute;
    left: 25px;
    top: 18px;
    width: 48px;
    height: 18px;
    border-bottom: 2px solid var(--ink);
    border-radius: 0 0 48px 48px;
    pointer-events: none;
}

.rest-symbol {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    line-height: 1;
    transform: translateY(-2px);
}

.notation-fallback {
    min-width: 28px;
    min-height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 6px;
    background: rgba(255, 255, 255, .1);
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: .78rem;
    line-height: 1;
}

.rest-fallback {
    min-width: 54px;
    padding: 4px 6px;
    border: 2px solid var(--ink);
    border-radius: 6px;
    color: var(--ink);
    font-size: .66rem;
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
}

.text-notation .duration-btn strong {
    font-size: .78rem;
}

.note-label {
    position: absolute;
    top: 34px;
    min-width: 44px;
    text-align: center;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}

.slot-marker {
    position: absolute;
    top: 472px;
    min-width: 46px;
    transform: translateX(-50%);
    color: var(--muted);
    font-size: .72rem;
    text-align: center;
    user-select: none;
}

.marker-button {
    position: absolute;
    top: 500px;
    width: 34px;
    height: 28px;
    transform: translateX(-50%);
    border-radius: 7px;
    border: 1px solid rgba(25, 24, 23, .16);
    background: #fffdf8;
    color: var(--ink);
    font-weight: 800;
    display: grid;
    place-items: center;
}

.marker-button.active {
    background: var(--accent-2);
    border-color: #b47b11;
    color: #17110b;
}

.marker-button:focus-visible,
.slot-hit:focus-visible,
.note-item:focus-visible,
.duration-btn:focus-visible,
.text-btn:focus-visible,
.icon-btn:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(42, 168, 137, .65);
    outline-offset: 2px;
}

.tools {
    display: grid;
    gap: 12px;
    padding: 14px;
    background: rgba(20, 25, 31, .94);
}

.tool-section {
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 8px;
    background: rgba(32, 38, 45, .72);
    padding: 12px;
}

.tool-section h3 {
    margin: 0 0 10px;
    font-size: .9rem;
    color: #e7f1ef;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.icon-btn,
.text-btn {
    min-height: 38px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: var(--dark-2);
    color: var(--text);
    font-weight: 800;
    display: inline-grid;
    place-items: center;
    transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.icon-btn {
    width: 40px;
    font-size: 1.05rem;
}

.text-btn {
    padding: 0 12px;
    gap: 8px;
    grid-auto-flow: column;
    white-space: nowrap;
}

.icon-btn:hover,
.text-btn:hover {
    transform: translateY(-1px);
    background: var(--dark-3);
    border-color: rgba(255, 255, 255, .22);
}

.icon-btn.active,
.text-btn.active {
    background: var(--accent);
    color: #061512;
    border-color: rgba(255, 255, 255, .3);
}

.text-btn.primary {
    background: linear-gradient(135deg, var(--accent), #59d2b5);
    color: #061512;
    border-color: transparent;
}

.text-btn.warn {
    background: #44272a;
    color: #ffdede;
    border-color: rgba(207, 77, 77, .35);
}

.text-btn:disabled,
.icon-btn:disabled {
    opacity: .48;
    cursor: not-allowed;
    transform: none;
}

.field {
    display: grid;
    gap: 7px;
    margin-top: 10px;
}

label {
    color: #cedbd8;
    font-size: .82rem;
    font-weight: 800;
}

select,
input[type="number"],
input[type="text"],
input[type="date"],
input[type="range"] {
    width: 100%;
}

select,
input[type="number"],
input[type="text"],
input[type="date"],
textarea {
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    padding: 10px 11px;
    background: #0f1419;
    color: var(--text);
}

textarea {
    width: 100%;
    min-height: 84px;
    resize: vertical;
    line-height: 1.45;
}

input[type="range"] {
    accent-color: var(--accent);
}

.tempo-line {
    display: grid;
    grid-template-columns: 1fr 78px;
    gap: 8px;
    align-items: center;
}

.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.duration-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
}

.duration-btn {
    min-height: 44px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: #151b21;
    color: #f6fbff;
    display: grid;
    place-items: center;
    gap: 2px;
}

.duration-btn strong {
    font-size: 1.15rem;
    line-height: 1;
}

.duration-btn span {
    font-size: .68rem;
    color: #b9c8c4;
}

.duration-btn.active {
    background: rgba(42, 168, 137, .95);
    border-color: rgba(255, 255, 255, .24);
    color: #061512;
}

.duration-btn.active span {
    color: #12332b;
}

.small-note {
    margin-top: 8px;
    color: #aebdb9;
    font-size: .8rem;
    line-height: 1.5;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.check-option {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    background: #151b21;
    color: #f6fbff;
}

.check-option input {
    accent-color: var(--accent);
}

.field input[type="range"] {
    min-height: 30px;
}

.file-input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.export-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
    margin-top: 10px;
}

.export-grid .text-btn {
    padding: 0 8px;
}

.piano-panel {
    margin-top: 14px;
    background: rgba(20, 25, 31, .92);
}

.piano-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.piano-controls {
    display: grid;
    grid-template-columns: auto minmax(240px, 1fr) minmax(220px, 1fr) 170px;
    gap: 10px;
    align-items: end;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    background: rgba(17, 23, 29, .72);
}

.piano-controls .field,
.piano-controls .check-option {
    margin-top: 0;
}

.active-notes {
    min-height: 28px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.active-chip {
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(111, 168, 220, .18);
    border: 1px solid rgba(111, 168, 220, .28);
    color: #dbeeff;
    font-size: .78rem;
    font-weight: 800;
}

.active-chip.practice-chip {
    background: rgba(224, 167, 47, .2);
    border-color: rgba(224, 167, 47, .34);
    color: #ffe8ad;
}

.piano-scroll {
    overflow: auto;
    padding: 14px;
}

.piano {
    position: relative;
    height: 216px;
    min-width: 1260px;
    user-select: none;
    padding-bottom: 20px;
}

.white-keys {
    position: absolute;
    inset: 0 0 0 0;
    display: flex;
    gap: 2px;
    height: 196px;
}

.white-key {
    position: relative;
    flex: 0 0 34px;
    border: 1px solid #aeb5bd;
    border-radius: 0 0 6px 6px;
    background: linear-gradient(180deg, #fffdf7, #e6edf2);
    color: #1b2026;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-direction: column;
    padding-bottom: 8px;
    font-size: .72rem;
    font-weight: 800;
    transition: background .09s ease, transform .09s ease, box-shadow .09s ease;
}

.white-key.active,
.white-key.preview {
    background: linear-gradient(180deg, #9be6d5, #34b896);
    box-shadow: 0 0 0 2px rgba(52, 184, 150, .28) inset;
    transform: translateY(2px);
}

.white-key.practice {
    background: linear-gradient(180deg, #ffe9a6, #e0a72f);
    box-shadow: 0 0 0 2px rgba(224, 167, 47, .35) inset;
}

.white-key.record-target {
    outline: 2px solid rgba(42, 168, 137, .62);
    outline-offset: -4px;
}

.white-key.active,
.white-key.preview {
    background: linear-gradient(180deg, #9be6d5, #34b896);
    box-shadow: 0 0 0 2px rgba(52, 184, 150, .28) inset;
    transform: translateY(2px);
}

.black-key {
    position: absolute;
    top: 0;
    width: 22px;
    height: 124px;
    border: 1px solid #050606;
    border-radius: 0 0 5px 5px;
    background: linear-gradient(180deg, #31383f, #07090b);
    color: #eff8ff;
    z-index: 3;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-direction: column;
    padding-bottom: 7px;
    font-size: .58rem;
    font-weight: 800;
    transition: background .09s ease, transform .09s ease, box-shadow .09s ease;
}

.black-key.active,
.black-key.preview {
    background: linear-gradient(180deg, #6fa8dc, #1d6fa8);
    box-shadow: 0 0 0 2px rgba(111, 168, 220, .28) inset;
    transform: translateY(2px);
}

.black-key.practice {
    background: linear-gradient(180deg, #ffd877, #a36e06);
    box-shadow: 0 0 0 2px rgba(224, 167, 47, .35) inset;
}

.black-key.active,
.black-key.preview {
    background: linear-gradient(180deg, #6fa8dc, #1d6fa8);
    box-shadow: 0 0 0 2px rgba(111, 168, 220, .28) inset;
    transform: translateY(2px);
}

.key-label {
    line-height: 1;
    pointer-events: none;
}

.finger-label {
    min-width: 15px;
    min-height: 15px;
    display: grid;
    place-items: center;
    margin-bottom: 4px;
    border-radius: 999px;
    background: rgba(20, 25, 31, .85);
    color: #f7fbff;
    font-size: .58rem;
    line-height: 1;
    pointer-events: none;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%) translateY(16px);
    opacity: 0;
    pointer-events: none;
    padding: 11px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: #111820;
    color: #f5fffd;
    box-shadow: 0 18px 34px rgba(0, 0, 0, .28);
    transition: opacity .18s ease, transform .18s ease;
    z-index: 20;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(4, 8, 12, .68);
}

.modal-backdrop[hidden] {
    display: none;
}

.help-dialog {
    width: min(560px, 100%);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px;
    background: #172028;
    color: var(--text);
    box-shadow: 0 28px 70px rgba(0, 0, 0, .42);
    overflow: hidden;
}

.help-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.help-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.help-body {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.help-body p {
    color: #d8e5e2;
    max-width: none;
}

.compact-mode .page {
    padding-top: 12px;
}

.compact-mode h1 {
    font-size: clamp(1.9rem, 3.2vw, 2.8rem);
}

.compact-mode .tool-section,
.compact-mode .tools {
    padding: 10px;
}

.compact-mode .panel-head,
.compact-mode .piano-head,
.compact-mode .score-controls,
.compact-mode .context-bar {
    padding-block: 8px;
}

.compact-mode .score-stage {
    padding-top: 24px;
    min-height: 560px;
}

.compact-mode .note-label {
    font-size: .66rem;
}

.compact-mode .piano {
    height: 180px;
}

.compact-mode .white-keys {
    height: 164px;
}

.compact-mode .black-key {
    height: 106px;
}

@media (max-width: 1100px) {
    .app {
        grid-template-columns: 1fr;
    }

    .tools {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .piano-controls {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .page {
        width: calc(100vw - 16px);
        padding-top: 14px;
    }

    .topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .top-actions {
        margin-left: 0;
    }

    .status {
        min-width: 0;
    }

    .tools {
        grid-template-columns: 1fr;
    }

    .panel-head,
    .piano-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .score-stage {
        padding-left: 64px;
        padding-right: 20px;
        width: max(100%, calc(var(--slot-count, 16) * var(--slot-width, 58px) + 96px));
    }

    .score-controls,
    .context-bar,
    .context-controls {
        grid-template-columns: 1fr;
    }

    .duration-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .row,
    .tempo-line {
        grid-template-columns: 1fr;
    }

    .export-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .piano-controls {
        grid-template-columns: 1fr;
    }

    .piano {
        min-width: 1120px;
    }

    .white-key {
        flex-basis: 30px;
    }

    .black-key {
        width: 20px;
    }
}
