.viewport-text { --vt-glass:color-mix(in srgb,var(--bg) 90%,transparent); --vt-edge:color-mix(in srgb,var(--ink) 18%,transparent); position:absolute; z-index:5; top:auto; bottom:68px; left:16px; right:16px; max-width:650px; margin:0 auto; color:var(--ink); font:15px/1.4 var(--f-ui); background:var(--vt-glass); border:1px solid var(--vt-edge); border-radius:12px; box-shadow:var(--shadow-soft); overflow:hidden; backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px); }
.viewport-text button,.viewport-text input,.viewport-text select { font:inherit; color:var(--ink); }
.viewport-text button { min-height:36px; padding:7px 10px; border:1px solid var(--vt-edge); border-radius:8px; background:transparent; cursor:pointer; }
.viewport-text button:hover:not(:disabled) { background:color-mix(in srgb,var(--surface-2) 45%,transparent); }
.viewport-text button[aria-expanded="true"],.viewport-text button[aria-pressed="true"] { background:var(--solid); color:var(--on-solid); border-color:var(--solid); }
.viewport-text button[aria-expanded="true"]:hover:not(:disabled),.viewport-text button[aria-pressed="true"]:hover:not(:disabled) { background:var(--solid-hover); color:var(--on-solid); }
.viewport-text button:disabled,.viewport-text input:disabled,.viewport-text select:disabled { opacity:.5; cursor:not-allowed; }
.vt-heading { display:flex; flex-wrap:wrap; gap:8px; align-items:center; padding:8px; }
.vt-heading strong { max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.vt-heading button { display:inline-flex; align-items:center; justify-content:center; gap:6px; flex:none; min-height:44px; padding:7px 8px; font-weight:600; white-space:nowrap; }
.vt-heading button svg { flex:none; }
.vt-heading-actions { display:flex; flex:none; align-items:center; gap:4px; margin-left:auto; }
.viewport-text .vt-heading-actions button { width:44px; height:44px; padding:0; border-color:transparent; box-shadow:none; }
.vt-action-label { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
.vt-heading button:focus-visible { outline:2px solid var(--ink); outline-offset:1px; }
.viewport-text .vt-heading [data-collapse] { background:transparent; color:var(--ink); }
.viewport-text .vt-heading button:hover { background:var(--surface-2); color:var(--ink); }
.viewport-text .vt-heading [data-focus][aria-pressed="true"] { background:var(--solid); color:var(--on-solid); border-color:var(--solid); }
.viewport-text .vt-heading [data-focus][aria-pressed="true"]:hover { background:var(--solid-hover); }
.vt-heading [data-collapse][aria-expanded="false"] svg { transform:rotate(180deg); }
/* Stitch finish: a one-tap segmented switch beside the title, on every tab. */
.vt-heading strong { margin-right:0; }
.vt-finish { display:inline-flex; flex:none; gap:2px; padding:2px; border:1px solid color-mix(in srgb,var(--ink) 30%,transparent); border-radius:10px; background:color-mix(in srgb,var(--bg) 25%,transparent); }
.viewport-text .vt-finish button { min-height:44px; min-width:44px; padding:5px 8px; border:0; border-radius:8px; gap:6px; background:transparent; color:var(--muted); font-weight:600; }
.viewport-text .vt-finish button:hover:not(:disabled) { background:color-mix(in srgb,var(--surface-2) 60%,transparent); color:var(--ink); }
.viewport-text .vt-finish button[aria-checked="true"],.viewport-text .vt-finish button[aria-checked="true"]:hover:not(:disabled) { background:var(--solid); color:var(--on-solid); }
.vt-finish button:focus-visible { outline:2px solid var(--ink); outline-offset:1px; }
.vt-heading [data-attach-patch] { order:2; flex-basis:100%; }
.vt-finish-note { order:3; flex:none; padding:3px 8px; border-radius:8px; background:color-mix(in srgb,var(--surface-2) 70%,transparent); color:var(--muted); font-size:12px; font-weight:600; white-space:nowrap; }
.vt-puff-controls {order:4;flex:1 0 100%;min-width:0;display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:10px;padding-top:8px;border-top:1px solid var(--vt-edge);}
.vt-puff-controls label {font-size:13px;font-weight:600;}
.vt-puff-controls select {width:100%;min-width:0;min-height:44px;padding:8px;border:1px solid var(--vt-edge);border-radius:8px;background:var(--bg);color:var(--ink);font-size:14px;}
.vt-puff-controls select:focus-visible {outline:2px solid var(--ink);outline-offset:2px;}
.vt-puff-controls[hidden],.viewport-text.is-collapsed .vt-puff-controls {display:none;}
#vt-panel-shape [hidden] { display:none!important; }
.viewport-text.is-collapsed .vt-finish-note { display:none; }
.vt-toolbar { display:flex; flex-wrap:wrap; gap:4px; padding:0 6px 5px; border-bottom:1px solid var(--vt-edge); }
.vt-toolbar button { flex:1 0 auto; border:0; }
.vt-toolbar button[aria-selected="true"] { background:var(--solid); color:var(--on-solid); font-weight:600; }
.vt-toolbar button[aria-selected="true"]:hover { background:var(--solid-hover); }
.vt-short { display:none; }
.vt-shape-options { display:none; }
.vt-panels { position:static; width:100%; }
.vt-panels section { box-sizing:border-box; padding:11px; border:6px solid transparent; border-radius:0 0 12px 12px; background:transparent; scrollbar-width:thin; scrollbar-color:var(--muted) transparent; max-height:min(390px,var(--vt-panel-room,45dvh)); overflow:auto; overscroll-behavior:contain; }
.vt-panels section>label { display:block; margin:10px 0 6px; font-weight:600; }
.vt-panels section>label:first-child { margin-top:0; }
.vt-panels p { margin:0 0 12px; color:var(--muted); font-size:14px; }
.vt-panels input[type="text"],.vt-panels select { display:block; width:100%; min-height:40px; border:1px solid var(--vt-edge); border-radius:7px; padding:7px; background:color-mix(in srgb,var(--surface) 45%,transparent); }
.vt-panels select option { color:var(--ink); background:var(--surface); }
.vt-text-entry { display:flex; align-items:center; gap:10px; }
.vt-text-entry label { flex:none; font-weight:600; }
.vt-text-entry input { min-width:0; }
.vt-text-count { flex:none; color:var(--muted); font-size:12px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.vt-font-browser { display:flex; align-items:flex-start; gap:4px; padding-top:6px; }
.vt-font-browser>[data-font-prev],.vt-font-browser>[data-font-next] { flex:0 0 44px; height:44px; margin-top:3px; padding:0; font-size:24px; }
.vt-fonts { position:relative; display:flex; flex:1; min-width:0; gap:6px; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:thin; padding:3px; }
.vt-fonts button { flex:none; height:44px; min-height:44px; display:inline-flex; align-items:center; justify-content:center; white-space:nowrap; }
.vt-panels input[type="color"] { width:100%; height:42px; border:1px solid var(--vt-edge); border-radius:7px; background:color-mix(in srgb,var(--surface) 45%,transparent); }
.vt-adjust { margin-bottom:12px; }
.vt-adjust label { display:block; margin-bottom:5px; font-weight:600; }
.vt-adjust label span { font-weight:400; color:var(--muted); }
.vt-adjust>div { display:flex; align-items:center; gap:10px; }
.vt-adjust input[type="range"] { flex:1; min-width:0; width:100%; background:linear-gradient(var(--muted),var(--muted)) 0 50% / 100% 3px no-repeat; }
#viewport-text .vt-adjust input[type="range"][style*="--tick-gap"], .vt-adjust input[type="range"][style*="--tick-gap"] { background:linear-gradient(90deg,var(--tick,var(--muted)) 0 1px,transparent 1px) calc(var(--thumb,16px) / 2) 50% / calc((100% - var(--thumb,16px)) * var(--tick-gap)) 7px repeat-x, linear-gradient(var(--muted),var(--muted)) 0 50% / 100% 3px no-repeat; }
.vt-adjust input[type="number"] { flex:0 0 76px; width:76px; min-height:36px; border:1px solid var(--vt-edge); border-radius:7px; padding:6px; background:color-mix(in srgb,var(--surface) 45%,transparent); font-variant-numeric:tabular-nums; }
.vt-toggle { display:flex!important; align-items:center; gap:8px; }
.vt-toggle input { width:18px; height:18px; }
.vt-letters { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:14px; }
.vt-letters button { min-width:40px; min-height:40px; font-weight:700; }
.vt-actions { display:flex; gap:6px; flex-wrap:wrap; }
.vt-actions button { flex:1 1 auto; }
.vt-panels [data-reverse] { margin-top:10px; width:100%; }
/* Collapsed: one row of the tool tabs (tapping one reopens the editor on it)
   beside the view controls, in place of the title and the Flat / 3D Puff switch. */
.viewport-text.is-collapsed .vt-panels { display:none; }
.viewport-text.is-collapsed { display:flex; align-items:center; gap:6px; padding:6px; }
.viewport-text.is-collapsed .vt-heading { display:contents; }
.viewport-text.is-collapsed .vt-heading strong,.viewport-text.is-collapsed .vt-finish,.viewport-text.is-collapsed .vt-finish-note,.viewport-text.is-collapsed [data-attach-patch] { display:none; }
.viewport-text.is-collapsed .vt-toolbar { flex:1 1 auto; min-width:0; flex-wrap:nowrap; gap:2px; padding:0; border:0; overflow-x:auto; scrollbar-width:none; }
.viewport-text.is-collapsed .vt-toolbar::-webkit-scrollbar { display:none; }
.viewport-text.is-collapsed .vt-toolbar button { flex:1 0 auto; padding:7px 8px; }
.viewport-text.is-collapsed .vt-heading-actions { order:1; margin-left:0; }
/* Phones: short tab names; the row scrolls sideways if it is still too wide. */
@media(max-width:760px) { .viewport-text.is-collapsed .vt-toolbar button { padding:6px 6px; } }
/* Letter handle: an invisible box over the selected letter (sized and turned
   in JS) with an underline; nothing covers the text being adjusted. */
.viewport-letter { position:absolute; z-index:4; padding:0; border:0; border-radius:4px; background:transparent; color:transparent; touch-action:none; cursor:grab; }
.viewport-letter:active { cursor:grabbing; }
.viewport-letter:focus-visible { outline:2px solid #edbf73; outline-offset:2px; }
.viewport-letter::after { content:''; position:absolute; left:2px; right:2px; bottom:-6px; height:3px; border-radius:2px; background:#edbf73; box-shadow:0 0 0 1px #0007; pointer-events:none; transition:height .12s; }
.viewport-letter:hover::after,.viewport-letter:active::after { height:4px; }
/* Letter mode adjusts single letters, so the word's own frame and handles step aside. */
.viewer.is-letter-editing .selection-box { display:none; }
.viewport-letter-readout { position:absolute; z-index:5; transform:translate(-50%,-100%); padding:4px 8px; border-radius:7px; background:color-mix(in srgb,var(--surface) 90%,transparent); color:var(--ink); font:600 12px/1.25 var(--f-ui); font-variant-numeric:tabular-nums; white-space:nowrap; box-shadow:0 2px 8px #0004; pointer-events:none; }
#vt-panel-interlock { height:auto; min-height:64px; padding:5px; }
.vt-interlock-summary { display:flex; align-items:center; justify-content:space-between; gap:12px; }
#vt-interlock-settings { padding-top:8px; }
#vt-interlock-settings>label { display:block; margin-bottom:6px; font-weight:600; }
#vt-panel-interlock .vt-toggle { margin:0; min-height:44px; font-size:15px; }
#vt-panel-interlock input[type="checkbox"] { min-height:18px; width:18px; height:18px; margin:0; flex:none; }
.vt-interlock-example { width:120px; max-width:40%; height:42px; object-fit:contain; flex:none; }
:root[data-theme="dark"] .vt-interlock-example { filter:invert(1); }
@media(max-width:760px) {
 .viewer #scene { height:calc(100% - var(--vt-reserve,0px)); transition:height .32s cubic-bezier(.22,.8,.24,1); }
 .viewport-text { top:auto; bottom:calc(68px + var(--sheet-lip,0px)); left:10px; right:10px; }
 .vt-panels section { height:min(160px,var(--vt-panel-room,160px)); max-height:none; padding:5px; }
 #vt-panel-interlock.is-enabled { height:min(160px,var(--vt-panel-room,160px)); }
 .viewport-text button { min-height:44px; }
 .vt-heading { padding:6px 8px 8px; gap:6px; }
 .vt-toolbar { gap:2px; flex-wrap:nowrap; }
 .vt-toolbar button { flex:1 1 auto; padding:6px 3px; font-size:14px; }
 .vt-long { display:none; }
 .vt-short { display:inline; }
 .vt-shape-options { display:flex; gap:6px; margin-bottom:6px; }
 .vt-shape-options [data-shape-tool] { flex:1; }
 .vt-shape-options [data-shape-reset] { margin-left:4px; border:0; color:var(--muted); }
 #vt-panel-shape .vt-adjust { display:none; margin:0; }
 #vt-panel-shape[data-shape="arc"] [data-adjust="arc"],
 #vt-panel-shape[data-shape="height"] [data-adjust="height"],
 #vt-panel-shape[data-shape="rotation"] [data-adjust="rotation"],
 #vt-panel-shape[data-shape="puff"] [data-adjust="puff"] { display:block; }
 /* Phones: the finish switch takes the title's place to keep one header row. */
 .vt-heading strong { display:none; }
 .viewport-text .vt-finish button { padding:5px 8px; font-size:14px; }
 .vt-finish button svg { display:none; }
 #vt-panel-shape [data-straighten] { display:none; }
 .vt-adjust label { margin-bottom:2px; }
 .vt-adjust input[type="number"] { min-height:44px; }
 .vt-adjust input[type="range"] { min-height:44px; }
 #vt-panel-spacing { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:0 10px; }
 #vt-panel-spacing>p { display:none; }
 #vt-panel-spacing .vt-letters,#vt-panel-spacing .vt-actions { grid-column:1/-1; }
 #vt-panel-spacing .vt-adjust input[type="number"] { flex-basis:58px; width:58px; }
 #vt-panel-spacing .vt-adjust>div { gap:4px; }
 #vt-panel-spacing .vt-adjust label { min-height:36px; font-size:14px; }
 .vt-panels input,.vt-panels select { font-size:16px; min-height:44px; }
 /* Fingertip-sized grab area around even a small letter, without drawing anything. */
 .viewport-letter::before { content:''; position:absolute; inset:-12px; }
}

.vt-text-entry { gap:6px; }
.vt-text-entry [data-text-picker] { flex:0 0 58px; padding:4px; font-size:14px; }
.vt-text-entry [data-add-text] { flex:0 0 40px; padding:0; font-size:22px; }
.vt-text-items { max-height:84px; overflow-y:auto; overscroll-behavior:contain; margin-top:6px; }
.vt-text-items button { display:block; width:100%; text-align:left; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin:2px 0; }

.vt-color-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px; font-size:14px; }
.vt-color-heading [data-color-name] { color:var(--muted); }
.vt-thread-swatches { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:4px; }
.vt-thread-swatches button { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; min-width:0; min-height:54px; padding:4px 1px; font-size:12px; }
.vt-thread-chip { display:block; width:24px; height:24px; border-radius:6px; border:1px solid #8888; }
.vt-thread-swatches button[aria-pressed="true"] .vt-thread-chip { outline:2px solid currentColor; outline-offset:2px; }
.vt-panels .vt-custom-color { position:relative; display:flex; align-items:center; gap:8px; min-height:44px; margin-top:6px; padding:5px 8px; border:1px solid var(--vt-edge); border-radius:8px; cursor:pointer; }
.vt-custom-color.is-selected { border-color:var(--ink); }
.vt-custom-color.is-locked { opacity:.5; cursor:not-allowed; }
.vt-custom-chip { flex:none; width:26px; height:26px; border-radius:6px; border:1px solid #8888; }
.vt-custom-color [data-color-hex] { margin-left:auto; color:var(--muted); font-size:12px; font-variant-numeric:tabular-nums; }
.vt-custom-color #vt-color { position:absolute; inset:0; width:100%; height:100%; min-height:0; opacity:0; cursor:inherit; }
.vt-custom-color:focus-within { outline:2px solid var(--ink); outline-offset:2px; }
/* Match hat: one-tap thread colours taken from the hat's brim / mesh. */
.vt-match { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:6px; }
.vt-match-label { flex:none; color:var(--muted); font-size:13px; font-weight:600; }
.vt-match-list { display:flex; flex-wrap:wrap; gap:6px; min-width:0; }
.viewport-text .vt-match-list button { display:inline-flex; align-items:center; gap:7px; min-height:36px; padding:4px 10px 4px 5px; border-radius:8px; font-size:13px; font-weight:600; white-space:nowrap; }
.vt-match-list .vt-thread-chip { width:24px; height:24px; border-radius:8px; }
.viewport-text .vt-match-list button[aria-pressed="true"] .vt-thread-chip { outline:2px solid var(--on-solid); outline-offset:1px; }

/* Edit one outline at a time so three layers don't stack into a tall menu. */
#vt-panel-outline { padding:3px; }
.vt-outline-head { display:flex; align-items:center; gap:4px; margin-bottom:4px; }
.vt-outline-head strong { margin-right:4px; }
.vt-outline-head button { padding:4px 6px; }
.vt-outline-head [data-outline-add] { width:36px; font-size:22px; }
[data-outline-list] { display:flex; gap:3px; }
[data-outline-list] button { min-width:30px; }
.vt-outline-width { display:flex; align-items:center; gap:8px; margin:0 0 4px; min-height:44px; }
.vt-outline-width label { flex:none; margin:0; }
.vt-outline-width input[type="number"] { flex:0 0 52px; width:52px; padding:5px; }
.vt-outline-colors { display:flex; align-items:center; justify-content:space-between; gap:3px; }
.vt-outline-colors button,.vt-outline-custom { flex:1; min-width:0; height:44px; padding:5px; display:flex; align-items:center; justify-content:center; }
.vt-outline-colors button span { display:block; width:24px; height:24px; border:1px solid #8888; border-radius:5px; }
.vt-outline-custom { position:relative; border:1px solid var(--vt-edge); border-radius:8px; cursor:pointer; background:var(--outline-color); color:#FFF; text-shadow:0 0 2px #000,0 1px 3px #000; font-size:22px; }
.vt-outline-custom input[type="color"] { position:absolute; inset:0; width:100%; height:100%; min-height:0; opacity:0; cursor:inherit; }
.vt-outline-custom.is-locked { opacity:.5; cursor:not-allowed; }
.vt-outline-custom:focus-within { outline:2px solid var(--ink); outline-offset:2px; }
#vt-panel-outline [data-outline-empty] { margin:8px 0 0; }
.vt-panels section::-webkit-scrollbar { width:8px; height:8px; }
.vt-panels section::-webkit-scrollbar-track { background:transparent; margin-block:6px; }
.vt-panels section::-webkit-scrollbar-thumb { background:var(--muted); border:2px solid transparent; background-clip:padding-box; border-radius:8px; }
.vt-outline-modes { display:flex; gap:6px; margin-bottom:8px; overflow-x:auto; scrollbar-width:thin; }
.vt-outline-mode { display:flex; flex:none; align-items:stretch; }
.vt-outline-mode [data-outline-mode] { display:flex; align-items:center; gap:6px; padding:5px 8px; border-radius:8px 0 0 8px; white-space:nowrap; }
.vt-effect-preview { display:block; flex:none; width:72px; height:24px; overflow:visible; }
.vt-effect-thumb { display:contents; }
.vt-outline-mode .vt-effect-action { flex:none; width:36px; padding:0; font-size:22px; border-radius:0 8px 8px 0; border-left:0; }
@media(max-width:760px) {
 .vt-panels section,#vt-panel-outline,#vt-panel-interlock { padding:10px; }
 .vt-outline-modes { gap:4px; }
 .vt-outline-mode [data-outline-mode] { flex-direction:column; gap:1px; font-size:14px; padding:5px 3px; }
 .vt-effect-preview { width:58px; height:23px; }
 .vt-outline-mode .vt-effect-action { width:36px; }
}
.vt-line-toolbar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:6px; margin-bottom:8px; }
.vt-line-toolbar [data-line-empty] { margin:8px 0; }
.vt-line-color { display:flex; align-items:center; gap:6px; }
.vt-line-color input[type="color"] { width:40px; height:36px; min-height:36px; padding:2px; flex:none; }
.vt-line-color button { padding:5px 8px; }
#vt-line-settings .vt-adjust { margin-bottom:8px; }

/* Desktop: a compact, centered dock with content-sized panels. */
@media(min-width:761px) {
 .viewport-text { max-width:780px; }
 /* Puff thickness sits in the header beside the finish switch it belongs to,
    instead of taking a row of its own; the view controls stay on the right. */
 .vt-heading-actions { order:1; }
 .vt-puff-controls { order:0; flex:0 1 auto; display:flex; align-items:center; gap:8px; padding-top:0; border-top:0; }
 .vt-puff-controls select { width:190px; min-height:40px; padding:6px 8px; text-overflow:ellipsis; }
 .viewer #scene { top:80px; bottom:auto; height:calc(100% - 80px - var(--vt-reserve,0px)); transition:height .32s cubic-bezier(.22,.8,.24,1); }
 .vt-panels { width:100%; }
 .vt-panels section,#vt-panel-outline,#vt-panel-interlock { height:auto; max-height:min(168px,var(--vt-panel-room,168px)); padding:8px; }
 .vt-adjust { margin:0; min-width:0; }
 .vt-adjust label { margin-bottom:2px; }
 .vt-adjust input[type="number"] { flex-basis:60px; width:60px; }
 #vt-panel-text { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.4fr); align-items:center; min-height:88px; gap:12px; }
 .vt-font-browser { min-width:0; padding:0; }
 .vt-text-items { margin:0; max-height:140px; }
 #vt-panel-style { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(0,1fr); align-content:center; gap:8px 16px; }
 .vt-color-heading { grid-column:1/-1; margin:0; }
 .vt-panels .vt-custom-color { margin:0; align-self:center; }
 #vt-panel-style .vt-match { grid-column:1/-1; margin:0; }
 /* Path picker and Straighten share the first row, sliders the second; the
    panel is allowed the Outline panel's height and starts at the top, so the
    picker is never cut off (centred overflow could not be scrolled to). */
 #vt-panel-shape { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px 10px; align-content:start; max-height:min(212px,var(--vt-panel-room,212px)); }
 #vt-panel-shape .text-path-controls { grid-row:1; grid-column:1/3; margin:0; gap:4px 10px; }
 #vt-panel-shape .text-path-controls p:empty { display:none; }
 #vt-panel-shape [data-straighten] { grid-row:1; grid-column:3; justify-self:end; align-self:start; margin-top:18px; min-height:42px; }
 #vt-panel-spacing { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px 16px; align-content:start; padding:5px 8px; }
 #vt-panel-spacing>p { display:none; }
 /* Letter picker and its actions share the first row; the sliders sit below. */
 #vt-panel-spacing .vt-letters { grid-row:1; grid-column:1; align-self:center; flex-wrap:nowrap; overflow-x:auto; scrollbar-width:thin; margin:0; padding-bottom:4px; }
 #vt-panel-spacing .vt-letters button { flex:none; min-height:36px; }
 #vt-panel-spacing .vt-actions { grid-row:1; grid-column:2; align-self:start; flex-wrap:nowrap; }
 #vt-panel-spacing .vt-actions button { flex:1 1 0; padding:6px 4px; min-width:0; min-height:36px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
 .vt-interlock-summary { justify-content:flex-start; gap:20px; }
 #vt-panel-interlock .vt-toggle { min-height:36px; }
 .vt-interlock-example { height:32px; }
 #vt-interlock-settings { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px 16px; padding-top:4px; }
 #vt-interlock-settings>label { grid-column:3; grid-row:1; margin:0; align-self:start; }
 #vt-crossing { grid-column:3; grid-row:1; align-self:end; min-height:36px; padding:6px; margin-top:23px; }
 .vt-panels [data-reverse] { grid-column:3; margin:0; }
 .vt-outline-head { margin-bottom:12px; }
 #vt-panel-outline [data-outline-settings] { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:center; gap:20px; }
 .vt-outline-width { margin:0; }
 .vt-outline-modes { margin-bottom:6px; }
 .vt-outline-mode [data-outline-mode] { min-width:120px; }
 .vt-effect-thumb { display:grid; place-items:center; flex:none; width:88px; height:88px; border:1px solid currentColor; border-radius:6px; background:color-mix(in srgb,currentColor 5%,transparent); }
 .vt-effect-preview { width:84px; height:84px; }
 #vt-panel-outline { max-height:min(212px,var(--vt-panel-room,212px)); }
 .vt-outline-body { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; gap:12px; }
 .vt-outline-body [data-outline-empty] { grid-column:1/-1; }
 #vt-panel-outline [data-outline-settings] { gap:12px; }
 .vt-outline-head { margin-bottom:4px; }
 .vt-line-body { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,2fr); gap:16px; align-items:start; }
 .vt-line-toolbar { margin:0; }
 #vt-line-settings { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
}

/* Smooth open/collapse: the editor and its tool panels ease in (compositor-only
   opacity/transform) while the 3D canvas above glides to its new height. */
@keyframes vt-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes vt-fade { from { opacity:0; } to { opacity:1; } }
.viewport-text:not([hidden]) { animation:vt-in .24s cubic-bezier(.22,.8,.24,1); }
.viewport-text .vt-toolbar,.viewport-text .vt-panels section:not([hidden]) { animation:vt-fade .2s ease-out; }
/* Typing on a phone: the keyboard already moves everything; follow it exactly. */
#app.is-typing .viewer #scene { transition:none; }

/* While the Text Editor is up it docks at the bottom of the view, and undo/redo,
   the hat colour strip (plus the tips button and view pager that share their
   row) sit just above it. --vt-reserve (set by viewport-text.js every frame)
   is the editor's height from the bottom of the view plus an 8px gap. The
   controls glide as the editor opens, collapses or changes tabs. */
#viewer :is(.history-bar, .view-pager) { transition: opacity .2s ease, bottom .32s cubic-bezier(.22,.8,.24,1); }
#viewer :is(.viewport-colors, .tips-m) { transition: opacity .2s ease, bottom .32s cubic-bezier(.22,.8,.24,1); }
/* Phone layout only: on desktop Undo/Redo keeps its bottom-left spot beside the editor. */
@media (max-width: 820px) {
 #viewer:has(> #viewport-text:not([hidden])) .viewport-text { bottom: 10px; }
 #viewer:has(> #viewport-text:not([hidden])) :is(.history-bar, .viewport-colors, .tips-m) { bottom: var(--vt-reserve, 20px); }
 #viewer:has(> #viewport-text:not([hidden])) .view-pager { bottom: calc(var(--vt-reserve, 20px) + 44px); }
}
