/* Riff Generator: a control deck of knobs, an amp head for the tone, the tab on a dark screen and a bottom bar.
   Everything is drawn with CSS and inline SVG (no images or web fonts), so the skin adds next to nothing to the app's
   size. Light: a white amp with a walnut faceplate. Dark: black tolex with a brushed-metal faceplate. */

:root {
    --stage: #efefec;
    --stage-glow: #ffffff;
    --deck: #fbfbfa;
    --ink: #1b1c1f;
    --muted: #6c6f77;
    --line: #dcdcd8;
    --control: #ececea;
    --control-hover: #e2e2df;
    --accent: #e8642c;
    --accent-ink: #ffffff;
    --led: #2fb4ff;
    --ring-track: #d7d7d3;
    --ring-fill: #1b1c1f;
    --cap-hi: #ffffff;
    --cap-lo: #d6d6d2;
    --cap-edge: #bdbdb8;
    --pointer: #1b1c1f;

    /* The amp: a white shell, a walnut faceplate with cream lettering and black knobs */
    --shell-hi: #fdfdfb;
    --shell-lo: #dfdfda;
    --shell-edge: #c4c4be;
    --shell-texture: none;
    --grille: #dcdcd6;
    --grille-line: rgba(0, 0, 0, 0.13);
    --tube-glass: rgba(0, 0, 0, 0.16);
    --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(0, 0, 0, 0.18)),
             repeating-linear-gradient(97deg, #5d331c 0 3px, #6e3e22 3px 9px, #57301a 9px 13px, #744325 13px 21px, #5a321b 21px 26px);
    --panel-ink: #f3e7d7;
    --panel-line: rgba(243, 231, 215, 0.35);
    --amp-cap-hi: #3d3d40;
    --amp-cap-lo: #0c0c0d;
    --amp-skirt: #1a1a1b;
    --amp-pointer: #f4f4f4;
    --logo: #6f6f69;
    --corner: linear-gradient(135deg, #dadad6, #8d8d88);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --stage: #0b0c0e;
        --stage-glow: #1a1c20;
        --deck: #131417;
        --ink: #e8e9eb;
        --muted: #8e929b;
        --line: #2a2c31;
        --control: #1e2024;
        --control-hover: #282b30;
        --accent: #ff8a3d;
        --accent-ink: #141518;
        --ring-track: #2c2f35;
        --ring-fill: #e8e9eb;
        --cap-hi: #44474e;
        --cap-lo: #16171a;
        --cap-edge: #0a0b0c;
        --pointer: #f4f4f4;

        --shell-hi: #232325;
        --shell-lo: #151516;
        --shell-edge: #2f2f32;
        --shell-texture: radial-gradient(rgba(255, 255, 255, 0.05) 0.8px, transparent 1.2px);
        --grille: #101011;
        --grille-line: rgba(255, 255, 255, 0.07);
        --tube-glass: rgba(255, 255, 255, 0.12);
        --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(0, 0, 0, 0.12)),
                 repeating-linear-gradient(90deg, #c9cbcf 0 1px, #d6d8db 1px 2px, #c3c5c9 2px 4px, #d2d4d7 4px 5px);
        --panel-ink: #1d1e21;
        --panel-line: rgba(29, 30, 33, 0.3);
        --amp-cap-hi: #fbfbfb;
        --amp-cap-lo: #a8aaaf;
        --amp-skirt: #1b1b1d;
        --amp-pointer: #121214;
        --logo: #d8d9db;
        --corner: linear-gradient(135deg, #8b8c90, #3b3c40);

        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --stage: #0b0c0e;
    --stage-glow: #1a1c20;
    --deck: #131417;
    --ink: #e8e9eb;
    --muted: #8e929b;
    --line: #2a2c31;
    --control: #1e2024;
    --control-hover: #282b30;
    --accent: #ff8a3d;
    --accent-ink: #141518;
    --ring-track: #2c2f35;
    --ring-fill: #e8e9eb;
    --cap-hi: #44474e;
    --cap-lo: #16171a;
    --cap-edge: #0a0b0c;
    --pointer: #f4f4f4;

    --shell-hi: #232325;
    --shell-lo: #151516;
    --shell-edge: #2f2f32;
    --shell-texture: radial-gradient(rgba(255, 255, 255, 0.05) 0.8px, transparent 1.2px);
    --grille: #101011;
    --grille-line: rgba(255, 255, 255, 0.07);
    --tube-glass: rgba(255, 255, 255, 0.12);
    --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(0, 0, 0, 0.12)),
             repeating-linear-gradient(90deg, #c9cbcf 0 1px, #d6d8db 1px 2px, #c3c5c9 2px 4px, #d2d4d7 4px 5px);
    --panel-ink: #1d1e21;
    --panel-line: rgba(29, 30, 33, 0.3);
    --amp-cap-hi: #fbfbfb;
    --amp-cap-lo: #a8aaaf;
    --amp-skirt: #1b1b1d;
    --amp-pointer: #121214;
    --logo: #d8d9db;
    --corner: linear-gradient(135deg, #8b8c90, #3b3c40);

    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--stage);
    color: var(--ink);
    font: 13px/1.4 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
}

#app { height: 100%; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.defs { position: absolute; width: 0; height: 0; }
.defs .cap-hi { stop-color: var(--cap-hi); }
.defs .cap-lo { stop-color: var(--cap-lo); }
.defs .amp-cap-hi { stop-color: var(--amp-cap-hi); }
.defs .amp-cap-lo { stop-color: var(--amp-cap-lo); }

/* Small spaced capitals, as printed on hardware */
.label, .knob-label {
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---- Layout ---- */

.app {
    height: 100%;
    overflow-x: clip;
    display: flex;
    flex-direction: column;
    background: radial-gradient(ellipse at 50% 38%, var(--stage-glow), var(--stage) 70%);
}

@media (max-height: 860px), (max-width: 900px) {
    .app { height: auto; min-height: 100%; }
    .screen { flex: none; }
    .tab-scroll { flex: none; height: 62vh; }
}

/* ---- Controls ---- */

button, select, input[type="text"] {
    font: inherit;
    color: var(--ink);
    background: var(--control);
    border: 1px solid var(--line);
    border-radius: 7px;
}

button { padding: 5px 12px; cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { background: var(--control-hover); }
button:disabled { opacity: 0.4; cursor: default; }
button.toggle[aria-pressed="true"] { background: var(--ink); color: var(--deck); border-color: var(--ink); }

select {
    appearance: none;
    height: 30px;
    min-width: 0;
    padding: 0 26px 0 10px;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: right 13px top 13px, right 9px top 13px;
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
    text-overflow: ellipsis;
    cursor: pointer;
}
select:disabled { opacity: 0.45; cursor: default; }

input[type="text"] { height: 30px; padding: 0 10px; min-width: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

svg { display: block; }
button.icon { padding: 0; width: 30px; height: 30px; display: grid; place-items: center; }
button.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
button.icon svg circle { fill: currentColor; stroke: none; }

/* ---- Knobs ---- */

.knob { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 72px; user-select: none; }
.knob-dial { width: 64px; height: 64px; cursor: ns-resize; touch-action: none; border-radius: 50%; }
.knob-dial svg { width: 100%; height: 100%; overflow: visible; }
.knob-value { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.knob.is-disabled { opacity: 0.4; }
.knob.is-disabled .knob-dial { cursor: default; }

.knob-ring .knob-track { fill: none; stroke: var(--ring-track); stroke-width: 4; stroke-linecap: round; }
.knob-ring .knob-fill { fill: none; stroke: var(--ring-fill); stroke-width: 4; stroke-linecap: round; }
.knob-ring .knob-cap { fill: url(#cap-ring); stroke: var(--cap-edge); stroke-width: 1; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.28)); }
.knob-ring .knob-pointer { stroke: var(--pointer); stroke-width: 3.2; stroke-linecap: round; }
.knob-ring .turning .knob-fill, .knob-ring .knob-dial:focus-visible .knob-fill { stroke: var(--accent); }

.knob-amp { min-width: 62px; gap: 6px; }
.knob-amp .knob-dial { width: 54px; height: 54px; }
.knob-amp .knob-label { color: var(--panel-ink); font-size: 10px; }
.knob-amp .knob-tick { fill: var(--panel-ink); opacity: 0.75; }
.knob-amp .knob-skirt { fill: var(--amp-skirt); filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45)); }
.knob-amp .knob-cap { fill: url(#cap-amp); }
.knob-amp .knob-pointer { stroke: var(--amp-pointer); stroke-width: 3.4; stroke-linecap: round; }

/* ---- Control deck ---- */

.deck {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px 28px;
    padding: 12px 24px 14px;
    background: var(--deck);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 6px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 1;
}

.brand { flex: 0 0 auto; min-width: 150px; }
.brand-name { font-size: 15px; font-weight: 300; letter-spacing: 0.32em; }
.brand-tag { font-size: 11px; color: var(--muted); margin-top: 2px; }
.brand-credit { font-size: 10px; font-style: italic; color: var(--muted); margin-top: 2px; opacity: 0.8; }

.deck-knobs { display: flex; gap: 14px; }
.deck .knob { min-width: 78px; }

.browser { flex: 1 1 420px; max-width: 620px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.browser-row { display: grid; grid-template-columns: 86px 26px minmax(0, 1fr) 26px; align-items: center; gap: 4px; }
.browser-row .arrow { padding: 0; height: 30px; border: none; background: transparent; font-size: 22px; line-height: 1; color: var(--muted); }
.browser-row .arrow:hover { color: var(--ink); background: transparent; }
.browser-row .custom-progression { grid-column: 2 / -1; min-width: 0; }
.screen-select {width: 100%; background-color: var(--control); font-weight: 600; text-align: center; text-align-last: center; }
.browser-grid { display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.5fr) minmax(0, 1.5fr) minmax(0, 0.8fr) minmax(0, 1fr); gap: 6px; }
.browser-grid label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.browser-grid .label { font-size: 9.5px; }
.browser-grid select { width: 100%; height: 26px; font-size: 12px; padding-left: 8px; }

.deck-riff { display: flex; flex-direction: column; gap: 8px; width: 190px; }
.seed { display: flex; flex-direction: column; gap: 2px; }
.seed-field { display: flex; gap: 6px; }
.seed-field input { flex: 1; width: 0; }
.new-riff {
    height: 40px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    background: var(--accent);
    color: var(--accent-ink);
    border: none;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.new-riff:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }

.deck-part2 { display: flex; align-items: center; gap: 8px; padding-left: 24px; border-left: 1px solid var(--line); }
.part2-buttons { display: flex; flex-direction: column; gap: 6px; }
.part2-buttons button { font-size: 12px; padding: 4px 10px; }

/* ---- The amp ---- */

.stage { padding: 26px 24px 8px; display: flex; justify-content: center; }

.amp { width: min(1080px, 100%); position: relative; transition: opacity 0.2s; }
.amp.is-bypassed .amp-head { filter: saturate(0.4); }
.amp.is-bypassed .amp-panel { opacity: 0.85; }

.amp-handle {
    width: 210px;
    height: 20px;
    margin: 0 auto -6px;
    border: 6px solid #2a2a2c;
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    position: relative;
}
.amp-handle::before, .amp-handle::after {
    content: "";
    position: absolute;
    bottom: -6px;
    width: 34px;
    height: 10px;
    border-radius: 3px;
    background: var(--corner);
}
.amp-handle::before { left: -20px; }
.amp-handle::after { right: -20px; }

.amp-head {
    position: relative;
    padding: 14px;
    border-radius: 16px;
    background: var(--shell-texture), linear-gradient(180deg, var(--shell-hi), var(--shell-lo));
    background-size: 3px 3px, auto;
    border: 1px solid var(--shell-edge);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.2), 0 24px 40px -16px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
/* metal corners */
.amp-head::before, .amp-head::after {
    content: "";
    position: absolute;
    top: -3px;
    width: 34px;
    height: 34px;
    background: var(--corner);
    border-radius: 12px 4px 4px 4px;
    clip-path: polygon(0 0, 100% 0, 100% 30%, 30% 30%, 30% 100%, 0 100%);
}
.amp-head::before { left: -3px; }
.amp-head::after { right: -3px; transform: scaleX(-1); }

.amp-grille {
    position: relative;
    height: 150px;
    border-radius: 8px;
    background:
        repeating-linear-gradient(45deg, var(--grille-line) 0 1px, transparent 1px 6px),
        repeating-linear-gradient(-45deg, var(--grille-line) 0 1px, transparent 1px 6px),
        var(--grille);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tubes { position: absolute; inset: 0 12%; display: flex; justify-content: space-around; align-items: flex-end; padding-bottom: 6px; }
.tube {
    width: 26px;
    height: 74px;
    border-radius: 13px 13px 4px 4px;
    background:
        radial-gradient(ellipse 40% 30% at 50% 62%, rgba(255, 140, 50, 0.25), transparent 70%),
        linear-gradient(90deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.02) 40%, rgba(255, 255, 255, 0.12) 85%);
    border: 1px solid var(--tube-glass);
    opacity: 0.6;
    transition: opacity 0.6s, box-shadow 0.6s;
}
.amp.is-on .tube {
    opacity: 1;
    background:
        radial-gradient(ellipse 45% 32% at 50% 62%, rgba(255, 170, 80, 0.95), rgba(255, 90, 20, 0.45) 55%, transparent 75%),
        linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02) 40%, rgba(255, 255, 255, 0.16) 85%);
    box-shadow: 0 0 22px 2px rgba(255, 120, 40, 0.35);
    animation: glow 2.8s ease-in-out infinite alternate;
}
.amp.is-on .tube:nth-child(2n) { animation-delay: -1.1s; }
.amp.is-on .tube:nth-child(3n) { animation-delay: -1.9s; }
@keyframes glow { from { filter: brightness(0.92); } to { filter: brightness(1.1); } }
@media (prefers-reduced-motion: reduce) { .amp.is-on .tube { animation: none; } }

.amp-logo {
    position: relative;
    font-size: 30px;
    font-weight: 200;
    letter-spacing: 0.45em;
    padding-left: 0.45em;
    color: var(--logo);
    text-shadow: 0 1px 0 color-mix(in srgb, var(--grille) 60%, transparent);
}
.amp-model {
    position: relative;
    margin-top: 4px;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--logo);
    opacity: 0.7;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.amp-panel {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 20px;
    border-radius: 8px;
    background: var(--panel);
    color: var(--panel-ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.3), 0 1px 0 rgba(0, 0, 0, 0.25);
    flex-wrap: wrap;
}
.amp-panel .label { color: var(--panel-ink); opacity: 0.85; font-size: 9.5px; }

.amp-jack { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.jack {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: radial-gradient(circle, #050505 0 32%, #9b9da1 34% 52%, #e6e7e9 54% 64%, #6e7074 66%);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
}

.amp-pickers { display: flex; flex-direction: column; gap: 8px; width: 190px; }
.amp-pickers label { display: flex; flex-direction: column; gap: 2px; }
.picker { display: flex; gap: 4px; }
.picker select, .picker button {
    height: 26px;
    font-size: 11.5px;
    color: var(--panel-ink);
    background-color: rgba(0, 0, 0, 0.22);
    border-color: var(--panel-line);
}
.picker select { flex: 1; width: 0; background-image: linear-gradient(45deg, transparent 50%, var(--panel-ink) 50%), linear-gradient(135deg, var(--panel-ink) 50%, transparent 50%); }
.picker select option { color: initial; }
.picker button { padding: 0 8px; }
.picker button:hover:not(:disabled) { background: rgba(0, 0, 0, 0.32); }

.amp-knobs { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; flex-wrap: wrap; }
.amp-divider { width: 1px; align-self: stretch; margin: 6px 8px; background: var(--panel-line); }

.amp-power { display: flex; align-items: center; gap: 14px; }
.reset-tone {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 8px;
    color: var(--panel-ink);
    background: transparent;
    border-color: var(--panel-line);
}
.reset-tone:hover:not(:disabled) { background: rgba(0, 0, 0, 0.15); }
.get-tone {
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 4px 9px;
    border-radius: 7px;
    color: var(--panel-ink);
    border: 1px solid var(--panel-ink);
    text-decoration: none;
    align-self: flex-start;
}
.get-tone:hover { background: var(--panel-ink); color: var(--grille); }

/* the standby/play toggle switch */
.switch { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: none; padding: 0; color: var(--panel-ink); }
.switch:hover:not(:disabled) { background: none; }
.switch .label { font-size: 9px; }
.switch-bat {
    width: 16px;
    height: 30px;
    border-radius: 8px;
    background: radial-gradient(circle at 50% 50%, #2a2a2c 0 4px, transparent 5px), linear-gradient(180deg, #cfd0d3, #7e8085);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
    position: relative;
}
.switch-bat::after {
    content: "";
    position: absolute;
    left: 4px;
    width: 8px;
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f6f6f7, #a8aaae);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    top: 14px;
    transition: top 0.12s;
}
.switch.is-up .switch-bat::after { top: 2px; }

.lamp {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #6c7a85, #1c2228 70%);
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(0, 0, 0, 0.12);
    transition: background 0.3s, box-shadow 0.3s;
}
.amp.is-on .lamp {
    background: radial-gradient(circle at 40% 35%, #e9f8ff, var(--led) 45%, #0b5e9a 80%);
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.2), 0 0 16px 4px color-mix(in srgb, var(--led) 60%, transparent);
}

.amp-feet { display: flex; justify-content: space-between; padding: 0 70px; height: 10px; }
.amp-feet span { width: 60px; height: 10px; background: #1d1d1f; border-radius: 0 0 6px 6px; }

/* ---- The tab screen (dark in both themes, like a display) ---- */

.screen {
    --ink: #e6e8ec;
    --muted: #8f96a3;
    --line: #2b2f37;
    --control: #1c1f25;
    --control-hover: #262a31;
    --deck: #121418;
    flex: 1 1 auto;
    min-height: 0;
    margin: 12px 24px 14px;
    padding: 12px 14px 10px;
    border-radius: 12px;
    background: #15171c;
    color: var(--ink);
    border: 1px solid #000;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 30px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.screen-head { display: flex; align-items: flex-end; gap: 16px; }
.readout { flex: 1; min-width: 0; }
.chords { font-size: 19px; font-weight: 600; color: #ffc857; white-space: pre; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0 12px rgba(255, 200, 87, 0.25); }
.detail { color: var(--muted); font-size: 12px; margin-top: 1px; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.position { font: 13px Consolas, ui-monospace, monospace; color: #6cc4ff; min-width: 90px; text-align: right; }

.editbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.editbar button { font-size: 12px; padding: 4px 10px; }
.segmented { display: flex; }
.segmented button { border-radius: 0; margin-left: -1px; }
.segmented button:first-child { border-radius: 7px 0 0 7px; margin-left: 0; }
.segmented button:last-child { border-radius: 0 7px 7px 0; }
.selection-text { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 200px; font-size: 12px; }

.tab-scroll { flex: 1; min-height: 160px; overflow-y: auto; overflow-x: hidden; border-radius: 8px; background: #15171c; }

.tab-canvas { position: relative; }
.tab-canvas svg { display: block; font-family: "Segoe UI", system-ui, sans-serif; user-select: none; }
.tab-canvas .fret { font: 600 13px Consolas, ui-monospace, monospace; text-anchor: middle; dominant-baseline: central; }
.tab-canvas .tuplet { font: italic 10px "Segoe UI", system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; }
.tab-hit { position: absolute; inset: 0; cursor: pointer; }

/* ---- Bottom bar ---- */

.bar {
    display: flex;
    align-items: center;
    gap: 10px 18px;
    flex-wrap: wrap;
    padding: 8px 24px;
    background: var(--deck);
    border-top: 1px solid var(--line);
    position: relative;
}
.bar-group { display: flex; align-items: center; gap: 8px; }
.bar button { font-size: 12px; padding: 4px 10px; }

.play { width: 38px; height: 34px; padding: 0 !important; display: grid; place-items: center; border-radius: 50% !important; background: var(--ink); color: var(--deck); border: none; }
.play:hover:not(:disabled) { background: var(--ink); filter: brightness(1.15); }
.play svg { width: 18px; height: 18px; fill: currentColor; }
.play.is-playing { background: var(--accent); color: var(--accent-ink); }
.play.is-playing:hover:not(:disabled) { background: var(--accent); }

/* checkboxes as pill toggles */
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill span {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
}
.pill input:checked + span { background: var(--ink); color: var(--deck); border-color: var(--ink); }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.mini .knob { min-width: 0; }
.mini .knob-label, .mini .knob-value { display: none; }
.mini .knob-dial { width: 32px; height: 32px; }

.sound select { width: 170px; height: 28px; font-size: 12px; }

.status { flex: 1 1 160px; min-width: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.popover { position: relative; }
.popover summary {
    list-style: none;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--control);
}
.popover summary::-webkit-details-marker { display: none; }
.popover[open] summary { background: var(--control-hover); }
.popover fieldset {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    z-index: 10;
    width: 290px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--deck);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.popover fieldset:disabled { opacity: 0.6; }
.popover .check { display: flex; align-items: center; gap: 6px; }
.popover .instrument { display: flex; flex-direction: column; gap: 2px; }
.popover .instrument select { width: 100%; font-size: 12px; height: 28px; }
.popover .channel { opacity: 0.7; margin-left: 4px; letter-spacing: 0; text-transform: none; }

.visits { font-size: 11px; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }

.theme-switch { display: flex; gap: 6px; padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.theme-switch button { width: 14px; height: 14px; padding: 0 !important; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; }
.theme-switch .theme-dark { background: var(--muted); }
.theme-switch .theme-auto { background: linear-gradient(90deg, transparent 50%, var(--muted) 50%); }
.theme-switch [aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---- Narrower screens ---- */

@media (max-width: 1280px) {
    .browser { order: 5; flex-basis: 100%; max-width: none; }
    .deck-part2 { margin-left: auto; }
}

@media (max-width: 900px) {
    .deck { padding: 12px 16px; gap: 14px; }
    .brand { flex-basis: 100%; }
    .deck-knobs { flex-wrap: wrap; }
    .deck-part2 { margin-left: 0; padding-left: 0; border-left: none; }
    .deck-riff { flex: 1 1 180px; }
    .browser-row { grid-template-columns: 80px 26px minmax(0, 1fr) 26px; }
    .browser-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .deck-riff { width: auto; }
    .sound select { width: auto; flex: 1; min-width: 0; }
    .bar-group.sound { flex: 1 1 100%; }
    .stage { padding: 20px 16px 4px; }
    .amp-grille { height: 110px; }
    .amp-logo { font-size: 20px; letter-spacing: 0.3em; }
    .tube { height: 54px; width: 20px; }
    .amp-panel { padding: 12px; justify-content: center; }
    .amp-pickers { width: 100%; }
    .amp-jack { display: none; }
    .amp-divider { display: none; }
    .amp-knobs { flex-basis: 100%; }
    .amp-power { flex-basis: 100%; justify-content: center; }
    .screen { margin: 10px 12px; }
    .bar { padding: 8px 12px; }
    .status { flex-basis: 100%; order: 10; white-space: normal; }
}

/* ---- Loading and errors ---- */

.loading {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
}
.loading-title { font-size: 22px; font-weight: 200; letter-spacing: 0.45em; padding-left: 0.45em; }
.loading-bar { width: 220px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.loading-bar div {
    height: 100%;
    width: calc(var(--blazor-load-percentage, 0%));
    background: var(--accent);
    transition: width 0.2s;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 16px;
    background: #5c1f14;
    color: #fff;
    z-index: 1000;
}
#blazor-error-ui .reload { color: #ffd2c4; margin-left: 8px; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
