:root {
  --bg: #000000;
  --surface: #0f0f0f;
  --surface-2: #1f1f1f;
  --sub-surface: #1f1f1f;
  --surface-tile: #272727;
  --ink: #ededed;
  --ink-strong: #ffffff;
  --muted: #a1a1a1;
  --faint: #6e6e6e;
  --line-alpha: 0.14;
  --line: rgba(255, 255, 255, var(--line-alpha));
  --sub-line: rgba(255, 255, 255, calc(var(--line-alpha) * 0.78));
  --line-strong: rgba(255, 255, 255, 0.18);
  --chip: #2b2b2b;
  --chip-hover: #353535;
  --chip-active: #252525;
  --seg-track: #0f0f0f;
  --seg-active: #252525;
  --brand-grad: linear-gradient(100deg, #ffc21a 0%, #ff3d9e 32%, #9a4dff 64%, #1fb0ff 100%);
  --font: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 16px;
  --pill: 999px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}
code, kbd {
  font-family: var(--mono);
  font-size: 11.5px;
}

/* App Shell */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
}

/* Topbar */
.topbar {
  flex: 0 0 56px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--sub-line);
  z-index: 40;
}
.topbar-start {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.brand-face {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}
.brand-face boop-face { filter: invert(1); }
.brand-wordmark {
  font-family: Geist, var(--font);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.04em;
  color: #fff;
}
.wordmark-face {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.badge {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.badge-version {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.scene-switch {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--seg-track);
}
.scene-switch button {
  padding: 5px 16px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: background-color 0.16s, color 0.16s;
}
.scene-switch button:hover { color: var(--ink-strong); }
.scene-switch button[aria-selected="true"] {
  background: var(--seg-active);
  color: var(--ink-strong);
  font-weight: 600;
}

.topbar-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.top-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}
.top-btn:hover {
  background: var(--chip-hover);
  border-color: rgba(255, 255, 255, 0.18);
}
.top-icon-btn {
  width: 32px;
  padding: 0;
  justify-content: center;
}
.top-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.top-btn .gh-icon { fill: currentColor; stroke: none; }
.top-btn .ext-arrow { width: 10px; height: 10px; opacity: 0.7; }
.topbar .top-btn[aria-expanded="true"] {
  background: var(--seg-active);
  border-color: var(--line-strong);
  color: #fff;
}

.lang-menu { position: relative; }
.lang-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 146px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(14, 14, 14, 0.98);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.7);
  display: grid;
  gap: 2px;
  z-index: 60;
}
.lang-popover button {
  text-align: left;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
}
.lang-popover button:hover { background: var(--chip-hover); color: #fff; }
.lang-popover button[aria-checked="true"] { background: var(--seg-active); color: #fff; font-weight: 600; }

/* Workspace Grid */
.workspace {
  flex: 0 0 auto;
  height: max(calc(100dvh - 56px), calc(var(--stage-min-h, 280px) + 278px));
  min-height: 0;
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  padding: 12px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 416px;
  gap: 14px;
}

.card {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

/* Left Column: Merged Stage Frame + Action Dock */
.left-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.stage-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  transition: border-color 0.2s ease;
}
.stage-canvas {
  position: relative;
  flex: 1;
  min-height: var(--stage-min-h, 280px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  /* No fade between backgrounds: a gradient and a plain colour cannot blend,
     and the half-way frame showed the dark card underneath (a black flash). */
}
.stage-card[data-scene="chat"] .stage-canvas {
  min-height: 260px;
}
.stage-card[data-backdrop="dark"] .stage-canvas {
  /* The stage itself is lit: brighter in the middle, darker at the edges.
     The vignette is centred and reaches full strength only past the corners,
     in eased steps, so no dark band shows inside the picture. */
  background:
    radial-gradient(farthest-corner at 50% 50%, transparent 30%, color-mix(in srgb, #080808 18%, transparent) 52%, color-mix(in srgb, #080808 45%, transparent) 74%, color-mix(in srgb, #080808 75%, transparent) 92%, #080808 108%),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) center / 32px 32px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) center / 32px 32px,
    radial-gradient(farthest-corner at 50% 46%, #222222 0%, #181818 30%, #121212 60%, #0b0b0b 100%);
}
.stage-card[data-backdrop="light"] .stage-canvas {
  background:
    radial-gradient(farthest-corner at 50% 50%, transparent 30%, color-mix(in srgb, #b5b8be 18%, transparent) 52%, color-mix(in srgb, #b5b8be 45%, transparent) 74%, color-mix(in srgb, #b5b8be 75%, transparent) 92%, #b5b8be 108%),
    linear-gradient(rgba(0, 0, 0, 0.045) 1px, transparent 1px) center / 32px 32px,
    linear-gradient(90deg, rgba(0, 0, 0, 0.045) 1px, transparent 1px) center / 32px 32px,
    radial-gradient(farthest-corner at 50% 46%, #ffffff 0%, #eef0f3 30%, #dfe1e5 62%, #c9ccd1 100%);
}
/* A skin's or a chosen colour gets the same lit stage: a soft light in the
   middle, darker edges and the grid, laid over the colour itself. */
.stage-card[data-backdrop="skin"] .stage-canvas,
.stage-card[data-backdrop="custom"] .stage-canvas {
  --stage-edge: rgba(0, 0, 0, 0.5);
  --stage-light: rgba(255, 255, 255, 0.07);
  --stage-grid: rgba(255, 255, 255, 0.04);
  background:
    radial-gradient(farthest-corner at 50% 50%, transparent 30%, color-mix(in srgb, var(--stage-edge) 18%, transparent) 52%, color-mix(in srgb, var(--stage-edge) 45%, transparent) 74%, color-mix(in srgb, var(--stage-edge) 75%, transparent) 92%, var(--stage-edge) 108%),
    radial-gradient(farthest-corner at 50% 46%, var(--stage-light), color-mix(in srgb, var(--stage-light) 40%, transparent) 30%, transparent 62%),
    linear-gradient(var(--stage-grid) 1px, transparent 1px) center / 32px 32px,
    linear-gradient(90deg, var(--stage-grid) 1px, transparent 1px) center / 32px 32px,
    var(--stage-bg);
}
.stage-card[data-backdrop="skin"] .stage-canvas { --stage-bg: var(--skin-stage-bg, #202024); }
.stage-card[data-backdrop="custom"] .stage-canvas { --stage-bg: var(--custom-stage-bg, #141416); }
.stage-card.is-light-bg[data-backdrop="skin"] .stage-canvas,
.stage-card.is-light-bg[data-backdrop="custom"] .stage-canvas {
  --stage-edge: rgba(60, 64, 72, 0.28);
  --stage-light: rgba(255, 255, 255, 0.35);
  --stage-grid: rgba(0, 0, 0, 0.045);
}

/* Solo Stage View (100% pure avatar stage) */
.stage-view {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0 16px;
}
.stage-center {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.stage-glow {
  display: none; /* no glow round avatars */
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 68%);
  pointer-events: none;
}
.stage-card[data-backdrop="light"] .stage-glow,
.stage-card[data-backdrop="skin"] .stage-glow { opacity: 0; }
#stageFace { position: relative; z-index: 2; }
/* First-visit loader, in the middle of the stage until the avatar shows. */
.stage-loader { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; justify-items: center; gap: 10px; pointer-events: none; transition: opacity .35s ease; }
.stage-loader.is-done { opacity: 0; }
.stage-loader-bar { width: 140px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.stage-loader-bar i { display: block; height: 100%; background: rgba(255, 255, 255, .75); transform: scaleX(0); transform-origin: left; transition: transform .25s ease-out; }
.stage-loader-text { font-size: 11.5px; color: var(--faint); letter-spacing: .04em; }
.stage-card[data-backdrop="light"] .stage-loader-bar { background: rgba(0, 0, 0, .1); }
.stage-card[data-backdrop="light"] .stage-loader-bar i { background: rgba(0, 0, 0, .6); }

/* Stage Hand-Drawn Onboarding Callouts */
.stage-hints {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  user-select: none;
  color: rgba(255, 255, 255, 0.46);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.stage-card[data-backdrop="light"] .stage-hints {
  color: rgba(15, 23, 42, 0.45);
}
.stage-hints[hidden] { display: none; }
.stage-hints.is-dismissed {
  opacity: 0;
  transform: scale(0.985);
}
.stage-hints-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stage-hint-label {
  position: absolute;
  margin: 0;
  font-size: 12.5px;
  font-weight: 450;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: currentColor;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.stage-hint-label.is-antenna {
  transform: rotate(-3deg);
  transform-origin: left center;
}
.stage-hint-label.is-body {
  text-align: right;
  transform: rotate(2.5deg);
  transform-origin: right center;
}
.stage-hints.is-ready .stage-hint-label.is-antenna {
  opacity: 1;
  transition-delay: 0.35s;
}
.stage-hints.is-ready .stage-hint-label.is-body {
  opacity: 1;
  transition-delay: 0.65s;
}
.stage-hints.is-drawing .hint-arrow-antenna .hint-shaft {
  animation: hint-draw 0.72s 0.3s ease-out forwards;
}
.stage-hints.is-drawing .hint-arrow-antenna .hint-head {
  animation: hint-draw 0.22s 0.98s ease-out forwards;
}
.stage-hints.is-drawing .hint-arrow-body .hint-shaft {
  animation: hint-draw 0.72s 0.6s ease-out forwards;
}
.stage-hints.is-drawing .hint-arrow-body .hint-head {
  animation: hint-draw 0.22s 1.28s ease-out forwards;
}
.stage-hint-label.is-pet {
  text-align: right;
  transform: rotate(-2deg);
  transform-origin: right center;
}
.stage-hints.is-ready .stage-hint-label.is-pet {
  opacity: 1;
  transition-delay: 0.95s;
}
.stage-hints.is-drawing .hint-arrow-pet .hint-shaft {
  animation: hint-draw 0.72s 0.9s ease-out forwards;
}
.stage-hints.is-drawing .hint-arrow-pet .hint-head {
  animation: hint-draw 0.22s 1.58s ease-out forwards;
}
/* The hints show at once: no fade, no drawing. */
.stage-hints .stage-hint-label { transition: none !important; }
.stage-hints path { animation: none !important; }
@keyframes hint-draw {
  to { stroke-dashoffset: 0; }
}

/* Official boopface.com Sidebar Chat Layout */
.chat-view {
  flex: 1;
  min-height: 0;
  padding: 10px;
  display: flex;
  background: #0d0d0e;
}
.talk {
  --w-bg: #1f1f21;
  --w-side: #171718;
  --w-edge: rgba(255, 255, 255, 0.09);
  --w-line: rgba(255, 255, 255, 0.07);
  --w-ink: #f2f2f3;
  --w-muted: #9b9ea4;
  --w-soft: #aeb1b6;
  --w-text: #ececec;
  --w-dot: #4b4b4f;
  --w-hover: rgba(255, 255, 255, 0.05);
  --w-open: rgba(255, 255, 255, 0.09);
  --w-field: #2a2a2d;
  --w-btn: #3a3a3e;
  --w-btn-ink: #d6d7da;
  --w-send: #f0f0f0;
  --w-send-ink: #0a0a0b;
  --bubble-user: #ececec;
  --bubble-user-ink: #1b1b1d;
  --bubble-bot: #2e2e31;
  --bubble-bot-ink: #e4e4e6;

  --talk-rail-w: 74px;
  --talk-rail-tile: 52px;
  --talk-head-pad: 10px 16px;
  --talk-head-face: 36px;
  --talk-title-fs: 13px;
  --talk-badge-fs: 10.5px;
  --talk-body-pad: 14px 16px;
  --talk-thread-gap: 12px;
  --talk-msg-fs: 13px;
  --talk-msg-pad: 9px 14px;
  --talk-agent-face: 44px;
  --talk-status-fs: 11px;
  --talk-bot-name-fs: 12.5px;
  --talk-bot-prev-fs: 11px;
  --talk-bot-pad: 6px 8px;
  --talk-bot-gap: 10px;
  --talk-input-fs: 13px;
  --talk-input-btn: 30px;
  --talk-input-margin: 0 14px 12px;

  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--talk-side-w, 208px) 5px minmax(0, 1fr);
  border-radius: 14px;
  border: 1px solid var(--w-edge);
  background: var(--w-bg);
  color: var(--w-ink);
  overflow: hidden;
  transition: grid-template-columns 0.16s ease;
}
.talk[data-zoom="125"] {
  --talk-rail-w: 88px;
  --talk-rail-tile: 64px;
  --talk-head-pad: 11px 18px;
  --talk-head-face: 44px;
  --talk-title-fs: 14px;
  --talk-badge-fs: 11px;
  --talk-body-pad: 16px 20px;
  --talk-thread-gap: 14px;
  --talk-msg-fs: 14px;
  --talk-msg-pad: 10px 15px;
  --talk-agent-face: 54px;
  --talk-status-fs: 11.5px;
  --talk-bot-name-fs: 13.5px;
  --talk-bot-prev-fs: 11.5px;
  --talk-bot-pad: 7px 9px;
  --talk-bot-gap: 11px;
  --talk-input-fs: 14px;
  --talk-input-btn: 33px;
  --talk-input-margin: 0 16px 14px;
}
.talk[data-zoom="150"] {
  --talk-rail-w: 98px;
  --talk-rail-tile: 74px;
  --talk-head-pad: 12px 20px;
  --talk-head-face: 52px;
  --talk-title-fs: 15px;
  --talk-badge-fs: 11.5px;
  --talk-body-pad: 18px 22px;
  --talk-thread-gap: 16px;
  --talk-msg-fs: 15px;
  --talk-msg-pad: 11px 16px;
  --talk-agent-face: 66px;
  --talk-status-fs: 12px;
  --talk-bot-name-fs: 14px;
  --talk-bot-prev-fs: 12px;
  --talk-bot-pad: 8px 10px;
  --talk-bot-gap: 12px;
  --talk-input-fs: 14.5px;
  --talk-input-btn: 36px;
  --talk-input-margin: 0 18px 16px;
}
.talk.is-resizing { transition: none; user-select: none; }
.talk-resizer {
  position: relative;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
}
.talk-resizer::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--w-line);
  transition: background-color 0.15s, width 0.15s, left 0.15s;
}
.talk-resizer:hover::before,
.talk.is-resizing .talk-resizer::before {
  left: 1px;
  width: 2px;
  background: rgba(255, 255, 255, 0.36);
}
.talk[data-look="light"] .talk-resizer:hover::before,
.talk[data-look="light"].is-resizing .talk-resizer::before {
  background: rgba(0, 0, 0, 0.28);
}
.talk[data-look="light"] {
  --w-bg: #e8e9ec;
  --w-side: #dcdde1;
  --w-edge: rgba(0, 0, 0, 0.08);
  --w-line: #cdcfd4;
  --w-ink: #1f2226;
  --w-muted: #5b6067;
  --w-soft: #5b6067;
  --w-text: #2b2e33;
  --w-dot: #b4b7bd;
  --w-hover: #d1d3d8;
  --w-open: #c8cad0;
  --w-field: #f6f6f7;
  --w-btn: #d2d4d9;
  --w-btn-ink: #4a4d53;
  --w-send: #2b2e33;
  --w-send-ink: #ffffff;
  --bubble-user: #52575e;
  --bubble-user-ink: #ffffff;
  --bubble-bot: #ffffff;
  --bubble-bot-ink: #2b2e33;
}
.talk[data-look="dark"] boop-face:not([skin]):not([data-custom-color="true"]) {
  filter: invert(1);
}
.talk-side {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--w-side);
}
.talk-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 13px 17px 10px;
  flex: none;
}
.talk-bar i {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--w-dot);
}
.talk-bots {
  list-style: none;
  margin: 0;
  padding: 0 7px 8px;
  display: grid;
  gap: 2px;
  /* Like Grokbot's list: it still scrolls with the wheel or a finger when it
     runs long, but shows no scrollbar, and never sideways. */
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: none;
}
.talk-bots::-webkit-scrollbar { display: none; }
.talk-bot {
  display: flex;
  align-items: center;
  gap: var(--talk-bot-gap);
  width: 100%;
  padding: var(--talk-bot-pad);
  border-radius: 10px;
  text-align: left;
  transition: background-color 0.15s;
}
.talk-bot:hover { background: var(--w-hover); }
.talk-bot.is-open { background: var(--w-open); }
.talk-bot boop-face { flex: none; pointer-events: none; }
.talk-bot-text { min-width: 0; display: grid; gap: 2px; }
.talk-bot-name { font-size: var(--talk-bot-name-fs); font-weight: 600; color: var(--w-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.talk-bot-preview { font-size: var(--talk-bot-prev-fs); color: var(--w-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.2s ease; }
.talk-bot-preview[data-tone="working"] { color: #93c5fd; }
.talk-bot-preview[data-tone="warn"] { color: #fbbf24; }
.talk-bot-preview[data-tone="error"] { color: #f87171; }
.talk-bot-preview[data-tone="done"] { color: #4ade80; }
.talk[data-look="light"] .talk-bot-preview[data-tone="working"] { color: #2563eb; }
.talk[data-look="light"] .talk-bot-preview[data-tone="warn"] { color: #b45309; }
.talk[data-look="light"] .talk-bot-preview[data-tone="error"] { color: #dc2626; }
.talk[data-look="light"] .talk-bot-preview[data-tone="done"] { color: #15803d; }

/* The main bot: the current character, bigger, its name under it, apart. */
.talk-hero {
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px 8px;
  text-align: center;
}
.talk-hero .talk-bot-text { justify-items: center; }
.talk-hero .talk-bot-preview { display: none; }
.talk-hero.is-open { background: var(--w-hero-open, rgba(0, 0, 0, 0.32)); }
.talk[data-look="light"] .talk-hero.is-open { --w-hero-open: rgba(0, 0, 0, 0.13); }
.talk-divider { height: 1px; margin: 6px 10px; background: var(--w-line); }

/* Grokbot-style Icon Rail */
.talk.is-rail {
  --talk-side-w: var(--talk-rail-w, 74px);
}
.talk.is-rail .talk-bots {
  padding: 4px 8px 10px;
  justify-items: center;
  gap: 6px;
}
.talk.is-rail .talk-bot {
  width: var(--talk-rail-tile, 52px);
  height: var(--talk-rail-tile, 52px);
  padding: 0;
  justify-content: center;
  border-radius: 13px;
}
.talk.is-rail .talk-bot-text {
  display: none;
}
.talk.is-rail .talk-hero { width: var(--talk-rail-tile, 52px); height: auto; padding: 4px 0; }
.talk.is-rail .talk-divider { width: 70%; margin: 2px auto; }

.talk-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.talk-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: var(--talk-head-pad);
  border-bottom: 1px solid var(--w-line);
}
.talk-head-start { display: flex; align-items: center; gap: 10px; min-width: 0; }
.talk-head-face { display: none; width: var(--talk-head-face); height: var(--talk-head-face); place-items: center; flex: none; }
.talk[data-avatar-pos="header"] .talk-head-face { display: grid; }
.talk-head-title { font-size: var(--talk-title-fs); font-weight: 600; color: var(--w-ink); }
.talk-head-end { display: flex; align-items: center; gap: 6px; min-width: 0; }
.talk-head-link {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--w-line);
  background: transparent;
  font-size: var(--talk-badge-fs);
  color: var(--w-muted);
  white-space: nowrap;
  transition: background-color 0.14s, color 0.14s;
}
.talk-head-link:hover { background: var(--w-hover); color: var(--w-ink, inherit); }
/* Inside the code panel the Connect AI settings drop their own card. */
.code-panel .agent-settings { padding: 2px 2px 4px; border: 0; background: none; border-radius: 0; }
.talk-head-badge {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--w-hover);
  font-family: var(--mono);
  font-size: var(--talk-badge-fs);
  color: var(--w-muted);
  white-space: nowrap;
}

.talk-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--talk-body-pad);
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(128, 128, 128, 0.25) transparent;
}
.talk-thread {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--talk-thread-gap);
}
.talk-ask {
  align-self: flex-end;
  max-width: 78%;
  margin: 0;
  padding: var(--talk-msg-pad);
  border-radius: 18px 6px 18px 18px;
  background: var(--bubble-user);
  color: var(--bubble-user-ink);
  font-size: var(--talk-msg-fs);
  line-height: 1.55;
}
.talk-agent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.talk-agent-face { width: var(--talk-agent-face); height: var(--talk-agent-face); flex: none; display: grid; place-items: center; }
.talk[data-avatar-pos="header"] .talk-agent-face { display: none; }
.talk-text { min-width: 0; }
.talk-reply {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: var(--talk-msg-pad);
  border-radius: 6px 18px 18px 18px;
  background: var(--bubble-bot);
  color: var(--bubble-bot-ink);
  font-size: var(--talk-msg-fs);
  line-height: 1.55;
}
.talk-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 6px 0 0 3px;
  font-size: var(--talk-status-fs);
  color: var(--w-soft);
}
.talk-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--w-soft);
}
.talk-status[data-state="listening"] i { background: #3d8bfd; }
.talk-status[data-state="thinking"] i { background: #e0a020; animation: status-pulse 1s ease-in-out infinite; }
.talk-status[data-state="done"] i { background: #2fb171; }
.talk-status[data-state="asking"] i { background: #e5743a; }
.talk-status[data-state="failed"] i { background: #e5484d; }
@keyframes status-pulse { 50% { opacity: 0.25; } }

.talk-input {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: var(--talk-input-margin);
  padding: 5px;
  border: 1px solid var(--w-line);
  border-radius: 999px;
  background: var(--w-field);
}
.talk-plus, .talk-enter {
  flex: none;
  width: var(--talk-input-btn);
  height: var(--talk-input-btn);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--w-btn);
  color: var(--w-btn-ink);
  transition: background-color 0.18s, color 0.18s;
}
.talk-plus svg, .talk-enter svg {
  width: calc(var(--talk-input-btn) * 0.5);
  height: calc(var(--talk-input-btn) * 0.5);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.talk-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  padding: 0 4px;
  font-size: var(--talk-input-fs);
  color: var(--w-text);
}
.talk-input input::placeholder { color: var(--w-muted); }
.talk-input:has(input:not(:placeholder-shown)) .talk-enter {
  background: var(--w-send);
  color: var(--w-send-ink);
}

/* Attached Stage Toolbar Footer Bar */
.stage-toolbar {
  position: relative;
  flex: 0 0 auto;
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px);
  background: var(--surface);
  z-index: 30;
}
.toolbar-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-solo {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
@media (max-width: 1120px) {
  .toolbar-solo { grid-template-columns: auto 1fr auto; }
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  flex-wrap: wrap;
}
.toolbar-center {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: center;
  flex-wrap: wrap;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
}

.seg-group {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--seg-track);
  gap: 3px;
}
.seg-group button {
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.seg-group button:hover { color: #fff; }
.seg-group button[aria-pressed="true"] {
  background: var(--seg-active);
  color: #fff;
  font-weight: 600;
}

/* Official-Style 3 Stage Backdrop Swatches */
.backdrop-swatches {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
}
.backdrop-swatch {
  width: 34px;
  height: 15px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  opacity: 0.65;
  transition: opacity 0.15s ease, box-shadow 0.15s ease;
}
.backdrop-swatch.is-dark {
  background: #141414;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.backdrop-swatch.is-light {
  background: #f2f3f5;
}
.backdrop-swatch.is-skin {
  background: linear-gradient(125deg, #ffc21a 8%, #ff3d9e 36%, #9a4dff 62%, #1fb0ff 92%);
}
.backdrop-swatch:disabled { opacity: 0.3; cursor: not-allowed; }
.backdrop-swatch:hover {
  opacity: 0.92;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}
.backdrop-swatch[aria-pressed="true"] {
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}
.backdrop-swatch.is-light[aria-pressed="true"] {
  box-shadow: 0 0 0 1px #000;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--chip);
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.tool-btn:hover:not(:disabled) {
  background: var(--chip-hover);
  border-color: rgba(255, 255, 255, 0.22);
}
.tool-btn:disabled {
  opacity: 0.38;
  cursor: default;
}
.tool-btn[aria-pressed="true"],
.tool-btn[aria-expanded="true"] {
  background: var(--seg-active);
  border-color: var(--line-strong);
  color: #fff;
  font-weight: 600;
}
.tool-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tool-btn svg[hidden] { display: none; }
.tool-icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
}
.tool-reset { color: var(--muted); }
.tool-reset:hover { color: #fff; }

/* Toolbar Popovers (Export & Size) */
.pop-menu { position: relative; }
.tool-popover {
  position: absolute;
  right: 0;
  left: auto;
  bottom: calc(100% + 10px);
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 14, 14, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.72);
  display: grid;
  gap: 10px;
  z-index: 70;
}
.size-popover { width: auto; }

/* 平面/立体 info: an i in a circle; the comparison shows on hover or focus. */
.view-info { position: relative; display: inline-flex; }
.info-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: var(--muted);
  font: italic 600 11px/1 Georgia, 'Times New Roman', serif;
  display: grid;
  place-items: center;
  transition: color 0.14s, border-color 0.14s, background-color 0.14s;
}
.info-dot:hover, .view-info:focus-within .info-dot { color: #fff; border-color: rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.06); }
.view-info-pop {
  left: -8px;
  right: auto;
  width: min(580px, calc(100vw - 32px));
  grid-template-columns: minmax(0, 1fr);
  padding: 18px;
  align-items: stretch;
  align-content: start;
  /* Never under the page header (the height is set from the room above). */
  overflow-y: auto;
  gap: 16px;
  display: none;
}
.view-info.is-open .view-info-pop { display: grid; }
.vi-head { display: grid; gap: 5px; }
.view-info-title { font-size: 16px; color: #fff; }
.vi-head span { font-size: 13px; color: var(--muted); line-height: 1.55; }
.view-info-pop code { font-family: var(--mono); font-size: 12px; color: #e5e5e5; padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); }
/* Flat and 3D as two cards side by side: what each is, then its figures. */
.vi-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .vi-cards { grid-template-columns: 1fr; } }
.vi-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.035); }
.vi-card h4 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; color: #fff; }
.vi-card h4 i { width: 16px; height: 3px; border-radius: 2px; }
.vi-card h4 i.is-3d { background: #f2f2f2; }
.vi-card h4 i.is-2d { background: #7d7d7d; }
.vi-tag { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.vi-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.vi-card li { position: relative; padding-left: 13px; font-size: 13px; line-height: 1.45; color: #c7c7cc; }
.vi-card li::before { content: ""; position: absolute; left: 1px; top: .6em; width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); }
.vi-card dl { margin: auto 0 0; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: grid; gap: 8px; }
.vi-card dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.vi-card dt { font-size: 12.5px; color: var(--faint); }
.vi-card dd { margin: 0; font-size: 17px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vi-card dd.is-text { font-size: 13px; font-weight: 500; color: #e5e5ea; white-space: normal; text-align: right; }
.vi-card dt { flex: none; }
.vi-chart { margin: 0; display: grid; align-content: start; gap: 10px; padding: 14px 16px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.025); }
.vi-chart figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.vi-legend { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); }
.vi-legend i { width: 14px; height: 2px; border-radius: 1px; margin-left: 6px; }
.vi-legend i.is-3d { background: #f2f2f2; }
.vi-legend i.is-2d { background: #7d7d7d; }
.vi-plot { position: relative; }
.vi-note { font-size: 12px; line-height: 1.6; color: var(--faint); }
.vi-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.vi-plot text { font-size: 10px; fill: #7a7a7a; font-family: inherit; }
.vi-tip { position: absolute; top: 0; pointer-events: none; padding: 6px 9px; border-radius: 8px; background: #262626; border: 1px solid rgba(255, 255, 255, 0.12); font-size: 12px; color: #d4d4d4; white-space: nowrap; display: grid; gap: 1px; font-variant-numeric: tabular-nums; }
.vi-tip b { font-weight: 600; color: #fff; }
/* The comparison: a table whose cells are bars. */
.vi-plot svg.is-drawing .vi-line { stroke-dasharray: 1; animation: vi-draw 1.1s cubic-bezier(.33, 0, .2, 1) both; }
.vi-plot svg.is-drawing .vi-area { animation: vi-fade .7s .45s ease-out both; }
@keyframes vi-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes vi-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .vi-plot svg.is-drawing .vi-line, .vi-plot svg.is-drawing .vi-area { animation: none; } }
.export-popover {
  width: 228px;
  top: calc(100% + 8px);
  bottom: auto;
  right: 0;
  left: auto;
  z-index: 80;
}
.pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
}
.pop-head code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--chip);
  color: #fff;
}
.export-alpha-row strong { font-size: 11.5px; }
.export-alpha-row small { font-size: 10.5px; }
.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.export-fmt-btn {
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  transition: background-color 0.15s, border-color 0.15s;
}
.export-fmt-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.34);
}
.export-status {
  margin: 0;
  font-size: 10.5px;
  color: var(--faint);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.export-status.is-ok { color: #4ade80; }
.size-pop-body {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 2px 0;
}
.vertical-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 24px;
  height: 112px;
  margin: 0;
  accent-color: #ededed;
  cursor: pointer;
}
.size-stops {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.size-stops button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.size-stops button strong {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink);
}
.size-stops button:hover {
  background: var(--chip-hover);
  color: #fff;
}
.size-stops button[aria-pressed="true"] {
  background: var(--seg-active);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* Action Dock (Folder-Tab Binder Style) */
.action-dock {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}
.dock-folder-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  min-height: 36px;
}
.dock-folder-tabs {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
}
.dock-folder-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 35px;
  padding: 0 16px;
  border-radius: 12px 12px 0 0;
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.14s, background-color 0.14s;
}
.dock-folder-tabs button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}
.dock-folder-tabs button[aria-selected="true"] {
  position: relative;
  z-index: 2;
  margin-bottom: -1px;
  height: 36px;
  padding-bottom: 1px;
  background: var(--surface);
  border-color: var(--line);
  color: #fff;
  font-weight: 600;
}
.dock-folder-tabs svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
}
.dock-tools-stack {
  min-width: 0;
  display: grid;
  align-items: center;
  justify-items: end;
  padding-bottom: 6px;
}
.dock-tools-stack > .dock-tools {
  grid-area: 1 / 1;
}
.dock-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 10px; }
.dock-folder-body {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: clamp(12px, calc(3.2dvh - 12px), 22px) 16px;
}
.action-dock[data-active-tab="expressions"] .dock-folder-body {
  border-top-left-radius: 0;
}
.dock-body { display: grid; }
.dock-body > [role="tabpanel"] {
  grid-area: 1 / 1;
  align-self: start;
}
.is-tab-hidden {
  visibility: hidden;
  pointer-events: none;
}

.dock-voice-meta {
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.voice-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  transition: background-color 0.2s, box-shadow 0.2s;
}
.voice-live-dot.is-active {
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.16);
}
.voice-live-dot.is-thinking {
  background: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

.action-groups { display: grid; gap: clamp(2px, calc(1.2dvh - 6px), 6px); container-type: inline-size; }
/* Widths follow the dock's own width smoothly (cqi = 1% of it), so the
   groups tighten little by little as the page narrows and never wrap. */
.action-row {
  display: grid;
  grid-template-columns: var(--label-w, clamp(34px, calc(4cqi + 13px), 42px)) minmax(0, 1fr);
  align-items: center;
  gap: clamp(6px, calc(0.5cqi + 3.5px), 8px);
  padding: clamp(2px, calc(0.6dvh - 1px), 5px) clamp(6px, calc(0.5cqi + 3.5px), 8px);
  border-radius: 10px;
}
/* Every other group on a faint band, so the four rows read apart. */
.action-row:nth-child(odd) { background: rgba(255, 255, 255, 0.028); }
.row-label {
  align-self: stretch;
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  /* A short line between the group name and its buttons, so the name does
     not read as one more expression. */
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  margin-block: 4px;
}
/* Seven columns of one width (the longest word in them plus padding, measured
   by the page) so the rows line up; the last column takes its own width (a
   longer word there moves nothing). The gap between buttons grows with the room
   between 4 and 18 px; past that the buttons stay put and the rest of the
   row is left empty, so a wide screen never stretches the buttons apart. */
.row-btns {
  display: grid;
  grid-template-columns: repeat(7, var(--btn-w, max-content)) max-content;
  column-gap: clamp(4px, calc((100cqi - 72px - 8 * var(--btn-w, 64px)) / 7), 18px);
  justify-content: start;
}
.row-btns button { min-width: 0; }
/* When the eight do not fit (a narrow phone, a language with long words) the
   buttons wrap onto more lines, all in one column width so they still line up. */
.action-groups.is-wrapped .row-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
}
.row-btns button {
  position: relative;
  padding: clamp(5px, calc(0.6dvh + 0.5px), 7.5px) clamp(5px, calc(1.6cqi - 4px), 13px);
  white-space: nowrap;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: clamp(11.5px, calc(0.5cqi + 9px), 12px);
  color: #b4b4b4;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s, box-shadow 0.14s;
}
.row-btns button[data-new="true"]::after {
  content: "";
  position: absolute;
  /* Moves into the corner as the button's padding shrinks, off the text. */
  top: clamp(1px, calc(1.6cqi - 9px), 4px);
  right: clamp(0px, calc(1.6cqi - 9px), 4px);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ef4444;
  pointer-events: none;
}
.row-btns button:disabled { color: #5a5a5a; cursor: not-allowed; }
.row-btns button:disabled:hover { background: transparent; color: #5a5a5a; }
.row-btns button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.row-btns button.is-active {
  background: var(--seg-active);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
}

/* Voice Interaction Suite Panel */
.voice-suite-panel {
  display: grid;
  gap: 8px;
  align-content: start;
}
.voice-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.voice-pipeline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--seg-track);
}
.voice-sep {
  font-size: 13px;
  color: var(--faint);
  line-height: 1;
  user-select: none;
}
.voice-stage-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: #c8c8c8;
  white-space: nowrap;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}
.voice-stage-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.voice-stage-btn.is-active {
  background: var(--seg-active);
  color: #fff;
  font-weight: 600;
}
.voice-think-group {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.voice-think-main {
  border-radius: 8px 0 0 8px;
  border-right-color: rgba(255, 255, 255, 0.08);
  padding-right: 10px;
}
.voice-think-caret {
  width: 26px;
  height: 30px;
  border-radius: 0 8px 8px 0;
  border: 1px solid transparent;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}
.voice-think-caret:hover,
.voice-think-caret[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.voice-think-caret svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s ease;
}
.voice-think-caret[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
/* The thinking step and its style menu are one button: lit together. */
.voice-think-group:has(.voice-think-main.is-active) .voice-think-caret {
  background: var(--seg-active);
  color: #fff;
  border-left-color: rgba(255, 255, 255, 0.14);
}
.voice-think-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 148px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 14, 14, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.72);
  display: grid;
  gap: 2px;
  z-index: 75;
}
.voice-think-popover[hidden] { display: none; }
.voice-pop-title {
  padding: 4px 8px 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
}
.voice-think-popover button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}
.voice-think-popover button:hover {
  background: var(--chip-hover);
  color: #fff;
}
.voice-think-popover button[aria-checked="true"] {
  background: var(--seg-active);
  color: #fff;
  font-weight: 600;
}
.voice-check {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}
.voice-think-popover button[aria-checked="true"] .voice-check {
  opacity: 1;
}

.voice-play-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.voice-demo-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}
.voice-demo-btn:hover {
  background: var(--chip-hover);
  border-color: rgba(255, 255, 255, 0.18);
}
.voice-demo-btn.is-playing {
  background: #e5e5e5;
  border-color: transparent;
  color: #171717;
}
.voice-demo-btn.is-playing:hover {
  background: #fafafa;
  border-color: transparent;
}
.voice-demo-btn svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}
.voice-demo-btn svg[hidden],
.voice-mute-btn svg[hidden] { display: none; }
.voice-mute-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--chip);
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}
.voice-mute-btn:hover {
  background: var(--chip-hover);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.voice-mute-btn[aria-pressed="true"] {
  background: var(--seg-active);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}
/* The volume slider floats above the speaker button. */
.voice-vol { position: relative; display: inline-flex; }
.voice-vol-pop {
  position: absolute;
  /* Opens leftwards from the button (it sits at the row's right end), so it
     stays on screen at every width. */
  right: -4px;
  bottom: calc(100% + 8px);
  transform: translateY(4px);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 14, 14, 0.98);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.14s, transform 0.14s, visibility 0s linear 0.14s;
  z-index: 30;
}
/* A bridge so the pointer can move from the button up to the slider. */
.voice-vol-pop::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }
.voice-vol.is-open .voice-vol-pop { opacity: 1; visibility: visible; transform: none; transition: opacity 0.14s, transform 0.14s; }
.voice-vol-pop input[type="range"] { width: 110px; accent-color: #e5e5e5; display: block; }
.voice-mute-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Right Column: Outer Tray + Inner Sub-Panels */
.inspector-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  min-width: 0;
  min-height: 0;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}
.inspector-tabs-track {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 0;
  border-radius: 0;
  background: transparent;
}
.inspector-tabs-track button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.inspector-tabs-track button:hover { color: #fff; }
.inspector-tabs-track button[aria-selected="true"] {
  background: var(--seg-active);
  color: #fff;
  font-weight: 600;
}
.tab-count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
}
.inspector-tabs-track button[aria-selected="true"] .tab-count {
  color: var(--muted);
}

/* Preview Card (Top of Look Tab) & Skin Search Bar (Top of Skins Tab) */
.insp-preview-card {
  flex: 0 0 auto;
  container-type: inline-size;
  padding: 8px 10px 8px 8px;
  border-radius: 16px;
  border: 1px solid var(--sub-line);
  background: var(--sub-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.preview-left-snug {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mini-stage-box {
  width: 64px;
  height: 48px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--live-bg, #141416);
  transition: background-color 0.15s;
  overflow: hidden;
}
.preview-hex-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-strong);
  text-transform: uppercase;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}
.preview-hex-btn:hover {
  background: var(--chip);
  border-color: rgba(255, 255, 255, 0.18);
}
.preview-hex-btn[data-copied="true"] {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.4);
}
.preview-right-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
/* A narrow card keeps the icons and drops their words (the titles still name them). */
@container (max-width: 340px) {
  .preview-right-actions .mini-pill-btn > span { display: none; }
}
.mini-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 7px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}
.mini-pill-btn:hover {
  background: var(--chip);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.mini-pill-btn[data-saved="true"] {
  border-color: rgba(251, 191, 36, 0.35);
  color: #fbbf24;
}
.mini-pill-btn svg {
  width: 12px;
  height: 12px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mini-pill-btn[data-saved="true"] svg polygon { fill: #fbbf24; }
:root:not(:lang(zh)):not(:lang(en)):not(:lang(ko)) .mini-pill-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
  border-color: transparent;
  background: transparent;
}
:root:not(:lang(zh)):not(:lang(en)):not(:lang(ko)) .mini-pill-btn span {
  display: none;
}
:root:not(:lang(zh)):not(:lang(en)):not(:lang(ko)) .mini-pill-btn svg {
  width: 15px;
  height: 15px;
}

.ghost-icon-btn {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}
.ghost-icon-btn:hover {
  background: var(--chip);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.ghost-icon-btn[aria-expanded="true"] {
  background: var(--seg-active);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
}
.ghost-icon-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.insp-preview-card.has-search-pop {
  position: relative;
  z-index: 25;
}
.skin-search-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(16, 16, 18, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.78);
}

.inspector-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.panel-scroll {
  overflow-y: auto;
  padding: 0 2px 2px 0;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.inspector-panel[data-panel="skins"] {
  gap: 10px;
}
.skin-browser-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--sub-line);
  background: var(--sub-surface);
  overflow: hidden;
}

/* Skin Browser Panel */
.search-box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}
.search-box:focus-within { border-color: rgba(255, 255, 255, 0.3); }
.search-box svg {
  width: 13px;
  height: 13px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
}
.search-box input {
  width: 100%;
  border: 0;
  background: none;
  outline: none;
  font-size: 12px;
  color: var(--ink);
}
.search-box input::placeholder { color: var(--faint); }

.square-icon-btn {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--chip);
  display: grid;
  place-items: center;
  color: var(--ink);
}
.square-icon-btn:hover { background: var(--chip-hover); border-color: rgba(255, 255, 255, 0.22); }
.square-icon-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skin-filters { display: flex; flex-wrap: nowrap; gap: 5px; padding: 12px 14px 0; overflow-x: auto; scrollbar-width: none; }
.skin-filters::-webkit-scrollbar { display: none; }
.skin-filters button { flex: none; white-space: nowrap; }
.skin-filters .skin-filter-star { display: grid; place-items: center; padding: 5px 8px; }
.skin-filters .skin-filter-star svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.skin-filters .skin-filter-star[aria-pressed="true"] svg { fill: currentColor; }
.skin-empty p { max-width: 220px; margin: 0 auto; line-height: 1.6; }
.skin-filters button {
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--chip);
  font-size: 11.5px;
  color: var(--muted);
  transition: background-color 0.14s, color 0.14s, box-shadow 0.14s;
}
.skin-filters button:hover { background: var(--chip-hover); color: #fff; }
.skin-filters button[aria-pressed="true"] {
  background: var(--seg-active);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.skin-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px 6px;
  font-size: 11px;
  color: var(--faint);
}

.skin-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 14px 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.skin-series-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 8px 2px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.skin-series-head:first-child { margin-top: 2px; }
.skin-series-head span { font-size: 11px; font-weight: 400; color: var(--faint); }
.skin-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 4px 8px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--surface-tile);
  text-align: center;
  transition: border-color 0.14s, background-color 0.14s, transform 0.14s;
}
.skin-card:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: #27272b;
  transform: translateY(-1px);
}
.skin-card[aria-pressed="true"] {
  border-color: rgba(255, 255, 255, 0.45);
  background: var(--seg-active);
}
.skin-card-star {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 11px;
  height: 11px;
  color: #fbbf24;
  fill: #fbbf24;
}
.skin-card img { width: 60px; height: 60px; object-fit: contain; display: block; }
.skin-card-name {
  font-size: 10.5px;
  line-height: 1.25;
  color: #d4d4d8;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.skin-card-id { font-family: var(--mono); font-size: 9.5px; color: var(--faint); }
.skin-empty { flex: 1; display: grid; place-content: center; gap: 8px; text-align: center; color: var(--muted); }

.inspector-foot {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}
.foot-link { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.foot-link:hover { color: #fff; }

/* Look & Behavior Inner Sub-Panels */
.insp-section {
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--sub-line);
  background: var(--sub-surface);
  display: grid;
  gap: 10px;
}
.insp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.insp-head h3 { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--ink-strong); }
.insp-note, .insp-subnote { font-size: 11px; color: var(--muted); }
.insp-help { margin: 0; font-size: 11px; color: var(--faint); }
.mono-val {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--chip);
}

.seg-full {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--seg-track);
}
.seg-full button { height: 28px; border-radius: 7px; font-size: 11.5px; color: var(--muted); transition: background-color 0.14s, color 0.14s; }
.seg-full button:hover { color: #fff; }
.seg-full button[aria-pressed="true"] {
  background: var(--seg-active);
  color: #fff;
  font-weight: 600;
}

/* Scheme 3B Look Rows & 10-Dot Palettes */
.prop-list { display: grid; gap: 0; }
.prop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 42px;
  padding: 0 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
/* The see-through row carries a note under its name. */
.prop-row.is-tail .prop-lead { flex: 1 1 auto; }
.prop-lead small { display: block; font-size: 11px; color: var(--faint); line-height: 1.35; white-space: normal; }
.prop-row.is-tail {
  height: auto;
  min-height: 36px;
  padding: 8px 2px 0;
  border-bottom: 0;
}
.prop-lead {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: none;
}
.prop-lead svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.prop-lead strong {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
.cur-dot-swatch {
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  background: var(--cur-color, #ededed);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}
.aw-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
}
.aw-sep {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 1px;
  flex: none;
}
.aw-dot {
  /* Dots shrink a little when the row is short of room (a phone, a long label). */
  width: 22px;
  height: auto;
  aspect-ratio: 1;
  flex: 0 1 22px;
  min-width: 15px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  transition: transform 0.14s ease, box-shadow 0.15s ease, background-color 0.12s ease;
}
.aw-dot:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.aw-dot[aria-pressed="true"] {
  transform: none;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.88);
}
.aw-dot.is-rainbow {
  background: conic-gradient(from 0deg, #ff3b30, #ff9500, #ffcc00, #34c759, #00c7be, #007aff, #af52de, #ff2d55, #ff3b30);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.aw-dot.is-rainbow:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.aw-dot.is-rainbow[aria-pressed="true"] {
  transform: none;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.88);
}
.aw-dot.is-auto {
  background: linear-gradient(135deg, transparent 46%, rgba(255, 255, 255, 0.62) 46%, rgba(255, 255, 255, 0.62) 54%, transparent 54%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.cur-dot-swatch.is-auto {
  background: linear-gradient(135deg, transparent 44%, rgba(255, 255, 255, 0.62) 44%, rgba(255, 255, 255, 0.62) 56%, transparent 56%);
}
/* Eye colour: dimmed while the eyes are see-through (a pick turns that off),
   greyed out on a skin whose eyes are part of its design. */
.eye-color-row.is-dim .aw-row { opacity: 0.5; }
.eye-color-row.is-locked .aw-row,
.eye-color-row.is-locked .cur-dot-swatch { opacity: 0.3; pointer-events: none; }
.eye-color-row.is-locked strong { color: var(--muted); }
.switch-row.is-locked { opacity: 0.4; pointer-events: none; }
.color-pair-wrap {
  position: relative;
  display: grid;
  grid-template-rows: 42px 42px;
}
.divider-swap-btn {
  position: absolute;
  top: 50%;
  left: 67px;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--chip);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 4px var(--sub-surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  z-index: 3;
  transition: background-color 0.14s, color 0.14s, border-color 0.14s, transform 0.14s;
}
.divider-swap-btn:hover {
  background: var(--chip-hover);
  border-color: rgba(255, 255, 255, 0.34);
  color: #fff;
}
.divider-swap-btn:active { transform: translate(-50%, -50%) scale(0.92); }
.divider-swap-btn svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Curated 18-Theme Concentric Scheme Grid */
.scheme-name-hint {
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.scheme-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  justify-items: center;
  align-items: center;
  gap: 10px 4px;
  padding: 2px 0;
}
.preset-dot {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sw-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  transition: transform 0.14s ease, box-shadow 0.15s ease;
}
.preset-dot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--sw-head);
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.28);
}
.preset-dot:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.preset-dot[aria-pressed="true"] {
  transform: none;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.88);
}
.saved-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.saved-label { font-size: 11px; color: var(--faint); }
.preset-save-wrap { position: relative; }
.preset-del {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #181818;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ededed;
  font-size: 9.5px;
  line-height: 1;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.12s, background-color 0.12s;
  z-index: 2;
}
.preset-save-wrap:hover .preset-del,
.preset-save-wrap:focus-within .preset-del { opacity: 1; }
.preset-del:hover { background: #ef4444; border-color: #ef4444; color: #fff; }

/* Studio Redesigned Color Picker Popover (No Alpha, HEX/RGB/HSL) */
.color-popover {
  position: fixed;
  width: 264px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #101012;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  display: grid;
  gap: 11px;
  z-index: 90;
}
.cp-slot-tag {
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-size: 10.5px;
}
.cp-sv {
  position: relative;
  height: 144px;
  border-radius: 11px;
  cursor: crosshair;
  touch-action: none;
  background:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, transparent),
    hsl(var(--cp-h, 219), 100%, 50%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.cp-sv-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid #ffffff;
  background: var(--cur-picked, #ededed);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.cp-hue-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cp-eye-btn {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: background-color 0.14s, color 0.14s, border-color 0.14s;
}
.cp-eye-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; border-color: rgba(255, 255, 255, 0.24); }
.cp-eye-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cp-hue {
  position: relative;
  flex: 1;
  height: 12px;
  border-radius: 999px;
  cursor: ew-resize;
  touch-action: none;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.cp-hue-thumb {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: hsl(var(--cp-h, 0), 100%, 50%);
  border: 3px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.cp-mode-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.cp-mode-btn {
  width: 48px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: background-color 0.14s, border-color 0.14s;
}
.cp-mode-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.24); }
.cp-mode-panel { flex: 1; min-width: 0; }
.cp-hex-panel {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cp-hex-box {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  gap: 5px;
}
.cp-hex-prefix {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--faint);
  user-select: none;
}
.cp-hex-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: none;
  padding: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #fff;
  text-transform: uppercase;
  outline: none;
}
.cp-color-tile {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--cur-picked, #ededed);
  transition: transform 0.12s;
}
.cp-color-tile:hover { transform: scale(1.04); }
.cp-color-tile:active { transform: scale(0.96); }
.cp-chan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.cp-chan-cell {
  display: grid;
  gap: 3px;
  justify-items: center;
}
.cp-chan-cell input {
  width: 100%;
  height: 34px;
  padding: 0 4px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--mono);
  font-size: 12.5px;
  color: #fff;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.cp-chan-cell input::-webkit-outer-spin-button,
.cp-chan-cell input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.cp-chan-cell input:focus { border-color: rgba(255, 255, 255, 0.35); }
.cp-chan-cell span {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.2;
}
.cp-quick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2px;
}
.cp-quick button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  transition: transform 0.12s, box-shadow 0.15s ease;
}
.cp-quick button:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.cp-quick button[aria-pressed="true"] {
  transform: none;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.88);
}

.slider-row { display: flex; align-items: center; gap: 9px; }
.shape-slider-row { gap: 7px; }
.roundness-ruler {
  position: relative;
  flex: 1;
  min-width: 0;
}
.roundness-ruler input {
  position: relative;
  display: block;
  width: 100%;
  height: 34px;
  margin: 0;
  padding: 0;
  cursor: pointer;
}
@media not (forced-colors: active) {
  .roundness-ruler {
    --thumb-width: 10px;
    --cursor-shape: polygon(0 0, 100% 0, 62% 19%, 62% 100%, 38% 100%, 38% 19%);
    --cursor-color: #bcbcc1;
  }
  .roundness-ruler::before,
  .roundness-ruler::after {
    content: "";
    position: absolute;
    inset-inline: calc(var(--thumb-width) / 2);
    top: 50%;
    height: 16px;
    transform: translateY(-50%);
    pointer-events: none;
  }
  .roundness-ruler::before {
    background:
      linear-gradient(90deg, #6a6a70 1px, transparent 1px) left center / 10% 12px repeat-x,
      linear-gradient(90deg, #515157 1px, transparent 1px) left center / 2% 6px repeat-x;
    mask-image: linear-gradient(90deg,
      #000, rgb(0 0 0 / 88%) 12%, rgb(0 0 0 / 28%) 36%,
      rgb(0 0 0 / 12%) 50%, rgb(0 0 0 / 28%) 64%, rgb(0 0 0 / 88%) 88%, #000);
  }
  .roundness-ruler::after {
    /* Keep the three reference marks equally bright over the graduated scale. */
    --reference-mark: linear-gradient(#808086 0 0);
    background: var(--reference-mark) left, var(--reference-mark) center, var(--reference-mark) right;
    background-size: 1px 100%;
    background-repeat: no-repeat;
  }
  .roundness-ruler input {
    z-index: 1;
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 4px;
  }
  .roundness-ruler input::-webkit-slider-runnable-track { height: 34px; background: transparent; }
  .roundness-ruler input::-moz-range-track { height: 34px; background: transparent; }
  .roundness-ruler input::-webkit-slider-thumb {
    appearance: none;
    width: var(--thumb-width);
    height: 24px;
    margin-top: 5px;
    background: var(--cursor-color);
    clip-path: var(--cursor-shape);
  }
  .roundness-ruler input::-moz-range-thumb {
    width: var(--thumb-width);
    height: 24px;
    border: 0;
    border-radius: 0;
    background: var(--cursor-color);
    clip-path: var(--cursor-shape);
  }
}
.shape-avatar-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  flex: none;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  opacity: 0.72;
  transition: transform 0.14s;
}
.shape-avatar-btn:hover {
  opacity: 0.79;
  transform: scale(1.06);
}
.shape-avatar-btn[aria-pressed="true"] {
  transform: scale(1.08);
}
.shape-avatar-btn boop-face {
  pointer-events: none;
  filter: invert(1);
}
.roundness-input {
  width: 44px;
  height: 26px;
  flex: none;
  padding: 0 4px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--chip);
  font-family: var(--mono);
  font-size: 11.5px;
  color: #fff;
  text-align: center;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}
.roundness-input::-webkit-inner-spin-button,
.roundness-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.roundness-input:focus {
  border-color: rgba(255, 255, 255, 0.36);
}

.coming-badge {
  padding: 0;
  border-radius: 0;
  border: 0;
  background: none;
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
}
.accessories-placeholder {
  padding: 4px 0 2px;
  border-radius: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}
.accessories-placeholder svg {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.72;
}
.accessories-placeholder > div {
  display: grid;
  gap: 2px;
}
.accessories-placeholder strong {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}
.accessories-placeholder small {
  font-size: 11px;
  color: var(--faint);
}

.control-block { display: grid; gap: 6px; }
.block-label { font-size: 11.5px; color: var(--muted); }

/* Switches (Shadcn Dark Reference Style) */
.switch-list {
  display: grid;
  gap: 0;
}
.switch-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.switch-inline input, .switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  background: #2e2e2e;
  border: 0;
  transition: background-color 0.18s;
}
.switch-track::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0a0a0a;
  transition: transform 0.18s, background-color 0.18s;
}
input:checked + .switch-track {
  background: #e5e5e5;
}
input:checked + .switch-track::after {
  transform: translateX(16px);
  background: #0a0a0a;
}
.switch-inline .switch-track {
  width: 30px;
  height: 16px;
}
.switch-inline .switch-track::after {
  width: 12px;
  height: 12px;
}
.switch-inline input:checked + .switch-track::after {
  transform: translateX(14px);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.switch-list .switch-row {
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}
.switch-list .switch-row:first-child { padding-top: 2px; }
/* A line above the switches, like the one above the see-through eyes. */
.switch-list.has-divider { margin-top: 12px; border-top: 1px solid var(--line); }
.switch-list.has-divider .switch-row:first-child { padding-top: 12px; }
.switch-list .switch-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.switch-row-lead {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
}
.switch-row-lead svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.switch-row-lead strong,
.switch-row strong {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}
.switch-row small { display: block; font-size: 11px; color: var(--faint); }
.export-alpha-row strong { font-size: 11.5px; }

.mini-btn, .mini-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--chip);
  font-size: 11.5px;
  color: var(--ink);
  white-space: nowrap;
}
.mini-btn:hover, .mini-link-btn:hover { background: var(--chip-hover); }
.mini-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.primary-chip { background: #e5e5e5; color: #171717; border-color: transparent; font-weight: 600; }
.primary-chip:hover { background: #fafafa; }

/* Tab 4: Code & Events Panel */
.code-panel {
  padding: 12px;
  gap: 10px;
  border-radius: 16px;
  border: 1px solid var(--sub-line);
  background: var(--sub-surface);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.code-subtabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}
.code-subtabs button[aria-selected="true"] {
  background: var(--seg-active);
  color: #fff;
  font-weight: 600;
}
.event-badge {
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-family: var(--mono);
  font-size: 10px;
}
.dev-tab-note { margin: 0; }
.dev-quick-row {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 0;
  background: var(--chip);
}
.dev-quick-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.dev-quick-label { font-size: 11px; color: var(--faint); white-space: nowrap; }
#devQuickAction {
  color: #e4e4e7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dev-code {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #050505;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: #e4e4e7;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}
.code-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: none;
}
.code-action-btn {
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--chip);
  font-size: 12px;
  color: var(--ink);
  transition: background-color 0.14s, border-color 0.14s;
}
.code-action-btn:hover {
  background: var(--chip-hover);
  border-color: rgba(255, 255, 255, 0.22);
}
.code-action-btn.primary-chip {
  background: #e5e5e5;
  color: #171717;
  border-color: transparent;
  font-weight: 600;
}
.code-action-btn.primary-chip:hover { background: #fafafa; }
.build-stats {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: none;
}
.build-stats > div {
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}
.build-stats strong { display: block; font-size: 14px; color: #fff; }
.build-stats span { font-size: 10.5px; color: var(--faint); }
.event-strip {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.event-strip.open { flex: 1 1 auto; }
.code-panel.events-full > :not(.event-strip) { display: none !important; }
.event-strip-head { display: flex; align-items: center; gap: 6px; padding-right: 6px; }
.event-strip-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  text-align: left;
}
.event-strip-title { color: var(--ink-strong); font-weight: 600; flex: none; }
.event-strip-last { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.event-strip-chev { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; transition: transform 0.16s; }
.event-strip.open .event-strip-chev { transform: rotate(180deg); }
.event-strip .dev-events { padding: 0 8px 8px; }
.dev-events {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.event-line { display: flex; gap: 8px; padding: 4px 8px; border-radius: 7px; background: rgba(255, 255, 255, 0.03); }
.event-time { color: var(--faint); flex: none; }
.event-name { color: #93c5fd; flex: none; }
.event-payload { color: #d4d4d8; overflow-wrap: anywhere; }

/* Responsive Tablet / Mobile (< 1180px / 1024px) */
@media (max-width: 1180px) {
  .toolbar-solo {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }
}
@media (max-width: 1024px) {
  .app { height: auto; min-height: 100dvh; overflow: visible; }
  .topbar { position: sticky; top: 0; grid-template-columns: auto 1fr auto; padding: 0 12px; }
  /* The tabs keep their own width, centred in the middle column. */
  .scene-switch { justify-self: center; }
  .badge-studio { display: none; }
  .workspace {
    flex: 0 0 auto;
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    padding: 10px 12px 14px;
  }
  .stage-card[data-scene="stage"] .stage-canvas {
    min-height: var(--stage-min-h, 280px);
    max-height: none;
  }
  .stage-card[data-scene="chat"] .stage-canvas {
    min-height: 320px;
    max-height: 400px;
  }
  .inspector-shell { height: 600px; }
}

/* Centered Lightbox Chat Modal */
body.has-chat-modal {
  overflow: hidden;
}
.chat-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.app.is-chat-expanded {
  overflow: hidden;
}
.app.is-chat-expanded .stage-card[data-scene="chat"] {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 1140px);
  height: min(88dvh, 840px);
  z-index: 95;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.84);
}
.app.is-chat-expanded .stage-card[data-scene="chat"] .stage-canvas {
  min-height: 0;
  max-height: none;
  flex: 1;
}

@media (max-width: 720px) {
  .topbar {
    position: static;
    flex: 0 0 auto;
    grid-template-columns: 1fr auto;
    padding: 8px 12px;
    gap: 8px;
  }
  /* Logo and buttons share the first row; the tabs take the second. */
  .topbar-start { grid-row: 1; grid-column: 1; }
  .topbar-end { grid-row: 1; grid-column: 2; }
  .scene-switch {
    grid-row: 2;
    grid-column: 1 / -1;
    justify-self: stretch;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .scene-switch button { text-align: center; }
  /* The link to the Embedded Studio stays on a phone (it is the way across); the badges make room. */
  .topbar-start .badge-version,
  .topbar-start .badge-studio,
  .export-label { display: none; }
  .toolbar-solo { gap: 6px; }
  .top-btn:not(.top-icon-btn) { padding: 0 9px; }
  .dock-folder-tabs button { padding: 0 11px; font-size: 11.5px; }
  .dock-tools { gap: 6px; }
  /* Colour rows: the name above, the dots across the full width below. */
  .color-pair-wrap .prop-row, .eye-color-row { flex-wrap: wrap; height: auto; padding: 8px 2px; row-gap: 7px; }
  .color-pair-wrap .aw-row, .eye-color-row .aw-row { flex: 1 1 100%; justify-content: space-between; }
  .color-pair-wrap { grid-template-rows: auto auto; }
  .color-pair-wrap .divider-swap-btn { left: auto; right: 0; top: calc(50% + 18px); transform: translateY(-50%); }
  .scheme-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px 2px; min-width: 0; }
  .insp-head { min-width: 0; }
  .preset-dot { width: min(22px, 100%); height: auto; aspect-ratio: 1; }
  /* Wrapped on a phone: the group name sits above its buttons. */
  .action-groups.is-wrapped .action-row { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
  .action-groups.is-wrapped .row-label { border-right: 0; margin-block: 2px 0; }
  /* The switches move above the tabs, so the tabs stay on the panel. */
  .dock-folder-bar { flex-wrap: wrap; row-gap: 6px; }
  .dock-tools-stack { order: -1; flex: 1 0 100%; min-width: 0; padding-bottom: 0; }
  .dock-tools { flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; }
  .dock-tools .mini-btn { padding: 0 7px; font-size: 11px; }
  .dock-tools .switch-inline { gap: 5px; font-size: 11px; }
  /* Narrow, the list is a column of faces down the left (as Grokbot does):
     no names, no scrollbar, never taller than the chat. */
  .talk { grid-template-columns: 66px minmax(0, 1fr); }
  .talk-resizer { display: none; }
  .talk-side { contain: size; }
  .talk-bar { justify-content: center; padding-left: 0; padding-right: 0; }
  .talk-bots { justify-items: center; gap: 6px; padding: 4px 5px 10px; }
  .talk-bots .talk-bot { width: 52px; height: 52px; padding: 0; justify-content: center; border-radius: 13px; }
  .talk-bots .talk-hero { width: 56px; height: auto; padding: 4px 0; }
  .talk-bots .talk-bot-text { display: none; }
  .talk-bots .talk-divider { width: 70%; margin: 2px auto; }
  .skin-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .palette-grid,
  .saved-palettes-row { grid-template-columns: repeat(6, 1fr); }
  .color-controls { gap: 5px; }
  .color-trigger { padding: 0 7px; gap: 6px; }
  .color-dot { width: 17px; height: 17px; }
  .color-meta code { font-size: 10.5px; }
  .stage-hint-label { font-size: 11px; line-height: 1.35; }
  .voice-stage-btn { padding: 0 9px; font-size: 11.5px; }
  .voice-pipeline, .voice-play-group { flex-wrap: wrap; max-width: 100%; }
  .voice-think-caret { width: 24px; }
  .app.is-chat-expanded .stage-card[data-scene="chat"] {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    border-radius: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stage-hints.is-ready .stage-hint-label { opacity: 1; transition: none; }
  .stage-hints.is-drawing .hint-shaft,
  .stage-hints.is-drawing .hint-head { animation: none; }
}

/* Caption under the avatar during a spoken voice turn */
.voice-caption{position:absolute;left:50%;bottom:22px;transform:translateX(-50%);max-width:min(560px,88%);padding:8px 14px;border-radius:12px;background:rgba(20,20,22,.78);border:1px solid rgba(255,255,255,.08);color:#ededf0;font-size:13px;line-height:1.5;text-align:center;backdrop-filter:blur(8px);pointer-events:none}
.voice-caption[hidden]{display:none}

/* Connect AI settings in the behaviour tab */
.insp-head .insp-hint{margin-left:auto;color:#8b8b91;font-size:12px;font-weight:400}
.agent-rows{display:grid;gap:10px}
.agent-row{display:grid;grid-template-columns:72px 1fr;align-items:center;gap:10px}
.agent-row>span{color:#a3a3a8;font-size:12.5px}
.mini-seg{display:flex;flex-wrap:wrap;gap:4px;background:#1f1f22;border-radius:10px;padding:3px}
.mini-seg button{border:0;background:none;color:#a3a3a8;font:inherit;font-size:12.5px;padding:5px 9px;border-radius:8px;cursor:pointer}
.mini-seg button:hover{color:#fff}
.mini-seg button[aria-pressed="true"]{background:#3a3a3f;color:#fff}

/* Until the Studio's code has wired them, the controls cannot be used (on a
   slow connection the page shows before its last files arrive). */
.studio-booting .action-dock,
.studio-booting .inspector-shell,
.studio-booting .stage-toolbar,
.studio-booting .scene-switch { opacity: .55; pointer-events: none; transition: opacity .2s; }

/* What Connect AI does, under its heading. */
.agent-what { margin: -2px 0 12px; line-height: 1.55; }

/* Chat: a plain statement that the replies are simulated, and a picker for the ending. */
.talk-demo {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 16px 6px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--w-muted);
}
.talk-demo-pick { display: inline-flex; align-items: center; gap: 6px; }
.talk-demo-pick select {
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--w-line);
  border-radius: 8px;
  background: var(--w-field);
  color: var(--w-text);
  font: inherit;
}

/* When the browser refuses to copy, the text is shown selected, to copy by hand. */
.manual-copy {
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--line-strong, var(--line));
  border-radius: 10px;
  background: var(--seg-active, rgba(255, 255, 255, 0.06));
  color: var(--ink);
  font-size: 12px;
}
.manual-copy p { margin: 0 0 6px; line-height: 1.5; }
.manual-copy textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}
.manual-copy button { height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: inherit; }
