/* ============================================================
   Studio Recorder — dark console aesthetic
   ============================================================ */

:root {
    --bg: #0a0b0f;
    --bg-glow-1: #171a2b;
    --bg-glow-2: #0f1520;
    --panel: #14161d;
    --panel-2: #191c25;
    --panel-hi: #1f2430;
    --border: #262a35;
    --border-hi: #333949;
    --text: #eceef4;
    --text-dim: #a2a8b8;
    --text-mute: #6b7183;
    --accent: #7c8cff;
    --accent-hi: #96a3ff;
    --accent-soft: rgba(124, 140, 255, 0.14);
    --rec: #ff4d5e;
    --rec-soft: rgba(255, 77, 94, 0.16);
    --ok: #34d399;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-lift: 0 18px 50px -20px rgba(0, 0, 0, 0.75);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

/* ---------- Light theme ---------- */
:root[data-theme="light"] {
    --bg: #eef1f6;
    --bg-glow-1: #dee4f6;
    --bg-glow-2: #e7ebf6;
    --panel: #ffffff;
    --panel-2: #f4f6fa;
    --panel-hi: #e8ecf3;
    --border: #e3e7ef;
    --border-hi: #cdd4e0;
    --text: #191d28;
    --text-dim: #4c5364;
    --text-mute: #8790a2;
    --accent: #5b6cff;
    --accent-hi: #4a5bef;
    --accent-soft: rgba(91, 108, 255, 0.12);
    --rec: #ef4356;
    --rec-soft: rgba(239, 67, 86, 0.12);
    --ok: #10b981;
    --shadow-lift: 0 18px 44px -22px rgba(30, 42, 80, 0.30);
}
/* Light-theme fixes for a few spots that assumed a dark background */
:root[data-theme="light"] .btn-primary { color: #fff; }
:root[data-theme="light"] .btn-primary kbd { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.3); color: #fff; }
:root[data-theme="light"] .seg button.active,
:root[data-theme="light"] .tpl-name { color: #fff; }
:root[data-theme="light"] .status-pill[data-state="recording"] { color: #b42334; }
:root[data-theme="light"] .status-pill[data-state="paused"] { color: #b45309; }
:root[data-theme="light"] .status-pill[data-state="review"] { color: #047857; }
:root[data-theme="light"] .toast.error { background: #fff2f3; color: #7a1420; }
:root[data-theme="light"] .btn-record kbd { color: #fff; }

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Smoothly cross-fade colours while switching theme (class is added only during the toggle) */
:root.theming, :root.theming * {
    transition: background-color .35s ease, color .35s ease, border-color .35s ease,
                fill .35s ease, box-shadow .35s ease, outline-color .35s ease !important;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; flex: none;
    background: var(--panel); border: 1px solid var(--border); border-radius: 9px;
    color: var(--text-dim); cursor: pointer; transition: background .2s, border-color .2s, color .2s;
}
.theme-toggle:hover { background: var(--panel-hi); border-color: var(--border-hi); color: var(--text); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
:root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }

/* The `hidden` attribute must always win, even over class rules that set an
   explicit display (.stage-empty, .btn, .field, .stage-media …). Without this,
   hidden elements like the "Nothing captured yet" placeholder stay visible. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(1100px 600px at 82% -8%, var(--bg-glow-1), transparent 60%),
        radial-gradient(900px 700px at -6% 100%, var(--bg-glow-2), transparent 55%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.app {
    max-width: 1280px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 22px clamp(16px, 3vw, 34px) 40px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* ---------- Top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 4px;
}

.brand { display: flex; align-items: center; gap: 11px; }

.brand-logo {
    display: block;
    filter: drop-shadow(0 2px 10px rgba(124, 140, 255, 0.45));
}

.brand-name { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.brand-name span { color: var(--accent-hi); font-weight: 650; }

.statusbar { display: flex; align-items: center; gap: 18px; }

.status-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 13px 7px 11px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12.5px; font-weight: 550;
    color: var(--text-dim);
    transition: color .25s, border-color .25s, background .25s;
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-mute); transition: background .25s, box-shadow .25s;
}
.status-pill[data-state="recording"] { color: #ffd7db; border-color: rgba(255,77,94,.4); background: var(--rec-soft); }
.status-pill[data-state="recording"] .status-dot { background: var(--rec); box-shadow: 0 0 0 4px var(--rec-soft); animation: blink 1.1s infinite; }
.status-pill[data-state="paused"] { color: #ffe6b0; border-color: rgba(245,158,11,.35); }
.status-pill[data-state="paused"] .status-dot { background: #f59e0b; }
.status-pill[data-state="review"] { color: #bff0dc; border-color: rgba(52,211,153,.35); }
.status-pill[data-state="review"] .status-dot { background: var(--ok); }

@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.readout { display: flex; align-items: baseline; gap: 8px; font-family: var(--mono); }
.readout-timer { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.readout-sep { color: var(--text-mute); }
.readout-size { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ---------- Workspace ---------- */
.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 336px;
    gap: 22px;
    align-items: start;
}

/* ---------- Stage ---------- */
.stage { display: flex; flex-direction: column; gap: 18px; }

.stage-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    background:
        repeating-conic-gradient(#0e1016 0% 25%, #0b0d12 0% 50%) 50% / 26px 26px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lift);
}

.stage-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage-media[hidden] { display: none; }

.stage-empty {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; text-align: center; color: var(--text-mute);
    background: radial-gradient(400px 260px at 50% 42%, rgba(124,140,255,.06), transparent 70%);
}
.stage-empty-glyph { color: var(--border-hi); margin-bottom: 8px; }
.stage-empty-title { font-size: 15px; font-weight: 600; color: var(--text-dim); }
.stage-empty-sub { font-size: 13px; }
.stage-empty kbd { margin: 0 2px; }

.rec-badge {
    position: absolute; top: 14px; left: 14px;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 11px; border-radius: 999px;
    background: rgba(10,11,15,.72); backdrop-filter: blur(8px);
    border: 1px solid rgba(255,77,94,.5);
    color: #ffdce0; font-size: 12px; font-weight: 700; letter-spacing: .08em;
}
.rec-badge[hidden] { display: none; }
.rec-badge span { width: 8px; height: 8px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 10px var(--rec); animation: blink 1.1s infinite; }
.rec-badge.paused span { animation: none; background: #f59e0b; box-shadow: none; }

.countdown {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(8,9,13,.66); backdrop-filter: blur(3px); z-index: 3;
}
.countdown[hidden] { display: none; }
.countdown span {
    font-size: clamp(72px, 16vw, 150px); font-weight: 700; color: #fff;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 40px rgba(124,140,255,.6);
    animation: pop .95s ease-out;
}
@keyframes pop { 0% { transform: scale(.5); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }

/* ---------- Transport ---------- */
.transport { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.btn {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 12px 18px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text);
    cursor: pointer; user-select: none;
    transition: transform .12s ease, background .2s, border-color .2s, opacity .2s, box-shadow .2s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn kbd { margin-left: 2px; }

.btn-ghost { background: var(--panel); border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-hi); border-color: var(--border-hi); color: var(--text); }

.btn-primary { background: var(--accent); color: #0b0d16; box-shadow: 0 8px 22px -10px rgba(124,140,255,.9); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hi); }
.btn-primary kbd { background: rgba(11,13,22,.25); border-color: rgba(11,13,22,.2); color: #10131f; }

.btn-record {
    background: var(--rec); color: #fff; padding-left: 15px;
    box-shadow: 0 8px 24px -10px rgba(255,77,94,.9);
}
.btn-record:hover:not(:disabled) { background: #ff6373; }
.btn-record .btn-record-ring {
    width: 13px; height: 13px; border-radius: 50%;
    background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.3);
    transition: border-radius .2s, width .2s, height .2s;
}
.btn-record kbd { background: rgba(0,0,0,.2); border-color: rgba(0,0,0,.15); color: #fff; }
.btn-record.is-recording .btn-record-ring { border-radius: 3px; width: 12px; height: 12px; }

/* ---------- Trim ---------- */
.trim {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px 18px;
}
.trim-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.trim-title { font-size: 13px; font-weight: 650; letter-spacing: .01em; }
.trim-range { font-family: var(--mono); font-size: 12.5px; color: var(--accent-hi); }

.trim-track { position: relative; height: 30px; }
.trim-track::before {
    content: ""; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
    height: 8px; border-radius: 5px; background: var(--panel-hi); border: 1px solid var(--border);
}
.trim-fill {
    position: absolute; top: 50%; transform: translateY(-50%); height: 8px;
    border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--accent-hi));
}
.trim-handle {
    position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 30px;
    -webkit-appearance: none; appearance: none; background: transparent; pointer-events: none; margin: 0;
}
.trim-handle::-webkit-slider-thumb {
    -webkit-appearance: none; pointer-events: auto; width: 16px; height: 26px;
    border-radius: 5px; background: #fff; border: 2px solid var(--accent);
    cursor: ew-resize; box-shadow: 0 3px 10px rgba(0,0,0,.5);
}
.trim-handle::-moz-range-thumb {
    pointer-events: auto; width: 14px; height: 24px; border-radius: 5px;
    background: #fff; border: 2px solid var(--accent); cursor: ew-resize;
}
.trim-note { margin-top: 12px; font-size: 12px; color: var(--text-mute); line-height: 1.5; }

/* ---------- Rail / panels ---------- */
.rail { display: flex; flex-direction: column; gap: 14px; }

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.panel-feature { border-color: var(--border-hi); background: linear-gradient(180deg, rgba(124,140,255,.05), transparent 40%), var(--panel); }

.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 16px; border-bottom: 1px solid var(--border);
}
.panel-head.static { border-bottom: 1px solid var(--border); }
.panel-title { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 650; letter-spacing: -0.01em; margin-right: auto; }

/* Collapsible panels */
.panel-head.collapsible { cursor: pointer; user-select: none; }
.panel-head.collapsible:hover .panel-chevron { border-color: var(--text-dim); }
.panel-chevron {
    flex: none; width: 8px; height: 8px; margin-left: 4px;
    border-right: 2px solid var(--text-mute); border-bottom: 2px solid var(--text-mute);
    transform: rotate(45deg) translate(-1px, -1px); transition: transform .2s;
}
.panel.collapsed .panel-chevron { transform: rotate(-45deg) translate(-1px, 1px); }
.panel.collapsed .panel-head { border-bottom-color: transparent; }
.panel-badge {
    font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: var(--accent-hi); background: var(--accent-soft); padding: 3px 7px; border-radius: 6px;
}
.panel-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; overflow: hidden; transition: max-height .28s ease, padding .28s ease; }
.panel-body[hidden] { display: none; }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 9px; }
.field-inset { padding: 14px; margin-top: 2px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.field-label { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 550; color: var(--text-dim); }
.field-val { font-family: var(--mono); font-size: 11.5px; color: var(--accent-hi); }

/* Rows (toggles) */
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row + .row { padding-top: 16px; border-top: 1px solid var(--border); margin-top: 0; }
.row-label { display: flex; flex-direction: column; gap: 3px; }
.row-label > span:first-child { font-size: 13px; font-weight: 550; }
.row-sub { font-size: 11.5px; color: var(--text-mute); line-height: 1.35; }
.row.disabled { opacity: .45; }

/* ---------- Segmented control ---------- */
.seg {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    gap: 4px; padding: 4px; background: var(--panel-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.seg button {
    padding: 8px 6px; border: none; border-radius: 6px; background: transparent;
    color: var(--text-dim); font-family: inherit; font-size: 12.5px; font-weight: 550;
    cursor: pointer; transition: background .18s, color .18s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--accent); color: #0b0d16; font-weight: 650; }
.seg-icons button { font-size: 15px; line-height: 1; }

/* ---------- Swatches ---------- */
.swatches { display: flex; gap: 9px; flex-wrap: wrap; }
.sw {
    width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
    border: 2px solid transparent; outline: 1px solid var(--border);
    background: linear-gradient(135deg, var(--a), var(--b) 50%, var(--c));
    transition: transform .14s, border-color .18s;
}
.sw-solid { background: var(--a); }
.sw:hover { transform: translateY(-2px); }
.sw.active { border-color: #fff; outline-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Slider ---------- */
.slider {
    -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
    border-radius: 4px; background: var(--panel-hi); border: 1px solid var(--border);
    cursor: pointer;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 17px; height: 17px; border-radius: 50%;
    background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.slider::-moz-range-thumb {
    width: 15px; height: 15px; border-radius: 50%; background: #fff;
    border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.5);
}

/* ---------- Switch ---------- */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
    position: absolute; inset: 0; border-radius: 999px;
    background: var(--panel-hi); border: 1px solid var(--border); transition: background .22s, border-color .22s;
}
.switch-track::before {
    content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
    border-radius: 50%; background: var(--text-mute); transition: transform .22s, background .22s;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::before { transform: translateX(18px); background: #fff; }
.switch input:disabled + .switch-track { opacity: .4; }

.rail-foot { font-size: 11.5px; color: var(--text-mute); text-align: center; padding: 4px 8px; line-height: 1.5; }

/* ---------- kbd ---------- */
kbd {
    display: inline-block; min-width: 18px; padding: 1px 5px; text-align: center;
    font-family: var(--mono); font-size: 10.5px; font-weight: 600; line-height: 1.5;
    color: var(--text-dim); background: var(--panel-2);
    border: 1px solid var(--border-hi); border-bottom-width: 2px; border-radius: 5px;
}

/* ---------- Modal ---------- */
.modal {
    position: fixed; inset: 0; z-index: 50;
    display: flex; align-items: center; justify-content: center;
    background: rgba(6,7,10,.72); backdrop-filter: blur(6px);
}
.modal[hidden] { display: none; }
.modal-card {
    width: min(360px, 90vw); padding: 30px; text-align: center;
    background: var(--panel); border: 1px solid var(--border-hi);
    border-radius: 18px; box-shadow: var(--shadow-lift);
}
.spinner {
    width: 42px; height: 42px; margin: 0 auto 18px; border-radius: 50%;
    border: 3px solid var(--panel-hi); border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-sub { font-size: 12.5px; color: var(--text-mute); margin-top: 6px; }
.modal-bar { margin-top: 18px; height: 6px; border-radius: 4px; background: var(--panel-hi); overflow: hidden; }
.modal-bar-fill { height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); transition: width .2s; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .workspace { grid-template-columns: 1fr; }
    .rail { order: 2; }
    .statusbar { gap: 12px; }
}
@media (max-width: 560px) {
    .app { padding: 16px 14px 32px; }
    .readout-size { display: none; }
    .transport .btn { flex: 1 1 auto; justify-content: center; }
    .btn kbd, .btn-record kbd { display: none; }
}

/* ---------- Presets ---------- */
.preset-row { display: flex; gap: 8px; align-items: center; }
.preset-select {
    flex: 1; min-width: 0; padding: 9px 10px;
    background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-family: inherit; font-size: 12.5px; cursor: pointer;
}
.preset-select:focus { outline: none; border-color: var(--accent); }
.mini-btn {
    flex: none; padding: 9px 12px; border-radius: var(--radius-sm);
    background: var(--panel-2); border: 1px solid var(--border); color: var(--text-dim);
    font-family: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer;
    transition: background .18s, border-color .18s, color .18s;
}
.mini-btn:hover { background: var(--panel-hi); border-color: var(--border-hi); color: var(--text); }
.mini-btn-accent { background: var(--accent); color: #0b0d16; border-color: var(--accent); }
.mini-btn-accent:hover { background: var(--accent-hi); color: #0b0d16; }
.mini-btn-icon { padding: 9px 11px; }

/* ---------- Upload swatch ---------- */
.sw-upload {
    display: flex; align-items: center; justify-content: center;
    background: var(--panel-2); color: var(--text-mute);
    font-size: 20px; font-weight: 400; line-height: 1;
    background-size: cover; background-position: center;
}
.sw-upload.has-image { color: transparent; }

/* ---------- Focus overlay (zoom targeting) ---------- */
.focus-overlay {
    position: absolute; inset: 0; z-index: 4; cursor: crosshair;
    background: rgba(8, 9, 13, 0.32);
}
.focus-overlay[hidden] { display: none; }
.focus-hint {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 550;
    background: rgba(10, 11, 15, 0.82); color: var(--text); border: 1px solid var(--border-hi);
}
.focus-marker {
    position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px;
    border: 2px solid #fff; border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(124,140,255,.7), 0 0 20px rgba(124,140,255,.6);
    left: 50%; top: 50%; pointer-events: none;
}
.focus-marker::after {
    content: ""; position: absolute; inset: 18px; border-radius: 50%; background: #fff;
}

/* ---------- Cut sections ---------- */
.cut-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.cut-actions { display: flex; gap: 8px; }
.cut-track {
    position: relative; height: 26px; margin: 12px 0;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.cut-band {
    position: absolute; top: 0; bottom: 0;
    background: repeating-linear-gradient(45deg, rgba(255,77,94,.5) 0 6px, rgba(255,77,94,.32) 6px 12px);
    border-left: 1px solid var(--rec); border-right: 1px solid var(--rec);
}
.cut-pending {
    position: absolute; top: 0; bottom: 0;
    background: rgba(255,77,94,.18); border-left: 2px solid var(--rec);
}
.cut-playhead { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.6); }
.cut-btn-armed { background: var(--rec) !important; color: #fff !important; border-color: var(--rec) !important; }

/* ---------- Zoom section ---------- */
.zoom-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.zoom-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.zoom-list { display: flex; flex-wrap: wrap; gap: 8px; }
.zoom-list:empty { display: none; }
.zoom-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 8px 6px 11px; border-radius: 999px;
    background: var(--panel-2); border: 1px solid var(--border);
    font-family: var(--mono); font-size: 12px; color: var(--text-dim); cursor: pointer;
    transition: border-color .15s, color .15s;
}
.zoom-chip:hover { border-color: var(--border-hi); color: var(--text); }
.zoom-chip.editing { border-color: var(--accent); color: var(--text); }
.zoom-chip button {
    border: none; background: transparent; color: var(--text-mute);
    font-size: 15px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.zoom-chip button:hover { color: var(--rec); }
.zoom-editor {
    margin-top: 12px; padding: 14px; background: var(--panel-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    display: flex; flex-direction: column; gap: 10px;
}
.zoom-editor[hidden] { display: none; }
.zoom-hint { font-size: 12px; color: var(--text-mute); }
.zoom-editor-actions { display: flex; gap: 8px; }

/* ---------- Paused overlay ---------- */
.paused-overlay {
    position: absolute; inset: 0; z-index: 2;
    display: flex; align-items: center; justify-content: center;
    background: rgba(8, 9, 13, 0.5); backdrop-filter: blur(2px);
}
.paused-overlay[hidden] { display: none; }
.paused-overlay span {
    font-size: 20px; font-weight: 650; letter-spacing: .04em; color: #ffe6b0;
    padding: 12px 22px; border-radius: 999px;
    background: rgba(10, 11, 15, 0.7); border: 1px solid rgba(245, 158, 11, 0.4);
}

/* ---------- Dialog (custom confirm/prompt) ---------- */
.dialog-backdrop {
    position: fixed; inset: 0; z-index: 70;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(6, 7, 10, 0.72); backdrop-filter: blur(6px);
}
.dialog-backdrop[hidden] { display: none; }
.dialog-card {
    width: min(420px, 100%); padding: 24px;
    background: var(--panel); border: 1px solid var(--border-hi);
    border-radius: 16px; box-shadow: var(--shadow-lift);
    animation: dialogIn .16s ease-out;
}
@keyframes dialogIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog-title { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 8px; }
.dialog-title[hidden], .dialog-msg[hidden] { display: none; }
.dialog-msg { font-size: 13.5px; line-height: 1.5; color: var(--text-dim); }
.dialog-input {
    width: 100%; margin-top: 16px; padding: 11px 13px;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-family: inherit; font-size: 14px;
}
.dialog-input[hidden] { display: none; }
.dialog-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dialog-actions .btn { min-width: 92px; justify-content: center; }
.btn-danger { background: var(--rec); color: #fff; box-shadow: 0 8px 22px -10px rgba(255,77,94,.9); }
.btn-danger:hover:not(:disabled) { background: #ff6373; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(8px);
    z-index: 60; max-width: min(560px, 92vw);
    display: flex; align-items: center; gap: 14px;
    padding: 13px 16px 13px 18px;
    background: var(--panel-hi); border: 1px solid var(--border-hi);
    border-radius: 12px; box-shadow: var(--shadow-lift);
    font-size: 13.5px; line-height: 1.45; color: var(--text);
    opacity: 0; transition: opacity .2s, transform .2s;
}
.toast:not([hidden]) { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[hidden] { display: none; }
.toast.error { border-color: rgba(255, 77, 94, 0.5); background: #221317; }
.toast.error::before { content: "⚠"; color: var(--rec); font-size: 16px; }
.toast.info::before { content: "ℹ"; color: var(--accent-hi); font-size: 15px; }
.toast button {
    flex: none; margin-left: auto; width: 24px; height: 24px; border-radius: 6px;
    border: none; background: transparent; color: var(--text-mute);
    font-size: 19px; line-height: 1; cursor: pointer; transition: background .15s, color .15s;
}
.toast button:hover { background: rgba(255,255,255,.08); color: var(--text); }

/* Fallback / unsupported banner */
.fatal {
    margin: 40px auto; max-width: 520px; padding: 26px 28px;
    background: var(--panel); border: 1px solid var(--border-hi); border-radius: var(--radius);
    text-align: center; color: var(--text-dim); line-height: 1.6;
}
.fatal h2 { color: var(--text); font-size: 17px; margin-bottom: 8px; }
