/* 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; }
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: 8px; }
html[data-compact] .brand { 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 { display: none; }
html[data-compact] .top-right { gap: 2px; }
html[data-compact] .codec, html[data-compact] #btnTopLabel { display: none; }
html[data-compact] .compact-only { display: inline; }
html[data-compact] .auth-login { min-height: 44px; max-width: 86px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; background: transparent; }
html[data-compact] .auth-user-btn { width: 44px; height: 44px; min-height: 44px; padding: 9px; background: transparent; border-color: transparent; }
html[data-compact] .auth-avatar { width: 26px; height: 26px; }
html[data-compact] .auth-popover { top: 46px; right: -44px; }
html[data-compact] .top-right .btn-primary { min-height: 44px; padding: 0 12px; font-size: 12px; background: transparent; color: var(--accent); }
html[data-compact] .top-right .btn-primary svg { width: 14px; }
html[data-compact] .touch-settings { display: block; position: relative; }
.touch-settings summary { display: grid; place-items: center; min-width: 44px; height: 44px; list-style: none; color: var(--muted); cursor: pointer; font-size: 20px; }
.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; }
.touch-institutional { display: grid; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.touch-institutional a { min-height: 40px; padding: 11px 10px; border-radius: 9px; color: var(--muted); text-decoration: none; font: 500 12px var(--sans); }
.touch-institutional a:hover { background: var(--hover); color: var(--text); }
html[data-compact] .lang-seg button { min-height: 44px; min-width: 44px; }
/* Seven languages no longer fit in one 44px row inside the "···" menu: wrap into 4 + 3. */
html[data-compact] .touch-settings .lang-seg { display: grid; grid-template-columns: repeat(4, 44px); border-radius: 14px; }
/* Inside the touch menu the languages stay a static grid of codes (no globe, no popover). */
html[data-compact] .lang-trigger, html[data-compact] .lang-name { display: none; }
html[data-compact] .lang-menu .lang-pop { position: static; display: grid; min-width: 0; padding: 3px; border: 0; border-radius: 14px; background: var(--control); box-shadow: none; }
html[data-compact] .lang-menu .lang-pop button { justify-content: center; padding: 6px 8px; }
html[data-compact] .lang-menu .lang-pop .lang-code { order: 0; color: inherit; font: 500 12px var(--sans); letter-spacing: 0; }
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] .tbtn-speed, 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) 80px; }
html[data-compact] .transport.has-timeline { height: 80px; 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)); }
html[data-compact] .transport.has-timeline.has-text-track { height: calc(80px + var(--text-row, 32px)); 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] .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; }
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=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: 2px 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; }
.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; }
.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; 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; }
.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; }
.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: 1; min-width: 0; font-size: 12px; }
#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 76px; 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: 1; 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: 1; }
.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); }
#touchEditor .touch-more { min-width: 44px; }
.touch-swatches { display: flex; align-items: center; gap: 4px; }
#touchEditor .touch-swatches > button:not(.touch-link) { width: 44px; height: 44px; padding: 6px; border-radius: 50%; }
.touch-swatches button > span { display: block; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; }
.touch-swatches canvas { display: block; width: 100%; height: 100%; }
#touchEditor .touch-swatches button[aria-pressed=true] { box-shadow: inset 0 0 0 1px var(--accent); }
.touch-swatches.touch-swatch-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
#touchEditor .touch-swatch-grid > button:not(.touch-link) { width: 100%; height: auto; aspect-ratio: 1; padding: 4px; border-radius: 10px; }
.touch-swatch-grid button > span { width: 100%; height: 100%; border-radius: 8px; }
.touch-palette { display: flex; gap: 8px; flex-wrap: wrap; }
.touch-palette label { display: flex; flex-direction: column; align-items: 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: 1; }
.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(3, 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,#btnSpeed,#btnLoop,#langSwitch,#segFormat,#imageOpts,.touch-settings) { 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-swatches:not(.touch-swatch-grid) > button:nth-child(n+5):not(.touch-link) { display: none; }
    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] .brand h1 { font-size: 12px; }
    html[data-compact] .brand h1 em { font-size: 14px; }
    html[data-compact] .top-right .btn-primary { padding-inline: 6px; font-size: 11px; }
    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; }
    #touchEditor .touch-swatches:not(.touch-swatch-grid) > button:nth-child(6) { display: none; }
}
@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. */
#touchEditor .touch-fit-toggle { display: flex; align-items: center; justify-content: center; margin-left: auto; }
/* 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); }

#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) — the desktop's own
   .touch-settings ("···") mechanics, reused as-is; only the summary label
   and touch-sized tap targets are specific to this one. */
.touch-aspect-picker summary { font: 500 11px var(--mono); }
.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: 0; padding-top: 0; border-top: 0; }
