/* Metre2 3D Viewer - "glass studio": the model floats in a full-window stage over a slowly
   drifting mint/violet glow, every control is a frosted-glass capsule floating on top of it.
   Accent: signal mint #0cf360 (chosen by max RGB distance from every accent in the portfolio). */
@font-face { font-family: "Inter"; src: url("fonts/inter-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("fonts/space-grotesk-var.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }

:root {
  --ink: #e9eef7; --ink-2: #b4bfd2; --muted: #7d8aa3; --line: rgba(255,255,255,.10); --line-2: rgba(255,255,255,.18);
  --glass: rgba(16, 22, 38, .62); --glass-2: rgba(24, 32, 54, .72); --hover: rgba(255,255,255,.07);
  --accent: #0cf360; --accent-2: #00c2a8; --accent-ink: #03200f; --violet: #8b5cf6; --warn: #ffb547; --bad: #ff6b81;
  --glow: 0 0 0 1px rgba(12,243,96,.35), 0 8px 28px -8px rgba(12,243,96,.55);
  --radius: 16px; --shadow: 0 18px 50px -18px rgba(0,0,0,.65), 0 2px 8px rgba(0,0,0,.25);
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #070b14; color: var(--ink); font: 14px/1.45 "Inter", system-ui, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .mono { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }

#app { position: fixed; inset: 0; }

/* --- the drifting backdrop (behind a transparent WebGL canvas) --- */
.backdrop { position: absolute; inset: 0; overflow: hidden; background: var(--bg, radial-gradient(120% 90% at 50% 40%, #16233f 0%, #0b1222 55%, #070b14 100%)); transition: background .4s; }
.backdrop i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(80px); opacity: .22; animation: drift 38s ease-in-out infinite alternate; }
.backdrop i:nth-child(1) { background: radial-gradient(circle, #0cf360 0%, transparent 62%); left: -18vmax; top: -22vmax; }
.backdrop i:nth-child(2) { background: radial-gradient(circle, #8b5cf6 0%, transparent 62%); right: -20vmax; bottom: -26vmax; animation-duration: 46s; animation-direction: alternate-reverse; }
.backdrop i:nth-child(3) { background: radial-gradient(circle, #00c2a8 0%, transparent 60%); left: 30vmax; top: 40vh; opacity: .12; animation-duration: 54s; }
@keyframes drift { 0% { transform: translate(0,0) scale(1); } 50% { transform: translate(6vmax, 4vmax) scale(1.08); } 100% { transform: translate(-4vmax, 7vmax) scale(.95); } }
#app[data-bg="graphite"] .backdrop { --bg: radial-gradient(120% 90% at 50% 35%, #3a3f47 0%, #202329 60%, #16181c 100%); }
#app[data-bg="white"] .backdrop { --bg: radial-gradient(120% 90% at 50% 35%, #ffffff 0%, #eef2f6 60%, #dfe5ec 100%); }
#app[data-bg="transparent"] .backdrop { --bg: repeating-conic-gradient(#1a2030 0 25%, #121726 0 50%) 0 0 / 22px 22px; }
#app[data-bg="graphite"] .backdrop i, #app[data-bg="white"] .backdrop i, #app[data-bg="transparent"] .backdrop i { opacity: 0; }

.stage { position: absolute; inset: 0; touch-action: none; }
.stage canvas { display: block; width: 100% !important; height: 100% !important; outline: none; }
#app.tool-measure .stage, #app.tool-edge .stage { cursor: crosshair; }

/* --- glass --- */
.glass { background: var(--glass); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); border: 1px solid var(--line); box-shadow: var(--shadow); }
.cap { position: absolute; top: 14px; display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 999px; z-index: 5; }
.cap-file { left: 14px; max-width: calc(100vw - 380px); padding-right: 10px; }
.cap-tools { right: 14px; }
.web-brand { display: inline-flex; color: var(--accent); }
.web-brand .mk, .hero-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, rgba(12,243,96,.35), rgba(12,243,96,.06)); border: 1px solid rgba(12,243,96,.35); }
.file-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; padding: 0 4px; }
.file-meta b { font-family: var(--display); font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta span { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--hover); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { background: rgba(255,255,255,.12); }
.btn.accent { background: linear-gradient(135deg, #3cff8a, #0cf360 45%, #00c2a8); color: var(--accent-ink); border-color: transparent; box-shadow: var(--glow); }
.btn.accent:hover { filter: brightness(1.08); }
.btn.big { height: 46px; padding: 0 22px; font-size: 15.5px; }
.btn.ghost { background: transparent; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.on { color: var(--accent); background: rgba(12,243,96,.12); }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 12.5px; }
.units select { height: 30px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; padding: 0 8px; cursor: pointer; }
select option { background: #121a2c; color: var(--ink); }
.only-narrow { display: none; }

/* --- left rail --- */
.rail { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 4px; padding: 7px; border-radius: 22px; z-index: 5; }
.rail .tool { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 58px; padding: 8px 0 6px; border: 0; border-radius: 14px; background: transparent; color: var(--ink-2); cursor: pointer; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; }
.rail .tool:hover { background: var(--hover); color: var(--ink); }
.rail .tool.on { background: linear-gradient(160deg, rgba(12,243,96,.22), rgba(0,194,168,.10)); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(12,243,96,.35); }
.rail .tool svg { width: 20px; height: 20px; }
.rail .sep { height: 1px; margin: 4px 8px; background: var(--line); }

/* --- inspector --- */
.inspector { position: absolute; right: 14px; top: 66px; bottom: 86px; width: 320px; border-radius: 20px; display: flex; flex-direction: column; overflow: hidden; z-index: 5; }
.tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); align-items: center; }
.tabs [role=tab] { flex: 1; height: 32px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.tabs [role=tab]:hover { color: var(--ink); background: var(--hover); }
.tabs [role=tab].on { color: var(--ink); background: linear-gradient(135deg, rgba(12,243,96,.18), rgba(139,92,246,.16)); box-shadow: inset 0 0 0 1px var(--line-2); }
.pane { display: none; flex: 1; overflow: auto; padding: 12px 14px 16px; }
.pane.on { display: block; }
.pane h4 { margin: 14px 0 8px; font: 600 11px/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pane h4:first-child { margin-top: 2px; }
.pane-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.spacer { flex: 1; }

.tree { font-size: 13px; }
.tree .node { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 9px; cursor: pointer; user-select: none; }
.tree .node:hover { background: var(--hover); }
.tree .node.sel { background: rgba(12,243,96,.13); box-shadow: inset 0 0 0 1px rgba(12,243,96,.3); }
.tree .node .tw { width: 14px; color: var(--muted); font-size: 10px; text-align: center; flex: none; }
.tree .node .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .node .ct { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.tree .node .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.tree .node .eye { width: 24px; height: 24px; border-radius: 6px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; display: grid; place-items: center; padding: 0; }
.tree .node .eye svg { width: 15px; height: 15px; }
.tree .node.hidden-part .nm { color: var(--muted); text-decoration: line-through; }
.tree .kids { margin-left: 14px; border-left: 1px dashed var(--line); padding-left: 4px; }
.tree .kids.closed { display: none; }

.stat-hero { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.stat-hero div { background: linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.02)); border: 1px solid var(--line); border-radius: 12px; padding: 9px 8px; text-align: center; }
.stat-hero b { display: block; white-space: nowrap; font: 600 15px/1.2 var(--display); background: linear-gradient(135deg, #e9fff1, #0cf360); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-hero span { font-size: 10.5px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 12.5px; color: var(--ink); overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; font-family: "Inter", sans-serif; }
.badge.ok { background: rgba(12,243,96,.15); color: var(--accent); } .badge.warn { background: rgba(255,181,71,.15); color: var(--warn); }
.info-sec { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.info-sec h5 { margin: 0 0 8px; font: 600 12.5px var(--display); }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.modes button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 9px 4px 8px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.03); cursor: pointer; font-size: 12px; color: var(--ink-2); }
.modes button:hover { background: var(--hover); }
.modes button.on { border-color: rgba(12,243,96,.5); color: var(--ink); box-shadow: var(--glow); }
.sw { width: 30px; height: 30px; border-radius: 50%; display: block; }
.sw-shaded { background: radial-gradient(circle at 35% 30%, #fff, #8fb3ff 40%, #24345a 85%); }
.sw-clay { background: radial-gradient(circle at 35% 30%, #fffaf0, #cfc6b8 45%, #6c645a 90%); }
.sw-flat { background: conic-gradient(from 30deg, #9db7e8 0 25%, #6b85b8 0 50%, #4e6595 0 75%, #8aa4d6 0); }
.sw-xray { background: radial-gradient(circle, transparent 45%, rgba(127,216,255,.85) 70%, transparent 74%), radial-gradient(circle, rgba(127,216,255,.25), transparent 70%); border: 1px solid rgba(127,216,255,.6); }
.sw-wire { background: repeating-linear-gradient(45deg, transparent 0 5px, var(--accent) 5px 6px), repeating-linear-gradient(-45deg, transparent 0 5px, var(--accent) 5px 6px); border-radius: 50%; border: 1px solid var(--accent); }
.sw-normals { background: conic-gradient(#ff6f91, #ffc75f, #9cff8f, #5ad8ff, #a98bff, #ff6f91); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03); cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.chips button.on { border-color: rgba(12,243,96,.55); color: var(--ink); background: rgba(12,243,96,.10); }
.bgsw { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line-2); }
.bg-midnight { background: #16233f; } .bg-graphite { background: #3a3f47; } .bg-white { background: #fff; }
.bg-transparent { background: repeating-conic-gradient(#888 0 25%, #ddd 0 50%) 0 0 / 7px 7px; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.toggles label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.rows { display: grid; gap: 8px; }
.rows label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); }
.rows select { height: 30px; border-radius: 9px; border: 1px solid var(--line-2); background: rgba(255,255,255,.04); padding: 0 8px; min-width: 150px; }

/* --- bottom dock --- */
.dock-wrap { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 5; max-width: calc(100vw - 28px); }
.dock { display: flex; gap: 2px; padding: 5px; border-radius: 999px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.dock button { height: 32px; padding: 0 13px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.dock button:hover { background: var(--hover); color: var(--ink); }
.dock button[data-view=fit] { background: linear-gradient(135deg, rgba(12,243,96,.22), rgba(0,194,168,.12)); color: var(--accent); }
.strip { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 16px; border-radius: 999px; font-size: 13px; max-width: 100%; }
.strip b { font-family: var(--display); font-weight: 600; }
.strip.hint { padding: 7px 16px; color: var(--ink-2); }
.strip input[type=range] { width: 260px; accent-color: var(--accent); }
.strip select { height: 28px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; padding: 0 8px; max-width: 180px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px; }
.seg button { width: 30px; height: 24px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-weight: 700; font-size: 12px; color: var(--ink-2); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

/* --- measurement labels --- */
.labels { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.labels .ml { position: absolute; transform: translate(-50%, -50%); padding: 3px 9px; border-radius: 999px; background: rgba(7,11,20,.82); border: 1px solid rgba(12,243,96,.55); color: #eafff2; font: 600 12px var(--mono); white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.labels .ml small { color: var(--muted); font-weight: 500; margin-left: 4px; }

/* --- welcome --- */
.welcome { position: absolute; inset: 0; display: none; place-items: center; padding: 80px 20px 30px; overflow: auto; z-index: 6; }
#app.empty .welcome { display: grid; }
#app.empty .rail, #app.empty .inspector, #app.empty .dock-wrap { display: none; }
.welcome-card { width: min(860px, 100%); border-radius: 28px; padding: 34px 34px 30px; text-align: center; background: linear-gradient(160deg, rgba(24,32,54,.72), rgba(12,17,30,.62)); }
.welcome-card .hero-mark { width: 64px; height: 64px; margin: 0 auto 14px; color: var(--accent); }
.welcome-card .hero-mark svg { width: 30px; height: 30px; }
.welcome-card h1 { margin: 0; font: 600 clamp(26px, 4vw, 38px)/1.1 var(--display); letter-spacing: -.02em; background: linear-gradient(120deg, #ffffff 30%, #9dffc0 70%, #b8a2ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome-card .lede { margin: 10px auto 20px; max-width: 560px; color: var(--ink-2); font-size: 15px; }
.welcome-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.welcome-card h3 { margin: 28px 0 12px; text-align: left; font: 600 11.5px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.samples { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sample { position: relative; border-radius: 16px; border: 1px solid var(--line); background: radial-gradient(120% 120% at 30% 20%, rgba(12,243,96,.10), rgba(139,92,246,.08) 60%, rgba(255,255,255,.02)); cursor: pointer; padding: 0 0 10px; overflow: hidden; text-align: left; transition: transform .18s, border-color .18s, box-shadow .18s; }
.sample:hover { transform: translateY(-3px) scale(1.01); border-color: rgba(12,243,96,.5); box-shadow: var(--glow); }
.sample img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.sample b { display: block; padding: 2px 12px 0; font: 600 13.5px var(--display); }
.sample span { display: block; padding: 0 12px; color: var(--muted); font-size: 12px; }
.recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; text-align: left; }
.recent-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.03); cursor: pointer; min-width: 0; }
.recent-item:hover { background: var(--hover); border-color: var(--line-2); }
.recent-item img, .recent-item .ph { width: 44px; height: 32px; border-radius: 7px; object-fit: cover; background: #0b1222; flex: none; }
.recent-item div { min-width: 0; } .recent-item b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item span { display: block; font-size: 11px; color: var(--muted); }

.menu { position: fixed; z-index: 30; min-width: 260px; max-width: 340px; padding: 6px; border-radius: 14px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 7px 8px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu .ph, .menu img { width: 40px; height: 28px; border-radius: 6px; object-fit: cover; background: #0b1222; flex: none; }
.menu b { display: block; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.menu span { display: block; font-size: 11px; color: var(--muted); }
.menu .empty-note { padding: 10px; color: var(--muted); font-size: 12.5px; }

/* --- drop, loading, toast, dialogs --- */
.dropzone { position: absolute; inset: 10px; border-radius: 26px; border: 2px dashed rgba(12,243,96,.7); background: rgba(12,243,96,.07); display: none; place-items: center; z-index: 20; pointer-events: none; }
.dropzone div { display: flex; flex-direction: column; align-items: center; gap: 10px; font: 600 20px var(--display); color: var(--accent); }
.dropzone svg { width: 44px; height: 44px; }
#app.dragging .dropzone { display: grid; }
.loading { position: absolute; inset: 0; z-index: 25; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(7,11,20,.55); backdrop-filter: blur(6px); }
.loading b { font: 600 16px var(--display); } .loading span { color: var(--muted); font-size: 12.5px; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--accent); border-right-color: var(--violet); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 120px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 40; padding: 10px 16px; border-radius: 12px; background: rgba(16,22,38,.92); border: 1px solid var(--line-2); box-shadow: var(--shadow); transition: opacity .2s, transform .2s; max-width: min(560px, calc(100vw - 32px)); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(255,107,129,.6); }
.dlg { color: var(--ink); border-radius: 22px; padding: 22px 24px; width: min(440px, calc(100vw - 32px)); background: rgba(16,22,38,.92); }
.dlg.wide { width: min(780px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(3,6,12,.55); backdrop-filter: blur(4px); }
.dlg h2 { margin: 0 0 14px; font: 600 20px var(--display); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.export-card { text-align: left; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(255,255,255,.04); padding: 14px; cursor: pointer; }
.export-card:hover { border-color: rgba(12,243,96,.55); box-shadow: var(--glow); }
.export-card b { display: block; font: 600 18px var(--display); color: var(--accent); }
.export-card span { font-size: 12.5px; color: var(--ink-2); }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.keys h4 { margin: 0 0 8px; font: 600 11px var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.keys p { margin: 0 0 7px; font-size: 13px; color: var(--ink-2); }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: rgba(255,255,255,.06); font: 600 11.5px var(--mono); color: var(--ink); text-align: center; }

/* --- white background: dark ink on the canvas overlays --- */
#app[data-bg="white"] .labels .ml { background: rgba(255,255,255,.92); color: #0b1222; }
#app[data-bg="white"] { --glass: rgba(14, 20, 34, .86); }

/* --- narrow / phone --- */
@media (max-width: 860px) {
  .only-narrow { display: inline-grid; }
  .cap-file { left: 10px; top: 10px; max-width: calc(100vw - 20px); }
  .cap-tools { right: 10px; top: 62px; }
  .file-meta span { display: none; }
  .rail { left: 10px; top: auto; bottom: 64px; transform: none; flex-direction: row; border-radius: 18px; padding: 5px; max-width: calc(100vw - 20px); overflow-x: auto; }
  .rail .tool { width: 50px; font-size: 9.5px; padding: 6px 0 5px; }
  .rail .sep { width: 1px; height: auto; margin: 6px 2px; }
  .inspector { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; height: 62vh; border-radius: 22px; transform: translateY(calc(100% + 20px)); transition: transform .28s ease; z-index: 12; background: rgba(14,20,34,.94); }
  #app.panel-open .inspector { transform: none; }
  .dock-wrap { bottom: 10px; left: 10px; right: 10px; transform: none; align-items: stretch; }
  .dock-wrap .strip { flex-wrap: wrap; border-radius: 18px; }
  .strip input[type=range] { width: 100%; flex: 1 1 140px; }
  .dock { justify-content: flex-start; }
  #app:not(.empty) .rail ~ .dock-wrap { bottom: 10px; }
  .rail { bottom: 60px; }
  .samples { grid-template-columns: repeat(2, 1fr); }
  .welcome { padding-top: 70px; }
  .welcome-card { padding: 24px 18px 20px; border-radius: 22px; }
  .keys { grid-template-columns: 1fr 1fr; }
  .export-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) { .samples { grid-template-columns: 1fr 1fr; } .sample span { display: none; } .units select { min-width: 64px; } }
@media (max-width: 860px) { #app.empty .cap-tools { display: none; } }

/* 2026-10-25: close button + the measurement Clear only shows when there is something to clear */
#app.empty #btn-close { display: none; }
#app:not(.has-measures) .rail .only-measures { display: none; }
.rail .tool span { text-align: center; line-height: 1.15; }
.rail .tool.dim { opacity: .45; }
