/*
 * WebEdit Pro (video-editor): the tool's own components, styled in the site's design language (13 Nov 2026, on the
 * UltraCompress Pro template, after PixelForge, whose shared block the first part of this file follows). Base:
 * /libs/site-pages.css (tokens, Inter and Space Grotesk, theme toggle, focus rings) and /libs/shared-nav.css (the site's
 * header and footer). The second part is the editor: the start drop zone, the preview with its transport bar and timeline
 * (sticky beside the tool groups on wide screens), the groups and their lists, the windows. The original locked the whole
 * screen with its own bars; here the page scrolls and nothing is fixed to the bottom of the screen (the toasts show at the
 * top, under the theme button). Light is the default; dark applies when <html> has no data-theme. Written once from
 * PixelForge's file, then edited by hand: this file is the source.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --ok: #166534;
    --ok-soft: rgba(22, 101, 52, 0.09);
    --bad: #b91c1c;
    --bad-soft: rgba(185, 28, 28, 0.08);
    --warn: #92400e;
    --warn-soft: rgba(217, 119, 6, 0.1);
    --info: #1d4ed8;
    --mark: #7c3aed;           /* the crop box, the chosen look, cell and layout, the progress bars (the original's violet) */
    --mark-soft: rgba(139, 92, 246, 0.12);
    --check-a: #ffffff;        /* the checkerboard behind see-through parts */
    --check-b: #e4e6ea;
    --head: 81px;              /* the site's header */
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.1);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.1);
    --info: #93c5fd;
    --mark: #a78bfa;
    --mark-soft: rgba(167, 139, 250, 0.16);
    --check-a: #2a2e35;
    --check-b: #22262c;
}
@media (max-width: 639.98px) { :root { --head: 65px; } }

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden], body > [hidden] { display: none !important; } /* the scripts hide parts that carry their own display */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.9rem; }
.hint { color: var(--text-3); font-size: 0.82rem; font-weight: 400; line-height: 1.45; }
.hint:empty { display: none; }
.hint.sub { display: block; margin-top: 2px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; gap: 8px 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.center { justify-content: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
code { font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: inherit; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); border-bottom-width: 2px; background: var(--chip); color: var(--text-strong); }

/* ----- Buttons (the scripts' class names: btn, primary, ghost, danger, on, big, small-btn) ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border: 1px solid var(--surface-border); border-radius: 9999px; background: var(--surface); color: var(--text-strong); font-family: inherit; font-weight: 600; font-size: 0.925rem; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn .ico { width: 17px; height: 17px; }
.btn:hover:not([disabled]) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn.primary, .btn.big { background: var(--gradient-brand); color: #fff; border-color: transparent; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn.primary:hover:not([disabled]), .btn.big:hover:not([disabled]) { color: #fff; border-color: transparent; box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(185, 28, 28, 0.35); }
.btn.danger:hover:not([disabled]) { background: var(--danger-strong); color: #fff; border-color: transparent; }
.btn.on { border-color: var(--brand); color: var(--link); background: var(--tint-brand); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.big { min-height: 52px; padding: 12px 28px; font-size: 1rem; }
.btn.small-btn, .small-btn { min-height: 38px; padding: 7px 15px; font-size: 0.85rem; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--surface-border); background: var(--surface); cursor: pointer; display: inline-grid; place-items: center; color: var(--text-strong); flex: none; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.icon-btn:hover:not([disabled]) { border-color: var(--brand); color: var(--link); }
.icon-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.icon-btn[aria-pressed="true"] { border-color: var(--brand); color: var(--link); background: var(--tint-brand); }
.icon-btn:focus-visible, .link:focus-visible, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Toolbar ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 0 0 1.25rem; }
.toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.view-tab { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 16px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-tab .ico { width: 16px; height: 16px; }
.view-tab:hover { color: var(--link); }
.view-tab[aria-current="page"] { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.view-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.view-tab .short { display: none; }
@media (max-width: 1279.98px) { .view-tab .long { display: none; } .view-tab .short { display: inline; } }
.shell-hint { margin-top: 18px; color: var(--text-3); font-size: 0.85rem; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field.end { justify-content: flex-end; }
.fields { display: flex; flex-direction: column; gap: 14px; }
.fields-row { gap: 10px 12px; align-items: flex-end; }
.fields-row .field { flex: 0 1 auto; }
.label { font-weight: 600; font-size: 0.85rem; color: var(--text-strong); }
.unit { color: var(--text-2); font-size: 0.85rem; }
.times { color: var(--text-2); padding-bottom: 12px; }
.input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input.num { max-width: 7.5rem; }
.input.tiny { max-width: 5.4rem; min-height: 34px; padding: 4px 8px; font-size: 0.875rem; text-align: right; font-variant-numeric: tabular-nums; }
textarea.input { min-height: 76px; resize: vertical; line-height: 1.45; }
.check-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; align-self: flex-start; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button:hover:not([disabled]) { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg button[disabled] { opacity: 0.4; cursor: not-allowed; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 12px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chip[aria-pressed="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.small-chip { min-height: 30px; padding: 2px 10px; font-size: 0.8rem; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; font-weight: 600; padding: 2px 10px; border-radius: 9999px; }
.pill.good { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.note { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-top: 2px solid currentColor; font-size: 0.9rem; }
.note > span { color: var(--text); flex: 1; min-width: 12rem; }
.note.bad { color: var(--bad); }
.note.warn { color: var(--warn); }
.note.info { color: var(--info); }
.color-field { flex-direction: row; align-items: center; gap: 8px; }
.color-field .unit { flex: none; white-space: nowrap; overflow-wrap: normal; }
.swatch { width: 48px; height: 38px; padding: 3px; border: 1px solid var(--field-border); border-radius: 10px; background: var(--field); cursor: pointer; }
/* sliders: the filled part follows the value (the script sets --p) */
.slider .slider-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slider-val { display: inline-flex; align-items: center; gap: 4px; }
.range { width: 100%; height: 28px; margin: 0; background: transparent; accent-color: var(--brand); -webkit-appearance: none; appearance: none; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--brand) var(--p, 50%), var(--line-strong) var(--p, 50%)); }
.range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line-strong); }
.range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--brand); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }
.range:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ----- Windows (the scripts put the heading inside the body) ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(560px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog.wide { width: min(880px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
/* The Save window and the Color Harmonizer record the picture while they are open. A blurred backdrop is drawn again
   over the whole page for every picture, which slowed the page to 24 frames a second where there is no fast graphics
   card, and the saved video lost a third of its pictures. These two windows get a plain, slightly darker backdrop. */
#exportDialog::backdrop, #colorDialog::backdrop { background: rgba(10, 10, 20, 0.72); backdrop-filter: none; }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; margin: 0; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-head h2 { margin: 0; font-size: 1.2rem; color: var(--text-strong); }
.dialog-head .icon-btn { border-radius: 50%; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; align-items: center; }
.help p { max-width: 75ch; color: var(--text-2); }
.help h3 { font-size: 1rem; margin-top: 6px; color: var(--text-strong); }
.keys { display: grid; gap: 6px; margin: 0; }
.keys div { display: flex; gap: 12px; }
.keys dt { min-width: 9rem; }
.keys dd { margin: 0; color: var(--text-2); }

/* ----- Toasts ----- */
.toasts { position: fixed; top: calc(var(--head) + 72px); right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toasts[popover] { left: auto; bottom: auto; margin: 0; border: 0; padding: 0; width: auto; height: auto; background: transparent; color: inherit; overflow: visible; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 420px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; min-height: 32px; flex: none; }
.toast.bad { border-left-color: #f87171; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ===== PixelForge components ===== */

/* ----- The site's text rules (p, ul, li, headings, tables, dl) must not reach the tool: same weight as the site's, loaded later ----- */
:where(.app-shell) p, :where(.app-shell) ul, :where(.app-shell) ol, :where(.app-shell) li, :where(.app-shell) dl, :where(.app-shell) dd,
:where(.dialog) p, :where(.dialog) dl, :where(.dialog) dd { margin: 0; line-height: 1.5; }
:where(.app-shell) ul, :where(.app-shell) ol { padding: 0; list-style: none; }
:where(.app-shell) h2, :where(.app-shell) h3, :where(.app-shell) h4, :where(.dialog) h2, :where(.dialog) h3 { margin: 0; line-height: 1.25; }
:where(.app-shell) img { max-width: none; }

/* ----- Long words (a file name or a text typed without spaces) break inside the tool instead of widening the page ----- */
.app-shell, .dialog { overflow-wrap: anywhere; }


/* ===== WebEdit Pro components ===== */

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.toolbar-left { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kept-note { margin: 0 0 1rem; }
.screen { margin: 0; }

/* ----- The start: the drop zone as on the other tools (dashed brand edge, tint and lift on hover, the gradient circle) ----- */
.drop-zone { position: relative; background: var(--surface); border: 3px dashed rgba(139, 92, 246, 0.45); border-radius: 24px; padding: 3.5rem 2rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; box-shadow: var(--surface-shadow); transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease; }
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.over { border-color: var(--brand); background: var(--tint-brand); transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.drop-zone:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
.upload-icon { width: 96px; height: 96px; border-radius: 50%; background: var(--gradient-brand); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 0.75rem; box-shadow: 0 10px 30px rgba(139, 92, 246, 0.35); transition: transform 0.3s ease; }
.upload-icon .dz-ico { width: 44px; height: 44px; stroke-width: 1.8; }
.drop-zone:hover .upload-icon { transform: scale(1.1); }
.dz-title { font-weight: 700; font-size: 1.5rem; color: var(--text-strong); font-family: 'Space Grotesk', 'Inter', sans-serif; }
.drop-zone .actions { margin-top: 0.75rem; }
.drop-zone .muted { max-width: 36rem; }
.small-drop { padding: 1.5rem 1rem; border-width: 2px; border-radius: 16px; gap: 4px; box-shadow: none; }
.small-drop:hover, .small-drop:focus-visible, .small-drop.over { transform: none; }
.dz-title.small-title { font-size: 1.05rem; }
.drop-overlay { position: fixed; inset: 0; z-index: 2500; background: rgba(124, 58, 237, 0.18); border: 4px dashed var(--brand); display: grid; place-items: center; pointer-events: none; }
.drop-overlay span { background: var(--surface); color: var(--text-strong); font-weight: 700; padding: 12px 22px; border-radius: 9999px; box-shadow: var(--surface-shadow); }

/* ----- The studio: the preview, its transport bar and the timeline beside the tool groups ----- */
.ws { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1024px) {
    .ws { grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); gap: 24px; }
    .stage-sticky { position: sticky; top: calc(var(--head) + 12px); }
}
.ws-stage { align-self: stretch; min-width: 0; } /* the column runs the full height, so the stage can stay in view inside it */
.stage-sticky { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.preview { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - var(--head) - 300px); min-height: 200px; background: #000; border-radius: 16px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.preview canvas { display: block; max-width: 100%; max-height: 100%; touch-action: none; cursor: pointer; }
.preview.cut-cursor canvas { cursor: crosshair; }
.ve-video { position: absolute; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }
/* Under 1024 px the tools come below the picture. The picture now stays in view under the site's header while they are
   used (it used to scroll away, so a slider was moved blind). A sticky box cannot leave its own grid cell, so here the
   editor is plain blocks and the picture's two wrappers step aside: it then sticks for the whole height of the editor. */
@media (max-width: 1023.98px) {
    .ws { display: block; }
    .ws-stage, .stage-sticky { display: contents; }
    .preview { position: sticky; top: var(--head); z-index: 30; max-height: 42vh; min-height: 120px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18); }
    .transport, .timeline { margin-top: 12px; }
    .ws-side { margin-top: 20px; }
    /* a control reached with Tab scrolls to below the picture, not under it */
    .ws-side :is(button, input, select, summary, a), .transport :is(button, input), .timeline :is(button, input) { scroll-margin-top: calc(var(--head) + 42vh + 16px); }
}
.busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(0, 0, 0, 0.55); color: #fff; font-weight: 600; }
.app-shell.recording .ws-side, .app-shell.recording .transport, .app-shell.recording .timeline, .app-shell.recording .app-toolbar { pointer-events: none; opacity: 0.6; }

/* transport */
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.play-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--gradient-brand); color: #fff; display: inline-grid; place-items: center; cursor: pointer; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); flex: none; padding: 0; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.play-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); }
.play-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.play-btn .ico { width: 22px; height: 22px; }
.play-btn .play-ico { fill: currentColor; margin-left: 3px; }
.play-btn .pause-ico, .play-btn.playing .play-ico { display: none; }
.play-btn.playing .pause-ico { display: block; stroke-width: 3; }
.time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-strong); min-width: 6.5rem; }
.t-sep { flex: 1 1 0; }
.chip .ico { width: 15px; height: 15px; }
.icon-btn .ico { width: 18px; height: 18px; }
.icon-btn.small-icon { width: 36px; height: 36px; border-radius: 10px; }
.icon-btn.danger-ico:hover:not([disabled]) { border-color: var(--danger); color: var(--danger); }

/* the timeline, in its own scroll box so the page never jumps */
.timeline { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; padding: 10px; }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.tl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tl-info { color: var(--text-2); font-size: 0.82rem; font-variant-numeric: tabular-nums; display: flex; gap: 12px; flex-wrap: wrap; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; border-radius: 10px; background: var(--surface-2); scrollbar-width: thin; }
.tl { position: relative; min-width: 100%; user-select: none; -webkit-user-select: none; touch-action: pan-y; cursor: pointer; }
.tl-marks { position: relative; height: 18px; }
.tl-row { position: relative; border-top: 1px solid var(--line); }
.tl-video { height: 46px; background: rgba(0, 0, 0, 0.18); }
.tl-audio { height: 38px; }
.tl-thumbs { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tl-thumb { position: absolute; top: 0; height: 100%; object-fit: cover; opacity: 0.55; max-width: none; }
.tl-clips { position: absolute; inset: 0; }
.tl-label { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 0.72rem; font-weight: 600; color: var(--text-2); pointer-events: none; text-shadow: 0 0 3px var(--surface); }
.tl-clip { position: absolute; top: 3px; bottom: 3px; min-width: 4px; padding: 0; border: 2px solid #059669; border-radius: 6px; background: rgba(16, 185, 129, 0.22); color: #fff; font-family: inherit; font-size: 0.72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: grab; z-index: 2; }
.tl-clip.chosen { border-color: var(--brand); background: rgba(139, 92, 246, 0.3); box-shadow: 0 0 0 2px var(--brand); }
.tl-clip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tl-clip-label { background: #065f46; padding: 1px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 20px); pointer-events: none; }
.tl-clip.chosen .tl-clip-label { background: #5b21b6; }
.tl-h { position: absolute; top: 0; bottom: 0; width: 10px; background: rgba(255, 255, 255, 0.45); cursor: ew-resize; z-index: 3; }
.tl-h-start { left: 0; border-right: 2px solid #fff; }
.tl-h-end { right: 0; border-left: 2px solid #fff; }
.tl-trim { position: absolute; top: -2px; bottom: -2px; width: 14px; margin-left: -7px; background: #2563eb; border: 2px solid #fff; border-radius: 4px; cursor: ew-resize; z-index: 4; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.tl-audio canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tl-played { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(16, 185, 129, 0.2); pointer-events: none; }
.tl-sel { position: absolute; top: 18px; bottom: 0; background: rgba(59, 130, 246, 0.25); border: 2px solid #3b82f6; pointer-events: none; z-index: 5; }
.tl-sel.open { border-right-style: dashed; }
.tl-snap { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #eab308; box-shadow: 0 0 8px rgba(234, 179, 8, 0.8); pointer-events: none; z-index: 6; }
.tl-playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #ef4444; pointer-events: none; z-index: 7; }
.tl-playhead::before { content: ""; position: absolute; top: 0; left: -5px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 9px solid #ef4444; }
.tl-marker { position: absolute; top: 1px; width: 12px; height: 16px; margin-left: -6px; padding: 0; border: 0; border-radius: 3px 3px 6px 6px; background: var(--mc, #eab308); cursor: pointer; z-index: 8; }
.tl-marker::after { content: ""; position: absolute; left: 5px; top: 16px; width: 2px; height: 84px; background: var(--mc, #eab308); opacity: 0.8; pointer-events: none; }
.tl-marker:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- The tool groups ----- */
.ws-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.grp { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); }
.grp > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 700; color: var(--text-strong); border-radius: 16px; }
.grp > summary::-webkit-details-marker { display: none; }
.grp > summary::after { content: '+'; margin-left: auto; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; }
.grp[open] > summary::after { content: '\2212'; }
.grp > summary .ico { color: var(--link); }
.grp > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.grp-body { display: flex; flex-direction: column; gap: 14px; padding: 0 8px 16px; }
.grp-body > .actions { gap: 8px; }
.seg.looks button { min-width: 5.6rem; }
.items { display: flex; flex-direction: column; gap: 8px; }
.item { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.item:first-child { border-top: 0; padding-top: 0; }
.item-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.item-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 0.9rem; }
.item-time { white-space: nowrap; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.item-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.field.mini { gap: 2px; }
.field.grow { flex: 1 1 8rem; }
.dot { width: 12px; height: 12px; border-radius: 4px; flex: none; border: 1px solid var(--line-strong); }
.dot-ok { background: var(--ok); border-color: transparent; }
.dot-off { background: var(--line-strong); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 40px; height: 40px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; }
.swatches button[aria-checked="true"] { border-color: var(--text-strong); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-strong); }
.swatches button:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.ex-facts { font-weight: 600; color: var(--text-strong); }
.progress { display: flex; flex-direction: column; gap: 6px; }
.progress-head { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 0.9rem; }
.bar { height: 8px; border-radius: 4px; background: var(--line-strong); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--gradient-brand); }

/* ----- The Color Harmonizer ----- */
.ch-tabs { align-self: flex-start; }
.ch-panel { display: flex; flex-direction: column; gap: 14px; }
.ch-two { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 760px) { .ch-two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ch-panel h3 { font-size: 1.05rem; color: var(--text-strong); }
.ch-pic { width: 100%; height: auto; border-radius: 10px; background: #000; }
.ch-fixes { margin: 0; }
.ch-fixes .info-card { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.ch-fixes .info-card p { flex: 1; margin: 0; }
.facts { margin: 0; display: grid; gap: 0; border-top: 2px solid var(--text-strong); }
.facts div { display: grid; grid-template-columns: minmax(6rem, 9rem) minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--surface-border); }
.facts dt { color: var(--text-2); font-size: 0.9rem; }
.facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.facts:empty { display: none; }

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .toolbar-left .btn, .toolbar-right .btn { flex: 1 1 auto; }
    .drop-zone { padding: 2.5rem 1rem; border-radius: 20px; }
    .upload-icon { width: 76px; height: 76px; }
    .upload-icon .dz-ico { width: 36px; height: 36px; }
    .dz-title { font-size: 1.25rem; }
    .toasts { top: calc(var(--head) + 60px); right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .dialog-body { padding: 16px; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
    .preview { border-radius: 12px; }
    .t-sep { display: none; }
    .grp > summary { padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .btn, .info-card, .dialog, .dialog[open], .toast, .seg button, .chip, .view-tab, .drop-zone, .upload-icon, .play-btn,
    .spinner { transition: none; animation: none; }
}
@media print {
    .app-toolbar, .ws-side, .toasts, .theme-toggle, .transport, .timeline { display: none !important; }
}
/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026). The preview, the timeline's drawing and the clip
   boxes are drawings; the markers on the timeline get a 44 px touch area. */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]) { min-height: 44px; }
    main .seg button, main .view-tab, main .chip, main .small-chip, main .btn.small-btn { min-height: 44px; }
    main .icon-btn, main .icon-btn.small-icon { width: 44px; height: 44px; min-width: 44px; }
    main .play-btn { width: 52px; height: 52px; }
    main .range { min-height: 44px; }
    main .swatch { width: 52px; height: 44px; }
    main .input.tiny { min-height: 44px; max-width: 6rem; }
    main .check-row input { width: 22px; height: 22px; }
    main .seg button { min-width: 44px; }
    main .check-row { min-height: 44px; align-items: center; }
    main .tl-video { height: 52px; } /* clip boxes 46 px tall */
    main .tl-clip { min-height: 0; }
    main .transport .chip, main .item-time { min-width: 44px; justify-content: center; }
    main .tl-marker { min-height: 0; }
    main .tl-marker::before { content: ""; position: absolute; left: -16px; right: -16px; top: -14px; height: 44px; }
    main :is(p, li, dt, dd, .hint, .label, .unit, .input, kbd, .seg button, .chip, .btn, .note, .shell-hint, .time, .tl-info, .item-name, .item-time) { font-size: 1rem; }
    main .btn.small-btn, main .small-btn, main .small-chip, main .slider-val, main output, main select.input, main .check-row, main .input.tiny, main .item .input { font-size: 1rem; }
    main .tl-label, main .tl-clip, main .tl-clip-label { font-size: 0.75rem; }
    .dialog button, .dialog .btn, .dialog select, .dialog summary,
    .dialog input:not([type="checkbox"]):not([type="range"]):not([type="color"]) { min-height: 44px; }
    .dialog .range { min-height: 44px; }
    .dialog .icon-btn { width: 44px; height: 44px; }
    .dialog .swatches button { width: 44px; height: 44px; }
    .dialog :is(p, .hint, .label, .unit, .input, kbd, dt, dd, .seg button, .chip, .btn, li) { font-size: 1rem; }
}
