@layer base, layout, components, responsive;

@layer base {
    :root {
        color-scheme: dark;
        --background: #0b0d16;
        --panel: #131622;
        --text: #f5f2fc;
        --muted: #b0adc3;
        --border: #282a3b;
        --accent: #aa91ff;
        --cyan: #78e3ce;
        --radius: 20px;
        font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
    }
    *, *::before, *::after { box-sizing: border-box; }
    body { margin: 0; background: radial-gradient(ellipse 900px 610px at 76% 14%, #17132a 0%, transparent 72%), var(--background); color: var(--text); }
    h1, h2, p { margin: 0; }
    a { color: inherit; text-decoration: none; }
    button, input { font: inherit; }
    button { cursor: pointer; }
    button:disabled, input:disabled { cursor: default; opacity: .62; }
    :focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
    [id] { scroll-margin-top: 1rem; }
    input[type="range"] { accent-color: var(--accent); cursor: pointer; }
    .sr-only { position: absolute; clip-path: inset(50%); inline-size: 1px; block-size: 1px; overflow: hidden; white-space: nowrap; }
}

@layer layout {
    .shell { width: min(1240px, calc(100% - 96px)); margin-inline: auto; }
    .site-header { border-bottom: 1px solid #ffffff0e; background: #0b0d16a8; }
    .header-inner { min-height: 73px; display: flex; justify-content: space-between; gap: 24px; align-items: center; }
    .hero { position: relative; display: grid; grid-template-columns: minmax(510px, 1.12fr) 1fr; align-items: center; padding-block: 64px 39px; }
    .hero-content { z-index: 1; }
    .hero-art { min-width: 0; margin-left: -22px; }
    .wave-art { display: block; width: 100%; height: auto; }
    .studio { display: grid; grid-template-columns: minmax(0, 1.69fr) minmax(300px, 1fr); gap: 18px; align-items: stretch; }
    .dna { margin-top: 18px; }
    .site-footer { padding-block: 31px; margin-top: 15px; display: flex; align-items: center; justify-content: space-between; gap: 15px; color: var(--muted); font-size: .9rem; }
    .footer-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; margin: 0; text-align: right; }
    .footer-meta a { color: var(--text); }
    .build-info { font-size: .75rem; opacity: .75; font-variant-numeric: tabular-nums; }
}

@layer components {
    [data-style] {
        --aurora-primary: #e8cd98;
        --aurora-secondary: #f1edff;
        --aurora-shadow: #303c6c;
        --aurora-highlight: #fff0cd;
        --aurora-travel: .72;
    }
    [data-style="Ambient"] {
        --aurora-primary: #69d6c6;
        --aurora-secondary: #93cbf2;
        --aurora-shadow: #1d4b82;
        --aurora-highlight: #b0f1e8;
        --aurora-travel: .45;
    }
    [data-style="Electronic"] {
        --aurora-primary: #d78edf;
        --aurora-secondary: #7fe3ee;
        --aurora-shadow: #4539a8;
        --aurora-highlight: #ddc7ff;
        --aurora-travel: 1;
    }

    .brand { display: inline-flex; align-items: center; gap: .3em; flex-shrink: 0; color: var(--text); font-size: 1.13rem; font-weight: 530; }
    .brand img { margin-right: 6px; }
    .brand strong { font-weight: 750; }
    nav { display: flex; gap: clamp(1rem, 3vw, 2.6rem); color: var(--muted); font-size: .93rem; }
    nav a:hover { color: var(--text); }
    .eyebrow { color: #c0adf7; text-transform: uppercase; letter-spacing: .13em; font-size: .76rem; font-weight: 700; }
    .hero-kicker { display: flex; align-items: center; gap: 9px; margin-bottom: 15px; font-size: .82rem; }
    .hero-kicker span { width: 20px; height: 1px; background: var(--accent); }
    h1 { font-size: clamp(3rem, 6.55vw, 6.1rem); line-height: .98; letter-spacing: -.07em; font-weight: 740; }
    h1 em { color: #b09aff; font-style: normal; }
    .hero-description { margin-top: 21px; font-size: clamp(1rem, 1.4vw, 1.2rem); line-height: 1.55; color: var(--muted); }
    .generator { margin-top: 28px; display: flex; gap: 7px; padding: 6px; background: #131624; border: 1px solid #373249; border-radius: 14px; width: min(100%, 570px); }
    .generator { transition: border-color .2s ease, box-shadow .2s ease; }
    .generator:focus-within {
        border-color: var(--aurora-primary);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--aurora-primary) 15%, transparent);
    }
    .generator:has([aria-invalid="true"]) { border-color: #ffb6b9; }
    .url-feedback { min-height: 1.45em; margin-top: 5px; color: #ffb6b9; font-size: .82rem; line-height: 1.45; }
    .url-check { color: var(--cyan); }
    .url-field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0 10px; color: #bcacdf; }
    .url-field svg { flex: none; }
    .url-field input { background: transparent; border: 0; width: 100%; padding: 9px 0; color: var(--text); outline-offset: 1px; }
    .url-field input::placeholder { color: #a09bb3; }
    .primary-button { color: #161026; background: linear-gradient(110deg, #b39bff, #a68aff); border: 1px solid #b39bff; border-radius: 9px; font-weight: 760; padding: .7rem 1rem; min-height: 44px; white-space: nowrap; }
    .primary-button:hover:not(:disabled) { background: #c6b5ff; }
    .style-picker { width: min(100%, 570px); min-width: 0; margin: 4px 0 0; padding: 0; border: 0; }
    .style-picker legend { padding: 0; margin-bottom: 8px; color: var(--muted); font-size: .88rem; }
    .style-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .style-options label { position: relative; display: flex; min-width: 0; }
    .style-card { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-content: start; align-items: center; gap: 5px 7px; width: 100%; border: 1px solid #343047; border-radius: 10px; padding: 9px; background: #171927; color: var(--text); cursor: pointer; }
    .style-card svg { color: var(--aurora-primary); }
    .style-card { transition: background-color .28s ease, border-color .24s ease, box-shadow .24s ease, transform .12s ease; }
    .style-card strong { font-size: .88rem; font-weight: 680; }
    .style-card small { grid-column: 1 / -1; color: var(--muted); font-size: .77rem; line-height: 1.3; }
    .style-radio:checked + .style-card {
        background: color-mix(in srgb, var(--aurora-shadow) 39%, #171927);
        border-color: var(--aurora-primary);
        box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--aurora-primary) 20%, transparent);
    }
    .style-radio:checked + .style-card strong { font-weight: 800; }
    .style-radio:not(:disabled) + .style-card:active { transform: scale(.98); }
    .primary-button, .demo-button, .play-button, .stop-button {
        transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .12s ease;
    }
    :is(.primary-button, .demo-button, .play-button, .stop-button):active:not(:disabled) { transform: scale(.97); }
    .style-radio:focus-visible + .style-card { outline: 2px solid var(--cyan); outline-offset: 3px; }
    .style-radio:disabled + .style-card { cursor: default; }
    .style-radio:not(:disabled):not(:checked) + .style-card:hover { border-color: #73618f; }
    .demo-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 15px; }
    .end-share {
        margin-top: 18px;
        padding: clamp(14px, 3vw, 21px);
        border: 1px solid #705b9e;
        border-radius: 14px;
        background: radial-gradient(ellipse at 95% 0%, #3a2c59, transparent 75%), #211b33;
    }
    .end-share-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
    .end-share-heading h3 { margin: 0; font-size: clamp(1.12rem, 3vw, 1.4rem); }
    .end-share-heading p { margin-top: 4px; color: #d4c8ea; font-size: .9rem; }
    .end-share-dismiss { display: grid; place-items: center; flex: none; width: 34px; padding: 0; }
    .end-share .native-share-action, .end-share a.social-share-link:first-of-type { background: var(--accent); color: #1b1030; border-color: #c3afff; }
    .share-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
    .share-url { flex: 1 0 100%; min-width: 0; }
    .share-actions .native-share-action { display: none; }
    .can-native-share .share-actions .native-share-action { display: inline-block; }
    .can-native-share .share-actions:not(.show-social-links) .social-share-link { display: none; }
    .social-share-link { display: inline-flex; align-items: center; }
    .share-status { flex-basis: 100%; }
    .share-status:empty { display: none; }
    .shared-page { max-width: 740px; padding-block: clamp(24px, 10vh, 96px) 32px; }
    .shared-page .shared-studio { grid-template-columns: minmax(0, 1fr); }
    .shared-title { font-size: clamp(1.35rem, 4vw, 2.4rem); line-height: 1.1; letter-spacing: -.035em; overflow-wrap: anywhere; }
    .shared-studio-link { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; color: var(--muted); }
    .shared-studio-link:hover { color: var(--text); }
    .demo-picker > span { color: var(--muted); margin-right: 3px; font-size: .88rem; }
    .demo-button { background: #171927; border: 1px solid #303044; color: #d4cfe5; border-radius: 7px; min-height: 34px; padding: .26rem .63rem; font-size: .84rem; }
    .demo-button:hover:not(:disabled), .demo-button[aria-pressed="true"] { background: #261f3c; border-color: #6c58a0; color: #eee5ff; }
    .mode-note { color: var(--muted); font-size: .85rem; line-height: 1.5; margin-top: 11px; }
    .analysis-feedback:has(.status:empty):not(:has(.error)) { display: none; }
    .analysis-feedback { margin-top: 11px; font-size: .93rem; }
    .queue-card { max-width: 570px; padding: 14px 16px; background: var(--panel); border: 1px solid #514365; border-radius: 12px; }
    .queue-detail { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); }
    .status { color: var(--cyan); display: flex; align-items: center; gap: 8px; }
    .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); }
    .status-dot { flex: none; }
    .status:is([data-phase="Submitting"], [data-phase="Queued"]) .status-dot {
        border: 1px solid currentColor;
        background: transparent;
    }
    .status[data-phase="Submitting"] .status-dot { animation: status-pulse 1s ease-in-out infinite alternate; }
    .status[data-phase="Analyzing"] .status-dot { animation: status-pulse 1.35s ease-in-out infinite alternate; }
    .status[data-phase="Composing"] .status-dot {
        border-radius: 1px;
        background: #d2bfff;
        transform: rotate(45deg);
        animation: status-pulse .75s ease-in-out infinite alternate;
    }
    .status[data-phase="Ready"] .status-dot { animation: status-ready .35s ease-out; }
    .status[data-phase="Cancelled"] { color: var(--muted); }
    .status[data-phase="Cancelled"] .status-dot { background: currentColor; }
    @keyframes status-pulse { to { opacity: .34; } }
    @keyframes status-ready { from { transform: scale(.65); } }
    .error, .audio-feedback { color: #ffb6b9; }
    .panel { background: linear-gradient(140deg, #171a28, var(--panel) 55%); border: 1px solid var(--border); border-radius: var(--radius); padding: 21px; min-width: 0; }
    .deck { position: relative; isolation: isolate; display: flex; flex-direction: column; }
    .aurora {
        position: absolute;
        z-index: -1;
        inset: -9px;
        overflow: hidden;
        border-radius: calc(var(--radius) + 9px);
        pointer-events: none;
        opacity: 0;
        transition: opacity .65s ease-out;
    }
    .aurora[data-reacting] { opacity: 1; transition-duration: .45s; }
    .aurora span {
        position: absolute;
        inset: -2% -12%;
        opacity: var(--strength, 0);
        transition: color .42s ease;
    }
    .aurora-low {
        color: var(--aurora-primary);
        background:
            radial-gradient(ellipse at 18% 6%, color-mix(in srgb, currentColor 38%, transparent), transparent 52%),
            radial-gradient(ellipse at 62% 0%, color-mix(in srgb, currentColor 27%, transparent), transparent 60%);
        transform: translate3d(calc(var(--drift, 0) * var(--aurora-travel) * .24%), -.7%, 0);
    }
    .aurora-high {
        color: var(--aurora-secondary);
        background:
            radial-gradient(ellipse at 89% 93%, color-mix(in srgb, currentColor 32%, transparent), transparent 50%),
            radial-gradient(ellipse at 30% 102%, color-mix(in srgb, currentColor 22%, transparent), transparent 54%);
        transform: translate3d(calc(var(--drift, 0) * var(--aurora-travel) * -.28%), .7%, 0);
    }
    .spectrum {
        position: relative;
        height: 26px;
        margin: 7px 3px 0;
    }
    .spectrum::before {
        content: "";
        position: absolute;
        inset: 50% 0 auto;
        height: 1px;
        background: linear-gradient(to right, transparent, currentColor 28% 72%, transparent);
        color: var(--aurora-primary);
        opacity: .26;
        transition: color .35s ease;
    }
    .spectrum canvas {
        display: block;
        width: 100%;
        height: 100%;
        opacity: 0;
        transition: opacity .45s ease-out;
    }
    .spectrum canvas[data-reacting] { opacity: .8; transition-duration: .25s; }
    .deck-header { display: flex; gap: 13px; align-items: center; }
    .album-art {
        color: var(--aurora-highlight);
        background: #221b38;
        background: color-mix(in srgb, var(--aurora-shadow) 52%, #171927);
        border: 1px solid #604d83;
        border-color: color-mix(in srgb, var(--aurora-primary) 38%, #303044);
        border-radius: 12px;
        width: 60px;
        height: 60px;
        flex: none;
        display: grid;
        place-items: center;
        transition: color .4s ease, background-color .4s ease, border-color .4s ease;
    }
    .score-heading { min-width: 0; }
    .score-heading .eyebrow { margin-bottom: 3px; }
    h2 { font-size: 1.28rem; line-height: 1.16; letter-spacing: -.025em; }
    .source-url { color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
    .score-meta { display: flex; align-items: flex-end; gap: 5px; flex-direction: column; margin-left: auto; text-align: right; flex: none; color: #e1d8f4; font-size: .87rem; }
    .score-meta span:first-child { color: var(--cyan); font-size: 1.1rem; font-weight: 715; font-variant-numeric: tabular-nums; }
    .score-meta small { font-size: .72rem; letter-spacing: .04em; }
    .player-style { color: var(--aurora-highlight); font-weight: 650; transition: color .4s ease; }
    .track { position: relative; display: flex; flex-direction: column; flex: 1; margin-top: 18px; border: 1px solid #2c2941; overflow: hidden; background: #10121e; border-radius: 11px; }
    .track-sections { display: flex; border-bottom: 1px solid #38314b; color: #ddd3f0; font-size: .75rem; }
    .track-sections span { min-width: max-content; padding: 6px 9px; border-right: 1px solid #3d3556; }
    .track-sections span:last-child { border-right: 0; }
    .roll { position: relative; flex: 1; min-height: 144px; overflow: hidden; background-image: repeating-linear-gradient(to right, #796ab526 0 1px, transparent 1px 6.25%), repeating-linear-gradient(to bottom, transparent 0 calc(14.2857% - 1px), #796ab522 calc(14.2857% - 1px) 14.2857%); }
    .roll i { position: absolute; height: 4px; border-radius: 2px; background: var(--note); opacity: .83; }
    .playhead { position: absolute; inset: 0; pointer-events: none; }
    .playing .playhead { will-change: transform; }
    .playhead::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: #f0e5ff; box-shadow: 0 0 10px #c5a8ff; }
    .seek { margin: 0 9px; height: 23px; }
    .seek:focus-visible { outline-offset: -2px; }
    .transport { margin-top: 7px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
    .transport-buttons { display: flex; align-items: center; gap: 8px; }
    .play-button, .stop-button { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 10px; }
    .play-button { background: var(--accent); color: #1b1030; border: 1px solid #c3afff; }
    .play-button:hover:not(:disabled) { background: #c8b5ff; }
    .stop-button { background: #202233; color: #d9d4e9; border: 1px solid #39384c; }
    .stop-button:hover:not(:disabled) { background: #34304a; }
    .pause-icon, .playing .play-icon { display: none; }
    .playing .pause-icon { display: block; }
    .time, .volume { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
    .time [data-elapsed] { color: var(--text); margin-left: 3px; }
    .volume { display: flex; gap: 7px; align-items: center; }
    .volume input { width: clamp(57px, 8vw, 105px); margin: 0; }
    .volume [data-volume-value] { min-width: 3ch; text-align: right; }
    .audio-feedback:not(:empty) { margin-top: 10px; }
    .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
    .panel-heading p { margin-top: 5px; color: var(--muted); font-size: .92rem; }
    .section-count { color: var(--cyan); font-size: .81rem; white-space: nowrap; }
    .instrument-list { margin: 13px 0 0; padding: 0; list-style: none; }
    .instrument-list li { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-top: 1px solid #ffffff11; min-height: 46px; transition: background .16s ease-out; }
    .instrument-mark { display: flex; align-items: center; justify-content: center; gap: 2px; width: 31px; height: 31px; color: var(--instrument); background: color-mix(in srgb, var(--instrument) 11%, transparent); border-radius: 8px; }
    .instrument-mark i { width: 2px; height: 8px; border-radius: 2px; background: currentColor; }
    .instrument-mark i:nth-child(2) { height: 14px; }
    .instrument-mark i:nth-child(3) { height: 11px; }
    .instrument-text { display: grid; gap: 1px; }
    .instrument-text strong { font-size: .94rem; font-weight: 630; }
    .instrument-text small, .event-count { color: var(--muted); font-size: .79rem; }
    .event-count { margin-left: auto; white-space: nowrap; }
    .silent .instrument-mark { color: #9f99b0; background: #ffffff08; }
    .sounding { background: color-mix(in srgb, var(--instrument) 14%, transparent); }
    .sounding .event-count, .sounding .instrument-text strong { color: var(--instrument); }
    .sounding .instrument-mark { box-shadow: inset 0 0 0 1px currentColor; }
    .score-id { font-family: ui-monospace, monospace; color: var(--muted); font-size: .77rem; }
    .metrics { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 17px 0; }
    .metrics > div { padding: 10px; background: #10131f; border: 1px solid #292c3c; border-radius: 9px; }
    .metrics dt { color: var(--muted); font-size: .82rem; }
    .metrics dd { margin: 4px 0 0; font-size: 1.35rem; font-weight: 680; font-variant-numeric: tabular-nums; }
    .dna-identity { margin-top: 14px; }
    .dna-theme, .dna-arrangement {
        display: flex;
        gap: 12px;
        align-items: center;
        flex-wrap: wrap;
        border: 1px solid #34374b;
        border-radius: 10px;
        padding: 10px 13px;
        background: #10131f;
    }
    .dna-theme { animation: dna-reveal .42s ease-out both; }
    .dna-theme h3 { margin: 0; font-size: .9rem; }
    .dna-theme p { margin-top: 4px; color: var(--muted); font-size: .87rem; }
    .motif {
        position: relative;
        flex: 1 0 min(180px, 100%);
        height: 44px;
        border-inline-start: 1px solid #43465e;
        background: repeating-linear-gradient(to right, #8586a833 0 1px, transparent 1px 25%);
    }
    .motif span {
        position: absolute;
        inset-inline-start: var(--beat);
        top: clamp(0px, calc(26px - var(--degree) * 4px), 35px);
        width: 10px;
        height: 6px;
        border-radius: 3px;
        background: #c8c4e2;
    }
    .dna-identity .metrics > div {
        animation: dna-reveal .42s ease-out calc(var(--reveal-order) * 45ms) both;
    }
    @keyframes dna-reveal {
        from { opacity: .45; transform: translateY(4px); }
    }
    .dna-arrangement {
        gap: 6px 14px;
        margin-bottom: 14px;
        color: var(--muted);
        font-size: .84rem;
        border-color: color-mix(in srgb, var(--aurora-primary) 30%, #34374b);
        transition: border-color .35s ease;
    }
    .dna-arrangement strong { color: var(--aurora-highlight); transition: color .35s ease; }
    .resource-details summary { color: #d9caff; cursor: pointer; font-size: .92rem; width: fit-content; }
    .about { margin-top: 18px; }
    .about-intro { max-width: 68ch; margin-top: 8px; color: var(--muted); line-height: 1.55; }
    .about-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin: 18px 0 0; padding: 0; list-style: none; }
    .about-flow li { position: relative; padding: 14px; background: #10131f; border: 1px solid #343047; border-radius: 9px; }
    .about-flow li + li::before {
        content: ""; position: absolute; top: calc(50% - 4px); left: -18px; width: 8px; height: 8px;
        border-top: 2px solid var(--accent); border-right: 2px solid var(--accent); transform: rotate(45deg);
    }
    .about-flow h3 { margin: 0 0 5px; font-size: 1rem; color: var(--cyan); }
    .about-flow p { color: var(--muted); font-size: .88rem; line-height: 1.5; }
    .dna-explainer { margin-bottom: 14px; }
    .dna-explanation { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; margin-top: 10px; }
    .dna-explanation > div { padding: 14px; border: 1px solid #292c3c; border-radius: 9px; background: #10131f; }
    .dna-explanation h3 { margin: 0 0 8px; font-size: 1rem; }
    .dna-explanation p, .dna-mappings { color: var(--muted); font-size: .88rem; line-height: 1.5; }
    .dna-explanation p + p { margin-top: 6px; }
    .dna-explanation strong { color: var(--text); }
    .dna-mappings { display: grid; gap: 8px; margin: 10px 0 0; }
    .dna-mappings dt { color: var(--accent); }
    .dna-mappings dt span { color: var(--muted); }
    .dna-mappings dd { margin: 0; }
    .resource-details summary span { margin-left: 7px; color: var(--muted); }
    .resource-table { overflow-x: auto; }
    table { margin-top: 12px; border-collapse: collapse; width: 100%; text-align: left; font-size: .85rem; }
    th, td { border-bottom: 1px solid var(--border); padding: 8px; }
    td:nth-child(2) { overflow-wrap: anywhere; }
    #components-reconnect-modal { position: fixed; bottom: 16px; right: 16px; max-width: calc(100% - 32px); z-index: 5; padding: 12px 16px; background: #302343; border: 1px solid var(--accent); border-radius: 10px; }
    #components-reconnect-modal.components-reconnect-hide { display: none !important; }
}

@layer responsive {
    @media (max-width: 1100px) {
        .hero { grid-template-columns: minmax(460px, 1.15fr) minmax(0, 1fr); }
        .shell { width: calc(100% - 64px); }
    }
    @media (max-width: 870px) {
        .shell { width: calc(100% - 40px); }
        .hero { grid-template-columns: minmax(0, 1fr); padding-top: 52px; }
        .hero-art { position: absolute; width: 52%; right: 0; top: 20px; opacity: .45; pointer-events: none; }
        .studio { grid-template-columns: minmax(0, 1fr); }
        .instrument-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; }
        .metrics { grid-template-columns: repeat(4, 1fr); }
    }
    @media (max-width: 640px) {
        .about-flow { grid-template-columns: 1fr; gap: 20px; }
        .about-flow li + li::before { top: -16px; left: calc(50% - 4px); transform: rotate(135deg); }
    }
    @media (max-width: 520px) {
        .shell { width: calc(100% - 28px); }
        .header-inner { min-height: 58px; gap: 8px; }
        .brand { font-size: 1rem; }
        .brand img { width: 27px; height: 27px; margin-right: 3px; }
        nav { gap: 10px; font-size: .78rem; }
        nav a[href="#about"] { display: none; }
        .hero { padding-top: 33px; padding-bottom: 26px; }
        .hero-art { width: 67%; top: 15px; right: -4px; opacity: .29; }
        .desktop-break { display: none; }
        h1 { font-size: clamp(2.65rem, 10.7vw, 3.4rem); line-height: 1; }
        .hero-description { margin-top: 13px; }
        .generator { margin-top: 19px; flex-direction: column; }
        .url-field input { min-height: 44px; }
        .demo-picker { gap: 6px; }
        .demo-button { min-height: 39px; }
        .demo-picker > span { width: 100%; }
        .panel { padding: 13px; border-radius: 14px; }
        .album-art { width: 43px; height: 43px; }
        .album-art svg { width: 31px; height: 31px; }
        .deck-header { gap: 8px; }
        .score-meta { font-size: .73rem; }
        .score-meta span:first-child { font-size: .93rem; }
        .roll { min-height: 122px; }
        .transport { gap: 6px; }
        .transport-buttons { gap: 5px; }
        .play-button, .stop-button { width: 44px; height: 44px; }
        .volume { gap: 4px; }
        .volume input { width: clamp(53px, 20vw, 87px); }
        .instrument-list { gap: 0 6px; }
        .instrument-list li { padding-inline: 2px; gap: 5px; }
        .instrument-mark { width: 24px; height: 28px; }
        .instrument-text strong { font-size: .83rem; }
        .instrument-text small, .event-count { font-size: .72rem; }
        .metrics { grid-template-columns: repeat(3, 1fr); }
        .site-footer { align-items: flex-start; flex-direction: column; }
        .footer-meta { align-self: stretch; align-items: flex-end; }
    }
    @media (prefers-reduced-motion: reduce) {
        *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    }
    @media (max-width: 360px) {
        .style-options { grid-template-columns: minmax(0, 1fr); }
        .style-card { grid-template-columns: 20px 85px minmax(0, 1fr); }
        .style-card small { grid-column: auto; }
        .instrument-list { grid-template-columns: minmax(0, 1fr); }
    }
}
