:root {
    font-family: system-ui, -apple-system, sans-serif;
    color-scheme: dark;
    color: #f2eef8;
    background: #17151f;
    font-synthesis: none;
    --accent: #bba5f5;
    --green: #dcf484;
    --muted: #b5afc3;
    --border: #514a63;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, select { font: inherit; }
button, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.instrument {
    width: min(100%, 640px);
    margin: 0 auto;
    padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
.app-header, .intro, .section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.eyebrow { font-size: .65rem; letter-spacing: .18em; font-weight: 700; margin: 0 0 4px; }
h1 { font-size: 2rem; letter-spacing: -.08em; margin: 0; }
h1 span { color: var(--accent); }
.sound-badge {
    font: bold .75rem ui-monospace, monospace;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
}
.sound-badge span { color: var(--green); }
.intro { margin: 24px 0; justify-content: flex-end; }
.key-selector { font-size: .75rem; display: flex; align-items: center; gap: 8px; }
select {
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: #2c2837;
    color: #f2eef8;
}
h2 { font-size: 1rem; margin: 0; }
.section-heading { margin-bottom: 12px; }
.volume-control { display: flex; align-items: center; gap: 6px; font-size: .7rem; color: var(--muted); }
.volume-control input { width: 96px; min-height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.volume-control output { min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums; }
.octave-setting { display: flex; justify-content: flex-end; margin: -12px 0 8px; }
.melody-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-bottom: 8px; }
.pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--border);
    border-bottom: 5px solid var(--border);
    border-radius: 8px;
    padding: 18px 2px 10px;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    min-width: 44px;
    min-height: 88px;
}
.melody-pad { background: #302c3c; color: #f2eef8; }
.low-note { background: #203c36; border-color: #426b60; }
.high-note { background: #3a2d50; border-color: #665184; }
.note-name { font-weight: 750; font-size: 1.1rem; }
.pad-detail { font-size: .6rem; letter-spacing: .08em; }
.pad.is-playing {
    background: var(--green);
    color: #253109;
    border-color: #a9c45b;
    box-shadow: inset 0 2px 4px #25310918;
}
.pad:disabled { opacity: .45; cursor: wait; }
.chords { margin-top: 24px; }
.looper { margin-bottom: 24px; }
.loop-actions { display: flex; gap: 8px; }
.control-button { min-height: 44px; min-width: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: #302c3c; color: #f2eef8; cursor: pointer; }
.control-button:disabled { opacity: .45; cursor: default; }
.control-button.recording { background: #482426; border-color: #ed9a98; }
.loop-card { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px; margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; font-size: .8rem; }
.loop-card small { color: var(--muted); }
.loop-card .volume-control input { width: 80px; }
.loop-message, .recording-status { font-size: .8rem; color: #ffd4d0; }
.recording-status { color: var(--muted); }
.drums { margin-top: 24px; }
.drum-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.drum-pad { background: #46362c; border-color: #7f624b; color: #f2eef8; justify-content: center; }
.chord-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chord-pad { background: #332d43; border-color: #5a4d72; color: #f2eef8; min-height: 78px; padding-top: 14px; }
.audio-error { padding: 12px; background: #482426; color: #ffd4d0; border-radius: 8px; font-size: .85rem; }
[hidden] { display: none !important; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; width: 100%; padding: 16px; background: #482426; color: #ffd4d0; z-index: 10; }
#blazor-error-ui a { color: inherit; }
#blazor-error-ui .dismiss { position: absolute; right: 16px; cursor: pointer; }
.loading { text-align: center; padding: 25vh 20px 0; }
.loading h1 { margin-bottom: 12px; }
.loading-progress { width: 160px; height: 6px; margin: 24px auto; background: #3a324d; border-radius: 3px; overflow: hidden; }
.loading-progress::after { content: ""; display: block; height: 100%; width: var(--blazor-load-percentage, 0%); background: var(--accent); }
@media (max-width: 359px) {
    .melody-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .intro { align-items: flex-start; }
}
@media (min-width: 600px) {
    .instrument { padding-top: 40px; }
    .pad { min-height: 112px; }
    .note-name { font-size: 1.4rem; }
}
