:root {
    color-scheme: dark;
    --bg: #111213;
    --stage: #0c0d0e;
    --panel: #171819;
    --control: #222426;
    --hover: #2c2e30;
    --line: rgba(240, 238, 232, .075);
    --line-strong: rgba(240, 238, 232, .18);
    --text: #f0eeea;
    --muted: #a4a5a5;
    --faint: #858787;
    --accent: #ded5c4;
    --accent-soft: rgba(222, 213, 196, .11);
    --accent-ink: #25241f;
    --danger: #ee9292;
    --radius: 10px;
    --pill: 999px;
    --mono: 'JetBrains Mono', monospace;
    --sans: 'Instrument Sans', sans-serif;
    --serif: 'Fraunces', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; letter-spacing: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button, summary, input, select, textarea { transition: background-color .16s, color .16s, border-color .16s, box-shadow .16s; }
button:disabled { cursor: default; opacity: .35; }
:is(button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button svg { flex: 0 0 auto; width: 16px; height: 16px; pointer-events: none; }
.ui-icon { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

/* Workspace chrome stays quieter than the preview. */
header { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 1; }
.brand a { color: inherit; text-decoration: none; }
.brand .mark { width: 8px; height: 8px; border-radius: 3px; background: var(--accent); }
.brand h1 { font: 600 17px var(--sans); }
.brand h1 em { margin-left: 3px; color: var(--accent); font: italic 500 19px var(--serif); }
.brand-description { max-width: 430px; overflow: hidden; color: var(--faint); text-overflow: ellipsis; white-space: nowrap; font: 400 11px var(--sans); }
.top-right { display: flex; align-items: center; gap: 20px; min-width: 0; }
.plan-status { flex: 0 0 auto; padding: 0; border: 0; background: transparent; color: var(--faint); font: 650 10px var(--mono); letter-spacing: .12em; }
.plan-status:not(.is-pro) { cursor: pointer; }
.plan-status:not(.is-pro):hover { color: var(--text); }
.plan-status.is-pro { cursor: default; }
.codec { color: var(--faint); font: 400 10px var(--mono); }
.lang-seg { flex: 0 0 auto; }
.lang-seg button { min-width: 30px; padding: 6px 10px; }
.lang-menu { position: relative; flex: 0 0 auto; }
.lang-trigger { display: grid; width: 32px; height: 32px; place-items: center; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--faint); cursor: pointer; }
.lang-trigger:hover, .lang-menu.open .lang-trigger { background: var(--control); color: var(--text); }
.lang-trigger .ui-icon { width: 17px; height: 17px; }
.lang-menu .lang-pop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 120; display: none; flex-direction: column; gap: 2px; min-width: 164px; padding: 7px; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(31, 33, 34, .99); box-shadow: 0 16px 44px rgba(0,0,0,.42); }
.lang-menu.open .lang-pop { display: flex; }
.lang-menu .lang-pop button { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 14px; min-height: 34px; padding: 8px 10px; border-radius: 10px; text-align: left; font: 500 12px var(--sans); }
.lang-menu .lang-pop .lang-code { color: var(--faint); font: 600 10px var(--mono); letter-spacing: .1em; order: 2; }
.lang-menu .lang-pop button.on .lang-code { color: inherit; opacity: .75; }
.takes-auth { position: relative; flex: 0 1 auto; min-width: 0; }
.auth-login, .auth-user-btn { min-height: 32px; border: 1px solid var(--line); border-radius: var(--pill); background: rgba(240, 238, 232, .025); color: var(--muted); font: 600 12px var(--sans); }
.auth-login { padding: 7px 13px; white-space: nowrap; }
.auth-login:not(:disabled):hover, .auth-user-btn:hover, .auth-user-btn[aria-expanded="true"] { border-color: var(--line-strong); background: var(--control); color: var(--text); }
.auth-menu { position: relative; }
.auth-user-btn { display: flex; align-items: center; gap: 8px; max-width: 210px; padding: 3px 10px 3px 3px; text-align: left; }
.auth-avatar { position: relative; width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font: 700 10px var(--sans); }
.auth-avatar-initials { grid-area: 1 / 1; }
.auth-avatar img { position: absolute; inset: 0; display: none; width: 100%; height: 100%; object-fit: cover; }
.auth-avatar img.is-loaded { display: block; }
.auth-avatar img[hidden] { display: none; }
.auth-user-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.05; }
.auth-user-copy strong, .auth-user-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-user-copy strong { color: var(--text); font: 650 11px var(--sans); }
.auth-user-copy small { margin-top: 3px; color: var(--faint); font: 400 9px var(--sans); }
.auth-popover { position: absolute; right: 0; top: calc(100% + 8px); z-index: 120; width: 240px; padding: 9px; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(31, 33, 34, .99); box-shadow: 0 16px 44px rgba(0,0,0,.42); }
.auth-popover-user { min-width: 0; padding: 6px 7px 10px; border-bottom: 1px solid var(--line); }
.auth-popover-user strong, .auth-popover-user span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-popover-user strong { color: var(--text); font: 650 12px var(--sans); }
.auth-popover-user span { margin-top: 4px; color: var(--faint); font: 400 11px var(--sans); }
.auth-popover button { width: 100%; min-height: 34px; margin-top: 7px; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; font: 500 12px var(--sans); }
.auth-popover button:hover { background: rgba(240, 238, 232, .07); color: var(--text); }
.auth-action-status { display: block; padding: 6px 7px 2px; color: var(--danger); font: 400 10px/1.35 var(--sans); }
.site-menu { position: relative; flex: 0 0 auto; }
.site-menu summary { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: var(--faint); cursor: pointer; list-style: none; font: 600 14px var(--sans); letter-spacing: .08em; }
.site-menu summary::-webkit-details-marker { display: none; }
.site-menu summary:hover, .site-menu[open] summary { background: var(--control); color: var(--text); }
.site-menu nav { position: absolute; top: calc(100% + 8px); right: 0; z-index: 120; min-width: 150px; padding: 7px; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(31, 33, 34, .99); box-shadow: 0 16px 44px rgba(0,0,0,.42); }
.site-menu a { display: block; min-height: 34px; padding: 8px 10px; border-radius: 10px; color: var(--muted); text-decoration: none; font: 500 12px var(--sans); }
.site-menu a:hover { background: rgba(240, 238, 232, .07); color: var(--text); }
.btn-primary, .btn-ghost { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 10px 18px; border: 0; border-radius: var(--pill); font: 600 12px var(--sans); }
.top-right .btn-primary { min-height: 30px; padding: 6px 14px; }
.btn-primary, #btnRender { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover, #btnRender:hover { background: #eae2d4; }
.btn-primary:active, .btn-ghost:active { transform: translateY(1px); }
.btn-ghost { width: 100%; margin-top: 14px; background: var(--control); color: var(--text); }
.btn-ghost.danger, #btnRender.danger { background: rgba(238, 146, 146, .12); color: var(--danger); }

main { display: grid; grid-template-columns: clamp(260px, 21vw, 310px) minmax(0, 1fr) 368px; height: calc(100% - 64px); }
.panel-left { grid-column: 1; }
.stage { grid-column: 2; }
.panel { grid-column: 3; }
.stage, .panel-left, .panel { grid-row: 1; }
.stage { position: relative; min-width: 0; min-height: 0; padding-bottom: 64px; background: var(--stage); display: flex; align-items: center; justify-content: center; }
.vp { position: relative; overflow: hidden; background: #000; }
/* Fundo transparente: checkerboard behind the canvas (preview only; never exported). */
.vp.is-transparent { background: repeating-conic-gradient(#2a2c31 0% 25%, #1c1d21 0% 50%) 0 0 / 20px 20px; }
.icon-btn.on { color: var(--accent); }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.export-overlay { position: absolute; inset: 0; z-index: 7; display: none; align-items: center; justify-content: center; gap: 10px; background: rgba(3, 4, 5, .82); backdrop-filter: blur(2px); pointer-events: none; }
body.is-exporting .export-overlay { display: flex; }
.export-overlay span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 18px rgba(222, 213, 196, .7); animation: exportPulse 1.15s ease-in-out infinite; }

@media (max-width: 1240px) {
    .brand-description { display: none; }
}
.export-overlay span:nth-child(2) { animation-delay: .16s; }
.export-overlay span:nth-child(3) { animation-delay: .32s; }
@keyframes exportPulse {
    0%, 80%, 100% { opacity: .28; transform: translateY(0) scale(.78); box-shadow: 0 0 8px rgba(222, 213, 196, .22); }
    40% { opacity: 1; transform: translateY(-2px) scale(1); box-shadow: 0 0 20px rgba(222, 213, 196, .75); }
}
.rec { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: none; align-items: center; gap: 8px; color: var(--danger); font: 500 10px var(--mono); z-index: 4; }
.rec.on { display: flex; }
.rec .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .15; } }
/* Whole-window file drop: the hint covers the app while files are dragged over it. */
.drop-hint { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; padding: 24px; text-align: center; background: rgba(23, 24, 25, .82); color: var(--accent); font-size: 15px; pointer-events: none; box-shadow: inset 0 0 0 2px var(--accent); }
body.file-drag .drop-hint { display: flex; }
.transport { position: absolute; left: 20px; right: 20px; bottom: 16px; display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 8px 12px; background: var(--panel); border-radius: 18px; z-index: 6; }
.tbtn { width: 36px; height: 36px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: transparent; border: 0; border-radius: 50%; color: var(--muted); }
.tbtn:hover { background: var(--hover); color: var(--text); }
.tbtn.on { color: var(--accent); background: var(--accent-soft); }
#btnPlay { color: var(--accent-ink); background: var(--accent); }
.timecode { font: 400 10px var(--mono); color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timecode b { color: var(--text); font-weight: 400; }
/* Timeline (Motion track): a second transport row; blocks share the scrub's column,
   inset by half the thumb so the playhead lines up with it. */
.stage.has-timeline { padding-bottom: calc(100px + var(--audio-extra, 0px)); }
.transport.has-timeline { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-rows: 36px 30px; column-gap: 14px; row-gap: 4px; --tl-inset: 6.5px; }
.transport.has-timeline > #btnPlay { grid-area: 1 / 1; }
.transport.has-timeline > #scrub { grid-area: 1 / 2; width: 100%; }
.transport.has-timeline > .timecode { grid-area: 1 / 3; }
.transport.has-timeline > #btnLoop { grid-area: 1 / 4; }
.transport.has-timeline > .timeline-label { grid-area: 2 / 1; }
.transport.has-timeline > .timeline-track { grid-area: 2 / 2; }
.transport.has-timeline > .timeline-tools { grid-area: 2 / 3 / 3 / 5; }
.timeline-tools { display: flex; align-items: center; gap: 2px; }
.timeline-tools .tbtn { width: 30px; height: 30px; }
.timeline-tools .tbtn:disabled { opacity: .3; cursor: default; background: transparent; }
.timeline-tools .tbtn svg { width: 16px; height: 16px; }
.timeline-tools #btnAddMotion { margin-left: 6px; }
.timeline-label { align-self: center; justify-self: center; font: 500 9px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.timeline-track { position: relative; min-width: 0; height: 30px; margin: 0 var(--tl-inset); }
.timeline-block { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 10px; border-radius: var(--pill); background: var(--control); color: var(--muted); font: 500 11px var(--sans); white-space: nowrap; overflow: hidden; cursor: pointer; user-select: none; }
.timeline-block:hover { background: var(--hover); color: var(--text); }
.timeline-block.on { background: var(--accent); color: var(--accent-ink); }
.timeline-block.kb-sel { outline: 2px solid var(--text); outline-offset: 1px; z-index: 3; }
.timeline-block.narrow { padding: 0 8px; }
.timeline-block.narrow .tb-dur { display: none; }
.timeline-block .tb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.timeline-block .tb-dur { flex: 0 0 auto; margin-left: auto; font: 400 10px var(--mono); opacity: .7; }
.timeline-playhead { position: absolute; top: -3px; bottom: -3px; left: calc(var(--tl-pos, 0) * 100%); width: 1px; margin-left: -.5px; background: var(--text); pointer-events: none; z-index: 1; }
/* Text track: a third row with every text's [start, end), packed in lanes (--text-row grows
   with them, up to three); edge handles drag a window, + adds a text. */
.stage.has-timeline.has-text-track { padding-bottom: calc(104px + var(--text-row, 30px) + var(--audio-extra, 0px)); }
.transport.has-timeline.has-text-track { grid-template-rows: 36px 30px var(--text-row, 30px); }
.transport.has-timeline > #textTrackLabel { grid-area: 3 / 1; align-self: start; height: 30px; display: flex; align-items: center; }
.transport.has-timeline > #textTrack { grid-area: 3 / 2; height: var(--text-row, 30px); }
.transport.has-timeline > #btnAddText { grid-area: 3 / 4; justify-self: end; align-self: start; width: 30px; height: 30px; }
#btnAddText svg { width: 16px; height: 16px; }
#btnAddText:disabled { opacity: .3; cursor: default; background: transparent; }
/* Image track: one more row below Text (or right under Motion without texts), same lanes / handles. */
.stage.has-timeline.has-image-track { padding-bottom: calc(104px + var(--image-row, 30px) + var(--audio-extra, 0px)); }
.stage.has-timeline.has-text-track.has-image-track { padding-bottom: calc(108px + var(--text-row, 30px) + var(--image-row, 30px) + var(--audio-extra, 0px)); }
.transport.has-timeline.has-image-track { grid-template-rows: 36px 30px var(--image-row, 30px); }
.transport.has-timeline.has-text-track.has-image-track { grid-template-rows: 36px 30px var(--text-row, 30px) var(--image-row, 30px); }
.transport.has-timeline > #imageTrackLabel { grid-area: 3 / 1; align-self: start; height: 30px; display: flex; align-items: center; }
.transport.has-timeline > #imageTrack { grid-area: 3 / 2; height: var(--image-row, 30px); }
.transport.has-timeline > #btnAddImage { grid-area: 3 / 4; justify-self: end; align-self: start; width: 30px; height: 30px; }
.transport.has-timeline.has-text-track > #imageTrackLabel, .transport.has-timeline.has-text-track > #imageTrack, .transport.has-timeline.has-text-track > #btnAddImage { grid-row: 4; }
#btnAddImage svg { width: 16px; height: 16px; }
#btnAddImage:disabled { opacity: .3; cursor: default; background: transparent; }
.timeline-block.image-block { gap: 6px; }
.timeline-block.image-block .tb-thumb { flex: 0 0 auto; height: 70%; max-height: 20px; aspect-ratio: 1; object-fit: contain; border-radius: 3px; pointer-events: none; }
.timeline-block.image-block.narrow .tb-thumb { display: none; }
/* Audio track: the last row (its grid row follows how many rows sit above it: --audio-r), one lane, waveform inside the bar. */
.transport.has-timeline { grid-auto-rows: var(--audio-row, 30px); }
.transport.has-timeline > #audioTrackLabel { grid-area: var(--audio-r, 3) / 1; align-self: start; height: 30px; display: flex; align-items: center; }
.transport.has-timeline > #audioTrack { grid-area: var(--audio-r, 3) / 2; height: var(--audio-row, 30px); }
.transport.has-timeline > #btnAddAudio { grid-area: var(--audio-r, 3) / 4; justify-self: end; align-self: start; width: 30px; height: 30px; }
#btnAddAudio svg { width: 16px; height: 16px; }
#btnAddAudio:disabled { opacity: .3; cursor: default; background: transparent; }
.timeline-block.audio-block { padding: 0 12px; }
.timeline-block.audio-block .tb-wave { position: absolute; left: 0; right: 0; top: 3px; bottom: 3px; width: 100%; height: calc(100% - 6px); fill: currentColor; opacity: .55; pointer-events: none; }
.timeline-block.audio-block .tb-name { position: relative; font-size: 10px; font-weight: 600; opacity: 1; text-shadow: 0 0 3px var(--accent-soft), 0 0 6px var(--accent-soft); }
.timeline-block.audio-block { box-shadow: inset 0 0 0 1px var(--text-faint, rgba(255,255,255,.34)), 0 0 0 1px var(--panel, #111); }
.timeline-block.audio-block.sel { box-shadow: inset 0 0 0 2px var(--text), 0 0 0 1px var(--panel, #111); }
.timeline-block.audio-block.on .tb-name { text-shadow: none; }
.timeline-block.audio-block.on .tb-wave { opacity: .5; }
.timeline-block.audio-block .tb-name { flex: 1 1 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* wide: full name · medium: ellipsis */
.timeline-block.audio-block.tiny .tb-name { display: none; }   /* very short: waveform only (name stays in title / aria-label) */
.timeline-block.audio-block.off .tb-wave { opacity: .16; }
.timeline-block.audio-block.moving { z-index: 2; }
.audio-card .text-card-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.timeline-block.static { cursor: default; }
.timeline-block.static:hover { background: var(--control); color: var(--muted); }
.timeline-block.text-block { min-width: 16px; padding: 0 12px; background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.timeline-block.text-block:hover { background: var(--hover); }
.timeline-block.text-block.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.timeline-block.text-block.invalid { opacity: .4; }
.timeline-block.text-block.off { opacity: .5; }
.timeline-block.text-block.sel { box-shadow: inset 0 0 0 2px var(--text); }
.timeline-block.text-block.on.sel { box-shadow: inset 0 0 0 2px var(--accent-ink); }
.timeline-block.text-block.laned { padding: 0 10px; font-size: 10px; }
.timeline-block.text-block.laned .tb-handle::after { top: 5px; bottom: 5px; }
.timeline-block.text-block:not(.invalid) { cursor: grab; touch-action: none; }
.timeline-block.text-block.moving { cursor: grabbing; }
.tb-handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; touch-action: none; z-index: 1; }
.tb-handle[data-edge="start"] { left: 0; }
.tb-handle[data-edge="end"] { right: 0; }
.tb-handle::after { content: ''; position: absolute; top: 9px; bottom: 9px; left: 3px; width: 2px; border-radius: 1px; background: currentColor; opacity: .45; }
.tb-handle:hover::after, .tb-handle.dragging::after, .tb-handle:focus-visible::after { opacity: 1; }
.tb-handle:focus-visible { outline: none; }
/* Motion block: only the selected block resizes, by its right edge (ripple). */
.timeline-block.resizable { padding-right: 14px; }
.timeline-block.resizing { cursor: ew-resize; }
/* Motion reorder: the body drags horizontally (vertical pan still scrolls the page on touch); a dashed slot marks the drop. */
.timeline-block.movable { cursor: grab; touch-action: pan-y; }
.timeline-block.moving { cursor: grabbing; z-index: 3; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.timeline-slot { position: absolute; top: 0; bottom: 0; border-radius: var(--pill); border: 1.5px dashed var(--accent); opacity: .7; pointer-events: none; }
.timeline-track.moving-block { cursor: grabbing; }
.timeline-track.moving-block .timeline-playhead { opacity: 0; }

/* One continuous inspector, separated by spacing and hairlines. */
.panel, .panel-left { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); overflow: hidden; }
.panel { border-left: 1px solid var(--line); }
.panel-left { border-right: 1px solid var(--line); }
.family-rail { flex: 0 0 38px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 0 16px 4px; }
.family-rail button { position: relative; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; transition: color .16s, background-color .16s; }
.family-rail button:hover { color: var(--text); background: var(--hover); }
.family-rail button:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 1px; }
.family-rail button.on { color: var(--accent); }
.family-rail button.on::before { content: ""; position: absolute; left: -4px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--accent); }
.family-rail .ui-icon { width: 17px; height: 17px; stroke-width: 1.75; }
/* Name tooltip: to the right of the icon, on hover and on keyboard focus. */
.family-rail button[data-tip]::after { content: attr(data-tip); position: absolute; left: calc(100% + 8px); top: 50%; z-index: 30; padding: 5px 9px; border-radius: 7px; background: #26272a; box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(0, 0, 0, .4); color: var(--text); font: 500 12px var(--sans); white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-3px, -50%); transition: opacity .12s, transform .12s; }
.family-rail button:is(:hover, :focus-visible)::after { opacity: 1; transform: translate(0, -50%); transition-delay: .25s; }
.family-rail button:focus-visible::after { transition-delay: 0s; }
@media (min-width: 941px) { .panel-left { flex-direction: row; } }
@media (max-width: 940px) { .family-rail { display: none; } }
.panel-scroll { flex: 1 1 auto; min-width: 0; min-height: 0; overflow-y: auto; padding-bottom: 20px; scroll-padding: 16px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--pill); }
.sec { padding: 14px 20px 16px; border-bottom: 1px solid var(--line); }
details.sec:not([open]) { padding-bottom: 16px; }
.sec-head { min-height: 28px; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; list-style: none; border-radius: 4px; }
details:not([open]) > .sec-head { margin-bottom: 0; }
details > .sec-head { cursor: pointer; user-select: none; }
.sec-head::-webkit-details-marker { display: none; }
.sec-head .idx { color: var(--faint); font: 400 10px var(--mono); }
.sec-head h2 { font: 600 13px var(--sans); color: var(--text); }
.media-plan-count { margin-left: 2px; color: var(--faint); font: 500 10px var(--mono); letter-spacing: .02em; white-space: nowrap; }
.media-manage-btn { margin-left: auto; padding: 4px 0; border: 0; background: transparent; color: var(--faint); font: 500 11px var(--sans); }
.media-manage-btn:hover, .media-manage-btn[aria-expanded="true"] { color: var(--text); }
.media-manage-btn[hidden] { display: none; }
details > .sec-head::after { content: ''; width: 6px; height: 6px; margin: 0 3px 0 auto; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(-45deg); transition: transform .16s; }
details[open] > .sec-head::after { transform: rotate(45deg); }
#secColl > .sec-head::after { margin-left: 0; }
.sec-head:hover h2 { color: var(--accent); }

.seg, .tabs, .text-align { display: flex; min-width: 0; gap: 3px; padding: 3px; background: var(--control); border: 0; border-radius: var(--pill); }
.seg button, .tabs button, .text-align button { flex: 1 1 0; min-width: 0; min-height: 30px; padding: 6px 8px; border: 0; border-radius: var(--pill); background: transparent; color: var(--muted); font: 500 12px var(--sans); line-height: 18px; white-space: nowrap; }
.seg button:hover:not(.on), .tabs button:hover:not(.on), .text-align button:hover:not(.on) { background: var(--hover); color: var(--text); }
.seg button.on, .tabs button.on, .text-align button.on { background: var(--accent); color: var(--accent-ink); }
.seg button.is-pro-locked:not(.on) { color: rgba(237, 233, 224, .36); }
.seg button:disabled { cursor: not-allowed; opacity: .42; }
.tabs { margin-bottom: 16px; }
.tabs button { padding-left: 6px; padding-right: 6px; font-size: 11px; }

/* Adaptive family switcher: only the active tab shows icon+name (flex-grow
   to fill the remaining width); inactive tabs collapse to a fixed-width
   icon-only pill so 4 very different label lengths never fight for space
   or leave dead space on either side. */
.tabs-adaptive button { flex: 0 0 34px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px; overflow: hidden; transition: flex-grow .18s ease, flex-basis .18s ease; }
.tabs-adaptive button.on { flex: 1 1 0; }
.tabs-adaptive .tab-icon { width: 15px; height: 15px; flex: 0 0 auto; }
.tabs-adaptive .tab-label { display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tabs-adaptive button.on .tab-label { display: inline-block; }
.pro-label { color: var(--faint); font: 650 9px var(--mono); letter-spacing: .1em; white-space: nowrap; }
.bg-heading { display: flex; align-items: center; gap: 8px; }
.bg-heading > label { min-width: 0; }
.bg-heading-actions { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.bg-transparent-option { display: inline-flex; align-items: baseline; gap: 6px; color: var(--muted); font: 400 11px var(--sans); white-space: nowrap; }
.fam { display: none; }
.legend, #dirHint, #loopKind, .sec .hint:not(#subjectError) { display: none; }
#subjectError:not(.hidden) { display: block; margin: 8px 0; font-size: 12px; line-height: 1.5; color: var(--danger); }
.upload { width: 100%; min-height: 38px; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--pill); background: transparent; color: var(--text); font: 500 12px var(--sans); }
.upload:hover { background: var(--control); border-color: var(--line-strong); }
.upload-label { color: var(--muted); }
.upload-action { margin-left: auto; color: var(--text); }
#btnUpload { justify-content: flex-start; }

.row, .text-row { margin-top: 10px; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; min-width: 0; }
.row-top label, .text-label, .swrow label, .switchrow > span, .collection-items-control label { color: var(--muted); font: 400 12px/1.4 var(--sans); }
.row-top output { color: var(--text); font: 400 11px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.slider-row { display: grid; grid-template-columns: var(--sr-label, 124px) minmax(0, 1fr); grid-template-areas: 'label bar'; align-items: center; gap: 0 10px; min-height: 30px; }
.slider-row .row-top { display: contents; }
.slider-row .row-top label { grid-area: label; min-width: 0; font-size: 12.5px; line-height: 1.2; overflow-wrap: break-word; }
.slider-row .row-top output, .slider-row .sr-out { display: none; }
.sr-bar { grid-area: bar; position: relative; display: flex; align-items: center; height: 30px; min-width: 0; overflow: hidden; border-radius: 8px; background: var(--control); }
.sr-bar > input[type=range] { --sr-pct: 0%; flex: 1 1 0; width: auto; min-width: 0; height: 30px; margin: 0; border-radius: 0; background: repeating-linear-gradient(to right, transparent 0 calc(10% - 1px), rgba(240, 238, 232, .07) calc(10% - 1px) 10%), linear-gradient(to right, rgba(222, 213, 196, .2) var(--sr-pct), transparent var(--sr-pct)); }
.sr-bar > input[type=range]::-webkit-slider-runnable-track { height: 30px; background: transparent; border-radius: 0; }
.sr-bar > input[type=range]::-moz-range-track { height: 30px; background: transparent; border-radius: 0; }
.sr-bar > input[type=range]::-webkit-slider-thumb { width: 3px; height: 16px; margin-top: 7px; border-radius: 2px; background: var(--accent); box-shadow: none; }
.sr-bar > input[type=range]::-moz-range-thumb { width: 3px; height: 16px; border: 0; border-radius: 2px; background: var(--accent); box-shadow: none; }
.sr-bar > input[type=range]:hover::-webkit-slider-thumb { box-shadow: none; background: #fff; }
.sr-bar > input[type=range]:disabled { opacity: .45; }
.sr-value { position: relative; flex: none; display: flex; align-items: center; justify-content: flex-end; box-sizing: border-box; width: 60px; height: 100%; padding: 0 9px 0 17px; color: var(--text); font: 400 12px var(--mono); font-variant-numeric: tabular-nums; transition: background .12s; }
.sr-value:hover, .sr-value:focus-within, .sr-value[data-editing] { background: rgba(240, 238, 232, .06); }
.sr-value[data-invalid] { box-shadow: inset 0 0 0 1px #d98585; }
.slider-row .sr-value input.sr-input { display: block; flex: 1 1 0; width: auto; min-width: 0; min-height: 0; height: 100%; padding: 0; border: 0; border-radius: 0; outline: 0; background: transparent; color: inherit; font: inherit; text-align: right; cursor: text; }
.slider-row .sr-value input.sr-input:read-only { cursor: default; }
.sr-unit { flex: none; margin-left: 1px; color: var(--muted); }
.sr-reset { position: absolute; left: 3px; top: 50%; display: grid; place-items: center; width: 16px; height: 16px; margin: -8px 0 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); opacity: 0; cursor: pointer; transition: opacity .12s, color .12s; }
.sr-reset[hidden] { display: none; }
.slider-row:hover .sr-reset, .slider-row:focus-within .sr-reset, .sr-reset:focus-visible { opacity: 1; }
.sr-reset:hover { color: var(--text); }
.sr-reset:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
@media (hover: none) { .sr-reset { opacity: 1; } }
.speed-pill { min-height: 22px; padding: 3px 10px; border: 0; border-radius: var(--pill); background: var(--accent); color: var(--accent-ink); font: 500 11px var(--sans); white-space: nowrap; }
.speed-pill:hover { background: #eae2d4; }
.speed-pill.off { background: var(--control); color: var(--muted); }
.speed-pill.off:hover { background: var(--hover); color: var(--text); }
.inline-choice { display: grid; grid-template-columns: minmax(78px, 1fr) minmax(0, 1.6fr); align-items: center; gap: 8px 12px; }
.inline-choice .row-top { margin: 0; }
.inline-choice > .seg, .inline-choice > input[type=range] { grid-column: 2; width: 100%; min-width: 0; }
#slotDeviceRow, #dirRow { grid-template-columns: minmax(0, 1fr); }
#slotDeviceRow > .seg, #dirRow > .seg { grid-column: 1; }

/* Compact aspect control (Media Aspect + Format's output Aspect): a single
   row of small ratio icons, no segmented pill background — used wherever an
   aspect choice needs to feel secondary/discreet rather than a primary
   decision. */
.mini-aspect-head { margin-bottom: 6px; }
#secColl .media-content > .row { margin-top: 7px; }
/* "Original" (the former Auto toggle) reuses the exact same discreet,
   outline-only look as the ratio icons below it — an active option in the
   same system, never a standalone CTA. */
.mini-aspect-icons { display: flex; gap: 4px; }
.mini-aspect-icons button { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 2px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--faint); font: 400 10px var(--mono); }
.mini-aspect-icons button:hover:not(.on) { color: var(--muted); }
.mini-aspect-icons button.on { color: var(--text); border-color: var(--line-strong); }
.mini-aspect-box { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; }
.mini-aspect-swatch { display: block; border: 1.3px solid currentColor; border-radius: 2px; opacity: .85; }
.mini-aspect-label { line-height: 1; white-space: nowrap; font-weight: 400; }
.mini-aspect-icons button.mini-aspect-original { flex-grow: 1.45; }
.mini-aspect-original .mini-aspect-swatch { width: 100%; }
.mini-aspect-original .mini-aspect-swatch[data-shape="tall"] { width: auto; height: 100%; }
.mini-aspect-original .mini-aspect-swatch[data-shape="square"] { width: 76%; }
.mini-aspect-original .mini-aspect-swatch.is-empty { border-style: dashed; }
.fit-line.fit-row { display: flex; justify-content: space-between; margin: 8px 0 0; padding: 0 2px; }

/* Cover/Contain: a single chip that cycles between the two values instead of
   two always-visible buttons — a small, secondary toggle affordance next to
   Original, always bordered (unlike Original) since it signals "click to
   switch" rather than "pick one of these options". */
.fit-line { display: inline-flex; align-items: baseline; gap: 6px; margin-left: 8px; font: 400 12px/1.4 var(--sans); }
.fit-label { color: var(--faint); }
.fit-value { min-height: 0; padding: 0; border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.fit-value:hover { color: var(--text); }
.mini-fit-chip { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; min-height: 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); }
.mini-fit-chip:hover { color: var(--text); border-color: var(--line-strong); }
.mini-fit-chip svg { width: 14px; height: 14px; }

/* Discreet separator between subject parameters and the media shelf — no
   card, just breathing room and a faint rule. */
.media-shelf-sep { height: 1px; margin: 10px 0 8px; background: var(--line); opacity: .5; }

/* Ajustes: light grouping via micro-labels + spacing only — no cards. */
/* Controls kept in the DOM for state/runtime but not exposed in the UI
   (inconsistent across presets or no evident benefit) — never shown
   regardless of any other visibility class toggled on/off around it. */
.ui-retired { display: none !important; }

input[type=range] { appearance: none; -webkit-appearance: none; background: transparent; height: 28px; flex: 1; min-width: 0; cursor: pointer; }
.row > input[type=range] { width: 100%; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; background: var(--line-strong); border-radius: var(--pill); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%; border: 0; background: var(--accent); box-shadow: 0 0 0 3px var(--panel); }
input[type=range]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 5px var(--accent-soft); }
input[type=range]::-moz-range-track { height: 3px; background: var(--line-strong); border-radius: var(--pill); }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; border: 0; background: var(--accent); box-shadow: 0 0 0 3px var(--panel); }
.switchrow, .swrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; min-height: 30px; }
.switch { position: relative; width: 36px; height: 22px; flex: 0 0 auto; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--pill); background: var(--control); }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .16s, background-color .16s; }
.switch.on { background: var(--accent); border-color: transparent; }
.switch.on::after { transform: translateX(14px); background: var(--accent-ink); }
.sw { display: flex; gap: 8px; flex-wrap: wrap; }
.sw button { width: 22px; height: 22px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; }
.sw button.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--accent); }

/* Text is a set of fields, not a nested panel. */
.text-card { padding: 0; border: 0; background: transparent; }
.text-card-head { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.text-card-head strong { flex: 1; min-width: 0; margin-right: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 12px var(--sans); color: var(--muted); }
.icon-btn { width: 30px; height: 30px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: var(--hover); }
#txtDelete:hover { color: var(--danger); }
.text-card textarea, .text-card select, .text-card input[type=text], .text-card input[type=number] { display: block; width: 100%; min-width: 0; min-height: 38px; border: 1px solid transparent; border-radius: var(--radius); background: var(--control); color: var(--text); font: 400 12px/1.5 var(--sans); padding: 9px 12px; }
.text-card :is(textarea, select, input):hover { border-color: var(--line-strong); }
.text-card textarea { min-height: 76px; resize: vertical; }
.text-card textarea::placeholder { color: var(--faint); }
.text-card select { padding-right: 8px; }
.text-label { display: block; margin-bottom: 8px; }
.text-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 88px; gap: 12px; }
.text-grid-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.text-color-row { display: grid; grid-template-columns: minmax(0, 1fr) 38px; gap: 12px; align-items: end; }
.text-color-row input[type=color] { width: 38px; height: 38px; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--control); cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.text-align button { display: flex; align-items: center; justify-content: center; }
.text-mode { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.text-mode button { font-size: 11px; }
.text-control-disabled { opacity: .38; }
.pos-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pos-wrap .text-label { margin: 0; }
.pos-grid { display: grid; grid-template-columns: repeat(3, 28px); gap: 4px; }
.pos-grid button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: var(--control); color: var(--faint); }
.pos-grid button::after { content: ''; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.pos-grid button:hover { background: var(--hover); color: var(--text); }
.pos-grid button.on { background: var(--accent); color: var(--accent-ink); }
/* Text panel density: inline labels, paired rows, Uppercase + Alignment on one row,
   position grid + rotation as one transform group. Same controls, ids and order of use. */
.text-card .text-row, .text-card .swrow { margin-top: 8px; }
.image-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.image-chip { width: 36px; height: 36px; padding: 2px; border: 0; border-radius: 8px; background: var(--control); cursor: pointer; }
.image-chip img { width: 100%; height: 100%; object-fit: contain; display: block; }
.image-chip.on { box-shadow: inset 0 0 0 2px var(--text); }
#secImage .upload:disabled { opacity: .4; cursor: default; }
/* Image In / Out: one preset row per side (scrolls sideways when narrow) + its duration under it. */
.image-motion { container-type: inline-size; }
.image-motion-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-top: 8px; }
.image-motion-row .text-label { margin: 0; }
.motion-pick, .motion-dur { min-height: 30px; border: 0; border-radius: var(--pill); background: var(--control); color: var(--text); cursor: pointer; }
.motion-pick { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 4px 10px; font: 500 12px var(--sans); text-align: left; }
.motion-pick .ui-icon { flex: 0 0 auto; width: 15px; height: 15px; }
.motion-pick .motion-chev { width: 13px; height: 13px; color: var(--muted); }
.motion-pick-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.motion-dur { min-width: 52px; padding: 4px 10px; font: 500 11px var(--mono); }
.motion-dur:disabled { opacity: .42; cursor: default; }
.motion-pick:hover, .motion-dur:hover:not(:disabled) { background: var(--hover); }
.motion-pick[aria-expanded=true], .motion-dur[aria-expanded=true] { box-shadow: inset 0 0 0 1px var(--line-strong); }
.motion-card { margin-top: 6px; padding: 0; }
/* Preset grid: 4 columns, 3 when the panel is narrow — icon + name always whole, never squeezed. */
.motion-grid { --cols: 4; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.motion-grid button { flex: 0 0 calc((100% - (var(--cols) - 1) * 4px) / var(--cols)); }
@container (max-width: 300px) { .motion-grid { --cols: 3; } }
.motion-grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 50px; padding: 6px 2px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 500 11px var(--sans); cursor: pointer; }
.motion-grid button .ui-icon { width: 16px; height: 16px; }
.motion-grid button span { max-width: 100%; white-space: nowrap; }
.motion-grid button:hover:not(.on) { background: var(--hover); color: var(--text); }
.motion-grid button.on { background: var(--accent); color: var(--accent-ink); }
.motion-dur-card { display: grid; grid-template-columns: minmax(0, 1fr) 42px; align-items: center; gap: 8px; padding: 4px 10px; }
.motion-dur-card output { font: 500 11px var(--mono); color: var(--text); text-align: right; }
.text-card .text-label { margin-bottom: 4px; }
.text-card-head { margin-bottom: 8px; }
.text-card textarea { min-height: 60px; }
.text-card select, .text-card input[type=text], .text-card input[type=number] { min-height: 34px; padding-top: 6px; padding-bottom: 6px; }
.text-mode { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.text-mode button { padding-inline: 4px; }
.text-inline, .text-color-row > label { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 8px; }
.text-inline > label { display: contents; }
.text-inline .text-label, .text-color-row .text-label { margin: 0; }
.text-color-row { grid-template-columns: minmax(0, 1fr) 34px; align-items: center; gap: 8px; }
.text-color-row input[type=color] { width: 34px; height: 34px; }
.text-style-row { display: flex; align-items: center; gap: 12px; }
.text-style-row .text-align-wrap { flex: 1 1 auto; min-width: 0; }
.text-style-row .text-align-wrap .text-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.text-style-row .swrow { flex: 0 0 auto; gap: 8px; margin: 0; }
.text-transform { display: flex; align-items: center; gap: 16px; }
.text-transform > .text-row { margin-top: 0; }
.text-transform .pos-wrap { flex: 0 0 auto; flex-direction: column; align-items: flex-start; gap: 4px; }
.text-transform .slider-row { flex: 1 1 auto; min-width: 0; }

/* Thumbnails keep their own imagery; chrome only marks selection. */
.bg-heading { position: relative; margin-top: 20px; }
.bg-family-tabs { margin-top: 12px; margin-bottom: 12px; }
.bg-picker { display: flex; flex-direction: column; gap: 14px; }
.bg-group-label { color: var(--faint); font: 400 11px var(--sans); margin-bottom: 8px; }
.bg-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
#bgGridSolid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.bg-thumb { aspect-ratio: 4 / 3; padding: 0; line-height: 0; background: transparent; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
#bgGridSolid .bg-thumb { aspect-ratio: 1.3; }
.bg-mesh-v2 { margin-top: 10px; display: grid; gap: 8px; }
.bg-mesh-v2-controls { display: grid; gap: 8px; position: relative; }
.bg-pal-head { align-items: baseline; gap: 8px; }
.bg-pal-head output { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-pal-edit { padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font: 400 11px var(--sans); cursor: pointer; }
.bg-pal-edit:hover, .bg-pal-edit[aria-expanded="true"] { color: var(--text); border-color: var(--accent); }
.bg-pal-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; display: grid; gap: 10px; padding: 10px; background: var(--control); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 28px rgba(0, 0, 0, .3); }
.bg-pal-pop.hidden { display: none; }
.bg-pal-stops { display: flex; flex-wrap: wrap; gap: 5px; }
.bg-pal-stop { position: relative; display: block; width: 24px; height: 24px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; cursor: pointer; }
.bg-pal-stop-input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.bg-pal-stop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.bg-pal-stop.on { box-shadow: 0 0 0 2px var(--control), 0 0 0 3px var(--accent); }
.bg-pal-pick .bg-palette-hex { width: 84px; }
.bg-pal-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bg-pal-actions button { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text); font: 400 11px var(--sans); cursor: pointer; }
.bg-pal-actions button:hover:not(:disabled) { border-color: var(--accent); }
.bg-pal-actions button:disabled { opacity: .4; cursor: default; }
.bg-pal-actions button.hidden { display: none; }
.bg-palette-strip { display: flex; gap: 6px; overflow-x: auto; padding: 3px 3px 5px; scrollbar-width: thin; }
.bg-palette-chip { flex: 0 0 auto; width: 38px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.bg-palette-chip:hover { border-color: var(--line-strong); }
.bg-palette-chip.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--accent); }
.bg-upgrade { justify-self: start; padding: 4px 10px; border: 1px dashed var(--line-strong); border-radius: 999px; background: transparent; color: var(--muted); font: 400 11px var(--sans); cursor: pointer; }
.bg-upgrade:hover { color: var(--text); border-color: var(--accent); }
.bg-mesh-v2-controls .row-top { margin-bottom: 0; }
.bg-mesh-motion { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bg-mesh-motion > span { flex: 0 0 auto; }
.bg-mesh-motion > .seg { flex: 0 0 auto; width: auto; }
.bg-mesh-motion > .seg button { flex: 0 0 auto; padding: 6px 16px; }
.bg-thumb canvas { display: block; width: 100%; height: 100%; }
.bg-thumb:hover { border-color: var(--line-strong); }
.bg-thumb.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--accent); }
.bg-palette-panel { position: absolute; top: 100%; right: 0; z-index: 20; display: flex; align-items: flex-start; gap: 10px; max-width: 100%; padding: 12px; margin-top: 6px; background: var(--control); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 28px rgba(0, 0, 0, .3); }
.bg-palette-swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; min-width: 0; }
.bg-palette-item { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bg-palette-sw { display: block; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); overflow: hidden; cursor: pointer; }
.bg-palette-sw input[type=color] { width: 140%; height: 140%; margin: -21% 0 0 -21%; padding: 0; border: 0; cursor: pointer; background: none; }
/* Radiant colors: one dropdown of palettes (a dot cluster + name per row), grouped by niche. */
.bg-colors { position: relative; display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.bg-colors-label { flex: 0 0 48px; color: var(--muted); font: 500 12px var(--sans); }
.bg-colors-trigger { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--control); color: var(--text); font: 500 12px var(--sans); cursor: pointer; }
.bg-colors-trigger:hover, .bg-colors-trigger[aria-expanded="true"] { border-color: var(--line-strong); }
.bg-colors-trigger .ui-icon { margin-left: auto; width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.bg-colors-trigger[aria-expanded="true"] .ui-icon { transform: rotate(180deg); }
.bg-colors-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-dots { display: inline-flex; flex: 0 0 auto; }
.bg-dots i { display: block; width: 16px; height: 16px; margin-left: -5px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--control), inset 0 0 0 1px rgba(255, 255, 255, .14); }
.bg-dots i:first-child { margin-left: 0; }
.bg-colors-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; max-height: min(360px, 60vh); overflow-y: auto; padding: 6px; background: var(--control); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 16px 36px rgba(0, 0, 0, .4); scrollbar-width: thin; }
.bg-colors-pop.hidden { display: none; }
.bg-colors-group { padding: 10px 10px 4px; color: var(--muted); font: 600 10px/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.bg-colors-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 7px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: 500 12px var(--sans); text-align: left; cursor: pointer; }
.bg-colors-opt:hover, .bg-colors-opt:focus-visible { background: var(--hover); }
.bg-colors-opt.on { background: var(--hover); }
.bg-colors-opt.on::after { content: ''; flex: 0 0 auto; width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: var(--accent); }
.bg-colors-opt .bg-dots i { box-shadow: 0 0 0 1.5px var(--control), inset 0 0 0 1px rgba(255, 255, 255, .14); }
.bg-colors-customize { display: block; width: calc(100% - 12px); margin: 8px 6px 4px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--pill); background: transparent; color: var(--muted); font: 500 12px var(--sans); cursor: pointer; }
.bg-colors-customize:hover { color: var(--text); border-color: var(--line-strong); }
.bg-ramp { display: block; flex: 0 0 auto; width: 46px; height: 16px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.bg-pal-select { margin: 0 0 10px; }
.bg-pal-select .bg-pal-edit { flex: 0 0 auto; height: 36px; padding: 0 12px; font: 500 12px var(--sans); }
/* Desktop: Mesh/Flow read Palette -> thumbnails -> Motion like Radiant; the shared V2 block flattens into the group and is ordered. */
html:not([data-compact]) .bg-group:is([data-family="mesh"], [data-family="flow"]):not(.hidden) { display: flex; flex-direction: column; }
html:not([data-compact]) .bg-group > .bg-mesh-v2:not(.hidden), html:not([data-compact]) .bg-group > .bg-mesh-v2 > .bg-mesh-v2-controls:not(.hidden) { display: contents; }
html:not([data-compact]) .bg-group > .bg-mesh-v2 .bg-pal-select { order: -1; }
html:not([data-compact]) .bg-group > .bg-mesh-v2 .bg-upgrade, html:not([data-compact]) .bg-group > .bg-mesh-v2 .bg-mesh-motion { order: 1; margin-top: 10px; }
.bg-colors-opt.bg-palette-chip { width: 100%; height: auto; padding: 7px 10px; border: 0; border-radius: 10px; }
.bg-colors-opt.bg-palette-chip.on { box-shadow: none; }
.bg-colors-custom { padding: 12px; margin: 0 0 10px; background: var(--control); border: 1px solid var(--line); border-radius: 12px; }
.bg-colors-custom.hidden { display: none; }
.bg-palette-hex { width: 58px; max-width: 100%; padding: 4px 0; border: 0; border-radius: 4px; background: var(--panel); color: var(--text); font: 400 9px var(--mono); text-align: center; text-transform: uppercase; }

#presetList { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 16px; }
.preset { display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 5px 5px 7px; text-align: center; background: transparent; border: 1px solid transparent; border-radius: 12px; }
.preset:hover { background: rgba(240, 238, 232, .04); }
.preset.on { background: var(--accent-soft); border-color: rgba(222, 213, 196, .28); }
.preset-media { position: relative; overflow: hidden; width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; background: #101214; }
.preset-media img, .bg-thumb, .bg-thumb img, .bg-thumb canvas { -webkit-user-drag: none; user-select: none; }
.preset-thumb, .preset-media canvas { display: block; width: 100%; height: 100%; margin: 0; object-fit: cover; background: transparent; }
.preset .pn { display: flex; align-items: baseline; justify-content: center; gap: 7px; min-width: 0; padding: 0 4px; color: var(--muted); font: 500 12px/1.3 var(--sans); letter-spacing: .01em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset .pn > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-plan-label { flex: 0 0 auto; color: var(--faint); font: 650 8px var(--mono); letter-spacing: .1em; }
.preset.on .pn, .preset:hover .pn { color: var(--text); }
.preset-loop { position: absolute; right: 6px; bottom: 6px; display: grid; place-items: center; width: 22px; height: 16px; border-radius: 8px; background: rgba(10, 11, 13, .42); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); pointer-events: none; }
.preset-loop svg { width: 13px; height: 7px; fill: none; stroke: rgba(245, 243, 238, .92); stroke-width: 1.8; stroke-linecap: round; }
.preset .pd { display: none; }
#mapWrap { overflow: hidden; background: transparent; }
#map { display: block; width: 100%; height: 104px; }
.map-lab { display: flex; justify-content: space-between; gap: 12px; color: var(--faint); font: 400 9px/1.5 var(--mono); }
.map-lab span:last-child { min-width: 0; text-align: right; overflow-wrap: anywhere; }

#imgStrip { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.ithumb { position: relative; width: 48px; height: 48px; flex: 0 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; cursor: grab; }
.ithumb img, .ithumb canvas { width: 100%; height: 100%; display: block; object-fit: cover; }
.ithumb .rm { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: rgba(12, 13, 14, .85); color: var(--text); font: 500 12px/1 var(--sans); }
.ithumb .rm:hover { color: var(--danger); }
.ithumb.hero { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--accent); }
.ithumb.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.ithumb.active-media { outline: 2px solid var(--accent); outline-offset: 2px; }
.ithumb.dim { opacity: .35; }
.ithumb.dim:hover { opacity: .6; }
/* Hidden by the user: the picture keeps its colour (no brightness/saturate — that is what "dim" looks like);
   the state is the eye-off chip. Out-of-motion media is .dim above and never carries both. */
.ithumb .hidden-tag { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; pointer-events: none; }
.ithumb .hidden-tag svg { box-sizing: content-box; width: 14px; height: 14px; padding: 5px; border-radius: 50%; background: rgba(8,9,10,.82); box-shadow: 0 0 0 1px rgba(237,233,224,.5); }
.ithumb .device-tag { position: absolute; left: 2px; bottom: 2px; max-width: 42px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 4px; border-radius: 4px; background: rgba(12, 13, 14, .85); color: var(--accent); font: 500 8px var(--sans); pointer-events: none; }
.ithumb.dragover { outline: 1px dashed var(--accent); }
.ithumb.ghost { display: flex; align-items: center; justify-content: center; border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--faint); cursor: pointer; }
.ithumb.ghost:hover { background: var(--control); color: var(--accent); }
.ithumb.ghost span { font: 400 18px/1 var(--sans); }
.model-thumb { cursor: pointer; background: var(--control); }
.model-thumb[aria-disabled="true"] { opacity: .5; }
#modelAnimation, #touchEditor select[data-action="model-clip"] { max-width: 100%; min-width: 0; padding: 6px; color: var(--text); background: var(--control); border: 1px solid var(--line); border-radius: 6px; }
#modelHealth, #modelStatus { overflow-wrap: anywhere; }
.sec #modelHealth.hint, .sec #modelStatus.hint { display: block; margin: 8px 0; font-size: 12px; line-height: 1.5; }
.collection-items-control { display: flex; align-items: center; gap: 10px; min-height: 34px; margin-top: 8px; }
.collection-items-control:not(.hidden) { display: flex; }
.collection-items-control .collection-repeat-label { margin-left: auto; color: var(--muted); font: 400 12px/1.4 var(--sans); }
.collection-items-stepper { display: grid; grid-template-columns: 30px minmax(32px, auto) 30px; height: 30px; padding: 2px; background: var(--control); border: 0; border-radius: var(--pill); }
.collection-items-stepper button, .collection-items-stepper output { display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font: 400 12px var(--mono); }
.collection-items-stepper button { font: 400 17px var(--sans); }
.collection-items-stepper button:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.collection-items-stepper output { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; padding: 0 6px; }
/* Auto: quiet text action beside the stepper — accent when active, faint otherwise (no pill, no fill). */
.items-auto { height: 30px; padding: 0 4px; border: 0; background: transparent; color: var(--faint); font: 400 12px/1 var(--sans); cursor: pointer; }
.items-auto:hover { color: var(--text); }
.items-auto.on { color: var(--accent); cursor: default; }
.items-auto[hidden], .collection-items-stepper button[hidden] { display: none; }
/* One item only (motion or subject): informative 1 / 1, no −/+ and no Auto. */
.collection-items-control.is-fixed .collection-items-stepper { grid-template-columns: auto; background: transparent; padding: 0; }
.collection-items-control.is-fixed .collection-items-stepper output { color: var(--faint); padding: 0; }

#secColl.is-managing-media #imgStrip,
#secColl.is-managing-media #focusSummary,
#secColl.is-managing-media #focusStyleRow,
#secColl.is-managing-media #focusIntensityRow,
#secColl.is-managing-media #focusEditorRow,
#secColl.is-managing-media #mediaTouchActions { display: none !important; }
.media-manager { margin: 0 0 2px; width: 100%; max-width: 320px; overflow: visible; background: transparent; }
.media-manager-list { max-height: min(42svh, 340px); overflow-y: auto; padding: 0; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.media-manager-row { display: grid; grid-template-columns: 18px 40px minmax(0, 1fr) 30px 30px 30px 30px; align-items: center; gap: 6px; min-height: 46px; padding: 4px 0; border-top: 1px solid rgba(240,238,232,.055); color: var(--muted); }
.media-manager-row:hover, .media-manager-row.is-over { background: rgba(240,238,232,.035); }
.media-manager-row.is-dragging { opacity: .45; }
.media-manager-row.is-hidden .media-row-thumb img,
.media-manager-row.is-hidden .media-row-thumb canvas,
.media-manager-row.is-hidden .media-row-thumb > span { filter: saturate(.45) brightness(.62); opacity: .4; }
.media-row-handle { color: var(--faint); font: 600 13px/1 var(--mono); cursor: grab; letter-spacing: -4px; }
.media-row-thumb { position: relative; width: 40px; height: 40px; display: grid; place-items: center; overflow: hidden; padding: 0; border: 0; border-radius: 7px; background: #0d0e0f; color: var(--faint); font: 600 9px var(--mono); }
.media-row-thumb img, .media-row-thumb canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-row-thumb small { position: absolute; right: 3px; top: 3px; padding: 1px 2px; border-radius: 3px; background: rgba(0,0,0,.68); color: var(--text); font: 650 7px/1.2 var(--mono); }
.media-row-index { min-width: 0; justify-self: start; padding: 0; border: 0; background: transparent; color: var(--faint); text-align: left; font: 500 11px var(--mono); }
.media-row-index:hover { color: var(--text); }
.media-row-remove:hover { color: var(--danger); }
/* Media Frames V1 — Frame is an action on the item's own row; its editor opens under the item only when asked. */
.media-row-frame { position: relative; }
.media-row-frame.is-on { color: var(--accent); }
.media-row-frame.is-on::after { content: ''; position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.media-frame { display: grid; gap: 0; padding: 0 0 6px 24px; border-top: 1px solid rgba(240,238,232,.035); }
.media-frame-head { display: flex; align-items: center; gap: 8px; min-height: 32px; min-width: 0; }
.media-frame-thumb { flex: none; width: 28px; height: 28px; border-radius: 5px; background: #0d0e0f; margin-right: auto; }
.media-frame-btn { flex: none; min-height: 28px; padding: 4px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--faint); font: 500 11px var(--sans); cursor: pointer; }
.media-frame-btn:hover { background: var(--hover); color: var(--text); }
.media-frame-btn.is-danger:hover { color: var(--danger); }
.media-frame-slider { display: grid; grid-template-columns: 36px minmax(0, 1fr) 40px 28px; align-items: center; gap: 8px; color: var(--faint); font: 400 11px var(--sans); }
.media-frame-slider output { text-align: right; color: var(--muted); font: 500 11px var(--mono); }
.media-frame-reset { width: 28px; height: 28px; }
.media-manager-add { width: auto; min-height: 30px; margin-top: 4px; padding: 4px 2px; justify-content: flex-start; gap: 6px; border: 0; border-radius: 8px; background: transparent; color: var(--faint); font: 500 11px var(--sans); }
.media-manager-add:hover { background: transparent; color: var(--text); }
.media-manager-add svg { width: 14px; height: 14px; }
.media-manager-foot { min-height: 30px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 7px 0 0; }
.media-clear-btn, .media-clear-confirm button { min-height: 28px; padding: 4px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--faint); font: 500 11px var(--sans); }
.media-clear-btn:hover, .media-clear-confirm button:hover { color: var(--text); background: var(--hover); }
.media-clear-confirm { display: flex; align-items: center; gap: 6px; min-width: 0; }
.media-clear-confirm span { color: var(--faint); font: 400 11px var(--sans); white-space: nowrap; }
#mediaClearConfirmBtn, .media-clear-btn:hover { color: var(--danger); }

.format-choice { grid-template-columns: minmax(0, 1fr); }
.format-choice > .seg { grid-column: 1; }
.dims { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.dims .dl { font: 400 11px var(--sans); color: var(--faint); }
.dims .dv { color: var(--muted); font: 400 11px var(--mono); font-variant-numeric: tabular-nums; }
/* Export > Video > Final duration: one row, spread edge to edge — label · mode · stepper · result */
.export-length { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.export-length > label { flex: 1 1 auto; min-width: 0; color: var(--muted); font: 400 12px var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.export-length-mode { flex: 0 0 auto; }
.seg.export-length-mode button { flex: 0 0 auto; width: 30px; height: 26px; min-height: 26px; padding: 0; font: 500 12px var(--mono); line-height: 26px; }
.export-stepper { display: inline-flex; flex: 0 0 auto; align-items: center; height: 30px; border-radius: var(--pill); background: var(--control); }
.export-stepper button { width: 28px; height: 30px; padding: 0; border: 0; border-radius: var(--pill); background: transparent; color: var(--muted); font: 500 14px var(--sans); }
.export-stepper button:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.export-stepper input { width: 3.5ch; padding: 0; border: 0; background: transparent; color: var(--text); font: 500 12px var(--mono); font-variant-numeric: tabular-nums; text-align: center; -moz-appearance: textfield; appearance: textfield; }
.export-stepper input::-webkit-inner-spin-button, .export-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.export-stepper input:focus { outline: none; }
.export-stepper:focus-within { box-shadow: 0 0 0 1px var(--line); }
.export-unit { margin-left: -2px; color: var(--muted); font: 400 11px var(--mono); }
.export-length-result { flex: 0 0 auto; min-width: 5ch; text-align: right; color: var(--faint); font: 400 11px var(--mono); font-variant-numeric: tabular-nums; }
.export-length-oneshot { flex: 0 0 auto; color: var(--muted); font: 400 11px var(--mono); font-variant-numeric: tabular-nums; }
/* Compact (touch): follow the export panel's 44 px targets so the row stays aligned and easy to tap */
html[data-compact] .seg.export-length-mode button { width: 40px; height: 44px; min-height: 44px; line-height: 44px; }
html[data-compact] .export-stepper { height: 44px; }
html[data-compact] .export-stepper button { width: 40px; height: 44px; }
.sec-export { flex: 0 0 auto; z-index: 10; border-top: 1px solid var(--line); border-bottom: 0; background: var(--panel); padding-top: 10px; padding-bottom: 14px; }
.sec-export .sec-head { min-height: 24px; margin-bottom: 8px; }
#btnRender { min-height: 40px; margin-top: 8px; }
.prog { display: none; margin-top: 12px; }
.prog.on { display: block; }
.prog-bar { height: 3px; background: var(--line-strong); border-radius: var(--pill); overflow: hidden; }
.prog-bar i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .12s linear; }
.prog-lab { margin-top: 8px; color: var(--muted); font: 400 10px/1.5 var(--mono); }
#toasts { position: fixed; left: 24px; bottom: 86px; max-width: min(420px, calc(100% - 48px)); display: flex; flex-direction: column; gap: 8px; z-index: 99; pointer-events: none; }
.toast { padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--control); color: var(--text); font: 400 12px/1.5 var(--sans); box-shadow: 0 8px 28px rgba(0, 0, 0, .2); animation: tin .18s ease-out; }
.checkout-return { width: max-content; position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; align-items: center; gap: 12px; max-width: min(460px, calc(100% - 32px)); padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--control); color: var(--text); font: 400 12px/1.5 var(--sans); box-shadow: 0 8px 28px rgba(0, 0, 0, .2); animation: tin .18s ease-out; }
.checkout-return-action { flex: none; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; color: var(--text); font: 600 12px/1.2 var(--sans); cursor: pointer; }
.checkout-return-action:disabled { opacity: .5; cursor: default; }
@keyframes tin { from { opacity: 0; transform: translateY(5px); } }

@media (max-width: 940px) {
    body { overflow: auto; }
    main { grid-template-columns: minmax(0, 1fr); height: auto; }
    .stage, .panel, .panel-left { grid-column: auto; grid-row: auto; }
    .stage { order: 1; height: 56svh; min-height: 300px; max-height: 640px; }
    .panel-left { order: 2; }
    .panel { order: 3; }
    .panel, .panel-left { overflow: visible; border-left: 0; border-right: 0; border-top: 1px solid var(--line); }
    .panel-scroll { overflow: visible; padding-bottom: 0; }
    .sec { padding-left: 24px; padding-right: 24px; }
    .sec-export { position: static; }
    .bg-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
    #bgGridSolid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    #presetList { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
    .codec { display: none; }
}

@media (max-width: 520px) {
    header { height: 60px; padding: 0 16px; gap: 12px; }
    .brand { gap: 8px; }
    .brand h1 { font-size: 15px; }
    .brand h1 em { font-size: 17px; }
    .top-right .btn-primary { min-height: 32px; padding: 8px 12px; font-size: 11px; }
    .top-right { gap: 10px; }
    .lang-seg button { min-width: 24px; padding: 6px 8px; font-size: 11px; }
    .sec { padding: 16px 20px 20px; }
    .seg button, .tabs button, .text-align button { min-height: 34px; }
    .bg-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    #presetList { grid-template-columns: minmax(0, 1fr); }
    .transport { left: 12px; right: 12px; bottom: 12px; gap: 8px; padding: 8px; }
    .transport.has-timeline { column-gap: 8px; }
    .timecode { font-size: 9px; }
    .tbtn { width: 32px; height: 32px; }
    #toasts { left: 16px; bottom: 16px; max-width: calc(100% - 32px); }
}

@media (max-width: 360px) {
    header { padding: 0 12px; }
    .brand .mark { display: none; }
    .sec { padding-left: 16px; padding-right: 16px; }
    .seg button { padding-left: 5px; padding-right: 5px; font-size: 11px; }
    .tabs button { font-size: 10px; }
    .timecode { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Subject (mockup) bar: one pill holding a scrolling row of names at their own width + the chevron that lists them all. */
.subject-bar { display: flex; align-items: center; min-width: 0; padding: 3px; border-radius: var(--pill); background: var(--control); }
.subject-bar > #segSubject { position: relative; flex: 1 1 auto; padding: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; background: none; }
.subject-bar > #segSubject::-webkit-scrollbar { display: none; }
#segSubject button[hidden] { display: none; }
#segSubject button { flex: 1 1 auto; padding-left: 12px; padding-right: 12px; text-align: center; }
#segSubject button:disabled { cursor: default; opacity: .35; }
:is(#segSubject, #touchEditor .touch-segment).is-overflow { --fade-l: 0px; --fade-r: 28px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent); mask-image: linear-gradient(90deg, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent); }
:is(#segSubject, #touchEditor .touch-segment).is-overflow:not(.is-start) { --fade-l: 22px; }
:is(#segSubject, #touchEditor .touch-segment).is-overflow.is-end { --fade-r: 0px; }
.subject-more { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; margin-left: 2px; padding: 0; border: 0; border-radius: var(--pill); background: transparent; color: var(--faint); }
.subject-more .ui-icon { width: 15px; height: 15px; transition: transform .17s ease; }
.subject-more[hidden] { display: none; }
.subject-more.has-value { width: auto; padding: 0 8px 0 12px; gap: 4px; grid-auto-flow: column; background: var(--text); color: var(--bg, #111); font-size: 12px; font-weight: 600; }
.subject-more-label[hidden] { display: none; }
.subject-more:hover, .subject-more[aria-expanded=true] { background: var(--hover); color: var(--text); }
.subject-more[aria-expanded=true] .ui-icon { transform: rotate(180deg); }

/* Menu card (.am): the touch account menu and the subject pickers (menu-picker.js). */
/* Header account trigger (account-menu.js): avatar + first name + quiet Pro mark. The account
   menu replaces the header's separate language, plan, user and ··· controls (kept in the DOM). */
.top-right :is(#langSwitch, #takesPlanStatus, #takesAuth, .site-menu) { display: none !important; }
.acct-btn { display: flex; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0; height: 38px; padding: 0 12px 0 5px; border: 0; border-radius: var(--pill); background: transparent; color: var(--text); font: 550 13px var(--sans); cursor: pointer; transition: background-color .16s; }
.acct-btn:hover, .acct-btn[aria-expanded=true] { background: var(--control); }
.acct-btn:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.acct-txt { display: flex; align-items: center; gap: 7px; min-width: 0; }
.acct-name { color: var(--muted); white-space: nowrap; }
.acct-pro { color: var(--faint); font: 650 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.acct-btn:not(:has(.acct-txt)) { padding-right: 5px; }
.am { position: fixed; top: calc(var(--touch-header) + 4px); right: 8px; z-index: 200; width: min(300px, calc(100vw - 16px)); overflow: hidden; border-radius: 18px; background: radial-gradient(120% 70% at 0% 0%, rgba(222, 213, 196, .07), transparent 60%), #1b1c1e; box-shadow: 0 0 0 1px rgba(240, 238, 232, .08), 0 20px 50px rgba(0, 0, 0, .55); color: var(--text); font: 500 13px var(--sans); transform-origin: calc(100% - 70px) 0; }
.am[hidden] { display: none; }
.am-view { display: flex; flex-direction: column; gap: 4px; padding: 6px; }
.am-ico { width: 18px; height: 18px; flex: 0 0 auto; }
.am button, .am a { -webkit-tap-highlight-color: transparent; }
.am-chev { margin-left: auto; color: var(--faint); font-size: 17px; line-height: 1; }
.am-id { display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 8px; border-radius: 13px; background: rgba(240, 238, 232, .04); }
.am-id .acct-face { width: 36px; height: 36px; font-size: 12px; }
.am-id-copy { flex: 1; min-width: 0; }
.am-id strong { display: flex; align-items: center; gap: 6px; min-width: 0; font: 650 13.5px var(--sans); }
.am-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-id small { display: block; margin-top: 2px; overflow: hidden; color: var(--faint); font: 400 11.5px var(--sans); text-overflow: ellipsis; white-space: nowrap; }
.am-pro-tag { flex: 0 0 auto; color: var(--faint); font: 650 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.am-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 11px; background: transparent; color: var(--faint); }
.am-icon:hover, .am-icon:focus-visible { background: var(--hover); color: var(--text); }
.am-google { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; border: 0; border-radius: 13px; background: #2b2d30; color: var(--text); font: 600 13.5px var(--sans); }
.am-google:disabled { color: var(--muted); }
.am-g { width: 17px; height: 17px; }
.am-pro { display: flex; align-items: center; gap: 11px; padding: 10px; border: 0; border-radius: 13px; background: linear-gradient(120deg, rgba(222, 213, 196, .13), rgba(222, 213, 196, .04) 70%); color: var(--text); text-align: left; }
.am-pro-ico { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 10px; background: rgba(222, 213, 196, .14); color: var(--accent); }
.am-pro-ico .ui-icon { width: 17px; height: 17px; }
.am-pro-copy { min-width: 0; }
.am-pro-copy b { display: block; font: 600 13.5px var(--sans); }
.am-pro-copy span { display: block; margin-top: 2px; color: #b9b3a8; font: 400 11.5px/1.35 var(--sans); text-wrap: balance; }
.am-list { display: flex; flex-direction: column; }
.am-list.am-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 4px; }
.am-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 11px; background: transparent; color: var(--text); font: 500 13.5px var(--sans); text-align: left; text-decoration: none; }
.am-row > .am-ico { color: var(--faint); }
.am-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-val { margin-left: auto; color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.am-val + .am-chev { margin-left: 4px; }
.am-plain { padding-left: 12px; color: #cfcdc8; }
.am-plain.is-on { color: var(--text); }
.am-plain.is-on .am-ico { margin-left: auto; color: var(--accent); }
:is(.am-row, .am-pro, .am-google):is(:hover, :focus-visible, :active):not(:disabled) { background-color: var(--hover); }
.am-pro:is(:hover, :focus-visible, :active) { background: linear-gradient(120deg, rgba(222, 213, 196, .17), rgba(222, 213, 196, .07) 70%); }
.am :focus-visible { outline: none; }
.am-group { padding-top: 4px; border-top: 1px solid rgba(240, 238, 232, .07); }
.am-id + .am-group, .am-google + .am-group { border-top: 0; padding-top: 0; }
.am-foot { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; padding: 2px 0 0; border-top: 1px solid rgba(240, 238, 232, .07); }
.am-link { display: flex; align-items: center; min-height: 40px; padding: 0 6px; color: var(--faint); font: 450 11.5px var(--sans); text-decoration: none; transition: color .16s; }
.am-link:is(:hover, :focus-visible) { color: var(--text); }
.am-link:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.am-dot { color: var(--faint); opacity: .6; font-size: 11px; }
.am-row:focus-visible, .am-pro:focus-visible, .am-google:focus-visible { box-shadow: inset 0 0 0 1.5px rgba(222, 213, 196, .45); }
html:not([data-compact]) .am { width: 280px; }
html:not([data-compact]) .am-row { min-height: 38px; font-size: 13px; }
html:not([data-compact]) .am-link { min-height: 34px; }

.am-status { margin: 0; padding: 2px 10px 6px; color: var(--danger); font: 400 11px/1.35 var(--sans); }
.am-sub-head { display: flex; align-items: center; gap: 2px; min-height: 44px; padding-right: 10px; }
.am-back { display: grid; place-items: center; width: 40px; height: 44px; padding: 0; border: 0; border-radius: 11px; background: transparent; color: var(--muted); }
.am-back:is(:hover, :focus-visible) { background: var(--hover); color: var(--text); }
.am-sub-head strong { font: 650 14px var(--sans); }
.am-title { margin: 0; padding: 10px 12px 4px; font: 650 13.5px var(--sans); }
.am-row:disabled { color: var(--faint); opacity: .45; cursor: default; }
.menu-picker { width: 220px; }

/* Projects: header action, quick switcher and local gallery. */
.project-head { min-width: 0; display: inline-flex; align-items: center; gap: 8px; }
.project-title { min-width: 0; max-width: min(280px, 30vw); height: 32px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid rgba(240, 238, 232, .12); border-radius: var(--pill); background: rgba(240, 238, 232, .025); color: var(--muted); font: 500 12px var(--sans); }
.project-title:hover, .project-title:focus-within, .project-title:has(.project-switch[aria-expanded="true"]) { color: var(--text); background: var(--control); border-color: var(--line-strong); }
.project-switch { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.project-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; border-radius: 4px; }
.project-name:focus-visible { outline: 1px solid var(--line-strong); outline-offset: 2px; }
.project-name-input { width: 170px; min-width: 0; height: 24px; margin: 0 -6px 0 0; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--control); color: var(--text); font: 500 12px var(--sans); }
.project-add { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid transparent; border-radius: var(--pill); background: transparent; color: var(--muted); opacity: .7; }
.project-add:hover, .project-add:focus-visible { color: var(--text); background: var(--control); border-color: var(--line-strong); opacity: 1; }
.project-add .ui-icon { width: 14px; height: 14px; }
.project-popover { position: fixed; z-index: 80; width: min(360px, calc(100vw - 24px)); padding: 12px; border: 1px solid var(--line-strong); border-radius: 18px; background: rgba(20, 21, 22, .985); box-shadow: 0 20px 56px rgba(0,0,0,.38); }
.project-popover-head { display: flex; justify-content: space-between; gap: 12px; padding: 4px 4px 12px; border-bottom: 1px solid var(--line); }
.project-popover-head strong { display: block; max-width: 245px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 650 13px var(--sans); color: var(--text); }
.project-popover-head span:not(.project-current) { display: block; margin-top: 4px; color: var(--faint); font: 400 10px var(--sans); }
.project-popover-head span.error { color: var(--danger); }
.project-current { align-self: flex-start; padding: 3px 8px; border: 1px solid rgba(222, 213, 196, .2); border-radius: var(--pill); color: var(--accent); font: 500 10px var(--sans); }
.project-recent-label { margin: 12px 4px 6px; color: var(--faint); font: 400 9px var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.project-recent-list { display: flex; flex-direction: column; gap: 3px; }
.project-recent-list button, .project-popover-actions button { width: 100%; min-height: 38px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); text-align: left; font: 500 12px var(--sans); }
.project-recent-list button:hover, .project-popover-actions button:hover { background: var(--control); color: var(--text); }
.project-recent-item { display: flex; flex-direction: column; gap: 3px; }
.project-recent-item strong { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; font: 600 12px var(--sans); }
.project-recent-item span { color: var(--faint); font: 400 10px var(--sans); }
.project-popover-actions { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.project-empty, .project-gallery-empty { padding: 14px 8px; color: var(--faint); font: 400 12px var(--sans); }
.project-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: clamp(18px, 4vw, 42px); background: rgba(7, 8, 9, .52); backdrop-filter: blur(11px); }
.project-modal-card { width: min(1080px, calc(100vw - 64px)); height: min(760px, calc(100svh - 88px)); min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(240, 238, 232, .18); border-radius: 22px; background: rgba(23, 24, 25, .985); box-shadow: 0 28px 90px rgba(0,0,0,.46); }
.project-modal-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.project-modal-head h2 { font: 650 18px var(--sans); }
.project-modal-actions { display: flex; align-items: center; gap: 8px; }
.project-light-btn { min-height: 32px; padding: 7px 13px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--control); color: var(--text); font: 600 12px var(--sans); }
.project-light-btn:hover { border-color: var(--line-strong); background: var(--hover); }
.project-modal-tools { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 20px 12px; }
.project-modal-tools input { width: 100%; min-width: 0; min-height: 38px; padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--control); color: var(--text); font: 400 12px var(--sans); }
.project-modal-tools input:focus { border-color: var(--line-strong); }
.project-modal-tools span { color: var(--faint); font: 400 11px var(--sans); }
.project-grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); align-content: start; gap: 22px 18px; overflow: auto; padding: 2px 20px 26px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.project-grid::-webkit-scrollbar { width: 8px; }
.project-grid::-webkit-scrollbar-thumb { background: var(--line-strong); border: 2px solid transparent; border-radius: var(--pill); background-clip: content-box; }
.project-card { min-width: 0; }
.project-card.active .project-thumb { border-color: rgba(222, 213, 196, .78); box-shadow: 0 0 0 1px rgba(222, 213, 196, .26); }
.project-thumb { width: 100%; aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: radial-gradient(circle at 32% 22%, rgba(222,213,196,.12), transparent 38%), linear-gradient(135deg, #222528, #111213); color: var(--faint); font: italic 500 16px var(--serif); }
.project-thumb:hover { border-color: var(--line-strong); }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-card-body { padding: 10px 1px 0; }
.project-name-row { min-height: 25px; display: flex; align-items: center; min-width: 0; }
.project-title-btn { max-width: 100%; padding: 2px 0; border: 0; background: transparent; color: var(--text); overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; font: 650 13px/1.35 var(--sans); }
.project-title-btn:hover { color: var(--accent); }
.project-rename-input { width: 100%; min-width: 0; height: 28px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--control); color: var(--text); font: 650 13px var(--sans); }
.project-card-meta { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font: 400 11px var(--sans); }
.project-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--faint); font: 400 11px var(--sans); }
.project-menu-btn { width: 32px; height: 28px; flex: 0 0 auto; border: 0; border-radius: 9px; background: transparent; color: var(--faint); letter-spacing: .08em; }
.project-menu-btn:hover { background: var(--control); color: var(--text); }
.project-action-menu { position: fixed; z-index: 120; min-width: 164px; padding: 7px; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(31, 33, 34, .99); box-shadow: 0 16px 44px rgba(0,0,0,.42); }
.project-action-menu button { width: 100%; min-height: 34px; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; font: 500 12px var(--sans); }
.project-action-menu button:hover { background: rgba(240, 238, 232, .07); color: var(--text); }
.project-action-menu button.danger { color: var(--danger); }
.project-action-menu button.danger:hover { background: rgba(238, 146, 146, .1); }

.export-modal { position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; padding: clamp(14px, 4vw, 48px); background: rgba(3, 4, 5, .62); backdrop-filter: blur(12px); }
.export-modal-card { width: min(560px, calc(100vw - 32px)); max-height: min(720px, calc(100svh - 32px)); min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(240, 238, 232, .16); border-radius: 22px; background: rgba(23, 24, 25, .985); box-shadow: 0 28px 90px rgba(0,0,0,.48); }
.export-modal-head { flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.export-modal-head h2 { font: 650 20px var(--sans); }
.export-modal-head p { margin-top: 5px; color: var(--faint); font: 400 12px var(--sans); }
.export-modal-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 18px 24px 20px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.export-modal-row { display: grid; grid-template-columns: minmax(96px, .8fr) minmax(0, 1.6fr); align-items: center; gap: 14px; min-height: 44px; margin-top: 10px; }
.export-modal-row:first-child { margin-top: 0; }
.export-modal-row > span { color: var(--muted); font: 400 12px var(--sans); }
.export-row-label { display: inline-flex; align-items: baseline; gap: 7px; }
.export-modal-row > strong { color: var(--text); font: 500 12px var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.export-modal-kind .seg button { text-transform: uppercase; font: 650 11px var(--sans); }
.option-pro-label { margin-left: 5px; color: var(--faint); font: 650 8px var(--mono); letter-spacing: .08em; }
.seg button.is-pro-locked:not(.on) .option-pro-label { color: rgba(237, 233, 224, .28); }
.export-modal.is-pro-unlocked .option-pro-label { display: none; }
.export-dimensions-row { align-items: start; }
.export-dimensions-control { min-width: 0; display: grid; gap: 9px; }
.export-dimension-presets button { font-size: 11px; padding-left: 6px; padding-right: 6px; }
.export-dimensions-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.export-dimensions-inputs label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font: 500 10px var(--sans); text-transform: uppercase; letter-spacing: .08em; }
.export-dimensions-inputs input { width: 100%; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.045); color: var(--text); font: 500 12px var(--mono); font-variant-numeric: tabular-nums; outline: none; }
.export-dimensions-inputs input:focus { border-color: rgba(222, 213, 196, .42); background: rgba(255,255,255,.07); }
.export-gif-size-readout { display: none; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.035); }
.export-gif-size-readout span { color: var(--muted); font: 500 10px var(--sans); text-transform: uppercase; letter-spacing: .08em; }
.export-gif-size-readout strong { color: var(--text); font: 500 12px var(--mono); font-variant-numeric: tabular-nums; }
.export-dimensions-row.is-gif-size .export-dimension-presets,
.export-dimensions-row.is-gif-size .export-dimensions-inputs,
.export-dimensions-row.is-gif-size .export-dimensions-meta { display: none; }
.export-dimensions-row.is-gif-size .export-gif-size-readout { display: flex; }
.export-dimensions-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--faint); font: 500 11px var(--mono); font-variant-numeric: tabular-nums; }
.export-dimensions-meta strong { color: var(--text); font: inherit; }
.export-dimensions-meta span { flex: 0 0 auto; padding: 3px 7px; border-radius: 999px; background: rgba(222, 213, 196, .1); color: var(--muted); font: 650 9px var(--mono); text-transform: uppercase; }
.export-dimensions-row.is-custom .export-dimensions-meta span { color: var(--accent); }
.export-dimensions-row.is-pro-size .export-dimensions-meta span { background: rgba(200, 161, 90, .16); color: var(--accent); }
.export-dimensions-row.is-readonly:not(.is-free-size) .export-dimensions-control { opacity: .72; }
.export-dimensions-row.is-readonly input { pointer-events: none; }
.export-dimensions-row.is-free-size .export-dimensions-inputs { display: none; }
.export-dimensions-row.is-free-size .export-dimensions-meta { justify-content: flex-end; }
.export-dimensions-row.is-free-size .export-dimensions-meta span { display: none; }
.export-modal-motion, .export-modal-image { margin-top: 14px; padding-top: 4px; }
.export-modal-motion #videoOpts, .export-modal-image #imageOpts { display: block; }
.export-modal-motion .export-length { min-height: 44px; margin-top: 0; }
.export-modal-image .row:first-child { margin-top: 0; }
.export-modal-note { margin-top: 12px; color: var(--faint); font: 400 11px/1.45 var(--sans); }
.export-modal-note:empty { display: none; }
.export-modal-pro-note { margin-top: 12px; color: var(--faint); font: 400 11px/1.45 var(--sans); }
.export-modal-foot { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 24px 22px; border-top: 1px solid var(--line); }
.export-modal-summary { min-width: 0; overflow: hidden; color: var(--faint); text-overflow: ellipsis; white-space: nowrap; font: 400 11px var(--mono); font-variant-numeric: tabular-nums; }
.export-modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.export-modal-actions .btn-primary, .export-modal-actions .project-light-btn { min-height: 36px; }
/* Pro modal: one surface — structure from type, spacing and row hairlines only. */
.upgrade-modal { position: fixed; inset: 0; z-index: 96; display: flex; align-items: center; justify-content: center; padding: clamp(16px, 4vw, 48px); background: rgba(3, 4, 5, .7); backdrop-filter: blur(14px); }
.upgrade-modal-card { position: relative; width: min(752px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr; grid-template-areas: "head head" "compare buy" "compare foot"; column-gap: 48px; padding: 36px 40px 32px; overflow: hidden auto; overscroll-behavior: contain; border-radius: 20px; background: var(--bg); box-shadow: 0 0 0 1px rgba(240, 238, 232, .05), inset 0 1px 0 rgba(240, 238, 232, .05), 0 40px 120px rgba(0, 0, 0, .55); outline: none; }
.upgrade-modal-close { position: absolute; top: 12px; right: 12px; z-index: 3; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--faint); }
.upgrade-modal-close:hover { color: var(--text); }
.upgrade-modal-close svg { width: 16px; height: 16px; }
.upgrade-head { grid-area: head; min-width: 0; margin-bottom: 30px; padding-right: 40px; }
.upgrade-brand { display: flex; align-items: baseline; color: var(--text); font: 600 15px/1 var(--sans); letter-spacing: -.005em; }
.upgrade-brand .mark { width: 8px; height: 8px; margin-right: 10px; align-self: center; border-radius: 3px; background: var(--accent); }
.upgrade-brand em { margin-left: 4px; color: var(--accent); font: italic 500 17px/1 var(--serif); }
.upgrade-head h2 { margin-top: 22px; color: var(--text); font: 600 32px/1.1 var(--sans); letter-spacing: -.022em; text-wrap: balance; }
.upgrade-lead { max-width: 60ch; margin-top: 12px; color: var(--muted); font: 400 14px/1.6 var(--sans); text-wrap: pretty; }
.upgrade-compare { grid-area: compare; align-self: start; width: 100%; border-collapse: collapse; font: 400 13px/1.35 var(--sans); font-variant-numeric: tabular-nums lining-nums; }
.upgrade-compare thead th { padding: 0 0 10px; text-align: left; color: var(--faint); font: 600 10.5px/1 var(--sans); letter-spacing: .09em; text-transform: uppercase; }
.upgrade-compare thead th:last-child { color: var(--accent); }
.upgrade-compare tbody tr { border-top: 1px solid var(--line); }
.upgrade-compare tbody th { position: relative; padding: 11px 16px 11px 0; text-align: left; color: var(--muted); font-weight: 400; text-wrap: balance; }
.upgrade-compare tbody td { padding: 11px 12px 11px 0; color: var(--faint); white-space: nowrap; }
.upgrade-compare tbody td:last-child { padding-right: 0; color: var(--text); font-weight: 500; }
.upgrade-compare td.is-none { color: rgba(133, 135, 135, .55); }
.upgrade-compare tr.is-focus th { color: var(--text); }
.upgrade-compare tr.is-focus td:last-child { color: var(--accent); }
.upgrade-compare tr.is-focus th::before { content: ""; position: absolute; top: 11px; bottom: 11px; left: -14px; width: 2px; border-radius: 2px; background: var(--accent); }
.upgrade-buy { grid-area: buy; min-width: 0; }
.upgrade-label { margin: 0 0 10px 16px; color: var(--faint); font: 600 10.5px/1 var(--sans); letter-spacing: .09em; text-transform: uppercase; }
.upgrade-plans { position: relative; display: grid; grid-auto-rows: 1fr; gap: 4px; }
.upgrade-plan-indicator { position: absolute; top: 0; left: 0; right: 0; height: calc((100% - 4px) / 2); border-radius: 14px; background: var(--panel); box-shadow: inset 0 0 0 1px rgba(222, 213, 196, .2); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.upgrade-plans:has(#upgradePlanMonthly:checked) .upgrade-plan-indicator { transform: translateY(calc(100% + 4px)); }
.upgrade-plan { position: relative; z-index: 1; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; grid-template-areas: "radio name price" ". note note"; align-items: center; column-gap: 14px; row-gap: 6px; padding: 15px 16px 14px; border-radius: 14px; cursor: pointer; }
.upgrade-plan input { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.upgrade-plan:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.upgrade-plan:has(input:disabled) { cursor: progress; }
.upgrade-radio { grid-area: radio; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-strong); transition: box-shadow .18s; }
.upgrade-radio::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.upgrade-plan:hover .upgrade-radio { box-shadow: inset 0 0 0 1.5px rgba(240, 238, 232, .32); }
.upgrade-plan:has(input:checked) .upgrade-radio { box-shadow: inset 0 0 0 1.5px var(--accent); }
.upgrade-plan:has(input:checked) .upgrade-radio::after { transform: scale(1); }
.upgrade-plan-name { grid-area: name; min-width: 0; color: var(--text); font: 600 14px/1.2 var(--sans); letter-spacing: -.005em; }
.upgrade-plan-name em { display: block; margin: 4px 0 0; color: var(--accent); font: 600 12px/1.2 var(--sans); font-style: normal; white-space: nowrap; }
.upgrade-plan-note { grid-area: note; color: var(--faint); font: 400 12px/1.4 var(--sans); }
.upgrade-plan-price { grid-area: price; color: var(--text); font: 600 26px/1 var(--sans); letter-spacing: -.025em; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; transition: color .2s; }
.upgrade-plan-price small { margin-left: 2px; color: var(--faint); font: 400 12px/1 var(--sans); letter-spacing: 0; }
.upgrade-plan:not(:has(input:checked)) .upgrade-plan-price { grid-area: price; color: var(--muted); }
.upgrade-foot { grid-area: foot; min-width: 0; padding-top: 16px; }
.upgrade-cta { width: 100%; height: 48px; display: flex; align-items: center; justify-content: center; padding: 0 20px; border: 0; border-radius: var(--pill); background: var(--accent); color: var(--accent-ink); font: 600 14.5px/1 var(--sans); letter-spacing: -.005em; transition: background-color .16s, transform .12s; }
.upgrade-cta:hover { background: #eae2d4; }
.upgrade-cta:active { transform: scale(.985); }
.upgrade-cta:disabled { cursor: progress; opacity: .8; }
.upgrade-cta span { display: inline-block; }
.upgrade-status { min-height: 1.45em; margin-top: 12px; color: var(--faint); font: 400 12px/1.45 var(--sans); text-align: center; text-wrap: balance; }
.upgrade-status.is-error { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes upgradeFade { from { opacity: 0; } }
@keyframes upgradeFadeOut { to { opacity: 0; } }
@keyframes upgradeRise { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes upgradeIn { from { opacity: 0; transform: translateY(5px); } }
@keyframes upgradeBar { from { transform: scaleY(0); } }
.upgrade-modal:not(.hidden) { animation: upgradeFade .18s ease-out both; }
.upgrade-modal.is-leaving { animation: upgradeFadeOut .14s ease-in forwards; pointer-events: none; }
.upgrade-modal:not(.hidden) .upgrade-modal-card { animation: upgradeRise .34s cubic-bezier(.2, .8, .2, 1) both; }
.upgrade-modal:not(.hidden) :is(.upgrade-brand, .upgrade-head h2, .upgrade-lead, .upgrade-compare, .upgrade-buy, .upgrade-foot) { animation: upgradeIn .4s cubic-bezier(.2, .8, .2, 1) both; }
.upgrade-modal:not(.hidden) .upgrade-head h2 { animation-delay: 30ms; }
.upgrade-modal:not(.hidden) .upgrade-lead { animation-delay: 60ms; }
.upgrade-modal:not(.hidden) .upgrade-compare { animation-delay: 90ms; }
.upgrade-modal:not(.hidden) .upgrade-buy { animation-delay: 120ms; }
.upgrade-modal:not(.hidden) .upgrade-foot { animation-delay: 150ms; }
.upgrade-modal:not(.hidden) tr.is-focus th::before { animation: upgradeBar .3s .36s cubic-bezier(.2, .8, .2, 1) both; }
@media (max-width: 640px) {
    .upgrade-modal { padding: 16px; }
    .upgrade-modal-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "head" "compare" "buy" "foot"; padding: 22px 20px 0; border-radius: 18px; }
    .upgrade-modal-close { top: 6px; right: 6px; }
    .upgrade-head { margin-bottom: 18px; padding-right: 0; }
    .upgrade-head h2 { margin-top: 18px; font-size: 24px; line-height: 1.15; letter-spacing: -.018em; }
    .upgrade-lead { margin-top: 8px; font-size: 13.5px; line-height: 1.55; }
    .upgrade-compare tbody th, .upgrade-compare tbody td { padding-top: 7px; padding-bottom: 7px; }
    .upgrade-compare tbody td { padding-right: 10px; }
    .upgrade-compare tr.is-focus th::before { top: 7px; bottom: 7px; left: -11px; }
    .upgrade-buy { margin-top: 18px; }
    .upgrade-plan { padding: 12px 14px 11px; column-gap: 12px; row-gap: 4px; }
    .upgrade-plan-price { font-size: 24px; }
    .upgrade-label { margin-left: 14px; }
    /* The CTA stays reachable on short screens; only the content above it scrolls. */
    .upgrade-foot { position: sticky; bottom: 0; z-index: 2; margin: 0 -20px; padding: 14px 20px 16px; background: var(--bg); transition: box-shadow .2s; }
    .upgrade-status { margin-top: 10px; }
    .upgrade-modal-card.is-scrolling .upgrade-foot { box-shadow: 0 -1px 0 var(--line); }
}
/* Short phones: price and plan come before the comparison, so the choice is never hidden behind the sticky CTA. */
@media (max-width: 640px) and (max-height: 700px) {
    .upgrade-modal-card { grid-template-areas: "head" "buy" "compare" "foot"; }
    .upgrade-buy { margin-top: 0; }
    .upgrade-compare { margin-top: 22px; }
}

@media (max-width: 940px) {
    .project-head { margin-left: auto; }
    .project-title { max-width: 210px; }
    .auth-user-copy { display: none; }
    .auth-user-btn { width: 34px; height: 34px; padding: 3px; justify-content: center; }
    .project-modal-card { width: min(860px, calc(100vw - 32px)); height: min(740px, calc(100svh - 44px)); }
    .export-modal-card { width: min(560px, calc(100vw - 24px)); }
}

@media (max-width: 520px) {
    .project-title { width: 34px; height: 34px; padding: 0; justify-content: center; }
    .project-switch { width: 100%; height: 100%; }
    .project-name, .project-name-input { display: none; }
    .auth-login { max-width: 96px; overflow: hidden; padding-inline: 10px; text-overflow: ellipsis; }
    .project-modal { align-items: stretch; padding: 10px; }
    .project-modal-card { width: 100%; height: calc(100svh - 20px); min-height: 0; border-radius: 18px; }
    .export-modal { align-items: stretch; padding: 10px; }
    .export-modal-card { width: 100%; max-height: none; height: calc(100svh - 20px); border-radius: 18px; }
    .export-modal-head, .export-modal-body, .export-modal-foot { padding-left: 16px; padding-right: 16px; }
    .export-modal-row { grid-template-columns: minmax(0, 1fr); gap: 7px; }
    .export-modal-row > strong { text-align: left; }
    .export-dimension-presets { flex-wrap: wrap; }
    .export-dimension-presets button { flex-basis: calc(33.333% - 3px); }
    .export-dimensions-meta { align-items: flex-start; flex-direction: column; }
    .export-modal-foot { grid-template-columns: minmax(0, 1fr); }
    .export-modal-actions { justify-content: stretch; }
    .export-modal-actions button { flex: 1 1 0; }
    .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; padding-left: 14px; padding-right: 14px; }
    .project-modal-head, .project-modal-tools { padding-left: 14px; padding-right: 14px; }
    .project-modal-tools { gap: 8px; }
    .project-action-menu { max-width: calc(100vw - 24px); }
}

/* Shared by desktop and touch background pickers: one row —
   preview · upload/replace · remove. */
.bg-image-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.bg-image-controls .upload { flex: 1 1 auto; margin: 0; min-width: 0; }

/* Small, discreet icon pill (e.g. Folha style): sits at the row's end,
   no stretching, low height. Compact mode keeps real touch targets. */
.inline-choice > .seg.seg-mini { width: auto; justify-self: end; }
.inline-choice.choice-fit { grid-template-columns: auto minmax(0, 1fr); }
.inline-choice.choice-fit > .seg button { flex: 1 1 auto; padding-left: 6px; padding-right: 6px; }
.inline-choice > .switch { grid-column: 2; justify-self: end; }
/* Lid: label + motion icons need their full width; the slider takes the rest. */
#laptopRows { grid-template-columns: auto minmax(0, 1fr); }
.seg.seg-mini { gap: 2px; padding: 2px; }
.seg.seg-mini button { flex: 0 0 auto; width: 30px; min-height: 22px; height: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.seg.seg-mini .ui-icon { width: 14px; height: 14px; }
html[data-compact] .seg.seg-mini button { width: 44px; height: 36px; }

.product-panel { margin-top: 10px; display: grid; gap: 10px; }
.product-panel.hidden { display: none; }
.product-art-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.product-art-thumb { width: 42px; height: 42px; overflow: hidden; border-radius: 7px; background: var(--control); border: 1px solid var(--line); }
.product-art-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-art-copy { min-width: 0; display: grid; gap: 2px; }
.product-art-copy span { color: var(--text); font: 550 12px var(--sans); }
.product-art-copy output { color: var(--faint); font: 400 10px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-change-btn, .product-actions button { min-height: 28px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--muted); padding: 0 10px; font: 550 11px var(--sans); }
.product-change-btn:hover, .product-actions button:hover { border-color: var(--line-strong); color: var(--text); }
.product-art-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; max-height: 148px; overflow-y: auto; }
.product-art-picker.hidden { display: none; }
.product-art-option { aspect-ratio: 1; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--control); color: var(--muted); font: 550 16px var(--sans); cursor: pointer; }
.product-art-option img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-art-option.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.product-art-option:hover { border-color: var(--line-strong); }
.product-slider { margin: 0; }
.product-color-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 32px; align-items: center; gap: 10px; }
.product-color-row > span { color: var(--muted); font: 550 11px var(--sans); }
.product-swatches { display: flex; gap: 6px; min-width: 0; }
.product-swatches button { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--swatch); box-shadow: inset 0 0 0 2px rgba(0,0,0,.12); }
.product-swatches button.on { outline: 2px solid var(--accent); outline-offset: 2px; }
#productCustomColor { width: 32px; height: 28px; padding: 0; border: 0; background: transparent; }
.product-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }


/* Foco / Tour — area editor (focus/focus-editor.js). Same quiet vocabulary
   as the rest of the inspector: muted label, small mono chips, hairlines. */
.tour-areas[hidden] { display: none; }
.tour-areas-head { margin-bottom: 8px; }
.tour-areas-head label { flex: 0 0 auto; }
.tour-areas-chips { display: flex; align-items: center; gap: 4px; min-width: 0; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.tour-areas-chip { width: 22px; height: 22px; flex: 0 0 auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--muted); font: 400 10px var(--mono); }
.tour-areas-chip:hover:not(.on) { color: var(--text); border-color: var(--muted); }
.tour-areas-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tour-areas-chip.pulse { animation: tour-chip-pulse .6s ease-out; }
@keyframes tour-chip-pulse { 0% { box-shadow: 0 0 0 0 var(--accent-soft); transform: scale(1.12); } 100% { box-shadow: 0 0 0 7px transparent; transform: scale(1); } }
.tour-areas-auto { color: var(--faint); font: 400 10px var(--mono); }
.tour-areas-reset { width: 24px; height: 24px; }
.tour-areas-reset svg { width: 13px; height: 13px; }
.tour-areas-photos { width: max-content; margin-bottom: 8px; }
.tour-areas-photos[hidden] { display: none; }
.tour-areas-photos button { font: 400 10px var(--mono); }
.tour-areas-canvas { display: block; margin: 0 auto; border-radius: 8px; cursor: crosshair; touch-action: none; outline: none; }
.tour-areas-canvas:focus-visible { box-shadow: 0 0 0 1px var(--line-strong); }
.tour-areas-note { margin-top: 6px; color: var(--faint); font: 400 11px/1.4 var(--sans); }

/* Foco (focus/focus-editor.js): a one-line summary under the media shelf
   that expands into the editor; ◎ marks on thumbnails and preset cards. */
.focus-summary { margin-top: 7px; display: flex; align-items: center; gap: 10px; }
.focus-summary .focus-summary-btn { flex: 1 1 auto; min-width: 0; }
.focus-summary.off .focus-summary-btn output, .focus-summary.off .focus-summary-btn .ui-icon { color: var(--faint); text-decoration: line-through; }
.focus-summary[hidden] { display: none; }
.focus-summary .switch { flex: 0 0 auto; }
.focus-summary-btn { width: 100%; min-height: 30px; display: flex; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--pill); background: transparent; color: var(--muted); font: 400 12px var(--sans); text-align: left; }
.focus-summary-btn:hover { border-color: var(--line-strong); color: var(--text); }
.focus-summary-btn .ui-icon { width: 14px; height: 14px; }
.focus-summary-btn output { margin-left: auto; color: var(--faint); font: 400 11px var(--mono); }
.focus-summary.has-areas .focus-summary-btn output { color: var(--text); }
.focus-summary.has-areas .focus-summary-btn .ui-icon { color: var(--accent); }
.focus-summary-chevron { width: 6px; height: 6px; margin: 0 2px 2px 4px; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(45deg); transition: transform .16s; }
.focus-summary.open .focus-summary-chevron { transform: rotate(-135deg); margin-bottom: -2px; }
#focusEditorRow { margin-top: 8px; }
.focus-badge { position: absolute; left: 2px; top: 2px; display: flex; align-items: center; gap: 2px; padding: 1px 4px 1px 3px; border-radius: 6px; background: rgba(10, 11, 13, .6); color: var(--accent); font: 500 9px var(--mono); pointer-events: none; }
.focus-badge .ui-icon { width: 9px; height: 9px; }
.focus-badge b { font-weight: 500; color: var(--text); }
.preset-focus { position: absolute; left: 6px; bottom: 6px; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 8px; background: rgba(10, 11, 13, .42); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); color: rgba(245, 243, 238, .92); pointer-events: none; }
.preset-focus .ui-icon { width: 10px; height: 10px; }
.focus-style-row { margin-top: 8px; }
.focus-style-row[hidden] { display: none; }

/* IMAGE workspace: Motion | Image switch + frame bar (replaces the transport while active). */
.ws-seg { position: absolute; top: 12px; left: 12px; z-index: 6; width: auto; gap: 1px; padding: 2px; background: transparent; }
.ws-seg button { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 28px; min-width: 0; min-height: 24px; padding: 0; color: var(--faint); }
.ws-seg button.on { background: var(--control); color: var(--text); }
.ws-seg .ui-icon { width: 13px; height: 13px; }
.image-bar { position: absolute; left: 20px; right: 20px; bottom: 16px; display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 8px 12px; background: var(--panel); border-radius: 18px; z-index: 6; }
.ib-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ib-row:last-child { flex: 1 1 0; }
.image-bar input[type=range] { flex: 1 1 0; min-width: 40px; }
.image-bar output { font: 400 10px var(--mono); color: var(--faint); min-width: 30px; text-align: right; }
.image-bar .btn-primary { flex: 0 0 auto; white-space: nowrap; min-height: 30px; padding: 0 12px; font-size: 12px; }
#segImgType button { padding-inline: 8px; min-height: 26px; font-size: 11px; }
#segImgType button.on { background: var(--hover); color: var(--text); }
.param-group-head { margin: 10px 0 2px; padding-top: 8px; border-top: 1px solid var(--line, rgba(255,255,255,.08)); color: var(--muted); font: 600 10px/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
/* The first heading follows the Speed row: it gets air above it (no rule, it is the group's own start). */
.param-group-head:first-child { margin-top: 16px; padding-top: 0; border-top: 0; }

/* Export pre-flight: opaque copy of the frame the user was looking at, above the live canvas
   (which keeps rendering for the encoder) and below .export-overlay (scrim + dots). It carries
   the stage background so a transparent project shows its checkerboard, not the encoder frames. */
.export-snapshot { position: absolute; inset: 0; z-index: 6; background: #000; pointer-events: none; }
.vp.is-transparent .export-snapshot { background: repeating-conic-gradient(#2a2c31 0% 25%, #1c1d21 0% 50%) 0 0 / 20px 20px; }
.export-snapshot canvas { display: block; width: 100%; height: 100%; }
/* Stored (not admitted) media: thumbnail only. Locked = confirmed Free plan. */
.ithumb.stored { cursor: pointer; }
.ithumb.locked img { filter: saturate(.7) brightness(.55); }
.ithumb .locked-tag { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: rgba(237,233,224,.92); background: rgba(8,9,10,.28); pointer-events: none; }
.ithumb .locked-tag svg { width: 14px; height: 14px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.8)); }
.ithumb .locked-tag b { font: 600 8px/1 var(--sans); letter-spacing: .06em; color: var(--accent); }
.media-manager-row.is-stored .media-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* CD Jewel Case controls: one distributed row each (label left, text segment right). */
.cd-row { margin-top: 10px; }
.screen-rows { margin-top: 10px; }
.screen-rows .row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.screen-scope { color: var(--faint); font: 400 11px/1.4 var(--sans); }
.cd-row-in { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.cd-row-in > label, .cd-switch > span { color: var(--muted); font: 400 12px/1.4 var(--sans); }
.seg.seg-text { flex: 0 1 auto; }
.seg.seg-text button { flex: 0 0 auto; min-height: 26px; padding: 4px 10px; }
.cd-credit { margin: 10px 0 0; font-size: 11px; }
.cd-credit a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

.cd-color { width: 28px; height: 26px; padding: 0; border: 1px solid var(--line, #3a3a40); border-radius: 6px; background: none; flex: 0 0 auto; cursor: pointer; }
.cd-color.hidden { display: none; }
.timeline-block.audio-block.blocked { opacity: .55; outline: 1px dashed currentColor; }
/* Audio fades: diagonals over the waveform (selected clip: + faded corners + two grab dots with a larger invisible hit area). */
.timeline-block.audio-block .tb-fades { position: absolute; left: 0; right: 0; top: 5px; bottom: 3px; width: 100%; height: calc(100% - 8px); pointer-events: none; overflow: visible; }
.timeline-block.audio-block .tb-fade-line { fill: none; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; opacity: .22; }
.timeline-block.audio-block .tb-fade-area { fill: currentColor; opacity: .06; }
.timeline-block.audio-block.sel .tb-fade-line { opacity: .95; stroke-width: 1.75; }
.timeline-block.audio-block.sel .tb-fade-area { opacity: .16; }
.timeline-block.audio-block.off .tb-fades { opacity: .5; }
.tb-fade { position: absolute; top: 0; bottom: 0; z-index: 2; cursor: ew-resize; touch-action: none; }   /* width / margin / left are set inline per bar; the whole bar height is the touch target */
.tb-fade::after { content: ''; position: absolute; left: 50%; top: 8px; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 1.5px var(--panel, #111); opacity: .9; }
.tb-fade:hover::after, .tb-fade.dragging::after, .tb-fade:focus-visible::after { opacity: 1; transform: scale(1.3); }
.tb-fade:focus-visible { outline: none; }
.timeline-block.audio-block.micro .tb-fade { display: none; }

/* Media thumbnail hover preview (mouse only; see index.html) */
.media-hover-preview { position: fixed; z-index: 10000; display: grid; gap: 5px; max-width: 220px; padding: 6px; border: 1px solid rgba(240,238,232,.12); border-radius: 8px; background: #0d0e0f; box-shadow: 0 10px 28px rgba(0,0,0,.45); pointer-events: none; }
.media-hover-preview[hidden] { display: none; }
.media-hover-preview img { display: block; width: 100%; max-width: 208px; max-height: min(55vh, 300px); object-fit: contain; border-radius: 4px; justify-self: center; }
.media-hover-preview span { color: var(--muted); font: 500 10px var(--mono); text-align: center; }
@media (hover: none), (pointer: coarse) { .media-hover-preview { display: none !important; } }

/* Desktop polish — sidebar cohesion (desktop only; compact keeps its own rules).
   Values come from the measured audit: values 11px vs labels 12px, quiet actions
   at 11px/--faint with 22px hit areas, Items stepper floating next to its label.
   The subject segment's scroll + chevron live with .subject-bar. */
html:not([data-compact]) .row-top output { font-size: 12px; }
html:not([data-compact]) .media-manage-btn { min-height: 28px; margin-right: -8px; padding: 4px 8px; border-radius: var(--pill); color: var(--muted); font-size: 12px; }
html:not([data-compact]) .media-manage-btn:hover { background: var(--control); }
html:not([data-compact]) .fit-label { color: var(--muted); }
html:not([data-compact]) .fit-value { color: var(--text); }
html:not([data-compact]) .collection-items-control { margin-top: 10px; }
html:not([data-compact]) .collection-items-control .items-auto { margin-left: auto; height: 28px; padding: 0 8px; border-radius: var(--pill); }
html:not([data-compact]) .collection-items-control .items-auto:hover:not(.on) { background: var(--control); }
html:not([data-compact]) .collection-items-control:not(.is-fixed) .collection-repeat-label { margin-left: 8px; }
html:not([data-compact]) .collection-items-control.is-fixed .collection-items-stepper { margin-left: auto; }
html:not([data-compact]) .collection-items-stepper { grid-template-columns: 32px minmax(36px, auto) 32px; height: 32px; }
html:not([data-compact]) .collection-items-stepper button { font-size: 18px; }
html:not([data-compact]) .collection-items-stepper output { font-size: 12px; }
html:not([data-compact]) .media-manager-add { min-height: 32px; margin: 4px 0 0 -8px; padding: 6px 10px; color: var(--muted); font-size: 12px; }
html:not([data-compact]) .media-manager-add:hover { background: var(--control); color: var(--text); }
html:not([data-compact]) .media-manager-foot .media-clear-btn { font-size: 12px; }
html:not([data-compact]) .panel .btn-ghost, html:not([data-compact]) #btnRender { padding-top: 9px; padding-bottom: 9px; }

/* Desktop family strip — quiet text tabs (desktop only; compact has its own touch families).
   Natural-width labels on one line; the tab viewport scrolls horizontally and the
   arrow gutters take their own space, so no label ever slides under a control. */
.tabs-strip { display: contents; }
html:not([data-compact]) .tabs-strip { display: flex; align-items: stretch; margin: 0 -12px 16px; box-shadow: inset 0 -1px 0 var(--line); }
html:not([data-compact]) #tabsMotion { position: relative; flex: 1 1 0; min-width: 0; margin: 0; padding: 0 6px; gap: 2px; background: none; border-radius: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; user-select: none; -webkit-user-select: none; }
html:not([data-compact]) #tabsMotion::-webkit-scrollbar { display: none; }
html:not([data-compact]) .tabs-strip.is-scrollable #tabsMotion { cursor: grab; }
html:not([data-compact]) .tabs-strip.is-scrollable #tabsMotion.dragging { cursor: grabbing; }
html:not([data-compact]) .tabs-strip.is-scrollable #tabsMotion button { cursor: inherit; }
html:not([data-compact]) #tabsMotion.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 20px); mask-image: linear-gradient(90deg, transparent 0, #000 20px); }
html:not([data-compact]) #tabsMotion.fade-r { -webkit-mask-image: linear-gradient(270deg, transparent 0, #000 20px); mask-image: linear-gradient(270deg, transparent 0, #000 20px); }
html:not([data-compact]) #tabsMotion.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%); }
html:not([data-compact]) #tabsMotion.dragging button { pointer-events: none; }
html:not([data-compact]) #tabsMotion button { position: relative; flex: 0 0 auto; display: block; min-height: 34px; padding: 0 10px; overflow: visible; border-radius: 6px 6px 0 0; background: none; color: var(--muted); font: 500 13px var(--sans); transition: color .16s; }
html:not([data-compact]) #tabsMotion button:hover:not(.on) { background: none; color: var(--text); }
html:not([data-compact]) #tabsMotion button.on { background: none; color: var(--text); font-weight: 600; }
html:not([data-compact]) #tabsMotion button:focus-visible { outline: 1.5px solid var(--accent); outline-offset: -3px; }
html:not([data-compact]) #tabsMotion button.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
html:not([data-compact]) #tabsMotion .tab-icon { display: none; }
html:not([data-compact]) #tabsMotion .tab-label { display: inline; overflow: visible; text-overflow: clip; }

/* Desktop Media shelf: per-tile remove chip (hover/focus only, 26px hit area, small dark chip) and Clear all under the grid. */
html:not([data-compact]) .ithumb .rm { position: absolute; top: 0; right: 0; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 0 0 0 13px; background: transparent; display: grid; place-items: center; color: rgba(240,238,232,.85); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .12s; }
/* The 26px hit area has a rounded inner corner so it never reaches the tile centre (a click there selects, never removes). */
html:not([data-compact]) .ithumb .rm::before { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 5px; background: rgba(8,9,10,.66); }
html:not([data-compact]) .ithumb .rm svg { position: relative; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; margin: -4px -4px 0 0; }
html:not([data-compact]) .ithumb:hover .rm, html:not([data-compact]) .ithumb:focus-within .rm, html:not([data-compact]) .ithumb .rm:focus-visible { opacity: 1; pointer-events: auto; }
html:not([data-compact]) .ithumb .rm:hover { color: var(--danger); }
html:not([data-compact]) .ithumb .rm:focus-visible { outline: 1px solid var(--accent); outline-offset: -2px; }
html:not([data-compact]) #mediaFoot { margin-top: 2px; padding-top: 4px; min-height: 28px; }
html[data-compact] #mediaFoot { display: none !important; }

/* Items direct manipulation: outline + handles over the canvas (DOM, never in an export). */
.items-edit { position: fixed; z-index: 30; pointer-events: none; }
.items-edit[hidden] { display: none; }
.items-edit-box { position: absolute; inset: 0; border: 1.5px solid var(--accent); border-radius: 6px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.items-edit.is-group .items-edit-box { border-style: dashed; }
.items-edit-handle { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 2px solid var(--accent-ink); border-radius: 50%; background: var(--accent); pointer-events: auto; touch-action: none; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.items-edit-handle::before { content: ''; position: absolute; inset: -11px; }   /* 44px touch target */
.items-edit-handle[data-kind=scale] { cursor: nwse-resize; }
.items-edit [hidden] { display: none !important; }
/* Corner: a small square (size); knob on a stem above (rotate); turn / tilt live in the bar under the outline. */
.items-edit-handle[data-kind=scale] { width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 3px; border-width: 1.5px; background: #f4f1ea; border-color: var(--accent); }
.items-edit-stem { position: absolute; width: 1.5px; margin-left: -.75px; background: var(--accent); opacity: .8; }
.items-edit-handle.is-knob { display: grid; place-items: center; width: 24px; height: 24px; margin: -12px 0 0 -12px; border: 1.5px solid var(--accent); background: rgba(12, 13, 14, .88); color: var(--accent); cursor: grab; }
.items-edit-handle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.items-edit-tools { position: absolute; display: flex; gap: 2px; padding: 3px; transform: translateX(-50%); border-radius: var(--pill); background: rgba(12, 13, 14, .86); box-shadow: 0 2px 10px rgba(0, 0, 0, .4); pointer-events: none; white-space: nowrap; }
.items-edit-handle.is-tool { position: relative; display: flex; align-items: center; gap: 5px; width: auto; height: 28px; margin: 0; padding: 0 10px 0 8px; border: 0; border-radius: var(--pill); background: transparent; color: var(--text); font: 500 11px/1 var(--sans); box-shadow: none; }
.items-edit-handle.is-tool::before { inset: -6px 0; }
.items-edit-handle.is-tool:hover, .items-edit-handle.is-tool.is-active { background: var(--hover, rgba(255, 255, 255, .08)); color: var(--accent); }
.items-edit-handle[data-kind=yaw].is-tool { cursor: ew-resize; }
.items-edit-handle[data-kind=pitch].is-tool { cursor: ns-resize; }
.items-edit-handle[data-kind=roll] { cursor: grab; }
.items-edit.is-dragging .items-edit-stem, .items-edit.is-dragging .items-edit-tools { opacity: 0; }
.items-edit.is-dragging .items-edit-tools:has(.is-active) { opacity: 1; background: transparent; box-shadow: none; }
.items-guide { position: fixed; z-index: 29; pointer-events: none; background: rgba(244, 241, 234, .55); }
.items-guide.is-v { width: 1px; }
.items-guide.is-h { height: 1px; }
.items-guide[hidden] { display: none; }
.items-edit-label { position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, -18px); padding: 3px 8px; border-radius: var(--pill); background: rgba(12, 13, 14, .82); color: var(--text); font: 500 11px/1.4 var(--mono); white-space: nowrap; }
.items-edit-label:empty { display: none; }
.items-edit.is-dragging .items-edit-handle:not(.is-active) { opacity: 0; }   /* only the handle in use stays */
/* Touch: a 28px handle with a 48px target, placed just outside the outline (syncItemsOverlay). */
@media (pointer: coarse) {
    .items-edit-handle[data-kind=scale] { width: 22px; height: 22px; margin: -11px 0 0 -11px; }
    .items-edit-handle.is-knob { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
    .items-edit-handle:not(.is-tool)::before { inset: -10px; }
    .items-edit-handle.is-tool { height: 36px; padding: 0 12px 0 10px; font-size: 12px; }
}
.items-edit-foot { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin: -2px 0 12px; }
.items-edit-foot.hidden, .items-edit-foot .hidden { display: none; }
/* Arrangement: one scrollable strip, every label whole. */
/* Arrangement: one centred pill that is exactly as wide as its options (2–5), scrolling only if the panel is narrower. */
.seg.items-arrange-strip { width: fit-content; max-width: 100%; margin-inline: auto; overflow-x: auto; scrollbar-width: none; justify-content: center; }
.seg.items-arrange-strip::-webkit-scrollbar { display: none; }
.seg.items-arrange-strip button { flex: 0 0 auto; min-width: 72px; padding-inline: 16px; }

/* Background video: contextual rows under the upload row, only while a video background is set. */
.bg-video-controls { margin-bottom: 12px; }
.bg-video-segs { display: flex; gap: 8px; }
.bg-video-segs .seg { flex: 1 1 0; }
.bg-video-segs .seg button { flex: 1 1 0; padding-inline: 4px; }

/* Video Clip: while a clip block is selected the Motion-only sections step aside; only its own controls remain. */
html[data-clip] #secMotion, html[data-clip] #secColl, html[data-clip] #secAdjust { display: none; }
.timeline-block.video-block { background-image: linear-gradient(135deg, rgba(255, 255, 255, .06), transparent 60%); }
.add-seg-menu { position: fixed; z-index: 120; display: grid; width: max-content; min-width: 148px; max-width: min(280px, calc(100vw - 16px)); padding: 6px; gap: 2px;
    background: rgba(31, 33, 34, .99); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 16px 44px rgba(0, 0, 0, .42); }
.add-seg-menu button { display: block; width: 100%; min-height: 34px; text-align: left; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
    font: 500 12px var(--sans); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.add-seg-menu button:hover, .add-seg-menu button:focus-visible { background: rgba(240, 238, 232, .07); color: var(--text); outline: none; }
.add-seg-menu button:disabled { opacity: .4; cursor: default; background: transparent; color: var(--muted); }
.add-seg-menu hr { margin: 2px 6px; border: 0; border-top: 1px solid var(--line); }
html[data-compact] .add-seg-menu button { min-height: 44px; }

/* Background Video / Video Clip: identified media line, grouped rows, start picker (same tokens as the other compact controls). */
.bg-media-line { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.bg-media-line.clip-media { margin-bottom: 12px; }
.bg-media-thumb { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: var(--control); }
.bg-media-text { display: grid; flex: 1 1 auto; min-width: 0; gap: 1px; }
.bg-media-name { overflow: hidden; color: var(--text); font: 500 12px/1.3 var(--sans); text-overflow: ellipsis; white-space: nowrap; }
.bg-media-dur { color: var(--faint); font: 400 11px var(--mono); font-variant-numeric: tabular-nums; }
.bg-image-controls.is-video { margin-bottom: 14px; }
.bg-video-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; margin-bottom: 6px; min-width: 0; }
.bg-video-row .seg { flex: 0 1 200px; }
.bg-video-row .seg button { flex: 1 1 0; padding-inline: 4px; }
.bg-video-label { color: var(--muted); font: 400 12px/1.4 var(--sans); }
.bg-video-start-text { margin-left: auto; color: var(--muted); font: 400 12px var(--sans); font-variant-numeric: tabular-nums; }
.bg-link { padding: 6px 8px; border: 0; border-radius: var(--pill); background: transparent; color: var(--muted); font: 500 12px var(--sans); cursor: pointer; }
.bg-link:hover, .bg-link:focus-visible { background: rgba(240, 238, 232, .07); color: var(--text); outline: none; }
.bg-link-pill { border: 1px solid var(--line-strong); color: var(--text); padding: 4px 11px; }
.bg-link-pill:hover, .bg-link-pill:focus-visible { border-color: rgba(240, 238, 232, .3); }
.bg-link-strong { color: var(--text); }
.bg-start-pick { margin: 0 0 8px; }
.bg-start-track { display: flex; align-items: center; gap: 10px; }
.bg-start-track input { flex: 1 1 auto; min-width: 0; }
.bg-start-pick output { color: var(--text); font: 400 11px var(--mono); font-variant-numeric: tabular-nums; }
.bg-start-actions { display: flex; align-items: center; gap: 2px; margin-top: 6px; }
.bg-start-spacer { flex: 1 1 auto; }
.bg-video-adjust { margin-bottom: 8px; }
.bg-fill-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 34px; margin-bottom: 8px; padding: 0 2px; border: 0; background: transparent; color: var(--muted); font: 400 12px var(--sans); cursor: pointer; }
.bg-fill-toggle:hover, .bg-fill-toggle:focus-visible { color: var(--text); outline: none; }
.bg-fill-toggle[aria-expanded=true] .ui-icon { transform: rotate(180deg); }
.clip-caption { margin-bottom: 6px; }
.clip-duration { margin-top: 6px; }
#secClip .bg-video-row { flex-direction: column; align-items: stretch; gap: 4px; min-height: 0; margin-bottom: 10px; }
#secClip .bg-video-row .seg { flex: none; }
.toast-action { pointer-events: auto; margin-left: 12px; padding: 0; border: 0; background: none; color: var(--text); font: 600 12px/1.5 var(--sans); text-decoration: underline; cursor: pointer; }

/* Grid tab: "Editar grade" over the canvas (DOM, never in an export). Same language as .items-edit. */
.grid-edit { position: fixed; z-index: 30; pointer-events: none; }
.grid-edit.hidden, .grid-edit .hidden { display: none !important; }
.grid-divider { position: absolute; pointer-events: auto; touch-action: none; }
.grid-divider.is-x { width: 44px; margin-left: -22px; cursor: col-resize; }
.grid-divider.is-y { height: 44px; margin-top: -22px; cursor: row-resize; }
.grid-divider-line { position: absolute; background: rgba(244, 241, 234, .55); box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); transition: background .15s; }
.grid-divider.is-x .grid-divider-line { top: 0; bottom: 0; left: 50%; width: 1px; }
.grid-divider.is-y .grid-divider-line { left: 0; right: 0; top: 50%; height: 1px; }
.grid-divider-grip { position: absolute; left: 50%; top: 50%; border-radius: var(--pill); background: var(--accent); border: 1.5px solid var(--accent-ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .45); transform: translate(-50%, -50%); }
.grid-divider.is-x .grid-divider-grip { width: 6px; height: 26px; }
.grid-divider.is-y .grid-divider-grip { width: 26px; height: 6px; }
.grid-divider:hover .grid-divider-line, .grid-divider.is-dragging .grid-divider-line { background: var(--accent); }
.grid-edit-sel { position: absolute; border: 1.5px solid var(--accent); border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
/* Photo drag: the source region dims, the drop region lights up, a lifted copy follows the pointer. */
.grid-edit-src { position: absolute; border-radius: 4px; background: rgba(12, 13, 14, .55); outline: 1.5px dashed rgba(244, 241, 234, .55); outline-offset: -1.5px; }
.grid-edit-target { position: absolute; display: flex; align-items: center; justify-content: center; border-radius: 4px; border: 2.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 24%, rgba(12, 13, 14, .25)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3), 0 0 0 1px rgba(0, 0, 0, .35); transition: left .12s, top .12s, width .12s, height .12s; }
.grid-edit-swap { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.grid-edit-ghost { position: absolute; border-radius: 10px; pointer-events: none; opacity: 0; transform: scale(.82); box-shadow: 0 12px 30px rgba(0, 0, 0, .5), 0 0 0 1.5px var(--accent); transition: transform .18s cubic-bezier(.2, .8, .2, 1), opacity .12s; will-change: transform, left, top; }
.grid-edit-ghost.is-lifted { opacity: .96; transform: scale(1) rotate(-2deg); }
@media (prefers-reduced-motion: reduce) { .grid-edit-ghost, .grid-edit-target { transition: none; } }
.grid-edit-label { position: absolute; transform: translate(-50%, -50%); padding: 3px 8px; border-radius: var(--pill); background: rgba(12, 13, 14, .82); color: var(--text); font: 500 11px/1.4 var(--mono); white-space: nowrap; }
.grid-edit-bar { position: absolute; display: flex; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 8px); align-items: center; gap: 4px; padding: 3px; border-radius: 16px; background: rgba(12, 13, 14, .86); box-shadow: 0 2px 10px rgba(0, 0, 0, .4); pointer-events: auto; white-space: nowrap; }
.grid-edit-bar .seg { margin: 0; }
.grid-edit-btn { height: 26px; padding: 0 10px; border: 0; border-radius: var(--pill); background: transparent; color: var(--text); font: 500 11px/1 var(--sans); cursor: pointer; }
.grid-edit-btn:hover { background: var(--hover, rgba(255, 255, 255, .08)); color: var(--accent); }
.grid-edit-icon { padding: 0 8px; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; }
.grid-edit-icon:disabled { opacity: .35; cursor: default; background: transparent; color: var(--text); }
@media (max-width: 520px) {
  .grid-edit-bar { gap: 1px; }
  .grid-edit-btn { padding: 0 7px; }
  .grid-edit-icon { padding: 0 5px; }
  .grid-edit-bar .seg button { padding: 4px 7px; }
}
.grid-edit-sep { width: 1px; height: 16px; background: rgba(244, 241, 234, .18); flex: 0 0 auto; }
.grid-tools .seg { width: 100%; }
.grid-tools .seg button { flex: 1 1 auto; }
.grid-tools .seg button:disabled { opacity: .4; cursor: default; }
.param-color { width: 28px; height: 26px; padding: 0; border: 1px solid var(--line, #3a3a40); border-radius: 6px; background: none; flex: 0 0 auto; cursor: pointer; }
.grid-edit-bar .seg { flex: 0 0 auto; padding: 0; background: transparent; }
.grid-edit-bar .seg button { flex: 0 0 auto; min-height: 26px; padding: 4px 10px; font-size: 11px; line-height: 18px; }
.grid-edit-bar .seg button:not(.on) { color: var(--text); }
