/* Editor workspace. Shared primitives and the AI form have their own stylesheets. */
:root {
  --bg: #101113;
  --panel: #191b1f;
  --panel-raised: #24272c;
  --line: #2b2e33;
  --text: #eceeef;
  --muted: #969aa3;
  --subtle: #6a707b;
  --teal: #76b9a9;
  --timeline-height: clamp(280px, 39vh, 420px);
  --ruler-height: 30px;
  --track-width: 164px;
  --font: 'DM Sans', 'Segoe UI', sans-serif;
}

/* A full-height library beside the preview and its timeline. */
.app { height: calc(100dvh - var(--site-navigation-height)); min-width: 690px; display: flex; flex-direction: column; }
.app:not(.generation-mode) {
  --bg: #090b10;
  --panel: #151618;
  --panel-raised: #1b1c1e;
  --line: #ffffff14;
  --text: #f0f1f2;
  --muted: #a7a9b2;
  --subtle: #767982;
  position: relative;
  isolation: isolate;
  background: var(--bg);
}
/* Match the home grid without running an animation while editing. */
.app:not(.generation-mode)::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 65% 15%, color-mix(in srgb, var(--accent-text) 2.4%, transparent), transparent 60%),
    radial-gradient(circle, #ffffff24 .85px, transparent 1px) 12px 12px / 24px 24px;
  mask-image: linear-gradient(#000 35%, #0009 100%);
}
.app-header {
  height: 66px; flex-shrink: 0; position: relative; z-index: 20;
  display: flex; align-items: center; padding: 0 24px; gap: 16px;
  background: var(--bg);
}
.app:not(.generation-mode) .app-header { background: #090b1080; }
.brand { display: flex; align-items: center; }
.brand img { width: 36px; height: 36px; object-fit: contain; }
#editor-home-button { width: 28px; height: 28px; margin-left: -7px; }
#editor-home-button .icon { width: 15px; height: 15px; }
.project-name {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  position: absolute; left: 50%; transform: translateX(-50%);
  border: 1px solid var(--line); border-radius: 100px; background: #1b1c1ee8;
}
.project-name:hover, .project-name:focus-within { background: #222325; border-color: #ffffff26; }
.project-name input {
  width: 178px; background: transparent; border: 0; padding: 0;
  color: #d6d9df; font-size: 13px; font-weight: 550; text-align: center; text-overflow: ellipsis;
}
.project-name [data-icon] { color: var(--muted); }
.project-name .icon { width: 14px; height: 14px; }
.project-pencil { opacity: 0; }
.project-name:hover .project-pencil, .project-name:focus-within .project-pencil { opacity: 1; }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.button {
  height: 36px; padding: 0 15px; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.button .icon { width: 16px; height: 16px; }
.primary { background: var(--accent); border: 1px solid var(--accent); color: var(--accent-ink); box-shadow: none; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.primary:disabled { opacity: .45; }
.subtle { background: #1b1c1e; border: 1px solid #ffffff18; color: #e0e1e5; }
.subtle:hover:not(:disabled) { background: #252628; border-color: #ffffff30; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 8px; color: #959ca8;
}
.icon-button:hover:not(:disabled) { color: #f4f5f6; background: #ffffff09; }
.icon-button.active { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 9%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); }
.tiny-icon .icon { width: 12px; height: 12px; }
#export-button { padding: 0 17px; }
#help-button { margin-right: 2px; }
.dropdown {
  position: absolute; z-index: 40; background: #1b1c1e; border: 1px solid #ffffff20;
  border-radius: 12px; padding: 6px; box-shadow: 0 16px 50px #0008;
}
.project-menu { right: 136px; top: 58px; width: 272px; }
.dropdown button { display: flex; align-items: center; gap: 10px; padding: 12px; width: 100%; font-size: 12px; text-align: left; border-radius: 7px; }
.dropdown button:hover { background: #ffffff07; }
.dropdown kbd { margin-left: auto; font-size: 9px; }
.editor-top { display: flex; flex: 1; gap: 12px; min-height: 0; margin: 0 12px 12px; overflow: hidden; }
.editor-main { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.library, .viewer { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 8px 30px #00000018; }

/* Compact pill navigation mirrors the home menu. */
.library { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; padding: 18px 16px 0; background: var(--panel); }
.app:not(.generation-mode) .library { background: #151618f2; }
.library .panel-heading { display: flex; align-items: center; margin-bottom: 18px; flex-shrink: 0; }
.library-panel-tabs { display: flex; align-items: center; justify-content: center; gap: 4px; width: fit-content; margin-inline: auto; background: #1b1c1e; padding: 4px; border: 1px solid #ffffff14; border-radius: 100px; }
.library-panel-tab {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 30px;
  padding: 5px 15px; border-radius: 100px; color: #a3a5ad; font-size: 12px; font-weight: 600; line-height: 20px;
}
.library-panel-tab .icon { width: 14px; height: 14px; }
.library-panel-tab.active { color: var(--accent-text); background: #090b10; }
.library-panel-tab:not(.active):hover { color: #dadee5; }
.library-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.library-tabs { display: flex; gap: 3px; margin: 0; padding: 4px; background: #090b1080; border: 1px solid #ffffff0a; border-radius: 10px; flex-shrink: 0; }
.library-tabs button { flex: 1; font-size: 11px; padding: 7px 0; border-radius: 6px; color: #9299a5; }
.library-tabs button.active { background: var(--accent-surface); color: var(--accent-text); font-weight: 600; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent); }
.library-tabs button.active::after { display: none; }
.library-tabs button:hover:not(.active) { background: #ffffff04; color: #d5dae2; }
.library-search-row { display: flex; align-items: center; gap: 7px; margin-top: 12px; flex-shrink: 0; }
.search-field { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 35px; margin: 0; padding: 0 10px; background: #090b1080; border: 1px solid #ffffff14; border-radius: 9px; color: #858892; }
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 8%, transparent); }
.search-field .icon { width: 14px; height: 14px; }
.search-field input { background: transparent; border: 0; width: 100%; font-size: 11px; outline: none; }
.search-field input::placeholder { color: #7c8490; }
.search-hint { border: 1px solid #353942; width: 17px; height: 18px; line-height: 16px; text-align: center; border-radius: 4px; color: #858c98; font-size: 10px; flex-shrink: 0; }
.library-add { width: 35px; height: 35px; border: 1px solid #ffffff18; border-radius: 9px; color: var(--accent-text); background: #1b1c1e; }
.library-add:hover:not(:disabled) { color: var(--accent-text); background: #2d3337; border-color: var(--accent-border); }
.library-add .icon { width: 16px; height: 16px; }
.media-list { position: relative; flex: 1; min-height: 80px; padding: 16px 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; container-type: size; container-name: media-browser; }
.library-empty { height: 100%; min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px dashed #ffffff24; border-radius: 12px; padding: 18px 8px; background: radial-gradient(circle, #ffffff0d .85px, transparent 1px) 12px 12px / 24px 24px; }
.empty-library-icon { width: 46px; height: 46px; margin-bottom: 17px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 7%, #151618); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 14px; color: var(--accent-text); }
.empty-library-icon .icon { width: 22px; height: 22px; stroke-width: 1.4; }
.library-empty h2 { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text); letter-spacing: -.2px; }
.library-empty p { font-size: 11px; line-height: 1.7; color: var(--muted); }
.library-import { margin-top: 20px; height: 32px; padding: 0 12px; background: #1b1c1e; border: 1px solid #ffffff20; color: #eceef0; font-size: 11px; }
.library-import .icon { width: 14px; height: 14px; color: var(--accent-text); }
.library-import:hover:not(:disabled) { background: var(--accent-surface); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 9px; }
.media-card { position: relative; min-width: 0; cursor: grab; text-align: left; border: 1px solid #ffffff14; border-radius: 11px; padding: 4px; background: #1b1c1e; transition: border-color .15s, background .15s; }
.media-card:active { cursor: grabbing; }
.media-card:hover { background: #232426; border-color: #ffffff30; }
.media-card.selected { border-color: var(--accent); background: var(--accent-surface); }
.media-thumb { aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center; position: relative; background: #2a3039; border-radius: 5px; overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb > .icon { width: 25px; height: 25px; color: var(--accent-text); stroke-width: 1.2; }
.media-duration { position: absolute; bottom: 5px; right: 5px; background: #101215dd; padding: 2px 4px; border-radius: 4px; font-size: 9px; font-variant-numeric: tabular-nums; color: #f2f4f5; }
.media-type { position: absolute; left: 6px; top: 5px; color: #f3f4f6; filter: drop-shadow(0 1px 2px #000); }
.media-type .icon { width: 12px; height: 12px; }
.add-media { position: absolute; right: 5px; top: 5px; display: none; align-items: center; justify-content: center; width: 24px; height: 24px; border: 1px solid #ffffff18; border-radius: 6px; background: #171b21e6; color: var(--accent-text); }
.add-media .icon { width: 14px; height: 14px; }
.media-card:hover .add-media, .media-card:focus-visible .add-media { display: flex; }
.media-card-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 500; color: #d6dce5; margin: 8px 2px 0; }
.media-card-details { font-size: 9px; color: #8b95a6; margin: 5px 2px 3px; }
.media-offline .media-thumb { border: 1px dashed #a48858; }
.media-offline-label { position: absolute; bottom: 6px; font-size: 9px; color: #e7bc73; }
.no-results { padding: 35px 10px; text-align: center; color: #969faf; font-size: 11px; }

/* The image is the focal point, with transport controls in a stable bottom row. */
.viewer { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 220px; background: #141619; }
.app:not(.generation-mode) .viewer {
  background:
    radial-gradient(ellipse at 50% 35%, color-mix(in srgb, var(--accent) 2%, transparent), transparent 65%),
    radial-gradient(circle, #ffffff1a .85px, transparent 1px) 12px 12px / 24px 24px,
    #0e0f11e8;
}
.viewer-heading { display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 23px; flex-shrink: 0; }
.viewer-heading > div { display: flex; align-items: center; gap: 12px; }
.viewer-heading h2 { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text); }
.viewer-heading h2 .icon { width: 14px; height: 14px; color: var(--accent-text); }
.viewer-heading > div > span { font-size: 11px; color: #848c99; }
.viewer-heading .heading-slash { color: #434952; font-size: 13px; }
.viewer-options { gap: 8px !important; }
.viewer-options select { background: #1b1c1e; border: 1px solid #ffffff18; border-radius: 8px; padding: 6px 9px; font-size: 10px; color: #c8cad0; cursor: pointer; }
.quality-badge { border: 1px solid #ffffff12; border-radius: 100px; padding: 6px 9px; background: #1b1c1e80; font-size: 9px !important; letter-spacing: .1px; color: #a3a5ad !important; }
.preview-area { display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; flex: 1; min-height: 0; padding: 0 30px; container-type: size; container-name: montage-preview; }
.preview-frame { position: relative; height: calc(100% - 34px); max-width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #0d0e10; box-shadow: 0 0 0 1px #ffffff09, 0 10px 40px #0003; }
.preview-frame:has(.preview-empty:not([hidden])) { width: 100%; background: transparent; box-shadow: none; }
.preview-frame:has(.preview-empty:not([hidden])) canvas { visibility: hidden; }
.preview-frame canvas { display: block; width: 100%; height: 100%; object-fit: contain; background: #0d0e10; }
.preview-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: transparent; }
.preview-empty > * { flex-shrink: 0; }
.preview-illustration { width: 182px; height: 98px; position: relative; margin: 0 0 23px; flex-shrink: 0; }
.empty-shot { position: absolute; display: flex; align-items: center; justify-content: center; width: 90px; height: 63px; border: 1px solid #48554b; border-radius: 10px; background: #252f28; box-shadow: 0 10px 25px #0003; }
.shot-back { left: 2px; top: 10px; transform: rotate(-14deg); color: #789d8c; background: #202a25; border-color: #354b3f; }
.shot-side { right: 0; top: 13px; transform: rotate(13deg); color: #9b8ab9; background: #27232e; border-color: #443b54; }
.empty-shot .icon { width: 24px; height: 24px; stroke-width: 1.3; }
.shot-front { width: 104px; height: 75px; z-index: 1; left: 40px; top: 18px; background: linear-gradient(140deg, var(--accent-surface), var(--accent-surface)); border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 7%, transparent), 0 10px 25px #0003; }
.shot-front img { width: 41px; height: 41px; margin-bottom: 8px; }
.shot-line { position: absolute; bottom: 9px; left: 14px; right: 14px; height: 3px; background: var(--accent); opacity: .55; border-radius: 2px; }
.preview-empty h2 { max-width: calc(100% - 24px); font-size: clamp(19px, 2.2vw, 34px); font-weight: 700; letter-spacing: -1px; line-height: 1.3; color: var(--text); text-align: center; text-wrap: balance; }
.preview-empty h2 span { color: var(--accent-text); }
.preview-empty p { margin-top: 10px; padding-inline: 12px; font-size: 12px; color: var(--muted); text-align: center; }
.preview-import { height: 38px; margin-top: 23px; padding: 0 17px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); font-size: 12px; }
.preview-import:hover { background: var(--accent-hover); }
.preview-shortcut { display: flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 10px; color: #7c877f; }
.preview-shortcut > span { color: #556158; }
.preview-shortcut kbd { font-size: 9px; line-height: 17px; border-color: #3a443d; background: #ffffff04; color: #a8b4ac; }
.preview-caption { display: flex; align-items: center; justify-content: center; height: 34px; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; letter-spacing: .2px; color: #8d95a2; }
.preview-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: #101318b3; backdrop-filter: blur(3px); color: #c0c7d2; font-size: 11px; }
.spinner { width: 15px; height: 15px; border: 2px solid #505b48; border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.transport { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 63px; padding: 0 23px; border-top: 1px solid var(--line); flex-shrink: 0; background: #151618; }
.transport-time { display: flex; align-items: center; gap: 9px; font-size: 11px; font-variant-numeric: tabular-nums; letter-spacing: .3px; color: #8993a1; }
.transport-time #current-time { color: var(--accent-text); font-weight: 500; }
.time-separator { color: #4c5664; }
.transport-main { display: flex; align-items: center; gap: 12px; }
.transport-main .icon-button .icon { width: 15px; height: 15px; }
.play-button { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent); border: 1px solid var(--accent); color: var(--accent-ink); }
.play-button:disabled { opacity: .45; background: var(--accent-surface); border-color: color-mix(in srgb, var(--accent) 12.5%, transparent); color: var(--accent-text); }
.play-button:hover:not(:disabled) { background: var(--accent-hover); }
.play-button svg { pointer-events: none; }
.play-button .icon { width: 16px; height: 16px; fill: currentColor; stroke-width: 1.2; }
.play-button .icon-pause { fill: none; stroke-width: 2.5; }
.play-button .icon-play { margin-left: 2px; }
.transport-options { justify-self: end; display: flex; align-items: center; gap: 6px; }
.transport-options input { width: 66px; margin-right: 10px; }
.transport-options .icon { width: 16px; height: 16px; }
.preview-frame:fullscreen { width: 100vw; height: 100vh; border-radius: 0; max-width: none; display: flex; align-items: center; justify-content: center; }
.preview-frame:fullscreen canvas { object-fit: contain; }
.audio-placeholder { color: var(--accent-text); }

/* Consistent rows and restrained clip colours make cuts and stacking easy to read. */
.panel-resizer { display: flex; align-items: center; justify-content: center; height: 12px; flex-shrink: 0; cursor: ns-resize; touch-action: none; }
.panel-resizer > span { width: 42px; height: 3px; border-radius: 3px; background: #ffffff24; transition: background .15s; }
.panel-resizer:hover > span, .panel-resizer:focus-visible > span { background: var(--accent); }
.timeline { height: var(--timeline-height); min-height: 254px; max-height: calc(100% - 232px); display: flex; flex-direction: column; flex-shrink: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; container-type: size; container-name: montage; }
.timeline-toolbar { display: flex; align-items: center; gap: 14px; height: 50px; padding: 0 16px; flex-shrink: 0; border-bottom: 1px solid var(--line); background: #1b1c1e; }
.timeline-title { display: flex; align-items: center; gap: 9px; align-self: stretch; position: relative; margin-right: 16px; padding: 0 2px; }
.timeline-title::after { content: ''; position: absolute; height: 2px; left: 0; right: 0; bottom: -1px; background: var(--accent); border-radius: 2px; }
.timeline-title > span { color: var(--accent-text); }
.timeline-title .icon { width: 16px; height: 16px; }
.timeline-title h2 { font-size: 12px; font-weight: 600; color: #e1e7dd; white-space: nowrap; }
.tool-group { display: flex; align-items: center; gap: 3px; }
.history-tools { gap: 2px; }
.edit-tools { gap: 4px; padding: 3px; border: 1px solid #ffffff14; border-radius: 10px; background: #090b10; }
.timeline-toolbar .icon-button { width: 29px; height: 29px; border-radius: 6px; }
.timeline-toolbar .icon-button .icon { width: 16px; height: 16px; }
.toolbar-divider { width: 1px; height: 20px; flex-shrink: 0; background: #343a44; }
.edit-tools .icon-button.active { color: var(--accent-text); background: var(--accent-surface); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.split-button { height: 29px; padding: 0 9px; margin-left: 2px; background: #1b1c1e; border: 1px solid #ffffff20; border-radius: 6px; font-size: 11px; color: #d0d3d9; gap: 6px; }
.split-button .icon { width: 14px; height: 14px; }
.split-button kbd { font-size: 9px; line-height: 16px; padding: 0 4px; background: #303841; border-color: #45505b; color: #aebaca; margin-left: 3px; }
.timeline-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.timeline-right .toolbar-divider { margin: 0 9px; }
.timeline-right input { width: 88px; }
.timeline-workspace { --track-height: clamp(46px, calc((100cqh - 114px) / 3), 92px); position: relative; flex: 1; min-height: 0; display: flex; overflow: auto; scrollbar-width: thin; scrollbar-color: #48515b #191c21; }
.track-headers { position: sticky; left: 0; align-self: flex-start; min-height: 100%; width: var(--track-width); flex-shrink: 0; z-index: 10; background: #18191b; border-right: 1px solid #ffffff18; }
.track-header-ruler { display: flex; align-items: center; justify-content: space-between; height: var(--ruler-height); padding: 0 13px; border-bottom: 1px solid #ffffff12; background: #1b1c1e; }
.track-header-ruler > span { font-size: 9px; font-weight: 500; letter-spacing: .8px; color: #8c96a5; }
.track-header-ruler .icon-button { width: 22px; height: 22px; color: #a1acbb; border-radius: 5px; }
.track-header-ruler .icon { width: 13px; height: 13px; }
.track-label { height: var(--track-height); display: flex; flex-direction: column; justify-content: center; gap: 9px; padding: 9px 13px; border-bottom: 1px solid #ffffff12; }
.track-label-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.track-symbol { color: #97baad; display: flex; align-items: center; gap: 5px; font-size: 9px; font-weight: 600; flex-shrink: 0; }
.track-symbol .icon { width: 12px; height: 12px; }
.track-label.audio .track-symbol { color: #b3a0cc; }
.track-name { color: #b7c0cd; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-tools { display: flex; align-items: center; gap: 6px; }
.track-tools button { display: flex; align-items: center; justify-content: center; width: 21px; height: 21px; border-radius: 5px; padding: 0; color: #8893a3; }
.track-tools button:hover { color: #ecf0f7; background: #ffffff08; }
.track-tools button.is-on { color: #c8b2e6; background: color-mix(in srgb, var(--accent-text) 5.1%, transparent); }
.track-tools .icon { width: 12px; height: 12px; }
.track-tools .track-clip-count { color: #788394; font-size: 9px; margin-left: auto; white-space: nowrap; }
.timeline-scroll { position: relative; align-self: flex-start; flex: 1; overflow-x: auto; overflow-y: hidden; min-height: 100%; scrollbar-width: thin; scrollbar-color: #48515b #191c21; }
.timeline-content { position: relative; isolation: isolate; user-select: none; width: 1500px; min-height: 100%; }
.ruler { position: relative; height: var(--ruler-height); background: #1b1c1e; border-bottom: 1px solid #ffffff12; overflow: hidden; cursor: crosshair; }
.ruler-tick { position: absolute; bottom: 0; border-left: 1px solid #424b58; height: 4px; pointer-events: none; }
.ruler-tick.major { height: 8px; border-color: #667081; }
.ruler-tick span { position: absolute; left: 5px; bottom: 10px; color: #a1abba; font-size: 10px; letter-spacing: .2px; font-variant-numeric: tabular-nums; }
.track-lane { position: relative; height: var(--track-height); background: #121315; border-bottom: 1px solid #ffffff0f; }
.track-lane:nth-child(even) { background: #161719; }
.track-lane.audio { background: #17151c; }
.track-lane.drop-target { background: color-mix(in srgb, var(--accent) 6%, #121315); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent) inset; }
.track-lane.locked { background: repeating-linear-gradient(135deg, #29303a40 0, #29303a40 1px, transparent 1px, transparent 8px); }
.track-lane.razor-mode { cursor: crosshair; }
.timeline-empty { position: absolute; left: calc(var(--track-width) + 24px); right: 16px; top: calc(var(--ruler-height) + var(--track-height) + 14px); display: flex; align-items: center; gap: 12px; max-width: 590px; pointer-events: none; color: #647182; }
.timeline-empty > .icon { width: 24px; height: 24px; stroke-width: 1.3; }
.timeline-empty strong { color: #99a5b7; font-size: 11px; font-weight: 500; }
.timeline-empty p { margin-top: 5px; font-size: 10px; color: #758297; }
.clip { position: absolute; top: 8px; height: calc(var(--track-height) - 16px); min-width: 2px; border: 1px solid #4b6d63; border-radius: 6px; overflow: hidden; cursor: grab; background: #284239; touch-action: none; }
.clip:hover { filter: brightness(1.08); }
.clip.selected { outline: 1px solid var(--accent); outline-offset: 1px; z-index: 3; box-shadow: 0 0 0 2px #090b10; }
.clip.dragging { opacity: .75; cursor: grabbing; z-index: 5; }
.clip.invalid { outline-color: #ee8585; }
.clip.audio { background: #3a3249; border-color: #645477; }
.clip.image { background: #47402e; border-color: #7a6c48; }
.clip.offline { background: #433b30; border: 1px dashed #a48960; }
.clip-header { height: 20px; display: flex; align-items: center; justify-content: space-between; padding: 0 7px; gap: 7px; font-size: 10px; color: #e0ede6; background: #314f44; white-space: nowrap; overflow: hidden; pointer-events: none; }
.clip-header > span:first-child { display: flex; align-items: center; gap: 5px; overflow: hidden; }
.clip-header-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-header .icon { width: 10px; height: 10px; }
.clip-header-duration { color: #bfd0c7; font-size: 8px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.clip.audio .clip-header { color: #e3d9f0; background: #51425e; }
.clip.audio .clip-header-duration { color: #ccbeda; }
.clip.image .clip-header { color: #ece5cc; background: #645738; }
.clip-strip { height: calc(100% - 20px); display: flex; overflow: hidden; pointer-events: none; background: #14241d; }
.clip-strip img { width: 72px; height: 100%; object-fit: cover; flex-shrink: 0; border-right: 1px solid #0003; }
.clip-strip .icon { margin: auto; color: #94aa9e; }
.clip.image .clip-strip { background: #2f2b20; }
.clip.audio .clip-strip { background: #332b40; align-items: center; justify-content: center; }
.clip-wave { width: 100%; height: 100%; opacity: .8; }
.clip-handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; z-index: 5; opacity: 0; background: #eef3f533; }
.clip.selected .clip-handle { opacity: 1; }
.clip-handle.left { left: 0; }
.clip-handle.right { right: 0; }
.clip-handle::after { content: ''; position: absolute; width: 1px; height: 13px; background: #fff9; left: 3px; top: calc(50% - 6px); }
.playhead { position: absolute; top: 0; bottom: 0; width: 1px; z-index: 7; cursor: ew-resize; touch-action: none; }
.playhead-head { position: absolute; top: 1px; left: -5px; width: 11px; height: 13px; background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 65%, 50% 100%, 0 65%); border-radius: 2px 2px 0 0; }
.playhead-line { position: absolute; top: 14px; bottom: 0; width: 1px; background: var(--accent); opacity: .8; }
.snap-guide { position: absolute; top: var(--ruler-height); bottom: 0; width: 1px; background: color-mix(in srgb, var(--accent-text) 73.3%, transparent); z-index: 6; pointer-events: none; }
.timeline-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 26px; padding: 0 16px; border-top: 1px solid var(--line); background: #1b1c1e; color: #989ca6; font-size: 9px; flex-shrink: 0; }
.timeline-footer > div:first-child { display: flex; align-items: center; gap: 7px; }
.status-dot { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
#selection-info { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.footer-shortcuts { display: flex; align-items: center; gap: 13px; }
.footer-shortcuts > span { display: flex; align-items: center; gap: 5px; }
.footer-shortcuts kbd { font-size: 8px; line-height: 14px; color: #a1adbd; background: #262c34; border-color: #3b4552; }
.footer-shortcuts button { display: flex; align-items: center; gap: 5px; padding: 0; color: #acb8c8; font-size: 9px; }
.footer-shortcuts .icon { width: 11px; height: 11px; }
.app.is-exporting .editor-top, .app.is-exporting .timeline, .app.is-exporting .app-header { pointer-events: none; }

/* Shared dialogs and the AI workspace use the same restrained surface palette. */
dialog { background: #18191b; border-color: #ffffff20; border-radius: 17px; }
.dialog-heading h2 { letter-spacing: -.6px; }
.export-summary { background: #1b1c1e; border-color: #ffffff14; border-radius: 10px; }
#export-format, #export-resolution { width: 100%; padding: 10px; background: #1b1c1e; border: 1px solid #ffffff20; border-radius: 8px; font-size: 11px; color: #d0d3d9; }
#export-format { margin-bottom: 18px; }
.dialog-note { color: #9aa5b5; }
.eyebrow { font-size: 8px; font-weight: 600; letter-spacing: 1.4px; color: #8b95a6; }
.library.ai-detail-open { padding-top: 18px; }
.library.ai-detail-open .panel-heading { margin-bottom: 14px; }
.library.ai-detail-open .library-panel-tab { min-height: 30px; }

@media (min-width: 1700px) {
  .library { width: 344px; padding-left: 18px; padding-right: 18px; }
  .editor-top { gap: 12px; margin: 0 16px 16px; }
  .preview-area { padding: 0 40px; }
}
@media (max-width: 1100px) {
  .library { width: 280px; padding-left: 13px; padding-right: 13px; }
  .app-header { padding: 0 19px; }
  .project-name input { width: 151px; }
  .header-actions { gap: 7px; }
  .viewer-heading, .transport { padding-left: 17px; padding-right: 17px; }
  .preview-area { padding: 0 20px; }
  .transport-main { gap: 7px; }
  .transport-options input { width: 43px; margin-right: 2px; }
  .transport-time { font-size: 9px; gap: 6px; }
  .timeline-toolbar { gap: 9px; padding: 0 12px; }
  .timeline-title { margin-right: 4px; }
  .timeline-right input { width: 65px; }
  .timeline-right .toolbar-divider { margin: 0 5px; }
  .footer-shortcuts > span { display: none; }
}
@media (max-height: 760px) {
  .app-header { height: 60px; }
  .library, .library.ai-detail-open { padding-top: 12px; }
  .library .panel-heading { margin-bottom: 12px; }
  .viewer-heading { height: 42px; }
  .transport { height: 53px; }
  .play-button { width: 34px; height: 34px; border-radius: 10px; }
  .preview-illustration { transform: scale(.8); margin-bottom: 6px; height: 80px; }
  .preview-empty h2 { font-size: 21px; }
  .preview-empty p { margin-top: 7px; font-size: 11px; }
  .preview-import { margin-top: 15px; height: 34px; font-size: 11px; }
  .preview-shortcut { margin-top: 10px; font-size: 9px; }
  .preview-frame { height: calc(100% - 27px); }
  .preview-caption { height: 27px; font-size: 9px; }
  .library-empty { min-height: 170px; padding: 12px 6px; }
  .empty-library-icon { width: 36px; height: 36px; margin-bottom: 12px; }
  .library-import { margin-top: 13px; }
  .track-label { gap: 4px; padding-top: 6px; padding-bottom: 6px; }
}
@media (max-width: 850px) {
  :root { --track-width: 130px; }
  .app-header { height: 58px; padding: 0 14px; }
  .brand img { width: 32px; height: 32px; }
  .project-name { gap: 7px; padding: 8px 4px; }
  .project-name input { width: 146px; font-size: 11px; }
  .project-pencil { display: none; }
  .header-actions { gap: 6px; }
  .header-actions .responsive-label { display: none; }
  .header-actions .button { height: 33px; padding: 0 11px; font-size: 11px; }
  #export-button { padding: 0 12px; }
  .editor-top { gap: 8px; margin: 0 8px 8px; }
  .library { width: 240px; padding-left: 11px; padding-right: 11px; }
  .library-tabs button { font-size: 10px; }
  .library-panel-tabs { gap: 4px; }
  .viewer-heading > div { gap: 7px; }
  .viewer-heading { padding-left: 12px; padding-right: 12px; }
  .viewer-heading > div > span { font-size: 9px; }
  .viewer-heading h2 { font-size: 11px; }
  .quality-badge { display: none; }
  .preview-area { padding: 0 12px; }
  .preview-empty h2 { font-size: 18px; }
  .preview-empty p { font-size: 10px; }
  .preview-illustration { transform: scale(.65); margin-bottom: 0; height: 76px; }
  .preview-shortcut { display: none; }
  .transport { padding: 0 9px; }
  .transport-time { font-size: 8px; gap: 4px; letter-spacing: 0; }
  .transport-main { gap: 2px; }
  .transport-main .icon-button { width: 22px; }
  .transport-options { gap: 1px; }
  .transport-options .icon-button { width: 27px; }
  .transport-options input { display: none; }
  .play-button { width: 31px; height: 31px; border-radius: 9px; }
  .timeline-title { gap: 5px; margin-right: 0; }
  .timeline-title h2 { font-size: 10px; }
  .timeline-title .icon { width: 14px; height: 14px; }
  .timeline-toolbar { padding: 0 8px; gap: 7px; }
  .timeline-toolbar .icon-button { width: 25px; height: 27px; }
  .edit-tools { gap: 2px; padding: 2px; }
  .split-button { font-size: 10px; padding: 0 7px; margin-left: 0; }
  .split-button kbd { display: none; }
  .timeline-right input { width: 40px; }
  .timeline-right .toolbar-divider { margin: 0 3px; }
  .timeline-footer { padding: 0 12px; font-size: 8px; gap: 12px; }
  .footer-shortcuts { display: none; }
  .track-label { padding-left: 9px; padding-right: 9px; }
  .track-label-top { gap: 5px; }
  .track-name { font-size: 9px; }
  .track-tools { gap: 2px; }
  .track-tools .track-clip-count { font-size: 8px; }
  .media-card-details { font-size: 8px; }
}
@media (max-height: 650px) {
  :root { --timeline-height: 254px; }
  .library, .library.ai-detail-open { padding-top: 10px; }
  .library .panel-heading { margin-bottom: 10px; }
  .preview-illustration { display: none; }
  .preview-empty h2 { font-size: 20px; }
  .preview-import { margin-top: 12px; height: 31px; }
  .preview-shortcut { display: none; }
  .clip { top: 5px; height: calc(var(--track-height) - 10px); }
  .clip-header { height: 17px; font-size: 8px; }
  .clip-strip { height: calc(100% - 17px); }
  .track-tools button { height: 16px; }
  .track-label { gap: 2px; }
}
/* Adapt the welcome content to the preview after resizing the timeline. */
@container montage-preview (max-height: 300px) {
  .preview-illustration { transform: scale(.75); height: 76px; margin-bottom: 8px; }
  .preview-empty h2 { font-size: clamp(18px, 1.9vw, 26px); }
  .preview-empty p { margin-top: 7px; font-size: 11px; }
  .preview-import { height: 34px; margin-top: 16px; font-size: 11px; }
  .preview-shortcut { margin-top: 10px; font-size: 9px; }
}
@container montage-preview (max-height: 240px) {
  .preview-illustration { display: none; }
}
@container montage-preview (max-height: 210px) {
  .preview-shortcut { display: none; }
  .preview-import { height: 32px; margin-top: 12px; }
}
@container montage (max-height: 285px) {
  .clip { top: 5px; height: calc(var(--track-height) - 10px); }
  .clip-header { height: 17px; font-size: 9px; }
  .clip-strip { height: calc(100% - 17px); }
  .track-label { gap: 3px; padding-top: 5px; padding-bottom: 5px; }
  .track-tools button { height: 18px; }
}
/* The narrower right column keeps every editing tool available on small screens. */
@container montage (max-width: 740px) {
  .timeline-workspace { --track-height: clamp(34px, calc((100cqh - 148px) / 3), 92px); }
  .timeline-toolbar { height: 84px; padding: 6px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; }
  .timeline-title { grid-column: 1; grid-row: 1; margin-right: 0; }
  .history-tools { grid-column: 3; grid-row: 1; justify-self: end; }
  .timeline-toolbar > .toolbar-divider { display: none; }
  .edit-tools { grid-column: 1 / 3; grid-row: 2; justify-self: start; }
  .timeline-right { grid-column: 3; grid-row: 2; margin-left: 0; }
  .timeline-right input { width: 48px; }
  .timeline-right .toolbar-divider { margin: 0 3px; }
}
@container montage (max-width: 740px) and (max-height: 285px) {
  .track-label { padding: 3px 9px; gap: 2px; }
  .track-label-top { font-size: 9px; }
  .track-tools button { height: 14px; }
  .clip { top: 4px; height: calc(var(--track-height) - 8px); }
  .clip-header { height: 14px; font-size: 8px; }
  .clip-strip { height: calc(100% - 14px); }
}
@container montage (max-width: 480px) {
  .timeline-toolbar { padding: 6px 8px; gap: 4px 5px; }
  .timeline-right input { width: 30px; }
  .timeline-right { gap: 1px; }
  .timeline-right .toolbar-divider { display: none; }
  .split-button kbd { display: none; }
  .edit-tools { gap: 2px; padding: 2px; }
  .timeline-toolbar .icon-button { width: 25px; height: 27px; }
  .timeline-footer #selection-info, .footer-shortcuts { display: none; }
  .timeline-empty { left: calc(var(--track-width) + 12px); right: 12px; }
  .timeline-empty > .icon { display: none; }
  .timeline-empty strong { font-size: 10px; }
  .timeline-empty p { font-size: 9px; }
}
@container media-browser (max-height: 210px) {
  .library-empty { min-height: 0; padding: 8px; }
  .empty-library-icon { width: 30px; height: 30px; margin-bottom: 8px; }
  .empty-library-icon .icon { width: 17px; height: 17px; }
  .library-empty h2 { font-size: 12px; margin-bottom: 5px; }
  .library-empty p { font-size: 10px; }
  .library-import { height: 29px; margin-top: 12px; }
}
@container media-browser (max-height: 150px) {
  .empty-library-icon, .library-empty p { display: none; }
  .library-empty h2 { margin-bottom: 0; }
}
@container media-browser (max-height: 75px) {
  .library-empty h2 { display: none; }
  .library-import { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  button, select, .media-card, .panel-resizer > span { transition: none; }
}
