/* Shared visual system for the editing workspace. Layout and interaction live in editor.css. */
:root {
    --studio-bg: #eef0f3;
    --studio-panel: #ffffff;
    --studio-raised: #f5f6f8;
    --studio-hover: #e9edf3;
    --studio-stage: #e2e5e9;
    --studio-border: #dde1e7;
    --studio-text: #242a35;
    --studio-muted: #727c8c;
    --studio-accent: #2868dc;
    --studio-accent-text: #ffffff;
}
html[data-theme=dark] {
    --studio-bg: #111315;
    --studio-panel: #1a1c20;
    --studio-raised: #24272c;
    --studio-hover: #2c3036;
    --studio-stage: #101214;
    --studio-border: #30343a;
    --studio-text: #e9ecf0;
    --studio-muted: #959da9;
    --studio-accent: #91b6fc;
    --studio-accent-text: #122443;
}
html[data-theme] body {
    background: var(--studio-bg);
    color: var(--studio-text);
    --line: var(--studio-border);
    --muted: var(--studio-muted);
}
html[data-theme] header {
    background: var(--studio-panel);
    border-color: var(--studio-border);
    box-shadow: none;
}
.brand strong { font-weight: 650; letter-spacing: -.6px; }
html[data-theme] .brand strong { color: var(--studio-text); }
html[data-theme] .brand strong span { color: var(--studio-muted); opacity: 1; }
html[data-theme] .brand { color: var(--studio-accent); }
html[data-theme] .pill { color: var(--studio-muted); font-size: 9px; letter-spacing: .08em; }
html[data-theme] .actions > span { color: var(--studio-muted); font-size: 11px; }
html[data-theme] button {
    border-color: var(--studio-border);
    background: var(--studio-raised);
    color: var(--studio-text);
    box-shadow: none;
    font-weight: 500;
    transition: background .15s ease, border-color .15s ease;
}
html[data-theme] button:hover:not(:disabled) { background: var(--studio-hover); }
html[data-theme] button:disabled { opacity: .38; }
html[data-theme] .primary,
html[data-theme] .primary:hover:not(:disabled) {
    background: var(--studio-accent);
    color: var(--studio-accent-text);
    border-color: transparent;
    font-weight: 600;
}
html[data-theme] #theme-toggle { background: transparent; border-color: transparent; color: var(--studio-muted); }
html[data-theme] #theme-toggle:hover { background: var(--studio-raised); color: var(--studio-text); }
html[data-theme] aside { background: var(--studio-panel); border-color: var(--studio-border); }
.library, .inspector { scrollbar-width: thin; scrollbar-color: #69717f55 transparent; }
.library > h2, .inspector > .row h2 { font-size: 12px; font-weight: 600; }
html[data-theme] .library .import-button {
    background: var(--studio-raised);
    border: 1px solid var(--studio-border);
    color: var(--studio-text);
    padding: 11px 12px;
    border-radius: 7px;
    box-shadow: none;
}
html[data-theme] .library .import-button:hover { background: var(--studio-hover); border-color: var(--studio-accent); }
#media-name { font-size: 10px; margin-top: 9px; }
hr { margin: 22px 0; }
html[data-theme] .widget-card {
    background: var(--studio-raised);
    border: 1px solid transparent;
    border-radius: 9px;
    box-shadow: none;
}
html[data-theme] .widget-card:hover:not(:disabled) { background: var(--studio-hover); border-color: #8793a44d; }
.widget-card::after { content: '+'; position: absolute; right: 11px; top: 8px; color: var(--studio-muted); font-size: 18px; font-weight: 400; }
html[data-theme] .widget-card canvas { background: transparent; border-radius: 0; }
.widget-card strong { font-size: 12px; letter-spacing: -.1px; }
.widget-card small { font-size: 10px; line-height: 1.5; }
html[data-theme] #guide-button { color: var(--studio-muted); border-color: transparent; background: transparent; }
html[data-theme] #guide-button:hover { color: var(--studio-text); background: var(--studio-raised); }
.editor-heading { min-height: 24px; }
.editor-heading h1 { font-size: 15px; font-weight: 550; letter-spacing: -.3px; }
html[data-theme] .badge { border-color: var(--studio-border); color: var(--studio-muted); background: transparent; padding: 5px 8px; font-size: 9px; }
html[data-theme] .badge.ready { color: #64ac92; border-color: #64ac9233; }
html[data-theme] .preview-shell {
    background: var(--studio-stage);
    border-color: var(--studio-border);
    border-radius: 8px;
    box-shadow: none;
}
html[data-theme] .video-surface { background: var(--studio-stage); border-radius: 3px; }
html[data-theme] .empty > span { color: var(--studio-accent); border: 0; background: var(--studio-raised); border-radius: 12px; }
html[data-theme] .empty h2 { color: var(--studio-text); font-weight: 550; }
html[data-theme] .empty p, html[data-theme] .empty small { color: var(--studio-muted); }
html[data-theme] .transport #play { background: transparent; border-color: transparent; color: var(--studio-text); }
html[data-theme] .transport #play:hover { background: var(--studio-raised); }
html[data-theme] #clock { color: var(--studio-muted); font-size: 10px; }
html[data-theme] .gps-actions { background: transparent; border-color: var(--studio-border); border-radius: 6px; }
html[data-theme] .transport .gps-actions button { background: transparent; color: var(--studio-muted); border-color: var(--studio-border); }
html[data-theme] .transport .gps-actions button:hover:not(:disabled) { color: var(--studio-text); background: var(--studio-raised); }
html[data-theme] .timeline { padding-top: 6px; border-top: 1px solid var(--studio-border); }
html[data-theme] .timeline-track { border-color: var(--studio-border); border-radius: 5px; background: var(--studio-stage); }
html[data-theme] .timeline-track.loaded { border-color: #859ab6; }
html[data-theme] .timeline-range { border-color: #9cb6df; box-shadow: -700px 0 0 700px #10131870, 700px 0 0 700px #10131870; }
html[data-theme] .timeline-trim { background: #9cb6dfb3; }
.timeline-ruler span { font-variant-numeric: tabular-nums; }
.timeline-playhead { background: #f1c685; }
html[data-theme] .status-row, html[data-theme] .trial-notice { color: var(--studio-muted); font-size: 10px; }
html[data-theme] .trial-notice { border-color: var(--studio-border); }
html[data-theme] .inspector > label { margin-top: 22px; margin-bottom: 10px; color: var(--studio-muted); font-size: 9px; letter-spacing: .08em; }
html[data-theme] .style-picker button { background: var(--studio-raised); border-color: transparent; border-radius: 7px; }
html[data-theme] .style-picker .selected { border-color: var(--studio-accent); background: var(--studio-hover); box-shadow: none; }
html[data-theme] .style-picker canvas { background: transparent; border-radius: 0; }
html[data-theme=light] .widget-card canvas,
html[data-theme=light] .style-picker canvas { background: #30363e; border-radius: 5px; }
.placed-widget:focus { outline: none; }
.placed-widget:focus-visible { outline: 1px solid #9cb6df; outline-offset: 2px; }
html[data-theme] .inspector select, html[data-theme] .trim-fields input {
    background: var(--studio-raised); color: var(--studio-text); border-color: var(--studio-border); box-shadow: none;
}
html[data-theme] input[type=color] { background: var(--studio-raised); border: 1px solid var(--studio-border); border-radius: 6px; }
html[data-theme] .inspector-delete { background: transparent; color: #c7838c; border-color: transparent; font-size: 10px; }
html[data-theme] .inspector-delete:hover:not(:disabled) { color: #d65f71; background: #bc596412; }
html[data-theme] dialog { background: var(--studio-panel); color: var(--studio-text); border-color: var(--studio-border); border-radius: 14px; box-shadow: 0 24px 100px #0006; }
dialog::backdrop { background: #080c1299; backdrop-filter: blur(3px); }
html[data-theme] .dialog-body > p, html[data-theme] .dialog-body label, html[data-theme] .dialog-body small { color: var(--studio-muted); }
html[data-theme] .dialog-body input { background: var(--studio-raised); color: var(--studio-text); border-color: var(--studio-border); }
html[data-theme] #export-panel, html[data-theme] #export-panel[data-state=complete] { background: var(--studio-panel); border-color: var(--studio-border); }
#studio-account-link { color: var(--studio-muted); font-size: 11px; white-space: nowrap; }
#studio-account-link:hover { color: var(--studio-text); }
html[data-theme] #export-panel strong { color: var(--studio-text); }
html[data-theme] #export-panel p { color: var(--studio-muted); }
html[data-theme] #export-panel[data-state=busy] { border-radius: 14px; }
.paid-video-list { display: grid; gap: 6px; max-height: 38dvh; overflow: auto; }
.paid-video-list button { text-align: left; overflow-wrap: anywhere; }
#export-panel .export-heading { display: flex; align-items: center; gap: 12px; }
#export-panel .export-heading svg { display: none; }
#export-panel[data-state=busy] .export-heading svg { display: block; width: 32px; height: 32px; flex: none; color: var(--studio-accent); }
#export-panel .export-progress { display: grid; gap: 7px; }
#export-panel .export-readout { justify-self: end; color: var(--studio-text); font-size: 13px; font-variant-numeric: tabular-nums; }
html[data-theme] #export-panel progress {
    display: block;
    height: 6px;
    accent-color: var(--studio-accent);
    border-radius: 999px;
}
#export-panel progress[value] { appearance: none; background: var(--studio-border); }
#export-panel progress[value]::-webkit-progress-bar { background: var(--studio-border); }
#export-panel progress[value]::-webkit-progress-value { background: var(--studio-accent); border-radius: 999px; }
#export-panel progress[value]::-moz-progress-bar { background: var(--studio-accent); border-radius: 999px; }
html[data-theme] #export-panel .download { background: var(--studio-accent); color: var(--studio-accent-text); border-color: transparent; }
@media (min-width: 1025px) {
    main { grid-template-columns: 216px minmax(350px, 1fr) 248px; }
    .library, .inspector { padding: 22px 16px; }
    .library .widget-card { padding: 16px 12px 12px; margin-top: 12px; }
    .library .widget-card canvas { width: 82px; height: 82px; }
    .library #add-altimeter canvas { width: 33px; height: 82px; }
    .editor { padding: 16px 20px 10px; }
    .transport { padding: 9px 0; }
    .timeline-track { height: 62px; }
}
@media (max-width: 1024px) {
    html[data-theme] .mobile-tools { background: var(--studio-panel); border-color: var(--studio-border); gap: 6px; }
    html[data-theme] .mobile-tools button { background: transparent; border-color: transparent; border-radius: 8px; color: var(--studio-muted); }
    html[data-theme] .mobile-tools button[aria-expanded=true] { background: var(--studio-raised); color: var(--studio-text); border-color: var(--studio-border); }
    html[data-theme] .mobile-tools button:first-child { color: var(--studio-accent); }
    html[data-theme] body[data-mobile-panel] main > aside { background: var(--studio-panel); border-color: var(--studio-border); box-shadow: 0 -8px 24px #0002; border-radius: 12px 12px 0 0; }
    .editor-heading h1 { font-size: 14px; }
    html[data-theme] .transport .gps-actions button { font-size: 10px; }
    html[data-theme] .widget-card { border-color: var(--studio-border); }
}
@media (prefers-reduced-motion: reduce) { html[data-theme] button { transition: none; } }

/* Make available widgets read as clear, actionable choices in the library. */
html[data-theme] .library .widget-card {
    border-color: #889ab23d;
    background: #edf1f7;
    padding-top: 20px;
    padding-bottom: 15px;
}
html[data-theme=dark] .library .widget-card {
    background: #2b3038;
    border-color: #67778e70;
}
html[data-theme] .library .widget-card:hover:not(:disabled) {
    border-color: var(--studio-accent);
    background: #e3ebf8;
}
html[data-theme=dark] .library .widget-card:hover:not(:disabled) { background: #354153; }
.library .widget-card::after {
    display: grid;
    place-items: center;
    top: 10px;
    right: 10px;
    width: 25px;
    height: 25px;
    border: 1px solid #7896c25c;
    border-radius: 7px;
    background: #779bd724;
    color: var(--studio-accent);
    font-size: 20px;
    line-height: 1;
}
.library .widget-card strong { font-size: 13px; font-weight: 600; }
html[data-theme] .library .widget-card small { color: #55729b; font-size: 11px; }
html[data-theme=dark] .library .widget-card small { color: #bccce3; }
@media (min-width: 1025px) {
    .library .widget-card canvas { width: 104px; height: 104px; }
    .library #add-altimeter canvas { width: 42px; height: 104px; }
}

@media (max-width: 1024px) { html[data-theme] .library .widget-card small { font-size: 0; } }

/* Match SnapPix desktop's compact, two-column widget catalog. */
.widget-catalog { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
html[data-theme] .widget-catalog .widget-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 106px;
    min-height: 106px;
    margin: 0;
    padding: 5px 4px;
    border: 1px solid #d6dfe9;
    border-radius: 4px;
    background: #e5eaf1;
    text-align: center;
}
html[data-theme=dark] .widget-catalog .widget-card { background: #0e1621; border-color: #26303e; }
html[data-theme] .widget-catalog .widget-card:hover:not(:disabled) { border-color: var(--studio-accent); background: var(--studio-hover); }
html[data-theme] .widget-catalog .widget-card::after { display: none; }
html[data-theme] .widget-catalog .widget-card canvas,
html[data-theme] .widget-catalog .widget-card small { display: none; }
.widget-catalog .desktop-widget-thumbnail { display: block; width: 100%; height: 74px; object-fit: contain; flex-shrink: 0; }
html[data-theme] .widget-catalog .widget-card strong { margin: 4px 0 0; font-size: 10.5px; line-height: 16px; font-weight: 500; letter-spacing: -.15px; }
html[data-theme] .widget-catalog .widget-card:disabled { opacity: .65; }
html[data-theme] .widget-catalog .widget-card[data-demo-locked] { opacity: .48; cursor: not-allowed; }
.widget-catalog .widget-card[data-demo-locked] img { filter: grayscale(.6); }
.widget-catalog-hint { margin: 14px 0 0; color: var(--studio-muted); font-size: 10px; line-height: 1.65; }
@media (min-width: 1025px) {
    main { grid-template-columns: 264px minmax(350px, 1fr) 248px; }
    .library { padding-inline: 10px; }
    .library > h2, .library > #media-name { margin-inline: 5px; }
}
@media (max-width: 1024px) {
    body[data-mobile-panel=library] .library > #widget-catalog { display: grid !important; }
    .widget-catalog { margin-top: 8px; }
    html[data-theme] .widget-catalog .widget-card { height: 106px; min-height: 106px; }
    .widget-catalog #add-widget { order: -2; }
    .widget-catalog #add-altimeter { order: -1; }
}

/* A calm welcome, with a subtle brand wash instead of a promotional splash. */
html[data-theme] #access-dialog { width: min(480px, calc(100vw - 28px)); padding: 0; border-radius: 20px; border: 1px solid #d7e0ee; background: #fbfcff; color: #20314b; box-shadow: 0 28px 100px #0005; }
#access-dialog::backdrop { background: #101722a6; backdrop-filter: blur(6px); }
#access-dialog .dialog-body { padding: 36px; background: radial-gradient(ellipse at 15% 0%, #85a6ff24, transparent 60%); }
#access-dialog .access-emblem { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 22px; border-radius: 12px; background: #497ce914; color: #578be9; }
#access-dialog .access-emblem svg { display: block; }
#access-dialog .eyebrow { color: #627a9b; font-size: 10px; letter-spacing: 1.3px; margin: 0 0 12px; }
#access-dialog h2 { max-width: 350px; font-size: 29px; line-height: 1.18; letter-spacing: -.9px; font-weight: 600; }
#access-dialog .access-benefits { display: flex; gap: 18px; margin-top: 20px; margin-bottom: 24px; color: #60718b; font-size: 11px; }
#access-dialog .access-benefits span::before { content: '✓'; margin-right: 6px; color: #668bd2; }
#access-dialog label { font-size: 12px; }
#access-dialog input[type=email] { height: 46px; border-radius: 9px; background: #fff; color: #20314b; border-color: #cbd6e6; }
#access-dialog .follow-up-consent { font-size: 11px; line-height: 1.6; color: #718099; margin: 14px 0; }
#access-dialog #email-submit { min-height: 46px; margin-top: 10px; border-radius: 9px; background: #4478db; border-color: #4478db; color: #fff; font-size: 13px; }
#access-dialog #email-submit:hover { background: #386aca; }
#access-dialog #access-status:empty { display: none; }
#access-dialog #access-status { margin: 16px 0; padding: 12px 14px; background: #eaf0fc; border-radius: 9px; color: #345c96; font-size: 13px; line-height: 1.6; }
#access-dialog #access-status[data-state=error] { color: #a74050; background: #fbecf0; }
#access-dialog .access-sample { display: block; text-align: center; margin-top: 22px; color: #5579b1; font-size: 12px; }
#access-dialog small { margin-top: 22px; padding-top: 18px; border-top: 1px solid #dce3ee; color: #7b889b; font-size: 10px; line-height: 1.6; }
html[data-theme=dark] #access-dialog { background: #24282f; border-color: #424953; color: #f0f3f8; }
html[data-theme=dark] #access-dialog .access-benefits, html[data-theme=dark] #access-dialog label { color: #bac5d5; }
html[data-theme=dark] #access-dialog input[type=email] { background: #1d2229; color: #f0f3f8; border-color: #4d596a; }
html[data-theme=dark] #access-dialog .eyebrow, html[data-theme=dark] #access-dialog .access-sample { color: #a3bde7; }
html[data-theme=dark] #access-dialog small { color: #a2afc2; border-color: #414954; }
html[data-theme=dark] #access-dialog #access-status { background: #303e55; color: #d5e5ff; }
html[data-theme=dark] #access-dialog #access-status[data-state=error] { background: #472f38; color: #ffc3ce; }
@media (max-width: 520px) { #access-dialog .dialog-body { padding: 28px 24px; } #access-dialog h2 { font-size: 26px; } #access-dialog .access-emblem { margin-bottom: 16px; } }

/* Studio identity: a video frame, play symbol and telemetry trace. */
.studio-brand-mark { display: block; flex: none; }
html[data-theme] #access-dialog { border-radius: 16px; }
#access-dialog .access-emblem { width: 48px; height: 48px; background: transparent; border-radius: 0; margin-bottom: 24px; }
#access-dialog .access-emblem img { display: block; width: 48px; height: 48px; }
#access-dialog h2 { max-width: none; font-size: 30px; line-height: 1.25; letter-spacing: -.8px; }
#access-dialog .access-studio-name { color: #4c72cc; }
@supports (background-clip: text) {
    #access-dialog .access-studio-name { background: linear-gradient(100deg, #4d85d7, #8663c9); background-clip: text; color: transparent; }
    html[data-theme=dark] #access-dialog .access-studio-name { background-image: linear-gradient(100deg, #8dbbff, #baa2f2); }
}
@media (max-width: 520px) { #access-dialog h2 { font-size: 27px; } }

#access-dialog #access-close { display: grid; place-items: center; padding: 0; line-height: 1; }
#access-dialog #access-close svg { display: block; margin: 0; }

/* Quiet editor chrome and a strong, consistent transport hierarchy. */
html[data-theme] .transport { gap: 12px; padding: 10px 0; align-items: center; }
html[data-theme] .transport #play { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; padding: 0; border-radius: 50%; background: var(--studio-accent); color: var(--studio-accent-text); border: 1px solid transparent; box-shadow: 0 2px 8px #0002; }
html[data-theme] .transport #play:hover:not(:disabled) { background: var(--studio-accent); filter: brightness(1.09); }
.transport #play svg { display: block; width: 24px; height: 24px; }
html[data-theme] #clock { color: var(--studio-text); font-size: 11px; }
html[data-theme] .transport .gps-actions { gap: 4px; padding: 4px; border: 0; border-radius: 9px; background: var(--studio-panel); overflow: visible; }
html[data-theme] .transport .gps-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--studio-text); font-size: 11px; font-weight: 500; white-space: nowrap; }
html[data-theme] .transport .gps-actions button:hover:not(:disabled) { background: var(--studio-hover); }
html[data-theme] .transport .gps-actions button:disabled { color: var(--studio-muted); opacity: .5; }
.transport .gps-actions button::before { content: ''; display: block; flex: none; width: 15px; height: 15px; background: currentColor; mask: var(--tool-icon) center / contain no-repeat; }
.transport .gps-actions .video-info-button, .phone-sheet .gps-actions .video-info-button { --tool-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5m0-8h.01'/%3E%3C/svg%3E"); }
.transport .gps-actions button:nth-child(2), .phone-sheet .gps-actions #sync { --tool-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M12 21s7-6 7-12a7 7 0 1 0-14 0c0 6 7 12 7 12Z'/%3E%3Ccircle cx='12' cy='9' r='2.5'/%3E%3C/svg%3E"); }
.transport .gps-actions button:nth-child(3), .phone-sheet .gps-actions #replace-gps { --tool-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 5 6-2 6 2 6-2v16l-6 2-6-2-6 2Zm6-2v16m6-14v16'/%3E%3C/svg%3E"); }
:is(.transport, .phone-sheet) .gps-actions #gps-map { --tool-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='17' r='2.5'/%3E%3Ccircle cx='18' cy='6' r='2.5'/%3E%3Cpath d='M8.5 17H16a2.75 2.75 0 0 0 0-5.5H8a2.75 2.75 0 0 1 0-5.5h7.5'/%3E%3C/svg%3E"); }
.transport .gps-actions #download-gpx, .phone-sheet .gps-actions #download-gpx { --tool-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12m-5-5 5 5 5-5M4 16v5h16v-5'/%3E%3C/svg%3E"); }
@media (max-width: 1024px) {
    html[data-theme] .transport .gps-actions { width: 100%; flex-wrap: wrap; gap: 2px; }
    html[data-theme] .transport .gps-actions button { flex: 1; min-height: 40px; padding: 8px 6px; font-size: 10px; gap: 5px; }
}
@media (max-width: 380px) { .transport .gps-actions button::before { width: 12px; height: 12px; } }

/* Separate desktop work areas with the same quiet gutters as SnapPix. */
@media (min-width: 1025px) {
    html[data-theme] main { gap: 6px; padding: 10px; background: var(--studio-bg); }
    html[data-theme] main > .library,
    html[data-theme] main > .editor,
    html[data-theme] main > .inspector { border: 1px solid var(--studio-border); border-radius: 9px; background: var(--studio-panel); min-width: 0; }
    html[data-theme] main > .editor { padding: 16px 18px 10px; }
}

/* Keep the main import action visible and the catalog close at hand. */
html[data-theme] .library .import-button {
    background: var(--studio-accent);
    color: var(--studio-accent-text);
    border: 1px solid transparent;
    font-weight: 600;
    margin-top: 14px;
    margin-bottom: 4px;
}
html[data-theme] .library .import-button:hover:not(:disabled) {
    background: var(--studio-accent);
    border-color: transparent;
    filter: brightness(1.08);
}
@media (min-width: 1025px) {
    .library > #media-name { margin-top: 5px; margin-bottom: 0; min-height: 0; }
    .library > hr { flex: 0 0 1px; margin: 14px 0; }
}

.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.workspace-heading h2 { font-size: 12px; font-weight: 600; }
html[data-theme] .workspace-heading #guide-button {
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    padding: 0;
    border: 1px solid var(--studio-border);
    border-radius: 50%;
    font-size: 13px;
}
html[data-theme] .library .import-button { display: flex; align-items: center; justify-content: center; gap: 7px; }

/* Keep clicks on the transport button while its decorative icon is displayed. */
.transport #play svg { pointer-events: none; }

.timeline-edit-tools { display: flex; align-items: center; gap: 5px; padding: 8px 0 2px; }
html[data-theme] .timeline-edit-tools button { padding: 6px 10px; min-height: 32px; border: 1px solid transparent; background: transparent; border-radius: 5px; font-size: 12px; }
html[data-theme] .timeline-edit-tools button:hover:not(:disabled) { background: var(--studio-hover); border-color: var(--studio-border); }
#edit-duration { margin-left: auto; color: var(--studio-muted); font: 10px Consolas, monospace; }
.timeline-edit-marks { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.timeline-cut-mark { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, #111c 0 4px, #8c616455 4px 8px); border-inline: 1px solid #ba8190; }
.timeline-split-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: #e2e9ff; box-shadow: 0 0 0 1px #19213288; }
@media (max-width: 1024px) { .timeline-edit-tools { padding-top: 2px; } html[data-theme] .timeline-edit-tools button { min-height: 36px; padding: 6px 8px; } }

/* Split clips read as separate pieces; the playhead selects the section to cut. */
.timeline-clip-section { position: absolute; inset-block: 2px; border: 1px solid #aab6ca99; border-radius: 5px; box-sizing: border-box; background: #657cab0a; box-shadow: inset 2px 0 0 #101419, inset -2px 0 0 #101419; }
.timeline-clip-section.selected { border: 2px solid #78adff; background: #5798ed1a; box-shadow: inset 5px 0 0 #4389e4, inset -5px 0 0 #4389e4; }
.timeline-clip-section > span { position: absolute; bottom: 5px; left: 9px; max-width: calc(100% - 18px); overflow: hidden; white-space: nowrap; font-size: 9px; color: #fff; padding: 1px 4px; border-radius: 3px; background: #17202bd9; }
.timeline-split-mark { width: 4px; margin-left: -2px; background: #11151c; box-shadow: none; }
.timeline-range { border-color: transparent; }
@media (max-width: 600px) { html[data-theme] .timeline-edit-tools button { font-size: 11px; padding-inline: 6px; } #edit-duration { font-size: 9px; } }

/* Only the selected split clip has a selection outline. Remaining clips repack. */
.timeline-clip-section { border: 0; box-shadow: none; border-radius: 4px; overflow: hidden; }
.timeline-clip-section.selected { border: 2px solid #78adff; box-shadow: none; }
.timeline-clip-section > .clip-filmstrip { position: absolute; inset: 0 2px; display: flex; padding: 0; background: none; max-width: none; }
.clip-filmstrip > :is(img, span) { display: block; flex: 0 0 var(--filmstrip-tile-width); min-width: 0; height: 100%; object-fit: cover; background-repeat: no-repeat; }
.timeline-clip-section > .clip-caption { z-index: 1; }
.timeline-track.has-splits .timeline-frames, .timeline-track.has-splits .timeline-name, .timeline-track.has-splits > .timeline-trim, .timeline-track.has-splits .timeline-range { visibility: hidden; }
html[data-theme] .clip-edge { position: absolute; top: 0; bottom: 0; width: 12px; padding: 0; border: 0; border-radius: 0; background: #4389e4; pointer-events: auto; cursor: ew-resize; touch-action: none; visibility: hidden; z-index: 3; }
.clip-edge-start { left: 0; } .clip-edge-end { right: 0; }
.clip-edge::after { content: ''; position: absolute; top: 25%; bottom: 25%; left: 5px; width: 2px; background: white; border-radius: 2px; }
.timeline-clip-section.selected .clip-edge { visibility: visible; }


.canvas-format-label { display: inline-flex; align-items: center; gap: 8px; color: var(--studio-muted); font-size: 11px; margin-left: auto; }
html[data-theme] #canvas-format { background: var(--studio-raised); color: var(--studio-text); border: 1px solid var(--studio-border); border-radius: 6px; padding: 6px 8px; font: inherit; min-height: 32px; }
html[data-theme] .video-surface { background: #000; }
@media (max-width: 1024px) { .canvas-format-label { font-size: 10px; gap: 5px; } html[data-theme] #canvas-format { max-width: 120px; } }

html[data-theme] #rotate-video { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 6px 9px; border-radius: 6px; font-size: 11px; }
#rotate-video svg { display: block; pointer-events: none; }
@media (max-width: 600px) { #rotate-video span { display: none; } html[data-theme] #rotate-video { padding-inline: 7px; } .editor-heading { gap: 6px; flex-wrap: wrap; } }

.video-tools { position: relative; border: 0; padding: 0; margin: 0; color: var(--studio-text); }
.video-tools summary { display: grid; place-items: center; width: 32px; height: 32px; cursor: pointer; list-style: none; border: 1px solid var(--studio-border); border-radius: 6px; background: var(--studio-raised); }
.video-tools summary::-webkit-details-marker { display: none; }
.video-tools-menu { position: absolute; right: 0; top: 38px; z-index: 30; width: 190px; padding: 5px; background: var(--studio-panel); border: 1px solid var(--studio-border); border-radius: 8px; box-shadow: 0 10px 30px #0005; }
html[data-theme] .video-tools-menu button { display: block; width: 100%; padding: 10px 12px; margin: 0; text-align: left; background: transparent; border: 0; border-radius: 4px; font-size: 12px; }
.video-tools summary:focus-visible { outline: 2px solid var(--studio-accent); outline-offset: 2px; }

.canvas-size-picker { position: relative; margin: 0; padding: 0; border: 0; color: var(--studio-text); }
.canvas-size-picker summary { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 5px 10px; border: 1px solid var(--studio-border); border-radius: 6px; background: var(--studio-raised); cursor: pointer; list-style: none; }
.canvas-size-picker summary::-webkit-details-marker { display: none; }
.canvas-shape { display: inline-block; box-sizing: border-box; border: 1.5px solid currentColor; border-radius: 2px; flex: none; }
.canvas-size-menu { position: absolute; top: 39px; right: 0; z-index: 40; width: 235px; max-width: calc(100vw - 28px); max-height: min(460px, 65dvh); overflow-y: auto; padding: 5px; background: var(--studio-panel); border: 1px solid var(--studio-border); border-radius: 8px; box-shadow: 0 12px 40px #0005; }
html[data-theme] .canvas-size-menu button { display: flex; align-items: center; width: 100%; gap: 10px; min-height: 47px; padding: 7px 8px; border: 0; border-radius: 5px; text-align: left; background: transparent; font-size: 12px; }
html[data-theme] .canvas-size-menu button[aria-checked=true] { background: var(--studio-hover); }
.canvas-shape-cell { width: 27px; display: grid; place-items: center; flex: none; }
.canvas-option-copy { display: flex; flex-direction: column; gap: 2px; }
.canvas-option-copy small { color: var(--studio-muted); font-size: 10px; }
.canvas-option-tick { margin-left: auto; color: var(--studio-accent); visibility: hidden; }
[aria-checked=true] > .canvas-option-tick { visibility: visible; }
.video-surface.canvas-size-active { outline: 2px solid #a5c7ff; outline-offset: -2px; }
.video-surface.canvas-size-active::after { content: ''; position: absolute; inset: 0; border: 2px solid #a5c7ff; pointer-events: none; z-index: 8; }
.canvas-size-picker summary:focus-visible { outline: 2px solid var(--studio-accent); outline-offset: 2px; }

html[data-theme] #frame-fit, html[data-theme] #reframe-video { min-height: 32px; border: 1px solid var(--studio-border); background: var(--studio-raised); color: var(--studio-text); border-radius: 6px; padding: 6px 8px; font-size: 11px; }
html[data-theme] #reframe-video[aria-pressed=true] { border-color: #78adff; color: #78adff; }
.video-surface.reframing { cursor: grab; touch-action: none; }
.video-surface.reframing:active { cursor: grabbing; }
@media (max-width: 900px) { .editor-heading { flex-wrap: wrap; } #frame-fit { max-width: 140px; } }

html[data-theme] #follow-subject { min-height: 32px; padding: 6px 9px; font-size: 11px; border-radius: 6px; border: 1px solid #6d9bdd66; }
#follow-dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 24px; overflow: auto; border-radius: 12px; }
.follow-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.follow-heading h2 { font-size: 23px; letter-spacing: -.5px; }
.follow-heading .eyebrow { margin: 0 0 8px; }
#follow-close { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; font-size: 22px; flex: none; }
#follow-help, #follow-status { margin: 16px 0; color: var(--studio-muted); font-size: 13px; line-height: 1.6; }
.follow-selection { background: #000; border-radius: 7px; overflow: hidden; text-align: center; }
#follow-canvas { display: block; max-width: 100%; max-height: 45dvh; width: auto; height: auto; margin: auto; touch-action: none; cursor: crosshair; }
.follow-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
#follow-progress { display: block; width: 100%; height: 6px; }
#follow-dialog > small { display: block; margin-top: 16px; color: var(--studio-muted); font-size: 11px; line-height: 1.6; }
@media (max-width: 600px) { #follow-dialog { padding: 18px; } .follow-heading h2 { font-size: 20px; } .follow-actions { flex-wrap: wrap; } .editor-heading { flex-wrap: wrap; } }

.video-zoom-control { display: block; padding: 12px; border-top: 1px solid var(--studio-border); color: var(--studio-text); font-size: 12px; }
.video-zoom-control > span { display: flex; justify-content: space-between; margin-bottom: 10px; }
#video-zoom { width: 100%; accent-color: var(--studio-accent); }

/* One restrained tool dock, with clear groups and consistent hit areas. */
.canvas-toolbar { display: flex; flex-wrap: wrap; align-items: center; align-self: center; justify-content: center; gap: 0; max-width: 100%; margin: 0 0 12px; padding: 4px; border: 1px solid var(--studio-border); border-radius: 10px; background: var(--studio-panel); box-shadow: 0 3px 12px #00000012; position: relative; z-index: 10; }
.canvas-tool-group { display: flex; align-items: center; gap: 4px; padding: 0 5px; min-width: 0; }
.canvas-tool-group + .canvas-tool-group { border-left: 1px solid var(--studio-border); }
.canvas-toolbar .canvas-format-label { margin: 0; }
html[data-theme] .canvas-toolbar button, html[data-theme] .canvas-toolbar summary { min-height: 32px; border: 1px solid transparent; background: transparent; color: var(--studio-text); border-radius: 5px; padding: 6px 9px; font-size: 11px; box-shadow: none; }
html[data-theme] .canvas-toolbar button:hover:not(:disabled), html[data-theme] .canvas-toolbar summary:hover { background: var(--studio-hover); }
html[data-theme] .canvas-toolbar #reframe-video[aria-pressed=true] { color: var(--studio-accent); background: var(--studio-hover); border-color: var(--studio-border); }
.fit-fill-switch { display: inline-flex; padding: 2px; background: var(--studio-bg); border-radius: 6px; }
html[data-theme] .fit-fill-switch button { min-height: 28px; padding: 4px 9px; color: var(--studio-muted); }
html[data-theme] .fit-fill-switch button[aria-pressed=true] { background: var(--studio-raised); color: var(--studio-text); box-shadow: 0 1px 3px #0002; }
.canvas-toolbar #reframe-video, .canvas-toolbar #follow-subject { display: inline-flex; align-items: center; gap: 7px; }
.canvas-toolbar #reframe-video::before, .canvas-toolbar #follow-subject::before { content: ''; display: block; width: 15px; height: 15px; background: currentColor; flex: none; }
.canvas-toolbar #reframe-video::before { mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3v14h14M3 7h14v14'/%3E%3C/svg%3E") center / contain no-repeat; }
.canvas-toolbar #follow-subject::before { mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5'/%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3C/svg%3E") center / contain no-repeat; }
.canvas-toolbar .canvas-size-menu, .canvas-toolbar .video-tools-menu { top: 40px; }
html[data-theme] .canvas-toolbar .canvas-size-menu button, html[data-theme] .canvas-toolbar .video-tools-menu button { text-align: left; justify-content: flex-start; }
.crop-guides { display: none; position: absolute; left: 50%; top: 50%; pointer-events: none; z-index: 11; }
.reframing .crop-guides { display: block; }
.crop-frame { position: absolute; pointer-events: auto; touch-action: none; cursor: move; border: 1px solid #dbe8ff; box-shadow: 0 0 0 200vmax #05091299; }
html[data-theme] .crop-handle {
    position: absolute; display: grid; place-items: center; width: 34px; height: 34px;
    pointer-events: auto; touch-action: none; padding: 0; border: 0; background: transparent;
    box-shadow: none; color: #fff; z-index: 1;
}
.crop-handle::after { content: ''; width: 20px; height: 4px; border-radius: 3px; background: currentColor; box-shadow: 0 0 0 1px #1118; }
.crop-handle:is(.crop-handle-left, .crop-handle-right)::after { width: 4px; height: 20px; }
.crop-handle-top { top: 0; left: 50%; transform: translate(-50%, -50%); cursor: ns-resize; }
.crop-handle-bottom { bottom: 0; left: 50%; transform: translate(-50%, 50%); cursor: ns-resize; }
.crop-handle-left { left: 0; top: 50%; transform: translate(-50%, -50%); cursor: ew-resize; }
.crop-handle-right { right: 0; top: 50%; transform: translate(50%, -50%); cursor: ew-resize; }
html[data-theme] .preview-shell:has(.crop-assist:not([hidden])) { display: flex; flex-direction: column; align-items: center; }
.preview-shell:has(.crop-assist:not([hidden])) > .video-surface { flex: none; }
.crop-handle-top-left { top: 0; left: 0; transform: translate(-50%, -50%); cursor: nwse-resize; }
.crop-handle-top-right { top: 0; right: 0; transform: translate(50%, -50%); cursor: nesw-resize; }
.crop-handle-bottom-left { bottom: 0; left: 0; transform: translate(-50%, 50%); cursor: nesw-resize; }
.crop-handle-bottom-right { bottom: 0; right: 0; transform: translate(50%, 50%); cursor: nwse-resize; }
.crop-handle:is(.crop-handle-top-left, .crop-handle-top-right, .crop-handle-bottom-left, .crop-handle-bottom-right)::after { width: 9px; height: 9px; border-radius: 50%; }
.crop-assist { display: flex; flex: none; justify-content: center; gap: 8px; padding: 4px 0; }
html[data-theme] .crop-assist button { min-height: 36px; padding: 5px 14px; border-radius: 7px; font-size: 12px; }
html[data-theme] .crop-assist .crop-confirm { background: var(--studio-accent); color: var(--studio-accent-text); border-color: transparent; }
html[data-theme] .crop-assist .crop-confirm:hover { filter: brightness(1.09); }
@media (max-width: 700px) {
    .canvas-toolbar { margin-bottom: 7px; row-gap: 4px; padding: 3px; border-radius: 8px; }
    .canvas-tool-group { padding-inline: 3px; }
    html[data-theme] .canvas-toolbar button, html[data-theme] .canvas-toolbar summary { min-height: 34px; padding-inline: 7px; }
    .canvas-toolbar .canvas-size-menu { left: 0; right: auto; }
}

html[data-theme] .preview-shell { position: relative; justify-content: center; }

/* Sized, aligned artwork and a distinct trigger surface for the canvas picker. */
html[data-theme] .canvas-toolbar .canvas-size-picker > summary {
    min-height: 34px; gap: 9px; padding: 5px 10px 5px 7px;
    border: 1px solid var(--studio-border); border-radius: 6px;
    background: var(--studio-raised); font-size: 12px; font-weight: 500;
}
.size-trigger-icon { display: grid; place-items: center; width: 24px; height: 24px; flex: none; color: var(--studio-text); }
.size-trigger-icon .canvas-shape { max-width: 17px; max-height: 17px; border-width: 1.4px; border-radius: 2px; opacity: .9; }
.size-trigger-label { line-height: 20px; }
.size-trigger-chevron { display: block; flex: none; margin-left: 3px; color: var(--studio-muted); }
html[data-theme] .canvas-toolbar .canvas-size-picker > summary:hover { border-color: #7d94b377; background: var(--studio-hover); }
html[data-theme] .canvas-toolbar .canvas-size-picker[open] > summary { border-color: #739bd5; background: var(--studio-hover); }
.canvas-size-picker[open] .size-trigger-chevron { transform: rotate(180deg); color: var(--studio-text); }
.canvas-toolbar .canvas-size-menu { top: 43px; padding: 6px; border-radius: 9px; }
html[data-theme] .canvas-toolbar .canvas-size-menu button { gap: 12px; min-height: 49px; padding: 8px 10px; border-radius: 5px; }
.canvas-size-menu .canvas-shape-cell { color: var(--studio-muted); }
.canvas-size-menu button[aria-checked=true] .canvas-shape-cell { color: var(--studio-accent); }
.canvas-size-menu .canvas-option-copy > span { font-weight: 500; line-height: 18px; }
.canvas-size-menu .canvas-option-copy small { line-height: 15px; }
@media (prefers-reduced-motion: no-preference) { .size-trigger-chevron { transition: transform .15s ease; } }

.tracking-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; margin: -3px 0 10px; border: 1px solid var(--studio-border); border-left: 2px solid #79a9ee; border-radius: 6px; background: var(--studio-raised); }
.tracking-state-copy { min-width: 0; }
.tracking-state-copy > div { display: flex; align-items: center; gap: 8px; }
.tracking-state-copy strong { font-size: 11px; font-weight: 600; }
#tracking-state-badge { font-size: 9px; color: #73a5ef; border: 1px solid #73a5ef44; border-radius: 4px; padding: 1px 5px; }
#tracking-state-detail { display: block; color: var(--studio-muted); font-size: 10px; line-height: 1.5; margin-top: 4px; }
.tracking-state-actions { display: flex; align-items: center; gap: 3px; flex: none; }
html[data-theme] .tracking-state-actions button { border: 0; background: transparent; padding: 6px 8px; min-height: 30px; font-size: 10px; }
html[data-theme] #follow-subject[data-tracking-state=on] { color: var(--studio-accent); background: var(--studio-hover); }
.tracking-summary[data-state=paused] { border-left-color: var(--studio-muted); }
.tracking-summary[data-state=paused] #tracking-state-badge { color: var(--studio-muted); border-color: var(--studio-border); }
@media (max-width: 600px) { .tracking-summary { flex-wrap: wrap; padding: 8px 10px; gap: 5px; margin-bottom: 7px; } .tracking-state-actions { margin-left: auto; } }

#follow-dialog #follow-close { padding: 0; line-height: 1; align-self: flex-start; }
#follow-close svg { display: block; pointer-events: none; }
#follow-status[data-state=warning] { padding: 10px 12px; border-left: 2px solid #bf9c70; background: #bc936512; border-radius: 4px; color: var(--studio-text); }

/* A dedicated scrubber keeps the tracking start separate from help text. */
.follow-time-control {
    margin-top: 16px;
    padding: 16px 18px 14px;
    border: 1px solid var(--studio-accent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--studio-accent) 7%, transparent);
}
.follow-time-control label { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--studio-text); font-size: 13px; font-weight: 600; }
#follow-start-label { padding: 5px 8px; border-radius: 5px; background: color-mix(in srgb, var(--studio-accent) 15%, transparent); color: var(--studio-text); font: 600 13px Consolas, monospace; font-variant-numeric: tabular-nums; }
#follow-start { display: block; appearance: none; -webkit-appearance: none; width: 100%; height: 36px; margin: 10px 0 4px; padding: 0; border: 0; background: transparent; cursor: ew-resize; touch-action: pan-y; }
#follow-start::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--studio-accent) 55%, var(--studio-muted)); }
#follow-start::-moz-range-track { height: 6px; border-radius: 3px; background: var(--studio-accent); }
#follow-start::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border: 3px solid #fff; border-radius: 50%; background: var(--studio-accent); box-shadow: 0 1px 5px #0006; }
#follow-start::-moz-range-thumb { width: 14px; height: 14px; border: 3px solid #fff; border-radius: 50%; background: var(--studio-accent); box-shadow: 0 1px 5px #0006; }
#follow-start:focus-visible { outline: 2px solid var(--studio-accent); outline-offset: 4px; border-radius: 5px; }
#follow-start:disabled { opacity: .45; cursor: wait; }
.follow-time-control small { display: block; color: var(--studio-muted); font-size: 11px; line-height: 1.5; }
@media (max-width: 600px) { .follow-time-control { padding: 12px 14px; } }


@media (min-width: 1200px) {
    .editor-heading { display: grid; grid-template-columns: minmax(90px, 1fr) auto; align-items: center; gap: 5px 12px; margin-bottom: 9px; }
    .editor-heading > div:first-child { min-width: 0; }
    .editor-heading h1 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .editor-heading > div:first-child > .badge { display: inline-block; margin-top: 3px; padding: 1px 5px; font-size: 8px; }
    .editor-heading > .canvas-toolbar { margin: 0; justify-self: end; align-self: center; }
}

@media (min-width: 1200px) {
    .editor-heading { position: relative; display: flex; justify-content: flex-start; min-height: 44px; }
    .editor-heading > div:first-child { width: calc((100% - 540px) / 2 - 12px); min-width: 0; }
    .editor-heading > .canvas-toolbar { position: absolute; left: 50%; transform: translateX(-50%); margin: 0; width: max-content; max-width: 100%; }
}

#video-plane { position: absolute; inset: 0; transform-origin: center; overflow: hidden; background: #000; }
#video-transform-box { position: absolute; inset: 0; border: 1.5px solid #78adff; transform-origin: center; z-index: 6; pointer-events: none; }
html[data-theme] #video-transform-box button { position: absolute; pointer-events: auto; touch-action: none; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; background: transparent; border: 0; transform: translate(-50%, -50%) scale(var(--inverse-video-scale, 1)); }
.video-corner::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 1px solid #4c78af; box-shadow: 0 1px 3px #0004; }
.video-corner-nw { left: 4px; top: 4px; cursor: nwse-resize; } .video-corner-ne { left: calc(100% - 4px); top: 4px; cursor: nesw-resize; }
.video-corner-sw { left: 4px; top: calc(100% - 4px); cursor: nesw-resize; } .video-corner-se { left: calc(100% - 4px); top: calc(100% - 4px); cursor: nwse-resize; }
html[data-theme] #video-transform-box .video-angle-handle { left: 50%; top: calc(100% - 22px); width: 25px; height: 25px; background: #fff; color: #294365; border-radius: 50%; border: 1px solid #4c78af; cursor: grab; }
.video-angle-handle svg { pointer-events: none; }
html[data-theme] #transform-video { min-height: 32px; font-size: 11px; }
html[data-theme] #transform-video[aria-pressed=true] { color: var(--studio-accent); background: var(--studio-hover); }
#video-transform-assist { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 13; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 8px; width: max-content; max-width: calc(100% - 12px); border: 1px solid var(--studio-border); border-radius: 7px; background: var(--studio-panel); color: var(--studio-text); font-size: 11px; box-shadow: 0 3px 15px #0004; }
#video-transform-assist label { display: inline-flex; align-items: center; gap: 4px; }
#video-transform-assist input { width: 51px; min-width: 0; padding: 5px; color: var(--studio-text); background: var(--studio-raised); border: 1px solid var(--studio-border); border-radius: 4px; font: inherit; }
html[data-theme] #video-transform-assist button { padding: 5px 8px; font-size: 11px; }
.transforming-video { cursor: move; touch-action: none; }

@media (min-width: 1200px) {
    .editor-heading { min-height: max(44px, var(--canvas-toolbar-height, 44px)); }
    .editor-heading > div:first-child { width: max(0px, calc((100% - var(--canvas-toolbar-width, 620px)) / 2 - 12px)); }
}

.transforming-video .placed-widget { border-color: transparent; }
.transforming-video .placed-widget :is(.selection-tag, :is(#resize-handle,.metric-resize), .widget-delete-handle, .alt-resize) { visibility: hidden; }

/* Keep selection chrome outside the image while the actual video stays canvas-clipped. */
.video-output-clip { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; }
html[data-theme] .video-surface.transforming-video { overflow: visible; }
#video-transform-box { border-width: calc(2.5px * var(--inverse-video-scale, 1)); border-color: #8bbaff; }
.video-corner-nw { left: -2px; top: -2px; }
.video-corner-ne { left: calc(100% + 2px); top: -2px; }
.video-corner-sw { left: -2px; top: calc(100% + 2px); }
.video-corner-se { left: calc(100% + 2px); top: calc(100% + 2px); }

.timeline-stack { position: relative; }
.timeline-stack > .timeline-playhead { position: absolute; top: 12px; bottom: 0; width: 14px; margin: 0; transform: translateX(-50%); background: transparent; box-shadow: none; pointer-events: auto; touch-action: none; cursor: ew-resize; z-index: 8; }
.timeline-stack > .timeline-playhead::before { left: 2px; top: 0; border-left-width: 5px; border-right-width: 5px; border-top-width: 7px; border-top-color: #f2c477; }
.timeline-stack > .timeline-playhead::after { content: ''; position: absolute; left: 6px; top: 6px; bottom: 0; width: 1px; background: #f2c477; box-shadow: 0 0 0 1px #17212b22; }
.timeline-ruler { cursor: pointer; touch-action: none; }
.timeline-clip-section { pointer-events: auto; cursor: pointer; }
.timeline-clip-section:focus-visible { outline: 2px solid #a8c9ff; outline-offset: -3px; }
.timeline-stack > .timeline-playhead:focus-visible { outline: 1px solid #a8c9ff; outline-offset: 2px; }

html[data-theme] .timeline-edit-tools #timeline-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin-left: 8px; color: var(--studio-muted); border: 1px solid transparent; padding: 5px 8px; font-size: 10px; white-space: nowrap; }
html[data-theme] .timeline-edit-tools #timeline-toggle:hover { color: var(--studio-text); background: var(--studio-hover); border-color: var(--studio-border); }
html[data-theme] .timeline-edit-tools #timeline-toggle { background: var(--studio-accent); color: var(--studio-accent-text); border-color: transparent; }
html[data-theme] .timeline-edit-tools #timeline-toggle:hover { background: var(--studio-accent); color: var(--studio-accent-text); border-color: transparent; filter: brightness(1.09); }
#timeline-toggle svg { display: block; pointer-events: none; flex: none; }
#timeline-toggle[aria-expanded=false] .timeline-toggle-chevron { transform: rotate(180deg); }
.timeline-edit-tools.timeline-collapsed > :not(#timeline-toggle) { display: none; }
.timeline-edit-tools.timeline-collapsed { padding-top: 4px; gap: 8px; }
.timeline-edit-tools.timeline-collapsed::before { content: ''; height: 1px; background: var(--studio-border); flex: 1; }
html[data-theme] .timeline-collapsed #timeline-toggle { margin-left: 0; }
@media (max-width: 600px) { .timeline-edit-tools { flex-wrap: wrap; row-gap: 1px; } html[data-theme] .timeline-edit-tools #timeline-toggle { gap: 4px; margin-left: 2px; padding-inline: 5px; min-height: 32px; } .timeline-toggle-icon { width: 13px; } }

/* Feedback is transient; no permanent helper row beneath the timeline. */
html[data-theme] .status-row { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 1080; width: max-content; max-width: min(600px, calc(100vw - 28px)); padding: 10px 14px; border: 1px solid var(--studio-border); border-radius: 7px; background: var(--studio-panel); color: var(--studio-text); box-shadow: 0 5px 24px #0004; font-size: 12px; line-height: 1.5; }
@media (max-width: 1024px) { html[data-theme] .status-row { bottom: calc(72px + env(safe-area-inset-bottom)); } }

/* Source details share the transport's quiet, compact controls. */
.video-info-list { display: grid; grid-template-columns: minmax(100px, 1fr) 2fr; gap: 14px 24px; margin: 24px 0; }
.video-info-list dt { opacity: .65; }
.video-info-list dd { margin: 0; overflow-wrap: anywhere; }
#video-info-dialog { width: min(480px, calc(100vw - 32px)); }
.gps-actions .video-info-button { white-space: nowrap; }

#story-dialog { width: min(680px, calc(100vw - 28px)); max-height: calc(100dvh - 40px); padding: 26px; color: var(--studio-text); background: var(--studio-panel, #191d23); border: 1px solid #74869c55; border-radius: 14px; }
.story-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.story-heading h2 { margin: 6px 0 16px; font-size: 23px; }
#story-close { flex: 0 0 32px; width: 32px; height: 32px; display: grid; place-items: center; padding: 0; font-size: 22px; }
.story-options { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin: 22px 0; }
.story-options label { display: grid; gap: 8px; flex: 1; font-size: 12px; }
.story-options select { min-height: 38px; }
#story-results { max-height: 35dvh; overflow-y: auto; }
.story-clip { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #8796aa26; }
.story-clip label { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.story-clip input { width: 16px; height: 16px; flex-shrink: 0; }
.story-clip button { white-space: nowrap; padding: 7px 10px; font-size: 12px; }
.story-moment { display: block; width: 100%; text-align: left; margin: 7px 0; padding: 9px; }
#story-results details { margin: 18px 0; font-size: 13px; }
#story-dialog small { display: block; color: var(--studio-muted); font-size: 11px; line-height: 1.6; }
@media(max-width: 520px) { #story-dialog { padding: 18px; } .story-options > button { width: 100%; } .story-clip { flex-wrap: wrap; } }

#story-preview { display: block; width: 100%; max-height: 24dvh; background: #070a0e; border-radius: 8px; margin: 14px 0; }

/* Put the next step beside the story choices and keep it in view during review. */
.story-review-actions { position: sticky; top: -1px; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 14px 0; margin: 0 0 12px; background: var(--studio-panel, #191d23); border-block: 1px solid var(--studio-border, #74869c55); }
.story-review-actions > div { flex: 1; min-width: 0; }
#story-selection-summary { display: block; font-size: 13px; font-weight: 600; }
#story-dialog .story-review-actions small { margin-top: 4px; font-size: 11px; }
html[data-theme] .story-review-actions button { min-height: 44px; white-space: nowrap; }
html[data-theme] #story-cancel { background: transparent; border-color: transparent; color: var(--studio-muted); }
html[data-theme] #story-apply { font-size: 13px; padding: 12px 16px; }
@media (max-width: 520px) {
    .story-review-actions { flex-wrap: wrap; gap: 8px; padding: 12px 0; }
    .story-review-actions > div { flex-basis: 100%; }
    #story-apply { flex: 1; }
}

html[data-theme] #story-close { display: grid; place-items: center; padding: 0; line-height: 1; }
#story-close svg { display: block; pointer-events: none; }

/* Keep playback visually separate from source and GPS actions. */
@media (min-width: 769px) {
    html[data-theme] .transport { column-gap: 16px; row-gap: 10px; flex-wrap: wrap; }
    html[data-theme] .transport #clock { flex: 0 0 auto; white-space: nowrap; }
    html[data-theme] .transport > .gps-actions { margin-left: auto; padding-left: 16px; border-left: 1px solid var(--studio-border); border-radius: 0; background: transparent; flex-wrap: wrap; justify-content: flex-end; }
}

/* Compact seeking stays available when the editing timeline is collapsed. */
html[data-theme] .transport #collapsed-scrubber {
    appearance: none; -webkit-appearance: none; flex: 1 1 120px; min-width: 60px;
    width: auto; height: 32px; margin: 0 6px; padding: 0; border: 0; outline-offset: 2px;
    background: transparent; cursor: pointer; touch-action: pan-y;
}
#collapsed-scrubber::-webkit-slider-runnable-track {
    height: 3px; border-radius: 3px;
    background: linear-gradient(to right, var(--studio-accent, #91b4ff) var(--scrub-progress, 0%), #ffffff30 var(--scrub-progress, 0%));
}
#collapsed-scrubber::-webkit-slider-thumb {
    appearance: none; -webkit-appearance: none; width: 9px; height: 9px;
    margin-top: -3px; border: 0; border-radius: 50%; background: var(--studio-accent, #91b4ff);
}
#collapsed-scrubber::-moz-range-track { height: 3px; border-radius: 3px; background: #ffffff30; }
#collapsed-scrubber::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--studio-accent, #91b4ff); }
#collapsed-scrubber::-moz-range-thumb { width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--studio-accent, #91b4ff); }
#collapsed-scrubber:disabled { opacity: .35; }
@media (max-width: 1024px) {
    html[data-theme] body.timeline-is-collapsed .transport { flex-wrap: wrap; }
    html[data-theme] .transport #collapsed-scrubber { flex: 1 0 calc(100% - 12px); order: 10; margin-block: -5px; }
}

/* Selection decorations belong to editing and are suppressed during export. */
html[data-theme] body.exporting-video .placed-widget,
html[data-theme] body.exporting-video .placed-text {
    border-color: transparent !important; outline: none !important; box-shadow: none !important;
}
body.exporting-video .placed-widget > :not(canvas),
body.exporting-video .placed-text > button,
body.exporting-video #video-transform-box,
body.exporting-video #video-transform-assist { visibility: hidden !important; }

html[data-theme] .placed-widget .widget-delete-handle {
    position: absolute;
    inset: max(-11px, calc(2px - var(--widget-top-space, 0px))) auto auto max(-11px, calc(2px - var(--widget-left-space, 0px)));
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: #202631e8;
    color: #f2a5ac;
    z-index: 1;
}
html[data-theme] .placed-widget .widget-delete-handle:hover { background: #412b33; color: #ffc2c7; }
.placed-widget:has(.widget-delete-handle) .selection-tag { left: 26px; }
.widget-delete-handle svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
