/* banesocials studio. Same room as Nameflare and Banechat: Ink (dark) by
 * default, Gallery (light) as the alternative. Depth from soft rings and
 * shadows, never hairlines; pills for buttons; 10 / 16 / 24px radius tiers;
 * crimson only for Export, focus rings and the active key.
 */
@font-face {
  font-family: "Mona Sans";
  src: url("../assets/fonts/MonaSans-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Mona Sans Mono";
  src: url("../assets/fonts/MonaSansMono-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --bg-raised: #111113;
  --surface: #161618;
  --surface-2: #1c1c1f;
  --surface-3: #242428;
  --surface-4: #2e2e33;
  --plate: #111113;
  --ink: #f4f4f2;
  --ink-2: #dadad8;
  --muted: #a3a3aa;
  --faint: #8e8e96;
  --on-ink: var(--bg);
  --ink-hover: color-mix(in srgb, var(--ink) 86%, var(--bg));
  --tint-1: color-mix(in srgb, var(--ink) 6%, transparent);
  --tint-2: color-mix(in srgb, var(--ink) 10%, transparent);
  --tint-3: color-mix(in srgb, var(--ink) 15%, transparent);
  --accent: #e5484d;
  --accent-soft: rgb(229 72 77 / 0.16);
  --accent-gradient: linear-gradient(180deg, #ec565b, #dc3545);
  --accent-hover: linear-gradient(180deg, #f2666b, #e5484d);
  --accent-glow: rgb(229 72 77 / 0.55);
  --on-accent: #fff;
  --success: #4fcf8f;
  --success-soft: rgb(79 207 143 / 0.13);
  --warning: #f0b45a;
  --warning-soft: rgb(240 180 90 / 0.12);
  --danger: #ff6b5e;
  --shadow-1: 0 0 0 1px color-mix(in srgb, var(--ink) 7%, transparent), 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-1-hover: 0 0 0 1px color-mix(in srgb, var(--ink) 14%, transparent), 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 0 0 1px color-mix(in srgb, var(--ink) 11%, transparent), 0 14px 32px -12px rgb(0 0 0 / 0.75);
  --shadow-pop: 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent), 0 28px 70px -20px rgb(0 0 0 / 0.85), 0 6px 16px -6px rgb(0 0 0 / 0.5);
  --ring: 0 0 0 3px rgb(229 72 77 / 0.32);
  --plate-light: radial-gradient(120% 70% at 50% -10%, rgb(255 255 255 / 0.07), transparent 60%);
  --font-ui: "Mona Sans", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Mona Sans Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --r-control: 10px;
  --r-el: 16px;
  --r-panel: 24px;
  --b-h: 36px;
  --b-h-sm: 32px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 140ms;
  --base: 220ms;
  --header-h: 60px;
  --rail-w: 84px;
  --gutter: 12px;
}
/* Gallery: Nameflare's light room. Same look, only colour changes. */
:root[data-theme="gallery"] {
  color-scheme: light;
  --bg: #f4f4f2;
  --bg-raised: #ededeb;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-3: #f4f4f2;
  --surface-4: #e6e6e4;
  --ink: #111113;
  --ink-2: #2a2a2e;
  --muted: #5e5e66;
  --faint: #6c6c74;
  --shadow-1: 0 0 0 1px rgb(17 17 19 / 0.08), 0 1px 2px rgb(17 17 19 / 0.06);
  --shadow-1-hover: 0 0 0 1px rgb(17 17 19 / 0.16), 0 1px 2px rgb(17 17 19 / 0.06);
  --shadow-2: 0 0 0 1px rgb(17 17 19 / 0.08), 0 14px 32px -14px rgb(17 17 19 / 0.25);
  --shadow-pop: 0 0 0 1px rgb(17 17 19 / 0.08), 0 28px 70px -24px rgb(17 17 19 / 0.35), 0 6px 16px -8px rgb(17 17 19 / 0.15);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
img, svg, canvas, video { display: block; max-width: 100%; }
h1, h2, h3, h4 { font-weight: 650; text-wrap: balance; }
code, kbd { font-family: var(--font-mono); font-size: 0.92em; padding: 1px 6px; background: var(--tint-1); border-radius: 6px; }
::selection { background: rgb(229 72 77 / 0.4); color: #fff; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-control); }
* { scrollbar-width: thin; scrollbar-color: var(--tint-3) transparent; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 300; padding: 0 16px; height: var(--b-h);
  display: inline-flex; align-items: center; color: var(--on-ink); background: var(--ink); border-radius: 999px; font-weight: 600;
  transform: translateY(-160%); transition: transform var(--base) var(--ease);
}
.skip-link:focus { transform: none; }

/* ---------------------------------------------------------------- header */
.app-header {
  display: flex; align-items: center; gap: var(--s-4); height: var(--header-h); padding: 0 var(--s-4) 0 var(--s-5);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; margin-left: -4px; border-radius: 999px; transition: background var(--fast) var(--ease); }
.brand:hover { background: var(--tint-1); }
.brand-mark { width: 28px; height: 28px; }
.brand-title { font-size: 19px; font-weight: 800; font-stretch: 112%; letter-spacing: -0.03em; }
.brand-sub { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; color: var(--muted); background: var(--tint-1); border-radius: 999px; font-size: var(--text-2xs); font-weight: 600; white-space: nowrap; }
.header-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.header-btn {
  display: inline-flex; align-items: center; height: var(--b-h); padding: 0 14px; color: var(--muted); border-radius: 999px;
  font-size: var(--text-md); font-weight: 600; white-space: nowrap; transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.header-btn:hover { color: var(--ink); background: var(--tint-1); }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--b-h); height: var(--b-h); flex-shrink: 0; color: var(--muted); border-radius: 999px;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover:not(:disabled) { color: var(--ink); background: var(--tint-1); }
.icon-btn:disabled { opacity: 0.35; }

/* --------------------------------------------------------------- buttons */
.btn {
  --_h: var(--b-h); --_px: 16px; --_fs: var(--text-md);
  --_bg: var(--surface-2); --_ink: var(--ink); --_sh: var(--shadow-1);
  --_bg-h: var(--surface-3); --_ink-h: var(--ink); --_sh-h: var(--shadow-2);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); height: var(--_h); padding: 0 var(--_px);
  color: var(--_ink); background: var(--_bg); border: 0; border-radius: 999px; box-shadow: var(--_sh);
  font: 600 var(--_fs)/1 var(--font-ui); letter-spacing: -0.01em; white-space: nowrap; user-select: none; flex-shrink: 0;
  transition: background var(--fast) var(--ease), box-shadow var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:hover:not(:disabled) { color: var(--_ink-h); background: var(--_bg-h); box-shadow: var(--_sh-h); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.42; box-shadow: none; }
.btn:focus-visible { border-radius: 999px; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { --_bg: var(--ink); --_ink: var(--on-ink); --_sh: none; --_bg-h: var(--ink-hover); --_ink-h: var(--on-ink); --_sh-h: none; }
.btn-ghost { --_bg: transparent; --_ink: var(--muted); --_sh: none; --_bg-h: var(--tint-1); --_ink-h: var(--ink); --_sh-h: none; }
.btn-accent {
  --_bg: var(--accent-gradient); --_ink: var(--on-accent);
  --_sh: inset 0 1px 0 rgb(255 255 255 / 0.22), 0 6px 16px -8px var(--accent-glow);
  --_bg-h: var(--accent-hover); --_ink-h: var(--on-accent); --_sh-h: var(--_sh);
}
.btn-danger { --_ink: var(--danger); --_ink-h: var(--danger); }
.btn.small { --_h: var(--b-h-sm); --_px: 13px; --_fs: var(--text-sm); }
.btn.copied { --_bg: var(--success-soft); --_bg-h: var(--success-soft); --_ink: var(--success); --_ink-h: var(--success); }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; color: var(--muted); background: var(--tint-1);
  border-radius: 999px; font-size: var(--text-xs); font-weight: 600; white-space: nowrap; transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.chip-btn:hover { color: var(--ink); background: var(--tint-2); }
.chip-btn[aria-pressed="true"], .chip-btn.active { color: var(--on-ink); background: var(--ink); }

/* ----------------------------------------------------------------- shell */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(320px, 400px) minmax(0, 1fr);
  gap: var(--gutter);
  height: calc(100dvh - var(--header-h));
  padding: 0 var(--gutter) var(--gutter) 0;
}
.rail { display: flex; flex-direction: column; padding: 4px 0 var(--s-3); overflow-y: auto; scrollbar-width: none; }
.rail-tabs { display: grid; gap: 4px; padding: 0 8px; }
.rail-tab {
  display: grid; justify-items: center; align-content: center; gap: 5px; height: 62px; padding: 0 2px; color: var(--muted);
  border-radius: var(--r-el); font-size: var(--text-2xs); font-weight: 600; transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.rail-tab svg {
  width: 30px; height: 30px; padding: 6px; border-radius: 999px; background: var(--tint-1); stroke-width: 1.9;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.rail-tab:hover { color: var(--ink); background: var(--tint-1); }
.rail-tab:hover svg { background: var(--tint-2); }
.rail-tab:focus-visible { outline: none; }
.rail-tab:focus-visible svg { box-shadow: var(--ring); }
.rail-tab.active { color: var(--ink); }
.rail-tab.active svg { color: var(--on-ink); background: var(--ink); }
.rail-foot { margin-top: auto; padding-top: var(--s-4); color: var(--faint); font-size: var(--text-2xs); text-align: center; }

/* ------------------------------------------------------------------ panel */
.panel {
  position: relative; display: flex; flex-direction: column; gap: var(--s-3); min-height: 0; padding: 0 var(--s-5) var(--s-5);
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; background: var(--surface); border-radius: var(--r-panel); box-shadow: var(--shadow-1);
}
.panel > * { flex-shrink: 0; }
.panel-head {
  position: sticky; top: 0; z-index: 5; display: grid; gap: 6px; margin: 0 calc(var(--s-5) * -1); padding: var(--s-6) var(--s-5) var(--s-3);
  background: var(--surface); border-radius: var(--r-panel) var(--r-panel) 0 0;
}
.panel-head h2 { font-size: 24px; font-weight: 800; font-stretch: 125%; line-height: 1.15; letter-spacing: -0.035em; }
.panel-head p { color: var(--muted); font-size: var(--text-sm); }
.panel-head .head-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }

.hint { color: var(--muted); font-size: var(--text-xs); line-height: 1.55; }
.hint.warn { color: var(--warning); }
.callout { display: grid; gap: 4px; padding: 12px 14px; background: var(--tint-1); border-radius: var(--r-el); font-size: var(--text-xs); color: var(--ink-2); }
.callout.warn { background: var(--warning-soft); color: var(--warning); }
.callout.ok { background: var(--success-soft); color: var(--success); }
.callout strong { font-weight: 650; }

/* groups (details) */
.group { background: var(--bg-raised); border-radius: var(--r-el); }
.group > summary {
  position: relative; display: flex; align-items: center; gap: var(--s-3); min-height: 54px; padding: 10px 42px 10px 16px;
  cursor: pointer; list-style: none; border-radius: var(--r-el); transition: background var(--fast) var(--ease);
}
.group > summary::-webkit-details-marker { display: none; }
.group > summary::after {
  content: ""; position: absolute; top: 50%; right: 18px; width: 7px; height: 7px; margin-top: -5px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
  transition: transform var(--base) var(--ease), border-color var(--fast) var(--ease);
}
.group[open] > summary::after { transform: translateY(3px) rotate(-135deg); }
.group > summary:hover { background: var(--tint-1); }
.group-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.group-title { font-size: var(--text-md); font-weight: 650; }
.group-state { color: var(--muted); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.group-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; gap: var(--s-4) var(--s-3); padding: 4px 16px 18px; }
.group-body > .full, .group-body > .switch-row, .group-body > .callout, .group-body > .hint { grid-column: 1 / -1; }
.plain-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4) var(--s-3); }
.plain-body > .full, .plain-body > .switch-row { grid-column: 1 / -1; }

/* fields */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > .lbl { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); color: var(--ink-2); font-size: var(--text-sm); font-weight: 600; line-height: 1.3; }
.field > .lbl .val { cursor: text; }
:where(input[type="text"], input[type="url"], input[type="search"], input[type="number"], select, textarea) {
  width: 100%; height: var(--b-h); padding: 0 12px; color: var(--ink); background: var(--surface-2); border: 0; border-radius: var(--r-control);
  box-shadow: var(--shadow-1); font-size: var(--text-md); line-height: 1.2; transition: box-shadow var(--fast) var(--ease);
}
textarea { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; font-family: var(--font-mono); font-size: var(--text-xs); }
:where(input, select, textarea)::placeholder { color: var(--faint); opacity: 1; }
:where(input[type="text"], input[type="url"], input[type="search"], input[type="number"], select, textarea):hover { box-shadow: var(--shadow-1-hover); }
:where(input[type="text"], input[type="url"], input[type="search"], input[type="number"], select, textarea):focus { box-shadow: 0 0 0 1px var(--accent), var(--ring); }
input[type="number"] { font-family: var(--font-mono); font-size: var(--text-sm); }
select {
  appearance: none; padding-right: 32px; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a3a3aa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
option, optgroup { background: var(--surface-2); color: var(--ink); }

.val {
  display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 22px; padding: 0 8px; color: var(--ink);
  background: var(--tint-1); border-radius: 999px; font: 500 var(--text-2xs)/1 var(--font-mono); font-variant-numeric: tabular-nums;
}
.val-input { width: 64px; height: 22px; padding: 0 6px; border-radius: 999px; font-size: var(--text-2xs); text-align: center; }
input[type="range"] {
  --fill: 50%; width: 100%; height: 22px; padding: 0; background: transparent; border: 0; appearance: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: linear-gradient(90deg, var(--ink) 0 var(--fill), var(--tint-2) var(--fill) 100%); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--tint-2); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; background: var(--ink); border: 0; border-radius: 50%;
  box-shadow: 0 0 0 3px var(--surface), 0 1px 3px rgb(0 0 0 / 0.6); transition: transform var(--fast) var(--ease);
}
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; background: var(--ink); border: 0; border-radius: 50%; box-shadow: 0 0 0 3px var(--surface), 0 1px 3px rgb(0 0 0 / 0.6); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px rgb(229 72 77 / 0.45); }

.color-row { display: flex; gap: var(--s-2); align-items: center; }
.color-row input[type="text"] { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: var(--text-sm); }
.swatch {
  flex-shrink: 0; width: var(--b-h); height: var(--b-h); padding: 4px; background: var(--surface-2); border: 0; border-radius: var(--r-control);
  box-shadow: var(--shadow-1); cursor: pointer; appearance: none; -webkit-appearance: none;
}
.swatch::-webkit-color-swatch-wrapper { padding: 0; }
.swatch::-webkit-color-swatch { border: 0; border-radius: 6px; }
.swatch::-moz-color-swatch { border: 0; border-radius: 6px; }

/* segmented */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px; background: var(--tint-1); border-radius: 999px; }
.field .seg, .seg.wide { display: grid; width: 100%; }
.seg > button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 10px; min-width: 0; color: var(--muted);
  border-radius: 999px; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.seg > button:hover { color: var(--ink); }
.seg > button.active { color: var(--ink); background: var(--surface-3); box-shadow: var(--shadow-1); }
.seg > button:focus-visible { outline: none; box-shadow: var(--ring); }
.seg.small > button { height: 26px; padding: 0 9px; font-size: var(--text-xs); }

/* switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 32px; }
.switch-row .sw-text { display: grid; gap: 2px; min-width: 0; }
.switch-row .sw-title { font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
.switch-row .sw-desc { font-size: var(--text-xs); color: var(--muted); }
.switch { position: relative; display: inline-block; flex-shrink: 0; width: 38px; height: 22px; }
.switch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--tint-3); border-radius: 999px; transition: background var(--base) var(--ease); pointer-events: none; }
.switch span::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: var(--ink-2); border-radius: 50%;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.5); transition: transform var(--base) var(--ease), background var(--base) var(--ease);
}
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::before { transform: translateX(16px); background: var(--bg); box-shadow: none; }
.switch input:focus-visible + span { box-shadow: var(--ring); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.row-inline { display: flex; gap: var(--s-2); align-items: center; }
.row-inline > input { flex: 1; min-width: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* option tiles (shapes, transitions, icon styles) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.tile {
  display: grid; justify-items: center; gap: 6px; padding: 10px 6px 8px; color: var(--muted); background: var(--surface-2); border-radius: 12px;
  box-shadow: var(--shadow-1); font-size: var(--text-2xs); font-weight: 600; text-align: center; line-height: 1.2;
  transition: color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
.tile:hover { color: var(--ink); box-shadow: var(--shadow-1-hover); }
.tile.active { color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.tile canvas { width: 64px; height: 30px; }
.tile.text-only { padding: 9px 6px; }
.tile-group-title { grid-column: 1 / -1; margin-top: 6px; color: var(--faint); font-size: var(--text-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.tile.multi[aria-pressed="true"] { color: var(--on-ink); background: var(--ink); box-shadow: none; }

.ease-graph { width: 100%; height: auto; aspect-ratio: 560 / 200; background: var(--bg); border-radius: 12px; }

/* anchor picker */
.anchor { display: grid; grid-template-columns: repeat(3, 32px); grid-template-rows: repeat(3, 24px); gap: 4px; padding: 6px; background: var(--tint-1); border-radius: 12px; width: max-content; }
.anchor button { border-radius: 6px; background: var(--tint-2); transition: background var(--fast) var(--ease); }
.anchor button:hover { background: var(--tint-3); }
.anchor button.active { background: var(--ink); }

/* ---------------------------------------------------------- socials list */
.items { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.item { background: var(--tint-1); border-radius: var(--r-el); transition: background var(--fast) var(--ease), opacity var(--fast) var(--ease); }
.item:hover, .item:focus-within { background: var(--tint-2); }
.item.off { opacity: 0.55; }
.item.dragging { opacity: 0.4; }
.item.drop-before { box-shadow: 0 -2px 0 0 var(--accent); }
.item.drop-after { box-shadow: 0 2px 0 0 var(--accent); }
.item-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 6px; }
.drag { display: grid; place-items: center; width: 18px; height: 32px; color: var(--faint); cursor: grab; border-radius: 6px; flex-shrink: 0; }
.drag:hover { color: var(--ink); background: var(--tint-1); }
.drag svg { width: 14px; height: 14px; stroke-width: 2.4; }
.plat-chip {
  --pc: var(--muted); display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--pc) 18%, var(--surface)); transition: box-shadow var(--fast) var(--ease);
}
.plat-chip:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc) 55%, transparent); }
.plat-chip svg, .plat-chip img { width: 18px; height: 18px; fill: var(--pcl, var(--pc)); stroke: none; border-radius: 4px; object-fit: contain; }
.item-main { display: grid; gap: 4px; flex: 1; min-width: 0; }
.item-name { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 650; color: var(--muted); }
.item-name .pfx { color: var(--faint); font-weight: 500; }
.item-main input { height: 32px; font-size: var(--text-sm); }
.item-more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); padding: 4px 12px 14px 34px; }
.item-more > .full { grid-column: 1 / -1; }
.caret-btn svg { transition: transform var(--base) var(--ease); }
.caret-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

/* media field */
.media-field { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.media-thumb {
  width: 52px; height: 36px; flex-shrink: 0; border-radius: 8px; background: repeating-conic-gradient(#3a3a40 0% 25%, #26262b 0% 50%) 50% / 10px 10px;
  box-shadow: var(--shadow-1); overflow: hidden;
}
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-name { flex: 1; min-width: 0; font-size: var(--text-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-list { display: grid; gap: 6px; }

/* looks */
.looks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
.look { display: grid; gap: 6px; text-align: left; border-radius: var(--r-el); }
.look-plate {
  position: relative; aspect-ratio: 16 / 6.2; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-1);
  background: var(--plate-light), var(--plate); transition: box-shadow var(--fast) var(--ease);
}
.look-plate canvas { width: 100%; height: 100%; }
.look:hover .look-plate, .look:focus-visible .look-plate { box-shadow: var(--shadow-2); }
.look.active .look-plate { box-shadow: 0 0 0 2px var(--ink), var(--shadow-2); }
.look:focus-visible { outline: none; }
.look-name { font-size: var(--text-sm); font-weight: 650; padding: 0 2px; }
.look-note { font-size: var(--text-2xs); color: var(--muted); padding: 0 2px; line-height: 1.4; }
.saved-look { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; background: var(--tint-1); border-radius: 12px; }
.saved-look span { flex: 1; font-weight: 600; font-size: var(--text-sm); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-chip { display: inline-flex; align-items: center; gap: 8px; }
.scene-chip i { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 1px rgb(255 255 255 / 0.18); }

/* font picker */
.font-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 40px; padding: 0 12px; text-align: left;
  background: var(--surface-2); border-radius: var(--r-control); box-shadow: var(--shadow-1); font-size: 17px; transition: box-shadow var(--fast) var(--ease);
}
.font-btn:hover { box-shadow: var(--shadow-1-hover); }
.font-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-btn small { flex-shrink: 0; color: var(--faint); font: 600 var(--text-2xs)/1 var(--font-ui); text-transform: uppercase; letter-spacing: 0.06em; }
.font-pop {
  position: fixed; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: 360px; height: min(560px, 80vh); padding: 12px;
  background: var(--surface); border-radius: var(--r-el); box-shadow: var(--shadow-pop);
}
.font-pop-head { display: flex; gap: 8px; }
.font-list { position: relative; flex: 1; overflow-y: auto; margin: 0 -6px; }
.font-list-inner { position: relative; }
.font-row {
  position: absolute; left: 6px; right: 6px; height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px;
  border-radius: 10px; font-size: 18px; white-space: nowrap; transition: background var(--fast) var(--ease);
}
.font-row:hover, .font-row.kbd { background: var(--tint-1); }
.font-row.active { background: var(--tint-2); }
.font-row span { overflow: hidden; text-overflow: ellipsis; }
.font-row small { flex-shrink: 0; color: var(--faint); font: 600 var(--text-2xs)/1 var(--font-ui); }
.font-sep { position: absolute; left: 12px; right: 12px; height: 28px; display: flex; align-items: flex-end; color: var(--faint); font-size: var(--text-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }

/* ------------------------------------------------------------------ stage */
.stage-col { min-width: 0; min-height: 0; }
.bezel { display: flex; flex-direction: column; height: 100%; overflow: hidden; background: var(--surface); border-radius: var(--r-panel); box-shadow: var(--shadow-1); }
.stage-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 14px var(--s-5) 10px; flex-wrap: wrap; }
.stage-title { display: flex; align-items: center; gap: 10px; }
.stage-title h1 { font-size: 20px; font-weight: 800; font-stretch: 125%; letter-spacing: -0.035em; }
.res-tag {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; color: var(--ink); background: var(--surface-2); border-radius: 999px;
  box-shadow: var(--shadow-1); font: 500 var(--text-2xs)/1 var(--font-mono); font-variant-numeric: tabular-nums;
}
.stage-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dot { display: block; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1px rgb(255 255 255 / 0.2); }
.dot-checker { background: repeating-conic-gradient(#6b6b73 0% 25%, #2a2a30 0% 50%) 50% / 6px 6px; }
.dot-dark { background: #111113; }
.dot-light { background: #ecebe8; }
.dot-game { background: linear-gradient(135deg, #3c5a73, #6a3b4f); }
.dot-green { background: #00b140; }
.dot-custom { background: var(--surface-4) center / cover no-repeat; box-shadow: inset 0 0 0 1.5px var(--tint-3); }
.stage {
  position: relative; flex: 1; min-height: 0; margin: 0 var(--s-3); border-radius: 18px; overflow: hidden; display: grid; place-items: center;
  background: var(--plate-light), #0e0e10; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.04);
}
.stage-inner { position: relative; box-shadow: 0 0 0 1px rgb(255 255 255 / 0.06); }
.stage-inner.bd-checker { background: repeating-conic-gradient(#2a2a30 0% 25%, #1f1f24 0% 50%) 50% / 24px 24px; }
.stage-inner.bd-dark { background: #111113; }
.stage-inner.bd-light { background: #ecebe8; }
.stage-inner.bd-green { background: #00b140; }
.stage-inner.bd-game {
  background:
    radial-gradient(60% 50% at 70% 30%, rgb(255 200 120 / 0.35), transparent 60%),
    radial-gradient(50% 60% at 20% 80%, rgb(80 140 255 / 0.3), transparent 60%),
    linear-gradient(160deg, #2c4258 0%, #3d2a3e 55%, #1b1d29 100%);
}
.stage-inner.bd-custom { background: #111113 center / cover no-repeat; }
.stage-inner canvas { width: 100%; height: 100%; }
.bounds { position: absolute; inset: 0; pointer-events: none; }
.bounds-crop { position: absolute; outline: 1.5px dashed rgb(255 255 255 / 0.7); outline-offset: 0; box-shadow: 0 0 0 9999px rgb(0 0 0 / 0.25); }
.bounds-safe { position: absolute; inset: 5%; outline: 1px solid rgb(255 255 255 / 0.25); }
.stage-note {
  position: absolute; top: 10px; left: 10px; display: none; align-items: center; gap: 7px; height: 24px; padding: 0 10px; color: #c9c9cf;
  background: rgb(14 14 17 / 0.7); border-radius: 999px; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.1); backdrop-filter: blur(8px);
  font-size: var(--text-2xs); font-weight: 600; pointer-events: none;
}
.stage-note.show { display: inline-flex; }
.stage-note::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.stage-note.live { color: #8ff0bf; }
.stage-note.live::before { background: var(--success); }

.transport { display: flex; align-items: center; gap: 8px; padding: 12px var(--s-4) 14px; }
.play-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; color: var(--on-ink); background: var(--ink); border-radius: 999px;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.play-btn:hover { background: var(--ink-hover); }
.play-btn:active { transform: scale(0.96); }
.play-btn svg { width: 18px; height: 18px; stroke-width: 2.2; }
.play-btn .i-play { fill: currentColor; display: none; }
.play-btn.paused .i-play { display: block; }
.play-btn.paused .i-pause { display: none; }
.scrub { position: relative; flex: 1; min-width: 80px; height: 32px; cursor: pointer; border-radius: 10px; touch-action: none; }
.scrub:focus-visible { box-shadow: var(--ring); outline: none; }
.scrub-segs { position: absolute; left: 0; right: 0; top: 11px; height: 10px; border-radius: 999px; background: var(--tint-1); overflow: hidden; }
.scrub-seg { position: absolute; top: 0; bottom: 0; border-radius: 999px; opacity: 0.85; box-shadow: inset 0 0 0 1px var(--tint-3); }
.scrub-head { position: absolute; top: 4px; bottom: 4px; width: 3px; margin-left: -1.5px; border-radius: 3px; background: var(--ink); box-shadow: 0 0 0 2px var(--surface); }
.time { flex-shrink: 0; min-width: 96px; text-align: right; color: var(--muted); font: 500 var(--text-xs)/1 var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- dialogs */
.dlg {
  margin: auto; width: min(720px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 48px)); padding: 0; border: 0; color: var(--ink);
  background: var(--surface); border-radius: var(--r-panel); box-shadow: var(--shadow-pop);
}
.dlg::backdrop { background: rgb(0 0 0 / 0.55); backdrop-filter: blur(2px); }
.dlg-inner { display: flex; flex-direction: column; gap: 12px; padding: 20px; max-height: inherit; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; }
.dlg-head h2 { font-size: 20px; font-weight: 800; font-stretch: 125%; letter-spacing: -0.03em; }
.plat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; overflow-y: auto; padding: 2px; min-height: 120px; }
.plat-tile {
  --pc: #888; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 10px; background: var(--surface-2); border-radius: 12px;
  box-shadow: var(--shadow-1); font-size: var(--text-sm); font-weight: 600; text-align: left; transition: box-shadow var(--fast) var(--ease);
}
.plat-tile:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc) 60%, transparent); }
.plat-tile i { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 999px; background: color-mix(in srgb, var(--pc) 18%, var(--surface)); }
.plat-tile svg { width: 15px; height: 15px; fill: var(--pcl, var(--pc)); stroke: none; }
.plat-tile span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; overflow-y: auto; min-height: 140px; padding: 2px; }
.media-card { display: grid; gap: 6px; padding: 6px; background: var(--surface-2); border-radius: 12px; box-shadow: var(--shadow-1); }
.media-card .media-thumb { width: 100%; height: 84px; }
.media-card .meta { display: flex; align-items: center; gap: 6px; font-size: var(--text-2xs); color: var(--muted); }
.media-card .meta span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg.drop { box-shadow: 0 0 0 3px var(--accent), var(--shadow-pop); }

/* export */
.progress { height: 8px; border-radius: 999px; background: var(--tint-1); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 999px; transition: width 120ms linear; }
.result { display: grid; gap: 10px; padding: 12px; background: var(--bg-raised); border-radius: var(--r-el); }
.result-media { max-height: 260px; display: grid; place-items: center; border-radius: 12px; overflow: hidden; background: repeating-conic-gradient(#2a2a30 0% 25%, #1f1f24 0% 50%) 50% / 16px 16px; }
.result-media img, .result-media video { max-height: 260px; object-fit: contain; }
.result-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font: 500 var(--text-xs)/1.4 var(--font-mono); }
.link-box { display: flex; gap: 8px; align-items: center; }
.link-box input { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); }
.stat-row { display: flex; flex-wrap: wrap; gap: 6px; }
.stat { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; color: var(--muted); background: var(--tint-1); border-radius: 999px; font-size: var(--text-2xs); font-weight: 600; }
.stat b { color: var(--ink); font: 500 var(--text-2xs)/1 var(--font-mono); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 400; max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; color: var(--on-ink);
  background: var(--ink); border-radius: 999px; box-shadow: var(--shadow-pop); font-weight: 600; font-size: var(--text-sm);
  transform: translate(-50%, 140%); opacity: 0; transition: transform var(--base) var(--ease), opacity var(--base) var(--ease); pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ------------------------------------------------------------ responsive */

/* ------------------------------------------------------------ tool nav */
.app-nav { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; background: var(--tint-1); border-radius: 999px; }
.app-nav a {
  display: inline-flex; align-items: center; height: 28px; padding: 0 13px; color: var(--muted); border-radius: 999px;
  font-size: var(--text-sm); font-weight: 600; transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.app-nav a:hover { color: var(--ink); }
.app-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-3); box-shadow: var(--shadow-1); }
.app-nav a:focus-visible { outline: none; box-shadow: var(--ring); }

/* --------------------------------------------------------------- panels */
.tw-stage { flex: 1; min-height: 0; margin: 0 var(--s-3) var(--s-3); border-radius: 18px; overflow: auto; overscroll-behavior: contain; }
.tw-about {
  min-height: 100%; padding: 32px 28px 40px; background: #0e0e10; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.04);
  transition: background var(--base) var(--ease);
}
.tw-about[data-bg="light"] { background: #f7f7f8; }
.tw-about[data-bg="checker"] { background: repeating-conic-gradient(#2a2a30 0% 25%, #1f1f24 0% 50%) 50% / 24px 24px; }
/* Twitch lays panels out in 320 px columns, 20 px apart */
.tw-grid { display: grid; grid-template-columns: repeat(auto-fill, 320px); gap: 22px 20px; justify-content: center; align-items: start; }
.pv { display: grid; gap: 8px; margin: 0; }
.pv-pick { display: block; width: 320px; border-radius: 6px; transition: box-shadow var(--fast) var(--ease); }
.pv-canvas { display: block; width: 100%; height: auto; }
.pv-canvas { transition: filter var(--fast) var(--ease), transform var(--base) var(--ease); }
.pv-pick:hover .pv-canvas { filter: brightness(1.08); }
.pv-pick:active .pv-canvas { transform: scale(0.99); }
.pv-pick:focus-visible { outline: none; box-shadow: var(--ring); }
.pv.sel figcaption { color: #efeff1; }
.tw-about[data-bg="light"] .pv.sel figcaption { color: #0e0e10; }
.tw-about .pv.sel .pv-num { color: var(--on-accent); background: var(--accent); }
.pv figcaption { display: flex; align-items: center; gap: 8px; min-height: 28px; color: #adadb8; font-size: var(--text-xs); font-weight: 600; }
.tw-about[data-bg="light"] figcaption { color: #53535f; }
.pv-num {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: rgb(255 255 255 / 0.08);
  font: 600 var(--text-2xs)/1 var(--font-mono); font-variant-numeric: tabular-nums;
}
.tw-about[data-bg="light"] .pv-num { background: rgb(0 0 0 / 0.07); }
.pv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv figcaption .icon-btn { width: 28px; height: 28px; color: inherit; opacity: 0.8; }
.pv figcaption .icon-btn svg { width: 16px; height: 16px; }
.pv figcaption .icon-btn:hover:not(:disabled) { opacity: 1; color: inherit; background: rgb(127 127 140 / 0.18); }
.tw-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 12px; padding: 60px 0; color: #adadb8; }
.prow.sel { background: var(--tint-2); }
.preset-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-chip i { display: inline-grid; width: 14px; height: 14px; }
.preset-chip svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.own-img { margin-left: auto; color: var(--ink); background: var(--tint-2); }
.panel-looks .look-plate { aspect-ratio: auto; display: grid; place-items: center; padding: 14px 12px; }
.panel-looks .look-plate canvas { width: 100%; height: auto; }
.sub-head { margin-top: var(--s-4); font-size: var(--text-md); font-weight: 700; letter-spacing: -0.01em; }

@media (max-width: 1100px) {
  body { overflow: auto; }
  .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: 52vh auto; height: auto; }
  .stage-col { grid-column: 2; grid-row: 1; }
  .panel { grid-column: 2; grid-row: 2; max-height: none; overflow: visible; }
  .rail { grid-row: 1 / span 2; position: sticky; top: 0; height: calc(100dvh - var(--header-h)); }
}
@media (max-width: 700px) {
  :root { --rail-w: 0px; }
  .shell { grid-template-columns: minmax(0, 1fr); padding: 0 8px 80px; }
  .stage-col, .panel { grid-column: 1; }
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; z-index: 50; padding: 6px; flex-direction: row;
    background: color-mix(in srgb, var(--surface) 97%, transparent); backdrop-filter: blur(12px); box-shadow: var(--shadow-2);
  }
  .rail-tabs { grid-auto-flow: column; grid-auto-columns: 64px; overflow-x: auto; }
  .rail-tab { height: 56px; }
  .rail-foot { display: none; }
  .header-btn { display: none; }
  .brand-sub { display: none; }
  .brand-title { display: none; }
  .app-header { gap: var(--s-2); padding: 0 var(--s-3); }
  .app-nav a { padding: 0 10px; }
  #undo, #redo { display: none; }
  .looks { grid-template-columns: 1fr; }
  .tw-about { padding: 20px 12px; }
  .tw-grid { grid-template-columns: minmax(0, 320px); }
  .pv-pick { width: 100%; }
  #speeds { display: none; }
  .time { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* live transition preview beside the hovered tile */
.tr-pop {
  position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none;
  display: grid; gap: 6px; padding: 8px 8px 10px;
  background: var(--bg); border-radius: 16px; box-shadow: var(--shadow-2);
  opacity: 0; scale: 0.96; transition: opacity 0.12s ease-out, scale 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.tr-pop.on { opacity: 1; scale: 1; }
.tr-pop canvas { width: 300px; height: 95px; display: block; }
.tr-pop-name { justify-self: center; color: var(--muted); font-size: var(--text-2xs); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .tr-pop { transition: none; } }

/* paste-a-link row under every image / GIF / video field */
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 8px; }
.link-row input { min-width: 0; }
.link-msg:empty { display: none; }
.link-msg.bad { color: var(--danger); }

/* style filter above the looks grid */
.look-cats { display: grid; width: 100%; margin-bottom: var(--s-3, 12px); }
.look-cats > button { padding-inline: 4px; font-size: var(--text-xs); }
