/* Readable UI text scales with the browser's text-size preference. */
body { font-size: .9375rem; }
button, select { min-height: 44px; }
input[type="range"] { min-height: 32px; }
input[type="checkbox"] { min-width: 20px; min-height: 20px; flex-shrink: 0; }
button, label, select, summary { overflow-wrap: anywhere; }
.skip-link {
    position: fixed;
    z-index: 30;
    top: 8px;
    left: 8px;
    padding: 12px;
    background: var(--panel);
    color: var(--teal);
    transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }
.small, .direction .small, .section-heading .small, .action-note, .local-note,
.steps p, .hero .small, .report-notes, .report-stage p, .import-limits { font-size: .8125rem; }
.eyebrow, .studio-heading .eyebrow, .direction .eyebrow { font-size: .6875rem; }
.engine-tag, .live-badge { font-size: .6875rem; }
.tabs button { font-size: 1rem; white-space: normal; min-height: 44px; }
.direction label, .direction .check { font-size: .875rem; }
.direction label output { font-size: .8125rem; }
.direction > button { font-size: 1rem; }
.direction input[type="number"], .direction select { min-height: 44px; font-size: .9375rem; }
.direction details { font-size: .875rem; }
.direction summary { min-height: 44px; padding-block: 10px; }
.help, .direction .help, .transport-extra .help {
    min-height: 28px;
    min-width: 28px;
    width: 28px;
    height: 28px;
    font-size: .8125rem;
    margin-inline: 4px;
}
.transport button, .transport-extra, .transport-extra .check { font-size: .8125rem; }
.transport, .transport-main, .transport-extra { flex-wrap: wrap; }
.transport button { min-height: 44px; }
.band label, .band .gain-label, .band .on-label { font-size: .75rem; }
.band .band-name { font-size: .75rem; min-height: 44px; white-space: normal; }
.band input[type="number"], .band select { font-size: .8125rem; min-height: 44px; }
.band output { font-size: .875rem; }
.band-picker button { font-size: .75rem; min-height: 44px; }
.eq-actions > button, .eq-actions .check { font-size: .8125rem; min-height: 44px; }
.output-control { font-size: .8125rem; flex-wrap: wrap; }
.plot-legend { font-size: .6875rem; }
#eq-note { font-size: .8125rem; }
.text-button, .statusbar, .statusbar .small { font-size: .75rem; }
.dialog-close { min-height: 44px; min-width: 44px; }
dialog p, dialog li { font-size: .9375rem; }
.edit-actions > button { flex-shrink: 1; min-width: 0; }
.edit-bulk-action-summary { font-size: .875rem; }
.edit-bulk-omissions, .edit-wave-legend { font-size: .8125rem; }
.edit-player .edit-seek { font-size: .75rem; }
.edit-player button { min-height: 44px; }
.edit-fields label:has(input[type="checkbox"]) { align-items: center; }
.edit-fields input[type="number"] { min-height: 44px; }
.edit-local-error, .edit-field-error {
    display: block;
    padding: 10px;
    color: #ffdae4;
    background: #351c2b;
    border-left: 3px solid #ffb3ca;
    font-size: .875rem;
    overflow-wrap: anywhere;
}
.edit-local-error { margin: 12px 0; }
[aria-invalid="true"] { outline: 2px solid #ffb3ca; outline-offset: 2px; }
.edit-grid, .edit-fields, .edit-save, .edit-file-slot { min-width: 0; }
.track-card strong, #filename, #filemeta, #s-info { overflow-wrap: anywhere; }
.studio-heading { flex-wrap: wrap; }
.studio-heading > div { min-width: 0; }
.metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric strong { font-size: 1.5rem; }
.metric span, .metric small { font-size: .6875rem; }
.metric { min-width: 0; overflow-wrap: anywhere; }
.insight { font-size: .875rem; }
@media (max-width: 680px) {
    body { font-size: 1rem; }
    .masthead { align-items: center; }
    .brand { min-width: 0; flex: 1; }
    .brand img { flex-shrink: 0; }
    .brand strong { font-size: 1.0625rem; overflow-wrap: anywhere; }
    .brand small { font-size: .625rem; }
    .header-actions { flex-shrink: 0; }
    .header-actions button { font-size: .875rem; min-width: 80px; }
    .library h2 { font-size: 1rem; }
    .studio-mode .workspace > .library { display: none; }
    .edit-heading h2 { display: none; }
    #studio-tools[data-loaded="false"] .edit-heading { display: none; }
    body:not(.master-loaded) .playback .waveform,
    body:not(.master-loaded) .playback .transport-extra,
    #studio-tools[data-loaded="false"] .edit-player canvas,
    #studio-tools[data-loaded="false"] .edit-wave-legend,
    #studio-tools[data-loaded="false"] .edit-player label,
    #studio-tools[data-loaded="false"] .edit-player time,
    #studio-tools[data-loaded="false"] #s-before,
    #studio-tools[data-loaded="false"] #s-after { display: none; }
    body:not(.master-loaded) .playback .transport { margin-top: 0; }
    .library #demo, .library #add { font-size: .8125rem; }
    .track-card strong { font-size: .875rem; }
    .track-card p { font-size: .75rem; }
    .track-card button { min-height: 44px; font-size: .75rem; }
    .library:has(.track-card:not([hidden])) #import-limits { display: none; }
    .library:has(.track-card:not([hidden])) .track-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 8px;
        margin: 0;
        gap: 4px 8px;
    }
    .library .track-card strong { grid-column: 1; grid-row: 1; }
    .library .track-card p { grid-column: 1; grid-row: 2; }
    .library .track-card button { grid-column: 2; grid-row: 1/3; }
    .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .tabs button { padding: 8px; }
    .studio-heading h1 { font-size: 1.625rem; }
    .studio-heading .eyebrow { font-size: .6875rem; }
    .mobile-actions button { font-size: .875rem; }
    .hero { align-items: center; }
    .hero h2 { font-size: 1.625rem; }
    .hero p { font-size: .9375rem; }
    .hero .eyebrow { font-size: .6875rem; }
    .steps h3 { font-size: 1.1875rem; }
    .steps p { font-size: .875rem; }
    .section-heading { flex-wrap: wrap; gap: 8px; }
    .section-heading h2 { font-size: 1.375rem; }
    .section-heading button { font-size: .8125rem; }
    .live-badge { max-width: none; }
    .transport-main { justify-content: flex-start; }
    .transport-extra { gap: 8px; }
    .transport button { padding: 8px; }
    .ab { flex-wrap: wrap; }
    .volume input { width: 70px; }
    .plot-legend { gap: 8px; }
    .band .band-name { white-space: normal; }
    .metric strong { font-size: 1.25rem; }
    .metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr)); }
    .direction { padding: 16px 12px; }
    .direction .check { font-size: .875rem; }
    .footer-tools { flex-wrap: wrap; }
    .statusbar { flex-wrap: wrap; gap: 8px; }
}
/* Compact desktop windows use document scrolling rather than a tiny page pane.
   The transport remains independent of that scrolling, as on a phone. */
@media (min-width: 941px) and (max-height: 780px) {
    .app-shell {
        height: auto;
        min-height: 100dvh;
        padding-bottom: calc(var(--help-dock-height, 44px) + var(--playback-height, 150px) + var(--job-overlay-height, 0px) + 36px);
    }
    .workspace { overflow: visible; align-items: start; }
    .library, .direction, .studio > .page { overflow: visible; }
    .studio > .page { flex: 0; }
    .playback, .edit-player {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(var(--help-dock-height, 44px) + 20px);
        max-height: 35dvh;
        overflow: auto;
        margin: 0;
        padding: 10px;
        background: var(--panel);
        border: 1px solid #8b5ca4;
        border-radius: 8px;
        z-index: 5;
    }
    .job-feedback { bottom: calc(var(--help-dock-height, 44px) + var(--playback-height, 150px) + 28px); }
    html, html:has(.studio-mode) {
        scroll-padding-bottom: calc(var(--help-dock-height, 44px) + var(--playback-height, 150px) + var(--job-overlay-height, 0px) + 36px);
    }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
