@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/montserrat-latin-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/montserrat-latin-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/montserrat-latin-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("assets/fonts/ibm-plex-sans-arabic-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("assets/fonts/ibm-plex-sans-arabic-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #1c1b20;
  --white: #fff;
  --silver: #ddd;
  --graphite: #5c5c5e;
  --purple: #8b28e3;
  --card: #232228;
  --line: rgba(255,255,255,.09);
  --glass: rgba(29,27,34,.82);
  --ease-finish: cubic-bezier(.22,1,.36,1);
  --ease-sweep: cubic-bezier(.65,0,.35,1);
  --ease-snap: cubic-bezier(.34,1.56,.64,1);
  --crop-x-desktop: 50%;
  --crop-y-desktop: 94%;
  --scale-desktop: 1.012;
  --crop-x-mobile-closed: 42%;
  --crop-y-mobile-closed: 66%;
  --scale-mobile-closed: 1.018;
  --crop-x-mobile-open: 50%;
  --crop-y-mobile-open: 61%;
  --scale-mobile-open: 1.006;
  --chrome-top: calc(env(safe-area-inset-top, 0px) + 96px);
  --panel-peek: 92px;
  font-family: "Montserrat", Arial, sans-serif;
  background: var(--ink);
  color: var(--white);
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--ink); }
button, input, select { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.studio, .stage { position: relative; width: 100%; height: 100%; min-width: 0; overflow: hidden; }
.stage { background: #0d0c10; }
.canvas-frame {
  position: absolute;
  z-index: 1;
  inset: -8dvh 0 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  --preview-zoom: 1;
  --preview-pan-x: 0px;
  --preview-pan-y: 0px;
  transition: height 600ms var(--ease-finish), inset 600ms var(--ease-finish);
}

.preview-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: var(--crop-x-desktop) var(--crop-y-desktop);
  --preview-base-scale: var(--scale-desktop);
  filter: saturate(1.03) contrast(1.02);
  /* Safe before modules install gesture handlers. Standalone capture is enabled
     only by .standalone-gesture-ready after viewport handlers are attached. */
  touch-action: pan-y;
  transform: translate3d(var(--preview-pan-x),var(--preview-pan-y),0) scale(calc(var(--preview-base-scale) * var(--preview-zoom)));
  transition: object-position 600ms var(--ease-finish), transform 600ms var(--ease-finish), opacity 320ms var(--ease-finish);
}
.canvas-frame.is-preview-interacting .preview-canvas { transition: opacity 320ms var(--ease-finish); }
.preview-canvas:focus-visible { outline: 2px solid rgba(255,255,255,.92); outline-offset: -4px; }
.canvas-frame:has(.preview-canvas:not([hidden])) { cursor: grab; }
.canvas-frame.is-preview-interacting { cursor: grabbing; }

/* In an iframe, reserve single-finger vertical gestures for the containing page.
   The viewport handler captures only a two-finger touch gesture for the car. */
body.standalone-gesture-ready .preview-canvas, body.standalone-gesture-ready .scrim { touch-action: none; }
body.embed-mode .panel-body { overscroll-behavior-y: auto; }

.preview-gesture-hint {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 116px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  background: rgba(20,18,24,.72);
  box-shadow: 0 12px 28px -18px rgba(0,0,0,.85);
  color: rgba(255,255,255,.82);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .03em;
  pointer-events: none;
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.canvas-frame::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,rgba(7,6,9,.46),transparent 17%,transparent 72%,rgba(7,6,9,.52)),
    radial-gradient(75% 70% at 50% 56%,transparent 48%,rgba(8,7,10,.18));
  content: "";
  pointer-events: none;
}

.canvas-loading, .canvas-error, .vehicle-loading {
  position: relative;
  z-index: 4;
  max-width: 360px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(20,19,23,.78);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.7);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  text-align: center;
}

.canvas-error { display: grid; gap: 8px; }
.canvas-error img { width: 100%; border-radius: 10px; }
.vehicle-loading { align-items: center; gap: 10px; }
.vehicle-loading:not([hidden]) { display: flex; }
.loading-ring {
  width: 18px;
  height: 18px;
  flex: none;
  border: 2px solid rgba(255,255,255,.24);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: loading-spin 800ms linear infinite;
}
@keyframes loading-spin { to { transform: rotate(1turn); } }

.mobile-edge-extension { display: none; }
.media-sweep {
  position: absolute;
  z-index: 2;
  top: -10%;
  bottom: -10%;
  left: -34%;
  width: 24%;
  background: linear-gradient(105deg,transparent,rgba(255,255,255,.08) 38%,rgba(225,205,255,.22) 50%,rgba(255,255,255,.06) 62%,transparent);
  filter: blur(9px);
  mix-blend-mode: screen;
  pointer-events: none;
  transform: skewX(-9deg);
  animation: chrome-sweep 900ms var(--ease-sweep) 500ms both;
}
@keyframes chrome-sweep { to { left: 112%; } }
[dir="rtl"] .media-sweep { right: -34%; left: auto; transform: skewX(9deg); animation-name: chrome-sweep-rtl; }
@keyframes chrome-sweep-rtl { to { right: 112%; } }

.topbar {
  position: absolute;
  z-index: 10;
  top: 0;
  right: 0;
  left: 0;
  isolation: isolate;
  display: flex;
  min-height: 86px;
  align-items: center;
  gap: 18px;
  padding: max(16px,env(safe-area-inset-top)) 24px 12px;
  pointer-events: none;
}
.topbar::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg,rgba(13,12,16,.56),rgba(13,12,16,.2) 60%,transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  backdrop-filter: blur(14px) saturate(1.08);
  content: "";
  -webkit-mask-image: linear-gradient(#000 0 58%,transparent 100%);
  mask-image: linear-gradient(#000 0 58%,transparent 100%);
  pointer-events: none;
}

.brand, .top-actions, .vehicle-id { pointer-events: auto; }
.brand { display: inline-flex; width: 154px; height: 52px; flex: none; align-items: center; text-decoration: none; }
/* height:100% resolves against the auto-height <picture>, so the square source
   paints as a 154x154 box that overflows the link. object-fit keeps that looking
   correct, but the overflow still hit-tests -- and the stage tools now sit under
   it. Clicks belong to the link's own box. */
.brand picture, .brand img { pointer-events: none; }
.brand img { display: block; width: 100%; height: 100%; object-fit: contain; }
.vehicle-id { display: grid; min-width: 0; gap: 4px; }
.vehicle-id strong { font-size: .82rem; font-weight: 600; letter-spacing: .02em; }
.vehicle-id > span { color: rgba(255,255,255,.62); font-size: .62rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
[dir="rtl"] .vehicle-id > span { letter-spacing: 0; text-transform: none; }

.top-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.icon-button, .text-button {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(26,24,30,.62);
  box-shadow: inset 0 1px rgba(255,255,255,.06);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: border-color 120ms,background 120ms,transform 120ms var(--ease-snap);
}
.icon-button { width: 44px; padding: 0; }
.icon-button:hover, .text-button:hover { border-color: rgba(139,40,227,.72); background: rgba(46,38,58,.76); }
.icon-button:active, .text-button:active { transform: scale(.97); }
.icon-button svg, .text-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
/* Two-class selector so the compact padding-inline in the mobile block cannot
   squeeze the 22px flag into a 20px content box. */
.top-actions .locale-button { padding: 0; }
.locale-flag { display: none; width: 22px; height: 16px; flex: none; border-radius: 3px; object-fit: cover; }
html[lang="en"] .locale-flag--ar { display: block; }
html[lang="ar"] .locale-flag--en { display: block; }
.top-actions .quote-button { min-width: 0; gap: 6px; padding-inline: 10px; border-color: #25d366; background: #128c4a; color: #fff; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.top-actions .quote-button:hover { border-color: #4be184; background: #0b743b; }
.top-actions .quote-button svg { width: 19px; height: 19px; flex: none; fill: currentColor; stroke: none; }
.top-actions .quote-label { display: inline; }
[dir="rtl"] .quote-button { font-family: "IBM Plex Sans Arabic",Arial,sans-serif; }
.sfx-toggle { min-width: 72px; color: rgba(255,255,255,.86); font-size: .62rem; font-weight: 700; letter-spacing: .04em; }
.sfx-toggle.is-muted { color: rgba(255,255,255,.52); }
.sfx-icon--off, .sfx-toggle.is-muted .sfx-icon--on { display: none; }
.sfx-toggle.is-muted .sfx-icon--off { display: block; }

.panel-kicker {
  margin: 0;
  color: rgba(255,255,255,.64);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
[dir="rtl"] .panel-kicker { letter-spacing: 0; text-transform: none; }

.stage-tools {
  position: absolute;
  z-index: 5;
  top: var(--chrome-top);
  left: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  transition: opacity 320ms var(--ease-finish);
}
[dir="rtl"] .stage-tools { right: 24px; left: auto; }
.stage-tooltip-anchor { position: relative; display: flex; }
.stage-tools .stage-tool, .stage-tools select {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(22,20,25,.68);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: .72rem;
  font-weight: 600;
}
.stage-tools .stage-tool { display: inline-grid; place-items: center; transition: border-color 120ms,background 120ms,transform 120ms var(--ease-snap); }
.stage-tools .stage-tool:hover { border-color: rgba(255,255,255,.24); background: rgba(37,34,42,.82); }
.stage-tools .stage-tool:active { transform: scale(.97); }
.stage-tools .stage-tool svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.stage-tools .stage-tool--primary { border-color: rgba(139,40,227,.7); background: rgba(139,40,227,.85); box-shadow: 0 0 40px -8px rgba(139,40,227,.45); animation: cta-pulse 2400ms ease-in-out infinite alternate; }
.stage-tooltip {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: calc(100% + 10px);
  width: max-content;
  max-width: min(240px,80vw);
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  background: rgba(15,13,19,.95);
  box-shadow: 0 12px 28px -15px rgba(0,0,0,.9);
  color: rgba(255,255,255,.94);
  font-size: .64rem;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transform: translate(-4px,-50%);
  visibility: hidden;
  transition: opacity 120ms ease 220ms,transform 120ms ease 220ms;
}
[dir="rtl"] .stage-tooltip { right: calc(100% + 10px); left: auto; transform: translate(4px,-50%); }
.stage-tooltip-anchor:not([data-tooltip-dismissed]):is(:hover,:focus-within) .stage-tooltip { opacity: 1; pointer-events: auto; transform: translate(0,-50%); visibility: visible; }
@keyframes cta-pulse { to { box-shadow: 0 0 46px -5px rgba(139,40,227,.58); } }
.debug-control { display: none; }

.scrim {
  position: fixed;
  z-index: 8;
  inset: 0;
  border: 0;
  background: rgba(7,6,9,.28);
  touch-action: pan-y;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms var(--ease-finish);
}

.control-panel {
  position: fixed;
  z-index: 9;
  top: 94px;
  right: 22px;
  bottom: 22px;
  display: flex;
  width: 388px;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(160deg,rgba(35,33,42,.94),rgba(24,22,29,.91));
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.7),inset 0 1px rgba(255,255,255,.04);
  -webkit-backdrop-filter: blur(20px) saturate(1.08);
  backdrop-filter: blur(20px) saturate(1.08);
  opacity: 0;
  pointer-events: none;
  transform: translate(28px,20px) scale(.96);
  transition: opacity 320ms var(--ease-finish),transform 600ms var(--ease-finish);
}
[dir="rtl"] .control-panel { right: auto; left: 22px; transform: translate(-28px,20px) scale(.96); }
.panel-open .control-panel { opacity: 1; pointer-events: auto; transform: translate(0) scale(1); }
.panel-open .topbar { padding-inline: 24px; }
.panel-grip { display: none; }
.panel-peek { display: none; }
.panel-header { position: relative; flex: none; padding: 26px 24px 18px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 8px 52px 8px 0; font-size: 1.65rem; font-weight: 500; letter-spacing: -.035em; }
[dir="rtl"] .panel-header h2 { margin: 8px 0 8px 52px; font-family: "IBM Plex Sans Arabic",Arial,sans-serif; }
.panel-header > p:last-of-type { max-width: 38ch; margin: 0; color: rgba(255,255,255,.59); font-size: .73rem; line-height: 1.5; }
.panel-close { position: absolute; top: 24px; right: 20px; }
[dir="rtl"] .panel-close { right: auto; left: 20px; }
.panel-debug-import { position: absolute; top: 24px; right: 116px; }
[dir="rtl"] .panel-debug-import { right: auto; left: 116px; }
.panel-debug-copy { position: absolute; top: 24px; right: 68px; }
[dir="rtl"] .panel-debug-copy { right: auto; left: 68px; }
.panel-debug-import[aria-busy="true"] svg { opacity: .45; }
.preset-debug-status { position: absolute; top: 31px; right: 168px; min-height: 28px; padding: 0 8px; border: 1px solid rgba(199,137,255,.52); border-radius: 999px; background: rgba(139,40,227,.14); color: #e7c9ff; font-size: .54rem; font-weight: 800; letter-spacing: .1em; transition: border-color 160ms,background 160ms,transform 160ms var(--ease-snap); }
.preset-debug-status:hover { border-color: rgba(218,176,255,.92); background: rgba(139,40,227,.3); transform: translateY(-1px); }
[dir="rtl"] .preset-debug-status { right: auto; left: 168px; }
.is-preset-debug .panel-header h2 { margin-right: 238px; }
[dir="rtl"] .is-preset-debug .panel-header h2 { margin-right: 0; margin-left: 238px; }
.panel-body { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--purple) transparent; scrollbar-width: thin; }
.tabs-shell { position: sticky; z-index: 5; top: 0; display: grid; grid-template-columns: minmax(0,1fr) 48px; min-height: 64px; padding: 0 8px; border-bottom: 1px solid var(--line); background: rgba(29,27,34,.9); transition: grid-template-columns 260ms var(--ease-finish); -webkit-backdrop-filter: blur(15px); backdrop-filter: blur(15px); }
.tabs-shell:not(.is-searchable) { grid-template-columns: minmax(0,1fr); }
.tabs-shell.has-search-query { grid-template-columns: minmax(0,1fr) minmax(92px,128px); }
.tabs { display: grid; grid-template-columns: repeat(4,1fr); min-width: 0; transition: opacity 150ms,transform 240ms var(--ease-finish); }
.tabs.has-secondary { grid-template-columns: repeat(5,1fr); }
.tab { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: transparent; color: rgba(255,255,255,.5); font-size: .67rem; font-weight: 600; }
.tab__icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.65; transition: transform 220ms var(--ease-snap); }
.tab::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 1px; background: var(--purple); content: ""; opacity: 0; transform: scaleX(.2); transition: opacity 120ms,transform 320ms var(--ease-finish); }
.tab.is-active { color: var(--white); }
.tab.is-active .tab__icon { color: #d8b2ff; transform: translateY(-1px) scale(1.06); }
.tab.is-active::after { opacity: 1; transform: scaleX(1); }
.preset-search-trigger { display: inline-flex; min-width: 44px; min-height: 44px; align-self: center; align-items: center; justify-content: center; gap: 6px; overflow: hidden; padding: 0 9px; border: 0; border-radius: 12px; background: transparent; color: rgba(255,255,255,.58); transition: color 160ms,background 160ms,opacity 150ms,transform 240ms var(--ease-finish); }
.preset-search-trigger:hover, .preset-search-trigger:focus-visible { background: rgba(139,40,227,.12); color: #e1c1ff; }
.preset-search-trigger > svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
.preset-search-trigger__summary { display: none; min-width: 0; overflow: hidden; font-size: .61rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tabs-shell.has-search-query .preset-search-trigger { justify-content: flex-start; background: rgba(139,40,227,.1); color: #dfbcff; }
.tabs-shell.has-search-query .preset-search-trigger__summary { display: block; }
.tabs-shell.is-searching .tabs, .tabs-shell.is-searching .preset-search-trigger { opacity: 0; pointer-events: none; transform: translateY(-4px); }
.preset-search { position: absolute; z-index: 2; inset: 0; display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: #1d1b22; animation: preset-search-in 220ms var(--ease-finish) both; }
.preset-search__field { display: flex; min-width: 0; min-height: 42px; flex: 1; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(255,255,255,.035); transition: border-color 180ms,box-shadow 180ms,background 180ms; }
.preset-search__field:focus-within { border-color: rgba(139,40,227,.78); background: rgba(139,40,227,.07); box-shadow: 0 0 0 3px rgba(139,40,227,.12); }
.preset-search__field > svg { width: 17px; height: 17px; flex: none; fill: none; stroke: rgba(255,255,255,.56); stroke-linecap: round; stroke-width: 1.8; }
.preset-search__field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--white); font-size: .7rem; }
.preset-search__field input::placeholder { color: rgba(255,255,255,.42); }
.preset-search__field input::-webkit-search-cancel-button, .preset-search__field input::-webkit-search-decoration { appearance: none; -webkit-appearance: none; }
.preset-search__clear, .preset-search__close { display: grid; width: 36px; height: 36px; flex: none; place-items: center; padding: 0; border: 0; border-radius: 10px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); transition: background 160ms,transform 180ms var(--ease-snap); }
.preset-search__clear { background: transparent; transition: color 160ms; }
.preset-search__clear:hover, .preset-search__clear:focus-visible { background: transparent; color: #e1c1ff; }
.preset-search__close:hover, .preset-search__close:focus-visible { background: rgba(139,40,227,.42); transform: scale(1.06); }
.preset-search__clear:focus-visible, .preset-search__close:focus-visible { outline: 2px solid #e1c1ff; outline-offset: 2px; }
.preset-search__clear:active { background: transparent; }
.preset-search__close:active { transform: scale(.94); }
.preset-search__clear:not([hidden]) { animation: search-clear-in 180ms var(--ease-snap) both; }
.preset-search__clear svg, .preset-search__close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.preset-search__clear svg { transition: transform 180ms var(--ease-snap); }
.preset-search__clear:hover svg, .preset-search__clear:focus-visible svg { transform: scale(1.15) rotate(-8deg); }
.preset-search__clear:active svg { transform: scale(.88) rotate(8deg); }
.preset-search__empty { margin: 9px 18px 0; color: #deb7ff; font-size: .59rem; line-height: 1.35; }
@keyframes preset-search-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes search-clear-in { from { opacity: 0; } to { opacity: 1; } }
.control-section { display: grid; gap: 15px; padding: 20px 18px 24px; }
.material-preset-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; min-width: 0; }
.material-preset-card { position: relative; min-width: 0; }
.material-preset-card > .material-preset-tile { width: 100%; }
.material-preset-grid--loading { pointer-events: none; }
.material-preset-skeleton { position: relative; display: block; min-height: 132px; overflow: hidden; border: 1px solid rgba(255,255,255,.06); border-radius: 12px; background: linear-gradient(145deg,rgba(255,255,255,.055),rgba(255,255,255,.018)); }
.material-preset-skeleton::before { position: absolute; inset: 7px; border-radius: 8px; background: linear-gradient(140deg,rgba(255,255,255,.08),rgba(255,255,255,.02) 50%,rgba(255,255,255,.075)); content: ""; }
.material-preset-skeleton::after { position: absolute; right: 9px; bottom: 10px; left: 9px; height: 24px; border-radius: 4px; background: linear-gradient(rgba(255,255,255,.08) 0 7px,transparent 7px 12px,rgba(255,255,255,.05) 12px 17px,transparent 17px); content: ""; }
.material-preset-skeleton { animation: preset-skeleton-pulse 1300ms ease-in-out 700ms infinite alternate; }
@keyframes preset-skeleton-pulse { to { border-color: rgba(190,136,243,.22); background-color: rgba(139,40,227,.11); box-shadow: 0 0 22px -12px rgba(181,105,255,.8); } }
.material-preset-tile {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 132px;
  grid-template-rows: 74px auto;
  gap: 8px;
  padding: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  text-align: start;
  touch-action: manipulation;
  transition: border-color 120ms,background 120ms,transform 120ms var(--ease-snap),box-shadow 120ms;
}
.material-preset-tile:hover { border-color: rgba(139,40,227,.56); transform: translateY(-2px); }
.material-preset-tile.is-active { border-color: rgba(139,40,227,.92); background: linear-gradient(145deg,rgba(139,40,227,.16),rgba(255,255,255,.035)); box-shadow: 0 0 0 1px rgba(139,40,227,.16); }
.material-preset-tile.is-search-match { animation: preset-filter-in 220ms var(--ease-finish) both; }
@keyframes preset-filter-in { from { opacity: .35; transform: translateY(5px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.material-preset-preview { position: relative; z-index: 1; display: block; min-height: 74px; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: #111; }
.material-preset-preview--primary { width: 100%; height: 74px; min-height: 0; object-fit: fill; }
.material-preset-preview::before, .material-preset-preview::after { position: absolute; content: ""; pointer-events: none; }
.material-preset-preview--windows, .material-preset-preview--headlights { background: linear-gradient(135deg,#05070a,#27333c 52%,#080b0e); }
.material-preset-preview--windows::before { inset: 10px 13px 9px; border: 1px solid rgba(195,221,233,.35); border-radius: 44% 12% 40% 12%; background: linear-gradient(128deg,transparent 24%,rgb(235 248 255 / var(--glass-reflection)) 39%,transparent 47%),linear-gradient(145deg,#426174,#0a1520 46%,#172b37),linear-gradient(var(--glass-filter),var(--glass-filter)); background-blend-mode: screen,multiply,normal; box-shadow: inset 0 0 22px rgb(0 0 0 / calc(.2 + var(--glass-tint)*.7)); filter: brightness(calc(1 - var(--glass-tint)*.54)); }
.material-preset-preview--windows::after { inset: 30px 29px 17px 25px; border-radius: 3px 12px 12px 5px; background: linear-gradient(90deg,transparent 0 22%,#8d694d 23% 41%,transparent 42% 55%,#8d694d 56% 76%,transparent 77%),linear-gradient(#11202d,#05090d); opacity: var(--glass-detail); }
.material-preset-preview--headlights::before { inset: 13px 12px; border: 1px solid rgb(222 242 255 / calc(.28 + var(--lens-highlight)*.38)); border-radius: 58% 13% 52% 13%; background: linear-gradient(120deg,transparent 25%,rgb(255 255 255 / var(--lens-highlight)) 40%,transparent 47%),linear-gradient(130deg,#a1b7c1,#1e2c33 34%,#030506 61%,#526d79); box-shadow: inset 0 0 16px rgb(0 0 0 / calc(.3 + var(--lens-darkness)*.5)); filter: brightness(calc(1 - var(--lens-darkness)*.35)); }
.material-preset-tile__content { position: relative; z-index: 1; display: grid; min-width: 0; gap: 2px; padding: 0 2px 1px; }
.material-preset-tile__content strong, .material-preset-tile__content small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-preset-tile__content strong { font-size: .67rem; font-weight: 600; }
.material-preset-tile__content small { color: rgba(255,255,255,.5); font-size: .56rem; }
.material-preset-tile__sheen { position: absolute; z-index: 2; top: 7px; right: 7px; left: 7px; height: 74px; overflow: hidden; border-radius: 8px; background: linear-gradient(116deg,transparent 28%,rgba(255,255,255,.05) 40%,rgba(245,244,255,.76) 49%,rgba(255,255,255,.08) 57%,transparent 70%); mix-blend-mode: screen; opacity: 0; pointer-events: none; filter: blur(var(--tile-sheen-blur,4px)); transition: opacity 180ms var(--ease-finish); }
.material-preset-tile:hover .material-preset-tile__sheen, .material-preset-tile.is-active .material-preset-tile__sheen { opacity: var(--tile-sheen-opacity,0); animation: tile-reflection-sweep 620ms var(--ease-sweep) both; }
@keyframes tile-reflection-sweep { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
.material-preset-tile__check { position: absolute; z-index: 3; top: 12px; right: 12px; display: grid; width: 20px; height: 20px; place-items: center; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; color: transparent; background: rgba(12,11,14,.7); opacity: 0; transform: scale(.72); transition: opacity 120ms,transform 120ms var(--ease-snap),color 120ms,background 120ms; }
[dir="rtl"] .material-preset-tile__check { right: auto; left: 12px; }
.material-preset-tile__check::before { width: 8px; height: 4px; border-bottom: 2px solid currentColor; border-left: 2px solid currentColor; content: ""; transform: translateY(-1px) rotate(-45deg); }
.material-preset-tile.is-active .material-preset-tile__check { color: #fff; background: var(--purple); border-color: var(--purple); opacity: 1; transform: scale(1); }
.material-preset-tile__settings { position: absolute; z-index: 4; top: 10px; right: 10px; display: grid; width: 44px; height: 44px; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.24); border-radius: 11px; background: rgba(15,13,19,.82); color: #f0d8ff; box-shadow: 0 8px 18px -12px #000; opacity: 0; transform: translateY(-4px) scale(.92); transition: opacity 160ms,transform 160ms var(--ease-snap),border-color 160ms,background 160ms; }
.is-preset-debug .material-preset-tile__settings { opacity: 1; transform: none; }
.material-preset-tile__settings:hover { border-color: rgba(207,148,255,.85); background: rgba(139,40,227,.45); }
.material-preset-tile__settings svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.is-preset-debug .material-preset-tile__check { right: auto; left: 12px; }
[dir="rtl"] .material-preset-tile__settings { right: auto; left: 10px; }
[dir="rtl"] .is-preset-debug .material-preset-tile__check { right: 12px; left: auto; }
.control-note { margin: 0; color: rgba(255,255,255,.45); font-size: .59rem; line-height: 1.45; }
.panel-footer { display: flex; min-height: 44px; flex: none; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--line); color: rgba(255,255,255,.46); font-size: .56rem; }
.status-chip { color: rgba(255,255,255,.58); white-space: nowrap; }

.colour-field, .slider-stack, .preset-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); font-size: .68rem; }
.colour-field { grid-template-columns: 1fr auto auto; align-items: center; }
.colour-field input { width: 38px; height: 30px; padding: 0; border: 0; background: transparent; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--swatch); }
.swatch.black { --swatch:#1e2429; }.swatch.silver { --swatch:#a7afb4; }.swatch.white { --swatch:#eeefed; }.swatch.red { --swatch:#9f1422; }.swatch.green { --swatch:#173f34; }.swatch.violet { --swatch:#43225f; }
.slider-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.slider-row input { grid-column: 1/-1; width: 100%; accent-color: var(--purple); }
.preset-row { grid-template-columns: repeat(4,1fr); }
.preset-row button { min-height: 36px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.04); font-size: .6rem; }

.preset-debug-editor { position: fixed; z-index: 60; top: 94px; right: 22px; bottom: 22px; left: auto; width: 388px; height: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 1px solid rgba(201,142,255,.36); border-radius: 22px; background: linear-gradient(155deg,rgba(43,39,52,.98),rgba(22,20,28,.98)); color: var(--white); box-shadow: 0 26px 76px -28px rgba(0,0,0,.92),inset 0 1px rgba(255,255,255,.06); -webkit-backdrop-filter: blur(24px) saturate(1.1); backdrop-filter: blur(24px) saturate(1.1); }
.preset-debug-editor[open] { display: flex; flex-direction: column; overflow: hidden; }
.preset-debug-editor::backdrop { background: transparent; }
.preset-debug-editor__shell { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; overflow: hidden; }
.preset-debug-editor__header { display: flex; min-height: 82px; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: rgba(30,27,36,.88); }
.preset-debug-editor__identity { display: flex; min-width: 0; align-items: center; gap: 11px; }
.preset-debug-editor__swatch { width: 42px; height: 42px; flex: none; border: 1px solid rgba(255,255,255,.28); border-radius: 13px; background: linear-gradient(145deg,rgba(255,255,255,.36),transparent 44%),var(--debug-swatch); box-shadow: inset 0 1px rgba(255,255,255,.24),0 8px 20px -13px #000; }
.preset-debug-editor__copy { display: grid; min-width: 0; gap: 3px; }
.preset-debug-editor__copy h2 { overflow: hidden; margin: 0; font-size: .84rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.preset-debug-editor__badge { width: max-content; max-width: 100%; padding: 3px 6px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; color: rgba(255,255,255,.62); font-size: .5rem; font-weight: 700; letter-spacing: .04em; }
.preset-debug-editor__badge { border-color: rgba(202,139,255,.52); background: rgba(139,40,227,.16); color: #e8caff; }
.preset-debug-editor__actions { display: flex; flex: none; gap: 4px; }
.preset-debug-editor__icon { width: 44px; min-width: 44px; min-height: 44px; padding: 0; border-color: transparent; background: transparent; }
.preset-debug-editor__icon:hover { border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.07); }
.preset-debug-editor__form { min-height: 0; flex: 1 1 0; padding: 10px 13px 20px; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; scroll-padding-block: 14px 28px; scrollbar-color: var(--purple) transparent; scrollbar-width: thin; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.preset-debug-error { margin: 2px 0 10px; padding: 9px 10px; border: 1px solid rgba(255,117,148,.48); border-radius: 10px; background: rgba(176,33,69,.16); color: #ffbed0; font-size: .6rem; line-height: 1.45; }
.preset-debug-base { margin-bottom: 8px; }
.preset-debug-section { border-bottom: 1px solid rgba(255,255,255,.08); }
.preset-debug-section[open] { padding-bottom: 12px; }
.preset-debug-section__summary { display: flex; min-height: 48px; align-items: center; justify-content: space-between; color: rgba(255,255,255,.84); cursor: pointer; font-size: .68rem; font-weight: 700; letter-spacing: .015em; list-style: none; scroll-margin-block: 14px; }
.preset-debug-section__summary::-webkit-details-marker { display: none; }
.preset-debug-section__summary::after { width: 7px; height: 7px; margin-inline: 8px 3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; content: ""; transform: rotate(45deg) translateY(-2px); transition: transform 160ms var(--ease-snap); }
.preset-debug-section[open] > .preset-debug-section__summary::after { transform: rotate(225deg) translate(-2px,-2px); }
.preset-debug-section__body { display: grid; gap: 9px; }
.preset-debug-effect-section { margin-top: 2px; padding: 0 9px; border: 1px solid rgba(255,255,255,.1); border-radius: 11px; background: rgba(255,255,255,.022); }
.preset-debug-effect-section[open] { padding-bottom: 9px; }
.preset-debug-effect-section .preset-debug-section__summary { min-height: 44px; color: #d9b6f8; font-size: .62rem; }
.preset-debug-field { display: grid; min-inline-size: 0; gap: 6px; margin: 0; padding: 10px; border: 1px solid rgba(255,255,255,.09); border-radius: 11px; background: rgba(255,255,255,.028); }
.preset-debug-field__label { padding: 0; color: rgba(255,255,255,.72); font-size: .59rem; font-weight: 650; }
.preset-debug-field__hint { color: rgba(255,255,255,.42); font-size: .53rem; line-height: 1.35; }
.preset-debug-input, .preset-debug-number { width: 100%; min-height: 44px; box-sizing: border-box; padding: 0 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; outline: 0; background: rgba(8,7,10,.28); color: var(--white); font-size: .65rem; transition: border-color 150ms,box-shadow 150ms,background 150ms; scroll-margin-block: 14px; }
.preset-debug-input:focus, .preset-debug-number:focus, .preset-debug-input:focus-visible, .preset-debug-number:focus-visible { border-color: rgba(185,108,255,.9); background: rgba(139,40,227,.09); box-shadow: 0 0 0 3px rgba(139,40,227,.16); }
.preset-debug-input:disabled { color: rgba(255,255,255,.4); cursor: not-allowed; }
.preset-debug-input.is-invalid, .preset-debug-number.is-invalid { border-color: #ed7092; box-shadow: 0 0 0 2px rgba(232,71,112,.13); }
.preset-debug-colour-control { display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 8px; }
.preset-debug-colour-control__well { width: 44px; height: 44px; padding: 3px; border: 1px solid rgba(255,255,255,.16); border-radius: 9px; background: rgba(255,255,255,.04); }
.preset-debug-colour-control__hex { min-width: 0; }
.preset-debug-unit-control { display: grid; grid-template-columns: minmax(0,1fr) 70px; align-items: center; gap: 10px; }
.preset-debug-range { width: 100%; height: 44px; accent-color: #b96cff; }
.preset-debug-number { min-width: 0; padding-inline: 8px; text-align: center; }
.preset-debug-segmented { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }
.preset-debug-segmented__button { min-height: 38px; padding: 4px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: rgba(255,255,255,.025); color: rgba(255,255,255,.62); font-size: .56rem; }
.preset-debug-segmented__button[aria-pressed="true"] { border-color: rgba(185,108,255,.86); background: rgba(139,40,227,.23); color: #f0ddff; box-shadow: inset 0 1px rgba(255,255,255,.08); }
.preset-debug-subheading { margin: 7px 0 -1px; color: #d7b2f8; font-size: .58rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.preset-debug-add-effect { display: grid; gap: 7px; margin-top: 4px; padding: 10px; border: 1px dashed rgba(202,139,255,.42); border-radius: 11px; background: rgba(139,40,227,.06); }
.preset-debug-add-effect__label { margin: 0; color: rgba(237,215,255,.88); font-size: .59rem; font-weight: 700; }
.preset-debug-add-effect__actions { display: flex; flex-wrap: wrap; gap: 7px; }
.preset-debug-add-effect__button { min-height: 44px; padding: 0 12px; border: 1px solid rgba(202,139,255,.4); border-radius: 9px; background: rgba(139,40,227,.12); color: #f0dcff; font-size: .6rem; }
.preset-debug-add-effect__button:hover { border-color: rgba(215,165,255,.9); background: rgba(139,40,227,.28); }
[dir="rtl"] .preset-debug-editor { right: auto; left: 22px; }

.vehicle-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); min-width: 0; gap: 10px; }
.vehicle-option { position: relative; display: grid; min-width: 44px; min-height: 44px; grid-template-rows: auto auto; align-content: start; gap: 9px; padding: 8px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); text-align: start; touch-action: manipulation; transition: border-color 160ms,transform 180ms var(--ease-snap),box-shadow 180ms; }
.vehicle-option:focus-visible { border-color: #dcb6ff; box-shadow: 0 0 0 3px rgba(185,108,255,.32),0 12px 26px -18px rgba(0,0,0,.92); }
.vehicle-option[aria-selected="true"] { border-color: rgba(185,108,255,.98); box-shadow: 0 0 0 1px rgba(185,108,255,.35),inset 0 0 0 1px rgba(255,255,255,.13); }
.vehicle-option[aria-selected="true"]::after { position: absolute; z-index: 1; top: 10px; inset-inline-end: 10px; display: grid; width: 20px; height: 20px; place-items: center; border: 1px solid rgba(235,215,255,.7); border-radius: 50%; background: #8b28e3; color: white; content: "✓"; font-size: .68rem; font-weight: 800; box-shadow: 0 3px 12px rgba(0,0,0,.35); }
.vehicle-option img { display: block; width: 100%; aspect-ratio: 13 / 8; border-radius: 9px; object-fit: cover; }
.vehicle-option-label { display: block; min-width: 0; padding: 0 2px 1px; }
.vehicle-option-label strong { display: block; overflow: hidden; color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }

@media (hover:hover) and (pointer:fine) {
  .vehicle-option:hover { border-color: rgba(185,108,255,.84); transform: translateY(-2px); box-shadow: 0 12px 26px -18px rgba(0,0,0,.92); }
}

.offline-notice { position: fixed; z-index: 30; right: 18px; bottom: max(18px,env(safe-area-inset-bottom)); max-width: 340px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(27,25,32,.96); box-shadow: 0 20px 60px -20px #000; font-size: .7rem; line-height: 1.45; }
[dir="rtl"] .offline-notice { right: auto; left: 18px; }

:focus-visible { outline: 2px solid #b96cff; outline-offset: 3px; }

@media (max-width:700px) {
  :root { --chrome-top: calc(env(safe-area-inset-top, 0px) + 78px); }
  .canvas-frame { top: 0; right: 0; bottom: auto; left: 0; height: 68dvh; transition: height 600ms var(--ease-finish); }
  .preview-canvas { width: 100%; height: 100%; object-position: var(--crop-x-mobile-closed) var(--crop-y-mobile-closed); --preview-base-scale: var(--scale-mobile-closed); }
  .panel-open .canvas-frame { height: calc(47dvh + 16px); }
  .panel-open .preview-canvas { object-position: var(--crop-x-mobile-open) var(--crop-y-mobile-open); --preview-base-scale: var(--scale-mobile-open); }
  .canvas-frame::after { background: linear-gradient(180deg,rgba(8,7,10,.36),transparent 16%,transparent 70%,rgba(8,7,10,.72) 96%),radial-gradient(90% 70% at 50% 57%,transparent 50%,rgba(8,7,10,.13)); }
  .mobile-edge-extension {
    --edge-overlap: 48px;
    position: absolute;
    z-index: 2;
    top: calc(68dvh - var(--edge-overlap));
    right: -22px;
    left: -22px;
    display: block;
    height: calc(27dvh + var(--edge-overlap));
    overflow: visible;
    opacity: .9;
    pointer-events: none;
    transition: opacity 360ms var(--ease-finish);
    -webkit-mask-image: linear-gradient(180deg,transparent 0,#000 16%,#000 57%,rgba(0,0,0,.78) 72%,transparent 100%);
    mask-image: linear-gradient(180deg,transparent 0,#000 16%,#000 57%,rgba(0,0,0,.78) 72%,transparent 100%);
  }
  .mobile-edge-extension::before { position: absolute; z-index: 2; top: calc(var(--edge-overlap) - 38px); right: 0; left: 0; height: 76px; background: rgba(15,10,20,.08); -webkit-backdrop-filter: blur(18px) saturate(1.08); backdrop-filter: blur(18px) saturate(1.08); content: ""; -webkit-mask-image: linear-gradient(180deg,transparent,#000 34%,#000 66%,transparent); mask-image: linear-gradient(180deg,transparent,#000 34%,#000 66%,transparent); }
  .mobile-edge-extension canvas { display: block; width: 100%; height: 100%; filter: blur(14px) saturate(1.08) brightness(.68); transform: scale(1.1); transform-origin: top center; }
  .panel-open .mobile-edge-extension { opacity: 0; }
  .topbar { flex-wrap: wrap; min-height: 70px; gap: 6px; padding: max(10px,env(safe-area-inset-top)) 8px 8px; }
  .topbar::before { background: linear-gradient(180deg,rgba(12,11,15,.62),rgba(12,11,15,.18) 70%,transparent); -webkit-backdrop-filter: blur(12px) saturate(1.06); backdrop-filter: blur(12px) saturate(1.06); }
  .brand { width: 96px; height: 42px; }
  .vehicle-id { display: none; }
  .top-actions { flex-shrink: 0; gap: 4px; }
  .icon-button, .text-button { min-width: 42px; min-height: 42px; padding-inline: 12px; }
  .sfx-toggle { min-width: 42px; padding-inline: 11px; }
  .button-label { display: none; }
  .stage-tools { top: var(--chrome-top); left: 12px; flex-direction: column; gap: 6px; }
  [dir="rtl"] .stage-tools { right: 12px; left: auto; }
  .stage-tools .stage-tool { width: 44px; min-width: 44px; min-height: 44px; flex: none; }
  .preview-gesture-hint { bottom: calc(var(--panel-peek) + 20px); max-width: calc(100vw - 32px); text-align: center; }
  .panel-open .preview-gesture-hint { opacity: 0; }
  .scrim { background: rgba(7,6,9,.1); }
  .panel-open .scrim { opacity: 1; pointer-events: auto; }
  .control-panel, [dir="rtl"] .control-panel { top: auto; right: 10px; bottom: 10px; left: 10px; width: auto; height: min(80dvh,calc(min(53dvh,480px) + max(0px,12rem - 192px))); border-radius: 24px; opacity: 0; pointer-events: none; transform: translateY(28px) scale(.97); }
  .panel-open .control-panel { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
  .panel-open .stage-tools { opacity: 0; pointer-events: none; }
  .panel-open .topbar { padding-inline: 12px; }
  .panel-grip { display: block; width: 42px; height: 4px; flex: none; margin: 8px auto 2px; border-radius: 99px; background: rgba(255,255,255,.26); }
  .panel-header { min-height: 54px; padding: 8px 58px 8px 18px; }
  [dir="rtl"] .panel-header { padding: 8px 18px 8px 58px; }
  .panel-header h2 { margin: 2px 0 0; font-size: 1.12rem; line-height: 1.1; }
  .is-preset-debug .panel-header h2, [dir="rtl"] .is-preset-debug .panel-header h2 { margin: 2px 200px 0 0; }
  [dir="rtl"] .is-preset-debug .panel-header h2 { margin: 2px 0 0 200px; }
  .panel-header > p:last-of-type, .panel-kicker { display: none; }
  .panel-close { top: 6px; right: 12px; }
  [dir="rtl"] .panel-close { right: auto; left: 12px; }
  .panel-debug-import { top: 6px; right: 100px; }
  [dir="rtl"] .panel-debug-import { right: auto; left: 100px; }
  .panel-debug-copy { top: 6px; right: 56px; }
  [dir="rtl"] .panel-debug-copy { right: auto; left: 56px; }
  .preset-debug-status { top: 16px; right: 154px; min-height: 24px; padding-inline: 6px; font-size: .48rem; }
  [dir="rtl"] .preset-debug-status { right: auto; left: 154px; }
  .tabs-shell { min-height: 58px; }
  .tabs-shell.has-search-query { grid-template-columns: minmax(0,1fr) minmax(80px,96px); }
  .tabs, .tabs.has-secondary { grid-template-columns: repeat(auto-fit,minmax(min(100%,3.5rem),1fr)); }
  .tab { min-width: 0; flex-direction: column; gap: 4px; padding: 8px 2px; font-size: .64rem; }
  .tab > span { max-width: 100%; overflow-wrap: anywhere; line-height: 1.25; }
  .tab__icon { width: 15px; height: 15px; }
  .preset-search { padding: 7px 10px; }
  .preset-search__field { min-height: 38px; }
  .preset-search__empty { margin-top: 6px; }
  .control-section { gap: 10px; padding: 10px 12px 16px; }
  .material-preset-grid { grid-auto-columns: auto; grid-auto-flow: row; grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-rows: none; gap: 8px; overflow: visible; overscroll-behavior: auto; padding: 2px 2px 10px; scroll-snap-type: none; }
  .material-preset-skeleton { min-height: 130px; }
  .material-preset-tile { min-height: 130px; grid-template-rows: 78px auto; }
  .material-preset-preview { min-height: 78px; }
  .material-preset-preview--primary { height: 78px; min-height: 0; }
  .material-preset-tile__sheen { height: 78px; }
  .material-preset-tile__settings { top: 8px; right: 8px; width: 44px; height: 44px; opacity: 1; transform: none; }
  [dir="rtl"] .material-preset-tile__settings { right: auto; left: 8px; }
  .is-preset-debug .material-preset-tile__check { left: 9px; }
  [dir="rtl"] .is-preset-debug .material-preset-tile__check { right: 9px; left: auto; }
  /* Match the finish panel's sheet geometry so calibration keeps the car in view. */
  .preset-debug-editor, [dir="rtl"] .preset-debug-editor { top: auto; right: 10px; bottom: 10px; left: 10px; width: auto; height: min(53dvh,480px); max-height: none; border-radius: 22px; }
  .preset-debug-editor__header { min-height: 72px; padding: 10px 12px; }
  .preset-debug-editor__form { padding: 8px 10px 14px; }
  .preset-debug-input, .preset-debug-number { font-size: 16px; }
  .panel-footer { display: none; }
  .ui-booting.panel-open .canvas-frame { height: 68dvh; }
  .ui-booting.panel-open .preview-canvas { object-position: var(--crop-x-mobile-closed) var(--crop-y-mobile-closed); --preview-base-scale: var(--scale-mobile-closed); }
  .ui-booting.panel-open .mobile-edge-extension { opacity: 1; }
  .ui-booting.panel-open .scrim { opacity: 0; pointer-events: none; }
  .ui-booting.panel-open .control-panel { opacity: 0; pointer-events: none; transform: translateY(28px) scale(.97); }
  .ui-booting.panel-open .stage-tools { opacity: 1; }
}

@media (max-width:350px) {
  .topbar { gap: 4px; padding-inline: 6px; }
  .brand { width: 82px; }
  .top-actions { gap: 3px; }
  .top-actions .quote-button { gap: 5px; padding-inline: 7px; }
  .icon-button, .text-button { min-width: 40px; min-height: 40px; padding-inline: 10px; }
  .sfx-toggle { min-width: 40px; padding-inline: 10px; }
  .canvas-frame { height: 67dvh; }
  .mobile-edge-extension { --edge-overlap: 44px; top: calc(67dvh - var(--edge-overlap)); height: calc(28dvh + var(--edge-overlap)); }
  .panel-open .canvas-frame { height: calc(47dvh + 12px); }
  .control-panel, [dir="rtl"] .control-panel { right: 8px; bottom: 8px; left: 8px; }
  .preset-debug-editor, [dir="rtl"] .preset-debug-editor { right: 8px; bottom: 8px; left: 8px; height: 53dvh; }
  .tabs-shell.has-search-query { grid-template-columns: minmax(0,1fr) minmax(74px,86px); }
  body.embed-mode .tab { gap: 2px; padding-inline: 2px; }
  .stage-tools .stage-tool { width: 44px; min-width: 44px; min-height: 44px; }
  .material-preset-grid { gap: 7px; }
  .material-preset-tile, .material-preset-skeleton { min-height: 124px; }
  .material-preset-tile { grid-template-rows: 74px auto; padding: 6px; }
  .material-preset-preview { min-height: 74px; }
  .material-preset-preview--primary, .material-preset-tile__sheen { height: 74px; }
}

@media (max-width:700px) and (orientation:portrait) {
  /* The closed canvas ends at 68dvh and the sheet's bottom inset is 10px, so this
     peek height lands the sheet's top edge exactly where the car stops -- there is
     no dead band left between them. */
  :root { --panel-peek: calc(32dvh - 10px); }
  body:not(.panel-open) .control-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(calc(100% - var(--panel-peek)));
  }
  /* Above .tabs-shell (z-index 5), which is sticky and would otherwise stay
     tappable through the cover. */
  body:not(.panel-open) .panel-peek {
    display: block;
    position: absolute;
    z-index: 10;
    inset: 0;
    border: 0;
    background: transparent;
    touch-action: none;
    user-select: none;
  }
  body:not(.panel-open) .panel-close { opacity: 0; }
  .panel-header, .panel-grip { touch-action: none; user-select: none; }
  /* Disables the transform transition while panel-drag.js is driving it 1:1 with the
     finger; removed at gesture release so the class-driven transform finishes the snap. */
  .panel-dragging { transition: none !important; }
  /* Boot starts at .panel-open, and studio.js clears it in the same task that drops
     .ui-booting. Parking the booting state on the peek geometry keeps that swap from
     animating the sheet down from its open position on first paint. */
  .ui-booting.panel-open .control-panel { opacity: 1; transform: translateY(calc(100% - var(--panel-peek))); }
}

@media (max-width:350px) and (orientation:portrait) {
  :root { --panel-peek: calc(33dvh - 10px); }
}

@media (hover:none) and (pointer:coarse) {
  .preset-search__field input { font-size: 16px; }
}

@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .media-sweep { left: 38%; opacity: .18; animation: none; }
  [dir="rtl"] .media-sweep { right: 38%; left: auto; }
}
.force-reduced-motion *, .force-reduced-motion *::before, .force-reduced-motion *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
.force-reduced-motion .media-sweep { left: 38%; opacity: .18; animation: none; }
[dir="rtl"] .force-reduced-motion .media-sweep { right: 38%; left: auto; }
