/* style.css — Mandelbulber. Panel pattern from the AstroTechs shader studies:
   floating right panel, collapsible sections, label / range / value rows.
   Extra parts: formula slot strip, thumbnail picker, gradient editor, example
   list. main.js sets one layout class on body: mode-float (desktop), mode-sheet
   (portrait phone: bottom sheet) or mode-drawer (landscape phone, tablet). Coarse
   pointers get 44 px controls; see the @media (pointer: coarse) block.
   Part of the GPL-3.0 port of Mandelbulber2 (Krzysztof Marczak and the
   Mandelbulber team, github.com/buddhi1980/mandelbulber2); see COPYING.
   grep: .panel  .ctl  .slots  .formula-pick  .picker  .exlist  .grad  .hud  @media
         mode-sheet  mode-drawer  .grab  .peek  .ctx  .stick  .tip  --cover-b  --cover-r */
:root {
  --space: #070b12; --hull-edge: #1c2733; --frost: #cfdce8; --frost-dim: #8fa0b2;
  --ice: #8fd3ff; --lamp: #ffb26b;
  --line: rgba(143, 211, 255, .16); --fill: rgba(143, 211, 255, .08);
  --font: "Barlow", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--space); color: var(--frost); font-family: var(--font); overflow: hidden; }
/* no pull to refresh, no double-tap zoom; pinch zoom stays on outside the canvas */
html, body { height: 100dvh; overscroll-behavior: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

.stage { position: fixed; inset: 0; background: var(--space); }
/* the canvas covers only what the panel leaves free (main.js sets --cover-b and --cover-r) */
#gl { position: absolute; left: 0; top: 0; width: calc(100% - var(--cover-r, 0px)); height: calc(100% - var(--cover-b, 0px));
  display: block; touch-action: none; cursor: grab; object-fit: cover; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#gl.dragging { cursor: grabbing; }
body.flying #gl { cursor: crosshair; }

.fallback { position: absolute; inset: 0; display: none; place-items: center; padding: 24px; text-align: center; color: var(--frost-dim); font-size: 15px; line-height: 1.5; z-index: 5; }
.stage.nogpu .fallback { display: grid; }
.stage.nogpu #gl { display: none; }
.drop { position: absolute; inset: 14px; display: none; place-items: center; border: 2px dashed rgba(143, 211, 255, .5); border-radius: 16px;
  background: rgba(7, 11, 18, .7); color: var(--ice); font-size: 16px; z-index: 9; pointer-events: none; }
.stage.dropping .drop { display: grid; }

.toggle {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left)); height: 32px; padding: 0 12px; display: flex; align-items: center;
  background: rgba(12, 18, 27, .78); border: 1px solid var(--line); border-radius: 10px;
  backdrop-filter: blur(10px); color: var(--frost); font: inherit; font-size: 11px; cursor: pointer; z-index: 7;
}
.toggle:hover { background: rgba(143, 211, 255, .12); }
.toggle.fly { left: calc(78px + env(safe-area-inset-left)); }
.toggle.on { color: var(--space); background: var(--lamp); border-color: var(--lamp); }

.hud { position: fixed; left: 12px; bottom: 10px; display: flex; gap: 10px; font-size: 10.5px; color: var(--frost-dim); font-variant-numeric: tabular-nums;
  background: rgba(9, 13, 20, .66); padding: 3px 9px; border-radius: 7px; pointer-events: none; z-index: 6; max-width: calc(100vw - 370px);
  white-space: nowrap; overflow: hidden; }
.hud span:empty { display: none; }
.hud #hudSamples { color: var(--frost); }
.hud #hudStatus { overflow: hidden; text-overflow: ellipsis; }
.hud.err #hudStatus { color: var(--lamp); }

.panel {
  position: fixed; top: 12px; right: 12px; width: 340px; max-height: calc(100vh - 24px); display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(12, 18, 27, .9), rgba(9, 13, 20, .95));
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  backdrop-filter: blur(14px) saturate(1.2); overflow: hidden; transition: transform .25s, opacity .25s; z-index: 7;
}
.panel.hidden { transform: translateX(calc(100% + 30px)); opacity: 0; pointer-events: none; }
.panel header { display: flex; align-items: baseline; gap: 8px; padding: 11px 13px 9px; border-bottom: 1px solid rgba(143, 211, 255, .10); }
.panel header h1 { margin: 0; font-size: 13px; font-weight: 600; }
.panel header small { color: var(--frost-dim); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; margin-left: auto; }
.panel .scroll { overflow-y: auto; padding: 2px 13px 12px; scrollbar-width: thin; scrollbar-color: rgba(143, 211, 255, .25) transparent; overscroll-behavior: contain; }
.panel section { padding: 8px 0; border-bottom: 1px solid rgba(143, 211, 255, .08); }
.panel section:last-child { border-bottom: 0; }
.panel h2 { margin: 0; font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ice); opacity: .9; }
.panel h2 button { all: unset; cursor: pointer; display: flex; width: 100%; align-items: center; gap: 6px; padding: 2px 0; }
.panel h2 button::after { content: "\203A"; margin-left: auto; transition: transform .2s; font-size: 13px; }
.panel section:not(.closed) > h2 button::after { transform: rotate(90deg); }
.panel section.closed > .body { display: none; }
.panel .body { padding-top: 6px; }
.panel h3 { margin: 10px 0 2px; font-size: 9.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--frost-dim); }
.panel details { margin: 4px 0; }
.panel details > summary { cursor: pointer; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--frost-dim); padding: 4px 0; list-style: none; }
.panel details > summary::-webkit-details-marker { display: none; }
.panel details > summary::before { content: "\203A"; display: inline-block; width: 10px; transition: transform .2s; }
.panel details[open] > summary::before { transform: rotate(90deg); }
.panel details > summary small { font-weight: 400; letter-spacing: 0; text-transform: none; margin-left: 4px; opacity: .7; }

/* control rows */
.ctl { display: grid; grid-template-columns: 96px 1fr 58px; gap: 8px; align-items: center; margin: 5px 0; font-size: 12px; }
.ctl .k { color: var(--frost-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctl.changed .k { color: var(--frost); }
.ctl input[type=range] { width: 100%; min-width: 0; accent-color: var(--ice); margin: 0; }
.num { width: 100%; min-width: 0; font: inherit; font-size: 11.5px; text-align: right; color: var(--frost); font-variant-numeric: tabular-nums;
  background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 1px 3px; -moz-appearance: textfield; }
.num:hover { border-color: rgba(143, 211, 255, .2); }
.num:focus { outline: none; border-color: rgba(143, 211, 255, .6); background: rgba(143, 211, 255, .06); }
.num::-webkit-inner-spin-button { display: none; }
.ctl .vec { grid-column: 2 / 4; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.ctl .vec .num { background: var(--fill); border-color: rgba(143, 211, 255, .12); text-align: center; }
.ctl select, .field { grid-column: 2 / 4; font: inherit; font-size: 12px; color: var(--frost); background: var(--fill);
  border: 1px solid rgba(143, 211, 255, .22); border-radius: 7px; padding: 4px 6px; min-width: 0; }
.ctl select option { background: #0c121b; }
.ctl input[type=color] { grid-column: 2 / 4; justify-self: start; width: 56px; height: 22px; padding: 0; border: 1px solid rgba(143, 211, 255, .25); border-radius: 6px; background: none; cursor: pointer; }
.ctl input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.ctl input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }
.sw { grid-column: 2 / 4; justify-self: start; font: inherit; font-size: 11px; min-width: 56px; color: var(--frost-dim);
  background: rgba(143, 211, 255, .05); border: 1px solid rgba(143, 211, 255, .18); border-radius: 7px; padding: 3px 10px; cursor: pointer; }
.sw.on { color: var(--frost); background: rgba(143, 211, 255, .24); border-color: rgba(143, 211, 255, .6); }

.buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.buttons button { flex: 1 1 auto; font: inherit; font-size: 11.5px; color: var(--frost); background: var(--fill);
  border: 1px solid rgba(143, 211, 255, .22); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.buttons button:hover { background: rgba(143, 211, 255, .16); }
.buttons button.on { background: rgba(143, 211, 255, .26); border-color: rgba(143, 211, 255, .6); }
.buttons button.primary { color: var(--space); background: var(--lamp); border-color: var(--lamp); font-weight: 600; }
.buttons button.primary:hover { background: #ffc48c; }

.spec { font-size: 11px; line-height: 1.5; color: var(--frost-dim); margin: 6px 0 0; }
.spec b { color: var(--frost); font-weight: 500; }
.spec code { font-size: 10.5px; color: var(--ice); background: var(--fill); padding: 1px 4px; border-radius: 4px; }
.spec a { color: var(--ice); }
kbd { font: inherit; font-size: 10px; color: var(--frost); border: 1px solid rgba(143, 211, 255, .3); border-radius: 4px; padding: 0 4px; }
.progress { height: 3px; border-radius: 2px; background: var(--fill); overflow: hidden; margin: 2px 0 4px; }
.progress i { display: block; height: 100%; width: 0; background: var(--ice); transition: width .2s; }
.progress.done i { background: var(--lamp); }

/* thumbnails from the gen/thumbs.jpg sprite; main.js sets background-position */
.thumb { flex: none; width: 64px; height: 64px; border-radius: 6px; background-color: #0c121b; background-repeat: no-repeat; }
.thumb.none { display: grid; place-items: center; color: var(--frost-dim); font-size: 18px; border: 1px dashed rgba(143, 211, 255, .25); }

/* slot strip */
.slots { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin: 6px 0 8px; }
.slot { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid rgba(143, 211, 255, .18); border-radius: 7px; background: #0c121b;
  overflow: hidden; cursor: pointer; font: inherit; color: var(--frost-dim); }
.slot .thumb { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; }
.slot .thumb.none { border: 0; font-size: 11px; opacity: .45; padding-top: 8px; }
.slot b { position: absolute; left: 2px; top: 1px; font-size: 9px; font-weight: 600; color: var(--frost); text-shadow: 0 0 3px #000, 0 0 2px #000; }
.slot.active { border-color: var(--lamp); box-shadow: 0 0 0 1px var(--lamp); }
.slot.off { opacity: .35; }
.slot:hover { border-color: rgba(143, 211, 255, .6); }

.formula-pick { display: flex; gap: 10px; align-items: center; width: 100%; padding: 6px; margin: 2px 0 6px; font: inherit; color: var(--frost); text-align: left;
  background: var(--fill); border: 1px solid rgba(143, 211, 255, .22); border-radius: 10px; cursor: pointer; }
.formula-pick:hover { background: rgba(143, 211, 255, .14); }
.formula-pick .thumb { width: 52px; height: 52px; }
.formula-pick span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.formula-pick strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.formula-pick small { font-size: 10.5px; color: var(--frost-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.formula-pick em { margin-left: auto; font-style: normal; font-size: 10.5px; color: var(--ice); padding-right: 4px; }

/* formula picker: sits over the panel on a desktop, full screen on a phone */
.picker { position: fixed; top: 12px; right: 12px; width: 340px; height: calc(100vh - 24px); display: flex; flex-direction: column; z-index: 8;
  background: #0a0f17; border: 1px solid rgba(143, 211, 255, .3); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.picker.hidden { display: none; }
.picker .phead { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid rgba(143, 211, 255, .12); }
.picker .phead input { flex: 1; min-width: 0; font: inherit; font-size: 13px; color: var(--frost); background: var(--fill);
  border: 1px solid rgba(143, 211, 255, .3); border-radius: 8px; padding: 6px 9px; }
.picker .phead button { font: inherit; font-size: 11.5px; color: var(--frost); background: var(--fill); border: 1px solid rgba(143, 211, 255, .22); border-radius: 8px; padding: 0 10px; cursor: pointer; }
.picker .pbody { overflow-y: auto; padding: 4px 10px 14px; scrollbar-width: thin; scrollbar-color: rgba(143, 211, 255, .25) transparent; overscroll-behavior: contain; }
.picker h3 { margin: 12px 0 6px; font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ice); }
.picker h3 small { color: var(--frost-dim); font-weight: 400; letter-spacing: 0; margin-left: 4px; }
.picker .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.picker .tile { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px 5px; font: inherit; color: var(--frost-dim);
  background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer; min-width: 0; }
.picker .tile:hover, .picker .tile:focus-visible { background: var(--fill); border-color: rgba(143, 211, 255, .3); color: var(--frost); }
.picker .tile.cur { border-color: var(--lamp); color: var(--frost); }
.picker .tile span { font-size: 10px; line-height: 1.2; text-align: center; width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.picker .empty { color: var(--frost-dim); font-size: 12px; padding: 20px 4px; }

/* examples */
.exsearch { width: 100%; font: inherit; font-size: 12px; color: var(--frost); background: var(--fill); border: 1px solid rgba(143, 211, 255, .22); border-radius: 7px; padding: 5px 8px; }
.exlist { max-height: 300px; overflow-y: auto; margin-top: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  scrollbar-width: thin; scrollbar-color: rgba(143, 211, 255, .25) transparent; overscroll-behavior: contain; }
.ex { display: flex; align-items: center; gap: 7px; padding: 3px; font: inherit; font-size: 11px; color: var(--frost-dim); text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 7px; cursor: pointer; min-width: 0; }
.ex .thumb { width: 32px; height: 32px; border-radius: 5px; }
.ex span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex:hover { background: var(--fill); color: var(--frost); }
.ex.cur { border-color: var(--lamp); color: var(--frost); }

/* gradient editor */
.grad { margin: 6px 0 8px; }
.grad .bar { position: relative; height: 22px; border-radius: 6px; border: 1px solid rgba(143, 211, 255, .25); cursor: copy; margin: 0 7px; }
.grad .stop { position: absolute; top: 100%; width: 14px; height: 14px; margin: 2px 0 0 -7px; border: 2px solid var(--frost); border-radius: 3px 3px 7px 7px;
  cursor: ew-resize; touch-action: none; box-shadow: 0 1px 3px #000; }
.grad .stop.sel { border-color: var(--lamp); transform: scale(1.15); }
.grad .row { display: flex; align-items: center; gap: 6px; margin-top: 22px; font-size: 11px; color: var(--frost-dim); }
.grad .row input[type=color] { width: 40px; height: 22px; padding: 0; border: 1px solid rgba(143, 211, 255, .25); border-radius: 6px; background: none; cursor: pointer; }
.grad .row .num { width: 60px; background: var(--fill); border-color: rgba(143, 211, 255, .12); }
.grad .row button { font: inherit; font-size: 11px; color: var(--frost); background: var(--fill); border: 1px solid rgba(143, 211, 255, .22); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.grad .row button:first-of-type { margin-left: auto; }

/* ─── bottom sheet and drawer (main.js sets the mode class and the vars) ─── */
.grab, .peek, .peektext { display: none; }
body.mode-sheet .grab { display: grid; }
body:not(.mode-float) .peek { display: grid; }
body:not(.mode-float) .peektext { display: block; }
body:not(.mode-float) #subtitle { display: none; }
.grab { height: 16px; place-items: center; touch-action: none; cursor: grab; flex: none; }
.grab i { width: 40px; height: 5px; border-radius: 3px; background: rgba(207, 220, 232, .42); }
.peektext { margin-left: auto; font-size: 12px; color: var(--frost-dim); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.peek { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 0 12px 8px; flex: none; }
.peek button { min-height: 44px; min-width: 0; font: inherit; font-size: 13px; color: var(--frost); background: var(--fill); border: 1px solid rgba(143, 211, 255, .22);
  border-radius: 10px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peek button.primary { color: var(--space); background: var(--lamp); border-color: var(--lamp); font-weight: 600; }
.peek button:active { filter: brightness(1.25); }

body.mode-sheet .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: var(--sheet-full, 60vh); max-height: none;
  border-radius: 16px 16px 0 0; border-bottom: 0; transform: translateY(var(--sheet-y, 0px)); opacity: 1;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1); padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
body.mode-sheet .panel.dragging { transition: none; }
body.mode-sheet .panel.hidden { transform: translateY(calc(var(--sheet-full, 60vh) + 20px)); }
body.mode-sheet .panel header, body.mode-sheet .peek { touch-action: none; }
body.mode-sheet .panel header { padding: 0 14px 6px; border-bottom: 0; align-items: center; }
body.mode-sheet .panel .scroll { flex: 1; min-height: 0; padding-bottom: calc(var(--sheet-hidden, 0px) + 16px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(143, 211, 255, .10); }

body.mode-drawer .panel { top: 0; right: 0; bottom: 0; width: var(--drawer-w, 340px); max-height: none; border-radius: 0; border-width: 0 0 0 1px;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 0; }
body.mode-drawer .panel.hidden { transform: translateX(calc(100% + 10px)); }
body.mode-drawer .panel header { padding: 10px 13px 8px; border-bottom: 0; align-items: center; }
body.mode-drawer .panel .scroll { flex: 1; min-height: 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(143, 211, 255, .10); }

body:not(.mode-float) .hud { top: calc(env(safe-area-inset-top) + 62px); bottom: auto; left: calc(12px + env(safe-area-inset-left));
  max-width: calc(100vw - var(--cover-r, 0px) - 24px - env(safe-area-inset-left)); }

/* full-screen pickers; main.js keeps them inside the visual viewport, above the keyboard */
body:not(.mode-float) .picker { inset: auto; left: 0; top: var(--vv-top, 0px); width: 100%; height: var(--vv-h, 100%); border-radius: 0; border: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); transition: transform .25s; }
body:not(.mode-float) .picker.dragging { transition: none; }
body:not(.mode-float) .picker .phead { touch-action: none; }
body:not(.mode-float) .picker .pbody { flex: 1; min-height: 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
body:not(.mode-float) .picker .grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
body:not(.mode-float) .picker .tile { padding: 6px 3px 7px; min-height: 44px; }
body:not(.mode-float) .picker .tile .thumb { width: 100% !important; height: auto !important; aspect-ratio: 1; max-width: 96px; }
body:not(.mode-float) .exlist, body:not(.mode-float) .exsearch { display: none; }
.exbrowse { display: flex; gap: 6px; width: 100%; }
.exbrowse button:first-child { flex: 1; }
.exlist h3 { grid-column: 1 / -1; margin: 6px 0 0; }
.exchips { padding: 6px 10px 2px; border-bottom: 1px solid rgba(143, 211, 255, .12); display: grid; gap: 5px; }
.exchips .chips { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; align-items: center; }
.exchips .chip { flex: none; font: inherit; font-size: 11px; color: var(--frost-dim); background: var(--fill); border: 1px solid rgba(143, 211, 255, .18);
  border-radius: 999px; padding: 3px 10px; cursor: pointer; white-space: nowrap; }
.exchips .chip.on { color: var(--frost); border-color: var(--lamp); }
.exchips .count { flex: none; margin-left: auto; font-size: 10.5px; color: var(--frost-dim); padding-left: 6px; }
.picker h3 a.lic { margin-left: 6px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--frost-dim); }
.picker h3 small.n { float: right; }
.thumb.shot { background-color: #000; }

/* long-press menu on the canvas */
.ctx { position: fixed; z-index: 11; display: flex; flex-direction: column; min-width: 168px; padding: 6px; gap: 4px;
  background: rgba(10, 15, 23, .96); border: 1px solid rgba(143, 211, 255, .3); border-radius: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.ctx button { min-height: 44px; font: inherit; font-size: 14px; text-align: left; padding: 0 14px; color: var(--frost); background: transparent; border: 0; border-radius: 10px; }
.ctx button:active, .ctx button:focus-visible { background: var(--fill); }
.ctx button.on { color: var(--lamp); }

/* fly thumbsticks: touch only, fly mode only */
.sticks { display: none; }
.stick { position: fixed; bottom: calc(var(--cover-b, 0px) + env(safe-area-inset-bottom) + 20px); width: 124px; height: 124px; border-radius: 50%; z-index: 6;
  background: rgba(207, 220, 232, .10); border: 1px solid rgba(207, 220, 232, .30); touch-action: none; -webkit-user-select: none; user-select: none; }
#stickL { left: calc(env(safe-area-inset-left) + 20px); }
#stickR { right: calc(var(--cover-r, 0px) + env(safe-area-inset-right) + 20px); }
.stick i { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  background: rgba(207, 220, 232, .40); transform: translate(var(--kx, 0px), var(--ky, 0px)); }
.stick span { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: rgba(207, 220, 232, .55); pointer-events: none; }
body.flying.touchfly .sticks { display: block; }

/* tapped label: full text, tip, reset */
.tip { position: fixed; z-index: 12; max-width: min(300px, calc(100vw - 24px)); padding: 10px 12px; font-size: 13px; line-height: 1.4; color: var(--frost);
  background: rgba(10, 15, 23, .97); border: 1px solid rgba(143, 211, 255, .3); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
.tip b { display: block; font-weight: 600; margin-bottom: 2px; }
.tip small { display: block; color: var(--frost-dim); font-size: 12px; word-break: break-all; }
.tip button { margin-top: 8px; min-height: 40px; font: inherit; font-size: 13px; color: var(--frost); background: var(--fill); border: 1px solid rgba(143, 211, 255, .3); border-radius: 8px; padding: 0 12px; }

/* vector inputs: x y z tags show only when the inputs stack */
.vc { display: flex; align-items: center; gap: 6px; min-width: 0; }
.vc i { display: none; font-style: normal; font-size: 11px; color: var(--frost-dim); width: 12px; }
@media (max-width: 480px) {
  .ctl.vrow { grid-template-columns: 1fr; gap: 4px; }
  .ctl.vrow .vec { grid-column: 1; grid-auto-flow: row; gap: 6px; }
  .vc i { display: block; }
}

/* touch: 44 px targets, visible fields, larger type in inputs (16 px keeps iOS from zooming) */
@media (pointer: coarse) {
  .toggle { height: 44px; padding: 0 16px; font-size: 13px; border-radius: 12px; }
  .toggle.fly { left: calc(88px + env(safe-area-inset-left)); }
  .panel header h1 { font-size: 15px; }
  .panel h2 { font-size: 11px; }
  .panel h2 button { min-height: 44px; padding: 0; }
  .panel details > summary { min-height: 44px; display: flex; align-items: center; font-size: 11px; }
  .panel h3 { font-size: 11px; }
  .ctl { grid-template-columns: minmax(0, 34%) minmax(0, 1fr) 72px; gap: 10px; min-height: 44px; margin: 3px 0; font-size: 14px; }
  .ctl .k { cursor: pointer; padding: 12px 0; }
  .num { font-size: 16px; min-height: 44px; padding: 0 6px; background: var(--fill); border-color: rgba(143, 211, 255, .18); border-radius: 8px; }
  .ctl input[type=range] { -webkit-appearance: none; appearance: none; height: 44px; background: transparent; }
  .ctl input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(143, 211, 255, .28); }
  .ctl input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -11px; border-radius: 50%;
    background: var(--ice); border: 3px solid #0c121b; box-shadow: 0 0 0 1px rgba(143, 211, 255, .6); }
  .ctl input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(143, 211, 255, .28); }
  .ctl input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--ice); border: 3px solid #0c121b; }
  .sw { min-height: 44px; min-width: 76px; font-size: 14px; border-radius: 10px; }
  .buttons { gap: 8px; }
  .buttons button { min-height: 44px; font-size: 14px; border-radius: 10px; }
  .ctl select, .field { min-height: 44px; font-size: 16px; border-radius: 9px; }
  .ctl input[type=color] { width: 76px; height: 44px; }
  .slots { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 5px; }
  .slot { min-height: 44px; }
  .slot b { font-size: 10px; }
  .formula-pick { min-height: 64px; }
  .formula-pick em { font-size: 14px; padding: 12px 6px; }
  .formula-pick strong { font-size: 15px; }
  .formula-pick small { font-size: 12px; }
  .spec { font-size: 13px; }
  .grad .bar { height: 32px; }
  .grad .stop { width: 26px; height: 26px; margin-left: -13px; }
  .grad .row { margin-top: 36px; flex-wrap: wrap; font-size: 13px; }
  .grad .row input[type=color] { width: 52px; height: 44px; }
  .grad .row .num { width: 72px; }
  .grad .row button { min-height: 44px; font-size: 13px; }
  .exsearch { font-size: 16px; min-height: 44px; }
  .ex { min-height: 44px; }
  .picker .phead { padding: 8px 10px; }
  .picker .phead input { font-size: 16px; min-height: 44px; }
  .picker .phead button { min-height: 44px; min-width: 68px; font-size: 14px; }
  .exchips .chip { min-height: 36px; font-size: 13px; padding: 4px 12px; }
  .picker .tile span { font-size: 12px; }
  .picker h3 { font-size: 11px; }
}
}
:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
.ctl.dim { opacity: .42; }
[hidden] { display: none !important; }
/* the engine could not compile the current scene: the image is the previous one */
#gl.stale { filter: grayscale(.8) brightness(.6); }

/* presets sheet: wider on a desktop, chips wrap there (a mouse has no sideways scroll) */
body.mode-float #exSheet { width: min(640px, calc(100vw - 24px)); }
body.mode-float .exchips .chips { flex-wrap: wrap; }
