/* Kaleida — design system */
@font-face { font-family: 'Outfit'; src: url('../fonts/outfit-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/inter-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #07070b;
  --accent: #b388ff;
  --accent-2: #ff6fb1;
  --glass: rgba(11, 11, 17, 0.72);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #eeeef4;
  --muted: rgba(238, 238, 244, 0.56);
  --faint: rgba(238, 238, 244, 0.3);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display: 'Outfit', var(--font);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 20px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --shadow: 0 24px 64px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
  --tint: color-mix(in oklab, var(--accent) 20%, transparent);
  --tint-soft: color-mix(in oklab, var(--accent) 10%, transparent);
  --ring: color-mix(in oklab, var(--accent) 45%, transparent);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font: 13px/1.4 var(--font); overflow: hidden; overscroll-behavior: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { position: fixed; inset: 0; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; }
button, input { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.ic { width: 20px; height: 20px; flex: none; display: block; }
[hidden] { display: none !important; }

/* ---------- canvas ---------- */
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#gl:active { cursor: grabbing; }
body.picking #gl { cursor: crosshair; }
#gl.pulse { animation: pulse .55s var(--ease); }
@keyframes pulse { 0% { filter: brightness(1.5) saturate(1.3); } 100% { filter: none; } }
#checker { position: absolute; inset: 0; background: conic-gradient(#1a1a21 25%, #0f0f15 0 50%, #1a1a21 0 75%, #0f0f15 0) 0 0 / 24px 24px; }
body.ready #gl { animation: fadein 1.2s var(--ease); }
@keyframes fadein { from { opacity: 0; } }

/* ---------- glass ---------- */
.glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .015)), var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(170%);
  backdrop-filter: blur(30px) saturate(170%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
/* Without backdrop blur the artwork would show through and swamp the controls. */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  :root { --glass: rgba(11, 11, 17, .95); }
}

/* ---------- HUD ---------- */
#hud { position: absolute; top: calc(12px + var(--sat)); left: calc(14px + var(--sal)); right: calc(14px + var(--sar)); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: none; z-index: 20; transition: opacity .5s var(--ease), transform .5s var(--ease); }
#hud > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px 0 11px; border-radius: 999px; }
.mark { display: grid; }
.mark svg { width: 22px; height: 22px; display: block; }
.mark.spin svg { animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.wordmark { font: 300 14px/1 var(--display); letter-spacing: .36em; padding-left: .1em; text-transform: uppercase; }
.ver { font: 500 10px/1 var(--mono); letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); background: rgba(255, 255, 255, .04); border-radius: 999px; padding: 5px 7px 4px; cursor: pointer; transition: .2s; }
.ver:hover { color: var(--text); border-color: var(--accent); box-shadow: 0 0 12px var(--tint); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; height: 44px; }
.pill button, .ibtn { width: 36px; height: 36px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; transition: background .2s, color .2s, transform .2s, box-shadow .2s; }
.pill button:hover, .ibtn:hover { color: var(--text); background: rgba(255, 255, 255, .08); }
.pill button:active, .ibtn:active { transform: scale(.9); }
.pill button.on { color: var(--accent); background: var(--tint); box-shadow: 0 0 16px var(--tint); }
.pill button:disabled { opacity: .28; cursor: default; background: transparent; }
.pill .sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 3px; }
.pop-heart { color: var(--accent-2) !important; animation: heart .6s var(--ease); }
@keyframes heart { 30% { transform: scale(1.4); } 60% { transform: scale(.95); } }

/* ---------- dock ---------- */
#dock { position: absolute; right: calc(14px + var(--sar)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 2px; padding: 6px; border-radius: 22px; z-index: 30; transition: opacity .5s var(--ease), transform .5s var(--ease); }
#dock button { position: relative; width: 46px; height: 46px; border-radius: 15px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; transition: background .2s, color .2s, box-shadow .25s, transform .2s; }
#dock button:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
#dock button:active { transform: scale(.94); }
#dock button .ic { width: 22px; height: 22px; }
#dock button span { position: absolute; right: calc(100% + 12px); top: 50%; transform: translateY(-50%) translateX(6px); font: 500 10px/1 var(--font); letter-spacing: .16em; text-transform: uppercase; color: var(--text); background: var(--glass); border: 1px solid var(--line); padding: 7px 10px; border-radius: 8px; opacity: 0; pointer-events: none; transition: .2s var(--ease); white-space: nowrap; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
#dock button:hover span { opacity: 1; transform: translateY(-50%); }
#dock button.on { color: var(--accent); background: var(--tint); box-shadow: inset 0 0 0 1px var(--ring), 0 0 24px var(--tint); }
#dock button.on span { display: none; }

/* ---------- pop-out panel ---------- */
.pop { --glass: rgba(11, 11, 17, .82); position: absolute; right: calc(14px + var(--sar) + 70px); top: 50%; transform: translateY(-50%) translateX(14px) scale(.98); width: 316px; max-height: min(84vh, 780px); display: flex; flex-direction: column; border-radius: var(--r); opacity: 0; z-index: 25; transition: opacity .22s var(--ease), transform .22s var(--ease); }
.pop.in { opacity: 1; transform: translateY(-50%); }
.pop-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 4px 18px; }
.pop-title { font: 500 10.5px/1 var(--font); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.pop-tools { display: flex; gap: 2px; }
.pop-head .ibtn { width: 30px; height: 30px; }
.pop-head .ibtn .ic { width: 16px; height: 16px; }
.pop-pin.on { color: var(--accent); }
.pop-body { overflow: auto; padding: 2px 18px 18px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.pop-body::-webkit-scrollbar { width: 6px; }
.pop-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 3px; }

/* ---------- controls ---------- */
.ctl { margin: 10px 0; }
.ctl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.ctl-label { font: 500 10.5px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ctl-label .ic { width: 14px; height: 14px; }
.ctl-val { font: 500 11px/1 var(--mono); color: var(--faint); font-variant-numeric: tabular-nums; transition: color .2s; }
.ctl.active .ctl-val { color: var(--accent); }
.ctl.dim { opacity: .3; pointer-events: none; }
.sec { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 2px; font: 500 9.5px/1 var(--font); letter-spacing: .24em; text-transform: uppercase; color: var(--faint); }
.sec-tools { display: flex; gap: 4px; }
.mini { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; transition: .2s; }
.mini .ic { width: 14px; height: 14px; }
.mini:hover { color: var(--text); border-color: var(--accent); box-shadow: 0 0 10px var(--tint); }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; align-items: center; }
.note { color: var(--faint); font-size: 11.5px; margin: 12px 0 0; line-height: 1.5; display: flex; gap: 8px; align-items: center; }
.note.tiny { font-size: 10.5px; }
.note .ic { width: 14px; height: 14px; color: var(--muted); }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; margin: 0; cursor: pointer; --fill: 50%; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--fill), rgba(255, 255, 255, .12) var(--fill)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .08), 0 2px 8px rgba(0, 0, 0, .5); transition: transform .15s, box-shadow .15s; }
input[type=range]:hover::-webkit-slider-thumb, input[type=range]:active::-webkit-slider-thumb { transform: scale(1.15); box-shadow: 0 0 0 5px var(--ring), 0 0 16px var(--accent); }
input[type=range]::-moz-range-track { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .12); }
input[type=range]::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--accent); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .08), 0 2px 8px rgba(0, 0, 0, .5); }
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent); }

.tgl { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 9px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--muted); cursor: pointer; font-size: 12px; transition: .2s; white-space: nowrap; }
.tgl:hover { color: var(--text); background: rgba(255, 255, 255, .08); }
.tgl[aria-pressed=true] { color: var(--text); border-color: var(--ring); background: var(--tint); box-shadow: 0 0 18px var(--tint-soft); }
.tgl[aria-pressed=true] .ic { color: var(--accent); }
.tgl .ic { width: 16px; height: 16px; }
.tgl.big { flex-direction: column; height: auto; padding: 12px 6px 10px; gap: 6px; border-radius: 14px; font-size: 11px; }
.tgl.big .ic { width: 22px; height: 22px; }
.tgl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.chip-row { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.chip { flex: 1; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: .2s; padding: 0; min-width: 0; }
.chip.txt { font-size: 11.5px; font-weight: 500; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip:hover { color: var(--text); }
.chip[aria-checked=true] { color: var(--text); background: rgba(255, 255, 255, .1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 4px 12px rgba(0, 0, 0, .3); }
.chip[aria-checked=true] .ic { color: var(--accent); }

.pad { position: relative; height: 150px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); overflow: hidden; cursor: crosshair; touch-action: none; }
.pad-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px); background-size: 25% 25%; background-position: -1px -1px; }
.pad-h, .pad-v { position: absolute; background: var(--ring); pointer-events: none; }
.pad-h { left: 0; right: 0; height: 1px; }
.pad-v { top: 0; bottom: 0; width: 1px; }
.pad-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px var(--ring), 0 0 18px var(--accent); pointer-events: none; transition: transform .15s; }
.pad-wrap.active .pad-dot { transform: scale(1.25); }

.dial { position: relative; width: 150px; height: 150px; margin: 2px auto 0; cursor: ns-resize; touch-action: none; border-radius: 50%; }
.dial svg { width: 100%; height: 100%; display: block; }
.dial-ring { fill: none; stroke: var(--line-2); stroke-width: 1; }
.dial-wedges .w0 { fill: color-mix(in oklab, var(--accent) 24%, transparent); }
.dial-wedges .w1 { fill: color-mix(in oklab, var(--accent-2) 10%, transparent); }
.dial-lines line { stroke: rgba(255, 255, 255, .28); stroke-width: .8; }
.dial-num { position: absolute; inset: 0; display: grid; place-items: center; font: 200 36px/1 var(--display); pointer-events: none; text-shadow: 0 2px 14px rgba(0, 0, 0, .7); transition: color .2s; }
.dial-wrap.active .dial-num { color: var(--accent); }

.sgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.scell { aspect-ratio: 1; border-radius: 11px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; transition: .2s; }
.scell svg { width: 58%; height: 58%; }
.scell:hover { color: var(--text); background: rgba(255, 255, 255, .09); transform: translateY(-1px); }
.scell.sel-a { color: #fff; border-color: var(--accent); background: var(--tint); box-shadow: inset 0 0 0 1px var(--accent), 0 0 16px var(--ring); }
.scell.sel-b { color: var(--text); border-color: var(--accent-2); box-shadow: inset 0 0 0 1px var(--accent-2); }
.scell.sel-a.sel-b { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 2px var(--accent-2); }
.slot-row { display: flex; align-items: center; gap: 6px; margin: 6px 0 10px; }
.slot { width: 32px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: 600 11px var(--font); cursor: pointer; transition: .2s; }
.slot.on { color: #fff; }
.slot:first-child.on { background: color-mix(in oklab, var(--accent) 32%, transparent); border-color: var(--accent); }
.slot:last-child.on { background: color-mix(in oklab, var(--accent-2) 32%, transparent); border-color: var(--accent-2); }
.slot-hint { color: var(--faint); font-size: 10.5px; letter-spacing: .04em; margin-left: 2px; }

.pgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.pcell { height: 30px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .08); background: var(--g); cursor: pointer; transition: .2s; padding: 0; }
.pcell:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, .4); }
.pcell.sel { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px #fff; }
.stops-bar { height: 12px; border-radius: 6px; margin-top: 12px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.stops-row { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.stop { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid rgba(255, 255, 255, .18); position: relative; cursor: pointer; overflow: hidden; flex: none; transition: transform .15s; }
.stop:hover { transform: scale(1.12); border-color: #fff; }
.stop.flash { animation: stopflash 1.4s var(--ease); }
@keyframes stopflash {
  0%, 100% { box-shadow: none; }
  15%, 60% { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px #fff, 0 0 20px var(--accent); }
}
.stop input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.stop-btn { width: 26px; height: 26px; border-radius: 50%; border: 1px dashed var(--line-2); background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; flex: none; }
.stop-btn:hover { color: var(--text); border-color: var(--accent); }
.stop-btn:disabled { opacity: .25; cursor: default; }
.stop-btn .ic { width: 14px; height: 14px; }
.stops-row .stop-btn:nth-last-child(2) { margin-left: auto; }

.wheel-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 10px; }
.wheel { position: relative; width: 176px; height: 176px; cursor: crosshair; touch-action: none; border-radius: 50%; }
.wheel canvas { width: 100%; height: 100%; border-radius: 50%; display: block; box-shadow: 0 0 0 1px var(--line-2), 0 12px 32px rgba(0, 0, 0, .45); }
.wheel-dot { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .6); pointer-events: none; }
.wheel-row { display: flex; gap: 10px; align-items: center; width: 100%; }
.lslider { flex: 1; }
.lslider::-webkit-slider-runnable-track { background: linear-gradient(90deg, #000, #fff) !important; }
.lslider::-moz-range-track { background: linear-gradient(90deg, #000, #fff); }
.lslider::-moz-range-progress { background: transparent; }
.hex { width: 84px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--text); font: 500 12px var(--mono); text-align: center; letter-spacing: .04em; }
.harmonies { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.hpill { height: 36px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .08); background: var(--g); cursor: pointer; position: relative; overflow: hidden; padding: 0; transition: .2s; }
.hpill span { position: absolute; left: 8px; bottom: 5px; font: 600 8.5px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); opacity: .92; }
.hpill:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .35); }

.cchip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 8px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--muted); font-size: 12px; position: relative; cursor: pointer; overflow: hidden; }
.cchip:hover { color: var(--text); }
.cchip-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.cchip input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.ptile { position: relative; height: 150px; border-radius: 14px; border: 1px dashed var(--line-2); background: rgba(255, 255, 255, .03); display: grid; place-items: center; overflow: hidden; cursor: pointer; margin-top: 8px; transition: .2s; }
.ptile:hover { border-color: var(--accent); background: var(--tint-soft); }
.ptile.has { border-style: solid; }
.ptile-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.ptile-empty .ic { width: 28px; height: 28px; }
.ptile.has .ptile-empty { display: none; }
.ptile img, .ptile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.live-badge { position: absolute; top: 8px; left: 8px; display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 5px; border-radius: 999px; background: rgba(255, 45, 70, .9); color: #fff; font: 700 10px/1 var(--font); letter-spacing: .12em; }
.live-badge .ic { width: 12px; height: 12px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.btn-row { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--text); cursor: pointer; font-size: 12.5px; font-weight: 500; transition: .2s; flex: 1; white-space: nowrap; }
.btn:hover { background: rgba(255, 255, 255, .1); border-color: var(--line-2); }
.btn:active { transform: scale(.98); }
.btn .ic { width: 17px; height: 17px; }
.btn.primary { border: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 24px var(--tint); }
.btn.primary:hover { filter: brightness(1.1); box-shadow: 0 10px 28px var(--ring); }
.btn.rec { background: rgba(255, 45, 70, .18); border-color: rgba(255, 45, 70, .5); }
.btn.wide { width: 100%; }
.btn.busy { opacity: .6; pointer-events: none; }

/* ---------- gallery ---------- */
#gallery { --glass: rgba(11, 11, 17, .82); position: absolute; left: calc(14px + var(--sal)); top: calc(66px + var(--sat)); bottom: calc(14px + var(--sab)); width: 300px; border-radius: var(--r); display: flex; flex-direction: column; z-index: 25; opacity: 0; transform: translateX(-14px); transition: opacity .26s var(--ease), transform .26s var(--ease); }
#gallery.in { opacity: 1; transform: none; }
.g-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 4px 18px; }
.g-head > span { font: 500 10.5px/1 var(--font); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.g-head .ibtn { width: 30px; height: 30px; }
.g-head .ibtn .ic { width: 16px; height: 16px; }
.g-scroll { overflow: auto; padding: 0 12px 14px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.g-scroll h3 { font: 500 9.5px/1 var(--font); letter-spacing: .24em; text-transform: uppercase; color: var(--faint); margin: 14px 6px 8px; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.thumbs .note { grid-column: 1 / -1; margin: 4px 6px; }
.thumb { position: relative; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #000; cursor: pointer; padding: 0; transition: .2s; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .5); border-color: rgba(255, 255, 255, .35); }
.thumb > span { position: absolute; left: 8px; bottom: 6px; font: 500 9.5px/1 var(--font); letter-spacing: .1em; text-transform: uppercase; text-shadow: 0 1px 4px #000; }
.thumb-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; display: grid; place-items: center; opacity: 0; cursor: pointer; padding: 0; transition: .2s; }
.thumb:hover .thumb-x, .thumb:focus-within .thumb-x { opacity: 1; }
.thumb-x:hover { background: #e0304a; }
.thumb-x .ic { width: 12px; height: 12px; }

/* ---------- dialogs ---------- */
dialog.dlg { border: 0; padding: 0; margin: 0; background: transparent; max-width: none; max-height: none; width: 100vw; height: 100vh; height: 100dvh; color: inherit; }
dialog.dlg[open] { display: grid; place-items: center; }
dialog.dlg::backdrop { background: rgba(4, 4, 8, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dlg-card { --glass: rgba(11, 11, 17, .88); outline: none; width: min(430px, calc(100vw - 28px)); max-height: calc(100vh - 32px); overflow: auto; border-radius: 24px; padding: 18px 18px 20px; animation: rise .32s var(--ease); scrollbar-width: thin; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.dlg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dlg-title { font: 300 18px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; flex: 1; }
.dlg-head .ibtn { margin-left: auto; }
.preview { border-radius: 12px; overflow: hidden; background: #000; display: grid; place-items: center; min-height: 80px; max-height: 220px; border: 1px solid var(--line); }
.preview img { max-width: 100%; max-height: 220px; display: block; }
.preview.checker { background: conic-gradient(#2a2a32 25%, #16161c 0 50%, #2a2a32 0 75%, #16161c 0) 0 0 / 20px 20px; }
.dims { font: 500 11px var(--mono); color: var(--muted); text-align: center; margin: 10px 0; letter-spacing: .05em; }
.custom { justify-content: center; gap: 10px; }
.custom label { display: flex; align-items: center; gap: 7px; font: 500 10.5px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.custom .x { color: var(--faint); }
.custom input { width: 78px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--text); font: 500 12px var(--mono); text-align: center; -moz-appearance: textfield; }
.custom input::-webkit-inner-spin-button { -webkit-appearance: none; }
.fmt-row, .sec-row { margin: 10px 0; }
.about-hero { display: flex; align-items: center; gap: 14px; }
.mark.big svg { width: 44px; height: 44px; }
.about-hero .wordmark { font-size: 18px; }
.about-ver { font: 500 11px var(--mono); color: var(--muted); margin-top: 6px; letter-spacing: .05em; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; margin: 16px 0 6px; }
.keys div { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--muted); }
kbd { min-width: 30px; padding: 4px 7px; border-radius: 6px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .06); font: 500 10.5px var(--mono); color: var(--text); text-align: center; white-space: nowrap; }

/* ---------- toasts ---------- */
#toasts { position: absolute; left: 50%; bottom: calc(26px + var(--sab)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 9px 15px 9px 11px; border-radius: 999px; font-size: 12.5px; opacity: 0; transform: translateY(10px); transition: .28s var(--ease); pointer-events: auto; white-space: nowrap; background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02)), rgba(14, 14, 20, .82); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border: 1px solid var(--line-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.toast.in { opacity: 1; transform: none; }
.toast .ic { width: 16px; height: 16px; color: var(--accent); }
.toast-act { border: 0; background: var(--tint); color: var(--text); border-radius: 999px; padding: 4px 10px; font-size: 11.5px; cursor: pointer; margin-left: 4px; }

/* ---------- hint / no-gl / drop ---------- */
#hint, #nogl { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; background: rgba(4, 4, 8, .35); opacity: 0; transition: opacity .4s var(--ease); }
#hint.in, #nogl { opacity: 1; }
.hint-card { width: min(360px, calc(100vw - 40px)); border-radius: 26px; padding: 28px 24px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hint-card .wordmark { font-size: 18px; margin-top: -4px; }
.hint-card h2 { font: 300 20px/1 var(--display); letter-spacing: .1em; margin: 0; }
.hint-rows { display: flex; flex-direction: column; gap: 10px; width: 100%; margin: 6px 0 4px; }
.hint-rows > div { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); text-align: left; }
.hint-rows .ic { color: var(--accent); }
.hint-go { width: 100%; }
#drop-veil { position: absolute; inset: 12px; border: 2px dashed var(--accent); border-radius: 26px; display: grid; place-items: center; opacity: 0; pointer-events: none; transition: .2s; z-index: 70; background: var(--tint-soft); }
#drop-veil .ic { width: 64px; height: 64px; color: var(--accent); }
body.dragging #drop-veil { opacity: 1; }

/* ---------- zen / idle ---------- */
body.zen #hud, body.zen #dock, body.zen .pop, body.zen #gallery, body.idle #hud, body.idle #dock { opacity: 0; pointer-events: none; }
body.zen #hud { transform: translateY(-8px); }
body.zen #dock { transform: translateY(-50%) translateX(8px); }
body.idle #gl { cursor: none; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  #hud { flex-direction: column; align-items: stretch; gap: 8px; }
  .brand { align-self: flex-start; height: 40px; }
  .actions { justify-content: flex-start; }
  .pill { height: 40px; }
  .pill button { width: 33px; height: 33px; }
  .desk { display: none !important; }
  #dock { top: auto; right: auto; bottom: calc(10px + var(--sab)); left: 50%; transform: translateX(-50%); flex-direction: row; gap: 0; padding: 4px; border-radius: 20px; }
  #dock button { width: 44px; height: 44px; }
  #dock button span { display: none; }
  body.zen #dock { transform: translateX(-50%) translateY(8px); }
  .pop { right: 8px; left: 8px; top: auto; bottom: calc(64px + var(--sab)); width: auto; max-height: min(54vh, 480px); transform: translateY(14px) scale(.98); }
  .pop.in { transform: none; }
  #gallery { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(64px + var(--sab)); max-height: 58vh; }
  #toasts { bottom: calc(70px + var(--sab)); }
  .dlg-card { width: calc(100vw - 20px); border-radius: 22px; }
}
@media (max-width: 400px) {
  .pill button { width: 31px; height: 31px; }
  .pill { padding: 3px; }
  .wordmark { letter-spacing: .28em; }
}
@media (prefers-reduced-motion: reduce) {
  .mark.spin svg { animation: none; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- shape pickers ---------- */
.spick-badge { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font: 700 11px/1 var(--font); color: #fff; background: var(--tint); border: 1px solid var(--ring); flex: none; }
.spick[data-slot="B"] .spick-badge { background: color-mix(in oklab, var(--accent-2) 26%, transparent); border-color: color-mix(in oklab, var(--accent-2) 55%, transparent); }
.spick[data-slot="C"] .spick-badge { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); }
.tag { font: 500 9.5px/1 var(--font); letter-spacing: .22em; text-transform: uppercase; color: var(--faint); }
.tag.lines { display: block; margin: 12px 0 6px; }
.tag.use { white-space: nowrap; }

/* ---------- ambient ---------- */
body.ambient #gl { cursor: none; }
.amb-body { margin-top: 4px; }

/* ---------- tooltips ---------- */
#tip { position: fixed; z-index: 120; max-width: 260px; padding: 8px 11px; border-radius: 10px; font: 500 12px/1.4 var(--font); color: var(--text); background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02)), rgba(12, 12, 18, .94); border: 1px solid var(--line-2); box-shadow: 0 12px 32px rgba(0, 0, 0, .5); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .15s var(--ease), transform .15s var(--ease); }
#tip.in { opacity: 1; transform: none; }
#tip::after { content: ''; position: absolute; left: var(--ax, 50%); top: 100%; width: 10px; height: 10px; margin-left: -5px; margin-top: -5px; background: inherit; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); transform: rotate(45deg); }
#tip.below::after { top: 0; margin-top: -6px; border: 0; border-left: 1px solid var(--line-2); border-top: 1px solid var(--line-2); }

/* ---------- ambient exit ---------- */
#amb-exit { position: fixed; top: calc(14px + var(--sat)); right: calc(14px + var(--sar)); z-index: 80; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px 0 12px; border-radius: 999px; color: var(--text); font: 500 13px var(--font); cursor: pointer; opacity: 0; transform: translateY(-8px); transition: opacity .25s var(--ease), transform .25s var(--ease); }
#amb-exit.in { opacity: 1; transform: none; }
#amb-exit .ic { width: 18px; height: 18px; }
body.ambient #amb-exit { cursor: pointer; }

/* ---------- shape tabs ---------- */
.cur-line { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; font-size: 12.5px; color: var(--text); }
.cur-line .cur-ic { display: grid; }
.cur-line .cur-ic svg { width: 22px; height: 22px; }
.form-sliders { transition: opacity .2s; }
.form-sliders.dim { opacity: .35; pointer-events: none; }
.note.warn { color: var(--accent); }
.thumb.blank { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: rgba(255, 255, 255, .04); border-style: dashed; border-color: var(--line-2); color: var(--muted); }
.thumb.blank:hover { color: var(--text); border-color: var(--accent); }
.thumb.blank .blank-mark { width: 30px; height: 30px; border-radius: 50%; border: 1px dashed var(--line-2); display: grid; place-items: center; }
.thumb.blank .blank-mark .ic { width: 16px; height: 16px; }
.thumb.blank > span { position: static; left: auto; bottom: auto; }
.thumb.blank > span:last-child { font: 500 10px/1 var(--font); letter-spacing: .1em; text-transform: uppercase; text-shadow: none; }
.about-start { margin: 6px 0 4px; }
.about-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 2px; }
.about-links a { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; }
.about-links a:hover { color: var(--text); border-bottom-color: var(--accent); }
.about-links a .ic { width: 14px; height: 14px; color: var(--accent); }

/* Help */
.help-card { width: min(640px, calc(100vw - 28px)); padding-bottom: 16px; }
.help-grid { display: grid; grid-template-columns: 150px 1fr; gap: 16px; min-height: 360px; }
.help-nav { display: flex; flex-direction: column; gap: 2px; align-self: start; position: sticky; top: 0; }
.help-nav button { display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 500 11.5px var(--font); text-align: left; cursor: pointer; }
.help-nav button .ic { width: 15px; height: 15px; flex: none; }
.help-nav button:hover { color: var(--text); }
.help-nav button[aria-current=true] { color: var(--text); background: rgba(255, 255, 255, .09); }
.help-nav button[aria-current=true] .ic { color: var(--accent); }
.help-body { min-width: 0; }
.help-body h3 { font: 300 16px/1.2 var(--display); letter-spacing: .14em; text-transform: uppercase; margin: 6px 0 8px; }
.help-body .intro { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 0 0 12px; }
.help-list { display: grid; grid-template-columns: minmax(96px, 128px) 1fr; gap: 7px 12px; font-size: 11.5px; line-height: 1.45; }
.help-list b { font-weight: 500; color: var(--text); }
.help-list span { color: var(--muted); }
@media (max-width: 560px) {
  .help-grid { grid-template-columns: 1fr; gap: 10px; min-height: 0; }
  .help-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin: 0 -6px; }
  .help-nav::-webkit-scrollbar { display: none; }
  .help-nav button { flex: none; height: 30px; }
  .help-nav button span { display: none; }
  .help-nav button[aria-current=true] span { display: inline; }
  .help-list { grid-template-columns: minmax(84px, 108px) 1fr; }
}
.about-start .tag { display: block; margin: 8px 0 6px; }
