/*
 * 
 *  DESIGN SYSTEM — Shared UI Language
 *  For: Model Editor · Radial Studio · Sculpt Studio · Shape Forge
 * 
 *  TYPOGRAPHY FLOOR: 11px minimum (scaled). Nothing smaller.
 *  COLOR FLOOR: #666666 minimum darkness. Nothing darker.
 *
 *  SECTIONS:
 *    1.  Tokens (CSS variables)
 *    2.  Reset + Base
 *    3.  Page Tabs
 *    4.  Sidebars
 *    5.  Panel Chrome (titles, sections, descriptions)
 *    6.  Buttons — variant x color x size, composable
 *    7.  Toolbar + Toolbar Buttons
 *    8.  Dropdown Menus
 *    9.  Sliders
 *   10.  Number Inputs
 *   11.  Collapsible Sections
 *   12.  Library Grid
 *   13.  Toast
 *   14.  Modal / Overlay
 *   15.  Context Menu
 *   16.  Scrollbars
 *   17.  Zoom Controls
 *   18.  Shape Parameter Panels
 * 
 */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Inter:wght@300;400;500;600;700&display=swap');

/* ─────────────────────────────────────────────
   1. DESIGN TOKENS
   ───────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:        #09090c;
  --panel:     #0f1018;
  --panel2:    #14161f;
  --panel3:    #1a1d28;   /* hover / elevated surface */

  /* Borders */
  --border:    #1e2130;
  --border-hi: #2e3448;   /* highlighted border */

  /* Brand accents */
  --accent:    #7dd3fc;   /* sky blue — primary */
  --accent2:   #fb923c;   /* amber — secondary / active */
  --green:     #4ade80;
  --purple:    #c084fc;
  --red:       #f87171;

  /* Extended palette — same lightness/saturation family as brand accents */
  --color-yellow: #fde047;   /* yellow-300   — warm, matches accent2 brightness  */
  --color-gray:   #94a3b8;   /* slate-400    — neutral, desaturated, same L range */
  --color-brown:  #c4a882;   /* warm tan     — desaturated amber at same lightness */
  --color-white:  #e2e8f0;   /* slate-200    — near-white, visible as swatch on dark */

  /* Text */
  --text:      #c9cde4;
  --text-dim:  #a2aabb;   /* ≥ #666 — secondary labels */
  --text-strong: #dadada;
  --muted:     #777f95;   /* ≥ #666 — floor */

  /* Typography */
  --mono:      'Share Tech Mono', monospace;
  --display:   'Inter', sans-serif;

  /* Spacing rhythm */
  --gap-xs:  4px;
  --gap-sm:  8px;
  --gap-md:  12px;
  --gap-lg:  16px;

  /* Radius */
  --r-sm:  3px;
  --r-md:  5px;
  --r-lg:  8px;

  --header-h: 36px;   /* app header (#page-tabs) height; overridden on mobile */
}

html[data-theme="light"] {
  /* Set inline by applyTheme() → !important is the only way past it */
  --text:        #1c1b18 !important;   /* was #c9cde4 */
  --muted:       #5f5d55 !important;   /* was #777f95 (applyTheme's #7a786e is 3.2:1 on --panel3) */

  /* Not touched by applyTheme → plain declaration wins on specificity */
  --text-strong: #14130f;              /* was #dadada */
  --text-dim:    #4a4840;              /* was #a2aabb */
}

/* ─────────────────────────────────────────────
   2. RESET + BASE
   ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--display);
  font-size: 12px;
  line-height: 1.4;
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
  text-rendering: optimizeLegibility;
}


/* ─────────────────────────────────────────────
   3. PAGE TABS  (top 36 px bar)
   ───────────────────────────────────────────── */
#page-tabs {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 500;
}

.page-tab {
  padding: 0 20px;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  border-right: 1px solid var(--border);
  transition: color .15s, background .15s;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  user-select: none;
}
.page-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,.03);
}
.page-tab.active {
  color: var(--accent2);
  background: rgba(251,146,60,.07);
  border-bottom: 2px solid var(--accent2);
}
/* Small colored dot decoration */
.page-tab .tab-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .6;
  flex-shrink: 0;
}
/* Emoji / icon before label */
.page-tab .tab-icon {
  font-size: 12px;
  opacity: .7;
  flex-shrink: 0;
}
.page-tab.active .tab-icon { opacity: 1; }

/* Pushes Edit-menu to the right */
#tab-spacer { flex: 1; }


/* ─────────────────────────────────────────────
   4. SIDEBARS
   ───────────────────────────────────────────── */
.sidebar {
  background: var(--panel);
  border-color: var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-left  { border-right:  1px solid var(--border); }
.sidebar-right { border-left:   1px solid var(--border); }

/* Scrollable interior */
.sidebar-scroll {
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}


/* ─────────────────────────────────────────────
   5. PANEL CHROME
   ───────────────────────────────────────────── */

/* ── Primary panel title (top of a sidebar) ── */
.panel-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  padding: 11px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Amber variant (secondary panels) */
.panel-title.amber { color: var(--accent2); }
/* Purple variant */
.panel-title.purple { color: var(--purple); }

/* ── Section header inside a panel ── */
.panel-section {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px 10px;
}
.panel-section-title {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
  user-select: none;
}

/* ── Row layout inside a section ── */
.panel-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}
.panel-row:last-child { margin-bottom: 0; }

/* ── Labels ── */
.panel-label {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
  user-select: none;
  letter-spacing: .3px;
}
/* Fixed-width label column (use width utility on element: style="width:60px") */
.panel-label-fixed {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 60px;
  user-select: none;
}

/* ── Description / hint text ── */
.panel-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.65;
  letter-spacing: .2px;
  padding: 4px 0;
}
.hint-box {
  background: rgba(125,211,252,.04);
  border: 1px solid rgba(125,211,252,.12);
  border-radius: var(--r-md);
  padding: 9px 11px;
  margin-bottom: 8px;
}
.hint-box p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 4px;
}
.hint-box p:last-child { margin-bottom: 0; }
.hint-step { color: var(--accent2); font-weight: bold; }

/* ── Value readout (number beside slider) ── */
.panel-value {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--mono);
  min-width: 28px;
  text-align: right;
  flex-shrink: 0;
}
.panel-value.amber { color: var(--accent2); }
.panel-value.green { color: var(--green); }
.panel-value.purple { color: var(--purple); }


/* ─────────────────────────────────────────────
   6. BUTTONS
   ─────────────────────────────────────────────

   COMPOSE:   .btn-<variant>  +  .btn-<color>  +  .btn-<size>  +  state

   VARIANTS   btn-action    outlined tint — the panel CTA (full width)
              btn-solid     filled, dark label — one per screen, max
              btn-outline   outlined, transparent — secondary action
              btn-ghost     no chrome until hover — inline / dense rows
              btn-pill      small tag-shaped toggle
              btn-snap      micro label button, sits inside control rows
              btn-icon      square, icon only
              btn-tertiary  deprecated → use .btn-outline.btn-gray

   COLORS     btn-accent (default) · btn-accent2 · btn-green
              btn-purple · btn-red · btn-gray · btn-yellow
              legacy aliases still work: .amber = accent2, .danger = red, .green

   SIZES      btn-xs · btn-sm · btn-md (default) · btn-lg
              .btn-minor is an alias of .btn-sm (kept for existing markup)

   STATES     :hover · :active · .active (sticky/selected) · :focus-visible
              :disabled / .disabled / [aria-disabled="true"]

   ICONS      any <svg>, .icon or .btn-ico child is auto-sized to the button;
              .btn-ico-text for emoji/glyphs; .btn-icon-only collapses to square

   LAYOUT     .btn-block (full width) · .btn-auto (undo full width)

   Every variant reads the same knobs, so one color class or one size class
   works across all of them — no per-variant overrides needed:

     --btn-c    color          --btn-h    height       --btn-px  side padding
     --btn-hc   hover color    --btn-fs   font size    --btn-ico icon size
     --btn-hb   hover border   --btn-gap  icon gap     --btn-ls  letterspacing
     --btn-hbg  hover fill     --btn-r    radius       --btn-on  label on solid

   To add a color, add one line to the COLOR MODIFIERS block below.
   ───────────────────────────────────────────── */

/* ── Defaults. :where() = zero specificity, so every class below wins ── */
:where(.btn, .btn-action, .btn-solid, .btn-outline, .btn-ghost,
       .btn-pill, .btn-snap, .btn-icon, .btn-tertiary, .btn-minor) {
  /* color */
  --btn-c:   var(--accent);
  --btn-on:  var(--bg);                      /* label color on a solid fill */
  --btn-hc:  var(--text);                    /* neutral hover unless a color class is set */
  --btn-hb:  var(--border-hi);
  --btn-hbg: rgba(255,255,255,.05);

  /* derived tint ramp — re-resolves whenever --btn-c changes */
  --btn-fill:   color-mix(in srgb, var(--btn-c)  9%, transparent);
  --btn-fill-h: color-mix(in srgb, var(--btn-c) 20%, transparent);
  --btn-fill-a: color-mix(in srgb, var(--btn-c) 28%, transparent);
  --btn-edge:   color-mix(in srgb, var(--btn-c) 45%, transparent);

  /* size — md */
  --btn-h:   26px;
  --btn-px:  10px;
  --btn-fs:  11px;
  --btn-ico: 14px;
  --btn-gap: 6px;
  --btn-ls:  1px;
  --btn-r:   var(--r-sm);
}

/* ── Shared box ── */
.btn, .btn-action, .btn-solid, .btn-outline, .btn-ghost,
.btn-pill, .btn-snap, .btn-icon, .btn-tertiary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--btn-gap);
  height: var(--btn-h);
  padding: 0 var(--btn-px);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--btn-r);
  color: var(--btn-c);
  font-family: var(--display);
  font-size: var(--btn-fs);
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .14s, border-color .14s, color .14s, opacity .14s;
}


/* ─────────  VARIANTS  ───────── */

/* ── Action — outlined tint, full-width panel CTA ── */
.btn-action {
  --btn-h:  30px;
  --btn-ls: 2px;
  width: 100%;
  background: var(--btn-fill);
  border-color: var(--btn-c);
  letter-spacing: var(--btn-ls);
  text-transform: uppercase;
}
.btn-action:hover  { background: var(--btn-fill-h); }
.btn-action:active { background: var(--btn-fill-a); }
.btn-action.active { background: var(--btn-fill-a); border-color: var(--btn-c); }

/* ── Solid — filled. The loudest thing on screen; use sparingly ── */
.btn-solid {
  --btn-h:  30px;
  --btn-ls: 2px;
  background: var(--btn-c);
  border-color: var(--btn-c);
  color: var(--btn-on);
  font-weight: 600;
  letter-spacing: var(--btn-ls);
  text-transform: uppercase;
}
.btn-solid:hover {
  background:   color-mix(in srgb, var(--btn-c) 84%, #fff);
  border-color: color-mix(in srgb, var(--btn-c) 84%, #fff);
}
.btn-solid:active {
  background:   color-mix(in srgb, var(--btn-c) 86%, #000);
  border-color: color-mix(in srgb, var(--btn-c) 86%, #000);
}

/* ── Outline — secondary action ── */
.btn-outline {
  border-color: var(--btn-edge);
  color: var(--btn-c);
}
.btn-outline:hover  { border-color: var(--btn-c); background: var(--btn-fill); }
.btn-outline:active { background: var(--btn-fill-h); }
.btn-outline.active { border-color: var(--btn-c); background: var(--btn-fill-h); }

/* ── Ghost — inline, quiet until touched ── */
.btn-ghost {
  --btn-h:  26px;
  --btn-fs: 11px;
  color: var(--muted);
}
.btn-ghost:hover {
  color: var(--btn-hc);
  border-color: var(--btn-hb);
  background: var(--btn-hbg);
}
.btn-ghost.hi { --btn-c: var(--accent2); }        /* attention, but not "selected" */
.btn-ghost.active,
.btn-ghost.hi {
  color: var(--btn-c);
  border-color: var(--btn-c);
  background: var(--btn-fill);
}
.btn-ghost.active:hover,
.btn-ghost.hi:hover {
  color: var(--btn-c);
  border-color: var(--btn-c);
  background: var(--btn-fill-h);
}

/* ── Pill — small tag toggle ── */
.btn-pill {
  --btn-h:   22px;
  --btn-fs:  11px;
  --btn-gap: 5px;
  border-color: var(--border);
  color: var(--muted);
}
.btn-pill:hover  { border-color: var(--btn-c); color: var(--btn-c); }
.btn-pill.active { border-color: var(--btn-c); color: var(--btn-c); background: var(--btn-fill); }

/* ── Snap — micro button inside a control row ── */
.btn-snap {
  --btn-h:   18px;
  --btn-px:  6px;
  --btn-fs:  11px;
  --btn-gap: 4px;
  background: var(--bg);
  border-color: var(--border);
  color: var(--muted);
  letter-spacing: .3px;
}
.btn-snap:hover  { border-color: var(--btn-c); color: var(--btn-c); }
.btn-snap.active { border-color: var(--btn-c); color: var(--btn-c); background: var(--btn-fill); }

/* ── Icon — square, no label ── */
.btn-icon {
  --btn-gap: 0;
  width: var(--btn-h);
  padding: 0;
  border-color: var(--border);
  color: var(--muted);
  font-size: var(--btn-ico);
  flex-shrink: 0;
}
.btn-icon:hover  { color: var(--btn-hc); border-color: var(--btn-hb); background: var(--btn-hbg); }
.btn-icon.active { color: var(--btn-c);  border-color: var(--btn-c);  background: var(--btn-fill); }

/* ── Tertiary — DEPRECATED. Prefer .btn-outline.btn-gray.
      Kept for existing markup; the old :hover was a no-op (it re-set --muted). ── */
.btn-tertiary {
  --btn-c:  var(--muted);
  --btn-hc: var(--text);
  --btn-fs: 11px;
  margin-left: auto;
  align-self: center;
  flex-shrink: 0;
  appearance: none;
  border-color: var(--border-hi);
  color: var(--muted);
  letter-spacing: .1px;
  text-transform: uppercase;
}
.btn-tertiary:hover  { color: var(--btn-hc); border-color: var(--btn-hb); background: var(--btn-hbg); }
.btn-tertiary:active { transform: translateY(1px); }


/* ─────────  COLOR MODIFIERS  ─────────
   Each sets the base color only; the hover trio is derived below. */
.btn-accent  { --btn-c: var(--accent);      }
.btn-accent2 { --btn-c: var(--accent2);     }
.btn-green   { --btn-c: var(--green);       }
.btn-purple  { --btn-c: var(--purple);      }
.btn-red     { --btn-c: var(--red);         }
.btn-gray    { --btn-c: var(--color-gray);  }
.btn-yellow  { --btn-c: var(--color-yellow);}

/* Legacy aliases — scoped so .panel-value.amber etc. are untouched */
[class*="btn"].amber  { --btn-c: var(--accent2); }
[class*="btn"].danger { --btn-c: var(--red);     }
[class*="btn"].green  { --btn-c: var(--green);   }

/* An explicit color means "hover in my color", not the neutral gray-up */
:is(.btn-accent, .btn-accent2, .btn-green, .btn-purple, .btn-red,
    .btn-gray, .btn-yellow,
    [class*="btn"].amber, [class*="btn"].danger, [class*="btn"].green) {
  --btn-hc:  var(--btn-c);
  --btn-hb:  var(--btn-c);
  --btn-hbg: var(--btn-fill-h);
}


/* ─────────  SIZES  ─────────
   Declared after the variants so a size class always wins. */
.btn-xs { --btn-h: 20px; --btn-px:  7px; --btn-fs: 11px; --btn-ico: 12px; --btn-gap: 4px; --btn-ls:  .3px; }
.btn-sm { --btn-h: 24px; --btn-px:  9px; --btn-fs: 11px; --btn-ico: 13px; --btn-gap: 5px; --btn-ls:   1px; }
.btn-md { --btn-h: 28px; --btn-px: 12px; --btn-fs: 12px; --btn-ico: 14px; --btn-gap: 6px; --btn-ls:   1px; }
.btn-lg { --btn-h: 34px; --btn-px: 16px; --btn-fs: 13px; --btn-ico: 16px; --btn-gap: 8px; --btn-ls:   2px; }

/* .btn-minor = .btn-sm, plus the standalone box it used to carry on its own
   (it is applied to component-styled buttons with no variant class). */
.btn-minor {
  --btn-h: 24px; --btn-px: 9px; --btn-fs: 12px; --btn-ico: 13px; --btn-gap: 5px;
  padding: 4px var(--btn-px);
  border-radius: var(--btn-r);
  font-family: var(--display);
  font-size: var(--btn-fs);
  letter-spacing: 1px;
  text-transform: capitalize;
  white-space: nowrap;
  cursor: pointer;
  margin-top: 2px;                 /* legacy spacing — .btn-sm is this without the margin */
  transition: background .12s, border-color .12s, color .12s;
}


/* ─────────  ICONS  ───────── */
:is(.btn, .btn-action, .btn-solid, .btn-outline, .btn-ghost,
    .btn-pill, .btn-snap, .btn-icon, .btn-tertiary) :is(svg, .icon, .btn-ico) {
  width:  var(--btn-ico);
  height: var(--btn-ico);
  flex-shrink: 0;
  pointer-events: none;
}
/* emoji or glyph standing in for an icon */
:is(.btn, .btn-action, .btn-solid, .btn-outline, .btn-ghost,
    .btn-pill, .btn-snap, .btn-icon, .btn-tertiary) .btn-ico-text {
  font-size: var(--btn-ico);
  line-height: 1;
  flex-shrink: 0;
  pointer-events: none;
}
/* push a trailing icon to the far edge (chevrons on full-width buttons) */
.btn-ico-end { margin-left: auto; }

/* collapse any variant to a square icon button */
.btn-icon-only {
  --btn-gap: 0;
  width: var(--btn-h);
  padding: 0;
}


/* ─────────  LAYOUT  ───────── */
.btn-block { display: flex; width: 100%; }
.btn-auto  { width: auto; }


/* ─────────  STATES  ───────── */
:is(.btn, .btn-action, .btn-solid, .btn-outline, .btn-ghost,
    .btn-pill, .btn-snap, .btn-icon, .btn-tertiary):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--btn-c) 55%, transparent);
  outline-offset: 1px;
}

/* Disabled last, so it beats every hover/active rule above. */
:is(.btn, .btn-action, .btn-solid, .btn-outline, .btn-ghost,
    .btn-pill, .btn-snap, .btn-icon, .btn-tertiary, .btn-minor):is(
    :disabled, .disabled, [aria-disabled="true"]) {
  opacity: .35;
  filter: grayscale(.4);
  cursor: not-allowed;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .btn, .btn-action, .btn-solid, .btn-outline, .btn-ghost,
  .btn-pill, .btn-snap, .btn-icon, .btn-tertiary, .btn-minor { transition: none; }
}


/* ─────────────────────────────────────────────
   7. TOOLBAR
   ───────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: stretch;
  height: 36px;
  background: rgba(9,9,12,.92);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}
/* Vertical toolbar variant */
.toolbar-v {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 36px;
  background: rgba(9,9,12,.92);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Toolbar button ── */
.tb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 12px;
  height: 100%;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .15s, background .15s;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}
.tb-btn:hover { color: var(--text); background: rgba(255,255,255,.04); }
.tb-btn.active {
  color: var(--accent2);
  background: rgba(251,146,60,.07);
  border-bottom: 2px solid var(--accent2);
}
/* Disabled toolbar button */
.tb-btn.disabled {
  opacity: .3;
  pointer-events: none;
}
/* Toolbar step / phase button with numbered badge */
.tb-btn .tb-num {
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 1px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
/* Toolbar chevron for menus */
.tb-chevron {
  font-size: 8px;
  opacity: .5;
  transition: transform .15s;
  flex-shrink: 0;
}
.tb-btn.open .tb-chevron { transform: rotate(180deg); }

/* Vertical toolbar button */
.toolbar-v .tb-btn {
  width: 100%;
  height: 34px;
  padding: 0;
  border-right: none;
  border-bottom: 1px solid var(--border);
  font-size: 15px;     /* icon size in vertical variant */
}
.toolbar-v .tb-btn.active { border-left: 2px solid var(--accent2); }

/* Toolbar label (non-interactive, e.g. "Tool:") */
.tb-label {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 11px;
  color: var(--muted);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}
/* Push everything after this to the right */
.tb-spacer { flex: 1; }


/* ─────────────────────────────────────────────
   8. DROPDOWN MENUS
   ───────────────────────────────────────────── */

/* ── Dropdown container ── */
.dropdown {
  display: none;
  position: absolute;
  top: 100%; right: 0;
  min-width: 240px;
  background: var(--panel2);
  border: 1px solid var(--accent);
  border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md);
  box-shadow: 0 10px 36px rgba(0,0,0,.65);
  z-index: 600;
  overflow: hidden;
}
.dropdown.open { display: block; }

/* Detached / floating dropdown (not anchored below a button) */
.dropdown-float {
  display: none;
  position: fixed;
  min-width: 240px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 10px 36px rgba(0,0,0,.65);
  z-index: 600;
  overflow: hidden;
}
.dropdown-float.open { display: block; }

/* ── Section label inside dropdown ── */
.dd-section {
  padding: 6px 16px 4px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}

/* ── Divider ── */
.dd-sep {
  height: 1px;
  background: var(--border);
  margin: 3px 0;
}

/*
 * ── Menu item ──
 *  Required structure:
 *   <div class="dd-item">
 *     <span class="dd-icon">⊡</span>         ← icon (emoji or SVG)
 *     <span class="dd-label">Action Name</span>
 *     <span class="dd-kbd">Ctrl+Z</span>      ← optional keyboard shortcut
 *   </div>
 */
.dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background .1s;
}
.dd-item:hover:not(.dd-item-disabled) {
  background: rgba(125,211,252,.08);
}
.dd-item.dd-item-disabled {
  opacity: .32;
  cursor: default;
  pointer-events: none;
}

/* Icon column — always 18 px wide */
.dd-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  color: var(--accent);
}
.dd-icon.red   { color: var(--red); }
.dd-icon.amber { color: var(--accent2); }
.dd-icon.green { color: var(--green); }

/* Label */
.dd-label {
  flex: 1;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
  user-select: none;
}
.dd-item:hover:not(.dd-item-disabled) .dd-label { color: var(--accent); }
.dd-label.red   { color: var(--red); }

/* Keyboard shortcut badge */
.dd-kbd {
  font-family: var(--display);
  font-size: 11px;
  color: var(--muted);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}


/* ─────────────────────────────────────────────
   9. SLIDERS
   ───────────────────────────────────────────── */

/* Default slider row */
.slider-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}

input[type=range] {
  flex: 1;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
  max-width: 110px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px; height: 11px;
  background: var(--accent);
  border-radius: 50%;
  transition: transform .1s;
}
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.2); }
input[type=range]:focus::-webkit-slider-thumb { transform: scale(1.2); }

/* Axis label (X / Y / Z) */
.slider-ax {
  font-size: 11px;
  color: var(--muted);
  width: 12px;
  flex-shrink: 0;
  text-align: right;
  user-select: none;
}

/* Value readout beside slider */
.slider-val {
  font-size: 11px;
  color: var(--accent2);
  font-family: var(--mono);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* Editable value input beside slider */
.slider-inp {
  width: 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--accent2);
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 4px;
  text-align: right;
  flex-shrink: 0;
}
.slider-inp:focus { outline: none; border-color: var(--accent); }

/* ── Firefox: match the WebKit thumb (base rule was WebKit-only) ──────────── */
input[type=range]::-moz-range-thumb {
  width: 11px; height: 11px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
}

/* ── Mobile: enlarge slider touch targets ─────────────────────────────────────
   The default 11px thumb on a 3px track is too small to grab with a finger, so
   on touch layouts we grow the thumb to ~22px and give the input a real ~28px
   vertical hit area (the thin track is drawn separately so it still looks slim).

   • Keyed off body.is-mobile — the same flag useIsMobile() toggles at 768px —
     so the desktop mouse experience is untouched.
   • height uses !important because a few sliders set an inline height:3px that
     would otherwise win over this rule.
   • touch-action:none lets a horizontal drag move the thumb instead of being
     interpreted as a page scroll. */
body.is-mobile input[type=range] {
  height: 28px !important;
  background: transparent;      /* track is drawn by the runnable-track below */
  touch-action: none;
}
body.is-mobile input[type=range]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}
body.is-mobile input[type=range]::-webkit-slider-thumb {
  width: 22px; height: 22px;
  margin-top: -9px;             /* centre the 22px thumb on the 4px track */
}
body.is-mobile input[type=range]::-moz-range-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}
body.is-mobile input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px;
}


/* ─────────────────────────────────────────────
   10. NUMBER / TEXT INPUTS
   ───────────────────────────────────────────── */
.num-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 5px;
  text-align: right;
  min-width: 0;
  transition: border-color .12s;
}
.num-input:focus { outline: none; border-color: var(--accent); }
/* Wide variant */
.num-input-wide { width: 72px; }
/* Tight variant */
.num-input-tight { width: 44px; }

input[type=checkbox] {
  accent-color: var(--accent);
  width: 12px; height: 12px;
  cursor: pointer;
  flex-shrink: 0;
}


/* ─────────────────────────────────────────────
   11. COLLAPSIBLE SECTIONS
   ───────────────────────────────────────────── */
.collapsible {
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Header row */
.collapsible-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px 9px 12px;
  cursor: pointer;
  user-select: none;
  transition: background .12s;
  min-height: 44px;
}
.collapsible-header:hover { background: rgba(255,255,255,.035); }

/* Arrow chevron */
.collapsible-arrow {
  font-size: 11px;
  color: var(--muted);
  transition: transform .18s;
  flex-shrink: 0;
  width: 10px;
  text-align: center;
  line-height: 1;
}
.collapsible.is-open .collapsible-arrow { transform: rotate(90deg); }

/* Title + description stacked */
.collapsible-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.collapsible-title {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  line-height: 1;
}
.collapsible.is-open .collapsible-title { color: var(--text); }

/* Description — hidden when open */
.collapsible-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  font-family: var(--display);
}
.collapsible.is-open .collapsible-desc { display: none; }

/* Optional icon to the right */
.collapsible-icon {
  flex-shrink: 0;
  opacity: .65;
  font-size: 15px;
}
.collapsible.is-open .collapsible-icon { display: none; }

/* Body — hidden until open */
.collapsible-body { display: none; }
.collapsible.is-open .collapsible-body { display: block; }


/* ─────────────────────────────────────────────
   12. LIBRARY GRID
   ───────────────────────────────────────────── */
.lib-section {
  border-top: 1px solid var(--border);
  padding: 10px 10px 12px;
  flex-shrink: 0;
}
.lib-title {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  user-select: none;
}
.lib-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.lib-item {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 6px 4px;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  position: relative;
  overflow: hidden;
}
.lib-item:hover { border-color: var(--accent); background: rgba(125,211,252,.04); }
.lib-item.selected { border-color: var(--accent2); background: rgba(251,146,60,.06); }

.lib-item canvas {
  width: 100%; height: 44px;
  display: block;
  background: #080a10;
  border-radius: 2px;
}
.lib-item-name {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-item:hover .lib-item-name { color: var(--text-dim); }
.lib-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 0;
}
.lib-source-badge {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--accent2);
  opacity: .6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-item-del {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 2px;
  transition: color .1s;
  line-height: 1;
}
.lib-item-del:hover { color: var(--red); }
.lib-empty {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 14px 0;
  letter-spacing: .5px;
  grid-column: 1 / -1;
}


/* ─────────────────────────────────────────────
   13. TOAST
   ───────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 36px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #141828;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 11px;
  padding: 7px 18px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 999;
  letter-spacing: .5px;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--red); color: var(--red); }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.warning { border-color: var(--accent2); color: var(--accent2); }


/* ─────────────────────────────────────────────
   14. MODAL / OVERLAY
   ───────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 950;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--panel2);
  border: 1px solid var(--accent);
  border-radius: var(--r-lg);
  padding: 22px 26px 20px;
  min-width: 300px;
  max-width: 420px;
  box-shadow: 0 14px 44px rgba(0,0,0,.8);
}
.modal-title {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.modal-title.danger { color: var(--red); border-color: var(--red); }
.modal-body {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 20px;
}
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-footer button {
  padding: 7px 18px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .15s;
  border: 1px solid;
}
.modal-cancel {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}
.modal-cancel:hover { border-color: var(--text-dim); color: var(--text); }
.modal-confirm {
  background: rgba(125,211,252,.1);
  border-color: var(--accent);
  color: var(--accent);
}
.modal-confirm:hover { background: rgba(125,211,252,.22); }
.modal-confirm.danger {
  background: rgba(248,113,113,.1);
  border-color: var(--red);
  color: var(--red);
}
.modal-confirm.danger:hover { background: rgba(248,113,113,.24); }


/* ─────────────────────────────────────────────
   15. CONTEXT MENU
   ───────────────────────────────────────────── */
.ctx-menu {
  display: none;
  position: fixed;
  z-index: 900;
  background: var(--panel2);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  min-width: 175px;
  box-shadow: 0 6px 24px rgba(0,0,0,.72);
  overflow: hidden;
}
.ctx-menu.open { display: block; }
.ctx-menu-header {
  padding: 8px 14px 6px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Context menu item — same icon/label/kbd structure as .dd-item */
.ctx-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text);
  letter-spacing: .3px;
  transition: background .1s;
}
.ctx-item:hover { background: rgba(125,211,252,.09); color: var(--accent); }
.ctx-item .dd-icon { font-size: 13px; color: var(--accent); }
.ctx-item .dd-label { font-size: 11px; }
.ctx-item.red { color: var(--red); }
.ctx-item.red:hover { background: rgba(248,113,113,.09); color: var(--red); }
.ctx-item.red .dd-icon { color: var(--red); }
.ctx-sep { height: 1px; background: var(--border); margin: 2px 0; }


/* ─────────────────────────────────────────────
   17. ZOOM CONTROLS  (canvas panel overlays)
   ─────────────────────────────────────────────
   Placed absolute, bottom-right of any .view-pane
   or relatively-positioned canvas container.

   Usage:
     <div class="zoom-btn-group">
       <button class="zoom-btn" title="Zoom in">  <svg class="icon"><use href="#icon-zoom-in"/></svg>  </button>
       <button class="zoom-btn" title="Zoom fit">  <svg class="icon"><use href="#icon-zoom-fit"/></svg> </button>
       <button class="zoom-btn" title="Zoom out"> <svg class="icon"><use href="#icon-zoom-out"/></svg> </button>
     </div>
   ───────────────────────────────────────────── */
.zoom-btn-group {
  position: absolute;
  bottom: 28px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 10;
  pointer-events: auto;
}

.zoom-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 9, 12, 0.82);   /* --bg at 82% */
  border: 1px solid rgba(74, 222, 128, 0.35);  /* --green at 35% */
  border-radius: var(--r-sm);
  color: rgba(74, 222, 128, 0.85);    /* --green at 85% */
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  flex-shrink: 0;
  user-select: none;
}
.zoom-btn .icon {
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.zoom-btn:hover {
  background: rgba(74, 222, 128, 0.15);
  border-color: rgba(74, 222, 128, 0.6);
  color: var(--green);
}
.zoom-btn:active {
  background: rgba(74, 222, 128, 0.25);
}


/* ─────────────────────────────────────────────
   16. SCROLLBARS (webkit)
   ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }


/* ─────────────────────────────────────────────
   18. SHAPE PARAMETER PANELS
   ─────────────────────────────────────────────
   The "Customize <Shape>" sections in the Properties panel — star, gear,
   spring, cylinder, prism, torus, torus-knot, lathe, sweep.  Every one of
   these used to hand-roll the same six inline style strings.  They all live
   here now.

   Anatomy:
     .param-section              ← wrapper, gets .is-open when expanded
       .param-header             ← click target
         .param-chevron          ← "▸", rotates 90° when open
         .param-title            ← "CUSTOMIZE CYLINDER"
       .param-body               ← hidden unless .is-open
         .param-badge-row / .param-badge
         .param-row × N          ← label + slider + value
         .param-preset-row
         .param-reset-row > .section-reset

   Typography floor (11px) and colour floor (#666) are respected throughout;
   the old inline rules used 9–10px and are superseded.
   ───────────────────────────────────────────── */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
/* The .prop-section class is kept alongside .param-section so MobilePanelDock's
   drill-down (which walks `.prop-section` / `.prop-section-title`) keeps working.
   Compound selectors are used below so these rules beat the app-local
   .prop-section-title in style.css regardless of stylesheet order. */
.param-section {
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
}

/* ── Collapsible header ──────────────────────────────────────────────────── */
.param-header,
.prop-section-title.param-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  cursor: pointer;
  user-select: none;
  min-height: 20px;
}

.param-chevron {
  font-size: 11px;
  line-height: 1;
  color: var(--muted);
  width: 12px;
  flex-shrink: 0;
  text-align: center;
  transition: transform .18s, color .12s;
}
.param-section.is-open .param-chevron { transform: rotate(90deg); }

.param-title {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: capitalize;
  color: var(--accent2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Colour variants — pick one per shape family if you want to differentiate */
.param-title.blue   { color: var(--accent); }
.param-title.green  { color: var(--green); }
.param-title.purple { color: var(--purple); }

.param-header:hover .param-chevron { color: var(--accent2); }

/* ── Body ────────────────────────────────────────────────────────────────── */
.param-body { display: none; padding-top: 8px; }
.param-section.is-open .param-body { display: block; }

/* ── Sub-groups: collapsible bands of rows inside one panel ─────────────────
   Driven by `{ section: 'Front Face' }` markers in a shape's slider list (see
   ui-slider-row.js).  A shape with twenty-odd controls — corbel — is a wall of
   sliders otherwise.

   Anatomy:
     .param-group                  ← gets .is-open when expanded
       .param-subhead              ← click target
         .param-subchevron         ← "▸", rotates 90° when open
         .param-subtitle           ← "FRONT FACE"
       .param-group-body           ← hidden unless .is-open
         .param-row × N

   The chevron has its OWN class rather than reusing .param-chevron: that one
   is rotated by `.param-section.is-open .param-chevron`, a descendant selector
   which would flip every nested chevron open the moment the outer section was
   expanded.  Quieter than .param-title too — a sub-head must not compete with
   the section header above it. */
.param-group { margin: 0; }

.param-subhead {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0 4px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  min-height: 18px;
}
/* No rule above the first group — the section header is already there. */
.param-group:first-child > .param-subhead { border-top: 0; margin-top: 0; }

.param-subchevron {
  font-size: 10px;
  line-height: 1;
  color: var(--muted);
  width: 12px;
  flex-shrink: 0;
  text-align: center;
  transition: transform .18s, color .12s;
}
.param-group.is-open > .param-subhead > .param-subchevron { transform: rotate(90deg); }

.param-subtitle {
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .12s;
}
.param-subhead:hover .param-subchevron,
.param-subhead:hover .param-subtitle { color: var(--accent2); }

.param-group-body { display: none; padding: 4px 0 6px 2px; }
.param-group.is-open > .param-group-body { display: block; }

/* ── Parameter row: label · slider · editable value · unit ───────────────── */
.param-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  margin-bottom: 2px;
}

.param-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: .3px;
  width: 64px;
  flex-shrink: 0;
  user-select: none;
}

/* The range input itself inherits its look from Section 9. */
.param-slider { flex: 1; min-width: 0; }

.param-value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
  width: 58px;
  flex-shrink: 0;
}

.param-num {
  width: 100%;
  min-width: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  text-align: right;
  padding: 1px 3px;
  transition: border-color .12s, background .12s;
}
.param-num:hover { border-color: var(--border); }
.param-num:focus {
  outline: none;
  border-color: var(--accent2);
  background: color-mix(in srgb, var(--accent2) 10%, transparent);
}

.param-unit {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Info badge (e.g. torus-knot "p=2 q=3 · true knot") ──────────────────── */
.param-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 6px;
}
.param-badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent2) 15%, transparent);
  color: var(--accent2);
  transition: background .15s, color .15s;
}
/* Secondary state — degenerate / non-canonical value */
.param-badge.alt {
  background: color-mix(in srgb, var(--color-brown) 15%, transparent);
  color: var(--color-brown);
}

/* ── Preset row (torus-knot, lathe silhouettes) ──────────────────────────── */
.param-preset-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  flex-wrap: wrap;
}
.param-preset-row > .param-label { width: 64px; }
/* Preset chips use the existing .btn-snap from Section 6. */

/* ── Reset row ───────────────────────────────────────────────────────────── */
.param-reset-row {
  display: flex;
  justify-content: flex-end;
  padding: 6px 0 0;
}



/* ── Select row (cloud genus, …) ─────────────────────────────────────────
   Native <select>: on a phone iOS and Android render their own wheel/sheet,
   which beats a hand-rolled menu inside the properties drawer. Matches the
   other panel selects (.uv-select, .shape-set-select). */
.param-select-field {
  position: relative;
  flex: 1;
  min-width: 0;
}
/* appearance:none drops the native caret and a <select> can't carry a
   pseudo-element, so the wrapper draws it. */
.param-select-field::after {
  content: '▾';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  line-height: 1;
  color: var(--muted);
  pointer-events: none;
}

.param-select {
  width: 100%;
  appearance: none;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: .3px;
  padding: 3px 20px 3px 7px;
  cursor: pointer;
  outline: none;
  transition: border-color .12s, color .12s;
}
.param-select:hover { border-color: var(--border-hi); }
.param-select:focus { border-color: var(--accent2); }
/* Option text is drawn by the OS — give it a surface instead of inheriting a
   transparent one. */
.param-select option { background: var(--panel); color: var(--text); }

body.is-mobile .param-select { padding: 5px 20px 5px 7px; font-size: 12px; }
/* Same flex trap as .param-slider above: in drilled mode the row's children
   resolve against a column's main axis unless pinned. */
body.is-mobile .param-section .param-row > .param-select-field { flex: 1 1 auto; min-width: 0; }


/* Canonical .section-reset — moved here from style.css.
   `margin-left:auto` is intentionally NOT set: .param-reset-row does the
   alignment, and the button is also used inline inside .prop-section-title. */
.section-reset {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: color .12s;
}
.section-reset:hover,
.param-reset-row > .section-reset:hover { color: var(--accent2); }
.prop-section-title > .section-reset { margin-left: auto; }

/* ── Mobile: roomier rows, wider label gutter ────────────────────────────── */
body.is-mobile .param-header { min-height: 32px; }
body.is-mobile .param-row    { padding: 5px 0; gap: 10px; }
body.is-mobile .param-label  { width: 72px; }
body.is-mobile .param-num    { padding: 3px; }

/* ── A parameter row is always one full-width line ───────────────────────────
   In drilled mode (body.ma-section-focus, style.css) the section body becomes
   a flex column so it can fill the drawer and scroll. That makes every
   .param-row a flex ITEM, so the row's own flex properties suddenly resolve
   against the column's main axis — height, not width. These two rules keep a
   row behaving like a block line no matter which way the parent is flexing. */
body.is-mobile .param-section .param-row {
  display: flex;
  /* `flex: none`, never a percentage basis: when the drilled-section rule makes
     the body a column, a basis of 100% resolves against HEIGHT and every row
     claims the whole drawer. Width is pinned on the cross axis instead. */
  flex: none;
  width: 100%;
}
body.is-mobile .param-section .param-row > .param-slider { flex: 1 1 auto; min-width: 0; }
body.is-mobile .param-section .param-row > .param-value  { flex: 0 0 58px; }
/* If a mobile rule flexes the body (the drilled-section stretch in style.css
   does), it stacks — it never lays rows out in a line. */
body.is-mobile .param-section > .param-body { flex-direction: column; }

/* ── Mobile: sub-groups are block lines too ──────────────────────────────────
   Same trap as .param-row above. In drilled mode (body.ma-section-focus,
   style.css) the section body becomes a flex COLUMN so it can fill the drawer
   and scroll, which turns every direct child into a flex item — including a
   .param-group. Without `flex: none` a percentage basis would resolve against
   HEIGHT and one group would claim the whole drawer. */
body.is-mobile .param-section .param-group { flex: none; width: 100%; }
body.is-mobile .param-subhead { min-height: 30px; padding: 7px 0 6px; }
