/* Overlay Studio — editor chrome (never loaded by the overlay itself).

   Liquid glass over an achromatic ground. The whole interface is white at
   low alpha on near-black; the only colour anywhere is one prism gradient,
   spent on the things that need to be found — what is active, what has
   focus, how far a slider has travelled. */

:root {
  /* ground */
  --ink: #07080a;
  --ink-2: #0a0b0f;

  /* glass */
  --glass: rgba(255, 255, 255, .055);
  --glass-2: rgba(255, 255, 255, .085);
  --glass-3: rgba(255, 255, 255, .125);
  --edge: rgba(255, 255, 255, .10);
  --edge-2: rgba(255, 255, 255, .18);
  --spec: rgba(255, 255, 255, .30);          /* the lit top rim */

  /* ink on glass */
  --text: #eef1f7;
  --text-2: rgba(238, 241, 247, .62);
  --text-3: rgba(238, 241, 247, .38);

  /* the one chromatic thing */
  --p1: #7bdcff;
  --p2: #b39dff;
  --p3: #ff9ecb;
  --prism: linear-gradient(100deg, var(--p1), var(--p2) 46%, var(--p3));

  --insp: 348px;                              /* inspector width, shared so
                                                 the floating chips can dodge it */
  --r: 20px;                                  /* panel radius */
  --r-sm: 12px;
  --danger: #ff8a8f;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  overflow: hidden;
  font: 400 14px/1.5 Inter, "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }

/* Panel sections are shown and hidden with the hidden attribute, and most of
   them are grid or flex — which beats the UA stylesheet's [hidden] rule and
   leaves controls on screen that do nothing for the current controller. */
[hidden] { display: none !important; }

/* ---------- the ground the glass sits on ---------- */
.aurora { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.aurora i {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(90px); opacity: .42; mix-blend-mode: screen;
}
.aurora i:nth-child(1) {
  width: 46vw; height: 46vw; left: -8vw; top: -12vw;
  background: radial-gradient(circle, var(--p1), transparent 68%);
  animation: drift-a 34s ease-in-out infinite;
}
.aurora i:nth-child(2) {
  width: 40vw; height: 40vw; right: -6vw; top: 18vh;
  background: radial-gradient(circle, var(--p2), transparent 68%);
  animation: drift-b 41s ease-in-out infinite;
}
.aurora i:nth-child(3) {
  width: 34vw; height: 34vw; left: 32vw; bottom: -14vw;
  background: radial-gradient(circle, var(--p3), transparent 68%);
  animation: drift-c 47s ease-in-out infinite;
  opacity: .3;
}
@keyframes drift-a { 50% { transform: translate3d(7vw, 5vh, 0) scale(1.12); } }
@keyframes drift-b { 50% { transform: translate3d(-6vw, 7vh, 0) scale(.9); } }
@keyframes drift-c { 50% { transform: translate3d(4vw, -6vh, 0) scale(1.15); } }

/* ---------- the glass recipe ----------
   A gradient body so the surface catches light unevenly, a bright inner rim
   along the top edge, a dark one along the bottom, and a wide soft drop so
   the panel reads as floating rather than pasted on. */
.glass {
  position: relative;
  background: linear-gradient(168deg, var(--glass-2), var(--glass) 58%, rgba(255, 255, 255, .03));
  backdrop-filter: blur(26px) saturate(165%);
  -webkit-backdrop-filter: blur(26px) saturate(165%);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  box-shadow:
    inset 0 1px 0 var(--spec),
    inset 0 -1px 0 rgba(0, 0, 0, .38),
    0 26px 60px -24px rgba(0, 0, 0, .9),
    0 2px 10px -4px rgba(0, 0, 0, .6);
}
/* the specular bloom that makes it read as a lens rather than a tint */
.glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(130% 62% at 18% -14%, rgba(255, 255, 255, .16), transparent 62%);
}

/* ---------- layout ---------- */
.app { position: relative; z-index: 1; height: 100%; }

.stage-wrap { position: absolute; inset: 0; }
.stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  /* the rail and the inspector float over the stage, so the artwork has to
     centre in what is left of it rather than in the whole viewport */
  padding: 0 calc(var(--insp) + 36px) 0 96px;
  /* a whisper of a checker: it has to say "transparent in OBS" without
     competing with the artwork sitting on it */
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, .022) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .022) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, .022) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .022) 75%);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
}
.stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(125% 95% at 50% 45%, transparent 52%, rgba(0, 0, 0, .42));
}
.stage.is-empty::before {
  content: 'Pick a controller to begin';
  color: var(--text-3); font-size: 13.5px; letter-spacing: .05em;
}

/* ---------- floating chips ---------- */
.hud {
  position: absolute; z-index: 3; margin: 0;
  padding: 9px 15px; border-radius: 999px;
  font-size: 12.5px; letter-spacing: .01em; color: var(--text-2);
  display: flex; align-items: center; gap: 9px; white-space: nowrap;
}
.hud-brand { left: 18px; top: 18px; color: var(--text); font-weight: 600; letter-spacing: .015em; }
.brand-mark {
  width: 15px; height: 15px; border-radius: 5px; background: var(--prism);
  box-shadow: 0 0 14px -2px var(--p2), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.hud-status { right: calc(var(--insp) + 34px); top: 18px; }
.hud-status .dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: rgba(255, 255, 255, .22);
}
.hud-status.live .dot { background: var(--p1); box-shadow: 0 0 12px var(--p1); }
.hud-status.live { color: var(--text); }

/* undo / redo: out of the way at the foot of the stage, but on the stage —
   this is where the design is, so this is where taking a change back belongs */
.hud-history { left: 18px; bottom: 20px; padding: 5px; gap: 2px; }
.hud-btn {
  width: 30px; height: 30px; border: 1px solid transparent; border-radius: 999px;
  background: none; color: var(--text-2); font-size: 15px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .14s ease, color .14s ease;
}
.hud-btn:hover:not(:disabled) { background: var(--glass-3); color: var(--text); }
.hud-btn:disabled { opacity: .3; cursor: default; }

.stage-hint {
  left: 50%; bottom: 20px; transform: translateX(-50%);
  max-width: min(640px, calc(100vw - var(--insp) - 210px));
  text-align: center; white-space: normal; text-wrap: pretty; line-height: 1.5;
  padding: 10px 18px;
}
.stage-hint b { color: var(--text); font-weight: 600; }

/* ---------- icon rail ---------- */
.rail {
  position: absolute; z-index: 3; left: 18px; top: 50%; transform: translateY(-50%);
  padding: 8px; display: flex; flex-direction: column; gap: 6px; border-radius: 22px;
}
.rail-btn {
  width: 50px; height: 54px; border: 0; border-radius: 15px; cursor: pointer;
  background: transparent; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: color .18s ease, background .18s ease;
}
.rail-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn span { font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; }
.rail-btn:hover { color: var(--text-2); background: rgba(255, 255, 255, .05); }
.rail-btn.is-on { color: var(--text); background: var(--glass-3); box-shadow: inset 0 1px 0 var(--edge-2); }
/* the active one is the only lit thing in the rail */
.rail-btn.is-on::after {
  content: ''; position: absolute; left: -4px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 99px;
  background: var(--prism); box-shadow: 0 0 12px -1px var(--p2);
}
.rail-btn { position: relative; }
.rail-go.is-on::after, .rail-go:hover { color: var(--text); }

/* ---------- inspector ---------- */
.inspector {
  position: absolute; z-index: 3; right: 18px; top: 18px; bottom: 18px; width: var(--insp);
  display: flex; flex-direction: column; overflow: hidden;
}
.inspector-scroll {
  position: relative; z-index: 1;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 16px 28px;
  display: flex; flex-direction: column; gap: 9px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .16) transparent;
}
.inspector-scroll::-webkit-scrollbar { width: 9px; }
.inspector-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .13); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
.inspector-scroll > section { display: flex; flex-direction: column; gap: 9px; }

.pane { display: flex; flex-direction: column; gap: 9px; }

/* ---------- segmented control ---------- */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px;
  background: rgba(0, 0, 0, .28); border: 1px solid var(--edge); border-radius: 13px;
}
.tab {
  border: 0; border-radius: 10px; padding: 8px 6px; cursor: pointer;
  background: transparent; color: var(--text-3); font-weight: 600; font-size: 12.5px;
  letter-spacing: .02em; transition: color .16s ease, background .16s ease;
}
.tab:hover { color: var(--text-2); }
.tab.is-on { color: var(--text); background: var(--glass-3); box-shadow: inset 0 1px 0 var(--edge-2), 0 2px 8px -3px rgba(0, 0, 0, .8); }

/* ---------- type ---------- */
h2 {
  margin: 16px 0 2px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--text-3);
}
section > .pane > h2:first-child, .pane > h2:first-child { margin-top: 2px; }
.note { margin: 0; color: var(--text-3); font-size: 11.5px; line-height: 1.5; }
.note b { color: var(--text-2); font-weight: 600; }
.note a { color: var(--text-2); }
.note code { background: rgba(255, 255, 255, .07); padding: 1px 5px; border-radius: 5px; }

/* ---------- fields ---------- */
select, input[type="text"], input[type="number"] {
  background: rgba(255, 255, 255, .045); border: 1px solid var(--edge);
  border-radius: var(--r-sm); padding: 10px 11px; width: 100%;
  transition: border-color .16s ease, background .16s ease;
}
select:hover, input[type="text"]:hover, input[type="number"]:hover { background: rgba(255, 255, 255, .07); }
select:focus-visible, input:focus-visible, button:focus-visible {
  outline: none; border-color: transparent;
  box-shadow: 0 0 0 1.5px var(--p2), 0 0 18px -6px var(--p2);
}
select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
/* The native popup is the platform's, not ours, and it only takes these two
   properties. Without the optgroup rule its labels inherit a colour meant for
   a light menu and the group headings all but vanish on the dark list. */
select option { background: #14161c; color: var(--text); padding: 6px 8px; }
select optgroup {
  background: #0e1015; color: #9aa3b2; font-weight: 700; font-style: normal;
  font-size: 11.5px; letter-spacing: .04em;
}
select optgroup option { color: var(--text); font-weight: 400; letter-spacing: 0; }
input[type="text"].mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; }
input[type="text"]::placeholder { color: var(--text-3); }

/* ---------- buttons ---------- */
.btn {
  position: relative; background: rgba(255, 255, 255, .055);
  border: 1px solid var(--edge); border-radius: var(--r-sm);
  padding: 10px 11px; cursor: pointer; font-weight: 600; font-size: 12.5px; text-align: center;
  color: var(--text-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .1s ease;
}
.btn:hover { background: rgba(255, 255, 255, .1); color: var(--text); border-color: var(--edge-2); }
.btn:active { transform: translateY(1px); }
.btn.is-on { color: var(--text); border-color: transparent; box-shadow: inset 0 0 0 1.5px var(--p2), inset 0 1px 0 rgba(255, 255, 255, .18); }
/* the one action the whole page exists for */
.btn-accent {
  color: #0a0b0f; border-color: transparent; background: var(--prism);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 8px 22px -12px var(--p2);
}
.btn-accent:hover { color: #0a0b0f; filter: brightness(1.08); }
.btn-danger { color: var(--danger); border-color: rgba(255, 138, 143, .22); }
.btn-danger:hover { background: rgba(255, 138, 143, .1); color: var(--danger); border-color: rgba(255, 138, 143, .4); }
.btn-sm { padding: 8px 5px; font-size: 11.5px; }
.wide { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
/* two to a row in a 320px panel is tight — buy the labels a little space */
.row2 > .btn { padding: 10px 7px; font-size: 12px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

/* ---------- labelled rows ---------- */
.ctrl { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; font-size: 12.5px; align-items: center; }
.ctrl > span { color: var(--text-2); }
.ctrl > output { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.ctrl > select, .ctrl > input[type="range"] { grid-column: 1 / -1; }
/* the typable half of a slider: the same slot the read-only output sits in,
   so a row reads identically whether or not its value can be edited */
.ctrl > .num {
  width: 74px; justify-self: end; padding: 3px 6px; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--text);
  background: rgba(255, 255, 255, .05); border: 1px solid var(--edge);
  border-radius: 7px; appearance: textfield;
}
.ctrl > .num::-webkit-inner-spin-button, .ctrl > .num::-webkit-outer-spin-button {
  appearance: none; margin: 0;
}
.ctrl > .num:focus { outline: none; border-color: var(--edge-2); background: rgba(255, 255, 255, .09); }

/* ---------- sliders: the prism shows how far you have gone ---------- */
input[type="range"] { appearance: none; width: 100%; height: 22px; background: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 99px;
  background:
    var(--prism) 0 / var(--p, 0%) 100% no-repeat,
    rgba(255, 255, 255, .12);
}
input[type="range"]::-moz-range-track {
  height: 4px; border-radius: 99px;
  background:
    var(--prism) 0 / var(--p, 0%) 100% no-repeat,
    rgba(255, 255, 255, .12);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 15px; height: 15px; margin-top: -5.5px; border-radius: 50%;
  background: #fff; border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .8), 0 0 0 1px rgba(0, 0, 0, .35);
  transition: transform .12s ease;
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: #fff; border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.05); }

/* ---------- checkboxes ---------- */
.check { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.check input {
  appearance: none; width: 17px; height: 17px; flex: none; margin: 0; cursor: pointer;
  border: 1px solid var(--edge-2); border-radius: 6px; background: rgba(255, 255, 255, .05);
  transition: background .16s ease, border-color .16s ease;
}
.check input:checked {
  background: var(--prism); border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}
.check input:checked::after {
  content: ''; display: block; width: 100%; height: 100%;
  background: no-repeat center/9px 8px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 8'%3E%3Cpath d='M1 4l2.6 2.6L9 1.2' fill='none' stroke='%230a0b0f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---------- colour swatches ---------- */
.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.swatch { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
input[type="color"] {
  appearance: none; width: 28px; height: 28px; flex: none; padding: 0; cursor: pointer;
  background: none; border: 1px solid var(--edge-2); border-radius: 50%; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 2px 6px -2px rgba(0, 0, 0, .8);
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 50%; }

/* ---------- per-part colours ---------- */
.parts { display: flex; flex-direction: column; gap: 6px; }
.parts:empty { display: none; }
.part-cell {
  background: rgba(255, 255, 255, .035); border: 1px solid var(--edge);
  border-radius: var(--r-sm); padding: 6px 9px;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color .16s ease, background .16s ease;
}
.part-cell:hover { background: rgba(255, 255, 255, .06); }
.part-cell.is-set { border-color: var(--edge-2); }
.part-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.part-cell input[type="color"] { width: 24px; height: 24px; }
.part-style { padding: 6px 9px; font-size: 11.5px; background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px; }
.part-row .part-name { flex: 1; min-width: 0; }
.part-row .part-clear {
  flex: none; background: none; border: 1px solid transparent; border-radius: 7px;
  color: var(--text-3); cursor: pointer; padding: 1px 7px; line-height: 1.3; visibility: hidden;
}
.part-cell.is-set .part-clear { visibility: visible; }
.part-row .part-clear:hover { color: var(--danger); border-color: rgba(255, 138, 143, .3); }

/* ---------- folding blocks ---------- */
.fold {
  background: rgba(255, 255, 255, .035); border: 1px solid var(--edge);
  border-radius: var(--r-sm); padding: 9px 11px;
}
.fold[open] { background: rgba(255, 255, 255, .055); border-color: var(--edge-2); }
.fold > summary {
  cursor: pointer; list-style: none; font-weight: 600; font-size: 12.5px; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before {
  content: '▸'; font-size: 10px; color: var(--text-3); transition: transform .16s ease;
}
.fold[open] > summary { color: var(--text); margin-bottom: 8px; }
.fold[open] > summary::before { transform: rotate(90deg); }
.fold > * + * { margin-top: 8px; }

/* ---------- template gallery ----------
   Each tile leads with its palette, because that is what someone is choosing
   between — the controller's name is the second thing you read, not the first. */
/* Capped and scrolled on its own, so nineteen tiles cannot push the rest of
   the panel off the bottom of the screen. */
.templates {
  display: flex; flex-direction: column; gap: 7px;
  max-height: 48vh; overflow-y: auto; overscroll-behavior: contain;
  padding-right: 4px;
}
.templates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
/* A heading per group, so nineteen tiles read as three short lists. */
.tpl-group { display: flex; flex-direction: column; gap: 1px; padding: 8px 2px 1px; }
.tpl-group:first-child { padding-top: 2px; }
.tpl-group-name {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-2);
}
.tpl-group-note { font-size: 11px; color: var(--text-3); line-height: 1.3; }
.tpl {
  display: flex; flex-direction: column; align-items: stretch; gap: 5px; text-align: left;
  padding: 9px 10px 10px; border-radius: var(--r-sm); cursor: pointer;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--edge); color: var(--text);
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.tpl:hover { background: rgba(255, 255, 255, .085); border-color: var(--edge-2); transform: translateY(-1px); }
.tpl:active { transform: none; }
.tpl-sw { display: flex; height: 16px; border-radius: 5px; overflow: hidden; border: 1px solid var(--edge); }
.tpl-sw i { flex: 1; display: block; }
.tpl-name { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.tpl-note { font-size: 11px; color: var(--text-3); line-height: 1.3; }

/* ---------- button remapping ---------- */
.remap { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }
.remap-row {
  display: flex; align-items: center; gap: 9px; padding: 5px 8px; font-size: 12px;
  background: rgba(255, 255, 255, .03); border: 1px solid transparent; border-radius: 9px;
  cursor: pointer; color: var(--text-2); text-align: left; width: 100%;
}
.remap-row:hover { background: rgba(255, 255, 255, .07); color: var(--text); }
.remap-row .remap-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remap-row .remap-idx {
  flex: none; font-variant-numeric: tabular-nums; font-size: 11px; color: var(--text-3);
  background: rgba(0, 0, 0, .3); border-radius: 6px; padding: 1px 7px;
}
.remap-row.is-moved .remap-idx { color: var(--text); background: rgba(255, 255, 255, .12); }
.remap-row.is-listening {
  border-color: transparent; color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--p2), 0 0 18px -8px var(--p2);
}
.remap-row.is-listening .remap-idx { color: var(--p1); }

/* ---------- per-key highlights ---------- */
.keycolors { display: flex; flex-wrap: wrap; gap: 6px; }
.keycolors:empty { display: none; }
.keycolor {
  display: flex; align-items: center; gap: 7px; padding: 4px 6px 4px 5px; font-size: 11.5px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--edge); border-radius: 9px;
  color: var(--text-2);
}
.keycolor input[type="color"] { width: 20px; height: 20px; }
.keycolor button {
  background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0 2px; line-height: 1;
}
.keycolor button:hover { color: var(--danger); }

/* ---------- saved designs ---------- */
.designs { display: flex; flex-direction: column; gap: 6px; }
.designs:empty { display: none; }
.design {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; font-size: 12.5px;
  background: rgba(255, 255, 255, .035); border: 1px solid var(--edge); border-radius: var(--r-sm);
}
.design:hover { background: rgba(255, 255, 255, .06); }
.design .design-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.design .design-at { flex: none; font-size: 11px; color: var(--text-3); }
.design button {
  flex: none; background: none; border: 1px solid transparent; border-radius: 7px;
  color: var(--text-3); cursor: pointer; padding: 2px 8px; font-size: 11.5px; font-weight: 600;
}
.design .design-load:hover { color: var(--text); border-color: var(--edge-2); }
.design .design-del:hover { color: var(--danger); border-color: rgba(255, 138, 143, .3); }

/* ---------- image / GIF layer cards ---------- */
.layers { display: flex; flex-direction: column; gap: 8px; }
.layers:empty { display: none; }
.layer {
  background: rgba(255, 255, 255, .035); border: 1px solid var(--edge);
  border-radius: var(--r-sm); padding: 9px 11px;
}
.layer[open] { background: rgba(255, 255, 255, .06); border-color: var(--edge-2); }
/* the layer the transform box is on, so the panel and the stage agree */
.layer.is-sel { border-color: rgba(120, 200, 255, .55); box-shadow: 0 0 0 1px rgba(120, 200, 255, .22); }
.layer > .ctrl, .layer > .check, .layer > .row2 { margin-top: 8px; }
.layer-head { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.layer-head::-webkit-details-marker { display: none; }
.layer-thumb {
  width: 32px; height: 25px; flex: none; border-radius: 7px; border: 1px solid var(--edge);
  object-fit: contain; background: rgba(0, 0, 0, .4);
}
.layer-thumb.is-vid { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-3); }
.layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 12.5px; }
.layer-x {
  flex: none; background: none; border: 1px solid transparent; border-radius: 7px;
  color: var(--text-3); cursor: pointer; padding: 2px 7px; line-height: 1.3;
}
.layer-x:hover { color: var(--danger); border-color: rgba(255, 138, 143, .3); }

/* ---------- drop target ---------- */
.drop-hint {
  position: absolute; inset: 26px; border: 1.5px dashed rgba(255, 255, 255, .45); border-radius: 26px;
  display: none; align-items: center; justify-content: center; color: var(--text);
  background: rgba(255, 255, 255, .05); backdrop-filter: blur(6px);
  font-weight: 600; letter-spacing: .01em; pointer-events: none; z-index: 4;
}
.stage-wrap.dragging .drop-hint { display: flex; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: rgba(20, 22, 28, .82); backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--edge-2); color: var(--text);
  padding: 11px 18px; border-radius: 999px; font-size: 12.5px; z-index: 40;
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, .95), inset 0 1px 0 var(--spec);
}

/* ---------- narrow ---------- */
@media (max-width: 1040px) {
  :root { --insp: 316px; }
  .inspector { width: var(--insp); }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100%; display: flex; flex-direction: column; }
  .stage-wrap { position: relative; inset: auto; height: 52vh; flex: none; }
  .stage { padding: 0 12px; }        /* the panels are in the flow down here */
  /* the wordmark drops to just its mark so the status has room to sit
     beside it; the only text in the chip is the bare label */
  .hud-brand { left: 16px; font-size: 0; padding: 9px; gap: 0; }
  .hud-status { right: 16px; max-width: calc(100vw - 90px); }
  .hud-status #status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* the chips are children of the app, not the stage, so "bottom" down here
     means the bottom of a scrolling page — join the flow instead */
  .hud-history { position: static; align-self: center; margin: 12px auto 0; }
  .stage-hint {
    position: static; transform: none; margin: 12px auto 0;
    max-width: calc(100vw - 32px); align-self: center;
  }
  .rail {
    position: relative; left: auto; top: auto; transform: none;
    flex-direction: row; justify-content: center; margin: 12px auto 0; border-radius: 18px;
  }
  .inspector { position: relative; inset: auto; width: auto; margin: 12px; flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora i { animation: none; }
  * { transition-duration: .01ms !important; }
}
