:root {
    color-scheme: dark;
    --app-bg: #0d0f12;
    --chrome: #15171b;
    --panel: #181b20;
    --panel-raised: #20242a;
    --surface: #24282f;
    --surface-hover: #2c3139;
    --text: #f3f4f6;
    --muted: #9299a5;
    --faint: #666e7a;
    --border: rgba(255, 255, 255, .09);
    --border-strong: rgba(255, 255, 255, .15);
    --accent: #7c6cf2;
    --accent-hover: #8c7ef5;
    --accent-soft: rgba(124, 108, 242, .16);
    --danger: #f05d6c;
    --danger-soft: rgba(240, 93, 108, .13);
    --success: #42c892;
    --warning: #f1a84b;
    --radius-sm: 6px;
    --radius: 9px;
    --topbar-height: 58px;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    color: var(--text);
    background: var(--app-bg);
    font: 13px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button,
a,
select,
input {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button {
    color: inherit;
}

svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.editor-app {
    display: grid;
    grid-template-rows: var(--topbar-height) minmax(0, 1fr);
    width: 100vw;
    height: 100vh;
    background: var(--app-bg);
}

.editor-topbar {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-width: 0;
    padding: 0 14px 0 16px;
    border-bottom: 1px solid var(--border);
    background: var(--chrome);
}

.editor-brand,
.toolbar-actions,
.toolbar-button,
.transport-left,
.preview-transport,
.section-heading,
.button-row,
.dialog-title-wrap {
    display: flex;
    align-items: center;
}

.editor-brand {
    min-width: 0;
    gap: 11px;
}

.brand-mark {
    display: grid;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 8px;
    background: #252931;
    color: #d9d6ff;
}

.brand-mark svg {
    width: 18px;
    height: 18px;
}

.project-identity {
    min-width: 0;
}

.project-identity strong {
    display: block;
    margin-bottom: 1px;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.toolbar-session {
    display: block;
    max-width: min(46vw, 600px);
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toolbar-session strong {
    color: #c7ccd4;
    font-size: inherit;
    font-weight: 500;
}

.toolbar-actions {
    flex: 0 0 auto;
    gap: 6px;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    margin: 0 4px;
    background: var(--border);
}

.auth-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 4px;
    padding-left: 10px;
    border-left: 1px solid var(--border);
}

.auth-user.hidden {
    display: none;
}

.auth-user-name {
    max-width: 180px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toolbar-button,
.primary-action,
.secondary-action,
.text-action,
.text-button,
.icon-button,
.transport-button {
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, opacity 120ms ease;
}

.toolbar-button {
    min-height: 34px;
    gap: 7px;
    padding: 7px 11px;
    border-color: var(--border);
    border-radius: 7px;
    background: transparent;
    color: #c8cdd5;
    font-weight: 550;
    text-decoration: none;
}

.toolbar-button:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: var(--surface);
    color: #fff;
}

.toolbar-button.primary,
.primary-action {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.toolbar-button.primary:hover:not(:disabled),
.primary-action:hover:not(:disabled) {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
}

.toolbar-button.primary svg {
    width: 15px;
}

.toolbar-button.icon-only {
    width: 34px;
    justify-content: center;
    padding: 7px;
}

.polish-button {
    color: #d8d4ff;
}

.polish-button svg,
.polish-icon svg {
    fill: currentColor;
    stroke: none;
}

.polish-button.is-applied {
    border-color: rgba(124, 108, 242, .42);
    background: var(--accent-soft);
    color: #e4e1ff;
}

button:disabled,
.toolbar-button:disabled {
    cursor: not-allowed;
    opacity: .38;
}

.hidden-upload {
    position: fixed;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.editor-main,
.editor-workspace,
.editor-layout,
.preview-player,
.preview-canvas {
    min-width: 0;
    min-height: 0;
}

.editor-main {
    overflow: hidden;
}

.editor-workspace,
.editor-layout {
    width: 100%;
    height: 100%;
}

.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 304px;
}

.preview-player {
    display: grid;
    grid-template-rows: minmax(220px, 1fr) 44px auto;
    width: 100%;
    overflow: hidden;
    background: #101216;
}

.preview-canvas {
    display: grid;
    overflow: hidden;
    padding: 16px 18px;
    place-items: center;
    background: #0c0e11;
}

.preview-output-canvas {
    position: relative;
    display: grid;
    width: min(100%, 1200px);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    place-items: center;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
}

/* Compare mode: the untouched recording sits beside the edited one.
   justify-items must be stretch here — the base .preview-canvas centres its
   single child, which would leave both columns sized to content instead of
   splitting the space evenly. */
.preview-canvas.compare {
    /* minmax(0, 1fr), not 1fr: the edited canvas carries an explicit inline
       width, which as a column minimum would starve the original's column. */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    justify-items: stretch;
}

.raw-pane {
    position: relative;
    display: grid;
    width: 100%;
    min-width: 0;
    place-items: center;
}

/* Deliberately plain: no gradient, no frame, no rounding. Everything the
   edited pane adds should read as an edit. */
.raw-output-canvas {
    background: #16181d;
    border: 1px solid var(--border);
}

.pane-badge {
    position: absolute;
    z-index: 5;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(10, 12, 16, .78);
    color: #dfe4ec;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
    pointer-events: none;
}

.edited-badge {
    background: rgba(70, 106, 190, .85);
    color: #eef3ff;
}

/* Appears on the original pane whenever the edit skipped past something. */
.raw-skip-badge {
    position: absolute;
    z-index: 6;
    right: 8px;
    bottom: 8px;
    padding: 4px 9px;
    border-radius: 4px;
    background: rgba(214, 84, 96, .92);
    color: #fff;
    font-size: 10px;
    font-weight: 650;
    pointer-events: none;
}

.compare-button.is-active {
    background: rgba(93, 200, 245, .2);
    color: #9adcf8;
}

.preview-frame {
    position: absolute;
    display: grid;
    grid-template-rows: 22px minmax(0, 1fr);
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 22px 55px rgba(0, 0, 0, .42);
}

.preview-frame.no-browser {
    grid-template-rows: minmax(0, 1fr);
}

.preview-browser-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 0;
    padding: 0 8px;
    background: #f1f3f5;
}

.preview-frame.no-browser .preview-browser-bar {
    display: none;
}

.preview-browser-bar i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ff5f57;
}

.preview-browser-bar i:nth-child(2) { background: #febc2e; }
.preview-browser-bar i:nth-child(3) { background: #28c840; }
.preview-browser-bar span {
    width: 42%;
    height: 7px;
    margin-left: 5px;
    border-radius: 99px;
    background: #fff;
}

.preview-stage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #08090b;
}

.rrweb-preview {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #090a0c;
}

.rrweb-preview .replayer-wrapper {
    position: absolute !important;
    top: 0;
    left: 0;
    max-width: none !important;
    max-height: none !important;
    transform-origin: top left;
}

.rrweb-preview iframe {
    display: block;
    border: 0 !important;
    background: #fff;
}

.rrweb-preview .rr-controller,
.rrweb-preview .replayer-mouse {
    display: none !important;
}

.preview-custom-cursor {
    position: absolute;
    z-index: 20;
    display: none;
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.preview-click-effect {
    position: absolute;
    z-index: 19;
    display: none;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, .9);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(.25);
}

.preview-click-effect.ripple {
    display: block;
    animation: cursor-ripple 560ms ease-out both;
}

.preview-click-effect.pulse {
    display: block;
    border: 0;
    background: rgba(99, 102, 241, .42);
    animation: cursor-pulse 420ms ease-out both;
}

@keyframes cursor-ripple { to { opacity: 0; transform: translate(-50%, -50%) scale(1.15); } }
@keyframes cursor-pulse { 50% { transform: translate(-50%, -50%) scale(.7); } to { opacity: 0; transform: translate(-50%, -50%) scale(1); } }

.preview-empty {
    display: grid;
    height: 100%;
    place-content: center;
    justify-items: center;
    gap: 6px;
    color: var(--faint);
    text-align: center;
}

.preview-empty strong {
    color: #aeb4be;
    font-size: 14px;
    font-weight: 600;
}

.preview-empty > span:last-child {
    font-size: 12px;
}

.empty-icon {
    display: grid;
    width: 44px;
    height: 44px;
    margin-bottom: 7px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #15181d;
    color: #757d89;
}

.empty-icon svg {
    width: 20px;
    height: 20px;
}

.preview-transport {
    position: relative;
    justify-content: center;
    gap: 18px;
    padding: 0 14px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--chrome);
}

.transport-left {
    gap: 4px;
}

.transport-button,
.icon-button {
    display: inline-grid;
    width: 30px;
    height: 30px;
    padding: 0;
    place-items: center;
    border-radius: 6px;
    background: transparent;
    color: #aab1bc;
}

.transport-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
    background: var(--surface-hover);
    color: #fff;
}

.play-toggle {
    color: #fff;
}

.play-toggle .pause-icon,
.play-toggle.is-playing .play-icon {
    display: none;
}

.play-toggle.is-playing .pause-icon {
    display: block;
}

.play-toggle .play-icon {
    fill: currentColor;
    stroke: none;
}

/* Seek bar. The polish timeline is hidden in fullscreen, so without this there
   is no way to move the playhead there at all. */
.preview-scrubber {
    position: relative;
    flex: 1 1 auto;
    min-width: 80px;
    height: 30px;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
}

.scrub-rail {
    position: relative;
    width: 100%;
    height: 4px;
    border-radius: 99px;
    background: #3a4048;
    transition: height .12s ease;
}

.preview-scrubber:hover .scrub-rail,
.preview-scrubber.is-scrubbing .scrub-rail,
.preview-scrubber:focus-visible .scrub-rail {
    height: 6px;
}

.scrub-played {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0;
    border-radius: 99px;
    background: #5793f2;
}

.scrub-marks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Isolated moments, so the beats stay findable when the timeline is hidden. */
.scrub-mark {
    position: absolute;
    top: 50%;
    width: 3px;
    height: 3px;
    margin-top: -1.5px;
    border-radius: 50%;
    background: #9adcf8;
}

.scrub-handle {
    position: absolute;
    top: 50%;
    left: 0;
    width: 11px;
    height: 11px;
    margin: -5.5px 0 0 -5.5px;
    border-radius: 50%;
    background: #eef3ff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .55);
    opacity: 0;
    transition: opacity .12s ease;
}

.preview-scrubber:hover .scrub-handle,
.preview-scrubber.is-scrubbing .scrub-handle,
.preview-scrubber:focus-visible .scrub-handle {
    opacity: 1;
}

.preview-scrubber:focus-visible {
    outline: 2px solid #7aa7ff;
    outline-offset: 2px;
    border-radius: 4px;
}

.scrub-tooltip {
    position: absolute;
    bottom: 26px;
    padding: 2px 6px;
    transform: translateX(-50%);
    border-radius: 4px;
    background: rgba(10, 12, 16, .92);
    color: #e6eaf1;
    font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    white-space: nowrap;
}

/* Fullscreen has room to breathe, and the bar is the only way to seek there. */
.preview-player:fullscreen .preview-transport {
    gap: 14px;
    padding: 0 22px;
}

.preview-player:fullscreen .preview-scrubber {
    height: 38px;
}

.preview-player:fullscreen .scrub-rail {
    height: 5px;
}

.time-display {
    display: flex;
    min-width: 92px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #c7ccd4;
    font: 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

.time-divider {
    color: #525965;
}

.speed-select {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #858d99;
}

.speed-select svg {
    width: 15px;
    height: 15px;
}

.speed-select select {
    min-height: 28px;
    padding: 4px 24px 4px 6px;
    border: 0;
    border-radius: 5px;
    color: #bfc5ce;
    background: transparent;
    cursor: pointer;
}

.speed-select select:hover {
    background: var(--surface);
}

/* Compare and fullscreen sit in the row as a pair, like the play controls on
   the left. Fullscreen used to be pinned to the right edge with absolute
   positioning; the scrubber stretches to fill the bar, which put the compare
   button exactly there, one on top of the other. */
.transport-right {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
}

.fullscreen-button .fullscreen-exit-icon,
.fullscreen-button.is-fullscreen .fullscreen-enter-icon {
    display: none;
}

.fullscreen-button.is-fullscreen .fullscreen-exit-icon {
    display: block;
}

.preview-player:fullscreen {
    display: grid;
    grid-template-rows: minmax(0, 1fr) 52px;
    width: 100vw;
    height: 100vh;
    background: #08090b;
}

.preview-player:fullscreen .preview-canvas {
    padding: 20px;
}

.preview-player:fullscreen .polish-timeline-panel {
    display: none !important;
}

.preview-player:fullscreen .preview-transport {
    border-bottom: 0;
}

.polish-timeline-panel {
    width: 100%;
    min-width: 0;
    min-height: 224px;
    padding: 10px 14px 13px;
    border-top: 1px solid var(--border);
    background: #14171b;
}

.timeline-heading,
.inspector-title-row,
.section-heading,
.dialog-header,
.dialog-footer,
.range-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.timeline-heading h3,
.inspector-header h2,
.section-heading h3,
.dialog-header h2 {
    margin: 0;
    color: var(--text);
    font-weight: 600;
    letter-spacing: -.015em;
}

.timeline-heading h3 {
    font-size: 12px;
}

.timeline-heading .hint {
    margin: 1px 0 0;
    color: var(--faint);
    font-size: 10px;
}

.timeline-tools {
    display: flex;
    align-items: center;
    gap: 3px;
}

.timeline-tool {
    display: inline-flex;
    min-width: 25px;
    height: 25px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 5px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: #818995;
    cursor: pointer;
}

.timeline-tool:hover:not(:disabled) {
    border-color: var(--border);
    background: var(--surface);
    color: #fff;
}

.timeline-tool:disabled {
    cursor: not-allowed;
    opacity: .3;
}

.timeline-tool svg {
    width: 13px;
    height: 13px;
}

.timeline-tool.tool-with-label {
    padding: 0 7px;
    font-size: 9px;
    font-weight: 600;
}

.timeline-tool-separator {
    width: 1px;
    height: 17px;
    margin: 0 3px;
    background: var(--border);
}

.timeline-zoom-label {
    min-width: 31px;
    color: #777f8b;
    font: 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
    text-align: center;
}

.keycap-button {
    font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.timeline-scroll {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    margin-top: 7px;
    padding-bottom: 4px;
    scrollbar-color: #3b4049 transparent;
    scrollbar-width: thin;
}

.polish-timeline {
    position: relative;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 5px 8px;
    width: 100%;
    min-width: 100%;
    cursor: pointer;
}

.timeline-ruler-label,
.timeline-track-label {
    position: sticky;
    z-index: 6;
    left: 0;
    background: #14171b;
}

.timeline-ruler-label {
    display: flex;
    height: 18px;
    align-items: center;
    color: #555d69;
    font-size: 8px;
}

.timeline-ruler {
    position: relative;
    height: 18px;
    border-bottom: 1px solid var(--border);
}

.ruler-tick {
    position: absolute;
    bottom: 0;
    width: 1px;
    height: 5px;
    background: #4b525d;
    pointer-events: none;
}

.ruler-tick.major {
    height: 9px;
    background: #68717e;
}

.ruler-tick span {
    position: absolute;
    bottom: 8px;
    left: 4px;
    color: #656d78;
    font: 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
    white-space: nowrap;
}

.timeline-track-label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #7c838e;
    font-size: 10px;
    font-weight: 550;
}

.timeline-track-label::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #657080;
}

.zoom-label::before { background: #967bf4; }
.cursor-label::before { background: #37bd8d; }
.typing-label::before { background: #ee9a43; }
.scene-label::before { background: #5dc8f5; }

.timeline-track {
    position: relative;
    height: 30px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: #1a1d22;
}

.source-clip {
    position: absolute;
    top: 3px;
    bottom: 3px;
    overflow: hidden;
    min-width: 4px;
    min-height: 0;
    padding: 0;
    border: 1px solid rgba(87, 147, 242, .52);
    border-radius: 3px;
    background: rgba(62, 111, 188, .18);
    cursor: pointer;
    z-index: 0;
}

.source-clip:hover,
.source-clip.active {
    border-color: rgba(128, 176, 251, .95);
    background: rgba(62, 111, 188, .3);
}

.source-clip.active {
    outline: 2px solid rgba(207, 225, 255, .75);
    outline-offset: 1px;
}

.timeline-event-marker {
    position: absolute;
    top: 5px;
    bottom: 5px;
    width: 1px;
    background: #d98c37;
    opacity: .72;
    pointer-events: none;
}

.timeline-event-layer {
    position: absolute;
    z-index: 1;
    inset: 3px;
    overflow: hidden;
    border-radius: 3px;
    pointer-events: none;
}

.cursor-activity {
    position: absolute;
    top: 7px;
    bottom: 7px;
    min-width: 2px;
    border-radius: 999px;
    background: #38b98b;
    opacity: .78;
    pointer-events: none;
}

.timeline-clip,
.typing-activity,
.scene-clip,
.text-clip {
    position: absolute;
    top: 3px;
    bottom: 3px;
    min-width: 5px;
    min-height: 0;
    border-radius: 3px;
    cursor: pointer;
}

.clip-handle {
    position: absolute;
    z-index: 3;
    top: 0;
    bottom: 0;
    width: 6px;
    opacity: 0;
    background: rgba(255, 255, 255, .9);
    cursor: ew-resize;
    transition: opacity 100ms ease;
}

.clip-handle.start { left: 0; }
.clip-handle.end { right: 0; }

.timeline-clip:hover .clip-handle,
.timeline-clip.active .clip-handle,
.source-clip:hover .clip-handle,
.source-clip.active .clip-handle,
.scene-clip:hover .clip-handle,
.scene-clip.active .clip-handle,
.text-clip:hover .clip-handle,
.text-clip.active .clip-handle {
    opacity: .9;
}

.timeline-clip {
    padding: 0;
    border: 1px solid transparent;
}

.camera-clip {
    border-color: rgba(150, 123, 244, .9);
    background: rgba(124, 96, 220, .55);
}

.cut-clip {
    z-index: 2;
    border-color: rgba(240, 93, 108, .9);
    background: repeating-linear-gradient(-45deg, rgba(240, 93, 108, .68) 0 5px, rgba(154, 48, 63, .5) 5px 10px);
}

.cut-clip.loading-cut {
    border-color: rgba(241, 168, 75, .95);
    background: repeating-linear-gradient(-45deg, rgba(241, 168, 75, .72) 0 5px, rgba(150, 91, 31, .52) 5px 10px);
}

.cut-clip.mixed-cut {
    border-color: rgba(230, 118, 119, .95);
    background: repeating-linear-gradient(-45deg, rgba(240, 93, 108, .68) 0 5px, rgba(241, 168, 75, .68) 5px 10px);
}

.typing-activity {
    overflow: hidden;
    padding: 0 6px;
    border: 1px solid rgba(238, 154, 67, .82);
    background: rgba(186, 108, 34, .48);
    color: #ffe0bc;
    font-size: 9px;
    font-weight: 600;
    line-height: 22px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.typing-activity.corrected {
    border-color: rgba(66, 200, 146, .85);
    background: rgba(46, 151, 109, .48);
    color: #c8f7e5;
}

.scene-clip {
    overflow: hidden;
    padding: 0 6px;
    border: 1px solid rgba(93, 200, 245, .85);
    background: linear-gradient(180deg, rgba(56, 152, 209, .58), rgba(38, 106, 156, .5));
    color: #d8f2ff;
    font-size: 9px;
    font-weight: 600;
    line-height: 22px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The press is the click landing inside the scene; mark it so the climax is
   findable on the timeline without opening the inspector. */
.scene-press {
    position: absolute;
    z-index: 3;
    top: 2px;
    bottom: 2px;
    width: 2px;
    background: #fff2a8;
    box-shadow: 0 0 4px rgba(255, 226, 120, .9);
    pointer-events: none;
}

/* On-screen text ---------------------------------------------------------- */

.text-label::before { background: #f5b65d; }

.text-clip {
    overflow: hidden;
    padding: 0 6px;
    border: 1px solid rgba(245, 182, 93, .85);
    background: linear-gradient(180deg, rgba(209, 150, 56, .58), rgba(156, 108, 38, .5));
    color: #fff0d8;
    font-size: 9px;
    font-weight: 600;
    line-height: 22px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sits over the whole output canvas rather than inside the framed viewport, so
   captions stay put while the camera zooms and pans underneath -- matching
   #text-overlay-layer in the exporter page. */
.preview-text-layer {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Editor-only affordance: shows which caption the inspector is editing. It is
   never present in the export, which renders from the same evaluator without
   any selection concept. */
.preview-text-layer .is-selected {
    outline: 1.5px dashed rgba(255, 255, 255, .75);
    outline-offset: 3px;
}

.timeline-clip.active,
.scene-clip.active,
.text-clip.active,
.typing-activity.active {
    outline: 2px solid #e4e1ff;
    outline-offset: 1px;
    z-index: 2;
}

.polish-playhead {
    position: absolute;
    z-index: 4;
    top: 13px;
    bottom: 0;
    left: 66px;
    width: 1px;
    background: #f4f5f7;
    pointer-events: none;
}

.timeline-snap-guide {
    position: absolute;
    z-index: 5;
    top: 13px;
    bottom: 0;
    width: 1px;
    background: #6ee7c1;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(110, 231, 193, .12);
}

.polish-playhead span {
    position: absolute;
    top: -1px;
    left: -5px;
    width: 11px;
    height: 8px;
    border-radius: 3px 3px 1px 1px;
    background: #f4f5f7;
    cursor: ew-resize;
    pointer-events: auto;
}

.editor-controls {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    border-left: 1px solid var(--border);
    background: var(--panel);
    scrollbar-color: #3b4049 transparent;
    scrollbar-width: thin;
}

.inspector-header {
    position: sticky;
    z-index: 4;
    top: 0;
    padding: 14px 16px 13px;
    border-bottom: 1px solid var(--border);
    background: rgba(24, 27, 32, .95);
    backdrop-filter: blur(8px);
}

.inspector-header h2 {
    font-size: 14px;
}

.eyebrow,
.section-kicker {
    display: block;
    margin: 0 0 2px;
    color: var(--faint);
    font-size: 9px;
    font-weight: 650;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.inspector-section {
    display: grid;
    gap: 13px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.inspector-section.selected-edit {
    background: rgba(124, 108, 242, .055);
}

.section-heading {
    justify-content: flex-start;
    gap: 9px;
}

.section-heading h3 {
    font-size: 12px;
}

.section-icon,
.dialog-icon {
    display: grid;
    flex: 0 0 auto;
    width: 29px;
    height: 29px;
    place-items: center;
    border-radius: 7px;
    background: var(--surface);
    color: #aab2be;
}

.section-icon svg {
    width: 15px;
    height: 15px;
}

.cursor-section-icon { color: #72d8b4; }
.typing-section-icon { color: #ee9a43; }

/* Small explanatory line under a control in the inspector. */
.field-hint {
    margin: -2px 0 0;
    color: #6d757f;
    font-size: 10px;
    line-height: 1.4;
}

.field-hint.is-inactive {
    color: #d09a5a;
}

/* Groups the canvas-only controls so "no background" can hide them as one,
   without adding a box of its own to the section's grid. */
.canvas-decoration {
    display: contents;
}
.zoom-section-icon { color: #b1a1f8; }
.canvas-section-icon { color: #80b8ff; }

.ratio-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    padding: 3px;
    border-radius: 7px;
    background: #202329;
}

.ratio-presets button {
    min-width: 0;
    padding: 7px 3px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #858d99;
    font-size: 9px;
    cursor: pointer;
}

.ratio-presets button.active {
    background: #353a43;
    color: #f4f5f7;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}

.color-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.color-row input[type="color"] {
    width: 100%;
    height: 32px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #202329;
    cursor: pointer;
}

.compact-option {
    min-height: 30px;
    padding: 0;
    border: 0;
}

.compact-option:hover { background: transparent; }
.compact-option .option-copy strong { margin: 0; color: #969eaa; font-size: 10px; font-weight: 550; }

.editor-controls label,
.dialog-settings label,
.polish-intensity {
    position: relative;
    display: grid;
    gap: 6px;
    color: #969eaa;
    font-size: 10px;
    font-weight: 550;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #202329;
    color: #e6e8ec;
}

input[readonly] {
    color: #858c97;
    background: #1b1e23;
}

select {
    cursor: pointer;
}

input[type="range"] {
    width: 100%;
    height: 3px;
    margin: 5px 0;
    padding: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.range-label {
    grid-template-columns: 1fr auto;
}

.range-label input {
    grid-column: 1 / -1;
}

.range-label output {
    color: #d0d4da;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.inspector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.inspector-grid label {
    display: grid;
}

#polish-edit-zoom-label,
#polish-edit-x-label,
#polish-edit-y-label {
    grid-column: 1 / -1;
}

.input-suffix {
    position: absolute;
    right: 8px;
    bottom: 8px;
    color: var(--faint);
    font-size: 9px;
    pointer-events: none;
}

.inspector-grid input[type="number"] {
    padding-right: 30px;
}

.inspector-title-row strong {
    display: block;
    font-size: 12px;
    font-weight: 600;
}

.button-row {
    gap: 6px;
}

.secondary-action,
.primary-action {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 11px;
    border-radius: 6px;
    font-weight: 600;
}

.secondary-action {
    flex: 1;
    border-color: var(--border-strong);
    background: var(--surface);
    color: #d9dde3;
}

.secondary-action:hover:not(:disabled) {
    background: var(--surface-hover);
    color: #fff;
}

.secondary-action svg,
.primary-action svg {
    width: 15px;
    height: 15px;
}

.text-action,
.text-button {
    min-height: 28px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: #9ea5b0;
    font-size: 11px;
    font-weight: 550;
}

.text-action:hover:not(:disabled),
.text-button:hover:not(:disabled) {
    color: #fff;
}

.danger-button {
    color: var(--danger);
}

.danger-button:hover:not(:disabled) {
    background: var(--danger-soft);
    color: #ff8c98;
}

.selection-summary {
    padding: 8px 9px;
    border-radius: 5px;
    background: #1e2126;
    color: #777f8a;
    font-size: 10px;
}

.editor-dialog {
    width: min(620px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: #1b1e23;
    color: var(--text);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .58);
}

.editor-dialog::backdrop {
    background: rgba(3, 4, 6, .68);
    backdrop-filter: blur(3px);
}

.polish-dialog {
    width: min(480px, calc(100vw - 32px));
}

.dialog-header {
    position: sticky;
    z-index: 5;
    top: 0;
    min-height: 66px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(27, 30, 35, .96);
    backdrop-filter: blur(10px);
}

.dialog-header h2 {
    font-size: 15px;
}

.dialog-title-wrap {
    gap: 10px;
}

.dialog-icon {
    width: 34px;
    height: 34px;
    background: var(--accent-soft);
    color: #b7adff;
}

.polish-dialog-body {
    padding: 18px;
}

.dialog-description {
    margin: 0 0 16px;
    color: #8f97a2;
    font-size: 12px;
}

.polish-options {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.option-row {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.option-row:last-child {
    border-bottom: 0;
}

.option-row:hover {
    background: rgba(255, 255, 255, .018);
}

.option-copy strong,
.option-copy small {
    display: block;
}

.option-copy strong {
    margin-bottom: 2px;
    color: #e5e7eb;
    font-size: 12px;
    font-weight: 600;
}

.option-copy small {
    color: #7d8591;
    font-size: 10px;
}

.switch {
    position: relative;
    flex: 0 0 auto;
    width: 32px;
    height: 18px;
}

.switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch i {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #3a3f48;
    transition: background 140ms ease;
}

.switch i::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d5d8dd;
    transition: transform 140ms ease;
}

.switch input:checked + i {
    background: var(--accent);
}

.switch input:checked + i::after {
    transform: translateX(14px);
    background: #fff;
}

.switch input:focus-visible + i {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.polish-intensity {
    margin-top: 18px;
}

.polish-summary {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 14px;
    padding: 9px 10px;
    border-radius: 6px;
    background: #15181c;
    color: #848c97;
    font-size: 10px;
}

.status-dot {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    margin-top: 4px;
    border-radius: 50%;
    background: var(--faint);
}

.polish-summary.applied .status-dot {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(66, 200, 146, .1);
}

.dialog-footer {
    min-height: 62px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: #181b20;
}

.dialog-footer .primary-action {
    min-width: 158px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.dialog-settings {
    padding: 18px;
}

.dialog-settings .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: center;
    color: #a6acb5;
}

.dialog-settings .checkbox-label input {
    accent-color: var(--accent);
}

.dialog-settings #start-export {
    grid-column: 1 / -1;
    min-height: 40px;
}

.progress-dialog {
    width: min(760px, calc(100vw - 32px));
}

.shortcuts-dialog {
    width: min(470px, calc(100vw - 32px));
}

.shortcut-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0;
    padding: 10px 18px 18px;
}

.shortcut-grid > span,
.shortcut-grid > kbd {
    display: flex;
    min-height: 38px;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.shortcut-grid > span {
    color: #aab0ba;
    font-size: 11px;
}

.shortcut-grid > kbd {
    justify-content: flex-end;
    color: #d7dbe1;
    font: 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.progress-dialog-status {
    padding: 16px 18px 0;
}

.status {
    color: #bec3cb;
    font-size: 11px;
}

.progress-track {
    height: 5px;
    overflow: hidden;
    margin: 14px 18px;
    border-radius: 999px;
    background: #2a2e35;
}

#progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 160ms ease;
}

.log {
    height: min(54vh, 480px);
    overflow: auto;
    margin: 0 18px 18px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #111317;
    color: #9da4ae;
    font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
}

.muted,
.hint {
    color: var(--muted);
}

.ok {
    color: var(--success);
}

.error {
    color: var(--danger);
}

.hidden {
    display: none !important;
}

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: #3b4049;
    background-clip: padding-box;
}

@media (max-width: 960px) {
    body {
        overflow: auto;
    }

    .editor-app {
        height: auto;
        min-height: 100vh;
    }

    .editor-topbar {
        position: sticky;
        top: 0;
    }

    .toolbar-session {
        max-width: 32vw;
    }

    .editor-layout {
        grid-template-columns: 1fr;
    }

    .preview-player {
        min-height: 760px;
    }

    .editor-controls {
        height: auto;
        border-top: 1px solid var(--border);
        border-left: 0;
    }
}

@media (max-width: 680px) {
    :root {
        --topbar-height: 54px;
    }

    .editor-topbar {
        gap: 8px;
        padding: 0 8px;
    }

    .project-identity strong,
    .toolbar-session,
    .toolbar-separator,
    .polish-button span,
    .toolbar-button:not(.primary) span {
        display: none;
    }

    .toolbar-button:not(.primary),
    .polish-button {
        width: 34px;
        justify-content: center;
        padding: 7px;
    }

    .preview-canvas {
        padding: 8px;
    }

    .preview-player {
        min-height: 680px;
    }

    .polish-timeline {
        grid-template-columns: 46px minmax(0, 1fr);
    }

    .polish-playhead {
        left: 54px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .dialog-settings #start-export {
        grid-column: auto;
    }
}

/* Compact studio shell and focused property panels. */
:root { --panel: #171a21; --chrome: #14171e; --accent: #9682ff; --accent-hover: #aa9aff; }
.editor-topbar { background: linear-gradient(110deg, #1d1d2b, #14171e 48%); }
.brand-mark { background: #302948; border-color: #65548e; color: #d6caff; }
.toolbar-session strong { display: inline; }
.editor-layout { grid-template-columns: minmax(0, 1fr) 300px; }
.preview-canvas { background: radial-gradient(ellipse at 50% 45%, #202330, #101218 75%); padding: 24px; }
.preview-transport { background: #171a22; }
.editor-controls { background: #171a21; }
.inspector-header { position: static; display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; background: transparent; }
.inspector-header h2 { font-size: 14px; }
.inspector-header .eyebrow { font-size: 8px; color: #a298bd; }
.inspector-status { font-size: 9px; color: #a6a0bb; border: 1px solid #373242; border-radius: 20px; padding: 3px 7px; }
.inspector-tabs { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px; gap: 4px; background: #171a21; border-bottom: 1px solid var(--border); }
.inspector-tabs button { display: grid; justify-items: center; gap: 5px; padding: 9px 2px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #9299aa; font-size: 10px; cursor: pointer; }
.inspector-tabs button:hover { background: #252832; color: #eeeaff; }
.inspector-tabs button[aria-selected="true"] { color: #c9bfff; background: #2c263f; border-color: #4a3b69; }
.inspector-tabs svg { width: 17px; height: 17px; }
.editor-controls .inspector-section { gap: 15px; padding: 18px 15px; }
.editor-controls .inspector-section[hidden] { display: none; }
.editor-controls .section-heading { gap: 8px; margin-bottom: 2px; }
.editor-controls .section-kicker { display: none; }
.editor-controls .section-icon { width: 24px; height: 24px; background: transparent; }
.editor-controls .section-heading h3 { font-size: 12px; }
.editor-controls label { font-size: 11px; color: #aeb4c2; }
.editor-controls label.property-row { grid-template-columns: 85px minmax(0, 1fr); align-items: center; gap: 10px; }
.editor-controls select, .editor-controls input[type="number"], .editor-controls input[type="text"] { min-height: 30px; padding: 5px 7px; font-size: 11px; background: #222630; border-color: #343945; }
.editor-controls .range-label { grid-template-columns: 85px minmax(0, 1fr) 48px; align-items: center; gap: 10px; min-height: 28px; }
.editor-controls .range-label input { grid-column: 2; grid-row: 1; min-width: 0; }
.editor-controls .range-label output { grid-column: 3; grid-row: 1; padding: 4px 3px; border: 1px solid #343945; border-radius: 5px; background: #222630; text-align: center; font-size: 10px; }
.editor-controls label.compact-option { display: flex; flex-direction: row; align-items: center; justify-content: space-between; min-height: 30px; padding: 0; border: 0; }
.editor-controls .compact-option .option-copy strong { font-size: 11px; color: #aeb4c2; }
.editor-controls .switch { flex: 0 0 auto; }
.ratio-presets { gap: 5px; padding: 0; background: transparent; }
.ratio-presets button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 2px 7px; border: 1px solid #333744; background: #1c2029; font-size: 10px; }
.ratio-presets button.active { border-color: #8d76de; background: #302741; color: #ded5ff; box-shadow: none; }
.aspect-symbol { display: block; width: 22px; height: 13px; border: 1.5px solid currentColor; border-radius: 2px; }
.aspect-9-16 { width: 9px; }
.aspect-1-1 { width: 13px; }
.aspect-original { border-style: dashed; width: 18px; }
.background-presets { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.background-presets button { height: 29px; border: 1px solid #ffffff25; border-radius: 6px; cursor: pointer; transition: transform 120ms ease; }
.background-presets button:hover { transform: translateY(-2px); border-color: white; }
.color-row { gap: 12px; }
.editor-controls .color-row label { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-size: 10px; }
.color-row input[type="color"] { height: 27px; min-width: 0; padding: 2px; }
.inspector-tip { display: flex; align-items: flex-start; gap: 9px; margin: 16px; padding: 12px; border: 1px dashed #343744; border-radius: 8px; color: #838b9c; font-size: 10px; line-height: 1.6; }
.inspector-tip svg { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 2px; color: #a69ac8; }
.editor-controls .selected-edit { margin: 10px; padding: 12px; border: 1px solid #574574; border-radius: 8px; background: #272135; }
.polish-timeline-panel { background: #171a21; padding: 10px 14px; }
.timeline-track-label, .timeline-ruler-label { background: #171a21; }
.timeline-heading { min-height: 30px; }
.timeline-heading > div:first-child { display: flex; align-items: baseline; gap: 12px; }
.timeline-heading .hint { font-size: 9px; }
.timeline-tool { background: #1e222b; border-color: #ffffff08; }
.timeline-track { border-color: #333744; }
.editor-controls .field-hint { color: #9a91ae; padding: 10px; border-radius: 6px; background: #24212f; }
@media (min-width: 961px) { .preview-player { grid-template-rows: minmax(160px, 1fr) 44px auto; } }
@media (max-width: 960px) {
    .editor-layout { grid-template-columns: minmax(0, 1fr) 280px; }
    .editor-app { height: 100vh; }
    .preview-player { min-height: 0; grid-template-rows: minmax(140px, 1fr) 44px auto; }
    .editor-controls { height: 100%; border-left: 1px solid var(--border); border-top: 0; }
    .timeline-heading .hint { display: none; }
    .preview-transport { gap: 4px; }
    .preview-canvas { padding: 14px; }
}
@media (max-width: 680px) {
    body { overflow: auto; }
    .editor-app { height: auto; }
    .editor-layout { grid-template-columns: minmax(0, 1fr); }
    .preview-player { min-height: 500px; grid-template-rows: minmax(180px, 1fr) 44px auto; }
    .editor-controls { height: auto; border-left: 0; border-top: 1px solid var(--border); }
    .inspector-header { padding: 10px 15px; }
    .inspector-tabs { position: static; }
    .editor-controls .inspector-section { padding: 15px; }
    .timeline-tools { gap: 1px; }
    .timeline-tool.tool-with-label span { display: none; }
    .time-display { min-width: 78px; font-size: 10px; }
    .preview-transport { padding-left: 6px; }
    .inspector-tip { margin-top: 10px; }
}

/* Autosave notice in the session summary: present enough to notice, quiet
   enough not to compete with the recording title next to it. */
.restored-note {
    opacity: .8;
}

.restored-note .text-button {
    margin-left: 4px;
}
