/* Touch-specific views; desktop sections and styling stay in ui.css. */
.media-touch-actions, .compact-panel, .compact-nav, .compact-edit, .compact-only, .touch-settings { display: none; }
html[data-compact] { --touch-header: calc(48px + env(safe-area-inset-top, 0px)); --touch-nav: calc(56px + env(safe-area-inset-bottom, 0px)); }
html[data-compact] body { height: 100svh; height: min(var(--compact-height, 100dvh), 100dvh); overflow: hidden; overscroll-behavior: none; }
html[data-compact] button { touch-action: manipulation; }
/* Touch header: [Swoovi] [folder] [16:9]  ……  [account] [Export]. Every control is 28px tall
   visually inside a 44px tap row; the pills (aspect, Export) use --pill, the avatar is round. */
html[data-compact] body > header { height: var(--touch-header); padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)); gap: 4px; }
html[data-compact] .brand { flex: 0 0 auto; gap: 6px; }
html[data-compact] .brand h1 { font-size: 14px; }
html[data-compact] .brand h1 em { font-size: 16px; }
html[data-compact] .brand .mark { display: none; }
html[data-compact] .brand-description, html[data-compact] .site-menu, html[data-compact] #langSwitch,
html[data-compact] #projectAdd, html[data-compact] #takesPlanStatus, html[data-compact] #takesAuth { display: none; }
html[data-compact] .codec, html[data-compact] #btnTopLabel { display: none; }
html[data-compact] .compact-only { display: inline; }
html[data-compact] .project-head { flex: 0 1 auto; gap: 2px; margin-left: 2px; }
html[data-compact] .project-title { height: 44px; max-width: 220px; gap: 8px; padding: 0 8px; border: 0; background: transparent; color: var(--muted); }
html[data-compact] .project-title svg { width: 18px; height: 18px; }
html[data-compact] .top-right { gap: 4px; margin-left: auto; }
/* A 28px pill drawn inside a 44px button: keeps the tap row without a heavy shape. */
html[data-compact] :is(.touch-aspect-picker summary, .top-right .btn-primary) { position: relative; isolation: isolate; min-height: 44px; background: transparent; }
html[data-compact] :is(.touch-aspect-picker summary, .top-right .btn-primary)::before { content: ''; position: absolute; inset: 8px 0; z-index: -1; border-radius: var(--pill); }
html[data-compact] .touch-aspect-picker summary::before { background: var(--control); }
html[data-compact] .top-right .btn-primary { gap: 6px; padding: 0 13px; color: var(--text); font: 500 12px var(--sans); letter-spacing: .01em; }
html[data-compact] .top-right .btn-primary::before { background: rgba(240, 238, 232, .075); }
html[data-compact] .top-right .btn-primary:hover { background: transparent; }
html[data-compact] .top-right .btn-primary:hover::before { background: rgba(240, 238, 232, .11); }
html[data-compact] .top-right .btn-primary svg { width: 13px; color: var(--accent); }
html[data-compact] .touch-settings { display: block; position: relative; }
.touch-settings summary { list-style: none; cursor: pointer; }
.touch-settings summary::-webkit-details-marker { display: none; }
.touch-settings > div { position: absolute; right: 0; top: 46px; z-index: 20; background: var(--panel); padding: 8px; border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 8px 24px #0005; }
@media (max-width: 520px) { html[data-compact] .project-title { width: 40px; padding: 0; justify-content: center; } }

/* Account (account-menu.js): the touch header shows the avatar only. Desktop trigger + menu card (.am) live in ui.css. */
html[data-compact] .acct-btn { display: grid; place-items: center; width: 40px; height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--muted); cursor: pointer; }
html[data-compact] .acct-txt { display: none; }
.acct-face { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; background: var(--control); color: var(--muted); }
.acct-face .am-ico { width: 16px; height: 16px; }
.acct-face.auth-avatar { background: #34373a; color: var(--text); font: 650 10px var(--sans); }
.acct-btn[aria-expanded=true] .acct-face { box-shadow: 0 0 0 1.5px rgba(240, 238, 232, .35); }
html[data-compact] main { display: flex; flex-direction: column; height: calc(100% - var(--touch-header)); min-height: 0; }
html[data-compact] :is(.panel, .panel-left, .compact-edit) { display: none !important; }
html[data-compact] .stage { order: 0; flex: 1 1 0; min-height: 132px; height: auto; max-height: none; padding: 0 0 4px; display: grid; grid-template-rows: minmax(0, 1fr) 44px; grid-template-columns: minmax(0, 1fr); }
html[data-compact] .vp { grid-row: 1; align-self: center; justify-self: center; }
html[data-compact] .transport { position: static; grid-row: 2; width: 100%; height: 44px; min-height: 44px; padding: 0 12px; gap: 10px; border-radius: 0; background: transparent; }
html[data-compact] .tbtn { width: 44px; height: 44px; min-width: 44px; }
html[data-compact] #btnPlay { background: transparent; color: var(--text); }
html[data-compact] #btnPlay svg { width: 19px; height: 19px; }
html[data-compact] #btnLoop { display: none; }
html[data-compact] .timecode { font-size: 10px; }
html[data-compact] #scrub { height: 44px; min-width: 24px; }
html[data-compact] #scrub::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6px; }
html[data-compact] .stage.has-timeline { grid-template-rows: minmax(0, 1fr) calc(80px + var(--audio-extra, 0px)); }
html[data-compact] .transport.has-timeline { height: calc(80px + var(--audio-extra, 0px)); grid-auto-rows: var(--audio-row, 32px); grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-rows: 44px 32px; column-gap: 10px; row-gap: 0; --tl-inset: 8px; }
html[data-compact] .transport.has-timeline > .timeline-tools { grid-area: 2 / 3; }
html[data-compact] .timeline-tools .tbtn { width: 30px; height: 32px; min-width: 30px; }
html[data-compact] .timeline-tools #btnAddMotion { margin-left: 2px; }
html[data-compact] .stage.has-timeline.has-text-track { padding-bottom: 4px; grid-template-rows: minmax(0, 1fr) calc(80px + var(--text-row, 32px) + var(--audio-extra, 0px)); }
html[data-compact] .transport.has-timeline.has-text-track { height: calc(80px + var(--text-row, 32px) + var(--audio-extra, 0px)); grid-template-rows: 44px 32px var(--text-row, 32px); }
html[data-compact] .transport.has-timeline > #btnAddText { grid-area: 3 / 3; width: 30px; height: 32px; min-width: 30px; }
html[data-compact] .transport.has-timeline > #textTrackLabel { height: 32px; }
html[data-compact] .stage.has-timeline.has-image-track { padding-bottom: 4px; grid-template-rows: minmax(0, 1fr) calc(80px + var(--image-row, 32px) + var(--audio-extra, 0px)); }
html[data-compact] .transport.has-timeline.has-image-track { height: calc(80px + var(--image-row, 32px) + var(--audio-extra, 0px)); grid-template-rows: 44px 32px var(--image-row, 32px); }
html[data-compact] .stage.has-timeline.has-text-track.has-image-track { grid-template-rows: minmax(0, 1fr) calc(80px + var(--text-row, 32px) + var(--image-row, 32px) + var(--audio-extra, 0px)); }
html[data-compact] .transport.has-timeline.has-text-track.has-image-track { height: calc(80px + var(--text-row, 32px) + var(--image-row, 32px) + var(--audio-extra, 0px)); grid-template-rows: 44px 32px var(--text-row, 32px) var(--image-row, 32px); }
html[data-compact] .transport.has-timeline > #btnAddImage { grid-area: 3 / 3; width: 30px; height: 32px; min-width: 30px; }
html[data-compact] .transport.has-timeline.has-text-track > #btnAddImage { grid-row: 4; }
html[data-compact] .transport.has-timeline > #imageTrackLabel { height: 32px; }
html[data-compact] .transport.has-timeline > #btnAddAudio { grid-area: var(--audio-r, 3) / 3; width: 30px; height: 32px; min-width: 30px; }
html[data-compact] .transport.has-timeline > #audioTrackLabel { height: 32px; }
html[data-compact] .timeline-block.text-block { min-width: 28px; padding: 0 16px; }
html[data-compact] .tb-handle { width: 14px; }
html[data-compact] .tb-handle::after { left: 6px; }
/* Short blocks (.narrow, < 92px; a 2s text/image in a long timeline is ~28px). Touch hit-testing is fuzzy: with a handle on each edge
   every touch on a 28px block lands on a handle, so the body can never be grabbed. The block keeps its real time width; only the hit
   areas change. Unselected: the handles are inert and the whole block is the body (tap selects, drag moves). Selected: the body is still
   the whole block and the handles sit just outside its edges, so resize stays one touch away without competing with the body.
   Where it touches a neighbour the selected block's handle wins (resize must stay reachable); the neighbour is still selected from its centre. */
html[data-compact] .timeline-block.text-block.narrow { padding-inline: 0; }
html[data-compact] .timeline-block.text-block.narrow:not(.sel) .tb-handle { pointer-events: none; }
html[data-compact] .timeline-block.text-block.narrow.sel { overflow: visible; }
html[data-compact] .timeline-block.text-block.narrow.sel .tb-handle { width: 10px; }
html[data-compact] .timeline-block.text-block.narrow.sel .tb-handle[data-edge="start"] { left: -7px; }
html[data-compact] .timeline-block.text-block.narrow.sel .tb-handle[data-edge="end"] { right: -7px; }
html[data-compact] .timeline-block.text-block.narrow.sel .tb-handle::after { left: 4px; }
html[data-compact] .compact-panel { order: 1; display: flex; flex-direction: column; flex: 0 0 auto; min-height: 0; max-height: min(260px, calc(var(--compact-height, 100dvh) - var(--touch-header) - var(--touch-nav) - 132px)); background: var(--panel); border-top: 1px solid var(--line); overflow: hidden; }
html[data-compact] .compact-panel[data-tier=catalog] { height: min(60dvh, calc(var(--compact-height, 100dvh) - var(--touch-header) - var(--touch-nav) - 132px)); max-height: none; }
html[data-compact] .compact-panel[data-tier=normal][data-detail]:not([data-detail=""]) { max-height: calc(var(--compact-height, 100dvh) - var(--touch-header) - var(--touch-nav) - 132px); }
html[data-compact] .compact-panel[data-tier=mini] { height: 72px; }
.compact-panel-head { flex: 0 0 44px; display: flex; align-items: center; gap: 4px; padding: 0 10px 0 16px; min-height: 44px; }
.compact-panel-head button { min-height: 44px; border: 0; background: transparent; color: var(--muted); }
.touch-title { font: 600 12px var(--sans); text-align: left; color: var(--text) !important; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.touch-close { flex: 0 0 44px; font-size: 18px; }
#compactHeadActions { display: flex; align-items: center; gap: 2px; }
#touchEditor { min-height: 0; padding: 0 16px 10px; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
#touchEditor[hidden], #compactExportContent[hidden], #compactExportActions[hidden] { display: none !important; }
#touchEditor button, #touchEditor select, #touchEditor input, #touchEditor textarea { font-family: var(--sans); }
#touchEditor button { min-width: 44px; min-height: 44px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 12px; flex-shrink: 0; }
#touchEditor button:hover { background: var(--hover); color: var(--text); }
#touchEditor button[aria-pressed=true] { color: var(--accent); background: var(--accent-soft); }
#touchEditor .touch-link, .compact-panel-head .touch-link { padding-inline: 8px; font-size: 11px; color: var(--muted); }
/* The main text box gets a real filled field — it's the primary editor.
   Number/select tweaks (weight, blend, line/letter spacing, size, the 3D
   clip picker…) don't need the same weight; font-size stays 16px either
   way (iOS zooms on focus below that), only the box around it differs —
   a thin outline like the app's other quiet chips (.mini-fit-chip,
   .tour-areas-chip), not a big filled block. */
#touchEditor textarea { min-height: 44px; min-width: 0; background: var(--control); border: 0; color: var(--text); font-size: 16px; border-radius: 8px; padding: 6px 8px; }
#touchEditor :is(input[type=number], select) { min-height: 36px; min-width: 0; background: transparent; border: 1px solid var(--line-strong); color: var(--text); font-size: 16px; border-radius: 8px; padding: 2px 6px; }
#touchEditor textarea { width: 100%; height: 44px; resize: none; display: block; margin: 0 0 6px; line-height: 30px; }
#touchEditor input[type=color] { width: 44px; height: 44px; flex: 0 0 44px; padding: 10px; border: 0; background: transparent; border-radius: 50%; }
#touchEditor input[type=color]::-webkit-color-swatch { border-radius: 50%; }
#touchEditor input[type=checkbox] { width: 44px; height: 44px; accent-color: var(--accent); }
.touch-inline, .touch-action-row { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.touch-inline > span { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.touch-inline > label { min-width: 0; font-size: 12px; color: var(--muted); }
.touch-inline select { display: block; width: 100%; }
.touch-action-row { flex-wrap: wrap; }
#touchEditor .touch-danger { color: var(--danger); }
.touch-advanced { display: flex; flex-direction: column; gap: 0; }
.touch-advanced > button { align-self: flex-start; }
.touch-strip, .touch-media-strip { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; overscroll-behavior-x: contain; }
.touch-strip::-webkit-scrollbar, .touch-media-strip::-webkit-scrollbar, .touch-presets::-webkit-scrollbar, .touch-families::-webkit-scrollbar { display: none; }
.touch-media-strip { height: 58px; margin: 0 -3px 3px; padding: 3px; }
#touchEditor .touch-media, #touchEditor .touch-add { position: relative; width: 52px; height: 52px; flex: 0 0 52px; overflow: hidden; border-radius: 7px; }
#touchEditor .touch-add { background: var(--control); color: var(--text); font-size: 24px; font-weight: 300; }
/* Empty project: one wide, obvious upload target instead of a lone + tile. */
#touchEditor .touch-add.touch-add-empty { height: 48px; font: 500 13px var(--sans); }
#touchEditor .touch-add-empty .ui-icon { width: 18px; height: 18px; flex: none; }
.touch-media span, .touch-media img, .touch-media canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
#touchEditor .touch-media[aria-pressed=true] { outline: 2px solid var(--accent); outline-offset: 1px; }
.touch-media small { position: absolute; bottom: 3px; left: 3px; font: 500 8px var(--mono); color: var(--text); background: #000b; padding: 2px; }
/* Delete lives on the thumbnail itself — just the glyph, no filled
   badge behind it (a solid circle read as too heavy at this size); a
   text-shadow keeps it legible over any photo. */
.touch-empty { color: var(--faint); font-size: 12px; padding-inline: 8px; white-space: nowrap; }
.touch-media-manage { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.touch-collection-row { min-height: 40px; }
.touch-collection-row output { min-width: 22px; text-align: center; color: var(--text); font: 400 12px var(--mono); }
.touch-collection-repeat { margin-left: auto; }
#touchEditor .touch-items-auto { min-width: 0; padding: 0 6px; background: none; color: var(--faint); font: 400 12px var(--sans); }
#touchEditor .touch-items-auto:hover { background: none; color: var(--text); }
#touchEditor .touch-items-auto[aria-pressed=true] { background: none; color: var(--accent); }
.touch-items-row.is-fixed output { color: var(--faint); min-width: 0; }
.touch-media-manage-list { display: flex; flex-direction: column; gap: 0; max-height: min(44svh, 360px); overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.touch-media-row { display: grid; grid-template-columns: 18px 40px minmax(0,1fr) 38px 38px 38px 38px; align-items: center; gap: 6px; min-height: 48px; border-top: 1px solid rgba(240,238,232,.055); color: var(--muted); }
.touch-media-row.is-over { background: var(--hover); }
.touch-media-row.is-dragging { opacity: .45; }
.touch-media-row.is-hidden .touch-media-row-thumb span:first-child,
.touch-media-row.is-hidden .touch-media-row-thumb img,
.touch-media-row.is-hidden .touch-media-row-thumb canvas { filter: saturate(.45) brightness(.62); opacity: .4; }
.touch-media-grip { color: var(--faint); font: 600 13px/1 var(--mono); letter-spacing: -4px; cursor: grab; }
#touchEditor .touch-media-row-thumb { position: relative; width: 40px; height: 40px; min-width: 40px; min-height: 40px; overflow: hidden; padding: 0; border-radius: 7px; background: #0d0e0f; color: var(--faint); font: 600 9px var(--mono); }
.touch-media-row-thumb img, .touch-media-row-thumb canvas, .touch-media-row-thumb span:first-child { display: block; width: 100%; height: 100%; object-fit: cover; }
/* The thumbnail is part of the draggable row: its <img>/<canvas> must not be the touch target (native image drag / long-press callout), so a press on it starts the row's reorder like the rest of the row. Taps still hit the button. */
.touch-media-row-thumb > *, .touch-media-row-thumb img, .touch-media-row-thumb canvas { pointer-events: none; -webkit-user-drag: none; -webkit-touch-callout: none; user-select: none; }
.touch-media-row-thumb small { position: absolute; right: 3px; top: 3px; font: 650 7px var(--mono); background: #000b; color: var(--text); padding: 1px 2px; border-radius: 3px; }
#touchEditor .touch-media-row-index { min-width: 0; min-height: 38px; justify-content: flex-start; padding: 0; color: var(--faint); text-align: left; font: 500 11px var(--mono); }
#touchEditor .touch-media-icon { min-width: 38px; min-height: 38px; border-radius: 50%; }
.touch-manage-add { min-height: 40px; justify-content: flex-start; gap: 6px; padding-inline: 2px; color: var(--faint); font-size: 12px; }
.touch-manage-add .ui-icon { width: 15px; height: 15px; }
/* Media Frames V1 — Frame is an action on the row; the editor opens under the item only when asked. */
.touch-media-row .touch-media-icon.is-on { position: relative; color: var(--accent); }
.touch-media-row .touch-media-icon.is-on::after { content: ''; position: absolute; top: 8px; right: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.touch-frame { display: grid; gap: 0; padding: 0 0 2px 24px; border-top: 1px solid rgba(240,238,232,.035); }
.touch-frame-head { display: flex; align-items: center; gap: 8px; min-height: 34px; min-width: 0; }
.touch-frame-thumb { flex: none; width: 28px; height: 28px; margin-right: auto; border-radius: 5px; background: #0d0e0f; }
#touchEditor .touch-frame-head button { flex: none; min-height: 34px; padding: 0 6px; border: 0; background: transparent; color: var(--faint); font: 500 11px var(--sans); }
#touchEditor .touch-frame-head .touch-danger { color: var(--danger); }
#touchEditor .touch-range.touch-frame-range { display: grid; grid-template-columns: 34px minmax(0, 1fr) 42px 34px; gap: 6px; min-height: 34px; flex: none; }
#touchEditor .touch-range.touch-frame-range input { height: 34px; }
#touchEditor .touch-range.touch-hold-range { display: grid; grid-template-columns: auto minmax(0, 1fr) 42px 38px; gap: 6px; }
#touchEditor .touch-hold-range button[hidden-slot] { visibility: hidden; }
#touchEditor .touch-frame-range .touch-media-icon { width: 34px; min-width: 34px; height: 34px; min-height: 34px; }
.touch-media-manage-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 42px; color: var(--faint); font-size: 11px; }
/* Same pill-in-a-padded-track recipe as .seg (below): inset padding so
   the selected fill floats as a smaller capsule instead of a block
   flush with the track's own (already rounded) edges. */
.touch-segment { display: flex; gap: 2px; padding: 3px; border-radius: var(--pill); background: var(--control); }
#touchEditor .touch-segment button { flex: 0 0 auto; min-width: 0; padding-inline: 14px; font-size: 12px; white-space: nowrap; }
#touchEditor .touch-segment button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); }
/* Every chip() button (Proporção, the subject segment, …) — rounded,
   not the 8px generic-button corners, so the selected fill reads as a
   pill rather than a squared-off block. */
#touchEditor .touch-chip { border-radius: var(--pill); }
.touch-ratios { gap: 10px; }
#touchEditor .touch-ratios button { font: 500 10px var(--mono); }
.touch-families { display: flex; gap: 3px; align-items: center; overflow-x: auto; scrollbar-width: none; margin-bottom: 6px; }
#touchEditor .touch-families button { display: flex; align-items: center; justify-content: center; gap: 6px; flex: 0 0 44px; padding: 0 10px; }
#touchEditor .touch-families button[aria-pressed=true] { flex: 1 0 auto; }
.touch-families button span { display: none; white-space: nowrap; }
.touch-families button[aria-pressed=true] span { display: inline; }
.touch-families svg { width: 16px; height: 16px; }
.touch-presets { display: flex; overflow-x: auto; gap: 8px; scrollbar-width: none; overscroll-behavior-x: contain; padding: 2px; margin: -2px; }
#touchEditor .touch-preset { flex: 0 0 116px; min-width: 0; padding: 3px; text-align: left; border-radius: 8px; }
#touchEditor .touch-preset[aria-pressed=true] { box-shadow: inset 0 0 0 1px var(--accent); }
/* Square, like the real 1:1 preset renders actually are (see the grid/
   overlay variants below) — a flat 40px strip was cropping most of the
   image away. */
.touch-preset-image { display: block; height: auto; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: var(--stage); }
.touch-preset-image .preset-media { height: 100%; aspect-ratio: auto; background: transparent; }
.touch-preset-image :is(img,canvas) { width: 100%; height: 100%; object-fit: cover; }
.touch-preset-name { display: block; font-size: 10px; padding: 4px 2px 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.touch-preset-image .preset-loop { right: 4px; bottom: 4px; transform: scale(.85); transform-origin: bottom right; }
.touch-presets.touch-preset-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); overflow: visible; gap: 10px; }
.touch-preset-grid .touch-preset-image { height: auto; aspect-ratio: 16 / 9; }
.touch-presets:not(.touch-preset-grid) .touch-preset-name { padding-top: 3px; }
.touch-preset-grid .touch-preset-name { font-size: 12px; padding: 6px 4px 4px; }
.touch-take-controls, .touch-background-controls { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.touch-range { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; flex: 1; color: var(--muted); font-size: 12px; }
.touch-range > span { white-space: nowrap; }
#touchEditor .touch-range input { height: 44px; min-width: 20px; width: 100%; }
#touchEditor input[type=range]::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -8px; }
#touchEditor input[type=range]::-moz-range-thumb { width: 20px; height: 20px; }
.touch-range output { min-width: 32px; text-align: right; font: 400 10px var(--mono); }
.touch-swatches { display: flex; align-items: center; gap: 6px; padding: 3px 3px 4px; margin: 2px -3px 0; overflow-x: auto; scrollbar-width: none; }
.touch-swatches::-webkit-scrollbar { display: none; }
/* Background presets: a rounded rectangle (52x40 art, 56x44 touch) so Radiant / Mesh / Flow can be told apart. */
#touchEditor .touch-swatches > button { flex: 0 0 auto; width: 56px; height: 44px; padding: 2px; border-radius: 10px; }
.touch-swatches button > span { display: block; width: 100%; height: 100%; border-radius: 8px; overflow: hidden; }
.touch-swatches canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
#touchEditor .touch-swatches button[aria-pressed=true] { box-shadow: 0 0 0 2px var(--accent); }
#touchEditor .touch-bg-families .seg { margin-left: 0; flex: 1 1 auto; }
#touchEditor .touch-bg-families .seg button { flex: 1 1 0; padding-inline: 4px; }
.touch-palette { display: flex; gap: 12px 20px; flex-wrap: wrap; justify-content: center; }
.touch-palette label { display: flex; flex-direction: column; align-items: center; min-width: 44px; text-align: center; font-size: 12px; color: var(--muted); }
.touch-text-tools { display: flex; gap: 4px; align-items: center; justify-content: center; }
/* These read as plain floating words otherwise — a soft pill background
   makes it obvious they're tappable, same discreet-chip language as the
   rest of the panel. Smaller than the generic 44px button (there's one
   fewer of them now, but four pills at full touch-target size still
   don't fit the row) — the color swatch is already its own round control. */
#touchEditor .touch-text-tools button { min-height: 34px; background: var(--control); border-radius: var(--pill); padding-inline: 9px; }
#touchEditor .touch-text-tools button:disabled { opacity: .4; }
/* Text transform group: the 3×3 position grid with rotation beside it (one row, like the desktop panel). */
.touch-transform { display: flex; align-items: center; gap: 14px; min-width: 0; }
.touch-position { display: grid; grid-template-columns: repeat(3, 30px); gap: 3px; flex: 0 0 auto; }
#touchEditor .touch-position .touch-chip { width: 30px; height: 30px; min-width: 0; min-height: 0; padding: 0; display: grid; place-items: center; border-radius: 9px; background: var(--control); color: var(--faint); }
#touchEditor .touch-position .touch-chip::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
#touchEditor .touch-position .touch-chip[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); }
/* Two ranges on one row (line height + letter spacing). */
.touch-pair { display: flex; gap: 14px; min-width: 0; }
.touch-pair .touch-range { flex: 1 1 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'label value' 'slider slider'; gap: 0 6px; }
.touch-pair .touch-range > span { grid-area: label; overflow: hidden; text-overflow: ellipsis; }
.touch-pair .touch-range output { grid-area: value; }
#touchEditor .touch-pair .touch-range input { grid-area: slider; height: 32px; }
.touch-transform .touch-range { min-width: 0; }
.touch-fonts { display: flex; flex-direction: column; }
#touchEditor .touch-mini-summary { display: block; width: 100%; text-align: left; min-height: 32px; padding: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.touch-overlay { position: fixed; inset: var(--touch-header) 0 var(--touch-nav); z-index: 80; pointer-events: auto; }
.touch-overlay[hidden] { display: none; }
.touch-overlay-scrim { position: absolute; inset: 0; background: #0008; }
.touch-overlay-card { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; background: var(--panel); box-shadow: 0 -12px 36px #0008; }
.touch-overlay-head { flex: 0 0 52px; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.touch-overlay-head strong { flex: 1; min-width: 0; color: var(--text); font: 600 13px var(--sans); }
.touch-overlay-close { width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 24px; }
.touch-overlay-body { min-height: 0; flex: 1; overflow-y: auto; padding: 12px 16px 24px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.touch-overlay button { min-width: 44px; min-height: 44px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font: 500 12px var(--sans); }
.touch-overlay button:hover, .touch-overlay button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
.touch-overlay .touch-families { margin-bottom: 14px; }
.touch-overlay .touch-families button { display: flex; align-items: center; justify-content: center; gap: 6px; flex: 0 0 44px; padding: 0 10px; }
.touch-overlay .touch-families button[aria-pressed=true] { flex: 1 0 auto; }
.touch-overlay .touch-families button span { display: none; white-space: nowrap; }
.touch-overlay .touch-families button[aria-pressed=true] span { display: inline; }
.touch-overlay .touch-preset { min-width: 0; padding: 3px; text-align: left; }
.touch-overlay .touch-preset-image { height: auto; aspect-ratio: 16 / 9; }
.touch-overlay .touch-preset-name { font-size: 10px; padding: 6px 2px 2px; }
/* Small square cards, like a native picker grid — 2 giant columns read
   as a desktop layout stretched onto a phone. */
.touch-overlay .touch-preset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible; }
html[data-compact] .compact-nav { order: 2; flex: 0 0 var(--touch-nav); height: var(--touch-nav); display: flex; align-items: flex-start; padding: 0 max(12px,env(safe-area-inset-right,0px)) env(safe-area-inset-bottom,0px) max(12px,env(safe-area-inset-left,0px)); background: var(--panel); border-top: 1px solid var(--line); }
.compact-nav button { display: flex; flex: 1; align-items: center; justify-content: center; flex-direction: column; gap: 3px; height: 56px; min-width: 44px; border: 0; background: transparent; color: var(--faint); font: 500 10px var(--sans); }
.compact-nav button svg { width: 19px; height: 19px; }
.compact-nav button[aria-pressed=true] { color: var(--accent); }
.compact-nav button:focus-visible { outline-offset: -3px; }
html[data-compact] #compactExportContent { flex: 1; overflow: auto; min-height: 0; }
html[data-compact] #compactExportContent .sec { border: 0; padding: 8px 16px; }
html[data-compact] #compactExportContent .sec-head { display: none; }
html[data-compact] #compactExportContent :is(.seg button,.mini-aspect-icons button) { min-height: 44px; }
html[data-compact] #compactExportActions { padding: 10px 16px; border-top: 1px solid var(--line); }
html[data-compact] #compactExportActions #btnRender { margin: 0; min-height: 44px; }
html[data-compact] #toasts { left: 16px; bottom: calc(var(--touch-nav) + 12px); }
body.is-exporting :is(#panelScroll,#panelLeft,#touchEditor,#compactNav,#compactPreview,#compactEdit,#btnPlay,#scrub,#btnLoop,#langSwitch,#segFormat,#imageOpts,.touch-settings,#accountBtn) { pointer-events: none; opacity: .5; }

@media (min-width: 900px) and (orientation: landscape), (min-width: 640px) and (max-height: 500px) {
    html[data-compact] main { display: grid; grid-template-columns: minmax(0,1fr) 288px; grid-template-rows: minmax(0,1fr) var(--touch-nav); grid-template-areas: 'stage tools' 'stage nav'; }
    html[data-compact] .stage { grid-area: stage; }
    html[data-compact] .compact-panel { grid-area: tools; max-height: none; height: auto; border-top: 0; border-left: 1px solid var(--line); }
    html[data-compact] .compact-panel[data-tier=catalog], html[data-compact] .compact-panel[data-tier=mini] { height: auto; }
    html[data-compact] .compact-nav { grid-area: nav; border-left: 1px solid var(--line); padding-inline: 4px; }
    html[data-compact] #touchEditor { padding-inline: 12px; }
    html[data-compact] .touch-text-tools { flex-wrap: wrap; }
    html[data-compact] .touch-families { gap: 0; }
    html[data-compact] .touch-families button { padding-inline: 4px; }
    html[data-compact] .touch-take-controls { flex-wrap: wrap; }
    html[data-compact] .touch-take-controls .touch-range { flex-basis: 100%; }
    html[data-compact] .touch-overlay-scrim { right: 288px; }
    html[data-compact] .touch-overlay-card { left: auto; width: 288px; }
}
@media (min-width: 640px) and (max-width: 899px) and (max-height: 500px) {
    html[data-compact] main { grid-template-columns: minmax(0,1fr) 256px; }
    html[data-compact] .touch-overlay-scrim { right: 256px; }
    html[data-compact] .touch-overlay-card { width: 256px; }
}
@media (max-width: 360px) {
    html[data-compact] .top-right .btn-primary { padding-inline: 12px; }
    html[data-compact] .top-right .btn-primary svg { display: none; }
    #touchEditor { padding-inline: 12px; }
    #touchEditor .touch-text-tools { gap: 0; }
    #touchEditor .touch-families { gap: 0; }
    #touchEditor .touch-families button { padding-inline: 5px; }
}
/* Motion panel in portrait: Duration/Speed were under the nav and the sliders ~50px wide. Wrap Duration onto its own full-width row
   (Zoom + "Mais" share the first) and let the panel grow only while the stage still holds a whole 16:9 preview + transport. */
@media (orientation: portrait), (max-width: 639px) {
    html[data-compact] .compact-panel { --panel-room: calc(var(--compact-height, 100dvh) - var(--touch-header) - var(--touch-nav)); max-height: max(min(260px, calc(var(--panel-room) - 132px)), min(var(--panel-grow, 344px), calc(var(--panel-room) - (100vw - 16px) * .5625 - 90px))); }
}
@media (max-width: 639px) and (orientation: portrait) {
    html[data-compact] .touch-take-controls { flex-wrap: wrap; }
    html[data-compact] .touch-take-controls .touch-range { flex-basis: 100%; }
}
@media (orientation: portrait), (max-width: 639px) {
    html[data-compact][data-touch-keyboard=true] .stage { min-height: 104px; }
    html[data-compact][data-touch-keyboard=true] .compact-panel { max-height: 130px; }
    html[data-compact][data-touch-keyboard=true] #touchEditor { padding-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) { #touchEditor *, .compact-nav * { transition: none !important; animation: none !important; } }

html[data-compact] .compact-panel[data-tier=mini] .compact-panel-head { flex: 1; }
html[data-compact] .compact-panel[data-tier=mini] #touchEditor { display: none; }

/* Foco (Mídia → Foco): the exact desktop components (.switch, .seg,
   .tour-areas-chip — see #focusSwitch/#focusStyle in index.html and
   focus-editor.js), just touch-sized. #touchEditor's generic button reset
   above (min-width/height, border:0, border-radius:8px, background) wins
   per-property over a plain desktop class on specificity (id+element beats
   class+element), so every property it touches has to be restated here —
   not just sizing — or the pill/border/fill silently reverts to the flat
   compact default. */
#touchEditor .tour-areas { margin-top: 0; }
/* Fit (Cover/Contain), now inside Foco — the same single cycling chip as
   the desktop's #segFit, just centered in a touch-sized box. */
.touch-fit-line { display: flex; align-items: baseline; justify-content: space-between; min-height: 30px; padding-top: 2px; font: 400 12px/1.4 var(--sans); }
.touch-fit-line > span { color: var(--faint); }
#touchEditor .touch-fit-value { min-height: 30px; padding: 0 0 0 12px; border: 0; background: transparent; color: var(--muted); font: inherit; }
/* Foco entry point, in the panel head next to "Mais" (compact-ui.js
   headActions) — not #touchEditor, so it's scoped separately. */
.compact-panel-head .touch-focus-head { display: flex; align-items: center; gap: 3px; }
.compact-panel-head .touch-focus-head .ui-icon { width: 13px; height: 13px; }
.compact-panel-head .touch-focus-head[aria-pressed=false] { color: var(--faint); }

/* Maiúsculas sits right next to alignment — same row, pushed to the
   end (there's room; no need for its own separate line). */
.touch-uppercase { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.touch-uppercase span { color: var(--muted); font-size: 12px; }
.touch-uppercase .switch { margin-left: 0; }

#touchEditor .switch { min-width: 0; min-height: 0; width: 44px; height: 26px; padding: 0; margin-left: auto; border: 1px solid var(--line-strong); border-radius: var(--pill); background: var(--control); }
#touchEditor .switch.on { background: var(--accent); border-color: transparent; }
#touchEditor .switch::after { width: 18px; height: 18px; }
#touchEditor .switch.on::after { transform: translateX(18px); }

#touchEditor .seg { margin-left: auto; width: auto; }
#touchEditor .seg button { min-width: 0; min-height: 36px; border: 0; border-radius: var(--pill); background: transparent; color: var(--muted); font-size: 12px; padding-inline: 14px; }
#touchEditor .seg button.on { background: var(--accent); color: var(--accent-ink); }
/* Speed: 6 equal tracks that always fit the row (360 phone, side-panel tablet); the
   label keeps its size, the seg takes what is left and the buttons shrink, never spill. */
#touchEditor .touch-speed-row > span { font-size: 11px; }
#touchEditor .touch-speed-row .seg { flex: 1 1 0; min-width: 0; max-width: 312px; margin-left: auto; gap: 1px; padding: 2px; }
#touchEditor .touch-speed-row .seg button { flex: 1 1 0; padding-inline: 0; font-size: 10.5px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; overflow: hidden; }
#touchEditor .touch-items-row .seg button { padding-inline: 10px; white-space: nowrap; }

#touchEditor .tour-areas-chip { min-width: 0; min-height: 0; width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; }
#touchEditor .tour-areas-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
#touchEditor .tour-areas-reset { min-width: 0; min-height: 0; width: 32px; height: 32px; border: 0; }
#touchEditor .tour-areas-photos button { min-width: 0; min-height: 32px; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--muted); }
#touchEditor .tour-areas-photos button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Canvas aspect popover in the top bar (S.aspectRatio): a quiet pill with a chevron, so it reads as a control. */
.touch-aspect-picker { margin-left: 2px; }
.touch-aspect-picker summary { display: inline-flex; align-items: center; gap: 5px; padding: 0 10px 0 11px; color: var(--muted); font: 500 11px var(--mono); }
.touch-aspect-picker summary::after { content: ''; width: 6px; height: 6px; margin-top: -3px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); opacity: .65; }
.touch-aspect-picker[open] summary { color: var(--text); }
/* The popover is wider than the room left of the summary on a phone: anchor it to the viewport, not the button. */
.touch-aspect-picker > div { position: fixed; left: 8px; right: auto; top: calc(var(--touch-header) - 2px); max-width: calc(100vw - 16px); }
.touch-aspect-picker .mini-aspect-icons button { min-height: 44px; padding: 6px 4px; }
.touch-aspect-picker .mini-aspect-box { width: 26px; height: 26px; }
/* IMAGE workspace: the bar takes over the transport's grid row (no extra page height). */
html[data-compact] .stage.is-image { grid-template-rows: minmax(0, 1fr) 72px; }
html[data-compact] .ws-seg { top: 6px; left: 8px; }
html[data-compact] .image-bar { position: static; grid-row: 2; flex-direction: column; align-items: stretch; justify-content: center; gap: 4px; width: 100%; height: 72px; min-height: 72px; padding: 0 12px; border-radius: 0; background: transparent; }
html[data-compact] .ib-row { justify-content: space-between; }
html[data-compact] .ib-row:last-child { flex: 0 0 auto; }
html[data-compact] #segImgType button { min-height: 30px; }
html[data-compact] .ws-seg button { width: 36px; min-height: 32px; }
html[data-compact] #btnDownloadImage { min-height: 34px; padding: 0 12px; font-size: 12px; background: var(--accent); color: var(--accent-ink); }
html[data-compact] .image-bar input[type=range] { height: 34px; }
.touch-group-head { margin: 6px 0 0; padding-top: 6px; 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; }
.touch-group-head:first-child { margin-top: 14px; padding-top: 0; border-top: 0; }

/* Image overlays (touch): thumbs + add + replace / delete in one row, the three sliders in the next. */
.touch-image-strip { display: flex; align-items: center; gap: 6px; min-height: 48px; overflow-x: auto; }
#touchEditor .touch-image-thumb { flex: 0 0 auto; width: 40px; height: 40px; padding: 3px; border-radius: 10px; background: var(--control); }
#touchEditor .touch-image-thumb[aria-pressed=true] { box-shadow: inset 0 0 0 2px var(--accent); }
.touch-image-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
#touchEditor .touch-image-add { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-width: 40px; height: 40px; padding-inline: 10px; border-radius: var(--pill); background: var(--control); }
#touchEditor .touch-image-add:disabled { opacity: .4; }
.touch-image-actions { display: flex; gap: 4px; margin-left: auto; flex: 0 0 auto; }
#touchEditor .touch-image-actions button { width: 40px; height: 40px; border-radius: var(--pill); background: var(--control); display: inline-flex; align-items: center; justify-content: center; }
#touchEditor .touch-image-actions button:disabled { opacity: .4; }
.touch-image-sliders { gap: 10px; }
/* Audio: the same two rows, a little tighter (the clip chips + 4 actions fit one row, sliders closer). */
.touch-audio { display: flex; flex-direction: column; gap: 6px; }
.touch-audio .touch-image-strip { min-height: 38px; gap: 4px; }
#touchEditor .touch-audio .touch-image-thumb, #touchEditor .touch-audio .touch-image-add { width: 38px; height: 38px; min-width: 38px; padding: 0; justify-content: center; }
#touchEditor .touch-audio .touch-image-add:has(span) { width: auto; padding-inline: 12px; }
#touchEditor .touch-audio .touch-image-actions { gap: 3px; }
#touchEditor .touch-audio .touch-image-actions button { width: 38px; height: 38px; }
.touch-audio .touch-image-sliders { gap: 6px; }
/* Image In / Out: side toggle fixed, preset chips scroll beside it. */
#touchEditor .image-motion-row { margin-top: 4px; }
#touchEditor .motion-pick, #touchEditor .motion-dur { min-height: 40px; border-radius: var(--pill); background: var(--control); color: var(--text); }
#touchEditor .motion-pick { min-width: 0; justify-content: flex-start; }
#touchEditor .motion-dur:disabled { opacity: .42; }
#touchEditor .motion-grid button { min-width: 0; min-height: 56px; border-radius: 10px; background: transparent; color: var(--muted); font-size: 11px; }
#touchEditor .motion-grid button.on { background: var(--accent); color: var(--accent-ink); }
#touchEditor .motion-dur-card input { height: 36px; }

/* Compact density: 44px touch target, ~32px visual. The fill/track is drawn by
   a pseudo-element centered inside the (44px) button, so nothing visible is
   an inset or a transparent border. Items 1–5 (.seg) and everything else keep
   their original look. */
#touchEditor :is(.touch-chip, .touch-families button) { position: relative; isolation: isolate; }
#touchEditor :is(button.touch-chip, .touch-families button), #touchEditor :is(button.touch-chip, .touch-families button):hover, #touchEditor :is(button.touch-chip, .touch-families button)[aria-pressed=true] { background: none; }
#touchEditor :is(.touch-chip, .touch-families button)::before { content: ''; position: absolute; inset: 6px 0; z-index: -1; border-radius: var(--pill); background: transparent; }
#touchEditor .touch-families button::before { border-radius: 8px; }
#touchEditor :is(.touch-chip, .touch-families button):hover::before { background: var(--hover); }
#touchEditor :is(.touch-chip, .touch-families button)[aria-pressed=true]::before { background: var(--accent-soft); }
/* Subject bar: one pill holds a scrolling row of names (never squeezed) and the chevron that opens them all. */
#touchEditor .touch-subjects { position: relative; isolation: isolate; display: flex; align-items: center; }
#touchEditor .touch-subjects .touch-segment button { flex: 1 1 auto; }
#touchEditor .touch-subjects .touch-segment button:disabled { opacity: .35; }
#touchEditor .touch-subjects::before { content: ''; position: absolute; inset: 6px 0; z-index: -1; border-radius: var(--pill); background: var(--control); }
#touchEditor .touch-segment { position: relative; flex: 1 1 auto; min-width: 0; padding: 0 3px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; background: none; }
#touchEditor .touch-segment::-webkit-scrollbar { display: none; }
/* Edge fades: shared with the desktop bar in ui.css (.is-overflow / .is-start / .is-end). */
#touchEditor .touch-subjects-more { flex: 0 0 auto; display: grid; place-items: center; width: 40px; min-width: 40px; height: 44px; min-height: 44px; margin-right: 2px; padding: 0; border: 0; background: none; color: var(--faint); }
#touchEditor .touch-subjects-more .ui-icon { width: 16px; height: 16px; transition: transform .17s ease; }
#touchEditor .touch-subjects-more[hidden] { display: none; }
#touchEditor .touch-subjects-more.has-value { width: auto; padding: 0 10px 0 14px; display: flex; gap: 4px; margin: 6px 6px 6px 0; height: 32px; min-height: 32px; border-radius: var(--pill); background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600; }
#touchEditor .touch-subjects-more:hover, #touchEditor .touch-subjects-more[aria-expanded=true] { color: var(--text); }
#touchEditor .touch-subjects-more[aria-expanded=true] .ui-icon { transform: rotate(180deg); }
#touchEditor .touch-segment .touch-chip::before { inset: 9px 0; }
#touchEditor .touch-segment .touch-chip:hover::before { background: transparent; }
#touchEditor .touch-segment .touch-chip[aria-pressed=true]::before { background: var(--accent); }
/* Not part of this pass: the 3×3 text-position grid keeps its own 30px cells. */
#touchEditor .touch-position .touch-chip { isolation: auto; }
#touchEditor .touch-position .touch-chip::before { display: none; }
#touchEditor .touch-position .touch-chip { background: var(--control); }
#touchEditor .touch-position .touch-chip[aria-pressed=true] { background: var(--accent); }

/* Export modal (compact): ~35px tracks with 30px pills; each button's touch
   target is 44px through an invisible ::before. Resolution (5 options) is two
   segmented groups — 720p|1080p|2K and 4K|8K — each with its own dark track. */
html[data-compact] .export-modal-card .seg { padding: 2.5px; }
html[data-compact] .export-modal-card .seg button { position: relative; min-height: 30px; height: 30px; padding-block: 0; }
html[data-compact] .export-modal-card .seg button::before { content: ''; position: absolute; inset: -7px 0; }
html[data-compact] .export-modal-card .export-modal-row { margin-top: 6px; gap: 4px; }
html[data-compact] .export-modal-card .export-modal-row:first-child { margin-top: 0; }
html[data-compact] .export-modal-card .export-dimension-presets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: 35px 35px; gap: 2px 0; padding: 0; background: none; border-radius: 0; }
html[data-compact] .export-modal-card .export-dimension-presets::before,
html[data-compact] .export-modal-card .export-dimension-presets::after { content: ''; grid-column: 1 / -1; background: var(--control); border-radius: var(--pill); }
html[data-compact] .export-modal-card .export-dimension-presets::before { grid-row: 1; }
html[data-compact] .export-modal-card .export-dimension-presets::after { grid-row: 2; }
html[data-compact] .export-modal-card .export-dimension-presets:not(:has(button:nth-child(4)))::after { display: none; }
html[data-compact] .export-modal-card .export-dimension-presets button { z-index: 1; margin: 2.5px; height: auto; min-height: 0; }
html[data-compact] .export-modal-card .export-dimension-presets button:nth-child(-n+3)::before { inset: -11.5px 0 -2.5px; }
html[data-compact] .export-modal-card .export-dimension-presets button:nth-child(n+4)::before { inset: -2.5px 0 -11.5px; }
html[data-compact] .export-modal-card .export-dimension-presets button:nth-child(1) { grid-area: 1 / 1 / 2 / 3; }
html[data-compact] .export-modal-card .export-dimension-presets button:nth-child(2) { grid-area: 1 / 3 / 2 / 5; }
html[data-compact] .export-modal-card .export-dimension-presets button:nth-child(3) { grid-area: 1 / 5 / 2 / 7; }
html[data-compact] .export-modal-card .export-dimension-presets button:nth-child(4) { grid-area: 2 / 1 / 3 / 4; }
html[data-compact] .export-modal-card .export-dimension-presets button:nth-child(5) { grid-area: 2 / 4 / 3 / 7; }

/* CD rows: label left, text segment pushed right, each pill as wide as its text. */
.touch-inline > .seg.seg-text { margin-left: auto; flex: 0 1 auto; }
.touch-inline > .seg.seg-text button { flex: 0 0 auto; padding: 0 12px; }

.touch-inline > .cd-color { flex: 0 0 auto; width: 32px; height: 28px; padding: 0; margin-left: 8px; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; background: none; }
/* Stored (locked) media in the compact strip / Manage: same language as the desktop .ithumb.stored. */
#touchEditor .touch-media.is-stored img, .touch-media-blank { display: block; width: 100%; height: 100%; object-fit: cover; }
.touch-media-blank { display: flex; align-items: center; justify-content: center; background: var(--control); color: var(--muted); font: 500 9px var(--mono); }
#touchEditor .touch-media.is-locked img, .touch-media-row.is-locked img { filter: saturate(.7) brightness(.55); }
.touch-media-lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-style: normal; background: rgba(8,9,10,.28); color: rgba(237,233,224,.92); pointer-events: none; }
.touch-media-lock .ui-icon { width: 14px; height: 14px; }
.touch-media-lock b, .touch-media-pro b, .touch-media-count b { font: 600 8px/1 var(--sans); letter-spacing: .06em; color: var(--accent); }
.touch-media-pro { display: flex; align-items: center; gap: 3px; grid-column: 4 / 7; justify-self: end; color: var(--muted); }
.touch-media-pro .ui-icon { width: 12px; height: 12px; }
.touch-media-row.is-stored .touch-media-icon { grid-column: 7; }
.touch-media-count { display: block; font: 500 11px var(--mono); color: var(--muted); }

/* Mesh / Flow V2 block grafted from the desktop (palette, Edit, Motion): same markup, touch-sized targets. */
.touch-bgv2 .bg-mesh-v2 { margin-top: 0; gap: 4px; }
.touch-bgv2 .bg-pal-head { min-height: 36px; align-items: center; font-size: 12px; color: var(--muted); }
.touch-bgv2 .bg-pal-head label, .touch-bgv2 .bg-mesh-motion > span { font-size: 12px; color: var(--muted); }
.touch-bgv2 .bg-pal-edit { min-height: 32px; padding-inline: 12px; font-size: 12px; }
.touch-bgv2 .bg-palette-chip { width: 48px; height: 32px; }
.touch-bgv2 .bg-mesh-motion { min-height: 44px; }
.touch-bgv2 .bg-pal-actions button { min-height: 36px; font-size: 12px; }
.touch-bgv2 .bg-pal-stop { width: 32px; height: 32px; }
.touch-bgv2 .bg-pal-pop { position: static; box-shadow: none; padding: 8px; }
.touch-bgv2 .bg-pal-stop { min-width: 0; min-height: 0; }

/* Cohesion pass — measured against the real DOM, three kinds of control, one rule each:
   1) single action → one family: panel-wide, centered icon + label, thin solid border, radius 12, no fill;
   2) label + value/control rows (Items, Ajuste, Grain, Cor, Fundo transparente) → label left, control on the right edge;
      option groups (.touch-ratios, .touch-bg-families, segments, strips, chips) keep their own layout;
   3) secondary navigation → quiet text + trailing chevron, no fill, 44px hit area. */
#touchEditor :is(.touch-add-empty, .touch-manage-add, .touch-image-add:has(span), [data-action=upload-background], [data-action=reset-background], [data-action=remove-background]) {
    display: flex; align-items: center; justify-content: center; align-self: stretch; flex: 1 1 auto; gap: 8px; width: 100%; height: auto; min-height: 44px;
    padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: transparent; color: var(--text); font: 500 13px var(--sans); text-align: center;
}
#touchEditor .touch-add-empty { min-height: 48px; }
#touchEditor :is(.touch-add-empty, .touch-manage-add, .touch-image-add:has(span)) .ui-icon { width: 16px; height: 16px; flex: none; }
#touchEditor .touch-manage-add { margin: 0; }
#touchEditor .touch-audio .touch-image-add:has(span) { width: 100%; padding-inline: 12px; }
#touchEditor :is(.touch-add-empty, .touch-manage-add, .touch-image-add:has(span), [data-action=upload-background], [data-action=reset-background], [data-action=remove-background]):active { background: var(--hover); }
.bg-image-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.touch-bg-presets + .touch-inline, .touch-background-controls { margin-top: 0; }
#touchEditor .touch-image-strip:has(.touch-image-add span) { min-height: 0; }
.touch-advanced > button { margin-top: 0; }
/* Same token as the desktop's primary/export buttons (--pill, ui.css .btn-primary). */
#touchEditor .touch-advanced > [data-action=reset-background] { border-radius: var(--pill); }
/* Ajuste: 30px row visually, 44px hit area (negative margin keeps the panel the same height). */
#touchEditor .touch-fit-value { min-height: 44px; margin-block: -7px; }
/* Cor: label → palette, swatch → native picker, chevron → palette (the three existing paths, just laid out as one row). */
.touch-color-row { gap: 0; }
#touchEditor .touch-color-row .touch-color-label { flex: 1 1 auto; justify-content: flex-start; padding-inline: 0; text-align: left; color: var(--muted); font-size: 12px; }
#touchEditor .touch-color-row input[type=color] { margin-left: auto; }
#touchEditor .touch-color-row .touch-chevron { min-width: 24px; padding: 0; color: var(--faint); font-size: 17px; }
.compact-panel-head .touch-link:is([data-value=media-manage], [data-value=media-more], [data-value=text-more], [data-action=catalog]):after { content: '›'; margin-left: 4px; font-size: 15px; line-height: 1; color: var(--faint); }
.compact-panel-head .touch-link:active, #touchEditor .touch-link:active { background: var(--hover); }
/* One centred pill as wide as its options (same track as the desktop .seg), scrolling only when the panel is narrower. */
#touchEditor .touch-arrange-row .touch-arrange-chips { display: flex; gap: 3px; flex: 0 1 auto; min-width: 0; max-width: 100%; margin-inline: auto; padding: 3px; overflow-x: auto; scrollbar-width: none; border-radius: var(--pill); background: var(--control); }
#touchEditor .touch-arrange-chips::-webkit-scrollbar { display: none; }
#touchEditor .touch-arrange-chips .touch-chip { flex: 0 0 auto; min-height: 36px; padding-inline: 14px; font-size: 12px; white-space: nowrap; }
#touchEditor .touch-arrange-row .touch-link { flex: 0 0 auto; margin-left: auto; }
/* Colors / Palette dropdowns inside the compact panel: the list expands inline instead of floating. */
.touch-bgv2 .bg-colors-pop, #touchEditor .bg-colors-pop { position: static; margin-top: 6px; max-height: 300px; box-shadow: none; }
#touchEditor .bg-colors-trigger { min-height: 44px; }
#touchEditor .bg-colors-opt { min-height: 44px; }

/* Background video / Video Clip (compact): identified media line, framing + playback as label | seg rows, start as one text row, adjustments as ranges. */
.touch-bg-video { display: grid; gap: 0; }
.touch-seg-row { gap: 8px; }
.touch-screen-scope { display: block; padding-top: 2px; color: var(--faint); font: 400 11px/1.4 var(--sans); }
.touch-seg-row > .seg { margin-left: auto; flex: 0 1 210px; }
.touch-seg-row > .seg button { flex: 1 1 0; padding-inline: 4px; }
.touch-bg-start-text { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.touch-bg-start-text + .touch-link { margin-left: 0; }
/* Same compact round pill as desktop; the 44px touch target is kept by an invisible hit area. */
#touchEditor .touch-link-pill { position: relative; min-height: 30px; height: 30px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text); font-size: 12px; }
#touchEditor .touch-link-pill:after { content: ''; position: absolute; inset: -7px -4px; }
.touch-bg-start-actions { min-height: 40px; }
.touch-spacer { flex: 1 1 auto; }
#touchEditor .touch-link.strong { color: var(--text); }
.bg-image-controls.is-video { flex-wrap: nowrap; }
#touchEditor .bg-media-line { min-height: 44px; gap: 10px; }
#touchEditor .bg-media-line .icon-btn { flex: 0 0 auto; width: 44px; height: 44px; }
.touch-clip .bg-media-line { margin-bottom: 4px; }
.touch-caption { color: var(--muted); font-size: 12px; line-height: 1.4; }
.touch-caption:empty { display: none; }
#touchEditor .touch-fill-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 0 2px; border: 0; background: transparent; color: var(--muted); font: 400 12px var(--sans); }
#touchEditor .touch-fill-toggle[aria-expanded=true] .ui-icon { transform: rotate(180deg); }
@media (min-width: 640px) { .touch-overlay .touch-preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
