/* ══════════════════════════════════════════════
   BLOCKS.CSS — Styles for editor UI + content blocks
   ══════════════════════════════════════════════ */

/* ── SLIDE MANAGER PANEL ── */
.slide-manager-panel {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: 240px; z-index: 190;
  background: #ffffff;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  display: none; flex-direction: column;
  overflow: hidden;
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.06);
}
.slide-manager-panel.open { display: flex; }

/*
 * Panel push is handled dynamically by the panel resize system in deck-engine.js.
 * It sets inline styles on slides, wrapper padding, nav elements.
 * No static CSS rules needed — JS manages all dimensions.
 */

/* ── Panel resize handles (draggable separators) ── */
.panel-resize-handle {
  position: fixed; top: 0; bottom: 0;
  width: 6px; cursor: col-resize; z-index: 196;
  background: transparent;
  transition: background 0.15s;
}
.panel-resize-handle:hover,
.panel-resize-handle.dragging {
  background: var(--teal);
  opacity: 0.4;
}
.panel-resize-handle.left {
  /* Positioned dynamically by JS at the right edge of slide manager */
}
.panel-resize-handle.right {
  /* Positioned dynamically by JS at the left edge of chat panel */
}

/* Brand row at top of slide panel */
.sm-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 10px;
}
.sm-brand-link {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: rgba(255,255,255,0.7);
  font-family: 'Sora', sans-serif; font-size: 14px; font-weight: 600;
  letter-spacing: -0.01em; transition: color 0.15s;
}
.sm-brand-link:hover { color: var(--teal); }
.sm-panel-close {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  background: none; border: none;
  color: rgba(255,255,255,0.35); cursor: pointer; transition: all 0.15s;
}
.sm-panel-close:hover { color: var(--teal); background: rgba(0,229,204,0.08); }
body.light-mode .sm-brand-link { color: #333; }
body.light-mode .sm-brand-link:hover { color: #008577; }
body.light-mode .sm-panel-close { color: #adadad; }
body.light-mode .sm-panel-close:hover { color: #008577; background: rgba(0,133,119,0.06); }
body.light-mode .slide-manager-panel {
  background: #ffffff;
  border-right-color: rgba(15, 23, 42, 0.08);
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.06);
}

/* ── Deck title input ──
   Sits between the Ocuport brand row and the "Slides" section header.
   Borderless, uses the site's primary font (Sora) so it harmonises with
   the dashboard hero + nav typography. Empty placeholder reads
   "Untitled presentation". Wired in slide-manager.js to call
   window.setDeckTitle() on input. (Rainy 2026-05-29.) */
.sm-deck-title-wrap {
  padding: 6px 12px 10px;
}
.sm-deck-title-input {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  margin: 0;
  font-family: 'Sora', 'Manrope', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.88);
  outline: none;
  transition: background 0.15s, border-color 0.15s;
}
.sm-deck-title-input::placeholder {
  color: rgba(255, 255, 255, 0.32);
  font-weight: 500;
}
.sm-deck-title-input:hover {
  background: rgba(255, 255, 255, 0.04);
}
.sm-deck-title-input:focus {
  background: rgba(0, 229, 204, 0.06);
  border-color: rgba(0, 229, 204, 0.3);
}
body.light-mode .sm-deck-title-input {
  color: #232323;
}
body.light-mode .sm-deck-title-input::placeholder {
  color: rgba(35, 35, 35, 0.42);
}
body.light-mode .sm-deck-title-input:hover {
  background: rgba(0, 0, 0, 0.03);
}
body.light-mode .sm-deck-title-input:focus {
  background: rgba(0, 133, 119, 0.05);
  border-color: rgba(0, 133, 119, 0.28);
}

.sm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; border-bottom: 1px solid rgba(0,229,204,0.1);
}
/* "Slides" section label — site-wide Sora to harmonize with the deck
   title input + dashboard typography (was 'DM Mono' uppercase 10px,
   which looked like a leftover from an earlier design — Rainy
   2026-05-29 "和全站统一一下"). */
.sm-title {
  font-family: 'Sora', 'Manrope', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray);
}
.sm-actions { display: flex; gap: 6px; }
.sm-btn {
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(0,229,204,0.08);
  border: 1px solid rgba(0,229,204,0.2);
  color: var(--teal); font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.sm-btn:hover {
  background: rgba(0,229,204,0.15);
  border-color: var(--teal);
}

.sm-thumbs {
  flex: 1; overflow-y: auto;
  padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
}

.sm-thumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  position: relative;
}
.sm-thumb:hover { background: rgba(0,229,204,0.05); }
.sm-thumb.active {
  background: rgba(0,229,204,0.08);
  border-color: rgba(0,229,204,0.25);
}
.sm-thumb.dragging { opacity: 0.4; }
.sm-thumb.drag-over { border-color: var(--teal); background: rgba(0,229,204,0.1); }

/* Slide thumbnail preview */
.sm-thumb-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.08);
  order: -1;
  /* Container-query based sizing so the 1920×1080 slide inside auto-scales
     to fill the preview width — eliminates the JS rAF timing gap that used
     to leave a right-edge whitespace strip when the sidebar resized. */
  container-type: inline-size;
}
.sm-thumb-preview > .slide,
.sm-thumb-preview > section.slide,
/* Extra-specific selector below to outweigh deck-engine.css's
   `.slide[data-template="broadside"][class*="slide--"] { width: 100% !important }`
   (specificity 0,3,1) which would otherwise win and collapse thumbs. */
.sm-thumb-preview > .slide[data-template][class*="slide--"],
.sm-thumb-preview > section.slide[data-template][class*="slide--"] {
  transform-origin: top left;
  width: 1920px !important;
  height: 1080px !important;
  max-height: none !important;
  padding: 0 !important;
  pointer-events: none;
  overflow: hidden;
  /* Make the slide its own size container so children's cq* units
     (used by signal/clean-light/etc for inner padding like
     `5.5cqh 7.5cqw`) resolve to the 1920×1080 design canvas instead of
     the tiny preview width — without this signal inner padding becomes
     ~19×44 instead of ~144×60 and content glues to the slide edge. */
  container-type: size;
  /* CSS-driven scale to fit container width exactly (no JS needed).
     `1920px` (WITH unit) is mandatory — `calc(length / unitless)` resolves
     to a length, which scale() silently rejects, leaving the thumb at raw
     1920×1080 and overflowing into nothing visible. */
  transform: scale(calc(100cqw / 1920px));
}
/* New Blank Deck slides carry `data-flavor="blank"`, which globally
   triggers `container-type: size` + a `clip-path: inset(...)` using
   `cqw/cqh` to paint a card-on-backdrop visual in the main editor view.
   Inside a thumbnail, `cqw/cqh` resolve against the surrounding
   `.sm-thumb-preview` (~200px wide instead of viewport-sized), so the
   inset values become huge relative to the 1920×1080 slide — the
   clip-path ends up cropping each slide to a tiny ~190×107 rectangle
   near the center. That's why blank-deck thumbnails appeared blank for
   "Content" / "Thank you" and showed only the middle slice ("ION" out
   of "My Presentation") for the cover slide. Reset everything that
   flavor adds, so thumbnails render the full 1920×1080 design. */
.sm-thumb-preview > .slide[data-flavor="blank"],
.sm-thumb-preview > section.slide[data-flavor="blank"] {
  /* Do NOT reset container-type — JsonRenderer sets it to inline-size
     in renderSlide() so text uses cqw font units that scale with the
     1920px design canvas. Resetting to `normal` killed cqw resolution
     in sidebar thumbs: fonts fell through to the px fallback (max()
     2nd term, 200px → 25px) and rendered ~2.4 visual px after the
     transform: scale(0.0953) → invisible in the thumb. Affected every
     SVG-import deck (samples/*-figma/deck.json all carry
     meta.flavor='blank' so this selector matched them in sidebar).
     (Rainy 2026-06-16: "preview不对啊" — retro-modern thumbnails
     showed micro-text instead of "Presentation Title" cover.) */
  clip-path: none !important;
  filter: none !important;
}
/* Force all objects visible in thumbnails (skip entrance animations) */
.sm-thumb-preview .anim-pending {
  opacity: 1 !important;
}
body.light-mode .sm-thumb-preview {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
}

.sm-thumb-num {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--teal);
  min-width: 20px; text-align: center;
}
.sm-thumb-label {
  font-size: 12px; color: var(--gray-light);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Collapse button */
.sm-collapse {
  position: absolute; right: -16px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 48px;
  background: rgba(13,30,53,0.97);
  border: 1px solid rgba(0,229,204,0.15);
  border-left: none;
  border-radius: 0 6px 6px 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray); font-size: 16px;
  cursor: pointer; z-index: 191;
  transition: all 0.15s;
}
.sm-collapse:hover {
  color: var(--teal);
  background: rgba(0,229,204,0.05);
}

/* Editable label */
.sm-thumb-label[contenteditable="true"] {
  outline: 1px solid rgba(0,229,204,0.4);
  outline-offset: 1px;
  border-radius: 3px;
  background: rgba(0,229,204,0.04);
  cursor: text;
}

/* ── FORMAT TOOLBAR ── */
.format-toolbar {
  position: fixed; z-index: 195;
  display: flex; align-items: center; gap: 3px;
  padding: 6px 8px;
  background: rgba(13,30,53,0.97);
  border: 1px solid rgba(0,229,204,0.2);
  border-radius: 14px;
  backdrop-filter: blur(20px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
/* Object mode hides the text-only controls; the shared object controls stay. */
.format-toolbar.mode-object .fmt-text-only { display: none !important; }

.fmt-btn {
  min-width: 32px; height: 32px;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--gray-light); font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: 3px; padding: 0 7px;
  transition: background 0.15s, color 0.15s;
  font-family: 'Sora', sans-serif;
}
.fmt-btn:hover { background: rgba(0,229,204,0.1); color: var(--teal); }
.fmt-btn.active { background: rgba(0,229,204,0.16); color: var(--teal); }
.fmt-btn svg { width: 16px; height: 16px; }
.fmt-btn.fmt-lbl { font-size: 13px; padding: 0 10px; min-width: 0; }
/* AI Replace — icon + label, subtle teal accent so it reads as an
   AI-flavoured action (parallels the AI rewrite pill on text mode). */
.fmt-btn.fmt-ai-replace-btn {
  gap: 6px; padding: 0 10px; font-size: 12px; font-weight: 600;
  color: var(--teal, #00e5cc);
}
.fmt-btn.fmt-ai-replace-btn svg { width: 14px; height: 14px; }
.fmt-btn.fmt-ai-replace-btn:hover { background: rgba(0,229,204,0.12); }
body.light-mode .fmt-btn.fmt-ai-replace-btn { color: #008577; }
body.light-mode .fmt-btn.fmt-ai-replace-btn:hover { background: rgba(0,133,119,0.10); }

.fmt-sep {
  width: 1px; height: 22px;
  background: rgba(255,255,255,0.12);
  margin: 0 3px;
}

/* Text-color button: an "A" with a colored underline bar reflecting the
   current text color. Clicking opens the hidden native color input. */
.fmt-color-btn { position: relative; flex-direction: column; gap: 0; line-height: 1; padding: 3px 7px; }
.fmt-color-a { font-size: 13px; font-weight: 600; }
.fmt-color-bar { width: 14px; height: 2.5px; border-radius: 2px; margin-top: 0; background: var(--teal); }
.fmt-color-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; bottom: 0; left: 50%; border: none; padding: 0; }

/* Font-size stepper pill:  −  [34]  +  */
.fmt-size-stepper {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px; height: 32px; padding: 0 2px;
}
.fmt-step {
  width: 26px; height: 28px; background: transparent; border: none; border-radius: 999px;
  color: var(--gray-light); font-size: 16px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-family: 'Sora', sans-serif;
}
.fmt-step:hover { background: rgba(0,229,204,0.14); color: var(--teal); }
.fmt-size-input {
  width: 34px; height: 28px; background: transparent; border: none;
  color: var(--gray-light); font-size: 13px; text-align: center; -moz-appearance: textfield;
  font-family: 'Sora', sans-serif;
}
.fmt-size-input::-webkit-outer-spin-button,
.fmt-size-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fmt-size-input:focus { outline: none; }

/* ── CONTENT BLOCKS (shared) ── */
.content-block {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}
.content-block[data-block-type="zoomable-image"] {
  border: 1px solid rgba(0,229,204,0.1);
  cursor: grab;
}
.content-block[data-block-type="zoomable-image"]:active {
  cursor: grabbing;
}

/* Zoomable image minimap */
.block-minimap {
  position: absolute; bottom: 8px; right: 8px;
  width: 80px; height: 60px;
  border: 1px solid rgba(0,229,204,0.3);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 5;
}
.block-minimap img {
  width: 100%; height: 100%; object-fit: contain;
}
.mm-viewport {
  position: absolute;
  border: 1px solid var(--teal);
  background: rgba(0,229,204,0.1);
}

/* ── DATA TABLE BLOCK ── */
.content-block[data-block-type="data-table"] table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.content-block[data-block-type="data-table"] th {
  text-align: left; padding: 8px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.05em;
  color: var(--teal); border-bottom: 1px solid rgba(0,229,204,0.2);
  background: rgba(0,229,204,0.03);
  user-select: none;
}
.content-block[data-block-type="data-table"] td {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--gray-light);
}
.content-block[data-block-type="data-table"] tr:hover td {
  background: rgba(0,229,204,0.03);
}
.content-block[data-block-type="data-table"] tr.highlighted td {
  background: rgba(0,229,204,0.08);
  color: var(--white);
}

.table-filter {
  margin-bottom: 8px;
}
.table-filter input {
  width: 100%; padding: 6px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--gray-light); font-size: 13px;
  font-family: 'Sora', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.table-filter input:focus {
  border-color: rgba(0,229,204,0.4);
}
.table-filter input::placeholder {
  color: rgba(255,255,255,0.2);
}

.table-pager {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-top: 8px; padding: 8px 0;
}
.pager-btn {
  padding: 4px 12px; border-radius: 6px;
  background: rgba(0,229,204,0.08);
  border: 1px solid rgba(0,229,204,0.2);
  color: var(--teal); font-size: 12px;
  cursor: pointer; transition: all 0.15s;
  font-family: 'DM Mono', monospace;
}
.pager-btn:hover:not(:disabled) {
  background: rgba(0,229,204,0.15);
}
.pager-btn:disabled {
  opacity: 0.3; cursor: default;
}
.pager-info {
  font-family: 'DM Mono', monospace;
  font-size: 12px; color: var(--gray);
}

/* ── PARAM SLIDER BLOCK ── */
.param-slider-container {
  padding: 12px 16px;
  background: rgba(0,229,204,0.03);
  border: 1px solid rgba(0,229,204,0.1);
  border-radius: 8px;
}
.param-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.1em;
  color: var(--gray); margin-bottom: 8px;
  display: block;
}
.param-controls {
  display: flex; align-items: center; gap: 12px;
}
.param-controls input[type="range"] {
  flex: 1; accent-color: var(--teal);
}
.param-value {
  font-family: 'DM Mono', monospace;
  font-size: 14px; color: var(--teal);
  min-width: 60px; text-align: right;
}

/* ── STAT CARD BLOCK — Dark Glass design system ── */
/* `.stat-card-inner` = JSON-path DOM, `.stat-card` = HTML-path DOM
   (generated by html_gen_prompt). Style both identically so the
   Biostate Dark look is consistent across generation paths. */
.stat-card-inner,
.stat-card {
  padding: 24px 20px; text-align: left;
  background: linear-gradient(160deg, #232a3a 0%, #1a1f2e 100%);
  border: 1px solid rgba(120,200,180,0.18);
  border-radius: 16px;
  height: 100%;
  position: relative;
  overflow: hidden;
}
/* Glass top-edge shine — design system spec */
.stat-card-inner::before,
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(100,220,180,0.38), transparent);
  pointer-events: none;
}
/* Inner ambient glow */
.stat-card-inner::after,
.stat-card::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(61,214,163,0.05), transparent);
  pointer-events: none;
}
/* When parent has gradient fill, make inner bg transparent to show through */
body:not(.light-mode) .deck-object[data-has-fill="true"] .stat-card-inner,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-card-inner {
  background: transparent;
  border-color: transparent;
}
.stat-card-inner.purple,
.stat-card.purple {
  background: linear-gradient(160deg, #25203a 0%, #1a1f2e 100%);
  border-color: rgba(167,139,250,0.30);
}
.stat-card-inner.purple::after,
.stat-card.purple::after {
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(167,139,250,0.08), transparent);
}
.stat-value {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 44px; font-weight: 600;
  color: #3dd6a3; line-height: 1;
  margin-bottom: 12px;
  letter-spacing: -1px;
}
.stat-card-inner.purple .stat-value,
.stat-card.purple .stat-value { color: #a78bfa; }
.stat-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px; font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  line-height: 1;
  color: #e8f0f8;
  display: block;
  margin-bottom: 4px;
}
.stat-desc {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px; font-weight: 400;
  line-height: 1.55;
  color: #7a9bb5;
}
.stat-bar {
  margin-top: 16px;
  height: 3px;
  border-radius: 2px;
  background: rgba(120,200,180,0.18);
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--teal), #7eb8f0);
}
.stat-card-inner.purple .stat-bar-fill,
.stat-card.purple .stat-bar-fill {
  background: linear-gradient(90deg, var(--purple), #c4b5fd);
}
.stat-delta {
  font-family: 'DM Mono', monospace;
  font-size: 12px; margin-top: 4px;
}
.stat-delta.positive { color: #22c55e; }
.stat-delta.negative { color: #ef4444; }

/* ── CLEAN LIGHT: Stat Card overrides ── */
/* Scoped via [data-theme-mode="light"] or body.light-mode */
body.light-mode .stat-card-inner,
[data-theme-mode="light"] .stat-card-inner {
  background: #FFFFFF;
  border: 1px solid #D4E4EF;
  border-radius: 10px;
  padding: 20px 16px 16px;
}
/* Light-mode stat card color overrides (top bar removed per design) */
body.light-mode .stat-card-inner.teal .stat-value,
[data-theme-mode="light"] .stat-card-inner.teal .stat-value {
  color: #1BC9C1;
}
/* Blue variant */
body.light-mode .stat-card-inner.blue .stat-value,
[data-theme-mode="light"] .stat-card-inner.blue .stat-value {
  color: #7FB3D9;
}
body.light-mode .stat-card-inner.purple,
[data-theme-mode="light"] .stat-card-inner.purple {
  background: #FFFFFF;
  border-color: #D4E4EF;
}
body.light-mode .stat-card-inner.purple .stat-value,
[data-theme-mode="light"] .stat-card-inner.purple .stat-value {
  color: #9B93D4;
}
/* Clean Light stat fonts */
body.light-mode .stat-value,
[data-theme-mode="light"] .stat-value {
  font-family: 'DM Sans', sans-serif;
  font-size: 44px; font-weight: 500;
  letter-spacing: -2px;
}
body.light-mode .stat-label,
[data-theme-mode="light"] .stat-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px; font-weight: 500;
  color: #2E3A5C;
}
/* Stat bar — Clean Light style */
body.light-mode .stat-bar,
[data-theme-mode="light"] .stat-bar {
  background: #E8F0F5;
}
body.light-mode .stat-card-inner.teal .stat-bar-fill,
[data-theme-mode="light"] .stat-card-inner.teal .stat-bar-fill {
  background: linear-gradient(90deg, #1BC9C1, #7FB3D9);
}
body.light-mode .stat-card-inner.blue .stat-bar-fill,
[data-theme-mode="light"] .stat-card-inner.blue .stat-bar-fill {
  background: linear-gradient(90deg, #7FB3D9, #9B93D4);
}
body.light-mode .stat-card-inner.purple .stat-bar-fill,
[data-theme-mode="light"] .stat-card-inner.purple .stat-bar-fill {
  background: linear-gradient(90deg, #9B93D4, #C4B5FD);
}

/* ── COMPARISON BLOCK ── */
.comparison-container {
  display: flex; position: relative;
  border: 1px solid rgba(0,229,204,0.1);
  border-radius: 8px;
  overflow: hidden;
}
.comparison-left, .comparison-right {
  overflow: hidden; position: relative;
}
.comparison-slider {
  position: absolute; top: 0; bottom: 0;
  width: 4px; left: 50%;
  background: var(--teal);
  cursor: col-resize; z-index: 5;
}
.comparison-slider::after {
  content: ''; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 20px; height: 40px;
  background: var(--teal); border-radius: 10px;
  opacity: 0.5;
}
.comparison-label {
  position: absolute; top: 8px; left: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.1em;
  color: var(--teal); background: rgba(6,13,26,0.7);
  padding: 2px 8px; border-radius: 4px; z-index: 4;
}

/* ── GATING HIERARCHY BLOCK ── */
.gating-tree {
  padding: 12px;
}
.gate-node {
  display: flex; align-items: center;
  padding: 4px 0;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 4px;
}
.gate-node:hover { background: rgba(0,229,204,0.04); }
.gate-connector {
  border-left: 1px dashed rgba(0,229,204,0.2);
  height: 100%;
}
.gate-content {
  display: flex; align-items: center; gap: 8px;
  flex: 1;
}
.gate-dot {
  width: 8px; height: 8px;
  background: var(--teal); border-radius: 50%;
  flex-shrink: 0;
}
.gate-name {
  font-size: 13px; color: var(--white);
  font-weight: 500;
}
.gate-pct {
  font-family: 'DM Mono', monospace;
  font-size: 12px; color: var(--teal);
}
.gate-count {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--gray);
}

/* ── ANNOTATION LAYER ── */
.annotation-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 10;
}

/* ── DRAG-DROP ZONE ── */
.slide.drop-target {
  outline: 3px dashed var(--teal) !important;
  outline-offset: -8px;
  background: rgba(0,229,204,0.03) !important;
}
.slide.drop-target::after {
  content: 'Drop media here';
  position: absolute; bottom: 100px; left: 50%;
  transform: translateX(-50%);
  font-family: 'DM Mono', monospace;
  font-size: 13px; letter-spacing: 0.1em;
  color: var(--teal); opacity: 0.6;
  background: rgba(6,13,26,0.7);
  padding: 8px 20px; border-radius: 8px;
  z-index: 10; pointer-events: none;
}

/* ── AUDIO PLAYER BLOCK ── */
.audio-player-container {
  padding: 16px; border-radius: 10px;
  background: rgba(0,229,204,0.03);
  border: 1px solid rgba(0,229,204,0.1);
}
.audio-filename {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--gray);
  margin-bottom: 8px; letter-spacing: 0.05em;
}
.audio-waveform {
  width: 100%; height: 60px;
  border-radius: 6px; margin-bottom: 8px;
  background: rgba(0,0,0,0.15);
}
.audio-controls {
  display: flex; align-items: center; gap: 10px;
}
.audio-play-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal); border: none;
  color: var(--navy); font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.audio-play-btn:hover { opacity: 0.85; transform: scale(1.08); }
.audio-scrubber {
  flex: 1; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.08);
  cursor: pointer; position: relative;
}
.audio-progress {
  height: 100%; border-radius: 2px;
  background: var(--teal); width: 0%;
  transition: width 0.1s;
}
.audio-time {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--gray);
  min-width: 80px; text-align: right;
}

/* ── VIDEO PLAYER BLOCK ── */
.video-player-container {
  position: relative; border-radius: 8px; overflow: hidden;
}
.video-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3);
  transition: opacity 0.2s;
}
.video-overlay.playing { opacity: 0; pointer-events: none; }
.video-play-btn {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(0,229,204,0.9); border: none;
  color: var(--navy); font-size: 24px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(0,229,204,0.3);
}
.video-play-btn:hover { transform: scale(1.1); }

/* ── PDF VIEWER BLOCK ── */
.pdf-viewer-container {
  border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(0,229,204,0.1);
}
.pdf-filename {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--gray);
  padding: 8px 12px; letter-spacing: 0.05em;
  background: rgba(0,229,204,0.03);
  border-bottom: 1px solid rgba(0,229,204,0.08);
}

/* ── INSERTED TEXT BOX ── */
.inserted-text-box:focus-within {
  border-color: rgba(0,229,204,0.4);
  background: rgba(0,229,204,0.05);
}

/* ── AI DESIGNER CHAT PANEL ── */
.chat-panel {
  position: fixed; right: 0; top: 60px; bottom: 0;
  width: 340px; z-index: 195;
  background: rgba(13,30,53,0.97);
  border-left: 1px solid rgba(0,229,204,0.15);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.3);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.chat-panel.open { transform: translateX(0); }

.chat-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,229,204,0.1);
}
.chat-title {
  font-family: 'Sora', -apple-system, sans-serif;
  font-size: 13px; font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--gray-light); flex-shrink: 0;
}
.chat-model-select {
  flex: 1; min-width: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--gray-light); font-size: 11px;
  padding: 4px 6px;
  font-family: 'Manrope', -apple-system, sans-serif;
  outline: none; cursor: pointer;
}
.chat-model-select:focus { border-color: rgba(0,229,204,0.3); }
.chat-close {
  width: 28px; height: 28px; border: none;
  background: transparent; color: var(--gray);
  font-size: 18px; cursor: pointer; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.chat-close:hover { background: rgba(255,255,255,0.06); color: var(--white); }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}

.chat-msg { display: flex; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-assistant { justify-content: flex-start; }
.chat-msg-system { justify-content: center; }

.chat-bubble {
  max-width: 86%; padding: 9px 13px;
  border-radius: 14px;
  font-family: 'Manrope', -apple-system, sans-serif;
  font-size: 13px; line-height: 1.5;
  word-wrap: break-word;
  letter-spacing: -0.005em;
}
.chat-msg-user .chat-bubble {
  background: var(--teal); color: var(--navy);
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.chat-msg-assistant .chat-bubble {
  background: rgba(255,255,255,0.06);
  color: var(--gray-light);
  border-bottom-left-radius: 4px;
}
.chat-msg-system .chat-bubble {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.6);
  font-size: 11.5px; font-style: italic;
  border-radius: 8px;
}

/* ── Applied-toast — inline confirmation after AI auto-applies ──
   Replaces the old Apply/Try Again/Reject bar. Single horizontal
   row: check icon + "N changes applied" + Undo button. Calm teal
   palette to match the deck toolbar / sidebar. (Rainy 2026-05-26:
   "chatbot 都不好看, 字体和下面 btn 不符合设计主题".) */
.chat-applied {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0, 229, 204, 0.08);
  border: 1px solid rgba(0, 229, 204, 0.22);
  font: 500 12px/1.2 'Manrope', -apple-system, sans-serif;
  color: var(--gray-light);
  flex-wrap: wrap;
}
.chat-applied.is-undone {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.10);
  opacity: 0.7;
}
.chat-applied.has-errors {
  background: rgba(255,168,82,0.08);
  border-color: rgba(255,168,82,0.30);
}
.chat-applied-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(0, 229, 204, 0.22);
  color: #00e5cc;
  flex-shrink: 0;
}
.chat-applied.has-errors .chat-applied-icon {
  background: rgba(255,168,82,0.20); color: #ffa852;
}
.chat-applied.is-undone .chat-applied-icon {
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.55);
}
.chat-applied-text {
  flex: 1; min-width: 0;
  color: var(--gray-light);
}
.chat-applied-undo {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(0,229,204,0.30);
  background: transparent;
  color: #00e5cc;
  font: 500 11px/1 'Manrope', -apple-system, sans-serif;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.chat-applied-undo:hover { background: rgba(0,229,204,0.12); }
.chat-applied-undo:disabled {
  border-color: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.4);
  cursor: default; background: transparent;
}
.chat-applied-err {
  width: 100%;
  padding-top: 4px;
  font-size: 10.5px;
  color: rgba(255,168,82,0.85);
  font-style: italic;
}

/* Hint row — neutral inline info (used when AI didn't propose changes
   or returned non-JSON). Replaces the noisy yellow-italic system bubble. */
.chat-hint {
  display: flex; align-items: flex-start;
  gap: 8px;
  margin: 2px 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  font: 400 11.5px/1.5 'Manrope', -apple-system, sans-serif;
  color: rgba(255,255,255,0.62);
}
.chat-hint-icon {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: rgba(0,229,204,0.65);
  margin-top: 1px;
}

/* Light-mode overrides for applied + hint */
body.light-mode .chat-applied {
  background: rgba(0,133,119,0.07);
  border-color: rgba(0,133,119,0.22);
  color: #1f2937;
}
body.light-mode .chat-applied-icon {
  background: rgba(0,133,119,0.20);
  color: #008577;
}
body.light-mode .chat-applied-text { color: #1f2937; }
body.light-mode .chat-applied-undo {
  border-color: rgba(0,133,119,0.30);
  color: #008577;
}
body.light-mode .chat-applied-undo:hover { background: rgba(0,133,119,0.10); }
body.light-mode .chat-hint {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.06);
  color: #6b7280;
}
body.light-mode .chat-hint-icon { color: #008577; }

/* ── AI Designer message typography ──
   Assistant prose is rendered from Markdown-lite (chat-panel.js
   renderMarkdownLite). Readable rhythm: paragraph spacing, indented
   lists with breathing room, teal bold for emphasis/option names,
   compact headings. (Rainy 2026-07-10 — "回复全是一大段,混杂很多
   符号,方案 A/B 看不清".) */
.chat-msg-assistant .chat-bubble { line-height: 1.62; font-size: 13.5px; }
.chat-bubble p { margin: 0 0 10px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul, .chat-bubble ol { margin: 6px 0 12px; padding-left: 22px; }
.chat-bubble ul:last-child, .chat-bubble ol:last-child { margin-bottom: 0; }
.chat-bubble li { margin: 5px 0; }
.chat-bubble li::marker { color: #00a08f; font-weight: 700; }
.chat-bubble strong { font-weight: 700; color: #00776a; }
.chat-bubble h4 {
  margin: 12px 0 6px; font-size: 13px; font-weight: 800;
  color: #00776a; letter-spacing: 0.01em;
}
.chat-bubble h4:first-child { margin-top: 0; }
.chat-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; background: rgba(0,133,119,0.10);
  padding: 1px 5px; border-radius: 4px;
}
body.dark-mode .chat-bubble strong,
body.dark-mode .chat-bubble h4 { color: #45d0bd; }
body.dark-mode .chat-bubble li::marker { color: #45d0bd; }
body.dark-mode .chat-bubble code { background: rgba(69,208,189,0.15); }

/* ── AI Designer working state — must be unmissable ──
   Sparkle + pulsing teal card + shared AiProgressBar while the model
   streams; the whole input row dims and the panel gets an animated
   top ribbon. (Rainy 2026-07-10 — "很小的…闪,但是很不明显,需要明显
   让用户知道 AI Designer 正在工作".) */
.chat-working-card {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(69,208,189,0.10) 0%, rgba(96,196,212,0.14) 100%);
  border: 1px solid rgba(0,133,119,0.30);
  animation: chatWorkingPulse 2s ease-in-out infinite;
}
.chat-working-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: #008577;
}
.chat-working-icon { display: inline-flex; color: #008577; animation: chatSparkle 2.4s ease-in-out infinite; }
.chat-working-sub { margin-top: 4px; font-size: 12px; color: #5f7a76; }
.chat-working-cancel {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(0,133,119,0.35);
  color: #00776a;
  font-size: 12px; font-weight: 600;
  padding: 3px 12px; border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.chat-working-cancel:hover { background: rgba(0,133,119,0.12); }
body.dark-mode .chat-working-cancel { color: #45d0bd; border-color: rgba(69,208,189,0.4); }
body.dark-mode .chat-working-cancel:hover { background: rgba(69,208,189,0.15); }
.chat-working-progress { margin-top: 10px; }
.chat-working-progress:empty { display: none; }
.chat-streaming .chat-stream-bubble { margin-top: 10px; background: transparent; border: 0; padding: 0; color: inherit; }
@keyframes chatWorkingPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,133,119,0.28); }
  50%      { box-shadow: 0 0 0 8px rgba(0,133,119,0.06); }
}
@keyframes chatSparkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50%      { transform: scale(1.25) rotate(18deg); opacity: 0.75; }
}
/* Panel-level state: animated top ribbon + dimmed input row.
   NOTE: .chat-panel is already position:fixed (right-docked, line ~823)
   — that anchors the ::before fine. An earlier `.chat-panel
   { position: relative }` here overrode fixed and yanked the whole
   panel out of its dock ("怎么你把位置都给我改了", Rainy 2026-07-10).
   Never redeclare position on it. */
.chat-panel--working::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #45d0bd, #60c4d4, #a78bfa, #45d0bd);
  background-size: 220% 100%;
  animation: chatRibbon 1.6s linear infinite;
  z-index: 3;
  border-radius: 3px 3px 0 0;
}
@keyframes chatRibbon { 0% { background-position: 0% 0; } 100% { background-position: 220% 0; } }
.chat-panel--working .chat-input-form { opacity: 0.55; }
.chat-panel--working .chat-send-btn { pointer-events: none; }
body.dark-mode .chat-working-card { background: linear-gradient(135deg, rgba(69,208,189,0.12) 0%, rgba(96,196,212,0.10) 100%); }
body.dark-mode .chat-working-sub { color: #8fb5b0; }

/* Streaming dots */
.chat-dots span {
  animation: chatDot 1.2s infinite;
  opacity: 0;
}
.chat-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatDot {
  0%, 60% { opacity: 0; }
  30% { opacity: 1; }
}

/* ── AI Designer empty-state welcome (compact) ──
   Fits in the panel without scrolling. 3 intent groups (text/style/
   add) × 2 chip each, laid out horizontally so a group occupies a
   single row. Tips collapsed into one hint line at the bottom. */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  padding: 18px 16px 12px;
  color: rgba(255, 255, 255, 0.65);
  flex: 1;
  min-height: 0;
}
.chat-empty-title {
  font-family: 'Sora', sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}
.chat-empty-sub {
  font-size: 11.5px;
  line-height: 1.4;
  margin-bottom: 14px;
  color: rgba(255, 255, 255, 0.5);
}

/* Vertical chip list — icon + label, like the original v1 layout
   (Rainy preferred this over the horizontal pill version). */
.chat-empty-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.chat-empty-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(0, 229, 204, 0.06);
  border: 1px solid rgba(0, 229, 204, 0.16);
  color: rgba(255, 255, 255, 0.88);
  font: 500 12.5px/1.4 'Manrope', sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.chat-empty-chip:hover {
  background: rgba(0, 229, 204, 0.13);
  border-color: rgba(0, 229, 204, 0.32);
  transform: translateX(2px);
}
.chat-empty-chip:active { transform: translateX(0); }
.chat-empty-chip-icon {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: rgba(0, 229, 204, 0.85);
}
.chat-empty-chip-icon svg { width: 16px; height: 16px; }
.chat-empty-chip-label { flex: 1; }

/* One-line hint at the bottom */
.chat-empty-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.4);
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}
.chat-empty-hint svg { color: rgba(0, 229, 204, 0.6); flex-shrink: 0; }

/* Light-mode overrides */
body.light-mode .chat-empty-state { color: #6b7280; }
body.light-mode .chat-empty-title { color: #111827; }
body.light-mode .chat-empty-sub { color: #6b7280; }
body.light-mode .chat-empty-chip {
  background: rgba(0, 133, 119, 0.06);
  border-color: rgba(0, 133, 119, 0.18);
  color: #374151;
}
body.light-mode .chat-empty-chip:hover {
  background: rgba(0, 133, 119, 0.12);
  border-color: rgba(0, 133, 119, 0.30);
}
body.light-mode .chat-empty-chip-icon { color: #008577; }
body.light-mode .chat-empty-hint {
  color: #9ca3af;
  border-top-color: rgba(0, 0, 0, 0.06);
}
body.light-mode .chat-empty-hint svg { color: #14b8a6; }

/* (Approval-bar styles removed 2026-05-26 — direct-apply flow has no
   confirmation buttons. Inline `.chat-applied` toast replaces them.) */

/* Input form */
.chat-input-form {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid rgba(0,229,204,0.10);
  background: rgba(0,0,0,0.18);
}
.chat-input {
  flex: 1; padding: 9px 13px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(0,229,204,0.20);
  border-radius: 10px; color: var(--white);
  font: 500 13px/1.4 'Manrope', -apple-system, sans-serif;
  outline: none;
  letter-spacing: -0.005em;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.chat-input:focus {
  border-color: rgba(0,229,204,0.55);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(0,229,204,0.08);
}
.chat-input::placeholder { color: rgba(255,255,255,0.32); }
.chat-input:disabled { opacity: 0.4; }

.chat-send-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--teal); border: none;
  color: var(--navy); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s, transform 0.12s; flex-shrink: 0;
}
.chat-send-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.chat-send-btn:active { transform: translateY(0); }

/* ══════════════════════════════════════════════
   LIGHT MODE OVERRIDES
   ══════════════════════════════════════════════ */
/* Dark mode: override default light panel */
body:not(.light-mode) .slide-manager-panel {
  background: rgba(13,30,53,0.97);
  border-right-color: rgba(0,229,204,0.15);
  box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}
body.light-mode .sm-title { color: #3a4f63; }
body.light-mode .sm-btn { background: rgba(0,133,119,0.08); border-color: rgba(0,133,119,0.2); color: #008577; }
body.light-mode .sm-header { border-bottom-color: rgba(15, 23, 42, 0.08); }
body.light-mode .sm-thumbs { background: #ffffff; }
body.light-mode .sm-thumb:hover { background: rgba(0,133,119,0.04); }
body.light-mode .sm-thumb.active { background: rgba(0,133,119,0.08); border-color: rgba(0,133,119,0.2); }
body.light-mode .sm-thumb-label { color: #1e3347; }
body.light-mode .sm-thumb-num { color: #008577; }
body.light-mode .sm-collapse { background: rgba(245,247,250,0.97); border-color: rgba(0,0,0,0.1); color: #3a4f63; }
body.light-mode .sm-collapse:hover { color: #008577; background: rgba(0,133,119,0.05); }
body.light-mode .panel-resize-handle:hover,
body.light-mode .panel-resize-handle.dragging { background: #008577; }

body.light-mode .format-toolbar {
  background: #ffffff;
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}
body.light-mode .fmt-btn { color: #1e3347; }
body.light-mode .fmt-btn:hover { background: rgba(0,133,119,0.1); color: #008577; }
body.light-mode .fmt-btn.active { background: rgba(0,133,119,0.15); color: #008577; }
body.light-mode .fmt-sep { background: rgba(0,0,0,0.1); }
body.light-mode .fmt-size-stepper,
body.light-mode .fmt-font-btn { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12); color: #1e3347; }
body.light-mode .fmt-size-input,
body.light-mode .fmt-step { color: #1e3347; }
body.light-mode .fmt-step:hover,
body.light-mode .fmt-font-btn:hover { background: rgba(0,133,119,0.1); color: #008577; }
body.light-mode .fmt-popover { background: rgba(255,255,255,0.99); border-color: rgba(0,0,0,0.12); box-shadow: 0 8px 26px rgba(0,0,0,0.14); }
body.light-mode .fmt-pop-item,
body.light-mode .fmt-pop-icobtn,
body.light-mode .fmt-pop-label { color: #1e3347; }
body.light-mode .fmt-pop-item:hover,
body.light-mode .fmt-pop-icobtn:hover { background: rgba(0,133,119,0.1); color: #008577; }

body.light-mode .comparison-label {
  background: rgba(245,247,250,0.7);
  color: #008577;
}
body.light-mode .block-minimap {
  background: rgba(255,255,255,0.7);
  border-color: rgba(0,133,119,0.3);
}
body.light-mode .gate-node:hover { background: rgba(0,133,119,0.04); }

body.light-mode .content-block[data-block-type="data-table"] th {
  color: #008577; border-bottom-color: rgba(0,133,119,0.2);
  background: rgba(0,133,119,0.03);
}
body.light-mode .content-block[data-block-type="data-table"] td {
  border-bottom-color: rgba(0,0,0,0.05);
  color: #1e3347;
}
body.light-mode .table-filter input {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.12);
  color: #1e3347;
}
body.light-mode .param-slider-container {
  background: rgba(0,133,119,0.03);
  border-color: rgba(0,133,119,0.1);
}
body.light-mode .stat-card-inner {
  background: rgba(0,133,119,0.03);
  border-color: rgba(0,133,119,0.1);
}

body.light-mode .slide.drop-target { outline-color: #008577; background: rgba(0,133,119,0.03) !important; }
body.light-mode .slide.drop-target::after { color: #008577; background: rgba(245,247,250,0.8); }
body.light-mode .audio-player-container { background: rgba(0,133,119,0.03); border-color: rgba(0,133,119,0.1); }
body.light-mode .audio-waveform { background: rgba(0,0,0,0.05); }
body.light-mode .audio-scrubber { background: rgba(0,0,0,0.08); }
body.light-mode .pdf-viewer-container { border-color: rgba(0,0,0,0.1); }
body.light-mode .pdf-filename { background: rgba(0,0,0,0.02); border-bottom-color: rgba(0,0,0,0.06); color: #3a4f63; }

body.light-mode .chat-panel {
  background: rgba(245,247,250,0.97);
  border-left-color: rgba(0,0,0,0.1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}
body.light-mode .chat-header { border-bottom-color: rgba(0,0,0,0.08); }
body.light-mode .chat-title { color: #3a4f63; }
body.light-mode .chat-model-select { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.12); color: #1e3347; }
body.light-mode .chat-close { color: #3a4f63; }
body.light-mode .chat-close:hover { background: rgba(0,0,0,0.04); color: #0a1628; }
body.light-mode .chat-msg-user .chat-bubble { background: #008577; color: #fff; }
body.light-mode .chat-msg-assistant .chat-bubble { background: rgba(0,0,0,0.04); color: #1e3347; }
body.light-mode .chat-input-form {
  background: rgba(0,0,0,0.02);
  border-top-color: rgba(0,0,0,0.06);
}
body.light-mode .chat-input {
  background: #ffffff;
  border: 1px solid rgba(0,133,119,0.18);
  color: #1a1a1a;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}
body.light-mode .chat-input:focus {
  background: #ffffff;
  border-color: rgba(0,133,119,0.45);
  box-shadow: 0 0 0 3px rgba(0,133,119,0.08);
}
body.light-mode .chat-input::placeholder { color: rgba(0,0,0,0.30); }
body.light-mode .chat-send-btn { background: #008577; color: #fff; }
body.light-mode .chat-send-btn:hover { background: #006B60; }

/* ── PRINT: hide editor UI ── */
@media print {
  .slide-manager-panel, .format-toolbar, .selection-overlay, .chat-panel, .marquee-box, .shortcuts-overlay { display: none !important; }
  .video-overlay, .audio-controls { display: none !important; }
  .find-replace-overlay, .zoom-indicator, .autosave-indicator, .notes-panel { display: none !important; }
}

/* ── Format Toolbar Extensions ── */
/* Font-family pill — opens the right-side font picker panel */
.fmt-font-btn {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px; height: 32px; padding: 0 8px 0 13px; gap: 6px;
  max-width: 152px; font-size: 13px;
}
.fmt-font-btn .fmt-font-name { max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmt-font-btn .fmt-font-caret { flex: none; opacity: 0.55; width: 13px; height: 13px; }
.fmt-font-btn:hover { background: rgba(255,255,255,0.1); color: var(--teal); }

/* ── Font picker panel (right-side, Canva-style preview list) ── */
.font-picker-panel {
  position: fixed; right: -380px; top: 80px; bottom: 80px; width: 320px; z-index: 198;
  background: rgba(13,30,53,0.95); border: 1px solid rgba(0,229,204,0.18); border-radius: 12px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; flex-direction: column; overflow: visible;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  transition: right 0.25s cubic-bezier(0.16,1,0.3,1), transform 0.22s ease;
  font-family: 'Manrope', 'Sora', sans-serif;
}
.font-picker-panel.open { right: 16px; }
.fp-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.fp-title { font-size: 15px; font-weight: 600; color: var(--gray-light); }
.fp-close { background: transparent; border: none; color: var(--gray-light); font-size: 22px; line-height: 1; cursor: pointer; opacity: .65; padding: 0 4px; }
.fp-close:hover { opacity: 1; color: var(--teal); }
.fp-search { display: flex; align-items: center; gap: 8px; margin: 0 14px 8px; padding: 0 12px; height: 40px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 999px; color: var(--gray-light); }
.fp-search:focus-within { border-color: var(--teal); }
.fp-search svg { flex: none; opacity: .55; }
.fp-search-input { flex: 1; background: transparent; border: none; outline: none; color: var(--gray-light); font-size: 14px; font-family: inherit; min-width: 0; }
.fp-search-input::placeholder { color: rgba(255,255,255,0.4); }
.fp-body { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.fp-section { margin-bottom: 8px; }
.fp-section-title { font-size: 12px; color: var(--gray-light); opacity: .55; padding: 10px 10px 4px; }
.fp-item { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 10px;
  background: transparent; border: none; border-radius: 8px; color: var(--gray-light); padding: 8px 12px;
  cursor: pointer; text-align: left; font-size: 15px; line-height: 1.2; }
.fp-item:hover { background: rgba(0,229,204,0.1); }
.fp-item.active { background: rgba(124,119,221,0.18); }
.fp-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-check { flex: none; color: var(--teal); font-size: 15px; }
.fp-empty { padding: 24px 16px; text-align: center; color: var(--gray-light); opacity: .6; font-size: 13px; }
body.light-mode .font-picker-panel { background: rgba(255,255,255,0.98); border-left-color: rgba(0,0,0,0.08); box-shadow: -4px 0 24px rgba(0,0,0,0.08); }
body.light-mode .fp-title,
body.light-mode .fp-close,
body.light-mode .fp-search,
body.light-mode .fp-search-input,
body.light-mode .fp-section-title,
body.light-mode .fp-item,
body.light-mode .fp-empty { color: #1e3347; }
body.light-mode .fp-search { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12); }
body.light-mode .fp-search-input::placeholder { color: rgba(0,0,0,0.4); }
body.light-mode .fp-item:hover { background: rgba(0,133,119,0.1); }
body.light-mode .fp-item.active { background: rgba(124,119,221,0.14); }

/* ── Text-color picker panel (Canva-style swatches) ── */
.color-picker-panel {
  position: fixed; right: -440px; top: 80px; bottom: 80px; width: 380px; z-index: 198;
  background: rgba(13,30,53,0.95); border: 1px solid rgba(0,229,204,0.18); border-radius: 12px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; flex-direction: column; overflow: visible;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  transition: right 0.25s cubic-bezier(0.16,1,0.3,1), transform 0.22s ease;
  font-family: 'Manrope', 'Sora', sans-serif;
}
.color-picker-panel.open { right: 16px; }
.cp-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.cp-title { font-size: 15px; font-weight: 600; color: var(--gray-light); }
.cp-close { background: transparent; border: none; color: var(--gray-light); font-size: 22px; line-height: 1; cursor: pointer; opacity: .65; padding: 0 4px; }
.cp-close:hover { opacity: 1; color: var(--teal); }
.cp-search { display: flex; align-items: center; gap: 8px; margin: 0 14px 8px; padding: 0 12px; height: 40px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 999px; color: var(--gray-light); }
.cp-search:focus-within { border-color: var(--teal); }
.cp-search svg { flex: none; opacity: .55; }
.cp-search-input { flex: 1; background: transparent; border: none; outline: none; color: var(--gray-light); font-size: 14px; font-family: inherit; min-width: 0; }
.cp-search-input::placeholder { color: rgba(255,255,255,0.4); }
.cp-body { flex: 1; overflow-x: hidden; overflow-y: auto; padding: 4px 14px 16px; }
.cp-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cp-section { margin-bottom: 14px; }
.cp-section-title { font-size: 13px; font-weight: 600; color: var(--gray-light); opacity: .85; padding: 8px 2px 8px; }
.cp-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.cp-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.cp-gradient-grid { grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cp-swatch { width: 36px; height: 36px; box-sizing: border-box; border-radius: 50%; border: 1px solid rgba(255,255,255,0.18);
  cursor: pointer; padding: 0; transition: transform .1s ease; }
/* Grid swatches fill their 1fr cell (square) so palette columns always fit the
   panel width — fixed 36px + gaps overflowed past the right edge. */
.cp-grid .cp-swatch { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.cp-swatch:hover { transform: scale(1.08); }
/* Selection ring stays within the 36px footprint (inset) so a selected recent
   swatch is the SAME visual size as the +/eyedropper icons. (Olivia 2026-06-25) */
.cp-swatch.active { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--purple, #7c77dd); border-color: transparent; }
.cp-tool { width: 36px; height: 36px; box-sizing: border-box; border-radius: 50%; border: 1px solid rgba(0,0,0,0.14);
  background: #fff; color: #1e3347; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.cp-tool:hover { border-color: var(--teal); color: var(--teal); }
/* Custom "+" — white center with a thin rainbow ring + a dark plus (Olivia 2026-06-25) */
.cp-custom { position: relative; overflow: hidden; border: none; background: transparent; }
.cp-wheel { position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 90deg, #ff3b3b, #ff9500, #ffd000, #34d058, #00c4cc, #4263eb, #a23bff, #ff3bd0, #ff3b3b); }
.cp-wheel::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }
.cp-plus { position: relative; z-index: 1; color: #1e3347; font-size: 22px; font-weight: 400; line-height: 1; }
.cp-empty { padding: 24px 16px; text-align: center; color: var(--gray-light); opacity: .6; font-size: 13px; }
body.light-mode .color-picker-panel { background: rgba(255,255,255,0.98); border-left-color: rgba(0,0,0,0.08); box-shadow: -4px 0 24px rgba(0,0,0,0.08); }
body.light-mode .cp-title,
body.light-mode .cp-close,
body.light-mode .cp-search,
body.light-mode .cp-search-input,
body.light-mode .cp-section-title,
body.light-mode .cp-tool,
body.light-mode .cp-empty { color: #1e3347; }
body.light-mode .cp-search { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12); }
body.light-mode .cp-search-input::placeholder { color: rgba(0,0,0,0.4); }
body.light-mode .cp-swatch { border-color: rgba(0,0,0,0.14); }
body.light-mode .cp-tool { background: #fff; border-color: rgba(0,0,0,0.14); }
body.light-mode .cp-custom { background: transparent; }
body.light-mode .cp-swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--purple, #7c77dd); }

/* Custom HSV picker (reached via the "+" tile) */
.cp-custom-view { display: flex; flex-direction: column; }
.cp-back { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start;
  background: transparent; border: none; cursor: pointer; padding: 2px 2px 10px;
  color: var(--gray-light); font-size: 14px; font-family: inherit; opacity: .8; }
.cp-back:hover { opacity: 1; color: var(--teal); }
.cp-sv { position: relative; width: 100%; aspect-ratio: 1 / 0.92; border-radius: 10px;
  cursor: crosshair; touch-action: none; }
/* Inner gradient border: gray (top-left) → transparent (bottom-right), following
   the rounded corners — drawn as a masked ::after ring, not an outer border.
   (Olivia 2026-06-25) */
.cp-sv::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  padding: 1.5px;
  background: linear-gradient(135deg, rgba(0,0,0,0.32), rgba(0,0,0,0) 65%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; }
.cp-sv-handle { position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.4);
  transform: translate(-50%, -50%); pointer-events: none; }
.cp-controls { display: flex; align-items: center; gap: 12px; margin: 16px 0 18px; }
.cp-eyedrop { flex: none; }
.cp-eyedrop-spacer { width: 0; }
.cp-slider-col { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.cp-hue, .cp-alpha { position: relative; height: 14px; border-radius: 999px; cursor: pointer; touch-action: none; }
.cp-hue { background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%); }
.cp-alpha { background-color: #fff;
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 12px 12px; background-position: 0 0, 0 6px, 6px -6px, -6px 0; }
.cp-alpha-fill { position: absolute; inset: 0; border-radius: 999px; }
.cp-hue-handle, .cp-alpha-handle { position: absolute; top: 50%; left: 0; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.35);
  transform: translate(-50%, -50%); pointer-events: none; }
.cp-inputs { display: flex; align-items: center; gap: 8px; }
.cp-fmt { display: inline-flex; align-items: center; height: 38px; padding: 0 12px; border-radius: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); color: var(--gray-light); font-size: 14px; }
.cp-hex-input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-radius: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); color: var(--gray-light);
  font-size: 14px; font-family: inherit; outline: none; text-transform: uppercase; }
.cp-opacity-input { width: 56px; height: 38px; padding: 0 8px; border-radius: 8px; text-align: right;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); color: var(--gray-light);
  font-size: 14px; font-family: inherit; outline: none; }
.cp-hex-input:focus, .cp-opacity-input:focus { border-color: var(--teal); }
.cp-pct { color: var(--gray-light); opacity: .7; font-size: 14px; margin-left: -2px; }
body.light-mode .cp-back,
body.light-mode .cp-fmt,
body.light-mode .cp-hex-input,
body.light-mode .cp-opacity-input,
body.light-mode .cp-pct { color: #1e3347; }
body.light-mode .cp-fmt,
body.light-mode .cp-hex-input,
body.light-mode .cp-opacity-input { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.14); }

/* Custom-view header: Back + solid/gradient toggle (Olivia 2026-06-25) */
.cp-cv-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 14px; }
.cp-mode-toggle { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(128,128,128,0.13); }
.cp-mode { border: none; background: transparent; border-radius: 999px; padding: 5px 14px; cursor: pointer;
  font-size: 13px; color: var(--gray-light); font-family: 'Manrope','Sora',sans-serif; transition: background .15s, box-shadow .15s, color .15s; }
.cp-mode.active { background: #fff; color: #1e3347; box-shadow: 0 1px 3px rgba(0,0,0,0.14); }
body.light-mode .cp-mode { color: #1e3347; }
body.light-mode .cp-mode-toggle { background: rgba(0,0,0,0.05); }

/* Gradient editor (图四) — two colour-stop bars + reverse + angle dial.
   Dashboard-style soft UI. (Olivia 2026-06-25) */
.cp-g2 { display: flex; flex-direction: column; gap: 10px; padding: 2px 0 4px; }
/* Fit the whole gradient editor on one page (no scroll) at any reasonable panel
   height: the custom view fills the body, every block is fixed-height EXCEPT the
   SV square, which flexes to absorb the slack (down to a 110px floor). Solid mode
   keeps its taller fixed-aspect square. (Olivia 2026-06-26) */
.cp-custom-view { height: 100%; min-height: 0; }
.cp-g2 { flex: 1 1 auto; min-height: 0; }
.cp-g2 .cp-sv { flex: 1 1 auto; aspect-ratio: auto; height: auto; min-height: 110px; }
.cp-g2 .cp-controls { margin: 12px 0 12px; }
.cp-g2 .cp-slider-col { gap: 12px; }
/* Live full-gradient preview bar. Inner gradient border (gray top-left →
   transparent bottom-right) — same soft treatment as the SV square, not a flat
   outer border. (Olivia 2026-06-26) */
.cp-g2-preview { position: relative; height: 22px; border-radius: 8px; }
.cp-g2-preview::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  padding: 1.5px;
  background: linear-gradient(135deg, rgba(0,0,0,0.32), rgba(0,0,0,0) 65%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; }
/* Row of selectable stop chips + the reverse button. */
.cp-g2-stoprow { display: flex; align-items: center; gap: 10px; }
.cp-g2-stops { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
/* Each stop is a selectable chip; the active one edits via the inline SV picker. */
.cp-g2-bar { flex: 1; height: 30px; border-radius: 8px; padding: 0; cursor: pointer;
  border: 1px solid rgba(0,0,0,0.12); box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: box-shadow .15s, transform .1s; }
.cp-g2-bar:hover { transform: translateY(-1px); }
.cp-g2-bar.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--teal); }
.cp-g2-swap { width: 34px; height: 34px; flex: none; border: 1px solid rgba(0,0,0,0.12); border-radius: 10px;
  background: #fff; color: #1e3347; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); transition: border-color .15s, color .15s, box-shadow .15s; }
.cp-g2-swap:hover { border-color: var(--teal); color: var(--teal); box-shadow: 0 2px 6px rgba(69,208,189,0.3); }
.cp-g2-anglewrap { display: flex; align-items: center; gap: 10px; }
.cp-g2-lbl { font-size: 14px; color: #1e3347; font-family: 'Manrope','Sora',sans-serif; }
.cp-g2-dial { position: relative; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: #fff; border: 1px solid rgba(0,0,0,0.12); box-shadow: inset 0 1px 3px rgba(0,0,0,0.08); cursor: grab; touch-action: none; }
.cp-g2-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #1e3347;
  transform: translate(-50%,-50%); box-shadow: 0 1px 2px rgba(0,0,0,0.3); pointer-events: none; }
.cp-g2-right { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.cp-g2-dirs { display: flex; gap: 6px; }
.cp-g2-dir { width: 34px; height: 30px; border: 1px solid rgba(0,0,0,0.12); border-radius: 8px;
  background: #fff; color: #1e3347; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, background .15s; }
.cp-g2-dir:hover { border-color: var(--teal); color: var(--teal); }
.cp-g2-dir.active { border-color: var(--teal); color: var(--teal); background: rgba(0,229,204,0.1); }
.cp-g2-degbox { display: flex; align-items: center; gap: 2px; height: 32px; padding: 0 10px; border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.12); background: #fff; }
.cp-g2-deg { width: 40px; border: none; outline: none; background: transparent; color: #1e3347;
  font-size: 14px; font-family: inherit; text-align: right; }
.cp-g2-deg-u { color: #1e3347; opacity: .6; font-size: 13px; }

/* ── Adjust-layer panel (排列 / 图层) ── */
.layer-panel {
  position: fixed; right: -380px; top: 80px; bottom: 80px; width: 320px; z-index: 198;
  background: rgba(13,30,53,0.95); border: 1px solid rgba(0,229,204,0.18); border-radius: 12px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; flex-direction: column; overflow: visible;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  transition: right 0.25s cubic-bezier(0.16,1,0.3,1), transform 0.22s ease;
  font-family: 'Manrope', 'Sora', sans-serif; color: var(--gray-light);
}
.layer-panel.open { right: 16px; }
.lp-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.lp-title { font-size: 16px; font-weight: 600; }
.lp-close { background: transparent; border: none; color: var(--gray-light); font-size: 22px; line-height: 1; cursor: pointer; opacity: .65; padding: 0 4px; }
.lp-close:hover { opacity: 1; color: var(--teal); }
.lp-tabs { display: flex; gap: 26px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.lp-tab { background: transparent; border: none; color: var(--gray-light); opacity: .55; font-size: 14px; padding: 8px 2px 11px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit; }
.lp-tab.active { opacity: 1; color: #b9b3f5; border-bottom-color: #7c77dd; font-weight: 500; }
.lp-body { flex: 1; overflow-y: auto; padding: 16px 14px; border-radius: 0 0 12px 12px; }
.lp-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lp-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 10px; align-items: end; }
.lp-btn { display: flex; align-items: center; gap: 9px; padding: 11px 12px; background: transparent; border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; color: var(--gray-light); font-size: 13px; cursor: pointer; font-family: inherit; text-align: left; }
.lp-btn:hover:not(:disabled) { background: rgba(0,229,204,0.1); border-color: rgba(0,229,204,0.4); color: var(--teal); }
.lp-btn:disabled { opacity: .35; cursor: default; }
.lp-btn-ico { display: inline-flex; flex: none; }
.lp-section-title { font-size: 13px; font-weight: 600; margin: 20px 0 10px; }
.lp-field { display: flex; flex-direction: column; gap: 6px; }
.lp-field label { font-size: 11px; opacity: .6; }
.lp-field input { height: 38px; background: transparent; border: 1px solid rgba(255,255,255,0.14); border-radius: 8px; color: var(--gray-light); font-size: 13px; padding: 0 10px; font-family: inherit; -moz-appearance: textfield; width: 100%; box-sizing: border-box; }
.lp-field input::-webkit-outer-spin-button, .lp-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lp-field input:focus { outline: none; border-color: var(--teal); }
.lp-unit { display: none; }
.lp-radius-control { display: grid; grid-template-columns: 1fr 82px; gap: 8px 12px; align-items: center; margin-top: 14px; }
.lp-radius-control label { grid-column: 1 / -1; font-size: 11px; opacity: .6; }
.lp-radius-control input[type="range"] { width: 100%; accent-color: var(--teal); }
.lp-radius-control input[type="number"] { height: 38px; background: transparent; border: 1px solid rgba(255,255,255,0.14); border-radius: 8px; color: var(--gray-light); font-size: 13px; padding: 0 10px; font-family: inherit; -moz-appearance: textfield; width: 100%; box-sizing: border-box; }
.lp-radius-control input[type="number"]::-webkit-outer-spin-button, .lp-radius-control input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lp-radius-control input[type="number"]:focus { outline: none; border-color: var(--teal); }
.lp-lock { height: 38px; display: flex; align-items: center; justify-content: center; background: transparent; border: 1px solid rgba(255,255,255,0.14); border-radius: 8px; color: var(--gray-light); cursor: pointer; }
.lp-lock.active { color: #b9b3f5; border-color: rgba(124,119,221,0.5); background: rgba(124,119,221,0.12); }
.lp-seg { display: flex; background: rgba(255,255,255,0.06); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.lp-seg-btn { flex: 1; background: transparent; border: none; color: var(--gray-light); opacity: .7; padding: 8px; border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit; }
.lp-seg-btn.active { background: rgba(255,255,255,0.16); opacity: 1; }
.lp-list { display: flex; flex-direction: column; gap: 8px; }
.lp-row { display: flex; align-items: center; gap: 10px; padding: 12px; background: rgba(255,255,255,0.06); border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.lp-row:hover { background: rgba(255,255,255,0.1); }
.lp-row.active { border-color: #7c77dd; background: rgba(124,119,221,0.14); }
.lp-row.dragging { opacity: .4; }
.lp-row.drag-over { border-color: var(--teal); }
.lp-grip { color: var(--gray-light); opacity: .5; cursor: grab; display: inline-flex; flex: none; }
.lp-row-name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-empty { padding: 26px 8px; text-align: center; opacity: .6; font-size: 13px; }
body.light-mode .layer-panel { background: rgba(255,255,255,0.97); border-color: rgba(0,0,0,0.08); box-shadow: 0 8px 32px rgba(0,0,0,0.12); }
body.light-mode .lp-title, body.light-mode .lp-close, body.light-mode .lp-tab, body.light-mode .lp-btn, body.light-mode .lp-section-title, body.light-mode .lp-field label, body.light-mode .lp-field input, body.light-mode .lp-radius-control label, body.light-mode .lp-radius-control input[type="number"], body.light-mode .lp-lock, body.light-mode .lp-seg-btn, body.light-mode .lp-row-name, body.light-mode .lp-grip, body.light-mode .lp-empty { color: #1e3347; }
body.light-mode .lp-tabs { border-bottom-color: rgba(0,0,0,0.08); }
body.light-mode .lp-tab.active { color: #534ab7; border-bottom-color: #7c77dd; }
body.light-mode .lp-btn, body.light-mode .lp-field input, body.light-mode .lp-radius-control input[type="number"], body.light-mode .lp-lock { border-color: rgba(0,0,0,0.14); }
body.light-mode .lp-btn:hover:not(:disabled) { background: rgba(0,133,119,0.1); border-color: rgba(0,133,119,0.4); color: #008577; }
body.light-mode .lp-seg, body.light-mode .lp-row { background: rgba(0,0,0,0.04); }
body.light-mode .lp-seg-btn.active { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
body.light-mode .lp-row:hover { background: rgba(0,0,0,0.07); }
body.light-mode .lp-row.active { background: rgba(124,119,221,0.12); }

/* ── Shared popover (case / align / list / line-height / letter-spacing / opacity) ── */
.fmt-popover {
  position: fixed; z-index: 197;
  background: rgba(13,30,53,0.98);
  border: 1px solid rgba(0,229,204,0.2);
  border-radius: 10px; padding: 5px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.45);
  backdrop-filter: blur(20px);
  min-width: 120px;
}
.fmt-pop-item {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: 6px;
  color: var(--gray-light); font-size: 13px; padding: 7px 12px; cursor: pointer;
  font-family: 'Sora', sans-serif;
}
.fmt-pop-item:hover { background: rgba(0,229,204,0.14); color: var(--teal); }
.fmt-pop-row { display: flex; gap: 2px; }
.fmt-pop-icobtn {
  width: 34px; height: 32px; background: transparent; border: none; border-radius: 6px;
  color: var(--gray-light); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.fmt-pop-icobtn svg { width: 16px; height: 16px; }
.fmt-pop-icobtn:hover { background: rgba(0,229,204,0.14); color: var(--teal); }
.fmt-pop-slider { padding: 8px 10px; min-width: 184px; }
.fmt-pop-label { display: block; font-size: 11px; color: var(--gray-light); opacity: .8; margin-bottom: 6px; font-family: 'Sora', sans-serif; }
.fmt-pop-sliderrow { display: flex; align-items: center; gap: 10px; }
/* Soft dashboard-style slider: white handle + gentle shadow (no harsh navy
   ring), teal-tinted glow + slight grow on hover. Track fill is painted by
   _paintRange (teal → soft gray). (Olivia 2026-06-25.) */
.fmt-pop-range {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 5px; border-radius: 999px; cursor: pointer; outline: none;
  background: rgba(128,128,128,0.18);
}
.fmt-pop-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%; background: #fff; border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.05);
  transition: box-shadow .18s ease, transform .15s ease;
}
.fmt-pop-range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #fff; border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.05);
  transition: box-shadow .18s ease, transform .15s ease;
}
.fmt-pop-range::-moz-range-track { height: 5px; border-radius: 999px; background: transparent; }
.fmt-pop-range:hover::-webkit-slider-thumb {
  box-shadow: 0 2px 8px rgba(69,208,189,0.4), 0 0 0 1px rgba(0,0,0,0.05); transform: scale(1.08);
}
.fmt-pop-range:hover::-moz-range-thumb {
  box-shadow: 0 2px 8px rgba(69,208,189,0.4), 0 0 0 1px rgba(0,0,0,0.05); transform: scale(1.08);
}
.fmt-pop-range:active::-webkit-slider-thumb { transform: scale(1.12); box-shadow: 0 3px 10px rgba(69,208,189,0.5), 0 0 0 1px rgba(0,0,0,0.05); }
.fmt-pop-range:active::-moz-range-thumb { transform: scale(1.12); box-shadow: 0 3px 10px rgba(69,208,189,0.5), 0 0 0 1px rgba(0,0,0,0.05); }
.fmt-pop-val { font-size: 12px; color: var(--teal); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; font-family: 'Sora', sans-serif; }
.fmt-pop-icobtn.active { background: rgba(124,119,221,0.22); color: #b9b3f5; }
body.light-mode .fmt-pop-icobtn.active { background: rgba(124,119,221,0.16); color: #534ab7; }

/* Advanced-settings dropdown (letter/line spacing + vertical align + more) */
.fmt-adv { min-width: 240px; padding: 8px 4px 4px; }
.fmt-adv-field { padding: 4px 10px 10px; }
.fmt-adv-field .fmt-pop-label { font-size: 14px; opacity: 1; margin-bottom: 8px; }
.fmt-adv-row { display: flex; align-items: center; gap: 12px; }
.fmt-adv-row .fmt-pop-range { flex: 1; }
.fmt-adv-num {
  width: 56px; height: 34px; text-align: center;
  background: transparent; border: 1px solid rgba(255,255,255,0.16); border-radius: var(--border-radius-md, 8px);
  color: var(--gray-light); font-size: 14px; font-family: 'Sora', sans-serif; -moz-appearance: textfield;
}
.fmt-adv-num::-webkit-outer-spin-button, .fmt-adv-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fmt-adv-num:focus { outline: none; border-color: var(--teal); }
.fmt-adv-sep { height: 1px; background: rgba(255,255,255,0.1); margin: 6px 10px; }
.fmt-adv-valign { display: flex; align-items: center; justify-content: space-between; padding: 4px 10px 10px; }
.fmt-adv-valign .fmt-pop-label { font-size: 14px; opacity: 1; margin-bottom: 0; }
.fmt-adv-more {
  display: block; width: calc(100% - 20px); margin: 4px 10px 6px; height: 40px;
  background: transparent; border: 1px solid rgba(255,255,255,0.16); border-radius: var(--border-radius-md, 8px);
  color: var(--gray-light); font-size: 14px; font-family: 'Sora', sans-serif; cursor: pointer;
}
.fmt-adv-more:hover { background: rgba(0,229,204,0.12); color: var(--teal); border-color: rgba(0,229,204,0.4); }
body.light-mode .fmt-adv-num,
body.light-mode .fmt-adv-more { color: #1e3347; border-color: rgba(0,0,0,0.16); }
body.light-mode .fmt-adv-sep { background: rgba(0,0,0,0.1); }
body.light-mode .fmt-adv-more:hover { background: rgba(0,133,119,0.1); color: #008577; border-color: rgba(0,133,119,0.4); }

/* Advanced "高级设置" panel — fuller text/typography settings (Olivia 2026-06-25) */
.fmt-adv-panel { min-width: 320px; max-width: 360px; max-height: 74vh; overflow-y: auto; padding: 2px 0 12px; }
.fmt-adv-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 2px; }
.fmt-adv-title { font-size: 16px; font-weight: 700; color: var(--gray-light); font-family: 'Sora', sans-serif; }
.fmt-adv-close { background: transparent; border: none; color: var(--gray-light); font-size: 22px; line-height: 1; cursor: pointer; opacity: .6; padding: 0 4px; }
.fmt-adv-close:hover { opacity: 1; color: var(--teal); }
.fmt-adv-secttl { font-size: 14px; font-weight: 700; color: var(--gray-light); padding: 16px 14px 4px; font-family: 'Sora', sans-serif; }
.fmt-adv-panel .fmt-adv-field { padding: 4px 14px 8px; }
.fmt-adv-panel > .fmt-pop-label,
.fmt-adv-panel .fmt-adv-valign .fmt-pop-label { padding: 8px 14px 0; margin: 0; font-size: 14px; opacity: 1; }
.fmt-adv-panel .fmt-adv-valign { display: block; padding: 0; }
.fmt-adv-tlabel { font-size: 14px; color: var(--gray-light); padding: 10px 14px 0; font-family: 'Sora', sans-serif; }
.fmt-adv-hint { display: block; font-size: 12px; opacity: .55; margin-top: 2px; font-weight: 400; }
.fmt-seg { display: flex; gap: 2px; padding: 4px; margin: 6px 14px 6px; background: rgba(128,128,128,0.13); border-radius: 12px; }
.fmt-seg-btn { flex: 1; height: 42px; border: none; background: transparent; border-radius: 9px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 2px;
  font-size: 16px; color: var(--gray-light); font-family: 'Sora', sans-serif;
  transition: background .15s ease, box-shadow .15s ease, color .15s ease; }
.fmt-seg-btn svg { width: 17px; height: 17px; }
.fmt-seg-btn sup, .fmt-seg-btn sub { font-size: .7em; }
.fmt-seg-btn:hover { background: rgba(128,128,128,0.12); }
.fmt-seg-btn.active { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.16); color: #1e3347; }
.fmt-liga-off { font-feature-settings: 'liga' 0, 'dlig' 0; }
.fmt-liga-on { font-feature-settings: 'liga' 1, 'dlig' 1; }
body.light-mode .fmt-adv-title,
body.light-mode .fmt-adv-secttl,
body.light-mode .fmt-adv-tlabel,
body.light-mode .fmt-adv-close,
body.light-mode .fmt-seg-btn { color: #1e3347; }
body.light-mode .fmt-seg { background: rgba(0,0,0,0.05); }

/* Right-side docked panel that hosts the advanced text settings (same frame as
   the font/color pickers). (Olivia 2026-06-25.) */
.text-settings-panel {
  position: fixed; right: -400px; top: 80px; bottom: 80px; width: 340px; z-index: 198;
  background: rgba(13,30,53,0.95); border: 1px solid rgba(0,229,204,0.18); border-radius: 12px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; flex-direction: column; overflow: visible;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  transition: right 0.25s cubic-bezier(0.16,1,0.3,1), transform 0.22s ease;
  font-family: 'Manrope', 'Sora', sans-serif;
}
.text-settings-panel.open { right: 16px; }
.text-settings-panel .ts-body { flex: 1; min-height: 0; overflow-y: auto; }
.text-settings-panel .fmt-adv-panel { min-width: 0; max-width: none; max-height: none; padding: 2px 0 16px; }
body.light-mode .text-settings-panel { background: rgba(255,255,255,0.98); border-color: rgba(0,0,0,0.08); box-shadow: -4px 0 24px rgba(0,0,0,0.08); }

/* Inspector section jump-target highlight (特效 / 动效 / 调整图层) */
.insp-section-flash { animation: inspSectionFlash 1.2s ease; border-radius: 8px; }
@keyframes inspSectionFlash { 0%,100% { background: transparent; } 25% { background: rgba(0,229,204,0.16); } }

/* ── AI rewrite button + menu + streaming highlight ──────────────────
   (Rainy 2026-06-03: inline AI rewrite — brand teal so the new entry
   reads as part of the same toolbar family, not a foreign element.) */
.fmt-ai-btn {
  width: auto !important; padding: 0 9px 0 7px;
  background: linear-gradient(135deg, rgba(0,229,204,0.18), rgba(0,229,204,0.10)) !important;
  color: var(--teal) !important;
  font-weight: 600;
  font-size: 11.5px !important;
  letter-spacing: 0.02em;
  gap: 4px;
  border: 1px solid rgba(0,229,204,0.30) !important;
}
.fmt-ai-btn:hover {
  background: linear-gradient(135deg, rgba(0,229,204,0.30), rgba(0,229,204,0.18)) !important;
  color: #5cf2e0 !important;
  border-color: rgba(0,229,204,0.50) !important;
}
.fmt-ai-spark {
  display: inline-block;
  width: 14px; height: 14px;
  vertical-align: -2px;
  flex-shrink: 0;
}
.fmt-ai-busy { opacity: 0.6; pointer-events: none; }
.fmt-ai-busy .fmt-ai-spark {
  animation: fmtAiSparkSpin 0.9s linear infinite;
}
@keyframes fmtAiSparkSpin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}
body.light-mode .fmt-ai-btn {
  background: linear-gradient(135deg, rgba(16,128,128,0.12), rgba(16,128,128,0.06)) !important;
  color: #108080 !important;
  border-color: rgba(16,128,128,0.35) !important;
}
body.light-mode .fmt-ai-btn:hover {
  background: linear-gradient(135deg, rgba(16,128,128,0.22), rgba(16,128,128,0.12)) !important;
  color: #0a5c5c !important;
}

.fmt-ai-menu {
  position: fixed; z-index: 197;
  background: rgba(13,30,53,0.98);
  border: 1px solid rgba(0,229,204,0.25);
  border-radius: 8px;
  padding: 6px 0;
  min-width: 220px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.48);
  backdrop-filter: blur(20px);
  flex-direction: column;
  font-family: 'Sora', sans-serif;
}
.fmt-ai-item {
  background: transparent; border: none;
  color: #d8d8e6; font-size: 12.5px;
  padding: 6px 12px;
  text-align: left;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-family: inherit;
}
.fmt-ai-item:hover { background: rgba(0,229,204,0.14); color: var(--teal); }
.fmt-ai-ico {
  width: 16px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.fmt-ai-ico svg { width: 14px; height: 14px; }
.fmt-ai-sep {
  height: 1px;
  margin: 4px 8px;
  background: rgba(255,255,255,0.08);
}
.fmt-ai-custom {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px 6px 12px;
}
.fmt-ai-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 5px;
  color: #e8e8f0;
  font-size: 12px; font-family: inherit;
  padding: 5px 8px;
  outline: none;
  min-width: 0;
}
.fmt-ai-input:focus { border-color: rgba(0,229,204,0.55); background: rgba(0,229,204,0.08); }
.fmt-ai-input::placeholder { color: rgba(255,255,255,0.35); }
.fmt-ai-run {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, rgba(0,229,204,0.25), rgba(0,229,204,0.15));
  border: 1px solid rgba(0,229,204,0.35);
  border-radius: 5px;
  color: var(--teal);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.fmt-ai-run svg { width: 13px; height: 13px; }
.fmt-ai-run:hover { background: linear-gradient(135deg, rgba(0,229,204,0.40), rgba(0,229,204,0.25)); color: #fff; }

body.light-mode .fmt-ai-menu {
  background: rgba(255,255,255,0.98);
  border-color: rgba(16,128,128,0.22);
  box-shadow: 0 6px 20px rgba(20, 60, 60, 0.14);
}
body.light-mode .fmt-ai-item { color: #1e3347; }
body.light-mode .fmt-ai-item:hover { background: rgba(16,128,128,0.10); color: #0a5c5c; }
body.light-mode .fmt-ai-sep { background: rgba(0,0,0,0.08); }
body.light-mode .fmt-ai-input {
  background: rgba(16,128,128,0.05);
  border-color: rgba(16,128,128,0.20);
  color: #1e3347;
}
body.light-mode .fmt-ai-input::placeholder { color: rgba(0,0,0,0.40); }
body.light-mode .fmt-ai-input:focus { border-color: rgba(16,128,128,0.55); background: rgba(16,128,128,0.10); }

/* ── In-flight + highlight transient classes ───────────────────────
   .ai-streaming: pulsing brand-teal bg while AI is writing — shows
                  there's an in-flight action, like a typing cursor.
   .ai-highlight: post-stream 1.5s fade — brief "AI just did this" cue
                  before the wrapper is unwrapped from the DOM.
   Both scoped to inline <span> only; do NOT affect block-level
   inheritance (e.g., gradient text colors on h1 stay intact). */
.ai-streaming {
  display: inline;
  background: linear-gradient(120deg, rgba(0,229,204,0.16), rgba(0,229,204,0.08));
  box-shadow: 0 0 0 1px rgba(0,229,204,0.22) inset;
  border-radius: 3px;
  padding: 0 2px;
  animation: aiStreamPulse 1.4s ease-in-out infinite;
}
@keyframes aiStreamPulse {
  0%, 100% { background: linear-gradient(120deg, rgba(0,229,204,0.16), rgba(0,229,204,0.08)); }
  50%      { background: linear-gradient(120deg, rgba(0,229,204,0.30), rgba(0,229,204,0.18)); }
}
.ai-highlight {
  display: inline;
  background: linear-gradient(120deg, rgba(0,229,204,0.28), rgba(0,229,204,0.16));
  border-radius: 3px;
  padding: 0 2px;
  animation: aiHighlightFade 1.5s ease-out forwards;
}
@keyframes aiHighlightFade {
  0%   { background: linear-gradient(120deg, rgba(0,229,204,0.32), rgba(0,229,204,0.20)); }
  100% { background: transparent; padding: 0; }
}

/* ── Find / Replace Overlay ── */
.find-replace-overlay {
  position: fixed; top: 70px; right: 20px; z-index: 300;
  background: rgba(13,30,53,0.97);
  border: 1px solid rgba(0,229,204,0.2);
  border-radius: 10px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  padding: 10px; width: 340px;
  display: none; flex-direction: column; gap: 6px;
}
.find-replace-overlay.open { display: flex; }
.find-replace-row {
  display: flex; align-items: center; gap: 6px;
}
.find-replace-overlay input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; color: var(--white);
  font-size: 12px; padding: 6px 10px;
  font-family: 'Sora', sans-serif; outline: none;
}
.find-replace-overlay input:focus { border-color: rgba(0,229,204,0.4); }
.find-replace-count {
  font-family: 'DM Mono', monospace;
  font-size: 10px; color: var(--gray);
  min-width: 60px; text-align: right;
}
.find-replace-btn {
  padding: 4px 10px; border-radius: 6px;
  background: rgba(0,229,204,0.08);
  border: 1px solid rgba(0,229,204,0.2);
  color: var(--teal); font-size: 11px;
  cursor: pointer; font-family: 'DM Mono', monospace;
  transition: all 0.15s;
}
.find-replace-btn:hover { background: rgba(0,229,204,0.18); }
.find-highlight {
  outline: 2px solid #ffc832 !important;
  outline-offset: 2px;
  box-shadow: 0 0 18px rgba(255,200,50,0.4);
}

/* ── Zoom Indicator ── */
.zoom-indicator {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%);
  background: rgba(13,30,53,0.94);
  border: 1px solid rgba(0,229,204,0.25);
  color: var(--teal);
  font-family: 'DM Mono', monospace;
  font-size: 13px; padding: 6px 14px;
  border-radius: 18px; z-index: 260;
  pointer-events: none;
  opacity: 0; transition: opacity 0.25s;
}
.zoom-indicator.visible { opacity: 1; }

/* ── Grid Overlay ── */
.slide.show-grid {
  background-image:
    linear-gradient(rgba(0,229,204,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,204,0.08) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ── Auto-save Indicator ── */
.autosave-indicator {
  position: fixed; bottom: 16px; left: 16px;
  background: rgba(13,30,53,0.9);
  border: 1px solid rgba(0,229,204,0.2);
  color: rgba(255,255,255,0.6);
  font-family: 'Manrope', 'DM Mono', monospace;
  font-size: 11px; padding: 5px 10px;
  border-radius: 8px; z-index: 255;
  display: none; align-items: center; gap: 6px;
  pointer-events: none;
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
}
.autosave-indicator.visible { opacity: 1; transform: translateY(0); }
.autosave-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34,197,94,0.5);
}

/* ── Notes Panel (speaker notes) ── */
.notes-panel {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 180px; z-index: 210;
  background: rgba(13,30,53,0.97);
  border-top: 1px solid rgba(0,229,204,0.2);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.notes-panel.open { transform: translateY(0); }
.notes-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(0,229,204,0.1);
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.12em;
  color: var(--gray);
}
.notes-toggle {
  cursor: pointer; font-size: 18px;
  color: var(--gray); padding: 0 6px;
  transition: color 0.15s;
}
.notes-toggle:hover { color: var(--teal); }
.notes-textarea {
  flex: 1; resize: none;
  background: transparent; border: none;
  color: var(--gray-light); font-size: 13px;
  font-family: 'Sora', sans-serif;
  padding: 12px 16px; outline: none;
  line-height: 1.5;
}
.notes-textarea::placeholder { color: rgba(255,255,255,0.25); }

/* Light mode for new elements */
body.light-mode .fmt-font-family {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.12);
  color: #1e3347;
}
body.light-mode .fmt-font-family option { background: #f5f7fa; color: #1e3347; }
body.light-mode .find-replace-overlay {
  background: rgba(245,247,250,0.97);
  border-color: rgba(0,0,0,0.12);
  box-shadow: 0 8px 28px rgba(0,0,0,0.15);
}
body.light-mode .find-replace-overlay input {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.12);
  color: #0a1628;
}
body.light-mode .find-replace-btn {
  background: rgba(0,133,119,0.08);
  border-color: rgba(0,133,119,0.2);
  color: #008577;
}
body.light-mode .zoom-indicator,
body.light-mode .autosave-indicator {
  background: rgba(245,247,250,0.94);
  border-color: rgba(0,0,0,0.1);
  color: #1e3347;
}
body.light-mode .notes-panel {
  background: rgba(245,247,250,0.97);
  border-top-color: rgba(0,0,0,0.1);
}
body.light-mode .notes-panel-header { color: #3a4f63; border-bottom-color: rgba(0,0,0,0.08); }
body.light-mode .notes-textarea { color: #1e3347; }

/* ── Slide Sorter View ──
   Centered modal showing every slide as a real thumbnail. Light/dark
   modes share layout; only surface tokens flip. The backdrop is painted
   by body.sorter-mode::before so the editor chrome behind is darkened/
   blurred without each individual chrome rule needing display:none. */
body.sorter-mode::before {
  content: "";
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  z-index: 499;
  animation: layoutPickerFadeIn 0.15s ease-out;
}
.slide-manager-panel.sorter-mode {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(1200px, 90vw) !important;
  height: min(820px, 85vh) !important;
  z-index: 500;
  background: #ffffff;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 32px 96px -16px rgba(15, 23, 42, 0.35);
  animation: layoutPickerPopIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
body:not(.light-mode) .slide-manager-panel.sorter-mode {
  background: #0b1220;
}
/* Header keeps Slides label + sorter toggle, but lays out as a top bar. */
.slide-manager-panel.sorter-mode .sm-header {
  padding: 20px 32px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}
body:not(.light-mode) .slide-manager-panel.sorter-mode .sm-header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
/* Hide the footer (Insert Slide / Browse Layouts) — sorter is for
   reorder/overview, not insertion. */
.slide-manager-panel.sorter-mode .sm-footer,
.slide-manager-panel.sorter-mode .sm-collapse,
.slide-manager-panel.sorter-mode .sm-panel-close,
.slide-manager-panel.sorter-mode .sm-brand { display: none !important; }
.slide-manager-panel.sorter-mode .sm-thumbs {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 28px 32px;
  overflow-y: auto;
  align-content: start;
}
/* Each card: real 16:9 thumbnail + label below, no chrome borders.
   The .sm-thumb-preview already has a child .slide that the existing
   container-query CSS scales correctly. */
.slide-manager-panel.sorter-mode .sm-thumb {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.slide-manager-panel.sorter-mode .sm-thumb:hover { transform: translateY(-2px); }
.slide-manager-panel.sorter-mode .sm-thumb-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto !important;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.slide-manager-panel.sorter-mode .sm-thumb:hover .sm-thumb-preview {
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 12px 32px -8px rgba(15, 23, 42, 0.28);
}
.slide-manager-panel.sorter-mode .sm-thumb.active .sm-thumb-preview {
  border-color: var(--teal, #00e5cc);
  box-shadow: 0 0 0 2px rgba(0, 229, 204, 0.35);
}
body:not(.light-mode) .slide-manager-panel.sorter-mode .sm-thumb-preview {
  border-color: rgba(255, 255, 255, 0.08);
}
/* Numbered label below — number + slide title on one row */
.slide-manager-panel.sorter-mode .sm-thumb-num {
  display: inline;
  font-size: 13px !important;
  font-weight: 600;
  color: #94a3b8;
  margin-right: 8px;
}
.slide-manager-panel.sorter-mode .sm-thumb-label {
  display: inline;
  font-size: 13px !important;
  font-weight: 500;
  color: #475569;
  letter-spacing: 0.01em;
}
body:not(.light-mode) .slide-manager-panel.sorter-mode .sm-thumb-num { color: rgba(255, 255, 255, 0.45); }
body:not(.light-mode) .slide-manager-panel.sorter-mode .sm-thumb-label { color: rgba(255, 255, 255, 0.75); }
/* Wrap num+label in a single line under the preview */
.slide-manager-panel.sorter-mode .sm-thumb > .sm-thumb-num,
.slide-manager-panel.sorter-mode .sm-thumb > .sm-thumb-label {
  text-align: center;
}
body.sorter-mode .slides-wrapper,
body.sorter-mode .deck-toolbar,
body.sorter-mode .slide-nav-bar,
body.sorter-mode .deck-nav-arrow,
body.sorter-mode .deck-counter {
  display: none !important;
}
/* Hide the side sm-panel and edge toggles while sorter modal is open */
body.sorter-mode .slide-manager-panel:not(.sorter-mode),
body.sorter-mode .sidebar-toggle-btn { display: none !important; }
/* Close (×) button — exists in DOM only during sorter view but stays
   parented to the panel; hide it explicitly outside sorter-mode so the
   element doesn't bleed into the regular collapsed-panel header. */
.sm-sorter-close { display: none !important; }
.slide-manager-panel.sorter-mode .sm-sorter-close {
  display: flex !important;
  background: none; border: none; cursor: pointer;
  font-size: 28px; line-height: 1; color: #64748b;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: 8px; margin-left: auto;
  transition: background 0.15s, color 0.15s;
}
.slide-manager-panel.sorter-mode .sm-sorter-close:hover { background: #f1f5f9; color: #0f172a; }
body:not(.light-mode) .slide-manager-panel.sorter-mode .sm-sorter-close { color: rgba(255,255,255,0.6); }
body:not(.light-mode) .slide-manager-panel.sorter-mode .sm-sorter-close:hover { background: rgba(255,255,255,0.06); color: #fff; }
/* Hide the sorter-toggle button itself inside sorter mode (header already
   has the × button for closing). */
.slide-manager-panel.sorter-mode .sm-sorter { display: none !important; }
/* Add Slide button + dropdown in the panel footer. Always visible so
   users have a single, predictable entry for inserting slides without
   needing to open the sorter overview. The menu opens upward (above the
   button) since the button itself sits at the bottom of the panel. */
.sm-add-wrap { position: relative; }
/* Icon-only "+" button in the panel header top-right. Hover pops the
   Blank / AI Generate menu (Rainy 2026-06-29 — "这个就一个➕icon就好.
   hover上去就能看到两个选项"). Same 28×28 pill as .sm-btn for visual
   parity with any future header buttons. */
.sm-add-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  background: rgba(0, 229, 204, 0.08);
  border: 1px solid rgba(0, 229, 204, 0.2);
  border-radius: 6px;
  color: var(--teal, #00e5cc);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sm-add-btn:hover { background: rgba(0, 229, 204, 0.15); }
.sm-add-btn svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
body.light-mode .sm-add-btn {
  background: rgba(0, 133, 119, 0.08);
  border-color: rgba(0, 133, 119, 0.2);
  color: #008577;
}
body.light-mode .sm-add-btn:hover { background: rgba(0, 133, 119, 0.14); }
.sm-add-menu {
  /* Menu hangs below the "+" trigger with NO gap so hover doesn't drop
     when the cursor crosses button→menu. Right-anchored so it grows
     leftward without spilling past the panel's left edge. Narrower now
     (Rainy 2026-06-29 — "还是太靠左了，能不能小一些"). */
  position: absolute;
  top: 100%; right: 0;
  padding-top: 6px;                     /* invisible hover bridge */
  width: 175px;
  display: none;
  z-index: 10;
}
.sm-add-menu-inner {
  background: #ffffff;
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.3), 0 1px 3px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.06);
  animation: smAddMenuPopIn 0.14s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-origin: top right;
}
@keyframes smAddMenuPopIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Hover-to-open (Rainy 2026-06-29: "hover上去就能看到两个选项"). Keep
   the .open class path too — click / tap still works on touch devices
   where :hover isn't a real gesture, and closes on option-click. */
.sm-add-wrap:hover .sm-add-menu,
.sm-add-wrap.open .sm-add-menu { display: block; }
.sm-add-opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px;
  background: transparent; border: none;
  text-align: left; cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s;
}
.sm-add-opt:hover { background: #f1f5f9; }
.sm-add-opt svg {
  width: 14px; height: 14px;
  stroke: #475569; fill: none; stroke-width: 1.8;
  flex-shrink: 0; margin-top: 2px;
}
.sm-add-opt-title {
  font-size: 12px; font-weight: 600; color: #0f172a;
  letter-spacing: 0.01em;
}
.sm-add-opt-sub {
  font-size: 10.5px; color: #64748b; margin-top: 2px; line-height: 1.35;
}
body:not(.light-mode) .sm-add-menu {
  background: #1a2438;
  border-color: rgba(255,255,255,0.08);
}
body:not(.light-mode) .sm-add-opt:hover { background: rgba(255,255,255,0.05); }
body:not(.light-mode) .sm-add-opt-title { color: #f0f4f8; }
body:not(.light-mode) .sm-add-opt-sub { color: rgba(255,255,255,0.55); }
body:not(.light-mode) .sm-add-opt svg { stroke: rgba(255,255,255,0.7); }
/* View-all button now lives in the panel footer (moved from header per
   Rainy 2026-06-29 — swap Add Slide ↔ View all positions). Full-width
   pill with icon + label, styled like the old .sm-browse-layouts row
   that used to occupy the footer, so muscle memory for "the row at the
   bottom" still works. */
.sm-btn.sm-sorter {
  width: 100%;
  height: auto;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Sora', sans-serif;
  font-size: 12px; font-weight: 600; letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sm-btn.sm-sorter svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.sm-btn.sm-sorter:hover {
  background: rgba(0, 229, 204, 0.08);
  border-color: rgba(0, 229, 204, 0.25);
  color: var(--teal);
}
body.light-mode .sm-btn.sm-sorter {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  color: rgba(0, 0, 0, 0.6);
}
body.light-mode .sm-btn.sm-sorter:hover {
  background: rgba(0, 133, 119, 0.08);
  border-color: rgba(0, 133, 119, 0.25);
  color: #008577;
}

/* ── Slide Manager Edge Tab (left edge) ── */
/* Sidebar toggle button (only visible when panel closed) */
/* Re-open handle for the collapsed slide panel.
 *
 * It only exists while the panel is closed, and in that state the toolbar
 * snaps back to left:0 — so this button lives INSIDE the toolbar's area and
 * has to be treated as the toolbar's first item, not as free-floating chrome.
 * It previously sat at top:18px/left:18px/34px while the toolbar row runs
 * y=8..44 with 20px of side padding, so it landed on top of the "Insert"
 * button: two clickable things stacked in the same pixels (Rainy 2026-07-27
 * "icon直接和 insert重叠了").
 *
 * Fixed by aligning it to the toolbar's own metrics (36px pill row at y=8,
 * gutter at x=20) and reserving a matching gutter on the toolbar below, so
 * the buttons sit side by side instead of on top of each other.
 *
 * Colours now match .tb-pill-btn. The old rules painted it white-on-white:
 * the base state assumed a dark surface, but .deck-toolbar is #fff in every
 * theme, so in dark mode this button was a nearly invisible white glyph on
 * a white bar.
 */
.sidebar-toggle-btn {
  position: fixed; top: 8px; left: 20px; z-index: 201;
  width: 36px; height: 36px; border-radius: 9999px;
  background: transparent; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #475061;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-toggle-btn > svg { width: 20px; height: 20px; display: block; }
.sidebar-toggle-btn:hover { background: rgba(15,23,42,0.06); color: #1a2433; }
.sidebar-toggle-btn:active { background: rgba(15,23,42,0.1); }
body.sm-panel-open .sidebar-toggle-btn { display: none; }

/* Keep the toolbar's first pill clear of that handle. Only while the panel is
 * closed — when it is open the handle is hidden and the toolbar shifts right
 * by the panel width instead. 20 (gutter) + 36 (handle) + 8 (gap) = 64. */
body:not(.sm-panel-open) .deck-toolbar { padding-left: 64px; }

/* Narrow viewports: deck-engine.css drops the toolbar gutter to 8px at this
 * width, so the handle and its reserved space track it down or the overlap
 * comes straight back. 8 + 36 + 4 = 48.
 *
 * Lives here rather than next to that media query in deck-engine.css so the
 * whole fix stays in one file. blocks.css loads after deck-engine.css, and
 * `body:not(...) .deck-toolbar` also outranks the bare `.deck-toolbar` there,
 * so this wins on both order and specificity. */
@media (max-width: 520px) {
  .sidebar-toggle-btn { left: 8px; }
  body:not(.sm-panel-open) .deck-toolbar { padding-left: 48px; }
}

/* ── Notes Panel: push slides up ── */
body.notes-panel-open .slides-wrapper {
  padding-bottom: 160px;
}
body.notes-panel-open .slide-nav-bar {
  bottom: 160px;
}
body.notes-panel-open .deck-counter {
  bottom: 170px;
}

body.notes-panel-open .slides-wrapper {
  height: calc(100vh - 150px);
}
body.notes-panel-open .slide {
  height: calc(100vh - 150px);
  min-height: calc(100vh - 150px);
}

/* ── Slide Manager Footer (Insert button in panel) ── */
.sm-footer {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sm-footer .sm-browse-layouts {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
}
.sm-footer .sm-browse-layouts:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
body.light-mode .sm-footer .sm-browse-layouts {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.6);
}
body.light-mode .sm-footer .sm-browse-layouts:hover {
  background: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.8);
}

/* ── Layout Picker Modal (Browse Layouts) ── */
.layout-picker-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: none;
}
.layout-picker-modal.open { display: block; }
.layout-picker-overlay {
  position: absolute; inset: 0;
  /* Softer wash so the frosted card glass can read the page behind */
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  animation: layoutPickerFadeIn 0.15s ease-out;
}
.layout-picker-content {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(1200px, 90vw);
  height: min(820px, 85vh);
  background: #ffffff;
  border-radius: 18px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 32px 96px -16px rgba(15, 23, 42, 0.35);
  animation: layoutPickerPopIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes layoutPickerFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes layoutPickerPopIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.layout-picker-header {
  padding: 20px 28px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.layout-picker-header h2 {
  margin: 0; font-size: 20px; font-weight: 600;
  color: #0f172a; letter-spacing: -0.01em;
}
.layout-picker-close {
  background: none; border: none; font-size: 28px;
  cursor: pointer; color: #64748b;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.layout-picker-close:hover { background: #f1f5f9; color: #0f172a; }
.layout-picker-grid {
  flex: 1; overflow-y: auto;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  align-content: start;
}
.layout-picker-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent;
  border: none;
  box-shadow: none;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.layout-picker-card:hover { transform: translateY(-2px); }
.layout-picker-card:hover .layout-picker-preview {
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 12px 32px -8px rgba(15, 23, 42, 0.28);
}
.layout-picker-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  background: #1a1a1a;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  container-type: inline-size;
  transition: box-shadow 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.layout-picker-preview > .slide,
/* Higher-specificity twin needed to outweigh deck-engine.css's
   `.slide[data-template="broadside"][class*="slide--"] { width: 100% !important }`
   (specificity 0,3,1). Without this the broadside picker thumbs
   collapse to 260px and only the top-left of the 1920×1080 inner shows. */
.layout-picker-preview > .slide[data-template][class*="slide--"] {
  /* Force the design canvas back to 1920×1080 in thumbnails. Scale down
     to preview width via container query (1920px must keep its unit so
     calc resolves to a unitless scale value). */
  width: 1920px !important;
  height: 1080px !important;
  /* Make the slide its own size container so children's cq* units
     (signal/clean-light inner padding like `5.5cqh 7.5cqw`) resolve to
     1920×1080 instead of the tiny preview width — without this signal
     thumbnails glue content to the slide edges. */
  container-type: size;
  transform: scale(calc(100cqw / 1920px));
  transform-origin: top left;
  pointer-events: none;
}
.layout-picker-label {
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  text-align: center;
  letter-spacing: 0.01em;
}
.sm-insert-wrap { position: relative; }
.sm-insert-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 229, 204, 0.08);
  border: 1px solid rgba(0, 229, 204, 0.2);
  border-radius: 6px;
  color: var(--teal);
  font-family: 'Sora', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.15s;
}
.sm-insert-btn:hover { background: rgba(0, 229, 204, 0.15); }
.sm-insert-btn svg { stroke: currentColor; fill: none; stroke-width: 2; }
.sm-insert-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--dark-card, #0d1e35);
  border: 1px solid rgba(0, 229, 204, 0.15);
  border-radius: 8px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 5;
}
.sm-insert-menu.open { display: flex; }
.sm-insert-menu .download-opt {
  text-align: left;
  padding: 6px 10px;
  font-size: 12px;
}
body.light-mode .sm-insert-btn {
  background: rgba(0, 133, 119, 0.08);
  border-color: rgba(0, 133, 119, 0.2);
  color: #008577;
}
body.light-mode .sm-insert-menu {
  background: rgba(245, 247, 250, 0.98);
  border-color: rgba(0, 0, 0, 0.1);
}

/* ── Insert Object Button (top-left of slide viewer) ── */
.insert-object-btn {
  position: relative;
  display: flex; align-items: stretch;
  background: rgba(0, 229, 204, 0.08);
  border: 1px solid rgba(0, 229, 204, 0.2);
  border-radius: 8px; overflow: visible;
}
.insert-object-btn .ins-obj-main {
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: none; color: var(--teal);
  padding: 8px 12px; cursor: pointer;
  font-family: 'Sora', sans-serif; font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
}
.insert-object-btn .ins-obj-main:hover { background: rgba(0, 229, 204, 0.12); border-radius: 8px; }
.insert-object-btn .ins-obj-main svg { stroke: currentColor; fill: none; stroke-width: 2; }
.insert-object-btn .insert-object-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  min-width: 170px; max-height: 70vh; overflow-y: auto;
  background: var(--dark-card, #0d1e35);
  border: 1px solid rgba(0, 229, 204, 0.15);
  border-radius: 8px; padding: 6px;
  display: none; flex-direction: column; gap: 2px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); z-index: 210;
}
.insert-object-btn .insert-object-menu.open { display: flex; }
.insert-object-btn .insert-object-menu .download-opt { text-align: left; padding: 6px 10px; font-size: 12px; }
/* Insert submenu groups (Image / Video with Upload + AI Generate sub-options) */
.ins-submenu-group { display: flex; flex-direction: column; gap: 1px; }
.ins-submenu-label {
  padding: 6px 10px 3px; font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,0.35); letter-spacing: 0.05em;
  text-transform: uppercase; pointer-events: none;
}
.ins-sub { padding-left: 22px !important; font-size: 11px !important; }
body.light-mode .ins-submenu-label { color: #999; }
body.light-mode .insert-object-btn { background: rgba(0, 133, 119, 0.08); border-color: rgba(0, 133, 119, 0.2); }
body.light-mode .insert-object-btn .ins-obj-main { color: #008577; }
body.light-mode .insert-object-btn .insert-object-menu { background: rgba(245, 247, 250, 0.98); border-color: rgba(0, 0, 0, 0.1); }

/* ══════════════════════════════════════════════
   INSPECTOR PANEL
   ══════════════════════════════════════════════ */
.inspector-panel {
  position: fixed; right: -340px; top: 80px; bottom: 80px;
  width: 280px; z-index: 195;
  background: rgba(13,30,53,0.92);
  border: 1px solid rgba(0,229,204,0.18);
  border-radius: 12px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; flex-direction: column;
  overflow: visible;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  transition: right 0.25s cubic-bezier(0.16,1,0.3,1), transform 0.22s ease;
  font-family: 'Manrope', 'Sora', sans-serif;
}
.inspector-panel.open { right: 16px; }

/* Collapsed: slide the whole card off the right edge. The left-edge tab is a
   child of the panel, so it rides the transform and lands at the screen edge.
   translateX(100% + 16px) == panel width + the 16px right gap. */
.panel-collapsed { transform: translateX(calc(100% + 16px)) !important; }

/* Collapse/expand handle pinned to the panel's left edge, vertically centered. */
.panel-edge-tab {
  position: absolute; left: -23px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 52px; z-index: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(13,30,53,0.92); color: var(--gray-light);
  border: 1px solid rgba(0,229,204,0.18); border-right: none;
  border-radius: 12px 0 0 12px;
  box-shadow: -6px 0 16px rgba(0,0,0,0.22);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
}
.panel-edge-tab svg { transform: rotate(180deg); transition: transform 0.2s ease; }   /* expanded → point right (collapse) */
.panel-collapsed .panel-edge-tab svg { transform: rotate(0deg); }                      /* collapsed → point left (expand) */
.panel-edge-tab:hover { color: var(--teal); }
body.light-mode .panel-edge-tab { background: rgba(255,255,255,0.96); color: #1e3347; border-color: rgba(0,0,0,0.1); }
body.light-mode .panel-edge-tab:hover { color: #008577; }

/* Toolbar hover tooltip — instant, styled, consistent across every control. */
.fmt-tip {
  position: fixed; z-index: 200; pointer-events: none;
  background: rgba(13,30,53,0.96); color: #fff;
  font: 500 12px/1.3 'Sora', sans-serif;
  padding: 5px 9px; border-radius: 6px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,0.32);
}

.insp-header-actions { display: flex; align-items: center; gap: 2px; }
/* Bodies clip their own bottom corners now that the panels are overflow:visible. */
.font-picker-panel .fp-body, .inspector-panel .insp-body { border-radius: 0 0 12px 12px; }

.insp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.insp-title {
  font-family: 'Sora', sans-serif;
  font-size: 13px; font-weight: 600; color: #fff;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.insp-close {
  background: none; border: none; color: rgba(255,255,255,0.4);
  font-size: 20px; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.insp-close:hover { color: #fff; background: rgba(255,255,255,0.05); }

.insp-body {
  flex: 1; overflow-y: auto; padding: 8px 0;
}
.insp-body::-webkit-scrollbar { width: 4px; }
.insp-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.insp-empty {
  padding: 32px 16px; text-align: center;
  color: rgba(255,255,255,0.3); font-size: 13px;
}

.insp-section {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.insp-section-title {
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.35);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.insp-type-badge {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 9999px;
  background: rgba(69,208,189,0.15); color: #45d0bd;
  text-transform: uppercase; letter-spacing: 0.04em;
}

.insp-row {
  display: flex; gap: 8px; margin-bottom: 6px; align-items: center;
}

.insp-field {
  flex: 1; display: flex; align-items: center; gap: 4px;
}
.insp-field label {
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.5);
  min-width: 24px; flex-shrink: 0;
}

.insp-field input[type="number"],
.insp-field input[type="text"] {
  width: 100%; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px; color: #fff;
  font-size: 12px; font-family: 'Manrope', sans-serif;
  padding: 5px 6px; outline: none;
  -moz-appearance: textfield;
}
.insp-field input[type="number"]::-webkit-inner-spin-button,
.insp-field input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.insp-field input:focus {
  border-color: rgba(69,208,189,0.5);
}

.insp-field select {
  width: 100%; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px; color: #fff;
  font-size: 12px; font-family: 'Manrope', sans-serif;
  padding: 5px 6px; outline: none; cursor: pointer;
}
.insp-field select option { background: #1e293b; color: #fff; }

.insp-field input[type="color"] {
  width: 28px; height: 28px; border: none; padding: 0;
  border-radius: 6px; cursor: pointer; flex-shrink: 0;
  background: transparent;
}
.insp-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.insp-field input[type="color"]::-webkit-color-swatch { border-radius: 4px; border: 1px solid rgba(255,255,255,0.15); }

.insp-color-text {
  flex: 1 !important;
  width: 60px !important;
  min-width: 0;
}

.insp-field input[type="range"] {
  flex: 1; height: 4px; -webkit-appearance: none;
  background: rgba(255,255,255,0.1); border-radius: 2px; outline: none;
}
.insp-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: #45d0bd; cursor: pointer;
}

.insp-range-val {
  font-size: 11px; color: rgba(255,255,255,0.5);
  min-width: 32px; text-align: right;
}

.insp-field input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: #45d0bd;
}

.insp-reset-crop {
  width: 100%; padding: 6px 12px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; color: rgba(255,255,255,0.7);
  font-size: 11px; font-family: 'Manrope', sans-serif;
  cursor: pointer; transition: all 0.15s;
}
.insp-reset-crop:hover:not(:disabled) { background: rgba(69,208,189,0.15); color: #45d0bd; border-color: rgba(69,208,189,0.3); }
.insp-reset-crop:disabled { opacity: 0.3; cursor: not-allowed; }

/* Light mode */
body.light-mode .inspector-panel {
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
body.light-mode .insp-title { color: #111; }
body.light-mode .insp-close { color: #adadad; }
body.light-mode .insp-close:hover { color: #111; background: rgba(0,0,0,0.04); }
body.light-mode .insp-section { border-bottom-color: rgba(0,0,0,0.05); }
body.light-mode .insp-section-title { color: #adadad; }
body.light-mode .insp-field label { color: #666; }
body.light-mode .insp-field input[type="number"],
body.light-mode .insp-field input[type="text"] {
  background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.1); color: #111;
}
body.light-mode .insp-field select {
  background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.1); color: #111;
}
body.light-mode .insp-field select option { background: #fff; color: #111; }
body.light-mode .insp-field input[type="range"] { background: rgba(0,0,0,0.1); }
body.light-mode .insp-range-val { color: #999; }
body.light-mode .insp-empty { color: #adadad; }

/* ══════════════════════════════════════════════
   CONTEXT MENU (right-click)
   ══════════════════════════════════════════════ */
.ctx-menu {
  display: none;
  position: fixed; z-index: 500;
  min-width: 200px;
  background: rgba(13,30,53,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  padding: 6px 0;
  font-family: 'Manrope', sans-serif;
  animation: ctxFadeIn 0.12s ease;
}
@keyframes ctxFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.ctx-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px;
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.85);
  cursor: pointer; transition: background 0.1s ease;
}
.ctx-item:hover { background: rgba(69,208,189,0.12); color: #fff; }
.ctx-disabled { opacity: 0.3; pointer-events: none; }
.ctx-shortcut {
  font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,0.35);
  margin-left: 24px;
}
.ctx-sep {
  height: 1px; margin: 4px 10px;
  background: rgba(255,255,255,0.07);
}
/* Submenu (Order ▸) — Google-Slides-style nested menu. Parent is the
   .ctx-item-has-submenu row, child .ctx-submenu floats out to the right
   on hover. The arrow glyph signals "more inside". */
.ctx-item-has-submenu { position: relative; }
.ctx-submenu-arrow {
  font-size: 11px; color: rgba(255,255,255,0.5);
  margin-left: 24px;
}
.ctx-submenu {
  display: none;
  position: absolute;
  top: -7px;
  left: 100%;
  min-width: 200px;
  background: rgba(13,30,53,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  padding: 6px 0;
  margin-left: 2px;
  z-index: 501;
}
.ctx-submenu.ctx-submenu-left {
  left: auto;
  right: 100%;
  margin-left: 0;
  margin-right: 2px;
}
.ctx-item-has-submenu:hover > .ctx-submenu,
.ctx-item-has-submenu.ctx-submenu-open > .ctx-submenu { display: block; }

/* Light mode */
body.light-mode .ctx-menu {
  background: rgba(255,255,255,0.98);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
body.light-mode .ctx-item { color: #333; }
body.light-mode .ctx-item:hover { background: rgba(69,208,189,0.08); color: #111; }
body.light-mode .ctx-shortcut { color: #adadad; }
body.light-mode .ctx-sep { background: rgba(0,0,0,0.06); }
body.light-mode .ctx-submenu {
  background: rgba(255,255,255,0.98);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
body.light-mode .ctx-submenu-arrow { color: rgba(0,0,0,0.4); }

/* ── METALLIC GLASS CARD STYLING (dark theme) ── */
/* Scoped via [data-theme-mode="dark"] on ancestor OR body:not(.light-mode)
   so glass effects render correctly inside modal/thumbnail previews too. */
body:not(.light-mode) .deck-object[data-has-fill="true"],
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] {
  overflow: hidden;
}
/* Glass top-edge highlight — removed per design system */
/* Glass radial glow — ::after = soft upper-left shine */
body:not(.light-mode) .deck-object[data-has-fill="true"]::after,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 30% 0%, rgba(180,240,220,0.07), transparent);
  pointer-events: none;
  z-index: 0;
}
/* Ensure text content stays above glass effects */
body:not(.light-mode) .deck-object[data-has-fill="true"] .obj-text-content,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content {
  position: relative;
  z-index: 1;
}
body:not(.light-mode) .deck-object[data-has-fill="true"] .stat-card-inner,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-card-inner {
  position: relative;
  z-index: 1;
}
/* ── Dark theme fact card (text card with fill) — matches design system ── */
/* Left accent bar */
body:not(.light-mode) .deck-object[data-has-fill="true"],
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] {
  border-left: 2px solid #3dd6a3;
}
body:not(.light-mode) .deck-object[data-has-fill="true"][data-accent-color="purple"],
[data-theme-mode="dark"] .deck-object[data-has-fill="true"][data-accent-color="purple"] {
  border-left-color: #a78bfa;
}
/* fact-tag: first strong = small uppercase label */
body:not(.light-mode) .deck-object[data-has-fill="true"] .obj-text-content strong:first-child,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content strong:first-child {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #3dd6a3;
  display: block;
  margin-bottom: 8px;
}
/* fact-val: body text = 14px / 300 weight */
body:not(.light-mode) .deck-object[data-has-fill="true"] .obj-text-content,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.5;
  color: #e8f0f8;
}
/* Inline bold in card body — teal highlight */
body:not(.light-mode) .deck-object[data-has-fill="true"] .obj-text-content strong,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content strong {
  color: #5ee8b5;
  font-weight: 500;
}
/* Stat card: transparent inner when parent has gradient fill */
body:not(.light-mode) .deck-object[data-has-fill="true"] .stat-card-inner,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-card-inner {
  background: transparent;
  border-color: transparent;
}
/* Stat label stays --text-primary (#e8f0f8) per design system, even when
   parent card has its own fill. --text-secondary (#7a9bb5) is for stat-desc. */
body:not(.light-mode) .deck-object[data-has-fill="true"] .stat-label,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-label {
  color: #e8f0f8;
}
body:not(.light-mode) .deck-object[data-has-fill="true"] .stat-desc,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-desc {
  color: #7a9bb5;
}

/* ════════════════════════════════════════════
   CLEAN LIGHT — Card overrides
   Scoped via [data-theme-mode="light"] or body.light-mode
════════════════════════════════════════════ */
/* Card text — DM Sans, body weight 300, heading navy */
body.light-mode .deck-object[data-has-fill="true"] .obj-text-content,
[data-theme-mode="light"] .deck-object[data-has-fill="true"] .obj-text-content {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  color: #64748B;
  line-height: 1.6;
}
/* Card heading (first strong) — mono tag style: small uppercase teal */
body.light-mode .deck-object[data-has-fill="true"] .obj-text-content strong:first-child,
[data-theme-mode="light"] .deck-object[data-has-fill="true"] .obj-text-content strong:first-child {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #14A89F;
  display: block;
  margin-bottom: 8px;
}
/* Inline bold in card body — teal2 highlight */
body.light-mode .deck-object[data-has-fill="true"] .obj-text-content strong,
[data-theme-mode="light"] .deck-object[data-has-fill="true"] .obj-text-content strong {
  color: #14A89F;
  font-weight: 500;
}
/* Clean Light cards — overflow hidden, compact padding */
body.light-mode .deck-object[data-has-fill="true"],
[data-theme-mode="light"] .deck-object[data-has-fill="true"] {
  overflow: hidden;
}
body.light-mode .deck-object[data-object-type="text"][data-has-fill="true"][data-has-text-content="true"],
[data-theme-mode="light"] .deck-object[data-object-type="text"][data-has-fill="true"][data-has-text-content="true"],
body.light-mode .deck-object[data-object-type="text"][data-has-border="true"][data-has-text-content="true"],
[data-theme-mode="light"] .deck-object[data-object-type="text"][data-has-border="true"][data-has-text-content="true"] {
  padding: 14px 18px;
}
body.light-mode .deck-object[data-has-fill="true"]::before,
[data-theme-mode="light"] .deck-object[data-has-fill="true"]::before {
  display: none;
}
body.light-mode .deck-object[data-has-fill="true"]::after,
[data-theme-mode="light"] .deck-object[data-has-fill="true"]::after {
  display: none;
}

/* ── AI engine badge ─────────────────────────────────────────────────
   Small "AI engine · <model>" pill that lives inside every AI-gen
   modal (dashboard GenerateModal, editor AddSlideModal, editor
   AIReplaceModal) directly under the primary Generate button. Tells
   the user which backend actually runs the generation, and gives
   Rainy a visible smoke-test that a model swap landed.

   Shared class so all three modals look identical. Kept in blocks.css
   (loaded by both dashboard.html and editor.html) so a modal doesn't
   have to inject its own copy of the styles.

   JS updates the model text via `#ai-engine-badge-model` fetches to
   `/models`; the SSR-safe hard-coded fallback in each modal keeps the
   pill readable if the sidecar is unreachable. (Rainy 2026-07-02.) */
.ai-engine-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  color: rgba(35, 31, 32, 0.62);
  background: rgba(69, 208, 189, 0.06);
  border: 1px solid rgba(69, 208, 189, 0.18);
  border-radius: 999px;
  letter-spacing: 0.01em;
  user-select: none;
  white-space: nowrap;
}
.ai-engine-badge-icon {
  color: #45d0bd;
  flex-shrink: 0;
}
/* Selector variant — same pill shell as .ai-engine-badge, but with an
   inline <select> the user can change. Reuses `.ai-engine-badge-icon`
   for the sparkle. The select is styled to look like part of the pill
   (no default OS dropdown chrome around the label; the caret still
   shows so it's discoverable as interactive). (Rainy 2026-07-06 —
   badge → dropdown so user can pick Claude / GPT-5 per generation.) */
.ai-engine-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  color: rgba(35, 31, 32, 0.62);
  background: rgba(69, 208, 189, 0.06);
  border: 1px solid rgba(69, 208, 189, 0.18);
  border-radius: 999px;
  letter-spacing: 0.01em;
  user-select: none;
  white-space: nowrap;
  cursor: pointer;
}
.ai-engine-selector:hover {
  background: rgba(69, 208, 189, 0.10);
  border-color: rgba(69, 208, 189, 0.28);
}
/* Strip ALL browser chrome (default button/menulist chrome, focus
   outline, borders) so the <select> reads as plain text inside the
   pill instead of a nested control — pill already carries the
   affordance (border + teal tint + hover state). A small custom
   chevron is drawn on the right via background-image so it's still
   discoverable as a picker. (Rainy 2026-07-06 — the default focus
   outline stacked a second teal ring inside the pill's border,
   reading as double-boxed / "很丑".) */
.ai-engine-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='rgba(35,31,32,0.55)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='3 4.8 6 7.6 9 4.8'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 10px 10px;
  border: 0;
  padding: 0 14px 0 4px;
  margin: 0;
  font: inherit;
  color: rgba(35, 31, 32, 0.85);
  font-weight: 600;
  cursor: pointer;
  outline: none;
  box-shadow: none;
}
.ai-engine-select:focus,
.ai-engine-select:focus-visible {
  outline: none;
  box-shadow: none;
}
