:root {
    color-scheme: dark;
    --surface: rgba(16, 18, 21, 0.82);
    --surface-strong: rgba(22, 24, 27, 0.94);
    --line: rgba(255, 255, 255, 0.13);
    --text: #f5efe4;
    --muted: rgba(245, 239, 228, 0.62);
    --accent: #36d6c5;
    --accent-strong: #1fb9ab;
    --warning: #f0b35a;
    --danger: #ff7a7a;
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
    --panel-glow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --sketch-gap: 22px;
    --sketch-top-safe: 76px;
    --sketch-dock-height: 176px;
    --sketch-min-stage-width: 700px;
    --sketch-min-shell-width: 1102px;
    --sketch-shell-width: 100vw;
    --sketch-left-width: calc(100vw - var(--sketch-ide-width) - var(--sketch-gap));
    --sketch-ide-width: 42vw;
    --transport-safe-bottom: 154px;
}
* {
    box-sizing: border-box;
}
canvas {
    width: 100%;
    height: 100%;
    display: block;
}
body {
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    background: #08090b;
    margin: 0;
    overflow: hidden;
}
button,
input,
select {
    font: inherit;
}
.stage-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
}
#scene-vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(8, 9, 11, 0.68), transparent 24%, transparent 76%, rgba(8, 9, 11, 0.64)),
        linear-gradient(180deg, rgba(8, 9, 11, 0.74), transparent 22%, transparent 68%, rgba(8, 9, 11, 0.78));
}
#app-shell {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}
.topbar,
.panel,
#transport-bar {
    position: absolute;
    pointer-events: auto;
}
.topbar {
    top: 18px;
    left: 22px;
    right: 22px;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.brand-mark {
    width: 42px;
    height: 42px;
    display: block;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
    overflow: hidden;
    object-fit: cover;
}
.brand-title {
    display: block;
    font-size: 16px;
    line-height: 1.1;
    letter-spacing: 0;
}
.brand-subtitle,
.status-pill,
.helper,
.field-label,
.track-title,
.value-readout {
    color: var(--muted);
}
.brand-subtitle {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}
.mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(106px, 1fr));
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.mode-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.mode-switch span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.mode-switch input:checked + span {
    background: var(--accent);
    color: #06201d;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow);
    white-space: nowrap;
    justify-self: end;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 14px rgba(240, 179, 90, 0.85);
}
.status-ready .status-dot {
    background: var(--accent);
    box-shadow: 0 0 14px rgba(54, 214, 197, 0.85);
}
.status-error .status-dot {
    background: var(--danger);
    box-shadow: 0 0 14px rgba(255, 122, 122, 0.85);
}
.static-preview-banner {
    position: absolute;
    top: 70px;
    left: 50%;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(760px, calc(100vw - 44px));
    padding: 9px 12px;
    border: 1px solid rgba(240, 179, 90, 0.34);
    border-radius: 8px;
    background: rgba(24, 18, 12, 0.86);
    box-shadow: var(--shadow), var(--panel-glow);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    pointer-events: auto;
    transform: translateX(-50%);
}
.static-preview-banner[hidden] {
    display: none;
}
.static-preview-banner strong {
    flex: 0 0 auto;
    color: var(--warning);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}
.panel {
    width: min(350px, calc(100vw - 44px));
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 92px),
        var(--surface);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow), var(--panel-glow);
    text-align: left;
}
#upload-panel {
    left: 22px;
    top: 92px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    padding: 18px;
}
#settings-panel {
    right: 22px;
    top: 92px;
    width: min(370px, calc(100vw - 44px));
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    padding: 18px;
}
#sketch-panel {
    right: 22px;
    top: 92px;
    bottom: 142px;
    width: min(460px, calc(100vw - 44px));
    overflow-y: auto;
    padding: 18px;
}
body.sketch-mode #sketch-panel {
    right: 0;
    top: 76px;
    bottom: var(--sketch-panel-safe-bottom, 56px);
    width: min(max(380px, var(--sketch-ide-width)), 65vw);
    overflow: hidden;
    padding: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 8px 0 0 0;
    background:
        radial-gradient(circle at 18% 0%, rgba(54, 214, 197, 0.11), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 150px),
        rgba(11, 14, 17, 0.92);
}
#sketch-review-dock {
    display: contents;
}
body.sketch-mode #sketch-review-dock {
    position: absolute;
    left: 22px;
    right: calc(min(max(380px, var(--sketch-ide-width)), 65vw) + 22px);
    bottom: 22px;
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(180px, 32%);
    gap: 12px;
    align-items: stretch;
    pointer-events: none;
}
body.sketch-mode #transport-bar {
    position: static;
    width: auto;
    height: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(118px, 170px);
    grid-template-areas:
        "buttons buttons"
        "track speed"
        "timeline timeline"
        "review review";
    pointer-events: auto;
    transform: none;
}
.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0;
}
.panel-title-stack {
    min-width: 0;
    display: grid;
    gap: 4px;
}
.panel-kicker {
    color: var(--accent);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.panel-title strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.badge {
    padding: 4px 8px;
    border: 1px solid rgba(54, 214, 197, 0.24);
    border-radius: 6px;
    background: rgba(54, 214, 197, 0.14);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
}
.field {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}
.field-label {
    font-size: 12px;
    font-weight: 650;
}
.file-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
}
#audio-file,
#midi-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.file-pick,
.primary-button,
.secondary-button,
.icon-button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}
.file-pick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-weight: 700;
}
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 11px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}
#file-name,
#midi-file-name {
    min-width: 0;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.primary-button {
    width: 100%;
    margin-top: 14px;
    border-color: rgba(54, 214, 197, 0.46);
    background: linear-gradient(180deg, #48e0d0, var(--accent-strong));
    color: #06201d;
    font-weight: 800;
    box-shadow: 0 0 24px rgba(54, 214, 197, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.primary-button:disabled {
    cursor: default;
    opacity: 0.42;
    transform: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.file-pick:hover,
.secondary-button:hover,
.icon-button:hover,
.primary-button:not(:disabled):hover {
    transform: translateY(-1px);
    border-color: rgba(245, 239, 228, 0.34);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.source-audio-preview {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}
.source-audio-preview[hidden] {
    display: none;
}
.source-audio-preview audio {
    width: 100%;
    height: 34px;
    accent-color: var(--accent);
}
.segmented-control {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
    box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.18);
}
.segmented-control label {
    min-width: 0;
}
.segmented-control input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.segmented-control span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 6px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}
.segmented-control input:checked + span {
    background: linear-gradient(180deg, rgba(54, 214, 197, 0.96), rgba(31, 185, 171, 0.96));
    color: #06201d;
}
.convert-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
#upload-status {
    color: var(--muted);
    overflow-wrap: anywhere;
}
.conversion-result {
    display: grid;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.conversion-result[hidden] {
    display: none;
}
#conversion-result-text {
    display: block;
    margin-top: 5px;
    color: var(--text);
    overflow-wrap: anywhere;
}
.result-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}
.compare-results {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.compare-results[hidden] {
    display: none;
}
.compare-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
}
.compare-card {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(54, 214, 197, 0.055), transparent),
        rgba(255, 255, 255, 0.055);
}
.compare-card > div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.compare-status {
    color: var(--text);
    font-size: 12px;
    text-align: right;
    overflow-wrap: anywhere;
}
.compare-meta {
    color: var(--muted);
    font-size: 12px;
}
.compare-metrics {
    color: var(--text);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.compare-metrics[hidden] {
    display: none;
}
.compare-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.cleanup-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 12px 0;
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    color: var(--text);
    font-size: 13px;
}
.checkbox-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}
.sketch-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.sketch-resizer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 3;
    width: 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: col-resize;
}
.sketch-resizer::after {
    content: "";
    position: absolute;
    top: 22px;
    bottom: 22px;
    left: 3px;
    width: 2px;
    border-radius: 999px;
    background: rgba(245, 239, 228, 0.12);
    transition: background 160ms ease, box-shadow 160ms ease;
}
.sketch-resizer:hover::after,
body.is-resizing-sketch .sketch-resizer::after {
    background: rgba(54, 214, 197, 0.72);
    box-shadow: 0 0 20px rgba(54, 214, 197, 0.38);
}
.sketch-ide-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
}
.sketch-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.25fr) minmax(0, 1fr) minmax(64px, 0.62fr) minmax(70px, 0.65fr) minmax(104px, 0.9fr);
    gap: 10px;
    align-items: end;
    padding: 14px;
    border-bottom: 1px solid rgba(245, 239, 228, 0.12);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent),
        rgba(12, 15, 18, 0.96);
    backdrop-filter: blur(18px);
}
.sketch-toolbar .field {
    margin-top: 0;
    gap: 6px;
}
.sketch-toolbar select,
.sketch-toolbar input[type="number"],
.sketch-toolbar .primary-button {
    min-height: 36px;
}
.sketch-toolbar .primary-button {
    margin-top: 0;
}
.compact-number input,
.compact-number select {
    text-align: center;
}
.sketch-ide-body {
    display: grid;
    grid-template-columns: minmax(270px, 1fr) minmax(220px, 300px);
    gap: 14px;
    min-height: 0;
    padding: 14px;
    overflow: hidden;
}
.sketch-editor-pane,
.sketch-side-pane {
    min-height: 0;
}
.sketch-editor-pane {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 12px;
}
.sketch-editor-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.sketch-editor-bar strong {
    display: block;
    margin-top: 3px;
    font-size: 13px;
}
.ai-sketch-card {
    display: grid;
    gap: 10px;
    margin-bottom: 0;
    padding: 11px;
    border: 1px solid rgba(80, 220, 204, 0.22);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(80, 220, 204, 0.1), rgba(255, 255, 255, 0.035));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.ai-sketch-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.ai-sketch-header strong {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    line-height: 1.25;
    white-space: nowrap;
}
.ai-sketch-header .badge {
    flex: 0 0 auto;
}
.ai-sketch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.ai-action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}
.ai-action-grid .secondary-button,
.draft-actions .secondary-button {
    min-height: 34px;
    padding: 0 8px;
    font-size: 11px;
    line-height: 1.12;
    white-space: nowrap;
}
.ai-sketch-status {
    margin-top: 0;
    grid-template-columns: auto minmax(0, 1fr);
}
.ai-sketch-card .compact-textarea {
    height: 70px;
    min-height: 70px;
}
.muted-note {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}
.muted-note[hidden] {
    display: none;
}
.sketch-editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.sketch-editor-actions .secondary-button,
.sketch-snippet-select {
    min-height: 32px;
    padding: 0 9px;
    font-size: 11px;
    line-height: 1.1;
    white-space: nowrap;
}
.sketch-snippet-select {
    width: 136px;
    color: var(--text);
}
body.sketch-mode #strudel-code {
    height: 100%;
    min-height: 0;
    max-height: none;
    resize: none;
    padding: 17px 18px;
    border-color: rgba(245, 239, 228, 0.15);
    background:
        linear-gradient(90deg, rgba(54, 214, 197, 0.06), transparent 34px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 68px),
        #05080b;
    color: #f8f1e6;
    font-size: 13px;
    line-height: 1.66;
    tab-size: 2;
    caret-color: var(--accent);
    scrollbar-color: rgba(54, 214, 197, 0.34) rgba(255, 255, 255, 0.05);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.045),
        inset 0 0 0 1px rgba(0, 0, 0, 0.28),
        0 18px 48px rgba(0, 0, 0, 0.18);
}
body.sketch-mode #strudel-code:focus {
    outline: none;
    border-color: rgba(54, 214, 197, 0.5);
    box-shadow:
        0 0 0 3px rgba(54, 214, 197, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
body.sketch-mode #strudel-code::selection {
    background: rgba(54, 214, 197, 0.32);
    color: #fffaf0;
}
body.sketch-mode #strudel-code::placeholder {
    color: rgba(245, 239, 228, 0.38);
}
body.sketch-mode #strudel-code.is-ready {
    border-color: rgba(245, 239, 228, 0.16);
}
body.sketch-mode #strudel-code.is-generating {
    border-color: rgba(54, 214, 197, 0.55);
    background:
        linear-gradient(90deg, rgba(54, 214, 197, 0.085), transparent 34px),
        linear-gradient(180deg, rgba(54, 214, 197, 0.045), transparent 72px),
        #05080b;
}
body.sketch-mode #strudel-code.is-error {
    border-color: rgba(255, 122, 122, 0.56);
    box-shadow:
        0 0 0 3px rgba(255, 122, 122, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
body.sketch-mode .sketch-editor-pane .CodeMirror {
    height: 100%;
    min-height: 0;
    border: 1px solid rgba(245, 239, 228, 0.15);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(54, 214, 197, 0.06), transparent 36px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 72px),
        #05080b;
    color: #f8f1e6;
    font-family: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.66;
    letter-spacing: 0;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.045),
        inset 0 0 0 1px rgba(0, 0, 0, 0.28),
        0 18px 48px rgba(0, 0, 0, 0.18);
}
body.sketch-mode .sketch-editor-pane .CodeMirror-focused {
    border-color: rgba(54, 214, 197, 0.5);
    box-shadow:
        0 0 0 3px rgba(54, 214, 197, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
body.sketch-mode .sketch-editor-pane .CodeMirror.is-ready {
    border-color: rgba(245, 239, 228, 0.16);
}
body.sketch-mode .sketch-editor-pane .CodeMirror.is-generating {
    border-color: rgba(54, 214, 197, 0.55);
    background:
        linear-gradient(90deg, rgba(54, 214, 197, 0.085), transparent 36px),
        linear-gradient(180deg, rgba(54, 214, 197, 0.045), transparent 72px),
        #05080b;
}
body.sketch-mode .sketch-editor-pane .CodeMirror.is-error {
    border-color: rgba(255, 122, 122, 0.56);
    box-shadow:
        0 0 0 3px rgba(255, 122, 122, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
body.sketch-mode .sketch-editor-pane .CodeMirror-scroll {
    padding: 14px 0 14px 0;
    scrollbar-color: rgba(54, 214, 197, 0.34) rgba(255, 255, 255, 0.05);
}
body.sketch-mode .sketch-editor-pane .CodeMirror-lines {
    padding: 0;
}
body.sketch-mode .sketch-editor-pane .CodeMirror pre.CodeMirror-line,
body.sketch-mode .sketch-editor-pane .CodeMirror pre.CodeMirror-line-like {
    padding: 0 18px;
}
body.sketch-mode .sketch-editor-pane .CodeMirror-gutters {
    border-right: 1px solid rgba(245, 239, 228, 0.1);
    background: rgba(255, 255, 255, 0.028);
}
body.sketch-mode .sketch-editor-pane .CodeMirror-linenumber {
    color: rgba(245, 239, 228, 0.36);
    font-size: 11px;
}
body.sketch-mode .sketch-editor-pane .CodeMirror-cursor {
    border-left-color: var(--accent);
}
body.sketch-mode .sketch-editor-pane div.CodeMirror-selected {
    background: rgba(54, 214, 197, 0.28);
}
body.sketch-mode .sketch-editor-pane .CodeMirror-activeline-background {
    background: rgba(255, 255, 255, 0.04);
}
body.sketch-mode .sketch-editor-pane .CodeMirror-matchingbracket {
    color: #fffaf0;
    background: rgba(54, 214, 197, 0.2);
    outline: 1px solid rgba(54, 214, 197, 0.34);
}
body.sketch-mode .sketch-editor-pane .CodeMirror-dialog {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(54, 214, 197, 0.22);
    background: rgba(9, 13, 16, 0.96);
    color: var(--text);
    font-size: 12px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}
body.sketch-mode .sketch-editor-pane .CodeMirror-dialog input {
    width: min(360px, calc(100% - 84px));
    padding: 7px 9px;
    border: 1px solid rgba(54, 214, 197, 0.34);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font: inherit;
}
body.sketch-mode .sketch-editor-pane .CodeMirror-searching {
    background: rgba(54, 214, 197, 0.22);
    color: #fffaf0;
}
body.sketch-mode .sketch-editor-pane .cm-strudel-diagnostic-line {
    background: rgba(255, 122, 122, 0.13);
}
body.sketch-mode .sketch-editor-pane .cm-keyword {
    color: #ffb86b;
}
body.sketch-mode .sketch-editor-pane .cm-def,
body.sketch-mode .sketch-editor-pane .cm-variable-2 {
    color: #7bdff0;
}
body.sketch-mode .sketch-editor-pane .cm-variable,
body.sketch-mode .sketch-editor-pane .cm-property {
    color: #f8f1e6;
}
body.sketch-mode .sketch-editor-pane .cm-string {
    color: #9ee493;
}
body.sketch-mode .sketch-editor-pane .cm-number {
    color: #d7b7ff;
}
body.sketch-mode .sketch-editor-pane .cm-comment {
    color: rgba(245, 239, 228, 0.42);
    font-style: italic;
}
body.sketch-mode .sketch-editor-pane .cm-operator,
body.sketch-mode .sketch-editor-pane .cm-bracket {
    color: rgba(248, 241, 230, 0.82);
}
.strudel-editor-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    min-height: 30px;
    padding: 7px 10px;
    border: 1px solid rgba(245, 239, 228, 0.09);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
}
.strudel-editor-status span {
    white-space: nowrap;
}
.strudel-editor-status .strudel-shortcut-hint {
    margin-left: auto;
    color: rgba(245, 239, 228, 0.5);
}
#strudel-dirty-status.is-saved {
    color: #7df0a6;
}
#strudel-dirty-status.is-edited {
    color: #ffd27a;
}
.sketch-side-pane {
    display: grid;
    align-content: start;
    gap: 12px;
    overflow-y: auto;
    padding-right: 2px;
}
.draft-console {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}
.sketch-diagnostic {
    display: grid;
    gap: 9px;
    padding: 10px;
    border: 1px solid rgba(255, 122, 122, 0.32);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 122, 122, 0.12), rgba(255, 255, 255, 0.035)),
        rgba(10, 11, 13, 0.88);
}
.sketch-diagnostic[hidden] {
    display: none;
}
.sketch-diagnostic-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.sketch-diagnostic-header strong {
    display: block;
    margin-top: 3px;
    font-size: 13px;
}
.sketch-diagnostic-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    flex: 0 0 auto;
}
.sketch-diagnostic .secondary-button {
    min-height: 30px;
    padding: 0 9px;
    font-size: 11px;
    white-space: nowrap;
}
#strudel-diagnostic-message {
    max-height: 150px;
    margin: 0;
    overflow: auto;
    white-space: pre-wrap;
    color: rgba(245, 239, 228, 0.86);
    font-family: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.45;
}
.draft-console .field {
    margin-top: 0;
}
.draft-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}
.sketch-result {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.sketch-result[hidden] {
    display: none;
}
#strudel-result-title {
    display: block;
    margin-top: 5px;
    overflow-wrap: anywhere;
}
.note-activity {
    display: none;
    gap: 6px;
    padding: 8px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(245, 239, 228, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}
body.sketch-mode .note-activity {
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}
.note-activity-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
#note-activity-summary {
    color: var(--muted);
    font-size: 11px;
    min-width: 0;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.note-activity-grid {
    position: relative;
    min-width: 0;
    height: 62px;
    min-height: 62px;
    overflow: hidden;
    border: 1px solid rgba(245, 239, 228, 0.1);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(245, 239, 228, 0.12) 1px, transparent 1px),
        linear-gradient(180deg, rgba(245, 239, 228, 0.075) 1px, transparent 1px),
        rgba(5, 8, 11, 0.56);
    background-size: calc(100% / 8) 100%, 100% 18.75%;
}
.note-activity-grid.is-empty {
    display: grid;
    place-items: center;
}
.note-activity-empty {
    color: var(--muted);
    font-size: 12px;
}
.note-activity-grid:not(.is-empty) .note-activity-empty {
    display: none;
}
.note-density {
    display: grid;
    gap: 5px;
    min-height: 0;
}
.note-density-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
#note-density-summary {
    color: var(--muted);
    font-size: 10px;
    min-width: 0;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.note-density-grid {
    display: grid;
    align-items: end;
    gap: 3px;
    height: 34px;
    min-height: 34px;
    padding: 5px;
    overflow: hidden;
    border: 1px solid rgba(245, 239, 228, 0.1);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(245, 239, 228, 0.07) 1px, transparent 1px),
        rgba(5, 8, 11, 0.62);
    background-size: 100% 50%;
}
.note-density-grid.is-empty {
    display: grid;
    place-items: center;
}
.note-density-grid:not(.is-empty) .note-density-empty {
    display: none;
}
.note-density-empty {
    color: var(--muted);
    font-size: 10px;
}
.note-density-bar {
    display: block;
    min-height: 3px;
    border-radius: 999px 999px 2px 2px;
    background: linear-gradient(180deg, rgba(54, 214, 197, 0.95), rgba(240, 179, 90, 0.72));
    box-shadow: 0 0 12px rgba(54, 214, 197, 0.18);
}
.note-block {
    position: absolute;
    min-width: 2px;
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(54, 214, 197, 0.82), rgba(240, 179, 90, 0.76));
    box-shadow: 0 0 12px rgba(54, 214, 197, 0.22);
}
.note-activity-bar-label {
    position: absolute;
    top: 6px;
    color: rgba(245, 239, 228, 0.46);
    font-size: 10px;
    transform: translateX(-50%);
}
.sketch-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
select,
input[type="range"],
textarea {
    width: 100%;
}
select {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    padding: 0 10px;
}
select option {
    background: #16181b;
    color: var(--text);
}
textarea,
input[type="number"] {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}
textarea {
    height: clamp(150px, 24vh, 280px);
    min-height: 150px;
    max-height: 36vh;
    resize: vertical;
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    tab-size: 2;
}
.compact-textarea {
    height: 82px;
    min-height: 82px;
    max-height: 140px;
    font-family: inherit;
    font-size: 13px;
}
input[type="number"] {
    min-height: 40px;
    padding: 0 10px;
}
input[type="range"] {
    accent-color: var(--accent);
}
input[type="color"] {
    width: 46px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
}
.inline-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.keyboard-map,
.smart-score,
.performance-dock {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.smart-score {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}
.disclosure-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    margin: -6px -8px 0;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
    transition: background 160ms ease, border-color 160ms ease;
}
.disclosure-summary:hover {
    background: rgba(255, 255, 255, 0.055);
}
.keyboard-map summary::-webkit-details-marker,
.smart-score summary::-webkit-details-marker,
.performance-dock summary::-webkit-details-marker {
    display: none;
}
.disclosure-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}
.disclosure-title {
    min-width: 0;
    color: var(--text);
    font-size: 12px;
    font-weight: 780;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.disclosure-subtitle {
    min-width: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.disclosure-trailing {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.summary-chip {
    max-width: 112px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid rgba(54, 214, 197, 0.24);
    border-radius: 999px;
    background: rgba(54, 214, 197, 0.11);
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.disclosure-chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 160ms ease, border-color 160ms ease;
}
.keyboard-map[open] > .disclosure-summary .disclosure-chevron,
.smart-score[open] > .disclosure-summary .disclosure-chevron,
.performance-dock[open] > .disclosure-summary .disclosure-chevron {
    border-color: var(--accent);
    transform: rotate(-135deg);
}
.key-grid {
    display: grid;
    gap: 7px;
    margin-top: 12px;
}
.key-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
    gap: 5px;
}
kbd {
    min-width: 44px;
    min-height: 34px;
    display: inline-grid;
    grid-template-rows: auto auto;
    place-items: center;
    gap: 3px;
    padding: 5px 6px;
    border: 1px solid var(--line);
    border-bottom-color: rgba(0, 0, 0, 0.42);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1;
}
kbd small {
    color: var(--muted);
    font-size: 10px;
    line-height: 1;
}
.smart-score {
    display: grid;
    gap: 10px;
}
#analysis-status {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.analysis-grid {
    display: grid;
    grid-template-columns: minmax(82px, auto) minmax(0, 1fr);
    gap: 7px 12px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        radial-gradient(circle at top right, rgba(54, 214, 197, 0.08), transparent 40%),
        rgba(255, 255, 255, 0.055);
}
.analysis-grid span {
    color: var(--muted);
    font-size: 11px;
}
.analysis-grid strong {
    min-width: 0;
    color: var(--text);
    font-size: 11px;
    font-weight: 750;
    text-align: right;
    overflow-wrap: anywhere;
}
.export-actions,
.cleanup-actions,
.preset-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.export-actions .secondary-button[hidden],
.cleanup-actions .secondary-button[hidden],
.preset-actions .secondary-button[hidden] {
    display: none;
}
.export-actions .secondary-button,
.cleanup-actions .secondary-button,
.preset-actions .secondary-button {
    min-width: 0;
}
.cleanup-actions .secondary-button:disabled,
.preset-actions .secondary-button:disabled {
    cursor: default;
    opacity: 0.42;
    transform: none;
}
.preset-field {
    display: grid;
    gap: 7px;
    margin-top: 14px;
}
.preset-field[hidden] {
    display: none;
}
#cleanup-status,
#preset-status {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.value-readout {
    font-variant-numeric: tabular-nums;
}
#transport-bar {
    left: 50%;
    bottom: 22px;
    width: min(920px, calc(100vw - 44px));
    display: grid;
    grid-template-columns: minmax(270px, auto) minmax(0, 1fr) minmax(180px, 260px);
    grid-template-areas:
        "buttons track speed"
        "timeline timeline timeline"
        "review review review";
    align-items: center;
    gap: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(54, 214, 197, 0.045), transparent),
        var(--surface-strong);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow), var(--panel-glow);
    transform: translateX(-50%);
}
#copyright {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 6;
    pointer-events: auto;
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}
@media (min-width: 961px) {
    body.sketch-mode .stage-canvas,
    body.sketch-mode #scene-vignette {
        right: auto;
        width: calc(100vw - min(max(380px, var(--sketch-ide-width)), 65vw));
    }
}
.stage-tips {
    position: fixed;
    left: 22px;
    bottom: var(--transport-safe-bottom);
    z-index: 6;
    pointer-events: auto;
}
.stage-tips-button {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(54, 214, 197, 0.32);
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.22), transparent 36%),
        rgba(16, 18, 21, 0.72);
    color: var(--accent);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(18px) saturate(1.2);
    cursor: pointer;
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
}
.stage-tips-button[aria-expanded="true"] {
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.28), transparent 36%),
        rgba(54, 214, 197, 0.2);
    color: var(--text);
}
.stage-tips-popover {
    position: absolute;
    left: 0;
    bottom: 52px;
    width: min(284px, calc(100vw - 44px));
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 12px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035)),
        rgba(10, 12, 15, 0.72);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(22px) saturate(1.25);
}
.stage-tips-popover[hidden] {
    display: none;
}
.stage-tips-popover strong {
    display: block;
    margin-bottom: 10px;
    color: var(--text);
    font-size: 12px;
    font-weight: 850;
}
.stage-tips-popover ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.stage-tips-popover li {
    display: grid;
    grid-template-columns: minmax(92px, auto) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.25;
}
.stage-tips-popover li span:first-child {
    color: var(--accent);
    font-weight: 780;
}
.transport-buttons {
    grid-area: buttons;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.icon-button {
    min-width: 62px;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
body.sketch-mode .transport-buttons {
    flex-wrap: nowrap;
    gap: 6px;
}
body.sketch-mode .icon-button {
    min-width: 56px;
    padding: 0 8px;
}
body.sketch-mode #reset-view-button {
    min-width: 76px;
}
body.sketch-mode .interaction-hint {
    display: none;
}
.toggle-button[aria-pressed="true"],
.toggle-button.is-active {
    border-color: rgba(54, 214, 197, 0.58);
    background: rgba(54, 214, 197, 0.18);
    color: var(--accent);
}
.track-info {
    grid-area: track;
    min-width: 0;
}
.track-title {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
}
#active-song-title {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 750;
}
.interaction-hint {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.speed-control {
    grid-area: speed;
    display: grid;
    gap: 6px;
}
.timeline-control {
    grid-area: timeline;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}
.timeline-track {
    display: grid;
    gap: 4px;
    min-width: 0;
}
.timeline-grid {
    position: relative;
    height: 14px;
    color: var(--muted);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}
.timeline-grid span {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
}
.timeline-grid span::before {
    content: "";
    display: block;
    width: 1px;
    height: 5px;
    margin: 0 auto 2px;
    background: rgba(245, 239, 228, 0.28);
}
.time-readout {
    min-width: 38px;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
#timeline-slider:disabled {
    cursor: default;
    opacity: 0.45;
}
.review-control {
    grid-area: review;
    display: grid;
    grid-template-columns: minmax(160px, auto) minmax(0, 1fr) minmax(140px, auto);
    align-items: center;
    gap: 10px;
    padding-top: 2px;
    border-top: 1px solid rgba(245, 239, 228, 0.08);
}
.review-readouts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
#bar-beat-readout {
    color: var(--text);
    font-weight: 760;
}
.loop-range-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.loop-range-actions .secondary-button {
    min-height: 30px;
    padding: 0 9px;
    font-size: 11px;
}
#loop-range-status {
    color: var(--muted);
    font-size: 11px;
    text-align: right;
    overflow-wrap: anywhere;
}
.speed-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
a {
    color: var(--accent);
}
@media (max-width: 960px) {
    .topbar {
        top: 12px;
        left: 12px;
        right: 12px;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand status"
            "mode mode";
    }
    .brand {
        grid-area: brand;
    }
    .mode-switch {
        grid-area: mode;
        justify-self: center;
    }
    .status-pill {
        grid-area: status;
    }
    #upload-panel,
    #settings-panel {
        width: calc(50vw - 18px);
        top: 112px;
        bottom: 252px;
        padding: 14px;
    }
    #sketch-panel {
        right: 12px;
        top: 112px;
        bottom: 252px;
        width: min(440px, calc(100vw - 24px));
        padding: 14px;
    }
    .sketch-resizer {
        display: none;
    }
    .sketch-toolbar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .sketch-ide-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    .sketch-editor-pane {
        min-height: 420px;
    }
    #upload-panel {
        left: 12px;
    }
    #settings-panel {
        right: 12px;
    }
    #transport-bar {
        bottom: 12px;
        width: calc(100vw - 24px);
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "buttons track"
            "timeline timeline"
            "review review"
            "speed speed";
    }
    #copyright {
        right: 12px;
        bottom: var(--transport-safe-bottom);
    }
    .stage-tips {
        left: 12px;
        bottom: var(--transport-safe-bottom);
    }
    .stage-tips-popover {
        bottom: 52px;
    }
}
@media (max-width: 640px) {
    body {
        overflow: auto;
    }
    #app-shell {
        position: absolute;
        min-height: 100vh;
    }
    .topbar {
        align-items: flex-start;
    }
    .brand-subtitle {
        display: none;
    }
    .status-pill {
        max-width: 44vw;
        white-space: normal;
    }
    #upload-panel,
    #settings-panel,
    #sketch-panel,
    #transport-bar {
        left: 12px;
        right: 12px;
        width: auto;
        transform: none;
    }
    #upload-panel {
        top: auto;
        bottom: 338px;
    }
    #settings-panel {
        top: auto;
        bottom: 142px;
    }
    #sketch-panel {
        top: 102px;
        bottom: 270px;
    }
    .sketch-toolbar {
        grid-template-columns: 1fr 1fr;
        padding: 12px;
    }
    .sketch-toolbar .primary-button {
        grid-column: 1 / -1;
    }
    .sketch-ide-body {
        padding: 12px;
    }
    .sketch-editor-bar {
        align-items: stretch;
        flex-direction: column;
    }
    .sketch-editor-pane {
        min-height: 360px;
    }
    #transport-bar {
        grid-template-columns: 1fr;
        grid-template-areas:
            "buttons"
            "track"
            "timeline"
            "review"
            "speed";
    }
    #copyright {
        left: 12px;
        right: 12px;
        bottom: var(--transport-safe-bottom);
        text-align: center;
    }
    .stage-tips {
        left: 12px;
        bottom: var(--transport-safe-bottom);
    }
    .stage-tips-popover {
        width: min(284px, calc(100vw - 24px));
    }
    .transport-buttons {
        justify-content: stretch;
    }
    .icon-button {
        flex: 1;
    }
    .mode-switch {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .sketch-controls,
    .sketch-actions,
    .ai-sketch-grid,
    .ai-action-grid,
    .draft-actions,
    .sketch-editor-actions {
        grid-template-columns: 1fr;
    }
    .review-control {
        grid-template-columns: 1fr;
    }
    #loop-range-status {
        text-align: left;
    }
    textarea {
        min-height: 220px;
    }
}

body.sketch-mode {
    overflow-x: auto;
    overflow-y: hidden;
    min-width: var(--sketch-min-shell-width);
}
body.sketch-mode #app-shell {
    position: absolute;
    inset: 0 auto auto 0;
    width: var(--sketch-shell-width);
    min-width: var(--sketch-min-shell-width);
    height: 100vh;
    min-height: 100vh;
    overflow: visible;
}
body.sketch-mode .topbar {
    top: 18px;
    left: var(--sketch-gap);
    right: var(--sketch-gap);
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: none;
    align-items: center;
}
body.sketch-mode .brand {
    grid-area: auto;
}
body.sketch-mode .mode-switch {
    grid-area: auto;
    width: auto;
    justify-self: center;
    grid-template-columns: repeat(2, minmax(106px, 1fr));
}
body.sketch-mode .status-pill {
    grid-area: auto;
    max-width: none;
    white-space: nowrap;
    justify-self: end;
}
body.sketch-mode .stage-canvas,
body.sketch-mode #scene-vignette {
    right: auto;
    width: var(--sketch-left-width);
}
body.sketch-mode #sketch-panel {
    position: absolute;
    left: auto;
    right: 0;
    top: var(--sketch-top-safe);
    bottom: 34px;
    width: var(--sketch-ide-width);
    min-width: 380px;
    transform: none;
    overflow: hidden;
    padding: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 8px 0 0 0;
}
body.sketch-mode .sketch-resizer {
    display: block;
}
body.sketch-mode #sketch-review-dock {
    position: absolute;
    left: var(--sketch-gap);
    right: auto;
    bottom: var(--sketch-gap);
    width: calc(var(--sketch-left-width) - (var(--sketch-gap) * 2));
    height: var(--sketch-dock-height);
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(420px, 1fr) minmax(220px, 260px);
    gap: 12px;
    align-items: stretch;
    pointer-events: none;
}
body.sketch-mode #transport-bar {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    width: auto;
    height: 100%;
    transform: none;
    grid-template-columns: minmax(250px, auto) minmax(0, 1fr) minmax(118px, 150px);
    grid-template-areas:
        "buttons track speed"
        "timeline timeline timeline"
        "review review review";
    align-items: center;
    gap: 10px;
    padding: 12px;
    overflow: hidden;
    pointer-events: auto;
}
body.sketch-mode #note-activity {
    position: static;
    width: auto;
    height: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}
body.sketch-mode .transport-buttons {
    flex-wrap: nowrap;
    justify-content: flex-start;
}
body.sketch-mode .icon-button {
    flex: 0 0 auto;
}
body.sketch-mode .review-control {
    grid-template-columns: minmax(115px, auto) minmax(0, 1fr) minmax(120px, auto);
}
body.sketch-mode #loop-range-status {
    text-align: right;
}

/* Studio Shell V2: keep workflow structure stable before responsive decoration. */
:root {
    --studio-gap: 22px;
    --studio-top-safe: 92px;
    --studio-footer-safe: 22px;
    --studio-side-width: 360px;
    --studio-inspector-width: 378px;
    --studio-transport-width: 940px;
    --studio-transport-height: 178px;
    --studio-sketch-dock-height: 204px;
    --studio-min-transcribe-width: 1180px;
    --studio-min-sketch-stage: 700px;
    --studio-focus-ring: 0 0 0 3px rgba(54, 214, 197, 0.18);
    --studio-panel-bg:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 110px),
        rgba(12, 15, 18, 0.88);
    --studio-panel-border: rgba(245, 239, 228, 0.14);
}
body {
    background:
        radial-gradient(circle at 52% 46%, rgba(54, 214, 197, 0.045), transparent 34%),
        linear-gradient(180deg, #08090b 0%, #090b0d 44%, #050607 100%);
}
body:not(.sketch-mode) {
    min-width: var(--studio-min-transcribe-width);
    overflow-x: auto;
    overflow-y: hidden;
}
body:not(.sketch-mode) #app-shell {
    position: absolute;
    inset: 0 auto auto 0;
    width: max(100vw, var(--studio-min-transcribe-width));
    min-width: var(--studio-min-transcribe-width);
    height: 100vh;
    min-height: 720px;
    overflow: visible;
}
.topbar {
    min-height: 46px;
}
.panel,
#transport-bar,
.note-activity {
    border-color: var(--studio-panel-border);
    background: var(--studio-panel-bg);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36), var(--panel-glow);
}
.panel {
    border-radius: 10px;
}
button,
.file-pick,
select,
input,
textarea,
.mode-switch span,
.segmented-control span {
    transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
button:focus-visible,
.file-pick:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
.mode-switch label:focus-within span,
.segmented-control label:focus-within span {
    outline: 0;
    box-shadow: var(--studio-focus-ring);
}
body:not(.sketch-mode) .topbar {
    top: 18px;
    left: var(--studio-gap);
    right: var(--studio-gap);
    grid-template-columns: minmax(280px, 1fr) auto minmax(160px, 1fr);
    grid-template-areas: none;
    align-items: center;
}
body:not(.sketch-mode) .brand,
body:not(.sketch-mode) .mode-switch,
body:not(.sketch-mode) .status-pill {
    grid-area: auto;
}
body:not(.sketch-mode) .mode-switch {
    width: auto;
    justify-self: center;
}
body:not(.sketch-mode) .status-pill {
    max-width: none;
    justify-self: end;
    white-space: nowrap;
}
body:not(.sketch-mode) #upload-panel,
body:not(.sketch-mode) #settings-panel {
    top: var(--studio-top-safe);
    bottom: calc(var(--studio-footer-safe) + var(--studio-transport-height) + 18px);
    max-height: none;
    padding: 16px;
    overflow-y: auto;
}
body:not(.sketch-mode) #upload-panel {
    left: var(--studio-gap);
    width: var(--studio-side-width);
}
body:not(.sketch-mode) #settings-panel {
    right: var(--studio-gap);
    width: var(--studio-inspector-width);
}
body:not(.sketch-mode) #transport-bar {
    left: 50%;
    bottom: var(--studio-footer-safe);
    width: min(var(--studio-transport-width), calc(100vw - 44px));
    min-height: var(--studio-transport-height);
    transform: translateX(-50%);
    grid-template-columns: minmax(300px, auto) minmax(0, 1fr) minmax(170px, 240px);
    grid-template-areas:
        "buttons track speed"
        "timeline timeline timeline"
        "review review review";
    gap: 14px;
    padding: 14px;
    border-radius: 10px;
}
body:not(.sketch-mode) #note-activity {
    display: none;
}
body:not(.sketch-mode) .transport-buttons,
body:not(.sketch-mode) .loop-range-actions {
    flex-wrap: nowrap;
}
body:not(.sketch-mode) .icon-button {
    flex: 0 0 auto;
}
body:not(.sketch-mode) .review-control {
    grid-template-columns: minmax(150px, auto) minmax(0, 1fr) minmax(130px, auto);
}
body:not(.sketch-mode) #loop-range-status {
    text-align: right;
}
body.sketch-mode {
    --sketch-gap: var(--studio-gap);
    --sketch-top-safe: 76px;
    --sketch-dock-height: var(--studio-sketch-dock-height);
    --sketch-min-stage-width: var(--studio-min-sketch-stage);
}
body.sketch-mode .topbar {
    min-width: calc(var(--sketch-min-shell-width) - (var(--studio-gap) * 2));
}
body.sketch-mode #sketch-panel {
    border-left: 1px solid var(--studio-panel-border);
    background:
        radial-gradient(circle at 16% 0%, rgba(54, 214, 197, 0.1), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.052), transparent 160px),
        rgba(8, 11, 13, 0.94);
}
body.sketch-mode #sketch-review-dock {
    height: var(--studio-sketch-dock-height);
}
body.sketch-mode #transport-bar {
    border-radius: 10px;
    grid-template-columns: minmax(290px, auto) minmax(0, 1fr) minmax(120px, 150px);
}
body.sketch-mode .note-activity {
    border-radius: 10px;
}
.panel-title,
.disclosure-summary,
.sketch-toolbar,
.sketch-editor-bar,
.compare-toolbar,
.note-activity-header {
    letter-spacing: 0;
}
.primary-button,
.secondary-button,
.icon-button,
.file-pick {
    border-radius: 8px;
    white-space: nowrap;
}
.primary-button {
    background: linear-gradient(180deg, rgba(54, 214, 197, 1), rgba(31, 185, 171, 0.94));
    box-shadow: 0 14px 32px rgba(54, 214, 197, 0.16);
}
.secondary-button,
.icon-button,
.file-pick {
    background: rgba(255, 255, 255, 0.07);
}
.secondary-button:hover,
.icon-button:hover,
.file-pick:hover {
    border-color: rgba(54, 214, 197, 0.36);
    background: rgba(54, 214, 197, 0.11);
}
.sketch-toolbar {
    align-items: end;
    grid-template-columns: minmax(140px, 1fr) minmax(160px, 1.08fr) minmax(140px, 1fr) 84px 92px minmax(136px, auto);
}
#strudel-code {
    font-family: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.62;
    letter-spacing: 0;
}
.ai-sketch-card,
.draft-console,
.sketch-result,
.compare-card,
.conversion-result,
.source-audio-preview {
    border-radius: 10px;
}
@media (max-width: 960px) {
    body:not(.sketch-mode) {
        min-width: var(--studio-min-transcribe-width);
    }
    body:not(.sketch-mode) #app-shell {
        position: absolute;
        width: var(--studio-min-transcribe-width);
        min-width: var(--studio-min-transcribe-width);
    }
    body:not(.sketch-mode) .topbar {
        top: 18px;
        left: var(--studio-gap);
        right: var(--studio-gap);
        grid-template-columns: minmax(280px, 1fr) auto minmax(160px, 1fr);
    }
    body:not(.sketch-mode) #upload-panel {
        left: var(--studio-gap);
        width: var(--studio-side-width);
    }
    body:not(.sketch-mode) #settings-panel {
        left: auto;
        right: var(--studio-gap);
        width: var(--studio-inspector-width);
    }
    body:not(.sketch-mode) #transport-bar {
        left: 50%;
        right: auto;
        width: var(--studio-transport-width);
        transform: translateX(-50%);
        grid-template-columns: minmax(300px, auto) minmax(0, 1fr) minmax(170px, 240px);
        grid-template-areas:
            "buttons track speed"
            "timeline timeline timeline"
            "review review review";
    }
    body:not(.sketch-mode) #copyright {
        left: auto;
        right: var(--studio-gap);
        bottom: var(--transport-safe-bottom);
        text-align: right;
    }
    body:not(.sketch-mode) .stage-tips {
        left: var(--studio-gap);
    }
}
body.static-preview-mode:not(.sketch-mode) #upload-panel,
body.static-preview-mode:not(.sketch-mode) #settings-panel {
    top: 122px;
    max-height: calc(100vh - 280px);
}
body.static-preview-mode.sketch-mode #sketch-panel {
    top: 122px;
}
