/* Video2SRT — Layout v2.0
 * Refactored: Better spacing, enhanced sidebar, polished workspace
 */

/* ── App shell ────────────────────────────────────────────────────────── */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    background: var(--color-bg);
    transition: grid-template-columns var(--duration-base) var(--ease-out);
}
.app[data-sidebar="collapsed"] {
    grid-template-columns: var(--sidebar-width-collapsed) 1fr;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.025), transparent 28%),
        var(--color-bg-elev-1);
    border-right: 1px solid var(--color-border);
    z-index: var(--z-sticky);
    overflow: hidden;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    height: var(--navbar-height);
    padding: 0 14px;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-md);
    font-weight: var(--weight-bold);
    color: var(--color-text);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-brand-mark {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--color-accent), #fb7185);
    color: #FFFFFF;
    box-shadow: 0 6px 16px rgba(225, 29, 72, 0.18);
    transition: box-shadow var(--duration-base) var(--ease-out);
}
.sidebar-brand-mark:hover {
    box-shadow: 0 8px 20px rgba(225, 29, 72, 0.24);
}
.sidebar-brand-mark > svg { width: 16px; height: 16px; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-md) var(--space-sm);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.sidebar-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    height: 38px;
    padding: 0 12px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    cursor: pointer;
    text-align: left;
    transition:
        background var(--duration-fast) var(--ease-out),
        color var(--duration-fast) var(--ease-out);
    white-space: nowrap;
    width: 100%;
}
.sidebar-nav-item > svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav-item:hover { background: var(--color-bg-elev-3); color: var(--color-text); }
.sidebar-nav-item[aria-current="page"] {
    background: rgba(248, 250, 252, 0.055);
    color: var(--color-text);
    box-shadow: inset 0 0 0 1px var(--color-border);
}
/* Active indicator bar */
.sidebar-nav-item[aria-current="page"]::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--color-accent);
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
    animation: fadeIn var(--duration-base) var(--ease-out);
}
.sidebar-nav-item[aria-current="page"] > svg { color: var(--color-accent); }

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-sm);
    border-top: 1px solid var(--color-border);
}
.sidebar-credit {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(248, 250, 252, 0.035);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    overflow: hidden;
}
.sidebar-credit-label {
    flex-shrink: 0;
    color: var(--color-text-subtle);
    font-weight: var(--weight-medium);
}
.sidebar-credit-value {
    font-family: var(--font-mono);
    color: var(--color-accent);
    font-weight: var(--weight-semibold);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 var(--space-sm);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    cursor: pointer;
    gap: var(--space-xs);
    transition: color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.sidebar-collapse-btn:hover { color: var(--color-text); border-color: var(--color-border-strong); }
.sidebar-collapse-btn > svg { width: 14px; height: 14px; transition: transform var(--duration-base) var(--ease-out); }
.app[data-sidebar="collapsed"] .sidebar-collapse-btn > svg { transform: rotate(180deg); }

.app[data-sidebar="collapsed"] .sidebar-brand span,
.app[data-sidebar="collapsed"] .sidebar-nav-item span,
.app[data-sidebar="collapsed"] .sidebar-credit-label,
.app[data-sidebar="collapsed"] .sidebar-credit-value,
.app[data-sidebar="collapsed"] .sidebar-collapse-btn span { display: none; }
.app[data-sidebar="collapsed"] .sidebar-nav-item { justify-content: center; padding: 0; width: 40px; margin: 0 auto; }
.app[data-sidebar="collapsed"] .sidebar-nav-item[aria-current="page"]::before { left: -4px; }
.app[data-sidebar="collapsed"] .sidebar-credit { justify-content: center; padding: var(--space-sm); }
.app[data-sidebar="collapsed"] .sidebar-collapse-btn { padding: 0; width: 32px; }

/* ── Main wrapper ─────────────────────────────────────────────────────── */
.main-wrapper {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    /* Subtle ambient glow from top-right corner */
    background:
        radial-gradient(ellipse at 85% 0%, rgba(225, 29, 72, 0.055), transparent 42%),
        radial-gradient(ellipse at 18% 8%, rgba(59, 130, 246, 0.035), transparent 38%),
        var(--color-bg);
}

/* ── Navbar ───────────────────────────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    height: var(--navbar-height);
    padding: 0 var(--space-lg);
    background: rgba(13, 16, 32, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--color-border);
    z-index: var(--z-sticky);
}
.navbar-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    min-width: 0;
}
.navbar-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.40);
    animation: pulse 2s var(--ease-in-out) infinite;
}
.navbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    cursor: pointer;
    transition:
        color var(--duration-fast) var(--ease-out),
        background var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out),
        transform var(--duration-fast) var(--ease-out);
}
.theme-toggle:hover {
    color: var(--color-text);
    background: var(--color-bg-elev-3);
    border-color: var(--color-border-strong);
    transform: rotate(15deg);
}
.theme-toggle > svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }

/* ── Main content ─────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: var(--space-md);
}

/* ── Auth screen ──────────────────────────────────────────────────────── */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(225, 29, 72, 0.08), transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(59, 130, 246, 0.04), transparent 40%),
        var(--color-bg);
}
.auth-card {
    width: min(100%, 440px);
    background: var(--color-bg-elev-1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-2xl);
    animation: fadeInScale var(--duration-slow) var(--ease-out);
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}
.auth-brand-mark {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: var(--color-accent);
    color: #FFFFFF;
    box-shadow: 0 4px 16px rgba(225, 29, 72, 0.35);
}
.auth-brand-mark > svg { width: 22px; height: 22px; }
.auth-brand h1 { font-size: var(--text-xl); }
.auth-brand p { font-size: var(--text-sm); color: var(--color-text-subtle); margin-top: 2px; }

.auth-form { display: flex; flex-direction: column; gap: var(--space-md); }
.auth-form .btn { margin-top: var(--space-sm); }

.security-note {
    padding: var(--space-md);
    background: var(--color-info-soft);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    line-height: var(--leading-relaxed);
}
@media (max-width: 640px) {
    .auth-card { padding: var(--space-xl) var(--space-lg); }
}

/* ── Upload screen ────────────────────────────────────────────────────── */
.upload-screen {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    height: 100%;
    padding: var(--space-md);
    overflow-y: auto;
}
.upload-wrapper {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    position: relative;
    animation: fadeInUp var(--duration-slow) var(--ease-out);
}
.upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    background: rgba(5, 5, 16, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}
.upload-overlay-progress { width: min(80%, 320px); }

/* ── Workspace ────────────────────────────────────────────────────────── */
.workspace {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    height: 100%;
    min-height: 0;
    overflow-y: hidden;
    overflow-x: hidden;
}
.video-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    flex: 0 1 auto;
    min-height: 0;
    min-width: 0;
    overflow: visible;
}
.subtitle-editor {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: min(360px, 48vh);
    overflow: hidden;
}
.subtitle-editor-header {
    align-items: center;
    min-height: 42px;
}
.subtitle-editor-header > div:first-child {
    min-width: 0;
    flex-shrink: 1;
}
.subtitle-editor-header h3 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.subtitle-editor-header h3 > svg {
    width: 16px;
    height: 16px;
    color: var(--color-accent);
}
.panel-hint {
    margin-top: 2px;
    font-size: var(--text-xs);
    color: var(--color-text-subtle);
}
.subtitle-editor-header .panel-hint {
    display: none;
}
.caption-font-select-wrap {
    width: clamp(148px, 14vw, 190px);
    min-width: 148px;
}
.caption-font-select {
    height: 30px;
    padding-left: var(--space-sm);
    padding-right: var(--space-xl);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
}
.subtitle-editor-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    flex: 1;
    min-height: 0;
    padding: var(--space-sm) var(--space-md) var(--space-md);
}
.audio-editor {
    display: flex;
    flex-direction: column;
    margin-top: var(--space-md);
}
.audio-editor-header {
    align-items: center;
}
.audio-editor-header h3 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.audio-editor-header h3 > svg {
    width: 16px;
    height: 16px;
    color: var(--color-accent);
}
.audio-editor-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.audio-editor-body {
    padding: var(--space-md);
}
.audio-tool-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(320px, 0.9fr);
    gap: var(--space-md);
}
.audio-music-panel,
.audio-transcript-panel {
    min-width: 0;
}
.audio-empty {
    min-height: 42px;
    display: flex;
    align-items: center;
    color: var(--color-text-subtle);
}
.audio-preview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-md);
}
.audio-preview-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.audio-preview-main strong,
.audio-preview-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.audio-preview-main span {
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
}
.audio-preview audio {
    width: 100%;
    height: 36px;
}
.audio-fields {
    display: grid;
    grid-template-columns: repeat(6, minmax(92px, 1fr));
    gap: var(--space-sm);
    align-items: end;
}
.compact-field {
    margin: 0;
}
.compact-field .field-label {
    font-size: var(--text-xs);
}
.audio-loop-row {
    min-height: 38px;
    align-items: center;
}
.audio-transcript-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.audio-transcript-header {
    min-height: 38px;
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
    align-items: center;
}
.audio-transcript-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}
.transcript-output {
    min-height: 132px;
    resize: vertical;
    line-height: 1.5;
}
.segment-stage {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-bottom: 4px;
}
.segment-ruler {
    position: sticky;
    top: 0;
    z-index: 6;
    flex: 0 0 auto;
    height: 32px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-elev-2);
    overflow: hidden;
}
.segment-ruler::before,
.segment-ruler::after {
    content: '';
}
.segment-ruler-track {
    position: relative;
    height: 100%;
    min-width: 100%;
}
.segment-ruler-label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: rgba(248, 250, 252, 0.06);
    color: var(--color-text-subtle);
    font-size: var(--text-2xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.segment-ruler-mark {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--text-2xs);
    color: var(--color-text-subtle);
    white-space: nowrap;
    padding-top: 4px;
    letter-spacing: 0.02em;
}
.segment-ruler-mark::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 50%;
    width: 1px;
    height: 7px;
    background: rgba(148, 163, 184, 0.35);
}
.segment-ruler-mark.is-start { transform: translate(0, -50%); }
.segment-ruler-mark.is-mid { transform: translate(-50%, -50%); }
.segment-ruler-mark.is-end { transform: translate(-100%, -50%); }
.segment-strip-wrap {
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.video-wrapper {
    position: relative;
    flex: 0 1 auto;
    min-height: 0;
    background: linear-gradient(180deg, #0b0d1a, #050609);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: grid;
    grid-template-columns: max-content minmax(280px, 1fr);
    gap: 10px;
    align-items: stretch;
    justify-items: stretch;
    padding: 10px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--duration-base) var(--ease-out);
}
.video-wrapper:has(video[src]) {
    box-shadow: var(--shadow-md), 0 0 30px rgba(0, 0, 0, 0.50);
}
/* Seeking indicator */
.video-wrapper.is-seeking::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: fadeIn var(--duration-fast) var(--ease-out);
}
.video-wrapper.is-seeking::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    z-index: 1;
    pointer-events: none;
}
/* Center column: player screen stacked above a welded transport dock */
.preview-stage {
    grid-column: 1;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    /* A portrait (9:16-ish) video's aspect-ratio width can drop well under
       300px, which is too narrow for the transport dock's controls (frame
       step, play, timestamp, speed, mute, fullscreen) to lay out — this
       floor keeps the stage (and the dock, which spans it edge to edge)
       usable, and .preview-screen's own black background below fills the
       gap on either side of the narrower video as ordinary letterboxing. */
    min-width: 380px;
    background: #000;
    border-radius: var(--radius-md);
    /* Match .preview-screen's aspect-ratio-driven width below, so this column
       (and the .preview-dock that's absolutely positioned inside it) hugs the
       video instead of stretching across whatever the grid track leaves free.
       min-width above still wins over this for narrow/portrait videos. */
    max-width: calc(clamp(220px, 40vh, 500px) * var(--video-aspect, 1.7778));
}
.workspace-action-panel {
    grid-column: 2;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(248, 250, 252, 0.10);
    border-radius: var(--radius-md);
    background:
        linear-gradient(180deg, rgba(17, 22, 42, 0.86), rgba(7, 8, 20, 0.72));
    box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    max-height: clamp(220px, 40vh, 500px);
    overflow: auto;
    scrollbar-width: thin;
}
.workspace-action-panel .badge {
    align-self: flex-start;
}
/* Controls grouped by what they actually do (view/caption/pipeline/voice/
   export) instead of one flat list — the panel now has real width to spare
   (see .preview-stage / .preview-screen above), so groups sit side by side
   as their own labeled cards and reflow to one column only when narrow. */
.action-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    align-content: start;
    gap: 10px;
}
.action-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(248, 250, 252, 0.08);
    border-radius: var(--radius-sm);
    background: rgba(7, 8, 20, 0.28);
}
.action-group-label {
    font-size: var(--text-2xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-subtle);
}
.action-group-status {
    font-size: var(--text-2xs);
    color: var(--color-text-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.action-group-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.action-group-row > * {
    flex: 1 1 140px;
    min-width: 0;
}
.action-group-row > .zoom-control {
    justify-content: stretch;
}
.action-group .zoom-level {
    flex: 1;
}
.action-group .action-bar-progress {
    flex-basis: 100%;
    align-items: center;
}
.action-group .action-bar-progress .progress-text {
    margin-top: 0;
}
.action-group-row > #btn-upload-music-timeline {
    flex: 0 0 auto;
    min-height: 34px;
    border-color: var(--color-border-strong);
}
.preview-screen {
    position: relative;
    flex: 0 1 auto;
    /* align-self overrides the column-flex default of stretching to the full
       cross size, so width can instead come from aspect-ratio × height — the
       actual fix for the black bars: the box now matches the video instead
       of filling whatever the grid track leaves free. */
    align-self: center;
    width: auto;
    max-width: 100%;
    height: clamp(220px, 40vh, 500px);
    aspect-ratio: var(--video-aspect, 1.7778);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background:
        radial-gradient(120% 120% at 50% 0%, rgba(30, 34, 60, 0.35), transparent 60%),
        #000000;
    overflow: hidden;
}
.preview-screen video {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
}
.preview-screen .video-transition-layer {
    position: absolute;
    inset: 0;
    z-index: 3;
    opacity: 0;
    pointer-events: none;
}
.preview-screen.is-short-crossfading .video-transition-layer {
    opacity: 1;
    transition: opacity var(--short-transition-duration, 350ms) linear;
}
.preview-screen .caption-transition-overlay {
    z-index: 4;
    opacity: 0;
    pointer-events: none;
}
.preview-screen .caption-transition-overlay .caption-box {
    pointer-events: none;
}
.preview-screen.is-short-crossfading .caption-transition-overlay {
    opacity: 1;
    transition: opacity var(--short-transition-duration, 350ms) linear;
}

/* Fullscreen preview — see the video at max size with captions overlaid. */
.preview-stage.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    padding: 18px;
    gap: 12px;
    border-radius: 0;
    /* The aspect-ratio-matched max/min-width above is meant for the inline
       grid layout only — fullscreen fills the viewport instead. */
    max-width: none;
    min-width: 0;
}
.preview-stage.is-fullscreen .preview-screen {
    border-radius: 0;
    background: #000;
    /* Fill the whole fullscreen area instead of staying capped at the 620px
       inline height, so the portrait video zooms to the max available size.
       Revert the inline aspect-ratio sizing too — object-fit: contain on the
       <video> itself already handles letterboxing here, same as before. */
    flex: 1 1 auto;
    align-self: stretch;
    width: 100%;
    max-width: 100%;
    aspect-ratio: auto;
    height: auto;
    min-height: 0;
}
.preview-stage.is-fullscreen .preview-dock {
    left: 50%;
    right: auto;
    bottom: 18px;
    width: min(900px, 90vw);
    transform: translate(-50%, 8px);
}
.preview-stage.is-fullscreen:hover .preview-dock,
.preview-stage.is-fullscreen:focus-within .preview-dock {
    transform: translate(-50%, 0);
}
.fullscreen-exit {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10000;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
}
.fullscreen-exit:hover { background: rgba(0, 0, 0, 0.75); }

.preview-rail {
    position: relative;
    top: auto;
    bottom: auto;
    z-index: 1;
    align-self: stretch;
    min-height: 0;
    border: 1px solid rgba(248, 250, 252, 0.10);
    background:
        linear-gradient(180deg, rgba(17, 22, 42, 0.88), rgba(7, 8, 20, 0.78));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 18px 40px rgba(0, 0, 0, 0.26);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.preview-rail {
    grid-column: 1;
    border-radius: var(--radius-lg);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}
.preview-inspector {
    grid-column: 2;
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.preview-panel-title {
    padding: 4px 6px 8px;
    font-size: var(--text-2xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.preview-tool {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    color: var(--color-text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    text-align: left;
    cursor: pointer;
    transition:
        background var(--duration-fast) var(--ease-out),
        color var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out);
}
.preview-tool:hover {
    color: var(--color-text);
    background: rgba(248, 250, 252, 0.055);
}
.preview-tool.is-active {
    color: var(--color-text);
    background: rgba(225, 29, 72, 0.14);
    border-color: rgba(225, 29, 72, 0.35);
}
.preview-tool:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.preview-tool > svg {
    width: 16px;
    height: 16px;
    color: var(--color-accent);
    flex-shrink: 0;
}
.preview-rail-note {
    margin-top: auto;
    padding: 10px;
    border: 1px dashed rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-md);
    color: var(--color-text-subtle);
    font-size: var(--text-2xs);
    line-height: var(--leading-snug);
}

/* Transport dock — overlays the player so it doesn't push the edit timeline down. */
.preview-dock {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    z-index: 4;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 8px 10px;
    background: rgba(17, 22, 42, 0.88);
    border: 1px solid rgba(248, 250, 252, 0.14);
    border-radius: var(--radius-md);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38), var(--shadow-xs);
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition:
        opacity 140ms var(--ease-out),
        transform 140ms var(--ease-out);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.preview-stage:hover .preview-dock,
.preview-stage:focus-within .preview-dock {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.preview-stage.is-detect-region-editing .preview-dock {
    display: none;
}
.video-controls-row {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
    row-gap: 6px;
}
.preview-dock .controls-group { display: flex; align-items: center; gap: var(--space-xs); flex-shrink: 0; }
.preview-dock .timeline {
    width: 100%;
    height: 28px;
    border-radius: var(--radius-sm);
}
.preview-dock .timeline-track {
    height: 4px;
}
.preview-dock .btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}
.preview-dock #btn-play {
    width: 34px;
    height: 34px;
}
.preview-dock .time-display {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-subtle);
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.preview-dock .select-wrap { flex-shrink: 0; width: auto; margin-left: auto; }
.preview-dock .select {
    min-width: 64px;
    height: 34px;
    padding-left: var(--space-sm);
    padding-right: var(--space-xl);
    font-size: var(--text-xs);
}

/* Timeline zoom control */
.zoom-control {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-elev-1);
}
.zoom-control .btn-icon { width: 26px; height: 26px; }
.zoom-control .btn:disabled { opacity: 0.4; cursor: not-allowed; }
.zoom-level {
    min-width: 46px;
    height: 26px;
    padding: 0 6px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.zoom-level:hover { background: rgba(248, 250, 252, 0.06); color: var(--color-text); }

.density-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0 var(--space-md);
    font-size: var(--text-xs);
    color: var(--color-text-subtle);
}
.density-row .select-wrap { width: auto; }
.density-row .select { height: 28px; min-width: 88px; padding: 0 var(--space-xl) 0 var(--space-sm); font-size: var(--text-xs); }

.action-bar-progress { display: flex; align-items: center; gap: var(--space-sm); flex: 0 0 auto; width: 140px; }
.action-bar-progress .progress { flex: 1; }

.workspace-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}
.panel-section { border-bottom: 1px solid var(--color-border); }
.panel-section:last-of-type { border-bottom: 0; }
.panel-section-label {
    padding: 6px var(--space-md);
    background: var(--color-bg-elev-3);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-subtle);
}
.segment-strip {
    position: relative;
    min-height: 132px;
    min-width: 0;
    border: 0;
    border-radius: var(--radius-lg);
    background: transparent;
    overflow: visible;
    padding: 0;
    align-self: center;
    width: max-content;
}

/* Absolutely positioned so the inspector's (potentially tall) form content
   can't drive the video-wrapper grid row height — otherwise selecting a clip
   stretches the left video column and leaves an empty gap under the transport.
   The shell fills the stage-tall inspector column and scrolls internally. */
.inspector-empty,
.inspector-shell {
    position: absolute;
    inset: 0;
}
.inspector-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    text-align: center;
    color: var(--color-text-muted);
}
.inspector-empty .empty-state-icon {
    width: 40px;
    height: 40px;
    margin-bottom: var(--space-xs);
    border-radius: var(--radius-md);
    background: var(--color-bg-elev-3);
}
.inspector-empty .empty-state-icon > svg { width: 20px; height: 20px; }
.inspector-empty h4 {
    font-size: var(--text-lg);
    color: var(--color-text);
}
.inspector-empty p {
    max-width: 240px;
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-subtle);
}
.inspector-shell {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.inspector-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    background: rgba(248, 250, 252, 0.03);
}
.inspector-kicker {
    margin-bottom: 2px;
    font-size: var(--text-2xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-subtle);
}
.inspector-header h4 {
    font-size: var(--text-md);
}
.inspector-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
}
.preview-inspector .textarea {
    min-height: 96px;
    resize: vertical;
}
.inspector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}
.inspector-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(248, 250, 252, 0.03);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}
.segment-tts-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.segment-tts-select-wrap {
    flex: 1;
    min-width: 0;
}
.segment-tts-select {
    width: 100%;
}
.inspector-meta strong {
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}
.inspector-meta.is-stack {
    flex-direction: column;
    align-items: flex-start;
}
.inspector-footer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--color-border);
    background: rgba(248, 250, 252, 0.02);
}
.inspector-footer .btn {
    height: 32px;
    min-width: 0;
    padding-inline: 8px;
    font-size: var(--text-xs);
    justify-content: center;
}
.segment-edit-dialog-body {
    padding: 0;
}
.segment-edit-dialog .inspector-empty,
.segment-edit-dialog .inspector-shell {
    position: static;
    inset: auto;
}
.segment-edit-dialog .inspector-empty {
    min-height: 260px;
}
.segment-edit-dialog .inspector-shell {
    max-height: min(76vh, 680px);
}
.segment-edit-dialog .inspector-body {
    overflow-y: auto;
}
.segment-edit-dialog .textarea {
    min-height: 120px;
}
.segment-edit-dialog .inspector-footer {
    grid-template-columns: repeat(5, minmax(0, auto));
    justify-content: end;
}

/* ── Admin page ───────────────────────────────────────────────────────── */
.admin-page {
    height: 100%;
    overflow-y: auto;
    padding: var(--space-xl) var(--space-lg);
}
.admin-container { max-width: 960px; margin: 0 auto; }

.admin-header { margin-bottom: var(--space-xl); }
.admin-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-lg);
    flex-wrap: wrap;
}
.admin-header h2 { font-size: var(--text-2xl); margin-bottom: var(--space-xs); }
.admin-header p { color: var(--color-text-subtle); font-size: var(--text-sm); }

.admin-stats {
    display: flex;
    gap: var(--space-md);
}
.admin-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-bg-elev-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    min-width: 100px;
}
.admin-stat-value {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--color-accent);
}
.admin-stat-label {
    font-size: var(--text-xs);
    color: var(--color-text-subtle);
    margin-top: 2px;
}

.admin-create-card { margin-bottom: var(--space-lg); }
.admin-create-form {
    display: flex;
    gap: var(--space-md);
    align-items: flex-end;
    flex-wrap: wrap;
}
.admin-create-form .field { flex: 1; min-width: 180px; }
.admin-create-form .btn { flex-shrink: 0; }
.admin-create-hint {
    font-size: var(--text-xs);
    color: var(--color-text-subtle);
    margin-top: var(--space-sm);
}
.admin-create-hint code {
    padding: 2px 6px;
    background: var(--color-bg-elev-3);
    border-radius: var(--radius-xs);
    font-size: var(--text-2xs);
}

.admin-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}
.admin-list-header h3 {
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
}
.admin-search-wrap { width: 240px; }
.admin-search {
    height: 34px;
    font-size: var(--text-xs);
    padding-left: var(--space-md);
}

.admin-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.admin-row {
    display: grid;
    grid-template-columns: 40px 1fr 140px 130px auto;
    gap: var(--space-md);
    align-items: center;
    padding: var(--space-md);
    background: var(--color-bg-elev-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition:
        border-color var(--duration-fast) var(--ease-out),
        box-shadow var(--duration-fast) var(--ease-out),
        transform var(--duration-fast) var(--ease-out);
}
.admin-row:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
.admin-row-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-bg-elev-3);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    color: var(--color-accent);
    text-transform: uppercase;
    flex-shrink: 0;
}
.admin-row-main { min-width: 0; }
.admin-row-email {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-row-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-xs);
    color: var(--color-text-subtle);
}
.admin-role-badge {
    display: inline-flex;
    padding: 1px 6px;
    font-size: var(--text-2xs);
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-full);
    background: var(--color-accent-soft);
    color: var(--color-accent);
}
.admin-role-badge.role-user {
    background: var(--color-bg-elev-3);
    color: var(--color-text-subtle);
}
.admin-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-success);
    flex-shrink: 0;
}
.admin-status-dot.is-disabled { background: var(--color-text-subtle); }
.admin-row-main strong { display: block; font-size: var(--text-sm); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-row-main span { display: block; font-size: var(--text-xs); color: var(--color-text-subtle); }
.admin-row-actions { display: flex; gap: var(--space-xs); justify-content: flex-end; }

/* API Keys page reuses .admin-row but with 3 columns (avatar, main, actions) */
#api-key-list .admin-row { grid-template-columns: 40px 1fr auto; }

.api-usage-example {
    background: var(--color-bg-elev-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    font-size: var(--text-xs);
    overflow-x: auto;
    white-space: pre;
}

.api-key-reveal {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--color-accent-soft);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-lg);
}
.api-key-reveal-warning {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-accent);
    margin-bottom: var(--space-sm);
}
.api-key-reveal-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.api-key-reveal-row code {
    flex: 1;
    min-width: 220px;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg-elev-1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    overflow-x: auto;
    white-space: nowrap;
}

@media (max-width: 1024px) {
    #api-key-list .admin-row {
        grid-template-columns: 40px 1fr;
        grid-template-areas:
            "avatar main"
            "avatar actions";
    }
    #api-key-list .admin-row-actions { grid-area: actions; justify-content: flex-start; }

    .admin-row {
        grid-template-columns: 40px 1fr;
        grid-template-areas:
            "avatar main"
            "avatar limit"
            "avatar actions";
        gap: var(--space-sm) var(--space-md);
    }
    .admin-row-avatar { grid-area: avatar; align-self: start; }
    .admin-row-main { grid-area: main; }
    .admin-limit-input { grid-area: limit; }
    .admin-status-select { display: none; }
    .admin-row-actions { grid-area: actions; justify-content: flex-start; flex-wrap: wrap; }
    .admin-create-form { flex-direction: column; }
    .admin-create-form .field { min-width: 100%; }
    .admin-stats { flex-wrap: wrap; }
    .admin-header-top { flex-direction: column; }
    .admin-search-wrap { width: 100%; }
    .admin-list-header { flex-direction: column; align-items: stretch; gap: var(--space-sm); }
}

@media (hover: none) {
    .preview-dock {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
    .preview-stage.is-fullscreen .preview-dock {
        transform: translate(-50%, 0);
    }
}

@media (max-height: 820px) {
    .preview-screen {
        height: clamp(190px, 34vh, 360px);
    }
    .workspace-action-panel {
        padding: 8px;
    }
    .action-groups {
        gap: 6px;
    }
    .subtitle-editor {
        min-height: min(320px, 48vh);
    }
}

@media (max-height: 700px) {
    .preview-screen {
        height: clamp(150px, 30vh, 280px);
    }
    .video-wrapper {
        padding: 8px;
    }
    .workspace-action-panel {
        max-height: 100%;
        overflow: auto;
    }
    .subtitle-editor {
        min-height: min(260px, 48vh);
    }
}

@media (max-width: 768px) {
    .admin-page { padding: var(--space-md); }
    .admin-stat { min-width: 80px; padding: var(--space-sm) var(--space-md); }
    .admin-stat-value { font-size: var(--text-md); }
}

/* History dialog rows */
.history-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.history-row {
    display: grid;
    grid-template-columns: 1fr 110px 110px;
    gap: var(--space-md);
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg-elev-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}
.history-row.is-today { border-color: var(--color-success); background: var(--color-success-soft); }
.history-row .history-amount { font-family: var(--font-mono); font-weight: var(--weight-semibold); text-align: right; }
.history-row .history-remaining { color: var(--color-text-subtle); font-size: var(--text-xs); text-align: right; }

/* ── SRT modal panels ────────────────────────────────────────────────── */
.srt-workbench {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    min-height: 0;
}
.srt-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    align-items: start;
}
.srt-panel { display: flex; flex-direction: column; min-height: 0; }
.srt-panel .card-body {
    max-height: 60vh;
    overflow-y: auto;
}
.translate-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-elev-1);
}
.translate-toolbar.srt-settings {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(7, 8, 20, 0.36);
    padding: var(--space-md);
}
.translate-toolbar .field { gap: 4px; }
.translate-toolbar .field-grow { flex: 1; min-width: 160px; }
.translate-toolbar .progress { width: 100%; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .workspace { gap: var(--space-sm); }
    .subtitle-editor-body { padding: var(--space-sm); }
    .srt-panels { grid-template-columns: 1fr; }
    .video-wrapper {
        grid-template-columns: 1fr;
        padding: 8px;
    }
    .preview-stage {
        /* Below the breakpoint the panel drops under the video instead of
           beside it, so there's no wide column to reclaim — go back to
           filling the available width like before. */
        max-width: none;
    }
    .preview-screen {
        align-self: stretch;
        width: 100%;
        max-width: 100%;
        aspect-ratio: auto;
    }
    .workspace-action-panel {
        grid-column: 1;
    }
    .workspace-action-panel .btn {
        padding-inline: var(--space-sm);
    }
    .preview-rail { display: none; }
    .preview-stage { gap: 8px; }
    .preview-screen {
        height: clamp(280px, 48vh, 440px);
    }
    .preview-screen video { width: 100%; }
    .inspector-grid { grid-template-columns: 1fr; }
    .audio-tool-grid { grid-template-columns: 1fr; }
    .audio-fields { grid-template-columns: repeat(3, minmax(96px, 1fr)); }
}

@media (max-width: 768px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
        min-height: 100vh;
    }
    .sidebar {
        flex-direction: row;
        align-items: center;
        height: var(--navbar-height);
        border-right: 0;
        border-bottom: 1px solid var(--color-border);
        padding: 0 var(--space-md);
        gap: var(--space-md);
    }
    .sidebar-brand { border-bottom: 0; height: auto; padding: 0; }
    .sidebar-nav {
        flex-direction: row;
        padding: 0;
        flex: 1;
        overflow-x: auto;
    }
    .sidebar-nav-item { width: auto; height: 36px; padding: 0 var(--space-md); }
    .sidebar-nav-item[aria-current="page"]::before { display: none; }
    .sidebar-footer { flex-direction: row; padding: 0; border-top: 0; }
    .sidebar-collapse-btn { display: none; }
    .sidebar-credit { display: none; }
    .navbar { display: none; }
    .main-content { padding: var(--space-md); }
    .preview-screen {
        height: clamp(240px, 52vh, 420px);
    }
    .video-controls-row { flex-wrap: wrap; }
    .admin-page { padding: var(--space-md); }
    .preview-dock .time-display { min-width: 0; font-size: var(--text-2xs); }
    .action-groups {
        grid-template-columns: 1fr;
    }
    .subtitle-editor-header { align-items: stretch; }
    .audio-editor-actions { width: 100%; justify-content: space-between; }
    .audio-preview { grid-template-columns: 1fr; }
    .audio-fields { grid-template-columns: repeat(2, minmax(104px, 1fr)); }
}

@media (max-width: 480px) {
    .auth-card { padding: var(--space-lg); }
    .upload-wrapper .dropzone { padding: var(--space-xl) var(--space-md); }
    .main-content { padding: var(--space-sm); }
    .audio-fields { grid-template-columns: 1fr; }
}

@media (max-height: 820px) {
    .preview-screen {
        height: clamp(190px, 34vh, 360px);
    }
    .workspace-action-panel {
        max-height: clamp(190px, 34vh, 360px);
    }
}

@media (max-height: 700px) {
    .preview-screen {
        height: clamp(150px, 30vh, 280px);
    }
    .workspace-action-panel {
        max-height: clamp(150px, 30vh, 280px);
    }
    .subtitle-editor {
        min-height: min(260px, 48vh);
    }
}
