/* ==========================================================================
   《互动大师 · JOYPLUS Interactive Studio》— STUDIO WORKBENCH STYLESHEET
   File: hudong/static/studio.css
   Aesthetic: Editorial Daylight (轻快 v4 Default) × Cinema Obsidian (Studio Dark)
   Rules: Zero <12px text · 100% tabular-nums · 9:16 sacred aspect · Zero AI slop
   ========================================================================== */

[hidden] {
  display: none !important;
}
html[data-boot-route] #view-projects {
  display: none !important;
}

/* The graph, dialogs, controls and dark-stage locks share the palette.css single source of truth. */
:root,
[data-theme="daylight"],
[data-theme="obsidian"],
[data-theme="dark"],
.cinema-stage-lock {
  --bg-abyss: var(--ui-bg);
  --bg-shell: var(--ui-bg);
  --bg-card: var(--ui-surface);
  --bg-elevated: var(--ui-raised);
  --bg-subtle: color-mix(in srgb, var(--ui-bg) 62%, var(--ui-surface));
  --bg-input: var(--ui-bg);
  --bg-glass: color-mix(in srgb, var(--ui-surface) 95%, transparent);
  --border-hairline: var(--ui-line);
  --border-strong: var(--ui-line-strong, var(--ui-line));
  --border-hover: color-mix(in srgb, var(--ui-muted) 65%, var(--ui-line));
  --rim-specular: 0 0 0 transparent;
  --canvas-dot: color-mix(in srgb, var(--ui-muted) 19%, transparent);
  --canvas-dot-major: color-mix(in srgb, var(--ui-muted) 32%, transparent);
  --fg-primary: var(--ui-ink);
  --fg-secondary: var(--ui-ink-2, color-mix(in srgb, var(--ui-ink) 80%, var(--ui-muted)));
  --fg-muted: var(--ui-muted);
  --fg-subtle: var(--ui-muted);

  /* JOYPLUS Brand Vermilion Flame (#e8492f) */
  --jp-flame: var(--ui-accent);
  --jp-vermilion: var(--ui-accent);
  --jp-flame-hover: var(--ui-accent-hover, color-mix(in srgb, var(--ui-accent) 88%, var(--ui-ink)));
  --jp-flame-tint: var(--ui-soft);
  --jp-flame-border: color-mix(in srgb, var(--ui-accent) 46%, var(--ui-line));
  --jp-grad-primary: var(--ui-grad-accent, var(--ui-accent));
  --jp-grad-primary-hover: var(--ui-accent-hover, var(--jp-flame-hover));
  --jp-shadow-primary: 0 4px 12px color-mix(in srgb, var(--ui-accent) 26%, transparent);
  --jp-focus-ring: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 24%, transparent);
  --sel-bg: var(--ui-soft);
  --sel-border: var(--jp-flame-border);

  /* Distinct Semantic Branch & Gate Colors */
  --branch-spine: var(--ui-ink);
  --branch-spine-active: var(--ui-accent);
  --branch-spine-bg: var(--ui-raised);
  --branch-spine-border: var(--ui-line-strong, var(--ui-line));

  --branch-free: var(--ui-alternate);
  --branch-free-text: var(--ui-alternate);
  --branch-free-bg: var(--ui-alt-soft, color-mix(in srgb, var(--ui-alternate) 10%, var(--ui-surface)));
  --branch-free-border: color-mix(in srgb, var(--ui-alternate) 42%, var(--ui-line));

  --branch-vip: var(--ui-warn);
  --branch-vip-text: var(--ui-warn);
  --branch-vip-bg: var(--ui-warn-soft, color-mix(in srgb, var(--ui-warn) 10%, var(--ui-surface)));
  --branch-vip-border: color-mix(in srgb, var(--ui-warn) 42%, var(--ui-line));
  --branch-vip-grad: var(--ui-warn);

  --branch-ad: var(--ui-ad);
  --branch-ad-text: var(--ui-ad);
  --branch-ad-bg: var(--ui-ad-soft, color-mix(in srgb, var(--ui-ad) 10%, var(--ui-surface)));
  --branch-ad-border: color-mix(in srgb, var(--ui-ad) 42%, var(--ui-line));

  --branch-clue: var(--ui-clue);
  --branch-clue-text: var(--ui-clue);
  --branch-clue-bg: var(--ui-clue-soft, color-mix(in srgb, var(--ui-clue) 12%, var(--ui-surface)));
  --branch-clue-border: color-mix(in srgb, var(--ui-clue) 44%, var(--ui-line));

  --branch-hidden: var(--ui-clue);
  --branch-hidden-text: var(--ui-clue);
  --branch-hidden-bg: var(--ui-clue-soft, color-mix(in srgb, var(--ui-clue) 12%, var(--ui-surface)));
  --branch-hidden-border: color-mix(in srgb, var(--ui-clue) 44%, var(--ui-line));

  --branch-bad: var(--ui-danger);
  --branch-bad-text: var(--ui-danger);
  --branch-bad-bg: var(--ui-danger-soft, color-mix(in srgb, var(--ui-danger) 10%, var(--ui-surface)));
  --branch-bad-border: color-mix(in srgb, var(--ui-danger) 42%, var(--ui-line));

  /* Distinct Operational Status Colors */
  --status-ok: var(--ui-ok);         --status-ok-bg: var(--ui-ok-soft, color-mix(in srgb, var(--ui-ok) 12%, var(--ui-surface)));
  --status-warn: var(--ui-warn);     --status-warn-bg: var(--branch-vip-bg);
  --status-danger: var(--ui-danger); --status-danger-bg: var(--branch-bad-bg);
  --status-work: var(--ui-accent);   --status-work-bg: var(--ui-soft);
  --status-wait: var(--ui-muted);    --status-wait-bg: var(--ui-raised);

  --shadow-sm: var(--ui-shadow-sm, 0 1px 3px rgb(10 18 20 / 5%));
  --shadow-md: var(--ui-shadow-md, 0 5px 16px rgb(10 18 20 / 10%));
  --shadow-lg: var(--ui-shadow-lg, 0 14px 40px rgb(10 18 20 / 22%));
  --shadow-node-active: 0 0 0 2px var(--ui-accent);
  /* Geometry, Fonts & Motion */
  --r-xs: 6px;
  --r-control: 10px;
  --r-node: 12px;
  --r-panel: 14px;
  --r-modal: 20px;
  --r-phone: 26px;
  --r-bubble: 12px 12px 12px 3px;

  --font-sans: var(--ui-font-sans, "Poppins", -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", sans-serif);
  --font-display: var(--ui-font-display, "Poppins", Bahnschrift, "DIN Alternate", "Segoe UI", sans-serif);
  --font-mono: var(--ui-font-mono, "Cascadia Mono", Consolas, ui-monospace, monospace);

  --ease-snappy: cubic-bezier(0.25, 1, 0.5, 1);
  --spring-cinema: cubic-bezier(0.22, 1, 0.36, 1);
  --spring-overshoot: cubic-bezier(0.34, 1.56, 0.64, 1);

  --sidebar-w: 252px;
  --sidebar-rail-w: 68px;
  --studio-topbar-h: 54px;
  --mobile-topbar-h: 56px;

  /* JOYPLUS Choice Semantic Accent System — 1:1 Aligned with Canvas Wires & palette.css */
  --choice-vip-gold: var(--ui-warn);
  --choice-vip-red: var(--ui-accent);
  --choice-vip-bar: linear-gradient(180deg, var(--ui-warn) 0%, var(--ui-accent) 100%);
  --choice-clue-purple: var(--ui-clue);
  --choice-clue-teal: var(--ui-clue);
  --choice-stat-blue: var(--ui-alternate);
  --choice-ad-green: var(--ui-ad);
  --choice-ad-violet: var(--ui-ad);
  --choice-free-slate: var(--ui-muted);
}

[data-theme="obsidian"],
[data-theme="dark"] {
  --choice-vip-gold: var(--ui-warn);
  --choice-vip-red: var(--ui-accent);
  --choice-vip-bar: linear-gradient(180deg, var(--ui-warn) 0%, var(--ui-accent) 100%);
  --choice-clue-purple: var(--ui-clue);
  --choice-clue-teal: var(--ui-clue);
  --choice-stat-blue: var(--ui-alternate);
  --choice-ad-green: var(--ui-ad);
  --choice-ad-violet: var(--ui-ad);
  --choice-free-slate: var(--ui-muted);
}

[data-theme="obsidian"] .jp-panel,
[data-theme="obsidian"] .jp-tile,
[data-theme="obsidian"] .jp-modal,
[data-theme="obsidian"] .jp-toast,
[data-theme="obsidian"] .jp-empty,
[data-theme="dark"] .jp-panel,
[data-theme="dark"] .jp-tile,
[data-theme="dark"] .jp-modal,
[data-theme="dark"] .jp-toast,
[data-theme="dark"] .jp-empty {
  background: var(--bg-card);
  border-color: var(--border-hairline);
  box-shadow: var(--shadow-sm), var(--rim-specular);
}
[data-theme="obsidian"] .jp-btn.secondary,
[data-theme="obsidian"] .jp-chip-filter,
[data-theme="dark"] .jp-btn.secondary,
[data-theme="dark"] .jp-chip-filter {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--fg-primary);
}
[data-theme="obsidian"] .jp-input,
[data-theme="obsidian"] .jp-select,
[data-theme="obsidian"] .jp-textarea,
[data-theme="dark"] .jp-input,
[data-theme="dark"] .jp-select,
[data-theme="dark"] .jp-textarea {
  background: var(--bg-input);
  border-color: var(--border-strong);
  color: var(--fg-primary);
}
[data-theme="obsidian"] .jp-table tbody tr:hover td,
[data-theme="dark"] .jp-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* --------------------------------------------------------------------------
   2. BASE RESET, TABULAR NUMERALS & BRAND LOGO SPECIFICITY LOCK
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-shell);
  color: var(--fg-secondary);
  font: 14px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.num,
.jp-num,
[data-num],
code.timecode,
.tabular {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

/* Strict Brand Logo Mutual Exclusion (Fixes Triple-Logo Stack Bug) */
:root .brand-logo-light,
[data-theme="daylight"] .brand-logo-light {
  display: block !important;
  width: 132px;
  height: auto;
}
:root .brand-logo-dark,
:root .studio-brand-icon,
[data-theme="daylight"] .brand-logo-dark,
[data-theme="daylight"] .studio-brand-icon {
  display: none !important;
}

[data-theme="obsidian"] .brand-logo-dark,
[data-theme="dark"] .brand-logo-dark {
  display: block !important;
  width: 132px;
  height: auto;
}
[data-theme="obsidian"] .brand-logo-light,
[data-theme="obsidian"] .studio-brand-icon,
[data-theme="dark"] .brand-logo-light,
[data-theme="dark"] .studio-brand-icon {
  display: none !important;
}

/* Collapsed 68px Rail Mode Brand Override */
.studio-shell[data-rail="true"] .brand-logo-light,
.studio-shell[data-rail="true"] .brand-logo-dark,
.studio-shell[data-rail="true"] .studio-brand-sub,
.studio-shell.is-rail .brand-logo-light,
.studio-shell.is-rail .brand-logo-dark,
.studio-shell.is-rail .studio-brand-sub {
  display: none !important;
}
.studio-shell[data-rail="true"] .studio-brand-icon,
.studio-shell.is-rail .studio-brand-icon {
  display: block !important;
  width: 32px;
  height: 32px;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 8px;
}

@keyframes dag-photon-flow {
  from { stroke-dashoffset: 36; }
  to   { stroke-dashoffset: 0; }
}

@keyframes rise-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tally-dot,
.rec-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--jp-flame);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   3. STUDIO SHELL & COLLAPSIBLE SIDEBAR (252px <-> 68px Rail)
   -------------------------------------------------------------------------- */
.studio-shell,
.jp-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  background: var(--bg-shell);
  transition: grid-template-columns 200ms var(--ease-snappy);
}

.studio-shell.is-rail,
.studio-shell[data-rail="true"] {
  grid-template-columns: var(--sidebar-rail-w) minmax(0, 1fr);
}

.studio-sidebar,
.jp-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-hairline);
  z-index: 40;
}

.studio-brand,
.jp-brand {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 6px 20px;
  text-decoration: none;
  color: var(--fg-primary);
  min-width: 0;
}

.studio-brand-sub,
.jp-brand-product {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Navigation Groups & Single-Line Items */
.studio-nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.studio-nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-group-label {
  margin: 0 12px 5px;
  color: var(--fg-subtle);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Collapsible Sidebar Navigation Groups (<details class="nav-group-fold">) */
.nav-group-fold {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}
.nav-group-fold > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 0 4px 4px;
  padding: 4px 8px;
  border-radius: 7px;
  color: var(--fg-subtle);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background 140ms ease, color 140ms ease;
}
.nav-group-fold > summary::-webkit-details-marker {
  display: none;
}
.nav-group-fold > summary::after {
  content: "▸";
  font-size: 12px;
  line-height: 1;
  color: var(--fg-muted);
  flex-shrink: 0;
  transition: transform 150ms var(--ease-snappy), color 140ms ease;
}
.nav-group-fold[open] > summary::after {
  transform: rotate(90deg);
}
.nav-group-fold > summary:hover {
  background: var(--bg-elevated);
  color: var(--fg-primary);
}
.nav-group-fold > summary:hover::after {
  color: var(--fg-primary);
}
.nav-group-fold-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.studio-nav-item,
.jp-nav-link {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  height: 40px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-control);
  border: 0;
  background: transparent;
  color: var(--fg-secondary);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 140ms var(--ease-snappy), color 140ms var(--ease-snappy);
}

.studio-nav-item > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-nav-item svg,
.jp-nav-link svg {
  width: 18px;
  height: 18px;
  color: var(--fg-subtle);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  transition: color 140ms ease;
}

.studio-nav-item:hover {
  background: var(--bg-elevated);
  color: var(--fg-primary);
}
.studio-nav-item:hover svg {
  color: var(--fg-secondary);
}

.studio-nav-item.active,
.studio-nav-item.is-active,
.jp-nav-link.active {
  background: var(--sel-bg);
  color: var(--fg-primary);
  font-weight: 700;
}
.studio-nav-item.active svg,
.studio-nav-item.is-active svg,
.jp-nav-link.active svg {
  color: var(--jp-flame);
}

.studio-nav-item.active::before,
.studio-nav-item.is-active::before,
.jp-nav-link.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 13px;
  height: 18px;
  margin-top: -9px;
  border-radius: 0;
  background: var(--jp-flame);
  clip-path: polygon(0 8%, 100% 0, 92% 76%, 36% 82%, 10% 100%, 16% 80%, 4% 80%);
}
.jp-spark-mark {
  color: var(--jp-flame);
  flex-shrink: 0;
  display: inline-block;
}

.nav-badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--fg-muted);
  font: 600 12px/1.35 var(--font-display);
  font-variant-numeric: tabular-nums;
  font-style: normal;
  white-space: nowrap;
}

/* Sidebar Footer: Upstream Health, Theme Switcher & Rail Toggle */
.studio-sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border-radius: var(--r-control);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
}
.theme-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.theme-switch button i {
  font-style: normal;
  font-size: 13px;
  line-height: 1;
}
.theme-switch button.active,
.theme-switch button.is-active {
  background: var(--bg-card);
  color: var(--fg-primary);
  box-shadow: var(--shadow-sm);
}

.rail-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.rail-toggle-btn:hover {
  background: var(--bg-elevated);
  color: var(--fg-primary);
}

/* Rail Mode ([data-rail="true"]) Clean Icon-Only Layout (Zero Text Overlap!) */
.studio-shell[data-rail="true"] .studio-sidebar,
.studio-shell.is-rail .studio-sidebar {
  padding: 18px 10px 14px;
  align-items: center;
}
.studio-shell[data-rail="true"] .studio-brand,
.studio-shell.is-rail .studio-brand {
  margin: 0 0 18px;
  align-items: center;
}
.studio-shell[data-rail="true"] .theme-btn-lbl,
.studio-shell[data-rail="true"] .sidebar-meta-text,
.studio-shell[data-rail="true"] .studio-nav-item > span,
.studio-shell[data-rail="true"] .nav-badge,
.studio-shell[data-rail="true"] .nav-group-label,
.studio-shell.is-rail .theme-btn-lbl,
.studio-shell.is-rail .sidebar-meta-text,
.studio-shell.is-rail .studio-nav-item > span,
.studio-shell.is-rail .nav-badge,
.studio-shell.is-rail .nav-group-label {
  display: none !important;
}
.studio-shell[data-rail="true"] .studio-nav,
.studio-shell.is-rail .studio-nav {
  align-items: center;
}
.studio-shell[data-rail="true"] .studio-nav-group,
.studio-shell.is-rail .studio-nav-group,
.studio-shell[data-rail="true"] .nav-group-fold,
.studio-shell.is-rail .nav-group-fold,
.studio-shell[data-rail="true"] .nav-group-fold-body,
.studio-shell.is-rail .nav-group-fold-body {
  align-items: center;
  width: 100%;
}
.studio-shell[data-rail="true"] .nav-group-fold > summary,
.studio-shell.is-rail .nav-group-fold > summary {
  display: none !important;
}
.studio-shell[data-rail="true"] .studio-nav-item,
.studio-shell.is-rail .studio-nav-item {
  grid-template-columns: 1fr;
  justify-items: center;
  width: 42px;
  height: 40px;
  padding: 0;
}
.studio-shell[data-rail="true"] .studio-nav-item.active::before,
.studio-shell.is-rail .studio-nav-item.active::before {
  left: -13px;
  width: 10px;
  height: 15px;
  margin-top: -7.5px;
}
.studio-shell[data-rail="true"] .theme-switch,
.studio-shell.is-rail .theme-switch {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 42px;
  margin: 0 auto;
  gap: 4px;
  padding: 3px;
}
.studio-shell[data-rail="true"] .theme-switch button,
.studio-shell.is-rail .theme-switch button {
  width: 36px;
  height: 30px;
  padding: 0;
}
.studio-shell[data-rail="true"] .rail-toggle-btn,
.studio-shell.is-rail .rail-toggle-btn {
  width: 42px;
  padding: 0;
  margin: 0 auto;
}

.studio-main {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  container-type: inline-size;
  container-name: workspace;
}

.studio-mobile-bar {
  display: none;
}
.sidebar-backdrop {
  display: none;
}

/* --------------------------------------------------------------------------
   4. SHARED CONTROLS, BUTTONS, CHIPS & SEGMENTED TABS
   -------------------------------------------------------------------------- */
.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 15px;
  border-radius: var(--r-control);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--fg-primary);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 140ms var(--ease-snappy), border-color 140ms var(--ease-snappy), transform 80ms ease;
}
.st-btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
}
.st-btn:active {
  transform: translateY(1px);
}
.st-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.st-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.85;
  flex-shrink: 0;
}

.st-btn.primary {
  background: var(--jp-grad-primary);
  border-color: transparent;
  color: var(--ui-on-accent);
  font-weight: 700;
  box-shadow: var(--jp-shadow-primary);
}
.st-btn.primary:hover {
  background: var(--jp-grad-primary-hover);
}

.st-btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--fg-secondary);
}
.st-btn.ghost:hover {
  background: var(--bg-elevated);
  color: var(--fg-primary);
}

.st-btn.danger {
  border-color: var(--branch-bad-border);
  color: var(--status-danger);
}
.st-btn.danger:hover {
  background: var(--status-danger-bg);
}

.st-btn.sm {
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
}
.st-btn.icon-only {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.st-chip,
.health-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-bubble);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.st-chip.ok, .health-chip.ok {
  background: var(--status-ok-bg);
  color: var(--status-ok);
}
.st-chip.warn, .health-chip.warn {
  background: var(--status-warn-bg);
  color: var(--status-warn);
}
.st-chip.danger, .health-chip.danger {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}
.st-chip.work, .health-chip.work {
  background: var(--status-work-bg);
  color: var(--status-work);
}
.st-chip.wait, .health-chip.wait {
  background: var(--status-wait-bg);
  color: var(--fg-muted);
}
.st-chip.clue, .health-chip.clue {
  background: var(--branch-clue-bg);
  color: var(--branch-clue-text);
  border-color: var(--branch-clue-border);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  border: 1px solid transparent;
}
.role-badge[data-role="spine"], .role-badge.spine {
  background: var(--branch-spine-bg);
  color: var(--fg-primary);
  border-color: var(--branch-spine-border);
}
.role-badge[data-role="vip_branch"], .role-badge.vip {
  background: var(--branch-vip-bg);
  color: var(--branch-vip-text);
  border-color: var(--branch-vip-border);
}
.role-badge[data-gate="coins"] {
  background: color-mix(in srgb, var(--choice-vip-gold) 13%, var(--bg-card));
  color: var(--choice-vip-gold);
  border-color: color-mix(in srgb, var(--choice-vip-gold) 48%, var(--border-hairline));
}
.role-badge[data-role="sub_branch"], .role-badge.free {
  background: var(--branch-free-bg);
  color: var(--branch-free-text);
  border-color: var(--branch-free-border);
}
.role-badge[data-gate="free"] {
  background: color-mix(in srgb, var(--choice-free-slate) 12%, var(--bg-card));
  color: var(--choice-free-slate);
  border-color: color-mix(in srgb, var(--choice-free-slate) 40%, var(--border-hairline));
}
.role-badge[data-gate="stat_gate"] {
  background: color-mix(in srgb, var(--choice-stat-blue) 12%, var(--bg-card));
  color: var(--choice-stat-blue);
  border-color: color-mix(in srgb, var(--choice-stat-blue) 45%, var(--border-hairline));
}
.role-badge[data-role="ad_branch"], .role-badge.ad,
.role-badge[data-gate="rewarded_ad"] {
  background: var(--branch-ad-bg);
  color: var(--ui-ad);
  border-color: var(--branch-ad-border);
}
.role-badge.clue,
.role-badge[data-gate="clue"] {
  background: var(--branch-clue-bg);
  color: var(--ui-clue);
  border-color: var(--branch-clue-border);
}
.role-badge[data-role="bad_end"], .role-badge.bad {
  background: var(--branch-bad-bg);
  color: var(--branch-bad-text);
  border-color: var(--branch-bad-border);
}
.role-badge[data-role="ending"], .role-badge.hidden, .role-badge.ssr {
  background: var(--branch-hidden-bg);
  color: var(--branch-hidden-text);
  border-color: var(--branch-hidden-border);
}

.seg-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: var(--r-control);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
}
.seg-tabs button {
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease;
}
.seg-tabs button:hover {
  color: var(--fg-primary);
}
.seg-tabs button.active,
.seg-tabs button.is-active {
  background: var(--bg-card);
  color: var(--fg-primary);
  box-shadow: var(--shadow-sm);
}

.st-input,
.st-select,
.st-textarea {
  width: 100%;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--fg-primary);
  font: inherit;
  font-size: 13px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.st-textarea {
  min-height: 72px;
  padding: 8px 11px;
  resize: vertical;
}
.st-input:focus,
.st-select:focus,
.st-textarea:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  border-color: var(--jp-flame);
  box-shadow: var(--jp-focus-ring);
}

:focus-visible {
  outline: 2px solid var(--jp-flame);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   5. VIEW 1: PROJECTS & UPSTREAM 4-STAGE PIPELINE (Precision Grid Alignment)
   -------------------------------------------------------------------------- */
.view-container {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 0 52px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise-fade 200ms var(--ease-snappy);
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.view-crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  color: var(--fg-muted);
  font-size: 12.5px;
}
.view-head h1 {
  margin: 0;
  color: var(--fg-primary);
  font-size: 25px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.view-head p {
  margin: 6px 0 0;
  color: var(--fg-muted);
  font-size: 13.5px;
}
.view-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 5-System JOYPLUS Industrial Pipeline Conveyor (首屏直出 · 零折叠) */
.home-pipeline-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.home-section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.home-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--fg-primary);
  letter-spacing: 0.01em;
}
.home-section-title small {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}

/* Sleek Single-Row 44px Industrial Pipeline Summary Strip (9:16 Drama Shelf Starts Above Fold) */
#pipelineStrip,
.pipeline-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: none;
}
#pipelineStrip::-webkit-scrollbar,
.pipeline-strip::-webkit-scrollbar {
  display: none;
}
#pipelineStrip .pipeline-strip-item,
.pipeline-strip .pipeline-strip-item,
#pipelineStrip .pipeline-stage,
.pipeline-strip .pipeline-stage {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  color: var(--fg-secondary);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transform: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
#pipelineStrip .pipeline-strip-item:hover,
.pipeline-strip .pipeline-strip-item:hover,
#pipelineStrip .pipeline-stage:hover,
.pipeline-strip .pipeline-stage:hover {
  background: var(--bg-subtle);
  border-color: var(--border-hairline);
  color: var(--fg-primary);
  transform: none;
  box-shadow: none;
}
#pipelineStrip .pipeline-strip-item.is-current,
#pipelineStrip .pipeline-strip-item.active,
.pipeline-strip .pipeline-strip-item.is-current,
.pipeline-strip .pipeline-strip-item.active,
#pipelineStrip .pipeline-stage.is-current,
#pipelineStrip .pipeline-stage.active {
  background: var(--jp-flame-tint);
  border-color: var(--jp-flame-border);
  color: var(--jp-flame);
  font-weight: 700;
  box-shadow: none;
}
#pipelineStrip .pipeline-strip-idx,
#pipelineStrip .stage-index,
.pipeline-strip .pipeline-strip-idx {
  font: 700 12px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--jp-flame);
}
#pipelineStrip .pipeline-strip-val,
#pipelineStrip .pipeline-strip-metric,
#pipelineStrip .stage-metric,
#pipelineStrip b,
#pipelineStrip strong {
  font: 700 13px/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--fg-primary);
}
#pipelineStrip .pipeline-strip-item.is-current :is(b, strong, .pipeline-strip-val, .pipeline-strip-metric, .stage-metric),
#pipelineStrip .pipeline-stage.is-current :is(b, strong, .stage-metric) {
  color: var(--jp-flame);
}
#pipelineStrip .pipeline-strip-sep,
.pipeline-strip .pipeline-strip-sep,
#pipelineStrip .pipeline-arrow {
  color: var(--fg-muted);
  font-size: 12px;
  opacity: 0.55;
  user-select: none;
  flex-shrink: 0;
}
#pipelineStrip .pipeline-strip-dot,
.pipeline-strip .pipeline-strip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-ok);
  flex-shrink: 0;
}
#pipelineStrip .is-current .pipeline-strip-dot,
.pipeline-strip .is-current .pipeline-strip-dot {
  background: var(--jp-flame);
}
#pipelineStrip .stage-progress,
.pipeline-strip .stage-progress {
  display: none;
}
#pipelineStrip .pipeline-strip-summary,
.pipeline-strip .pipeline-strip-summary {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--border-hairline);
  font-size: 12px;
  color: var(--fg-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.pipeline-conveyor,
.pipeline-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.pipeline-stage {
  position: relative;
  padding: 10px 12px;
  min-height: 92px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  transition: border-color 160ms ease, transform 160ms var(--ease-snappy), box-shadow 160ms ease;
}
.pipeline-stage:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.pipeline-stage.is-current,
.pipeline-stage.active {
  border-color: var(--jp-flame-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--ui-accent) 6%, var(--bg-card)) 0%, var(--bg-card) 68%);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--jp-flame-border);
}

.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}
.stage-index {
  font: 700 12px/1.2 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--jp-flame);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-title {
  margin: 0;
  color: var(--fg-primary);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-metric {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font: 700 20px/1.05 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--fg-primary);
  white-space: nowrap;
}
.stage-metric small {
  font: 600 12px/1.2 var(--font-sans);
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-meta {
  color: var(--fg-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-progress {
  height: 3px;
  border-radius: 2px;
  background: var(--bg-elevated);
  overflow: hidden;
}
.stage-progress > i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--status-ok);
  width: var(--fill, 100%);
}
.pipeline-stage.is-current .stage-progress > i {
  background: var(--jp-flame);
}

/* Unified Editorial Telemetry Ribbon (Replaces 4 bulky ERP boxes; puts 9:16 Showcase above the fold!) */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.kpi-tile {
  position: relative;
  padding: 10px 16px;
  border-radius: 0;
  border: 0;
  border-right: 1px solid var(--border-hairline);
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
  transition: background 140ms ease;
}
.kpi-tile:last-child {
  border-right: 0;
}
.kpi-tile:nth-child(2) { --kpi-accent: var(--branch-free); }
.kpi-tile:nth-child(3) { --kpi-accent: var(--branch-vip); }
.kpi-tile:nth-child(4) { --kpi-accent: var(--status-ok); }
.kpi-tile:hover {
  background: var(--bg-subtle);
}
.kpi-tile .kpi-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-tile .kpi-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--kpi-accent, var(--jp-flame));
  flex-shrink: 0;
}
.kpi-tile .kpi-value {
  color: var(--fg-primary);
  font: 700 20px/1.15 var(--font-display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi-tile .kpi-sub {
  color: var(--fg-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 9:16 Drama Matrix Cards (JOYPLUS v4 Industrial Shelf + 6-Action Matrix) */
.project-shelf-head { align-items: center; gap: 12px 24px; }
.project-shelf-head h1 { font-size: clamp(24px, 2.3vw, 31px); letter-spacing: -.02em; }
.project-shelf-head p { margin-top: 6px; line-height: 1.6; }
.project-source-count {
  padding-left: 9px;
  border-left: 1px solid var(--ui-line, var(--border-hairline));
  color: var(--ui-muted, var(--fg-muted));
  font-variant-numeric: tabular-nums;
}
.project-shelf.drama-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
}
.shelf-project {
  --shelf-ink: var(--ui-ink, var(--fg-primary));
  --shelf-muted: var(--ui-muted, var(--fg-muted));
  --shelf-line: var(--ui-line, var(--border-hairline));
  --shelf-accent: var(--ui-accent);
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
  background: var(--ui-surface, var(--bg-card));
  border: 1px solid var(--shelf-line);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms var(--ease-snappy), box-shadow 160ms ease, transform 160ms var(--ease-snappy);
}
.shelf-project:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.shelf-project-cover {
  position: relative;
  grid-area: 1 / 1 / 3 / 2;
  display: block;
  width: 112px;
  aspect-ratio: 9 / 16;
  align-self: center;
  justify-self: center;
  margin: 12px 0 12px 12px;
  min-width: 0;
  border-radius: 10px;
  background: #141416;
  overflow: hidden;
  border: 1px solid var(--shelf-line);
  box-shadow: 0 4px 12px rgba(29, 29, 29, 0.16);
  text-decoration: none;
}
.shelf-project-cover::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 44%;
  background: linear-gradient(180deg, rgba(17, 17, 19, 0) 0%, rgba(17, 17, 19, 0.72) 100%);
  pointer-events: none;
}
.cover-ratio-pill {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(29, 29, 29, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f7f5f2;
  font: 700 12px/1.3 var(--font-mono);
  letter-spacing: 0.02em;
}
.cover-play-badge {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(29, 29, 29, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.shelf-project-cover:hover .cover-play-badge {
  background: var(--jp-flame);
  border-color: var(--jp-flame);
  transform: translateX(-50%) scale(1.06);
}
.shelf-project-cover img { width: 100%; height: 100%; min-height: 0; object-fit: cover; object-position: 50% 24%; display: block; transition: transform 280ms var(--spring-cinema); }
.shelf-project:hover .shelf-project-cover img { transform: scale(1.04); }
.shelf-project-main { min-width: 0; padding: 14px 16px 10px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.shelf-project-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; color: var(--shelf-muted); font-size: 12px; }
.shelf-project-code { font: 700 12px/1.4 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--jp-flame); letter-spacing: .025em; padding: 1px 7px; border-radius: 5px; background: var(--jp-flame-tint); border: 1px solid var(--jp-flame-border); }
.shelf-project-title { margin: 2px 0; }
.shelf-project-title h2 { margin: 0; color: var(--shelf-ink); font-size: 17px; font-weight: 800; letter-spacing: -.015em; line-height: 1.28; overflow-wrap: anywhere; }
.shelf-project-title span { display: block; color: var(--shelf-muted); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.shelf-project-status-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.shelf-project-status { display: inline-flex; align-items: center; }
.shelf-project-status .health-chip { font-size: 12px; }
.shelf-project-facts { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; vertical-align: middle; font-variant-numeric: tabular-nums; }
.shelf-project-facts > div { display: inline-flex; flex-direction: row-reverse; align-items: baseline; gap: 3px; }
.shelf-project-facts dt { color: var(--shelf-muted); font-size: 12px; }
.shelf-project-facts dd { color: var(--shelf-ink); font: 700 13px/1.25 var(--font-display); font-variant-numeric: tabular-nums; margin: 0; }
.shelf-project-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.shelf-project-actions svg,
.shelf-project-tools svg {
  flex-shrink: 0;
}
.shelf-project-actions :is(a,button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--shelf-ink);
  font: 650 12.5px/1.2 var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.shelf-project-actions :is(a,button):hover {
  background: var(--bg-elevated);
  border-color: var(--jp-flame-border);
  color: var(--fg-primary);
}
.shelf-project-actions .shelf-design-action {
  background: var(--jp-grad-primary);
  color: var(--ui-on-accent, #fff);
  border-color: transparent;
  box-shadow: var(--jp-shadow-primary);
  font-weight: 700;
}
.shelf-project-actions .shelf-design-action:hover {
  background: var(--jp-grad-primary-hover);
  border-color: transparent;
  color: var(--ui-on-accent, #fff);
}
.shelf-project-actions .shelf-play-action {
  background: var(--jp-flame-tint);
  border-color: var(--jp-flame-border);
  color: var(--jp-flame);
  font-weight: 700;
}
.shelf-project-actions .shelf-play-action:hover {
  background: var(--jp-flame);
  border-color: var(--jp-flame);
  color: var(--ui-on-accent, #fff);
}
.shelf-project-tools {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  align-items: center;
  padding: 5px 16px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--shelf-line);
}
.shelf-project-tools :is(a,button) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--fg-secondary);
  cursor: pointer;
  font: 600 12px/1.35 var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  transition: color 140ms ease;
}
.shelf-project-tools :is(a,button):hover { color: var(--jp-flame); text-decoration: underline; text-underline-offset: 3px; }
.shelf-project :is(a,button):focus-visible { outline: 2px solid var(--shelf-accent); outline-offset: 2px; }
/* Signature JOYPLUS Logo-Native Charcoal Hero Showcase (#1D1D1D × #E8492F) */
.shelf-project-featured {
  grid-column: 1 / -1;
  grid-template-columns: 184px minmax(0, 1fr);
  background:
    radial-gradient(circle at 12% 30%, rgba(232, 73, 47, 0.22) 0%, rgba(29, 29, 29, 0) 44%),
    linear-gradient(135deg, #1d1d1d 0%, #151517 100%);
  border: 1px solid #302d2a;
  box-shadow: 0 14px 36px rgba(29, 29, 29, 0.16);
  --shelf-ink: #faf8f5;
  --shelf-muted: #aba49c;
  --shelf-line: rgba(255, 255, 255, 0.10);
}
.shelf-project-featured:hover {
  border-color: rgba(232, 73, 47, 0.56);
  box-shadow: 0 18px 42px rgba(29, 29, 29, 0.22);
}
.shelf-project-featured .shelf-project-cover {
  width: 162px;
  aspect-ratio: 9 / 16;
  margin: 14px 0 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.shelf-project-featured .shelf-project-cover img { object-fit: cover; object-position: 50% 24%; }
.shelf-project-featured .shelf-project-main { padding: 18px 24px 12px; }
.shelf-project-featured .shelf-project-code {
  background: rgba(232, 73, 47, 0.20);
  border-color: rgba(232, 73, 47, 0.48);
  color: #ff8b74;
}
.shelf-project-featured .genre-skin-badge {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #f3e4c3;
}
.shelf-project-featured .shelf-project-title { margin: 4px 0; }
.shelf-project-featured .shelf-project-title h2 { font-size: clamp(20px, 2vw, 25px); line-height: 1.24; color: #ffffff; }
.shelf-project-featured .shelf-project-title span { font-size: 13px; margin-top: 4px; color: #aba49c; }
.shelf-project-choice { margin: 6px 0; padding-inline-start: 11px; border-inline-start: 2.5px solid var(--jp-flame); color: var(--fg-secondary); font-size: 13px; line-height: 1.5; }
.shelf-project-featured .shelf-project-choice { color: #e9e4dd; }
.shelf-project-featured .shelf-project-facts { gap: 5px 14px; }
.shelf-project-featured .shelf-project-actions { margin-top: 8px; gap: 8px; }
.shelf-project-featured .shelf-project-actions :is(a,button) {
  min-height: 35px;
  padding: 0 14px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #f7f5f2;
}
.shelf-project-featured .shelf-project-actions :is(a,button):hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(232, 73, 47, 0.65);
  color: #ffffff;
}
.shelf-project-featured .shelf-project-actions .shelf-design-action {
  background: var(--jp-grad-primary);
  border-color: transparent;
  color: #ffffff;
}
.shelf-project-featured .shelf-project-actions .shelf-play-action {
  background: rgba(232, 73, 47, 0.18);
  border-color: rgba(232, 73, 47, 0.52);
  color: #ff9c88;
}
.shelf-project-featured .shelf-project-actions .shelf-play-action:hover {
  background: var(--jp-flame);
  border-color: var(--jp-flame);
  color: #ffffff;
}
.shelf-project-featured .shelf-project-tools {
  padding-inline: 24px;
  background: rgba(255, 255, 255, 0.03);
  border-top-color: rgba(255, 255, 255, 0.09);
}
.shelf-project-featured .shelf-project-tools :is(a,button) {
  color: #c8c1b8;
}
.shelf-project-featured .shelf-project-tools :is(a,button):hover {
  color: #ff7c63;
}
.shelf-project-featured .health-chip.ok {
  background: rgba(34, 197, 139, 0.16);
  color: #4ade80;
}
.shelf-project-featured .st-chip.work {
  background: rgba(232, 73, 47, 0.22);
  color: #ff8b74;
}
@media (max-width: 1020px) {
  .project-shelf.drama-grid { grid-template-columns: 1fr; }
  .shelf-project { grid-template-columns: 112px minmax(0, 1fr); }
  .shelf-project-cover { width: 96px; }
  .shelf-project-featured { grid-template-columns: 164px minmax(0, 1fr); }
  .shelf-project-featured .shelf-project-cover { width: 144px; }
}
@media (max-width: 650px) {
  .project-shelf-head { align-items: flex-start; }
  .project-shelf-head h1 { font-size: 26px; }
  .project-shelf-head p { font-size: 13px; }
  .project-shelf.drama-grid { gap: 10px; }
  .shelf-project { grid-template-columns: 68px minmax(0, 1fr); }
  .shelf-project-main { padding: 10px 12px 4px; }
  .shelf-project-title h2 { font-size: 16px; }
  .shelf-project-tools { padding-inline: 12px; gap: 0 11px; }
  .shelf-project-tools :is(a,button) { min-height: 35px; }
  .shelf-project-actions { gap: 10px 16px; margin-top: 4px; }
  .shelf-project-actions a { min-height: 36px; }
  .shelf-project-facts { display: flex; margin-left: 0; }
  .shelf-project-featured { grid-template-columns: minmax(100px, 34%) minmax(0, 1fr); }
  .shelf-project-featured .shelf-project-cover { grid-row: 1; }
  .shelf-project-featured .shelf-project-cover.has-second-still { grid-template-columns: 1fr; }
  .shelf-project-featured .shelf-project-cover img + img { display: none; }
  .shelf-project-featured .shelf-project-main { padding: 13px 13px 8px; }
  .shelf-project-featured .shelf-project-title h2 { font-size: 21px; line-height: 1.28; }
  .shelf-project-featured .shelf-project-title span { font-size: 12px; }
  .shelf-project-featured .shelf-project-actions { gap: 7px; margin-top: 9px; }
  .shelf-project-featured .shelf-project-actions a { padding: 0 10px; }
  .shelf-project-featured .shelf-project-tools { grid-column: 1 / -1; padding-inline: 13px; }
}

/* Genre Theme Skin Badge on Project Overview Cards */
.genre-skin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  border: 1px solid var(--branch-vip-border);
  background: var(--branch-vip-bg);
  color: var(--branch-vip-text);
}
.genre-skin-badge[data-genre-skin="corporate_noir"] {
  background: var(--branch-vip-bg);
  border-color: var(--branch-vip-border);
  color: var(--branch-vip-text);
}
.genre-skin-badge[data-genre-skin="dragon_romantasy"] {
  background: var(--ui-soft);
  border-color: var(--jp-flame-border);
  color: var(--jp-flame);
}
.genre-skin-badge[data-genre-skin="mafia_crimson"] {
  background: var(--branch-bad-bg);
  border-color: var(--branch-bad-border);
  color: var(--branch-bad-text);
}
.genre-skin-badge[data-genre-skin="palace_gilded"] {
  background: var(--branch-hidden-bg);
  border-color: var(--branch-hidden-border);
  color: var(--branch-hidden-text);
}

/* --------------------------------------------------------------------------
   5B. VIEW 1.5: PANORAMIC STORYLINE & ENDING ATLAS (#view-atlas)
   -------------------------------------------------------------------------- */
.atlas-view {
  width: min(1580px, calc(100% - 36px));
  margin: 0 auto;
  padding: 12px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: rise-fade 200ms var(--ease-snappy);
}

.atlas-top-row,
.atlas-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  flex-wrap: nowrap;
}

.atlas-toolbar-left,
.atlas-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}
.atlas-toolbar-left {
  flex: 1 1 auto;
}
.atlas-toolbar-right {
  flex-shrink: 0;
}

.atlas-project-select,
#atlasProjectSelect {
  width: 212px;
  min-width: 156px;
  max-width: 220px;
  height: 34px;
  min-height: 34px;
  padding-right: 26px;
  font-weight: 700;
  flex: 0 1 212px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.atlas-stats-pills {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  overflow: visible;
}

.atlas-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  color: var(--fg-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.atlas-stat-pill b {
  color: var(--fg-primary);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}
.atlas-stat-pill.highlight {
  background: var(--jp-flame-tint);
  border-color: var(--jp-flame-border);
  color: var(--jp-flame);
}

.atlas-section-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-primary);
  white-space: nowrap;
}
.atlas-section-kicker small {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
}

/* Row 2: Horizontal Ending Recipes & Causal Unlock Strip */
.atlas-ending-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(264px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.atlas-ending-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm), var(--rim-specular);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  min-width: 0;
  text-align: left;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.atlas-ending-card:hover {
  border-color: var(--jp-flame-border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.atlas-ending-card.is-active {
  border-color: var(--ui-accent);
  background: var(--ui-soft);
  box-shadow: inset 0 0 0 1px var(--ui-accent);
}

.atlas-ending-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.atlas-ending-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.atlas-ending-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.atlas-ending-trace-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--branch-vip-text);
  white-space: nowrap;
  flex-shrink: 0;
}

.atlas-recipe-chain {
  font-size: 12px;
  line-height: 1.38;
  color: var(--fg-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}
.atlas-recipe-chain strong {
  color: var(--fg-secondary);
  font-weight: 600;
}

/* Row 3: Panoramic Interactive Tree Canvas */
.atlas-canvas-stage {
  position: relative;
  width: 100%;
  height: calc(100dvh - 118px);
  min-height: 500px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-abyss);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.atlas-canvas-mount {
  width: 100%;
  height: 100%;
  position: relative;
}

.atlas-floating-hud {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 11px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  max-width: calc(100% - 190px);
}
.atlas-floating-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Wide-Canvas Mode Toggle inside /studio */
.studio-panes.is-wide-canvas {
  grid-template-columns: minmax(0, 1fr) !important;
}
.studio-panes.is-wide-canvas .pane-left,
.studio-panes.is-wide-canvas .pane-right,
.studio-panes.is-wide-canvas .studio-gutter {
  display: none !important;
}

/* --------------------------------------------------------------------------
   6. VIEW 2: 3-PANE DIRECTOR DAG STUDIO (NLE 100vh Zero-Scroll Workspace)
   -------------------------------------------------------------------------- */
.studio-workbench,
.dag-studio {
  height: 100vh;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(var(--studio-topbar-h), auto) minmax(0, 1fr);
  background: var(--bg-abyss);
}

/* Top Director Transport Bar (Single-Row Figma/Linear Layout) */
.studio-toolbar {
  height: 50px;
  min-height: 50px;
  min-width: 0;
  max-width: 100%;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-hairline);
  overflow: visible;
  z-index: 35;
}
.toolbar-more-wrap {
  position: relative;
  flex-shrink: 0;
}
.toolbar-more-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 204px;
  padding: 6px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 80;
}
.more-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-primary);
  font: 600 12.5px/1 var(--font-sans);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.more-menu-item:hover {
  background: var(--bg-elevated);
  color: var(--jp-flame);
}
.more-menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--border-hairline);
}
.toolbar-left,
.toolbar-center,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.toolbar-left {
  min-width: 0;
  flex-shrink: 1;
}
.toolbar-left .st-select {
  width: 186px;
  max-width: 204px;
  height: 32px;
  min-height: 32px;
  font-weight: 700;
  flex-shrink: 1;
  text-overflow: ellipsis;
}
.genre-theme-select,
.toolbar-left .genre-theme-select {
  width: auto;
  min-width: 126px;
  max-width: 162px;
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border-color: var(--branch-vip-border);
  background: var(--ui-surface);
  color: var(--ui-ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.atlas-toolbar-left .genre-theme-select,
#atlasGenreThemeSelect {
  width: 134px;
  min-width: 112px;
  max-width: 140px;
  height: 34px;
  min-height: 34px;
  padding: 0 8px;
  flex: 0 1 134px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.genre-theme-select:hover {
  border-color: var(--jp-flame);
}
.studio-toolbar .st-btn,
.studio-toolbar .st-chip,
.studio-toolbar .health-chip,
.autosave-pill {
  white-space: nowrap;
  flex-shrink: 0;
}
.autosave-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--fg-muted);
  font: 600 12px/1 var(--font-sans);
}

/* Studio Toolbar Undo / Redo History Controls */
.toolbar-history-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  flex-shrink: 0;
}
#btnStudioUndo,
#btnStudioRedo {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  color: var(--fg-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  flex-shrink: 0;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}
.toolbar-history-group #btnStudioUndo,
.toolbar-history-group #btnStudioRedo {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 6px;
  border-color: transparent;
  background: transparent;
}
#btnStudioUndo:hover:not(:disabled),
#btnStudioRedo:hover:not(:disabled) {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--fg-primary);
}
#btnStudioUndo:active:not(:disabled),
#btnStudioRedo:active:not(:disabled) {
  transform: translateY(1px);
}
#btnStudioUndo:disabled,
#btnStudioRedo:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}
#btnStudioUndo svg,
#btnStudioRedo svg,
#btnStudioUndo .lucide,
#btnStudioRedo .lucide {
  width: 15px;
  height: 15px;
}

.studio-mobile-tabs {
  display: none;
}

/* 3-Pane Precision Grid with Split-Grid Interactive Drag Gutters */
.studio-panes {
  display: grid;
  grid-template-columns: 256px 5px minmax(0, 1fr) 5px 352px;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.studio-panes.is-resizing-panes {
  transition: none !important;
  user-select: none;
}
.studio-gutter {
  position: relative;
  width: 5px;
  background: var(--bg-shell);
  cursor: col-resize;
  z-index: 18;
  transition: background 140ms ease;
}
.studio-gutter::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 1px;
  background: var(--border-hairline);
  transition: width 140ms ease, left 140ms ease, background 140ms ease;
}
.studio-gutter:hover::after,
.studio-panes.is-resizing-panes .studio-gutter::after {
  left: 1px;
  width: 3px;
  background: var(--jp-flame);
}

/* Left Pane: Concise 3-Tab Switcher (章节 / 变量 / AI 支线) */
.pane-left {
  background: var(--bg-card);
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.pane-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 10px;
  gap: 4px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
}
.pane-tabs button {
  height: 32px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.pane-tabs button.active,
.pane-tabs button.is-active {
  background: var(--bg-card);
  color: var(--fg-primary);
  box-shadow: var(--shadow-sm);
}

.pane-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spine-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: border-color 150ms var(--ease-snappy), background 150ms var(--ease-snappy), transform 140ms var(--ease-snappy), box-shadow 150ms ease;
}
.spine-thumb-916 {
  position: relative;
  width: 28px;
  aspect-ratio: 9 / 16;
  border-radius: 5px;
  overflow: hidden;
  background: #141822;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.spine-thumb-916 > span {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: rgba(240, 244, 255, 0.72);
  font: 700 12px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.spine-thumb-916 > img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  display: block;
}
.spine-item.is-active .spine-thumb-916 {
  border-color: var(--jp-flame);
  box-shadow: 0 0 0 1px var(--jp-flame);
}
.spine-item:hover {
  background: var(--bg-card);
  border-color: var(--border-hover);
  transform: translateX(2px);
  box-shadow: var(--shadow-sm);
}
.spine-item.is-active {
  background: var(--sel-bg);
  border-color: var(--jp-flame-border);
  box-shadow: var(--shadow-sm);
}
.spine-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3.5px;
  border-radius: 0 3px 3px 0;
  background: var(--jp-flame);
}
.spine-step-idx {
  width: 26px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--fg-primary);
  font: 700 12px var(--font-mono);
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
}
.spine-item.is-active .spine-step-idx {
  background: var(--jp-flame);
  color: var(--ui-on-accent, #ffffff);
}

.var-card {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.var-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-primary);
}
.var-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.var-controls button {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--fg-primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.var-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--bg-elevated);
  overflow: hidden;
}
.var-bar > i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--var-color, var(--jp-flame));
  width: var(--fill, 30%);
  transition: width 200ms var(--ease-snappy);
}

.ai-expander-card {
  padding: 14px;
  border-radius: 12px;
  background: var(--ui-surface);
  border: 1px solid var(--jp-flame-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-expander-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--fg-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Center Pane: 120fps Interactive DAG Node Canvas */
.dag-canvas-wrap,
.dag-viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-abyss);
  background-image:
    radial-gradient(var(--canvas-dot-major) 1.25px, transparent 1.25px),
    radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-size: 120px 120px, 24px 24px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.dag-canvas-wrap:active {
  cursor: grabbing;
}

.dag-canvas-wrap::before,
.dag-canvas-wrap::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--jp-flame);
  border-style: solid;
  opacity: 0.65;
  pointer-events: none;
  z-index: 12;
}
.dag-canvas-wrap::before {
  top: 10px;
  left: 10px;
  border-width: 2px 0 0 2px;
  border-top-left-radius: 4px;
}
.dag-canvas-wrap::after {
  bottom: 10px;
  right: 10px;
  border-width: 0 2px 2px 0;
  border-bottom-right-radius: 4px;
}

.health-popover {
  position: absolute;
  top: 12px;
  right: 14px;
  width: min(380px, calc(100% - 28px));
  max-height: 360px;
  overflow-y: auto;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.health-issue-row {
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}
.health-issue-row:hover {
  border-color: var(--jp-flame);
}

/* Right Pane: Embedded 9:16 Titanium Phone Frame + Node Inspector */
.pane-right {
  background: var(--bg-card);
  border-left: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.sim-dock {
  padding: 8px 10px 10px;
  background:
    radial-gradient(circle at 50% 38%, rgba(232, 73, 47, 0.16) 0%, rgba(20, 20, 22, 0) 68%),
    linear-gradient(180deg, #1b1b1e 0%, #121214 100%);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.sim-dock-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
  color: #E5E9F2;
  font-size: 12px;
}
.sim-dock-timecode {
  max-width: 128px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #F3F5F9;
  font: 700 12px/1.2 var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sim-transport-group {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.sim-transport-btn {
  height: 28px;
  min-height: 28px;
  padding: 0 7px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #1B1F2C;
  color: #F3F5F9;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 140ms ease, border-color 140ms ease, transform 80ms ease;
}
.sim-transport-btn:hover {
  border-color: var(--ui-accent);
  background: #252b3b;
}
.sim-transport-btn:active {
  transform: translateY(1px);
}
#simBtnSkipChoice {
  background: rgba(232, 73, 47, 0.22);
  border-color: rgba(255, 92, 64, 0.56);
  color: #ffd5cc;
  font-weight: 700;
  padding: 0 8px;
}
#simBtnSkipChoice:hover {
  background: var(--jp-flame);
  border-color: var(--jp-flame);
  color: #ffffff;
}

.titanium-phone {
  position: relative;
  width: 156px;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: 22px;
  padding: 5px;
  background: linear-gradient(155deg, #464c5e 0%, #171a24 44%, #313748 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 14px 32px rgba(0, 0, 0, 0.56);
  flex-shrink: 0;
}
.titanium-phone::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 9px;
  border-radius: 999px;
  background: #050608;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  z-index: 35;
  pointer-events: none;
}
.titanium-phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 17px;
  overflow: hidden;
  background: #050609;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

/* Pass 5 Reachable Interval Bounds Pills (Replaces Raw JSON Dump!) */
.bounds-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
}
.bounds-lbl {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-muted);
  margin-right: 2px;
  white-space: nowrap;
}
.bounds-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  color: var(--fg-primary);
  font: 600 12px/1.35 var(--font-display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Bottom Scrollable Node Inspector */
.node-inspector {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.insp-section {
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  background: var(--bg-subtle);
  overflow: hidden;
}
.insp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-hairline);
  color: var(--fg-primary);
  font-size: 13px;
  font-weight: 700;
  flex-wrap: nowrap;
}
.insp-head > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.insp-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.insp-head-actions .st-btn.sm {
  height: 28px;
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: 7px;
}
.st-btn.accent-soft {
  background: var(--jp-flame-tint);
  border-color: var(--jp-flame-border);
  color: var(--jp-flame);
  font-weight: 700;
}
.st-btn.accent-soft:hover {
  background: var(--jp-flame);
  border-color: var(--jp-flame);
  color: var(--ui-on-accent);
}
.insp-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.insp-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.insp-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.insp-field > label {
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Choice Section Header & Choice Style Picker Elevation */
.insp-section:has(#inspChoiceStyle) {
  border-color: color-mix(in srgb, var(--jp-flame) 36%, var(--border-strong));
  box-shadow: var(--shadow-sm);
}
.insp-section:has(#inspChoiceStyle) > .insp-head {
  background: linear-gradient(90deg, var(--jp-flame-tint) 0%, var(--bg-card) 78%);
  border-bottom-color: color-mix(in srgb, var(--jp-flame) 24%, var(--border-hairline));
}
#inspChoiceStyle {
  min-height: 38px;
  font-weight: 700;
  border-color: var(--jp-flame-border);
  background-color: var(--bg-card);
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--jp-flame) 8%, var(--bg-card)) 0%, var(--bg-card) 100%);
  color: var(--fg-primary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
#inspChoiceStyle:hover {
  border-color: var(--jp-flame);
}
#inspChoicePrompt {
  border-left: 3.5px solid var(--jp-flame);
  background: var(--bg-card);
  font-weight: 600;
}

/* ==========================================================================
   JOYPLUS v4 Elevated Inspector Choice Cards
   Left 4px Semantic Accent Bar · OPT A-H Index Badge · Gate Pill · Hover Lift
   ========================================================================== */
.choice-editor-card,
.opt-card,
.option-item,
.inspector-option-card {
  --opt-bar: var(--choice-free-slate);
  --opt-solid: var(--choice-free-slate);
  --opt-tint: color-mix(in srgb, var(--choice-free-slate) 6%, var(--bg-card));
  --opt-border: color-mix(in srgb, var(--choice-free-slate) 34%, var(--border-strong));
  --opt-border-hover: var(--choice-free-slate);
  position: relative;
  overflow: hidden;
  padding: 12px 13px 13px 17px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--opt-tint) 0%, var(--bg-card) 56%);
  border: 1px solid var(--opt-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition:
    transform 160ms var(--ease-snappy),
    box-shadow 160ms var(--ease-snappy),
    border-color 160ms ease,
    background 160ms ease;
}

/* Left 4px Semantic Accent Bar */
.choice-editor-card::before,
.opt-card::before,
.option-item::before,
.inspector-option-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--opt-bar);
  pointer-events: none;
}

/* Semantic Gate Variants: VIP Gold-Red · Clue Purple · Stat Blue · Ad Green · Free Slate */
.choice-editor-card[data-gate-visual="coins"],
.opt-card[data-gate-visual="coins"],
.inspector-option-card[data-gate-visual="coins"] {
  --opt-bar: var(--choice-vip-bar);
  --opt-solid: var(--choice-vip-gold);
  --opt-tint: color-mix(in srgb, var(--choice-vip-gold) 11%, var(--bg-card));
  --opt-border: color-mix(in srgb, var(--choice-vip-gold) 48%, var(--border-strong));
  --opt-border-hover: var(--choice-vip-red);
}
.choice-editor-card[data-gate-visual="clue"],
.opt-card[data-gate-visual="clue"],
.inspector-option-card[data-gate-visual="clue"] {
  --opt-bar: var(--ui-clue);
  --opt-solid: var(--ui-clue);
  --opt-tint: color-mix(in srgb, var(--ui-clue) 11%, var(--bg-card));
  --opt-border: color-mix(in srgb, var(--ui-clue) 48%, var(--border-strong));
  --opt-border-hover: var(--ui-clue);
}
.choice-editor-card[data-gate-visual="stat_gate"],
.opt-card[data-gate-visual="stat_gate"],
.inspector-option-card[data-gate-visual="stat_gate"] {
  --opt-bar: var(--choice-stat-blue);
  --opt-solid: var(--choice-stat-blue);
  --opt-tint: color-mix(in srgb, var(--choice-stat-blue) 11%, var(--bg-card));
  --opt-border: color-mix(in srgb, var(--choice-stat-blue) 46%, var(--border-strong));
  --opt-border-hover: var(--choice-stat-blue);
}
.choice-editor-card[data-gate-visual="rewarded_ad"],
.opt-card[data-gate-visual="rewarded_ad"],
.inspector-option-card[data-gate-visual="rewarded_ad"] {
  --opt-bar: var(--ui-ad);
  --opt-solid: var(--ui-ad);
  --opt-tint: color-mix(in srgb, var(--ui-ad) 11%, var(--bg-card));
  --opt-border: color-mix(in srgb, var(--ui-ad) 46%, var(--border-strong));
  --opt-border-hover: var(--ui-ad);
}

.choice-editor-card:hover,
.choice-editor-card:focus-within,
.opt-card:hover,
.option-item:hover,
.inspector-option-card:hover {
  transform: translateY(-1.5px);
  border-color: var(--opt-border-hover);
  box-shadow:
    var(--shadow-md),
    0 0 0 1px color-mix(in srgb, var(--opt-solid) 24%, transparent);
}

/* Crisp Header Row with OPT A-H Index Badge & Semantic Gate Pill */
.choice-editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  margin-bottom: 1px;
  border-bottom: 1px dashed color-mix(in srgb, var(--opt-border) 82%, transparent);
}
.choice-editor-card .choice-editor-top .role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 3px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.choice-editor-card .choice-editor-top .role-badge::before {
  content: "OPT";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--opt-bar);
  color: var(--ui-ink-on-bright, #ffffff);
  font: 700 12px/1.25 var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}
.choice-editor-card[data-opt-idx="0"] .choice-editor-top .role-badge::before { content: "OPT A"; }
.choice-editor-card[data-opt-idx="1"] .choice-editor-top .role-badge::before { content: "OPT B"; }
.choice-editor-card[data-opt-idx="2"] .choice-editor-top .role-badge::before { content: "OPT C"; }
.choice-editor-card[data-opt-idx="3"] .choice-editor-top .role-badge::before { content: "OPT D"; }
.choice-editor-card[data-opt-idx="4"] .choice-editor-top .role-badge::before { content: "OPT E"; }
.choice-editor-card[data-opt-idx="5"] .choice-editor-top .role-badge::before { content: "OPT F"; }
.choice-editor-card[data-opt-idx="6"] .choice-editor-top .role-badge::before { content: "OPT G"; }
.choice-editor-card[data-opt-idx="7"] .choice-editor-top .role-badge::before { content: "OPT H"; }

/* Default Fallback Radio Pill */
.choice-editor-top label:has(input[name="inspDefaultOpt"]) {
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--fg-muted) !important;
  font-size: 12px;
  font-weight: 600;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.choice-editor-top label:has(input[name="inspDefaultOpt"]:checked) {
  background: var(--jp-flame-tint);
  border-color: var(--jp-flame-border);
  color: var(--jp-flame) !important;
  font-weight: 700;
}
.choice-editor-top input[name="inspDefaultOpt"] {
  accent-color: var(--jp-flame);
  margin: 0;
}

/* Primary Option Copy & VIP Price Highlight */
.choice-editor-card input[data-opt-field="label_zh"] {
  min-height: 38px;
  font-size: 13.5px;
  font-weight: 700;
  background: var(--bg-card);
  border-color: color-mix(in srgb, var(--opt-solid) 38%, var(--border-strong));
}
.choice-editor-card input[data-opt-field="coins"] {
  font-weight: 800;
  color: var(--choice-vip-gold);
  border-color: color-mix(in srgb, var(--choice-vip-gold) 52%, var(--border-strong));
  background: color-mix(in srgb, var(--choice-vip-gold) 8%, var(--bg-card));
}

/* 3-Column Stat Delta Pills inside Choice Card */
.choice-editor-card .insp-field:has(input[data-opt-delta]) {
  padding: 5px 7px 6px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  gap: 3px;
}
.choice-editor-card input[data-opt-delta] {
  min-height: 30px;
  height: 30px;
  padding: 0 6px;
  text-align: center;
  font-weight: 700;
  background: var(--bg-card);
}

.choice-opt-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.opt-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 26px;
  min-height: 26px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--fg-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 80ms ease;
}
.opt-mini-btn[data-jump-opt-target] {
  background: var(--jp-flame-tint);
  border-color: var(--jp-flame-border);
  color: var(--jp-flame);
  font-weight: 700;
}
.opt-mini-btn:hover:not(:disabled) {
  background: var(--bg-elevated);
  border-color: var(--jp-flame-border);
  color: var(--fg-primary);
}
.opt-mini-btn[data-jump-opt-target]:hover:not(:disabled) {
  background: var(--jp-flame);
  border-color: var(--jp-flame);
  color: var(--ui-on-accent, #ffffff);
}
.opt-mini-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.opt-mini-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.opt-mini-btn.danger {
  border-color: var(--branch-bad-border);
  color: var(--status-danger);
}
.opt-mini-btn.danger:hover:not(:disabled) {
  background: var(--status-danger-bg);
}

/* Media Trim Sub-Clip Fine Control Box */
.insp-trim-box {
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.insp-trim-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-primary);
}
.insp-trim-dur-pill {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--jp-flame-tint);
  border: 1px solid var(--jp-flame-border);
  color: var(--jp-flame);
  font: 700 12px/1.35 var(--font-display);
  font-variant-numeric: tabular-nums;
}
.insp-trim-picks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.insp-trim-picks button {
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 7px;
}

/* v2.0 Inspector Sub-Cards: Verdict Seal Deck & Death Echo Audio Console */
.insp-verdict-box,
.insp-echo-box {
  padding: 10px 11px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--branch-vip-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.insp-echo-box {
  border-color: var(--branch-bad-border);
  background: linear-gradient(180deg, var(--branch-bad-bg), var(--bg-card) 58%);
}
.insp-subbox-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--fg-primary);
}
.insp-subbox-hd small {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}

/* Collapsible Advanced Fold in Node Inspector (<details class="insp-adv-fold">) */
.insp-adv-fold {
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 140ms ease;
}
.insp-adv-fold[open] {
  border-color: var(--border-strong);
}
.insp-adv-fold > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: background 140ms ease, color 140ms ease;
}
.insp-adv-fold > summary::-webkit-details-marker {
  display: none;
}
.insp-adv-fold > summary::after {
  content: "▸";
  font-size: 12px;
  line-height: 1;
  color: var(--fg-muted);
  flex-shrink: 0;
  transition: transform 150ms var(--ease-snappy), color 140ms ease;
}
.insp-adv-fold[open] > summary {
  border-bottom: 1px solid var(--border-hairline);
  color: var(--fg-primary);
}
.insp-adv-fold[open] > summary::after {
  transform: rotate(90deg);
  color: var(--jp-flame);
}
.insp-adv-fold > summary:hover {
  background: var(--bg-elevated);
  color: var(--fg-primary);
}
.insp-adv-fold-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.insp-adv-fold > .insp-field,
.insp-adv-fold > .insp-grid-2,
.insp-adv-fold > .insp-trim-box,
.insp-adv-fold > .insp-verdict-box,
.insp-adv-fold > .insp-echo-box {
  margin: 9px 10px;
}

/* --------------------------------------------------------------------------
   7. VIEW 4: PLAYABLE AD WORKSHOP (Clean 3-Way Overlay Switch & Budget Card)
   -------------------------------------------------------------------------- */
.playable-workbench {
  display: grid;
  grid-template-columns: minmax(276px, 1fr) 334px minmax(276px, 1fr);
  gap: 16px;
  align-items: stretch;
}

/* Compact 2x2 Playable Export Target Grid */
.playable-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.playable-targets .target-option-card {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--fg-primary);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.playable-targets .target-option-card:hover {
  border-color: var(--jp-flame-border);
  background: var(--bg-elevated);
}
.playable-targets .target-option-card.is-active {
  border-color: var(--jp-flame);
  background: var(--jp-flame-tint);
  box-shadow: var(--jp-focus-ring);
}
.playable-targets .target-option-card strong {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg-primary);
  line-height: 1.25;
}
.playable-targets .target-option-card span,
.playable-targets .target-option-card small {
  font-size: 12px;
  line-height: 1.32;
  color: var(--fg-muted);
}
.playable-targets .target-option-card code {
  font-family: var(--font-mono);
  font-size: 12px;
}
@media (max-width: 480px) {
  .playable-targets {
    grid-template-columns: minmax(0, 1fr);
  }
}

.playable-stage-card {
  padding: 14px 16px;
  border-radius: var(--r-panel);
  background:
    radial-gradient(circle at 50% 24%, rgba(232, 73, 47, 0.15) 0%, rgba(22, 22, 24, 0) 64%),
    linear-gradient(180deg, #1a1a1d 0%, #121214 100%);
  border: 1px solid var(--border-hairline);
  color: #f7f5f2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.playable-stage-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
  flex-wrap: wrap;
}
#playablePreviewModeLabel {
  display: inline-flex;
  align-items: center;
  height: 24px;
  max-width: 156px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f3f5f9;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playable-overlay-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.playable-overlay-switch button {
  height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9CA6BA;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.playable-overlay-switch button:hover {
  color: #FFFFFF;
}
.playable-overlay-switch button.active {
  background: var(--jp-flame);
  color: var(--ui-on-accent);
}

.playable-phone {
  position: relative;
  width: min(296px, 100%);
  aspect-ratio: 9 / 16;
  border-radius: 30px;
  padding: 8px;
  background: linear-gradient(155deg, #3C4150 0%, #151821 48%, #2C313F 100%);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.playable-phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 22px;
  overflow: hidden;
  background: #050609;
}

/* Ad Network Native HUD Simulation */
.ad-hud-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 42;
}
.ad-hud-right-rail {
  position: absolute;
  right: 10px;
  bottom: 88px;
  width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.ad-hud-icon-pill {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  font-size: 13px;
  display: grid;
  place-items: center;
}
.ad-hud-bottom-caption {
  position: absolute;
  left: 12px;
  right: 58px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
}
.ad-hud-cta-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--jp-flame);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* Safe-Zone Occlusion Warning Hatch (Clean, Zero Vertical Text Clutter) */
.safe-zone-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 43;
}
.safe-zone-block {
  position: absolute;
  background: repeating-linear-gradient(
    -45deg,
    rgba(240, 68, 56, 0.24) 0px,
    rgba(240, 68, 56, 0.24) 8px,
    rgba(240, 68, 56, 0.08) 8px,
    rgba(240, 68, 56, 0.08) 16px
  );
  border: 1px dashed rgba(255, 133, 125, 0.8);
  color: #FFD6D4;
  font: 700 12px/1.3 var(--font-sans);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 4px 8px;
}

/* Package Budget Card (Single-Baseline Readout & Non-Wrapping Legend) */
.budget-card {
  padding: 18px;
  border-radius: var(--r-panel);
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-sm), var(--rim-specular);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.budget-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}
.budget-readout b {
  font: 800 26px/1.1 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--fg-primary);
  white-space: nowrap;
}
.budget-readout span {
  font: 600 12px/1.2 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
  white-space: nowrap;
}
.budget-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
  gap: 2px;
}
.budget-bar > i {
  height: 100%;
  transition: width 280ms var(--ease-snappy);
}
.budget-bar > i.seg-video { background: var(--jp-flame); }
.budget-bar > i.seg-engine { background: var(--branch-free); }
.budget-bar > i.seg-sfx { background: var(--branch-ad); }
.budget-bar.is-over > i { background: var(--status-danger); }

.budget-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--fg-muted);
}
.budget-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.playable-dl-row {
  display: flex;
  gap: 8px;
}

.compliance-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  color: var(--fg-secondary);
}
.compliance-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}

/* --------------------------------------------------------------------------
   8. VIEW 5: MONTE CARLO 10,000-PLAYER FUNNEL, SANDBOX & TELEMETRY MATRIX
   -------------------------------------------------------------------------- */
.mc-sandbox-bar {
  padding: 14px 18px;
  border-radius: var(--r-panel);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm), var(--rim-specular);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mc-sandbox-bar.is-modified {
  border-color: var(--jp-flame-border);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--jp-flame-border);
}
.mc-sandbox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.mc-sandbox-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--fg-primary);
}
.mc-sandbox-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(240px, 1.35fr) auto auto;
  align-items: end;
  gap: 14px;
}
.mc-sandbox-ctrl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
}
.mc-sandbox-lbl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-secondary);
}
.mc-sandbox-readout {
  font: 700 13px/1.2 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--jp-flame);
  white-space: nowrap;
}
.mc-sandbox-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mc-sandbox-slider-row input[type="range"] {
  flex: 1;
  min-width: 90px;
  accent-color: var(--jp-flame);
  cursor: pointer;
}
.mc-sandbox-num-input {
  width: 78px !important;
  height: 30px;
  min-height: 30px !important;
  padding: 0 8px !important;
  font-size: 12.5px !important;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mc-scale-marks {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.mc-scale-marks button {
  padding: 1px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--fg-muted);
  font: 600 12px/1.3 var(--font-sans);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.mc-scale-marks button:hover,
.mc-scale-marks button.is-active {
  background: var(--jp-flame-tint);
  color: var(--jp-flame);
  font-weight: 700;
}

.mc-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.mc-kpi-card {
  padding: 16px 18px;
  border-radius: var(--r-panel);
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-sm), var(--rim-specular);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.mc-kpi-label {
  color: var(--fg-muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.mc-kpi-value {
  color: var(--fg-primary);
  font: 700 32px/1.1 var(--font-display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mc-kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--status-ok-bg);
  color: var(--status-ok);
  font: 700 12px/1.35 var(--font-display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-kpi-delta.is-down {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}
.mc-kpi-delta.is-neutral {
  background: var(--status-wait-bg);
  color: var(--fg-muted);
}

.mc-charts-row {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(0, 1fr);
  gap: 16px;
}

.mc-panel {
  padding: 18px 20px;
  border-radius: var(--r-panel);
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-sm), var(--rim-specular);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.mc-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.mc-panel-head h2 {
  margin: 0;
  color: var(--fg-primary);
  font-size: 16px;
  font-weight: 800;
}

/* Precision 3-Column Waterfall Rows (No Clipped Text Inside Bars!) */
.funnel-waterfall {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wf-row {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr) 156px;
  align-items: center;
  gap: 14px;
  height: 34px;
  font-size: 13px;
}
.wf-stage-name {
  color: var(--fg-secondary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-row.is-total .wf-stage-name {
  color: var(--fg-primary);
  font-weight: 800;
}
.wf-track {
  height: 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
  display: flex;
}
.wf-seg {
  height: 100%;
  border-radius: 999px;
  transition: width 480ms var(--spring-cinema);
}
.wf-seg.spine  { background: var(--jp-flame); }
.wf-seg.free   { background: var(--fg-muted); }
.wf-seg.lift   { background: var(--branch-free); }
.wf-seg.vip    { background: var(--branch-vip); }
.wf-seg.gift   { background: var(--branch-clue); }
.wf-seg.rewind { background: color-mix(in srgb, var(--branch-vip) 72%, var(--jp-flame)); }
.wf-seg.ad     { background: var(--branch-ad); }

.wf-count {
  text-align: right;
  font: 700 13px/1.2 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--fg-primary);
  white-space: nowrap;
}
.wf-row.is-total .wf-count {
  color: var(--jp-flame);
  font-weight: 800;
}

/* Ending Distribution Single-Line Cards (Full Title Readable, Zero Orphan Slot) */
.ending-dist-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid var(--border-hairline);
}
#view-simulator .view-actions .st-select,
#view-simulator .view-actions .st-btn {
  height: 36px;
  min-height: 36px;
}
#mcPersonasStrip {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}
.heat-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  font-size: 12.5px;
  color: var(--fg-muted);
}
.ending-dist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  cursor: pointer;
  min-width: 0;
  transition: border-color 140ms ease;
}
.ending-dist-item:hover {
  border-color: var(--jp-flame);
}
.ending-dist-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}
.ending-dist-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ending-dist-pct {
  font: 700 13px/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--fg-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Node Heat & Paid Unlock Conversion Matrix Table */
.heat-table-wrap {
  overflow-x: auto;
  border-radius: var(--r-panel);
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
}
.heat-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.heat-matrix-table th {
  padding: 11px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-hairline);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}
.heat-matrix-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-hairline);
  color: var(--fg-secondary);
  font-size: 13px;
  vertical-align: middle;
}
.heat-matrix-table tr:last-child td {
  border-bottom: 0;
}
.heat-matrix-table tbody tr:hover td {
  background: var(--bg-subtle);
}
.split-mini-bar {
  display: flex;
  width: 132px;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
  gap: 1px;
}
.split-mini-bar > i {
  height: 100%;
}

/* --------------------------------------------------------------------------
   9. @CONTAINER WORKSPACE & RESPONSIVE BREAKPOINTS (零竖排1字1行 · 零灰色横滚条)
   -------------------------------------------------------------------------- */
.view-head {
  flex-wrap: wrap;
  gap: 14px 20px;
}
.view-head > div:first-child {
  flex: 1 1 280px;
  min-width: 0;
}
.studio-toolbar::-webkit-scrollbar,
.atlas-top-row::-webkit-scrollbar,
.heat-table-wrap::-webkit-scrollbar {
  height: 5px;
}

@media (max-width: 1380px) {
  .studio-toolbar {
    height: auto;
    min-height: 48px;
    flex-wrap: wrap;
    padding: 6px 12px;
    row-gap: 6px;
  }
  .toolbar-left,
  .toolbar-center,
  .toolbar-right {
    flex-wrap: wrap;
  }
}

@media (max-width: 1320px) {
  .studio-panes {
    grid-template-columns: 232px 5px minmax(0, 1fr) 5px 326px;
  }
  .titanium-phone {
    width: 146px;
  }
  .playable-workbench {
    grid-template-columns: minmax(248px, 1fr) 312px minmax(248px, 1fr);
    gap: 12px;
  }
  .mc-sandbox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container workspace (max-width: 1180px) {
  .studio-panes {
    grid-template-columns: 224px 5px minmax(0, 1fr) 5px 320px;
  }
  .studio-toolbar {
    padding: 0 10px;
    gap: 6px;
  }
  .toolbar-left .st-select {
    width: 158px;
  }
  .toolbar-left .genre-theme-select {
    min-width: 102px;
    max-width: 128px;
  }
  .choice-editor-card {
    padding: 10px 10px 11px 14px;
  }
  .opt-mini-btn {
    padding: 0 6px;
  }
  .playable-workbench {
    grid-template-columns: minmax(236px, 1fr) 304px minmax(236px, 1fr);
    gap: 12px;
  }
  .mc-sandbox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container workspace (max-width: 1120px) {
  .studio-toolbar {
    height: auto;
    min-height: 48px;
    flex-wrap: wrap;
    padding: 6px 12px;
    row-gap: 6px;
  }
  .toolbar-left,
  .toolbar-center,
  .toolbar-right {
    flex-wrap: wrap;
  }
}

@container workspace (max-width: 1060px) {
  .atlas-top-row {
    flex-wrap: wrap;
  }
  .studio-panes {
    grid-template-columns: 204px 4px minmax(0, 1fr) 4px 302px;
  }
  .studio-panes.is-left-collapsed {
    grid-template-columns: 0px 0px minmax(0, 1fr) 4px 314px !important;
  }
  .toolbar-left .st-select {
    width: 138px;
  }
  .toolbar-left .genre-theme-select {
    min-width: 88px;
    max-width: 110px;
    padding: 0 7px;
  }
  .autosave-pill {
    display: none;
  }
  .studio-toolbar .st-btn.sm {
    padding: 0 9px;
    font-size: 12px;
  }
}

@container workspace (max-width: 960px) {
  .playable-workbench {
    grid-template-columns: minmax(0, 1fr);
  }
}

@container workspace (max-width: 900px) {
  .pipeline-conveyor,
  .pipeline-bar,
  .kpi-strip,
  .mc-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-strip .kpi-tile {
    border-bottom: 1px solid var(--border-hairline);
  }
  .kpi-strip .kpi-tile:nth-child(2n) {
    border-right: 0;
  }
  .kpi-strip .kpi-tile:nth-last-child(-n+2) {
    border-bottom: 0;
  }
  .project-shelf.drama-grid,
  .drama-grid,
  .playable-workbench,
  .mc-charts-row,
  .mc-sandbox-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .atlas-top-row,
  .atlas-sub-row {
    flex-wrap: wrap;
  }
  .studio-toolbar {
    height: auto;
    min-height: 48px;
    flex-wrap: wrap;
    padding: 6px 12px;
  }
  .toolbar-left,
  .toolbar-center,
  .toolbar-right {
    flex-wrap: wrap;
  }
}

@media (max-width: 1020px) {
  .pipeline-conveyor,
  .pipeline-bar,
  .kpi-strip,
  .mc-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-strip .kpi-tile {
    border-bottom: 1px solid var(--border-hairline);
  }
  .kpi-strip .kpi-tile:nth-child(2n) {
    border-right: 0;
  }
  .kpi-strip .kpi-tile:nth-last-child(-n+2) {
    border-bottom: 0;
  }
  .drama-grid,
  .playable-workbench,
  .mc-charts-row,
  .mc-sandbox-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .studio-shell,
  .studio-shell.is-rail,
  .studio-shell[data-rail="true"] {
    grid-template-columns: minmax(0, 1fr);
  }
  .studio-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: var(--z-topbar, 45);
    height: var(--mobile-topbar-h);
    padding: 0 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-hairline);
  }
  .studio-mobile-bar .brand-logo-light,
  .studio-mobile-bar .brand-logo-dark {
    width: 116px;
  }
  .studio-sidebar {
    display: none;
  }
  .studio-sidebar.is-open,
  .studio-sidebar.open {
    display: flex;
    position: fixed;
    top: var(--mobile-topbar-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100dvh - var(--mobile-topbar-h));
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: var(--z-drawer, 52);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-backdrop.is-open {
    display: block;
    position: fixed;
    inset: var(--mobile-topbar-h) 0 0 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: var(--z-drawer-backdrop, 48);
  }

  .view-container {
    width: calc(100% - 32px);
    padding: 20px 0 56px;
  }

  .studio-workbench,
  .dag-studio {
    height: calc(100dvh - var(--mobile-topbar-h));
    grid-template-rows: minmax(var(--studio-topbar-h), auto) auto minmax(0, 1fr);
  }
  .studio-mobile-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 6px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-hairline);
  }
  /* Mobile topbar already shows a primary 剧场 button; avoid duplicate button in wrapped studio toolbar */
  #btnStudioFullTheater {
    display: none;
  }
  .studio-panes {
    grid-template-columns: minmax(0, 1fr);
  }
  .studio-gutter {
    display: none !important;
  }
  .studio-panes[data-mobile-pane="canvas"] .pane-left,
  .studio-panes[data-mobile-pane="canvas"] .pane-right {
    display: none;
  }
  .studio-panes[data-mobile-pane="left"] .dag-canvas-wrap,
  .studio-panes[data-mobile-pane="left"] .pane-right {
    display: none;
  }
  .studio-panes[data-mobile-pane="right"] .pane-left,
  .studio-panes[data-mobile-pane="right"] .dag-canvas-wrap {
    display: none;
  }
}

@media (max-width: 560px) {
  .view-container {
    width: calc(100% - 24px);
    gap: 16px;
  }
  .view-head h1 {
    font-size: 22px;
  }
  .view-actions {
    flex-wrap: wrap;
  }
  .pipeline-conveyor,
  .pipeline-bar,
  .kpi-strip,
  .mc-kpi-grid,
  .ending-dist-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .atlas-view {
    width: calc(100% - 20px);
  }
  .atlas-toolbar-left,
  .atlas-toolbar-right {
    flex-wrap: wrap;
    width: 100%;
  }
  .atlas-project-select {
    min-width: 0;
    width: 100%;
    max-width: none;
  }
  .atlas-section-kicker small {
    display: none;
  }
  .atlas-canvas-stage {
    height: 68dvh;
    min-height: 440px;
  }
  .wf-row {
    grid-template-columns: 92px minmax(0, 1fr) 72px;
    gap: 8px;
    height: auto;
    min-height: 32px;
  }
  .wf-count {
    font-size: 12px;
  }
}

/* Canonical Toast Z-Index Layer (Toast 180 > Cmd+K 150 > Modal 100) */
body .toast-dock,
.toast-dock {
  z-index: var(--z-toast, 180);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* Hide native scrollbars inside 9:16 simulator screens & auto-hide simulated TikTok Ad HUD during interactions/endings */
#playablePhoneScreen *,
#studioPhoneScreen * {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#playablePhoneScreen *::-webkit-scrollbar,
#studioPhoneScreen *::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

#playablePhoneScreen:has(.ivd-qte-root.is-interactive) #playableAdHud,
#playablePhoneScreen:has(.ivd-player.has-choices) #playableAdHud,
#playablePhoneScreen:has(.ivd-player.has-interaction) #playableAdHud,
#playablePhoneScreen:has(.ivd-player.is-ending) #playableAdHud,
#playablePhoneScreen:has(.ivd-player.is-bad-end) #playableAdHud,
#playablePhoneScreen:has(.ivd-cinema-modal-wrap) #playableAdHud,
#playablePhoneScreen:has(.ending-settlement) #playableAdHud,
#playablePhoneScreen:has(.bad-end-overlay) #playableAdHud {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 140ms ease;
}


/* Clean 9:16 Simulator Screens: Hide Cheer Dock & Avoid Subtitle Collision Under Native Feed HUD */
#studioPhoneScreen .ivd-cheer-dock,
#playablePhoneScreen .ivd-cheer-dock {
  display: none !important;
}
#playablePhoneScreen:has(#playableAdHud:not([hidden])) .cinema-subtitle,
#playablePhoneScreen:has(#playableAdHud:not([hidden])) .ivd-subtitle-wrap,
#playablePhoneScreen:has(#playableAdHud:not([hidden])) .ivd-subtitles {
  padding-right: 54px !important;
  bottom: 92px !important;
}
.st-select {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* ==========================================================================
   STUDIO 2.0 PRO UPGRADES (Stornaway.io × Arcweave × Figma Weave × CapCut)
   ========================================================================== */
.studio-panes {
  transition: grid-template-columns 180ms var(--ease-snappy);
}
.studio-panes.is-left-collapsed {
  grid-template-columns: 0px 0px minmax(0, 1fr) 5px 352px !important;
}
.studio-panes.is-left-collapsed #studioGutterLeft {
  pointer-events: none;
  opacity: 0;
}
.studio-panes.is-left-collapsed .pane-left {
  opacity: 0;
  pointer-events: none;
  border-right-width: 0;
}
#btnToggleLeftPane.active {
  background: var(--jp-flame-tint);
  color: var(--jp-flame);
  border-color: var(--jp-flame-border);
}

/* Arcweave / CapCut Smart Spine Outline + Filter + Quick Dock */
.spine-pane-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.spine-filter-bar {
  padding: 8px 10px 7px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.spine-search-input {
  height: 30px !important;
  min-height: 30px !important;
  font-size: 12px !important;
  padding: 0 9px !important;
}
.spine-filter-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}
.spine-filter-chips button {
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font: 600 12px/1 var(--font-sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.spine-filter-chips button:hover {
  color: var(--fg-primary);
  border-color: var(--border-strong);
}
.spine-filter-chips button.active {
  background: var(--jp-flame-tint);
  border-color: var(--jp-flame-border);
  color: var(--jp-flame);
  font-weight: 700;
}
.spine-act-divider {
  margin: 6px 2px 2px;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--fg-muted);
  font: 700 12px/1.3 var(--font-sans);
  letter-spacing: 0.02em;
}
.spine-act-divider:first-child {
  margin-top: 0;
}
.spine-quick-dock {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  flex-shrink: 0;
}
.spine-quick-dock .st-btn.sm {
  height: 30px;
  min-height: 30px;
  font-size: 12px;
  padding: 0 8px;
}

/* CapCut / Eko Visual Interactive Scrubber & Collapsible Phone Monitor */
.sim-dock.is-collapsed .titanium-phone {
  display: none;
}
.sim-timeline-dock {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 2px;
}
.sim-timeline-track {
  position: relative;
  width: 100%;
  height: 16px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: visible;
  cursor: ew-resize;
}
.sim-timeline-trim {
  position: absolute;
  top: 1px;
  bottom: 1px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(232, 73, 47, 0.36), rgba(255, 138, 76, 0.24));
  border-left: 2px solid #ff6b4a;
  border-right: 2px solid #ff6b4a;
  pointer-events: none;
}
.sim-timeline-trigger {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  background: #fbbf24;
  border: 1.5px solid #0b0d14;
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.72);
  pointer-events: none;
  z-index: 3;
}
.sim-timeline-playhead {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: #ffffff;
  border-radius: 2px;
  transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.65);
  pointer-events: none;
  z-index: 4;
}
.sim-timeline-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.sim-timeline-range {
  font-size: 12px;
  font-weight: 600;
  color: #9da8be;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sim-timeline-snaps {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.sim-snap-btn {
  height: 22px;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #dce3f0;
  font: 600 12px/1 var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.sim-snap-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}
.sim-snap-btn.is-trigger {
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.38);
  background: rgba(251, 191, 36, 0.12);
}
.sim-snap-btn.is-trigger:hover {
  background: rgba(251, 191, 36, 0.24);
}

/* Figma / Stornaway Tabbed + Accordion Node Inspector */
.insp-node-banner {
  padding: 10px 11px 9px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.insp-node-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.insp-node-code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-elevated);
  color: var(--fg-primary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.insp-node-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.insp-banner-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.insp-banner-actions .st-btn.sm {
  height: 29px;
  min-height: 29px;
  font-size: 12px;
  padding: 0 8px;
}
.insp-seg-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
}
.insp-seg-tabs button {
  height: 28px;
  padding: 0 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-muted);
  font: 600 12px/1 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.insp-seg-tabs button:hover {
  color: var(--fg-primary);
}
.insp-seg-tabs button.is-active {
  background: var(--bg-card);
  color: var(--fg-primary);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* Visual Choice Style Quick-Picker Grid */
.insp-style-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.insp-style-pill {
  height: 28px;
  padding: 0 5px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--fg-secondary);
  font: 600 12px/1 var(--font-sans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.insp-style-pill:hover {
  border-color: var(--jp-flame-border);
  color: var(--fg-primary);
}
.insp-style-pill.is-active {
  background: var(--jp-flame-tint);
  border-color: var(--jp-flame);
  color: var(--jp-flame);
  font-weight: 700;
}

/* Accordion Option Cards */
.choice-editor-card.is-collapsed {
  padding: 0 0 0 4px !important;
  gap: 0 !important;
}
.choice-editor-card.is-expanded {
  padding: 0 0 11px 4px !important;
  gap: 0 !important;
}
.insp-acc-summary {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--fg-primary);
  text-align: left;
  cursor: pointer;
}
.insp-acc-summary:hover {
  background: color-mix(in srgb, var(--opt-solid) 6%, transparent);
}
.insp-acc-letter {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--opt-bar);
  color: var(--ui-ink-on-bright, #ffffff);
  font: 800 12px/1 var(--font-display);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.insp-acc-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.insp-acc-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.insp-acc-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.insp-acc-chev {
  font-size: 12px;
  color: var(--fg-muted);
  flex-shrink: 0;
}
.insp-acc-body {
  padding: 8px 11px 2px;
  border-top: 1px dashed color-mix(in srgb, var(--opt-border) 70%, transparent);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* Tab 3 Causal Link Rows */
.insp-causal-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 140ms ease, transform 120ms ease;
}
.insp-causal-item:hover {
  border-color: var(--jp-flame);
  transform: translateY(-1px);
}

/* ==========================================================================
   JOYPLUS v6 PRO PLUGINS (Lucide Icons · ECharts · Split-Grid · Ctrl+K)
   ========================================================================== */

/* Lucide Inline Monochrome Engineering Icon Sizing */
.lucide {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.spine-filter-chips button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.spine-filter-chips button .lucide {
  width: 12.5px;
  height: 12.5px;
}
.spine-quick-dock .st-btn .lucide,
.more-menu-item .lucide,
.mc-sandbox-bar .lucide {
  width: 14px;
  height: 14px;
}

/* Sidebar Quick Search Trigger (Linear / LTX Studio Ctrl+K) */
.sidebar-cmdk-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  margin-bottom: 14px;
  border-radius: 9px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font: 600 12.5px/1 var(--font-sans);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.sidebar-cmdk-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--jp-flame-border);
  color: var(--fg-primary);
}
.sidebar-cmdk-ico {
  width: 14px !important;
  height: 14px !important;
  color: var(--fg-muted);
}
.sidebar-cmdk-btn:hover .sidebar-cmdk-ico {
  color: var(--jp-flame);
}
.sidebar-cmdk-label {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-cmdk-kbd {
  font: 700 12px/1 var(--font-mono);
  padding: 3px 5px;
  border-radius: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  color: var(--fg-muted);
  flex-shrink: 0;
}
.studio-shell[data-rail="true"] .sidebar-cmdk-btn,
.studio-shell.is-rail .sidebar-cmdk-btn {
  width: 40px;
  height: 38px;
  padding: 0;
  margin: 0 auto 12px;
  justify-content: center;
}
.studio-shell[data-rail="true"] .sidebar-cmdk-label,
.studio-shell[data-rail="true"] .sidebar-cmdk-kbd,
.studio-shell.is-rail .sidebar-cmdk-label,
.studio-shell.is-rail .sidebar-cmdk-kbd {
  display: none;
}

/* Global Ctrl+K Command Palette Modal (Logo-Native #1d1d1d × #e8492f) */
.jp-cmdk-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-cmdk, 150);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 11vh 16px 24px;
  background: rgba(17, 17, 19, 0.54);
  backdrop-filter: blur(6px);
}
.jp-cmdk-dialog {
  width: min(620px, 100%);
  max-height: min(540px, 74vh);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  box-shadow: 0 28px 64px rgba(17, 17, 19, 0.34), 0 0 0 1px rgba(232, 73, 47, 0.12);
  overflow: hidden;
}
.jp-cmdk-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-hairline);
}
.jp-cmdk-head:focus-within {
  box-shadow: inset 0 -2px 0 var(--jp-flame);
}
.jp-cmdk-search-ico {
  width: 17px !important;
  height: 17px !important;
  color: var(--jp-flame);
}
.jp-cmdk-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 2px solid transparent;
  background: transparent;
  color: var(--fg-primary);
  font: 600 14.5px/1.3 var(--font-sans);
}
.jp-cmdk-input::placeholder {
  color: var(--fg-muted);
  font-weight: 500;
}
.jp-cmdk-kbd {
  font: 700 12px/1 var(--font-mono);
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  color: var(--fg-muted);
}
.jp-cmdk-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.jp-cmdk-group {
  padding: 8px 10px 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}
.jp-cmdk-item {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--fg-primary);
  text-align: left;
  cursor: pointer;
  transition: background 100ms ease, border-color 100ms ease;
}
.jp-cmdk-item:hover,
.jp-cmdk-item.is-active {
  background: var(--sel-bg);
  border-color: var(--jp-flame-border);
}
.jp-cmdk-item-ico {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  color: var(--fg-muted);
}
.jp-cmdk-item.is-active .jp-cmdk-item-ico {
  background: var(--jp-flame-tint);
  color: var(--jp-flame);
}
.jp-cmdk-item-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.jp-cmdk-item-copy strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jp-cmdk-item-copy small {
  font-size: 12px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jp-cmdk-item-tag {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--fg-muted);
  white-space: nowrap;
}
.jp-cmdk-item.is-active .jp-cmdk-item-tag {
  background: var(--jp-flame);
  color: #ffffff;
}
.jp-cmdk-empty {
  padding: 28px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-muted);
}
.jp-cmdk-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  font-size: 12px;
  color: var(--fg-muted);
}
.jp-cmdk-hints {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.jp-cmdk-hints kbd {
  font: 700 12px/1 var(--font-mono);
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  margin: 0 2px;
}

/* ECharts Simulator Ending Ring + Jump List Split */
.mc-ending-split {
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border-hairline);
}
.mc-ending-ring-host {
  width: 152px;
  height: 152px;
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .mc-ending-split {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }
}

/* ==========================================================================
   INTERACTIVE UI 3.0 STUDIO AUTHORING (6 Wireframe Cards + 24 QTE Gallery)
   ========================================================================== */
.insp-head-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.insp-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.insp-head-actions .st-btn.sm {
  height: 28px;
  min-height: 28px;
  padding: 0 7px;
  font-size: 12px;
  gap: 4px;
}
.insp-head-title .lucide {
  width: 14px;
  height: 14px;
  color: var(--jp-flame);
}
.insp-style-grid.is-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.insp-style-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 6px 6px;
  border-radius: 9px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  color: var(--fg-secondary);
  font: 600 12px/1.15 var(--font-sans);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 120ms ease;
}
.insp-style-card:hover {
  border-color: var(--jp-flame-border);
  color: var(--fg-primary);
  transform: translateY(-1px);
}
.insp-style-card.is-active {
  background: var(--jp-flame-tint);
  border-color: var(--jp-flame);
  color: var(--jp-flame);
  font-weight: 700;
}
.insp-style-svg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 24px;
  border-radius: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  color: var(--fg-muted);
}
.insp-style-card.is-active .insp-style-svg {
  background: rgba(232, 73, 47, 0.12);
  border-color: var(--jp-flame-border);
  color: var(--jp-flame);
}
.insp-style-svg svg {
  width: 32px;
  height: 22px;
  display: block;
}

.insp-qte-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.insp-qte-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  color: var(--fg-secondary);
  font: 600 12px/1 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease, color 130ms ease;
}
.insp-qte-chip .lucide {
  width: 12.5px;
  height: 12.5px;
}
.insp-qte-chip:hover {
  border-color: var(--jp-flame-border);
  color: var(--fg-primary);
}
.insp-qte-chip.is-active {
  background: var(--jp-flame);
  border-color: var(--jp-flame);
  color: #ffffff;
  font-weight: 700;
}

/* Interactive UI 3.0 Gallery Modal (30 Cinema UI Components) */
.jp-uigallery-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-cmdk, 150);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 17, 19, 0.58);
  backdrop-filter: blur(7px);
}
.jp-uigallery-dialog {
  width: min(940px, 100%);
  max-height: min(760px, 86vh);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 72px rgba(17, 17, 19, 0.38);
  overflow: hidden;
}
.jp-uigallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-hairline);
}
.jp-uigallery-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
.jp-uigallery-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--fg-primary);
}
.jp-uigallery-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
}
.jp-uigallery-tabs button {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
  color: var(--fg-secondary);
  font: 600 12px/1 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
}
.jp-uigallery-tabs button:hover {
  border-color: var(--jp-flame-border);
  color: var(--fg-primary);
}
.jp-uigallery-tabs button.is-active {
  background: var(--jp-flame);
  border-color: var(--jp-flame);
  color: #ffffff;
  font-weight: 700;
}
.jp-uigallery-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}
@media (max-width: 780px) {
  .jp-uigallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.jp-uig-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  color: var(--fg-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.jp-uig-card:hover {
  background: var(--bg-card);
  border-color: var(--jp-flame);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.jp-uig-card.is-active {
  background: var(--sel-bg);
  border-color: var(--jp-flame);
  box-shadow: 0 0 0 1px var(--jp-flame);
}
.jp-uig-card-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.jp-uig-ico {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  color: var(--jp-flame);
}
.jp-uig-badge {
  padding: 2px 7px;
  border-radius: 999px;
  font: 700 12px/1.3 var(--font-mono);
}
.jp-uig-badge.is-choice {
  background: var(--branch-free-bg);
  color: var(--branch-free-text);
}
.jp-uig-badge.is-qte {
  background: var(--jp-flame-tint);
  color: var(--jp-flame);
}
.jp-uig-card strong {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--fg-primary);
  line-height: 1.25;
}
.jp-uig-en {
  font: 600 12px/1.2 var(--font-mono);
  color: var(--fg-muted);
}
.jp-uig-card p {
  margin: 2px 0 4px;
  font-size: 12px;
  line-height: 1.42;
  color: var(--fg-secondary);
  flex: 1;
}
.jp-uig-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--jp-flame);
}
.jp-uig-cta .lucide {
  width: 12px;
  height: 12px;
}
