/* ═══════════════════════════════════════════════════════════
   generate-modal.css — AI deck generation modal
   3 states: input → progress → preview
   ═══════════════════════════════════════════════════════════ */

/* ── Deck engine CSS variables needed by blocks.css for slide rendering ── */
.gen-studio-canvas,
.gen-studio-slide-thumb {
  --teal: #00e5cc;
  --teal-dim: #00b8a4;
  --teal-glow: rgba(0,229,204,0.15);
  --navy: #060d1a;
  --navy-mid: #0d1e35;
  --navy-light: #142641;
  --dark-card: #0d1e35;
  --white: #f0f4f8;
  --gray: #8ea3b8;
  --gray-light: #c5d2de;
  --purple: #7b61ff;
  --purple-dim: rgba(123,97,255,0.2);
}

/* ── Overlay ── */
.gen-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s ease;
  font-family: var(--font-body, 'Manrope', sans-serif);
}
.gen-modal-overlay.open {
  display: flex;
  opacity: 1;
}

body.light-mode .gen-modal-overlay {
  background: rgba(35, 31, 32, 0.18);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
}

/* ── Modal shell ── */
.gen-modal {
  background: var(--surface, #1e293b);
  border-radius: 24px;
  width: min(720px, 92vw);
  max-height: min(86vh, 760px);
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5),
              0 0 0 1px rgba(69, 208, 189, 0.18);
  display: flex;
  flex-direction: column;
  transform: translateY(8px) scale(0.98);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-primary, #fff);
}
.gen-modal-overlay.open .gen-modal {
  transform: translateY(0) scale(1);
}

/* Full-page mode for progress and preview states */
.gen-modal[data-state="progress"],
.gen-modal[data-state="preview"] {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  box-shadow: none;
  position: relative;
}

/* Frosted-glass card — bumped opacity to 0.85 (was 0.55) so the card
   reads as solid white-glass even when sitting on a darker viewport
   behind. The 0.55 spec used for templates-modal got too gray here
   because gen-modal's overlay is darker by default. */
body.light-mode .gen-modal {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.98),
    inset 0 -1px 1px rgba(69, 208, 189, 0.10),
    0 1px 2px rgba(35, 31, 32, 0.04),
    0 12px 32px -8px rgba(69, 208, 189, 0.18),
    0 24px 56px -20px rgba(35, 31, 32, 0.12);
  color: var(--text, #231F20);
}
body.light-mode .gen-modal[data-state="progress"],
body.light-mode .gen-modal[data-state="preview"] {
  background: #ffffff;
  border: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

/* ── Header ── */
.gen-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0 28px;
  flex-shrink: 0;
}

.gen-modal-title {
  font-family: var(--font-heading, 'Sora', sans-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  display: flex;
  align-items: center;
  gap: 10px;
}

.gen-modal-title-icon {
  display: inline-flex;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #45d0bd, #44b6e9);
  align-items: center;
  justify-content: center;
  color: #fff;
}

.gen-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: all 0.15s ease;
}
.gen-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary, #fff);
}
body.light-mode .gen-modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ── Body ── */
.gen-modal-body {
  padding: 24px 28px 28px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.gen-modal[data-state="progress"] .gen-modal-body,
.gen-modal[data-state="preview"] .gen-modal-body {
  padding: 0;
  overflow: hidden;
}

/* ── State visibility ── */
.gen-state {
  display: none;
  width: 100%;
  flex-direction: column;
  gap: 18px;
}
.gen-modal[data-state="input"] .gen-state-input { display: flex; }
.gen-modal[data-state="progress"] .gen-state-progress { display: flex; }
.gen-modal[data-state="preview"] .gen-state-preview { display: flex; }

/* ── Input state ── */
.gen-prompt-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gen-prompt-input {
  width: 100%;
  min-height: 120px;
  max-height: 240px;
  resize: vertical;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  color: var(--text-primary, #fff);
  font-family: var(--font-body, 'Manrope', sans-serif);
  font-size: 15px;
  line-height: 1.5;
  outline: none;
  transition: border 0.18s ease, background 0.18s ease;
}
.gen-prompt-input::placeholder {
  color: var(--text-muted, rgba(255, 255, 255, 0.35));
}
.gen-prompt-input:focus {
  border-color: rgba(69, 208, 189, 0.6);
  background: rgba(255, 255, 255, 0.06);
}
body.light-mode .gen-prompt-input {
  background: #f6f8fa;
  border-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .gen-prompt-input:focus {
  background: #ffffff;
  border-color: rgba(69, 208, 189, 0.7);
}

/* ── Style picker (visual cards matching New Blank Deck templates) ── */
.gen-style-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.gen-modal-overlay.gen-modal--style-locked .gen-style-section {
  display: none;
}

/* Style card — clean tile with no border by default. Selected state
   uses a soft teal background-tint + pinned checkmark badge in the
   top-right (no harsh stroke, no radius mismatch with the preview). */
.gen-style-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px;
  background: transparent;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition:
    background 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
}
.gen-style-card:hover {
  background: rgba(35, 31, 32, 0.04);
  transform: translateY(-1px);
}
.gen-style-card.active {
  background: rgba(69, 208, 189, 0.10);
  box-shadow:
    inset 0 0 0 1px rgba(69, 208, 189, 0.20),
    0 4px 14px -6px rgba(69, 208, 189, 0.22);
}
/* Pinned frosted-glass checkmark badge — teal→blue brand gradient
   under semi-transparent layer, backdrop-blur frosts whatever sits
   behind (the slide thumbnail), inset highlight + soft teal glow. */
.gen-style-card.active::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='3 7.2 5.7 10 11 4.4'/></svg>"),
    linear-gradient(135deg, rgba(127, 232, 213, 0.62) 0%, rgba(68, 182, 233, 0.62) 100%);
  background-size: 14px 14px, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.85),
    inset 0 -1px 1px rgba(68, 182, 233, 0.18),
    0 4px 12px -2px rgba(69, 208, 189, 0.35);
}
/* Light-mode lookups —— mostly inherits from above; only adjust hover
   bg to a subtle gray since light bg suits a darker tint. */
body.light-mode .gen-style-card:hover {
  background: rgba(35, 31, 32, 0.05);
}

.gen-style-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
body.light-mode .gen-style-preview {
  border-color: rgba(0, 0, 0, 0.06);
}

.gen-style-title {
  position: absolute;
  bottom: 16%;
  left: 10%;
  font-family: var(--font-heading, 'Sora', sans-serif);
  font-size: 20px;
  font-weight: 800;
  pointer-events: none;
}

.gen-style-deco {
  position: absolute;
  pointer-events: none;
}

.gen-style-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted, rgba(255, 255, 255, 0.4));
  letter-spacing: 0.03em;
  padding-bottom: 4px;
}

@media (max-width: 480px) {
  .gen-style-picker { grid-template-columns: repeat(2, 1fr); }
}

/* ── CSV dropzone ── */
.gen-dropzone {
  border: 2px dashed rgba(69, 208, 189, 0.35);
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(69, 208, 189, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.gen-dropzone:hover,
.gen-dropzone.drag-over {
  border-color: rgba(69, 208, 189, 0.8);
  background: rgba(69, 208, 189, 0.08);
}

.gen-dropzone-icon {
  color: var(--color-accent, #45d0bd);
  margin-bottom: 4px;
}

.gen-dropzone-text {
  font-size: 13px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}
.gen-dropzone-text strong {
  color: var(--color-accent, #45d0bd);
  font-weight: 600;
}

.gen-dropzone-hint {
  font-size: 11px;
  color: var(--text-muted, rgba(255, 255, 255, 0.4));
  margin-top: 2px;
}

/* ── File list (multi-file chips) ── */
.gen-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gen-file-chip {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(69, 208, 189, 0.1);
  border: 1px solid rgba(69, 208, 189, 0.25);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-primary, #fff);
  max-width: 260px;
}
.gen-file-chip.active { display: inline-flex; }
.gen-file-chip-icon { font-size: 14px; flex-shrink: 0; }
.gen-file-chip-name {
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.gen-file-chip-meta {
  font-size: 10px;
  color: var(--text-muted, rgba(255, 255, 255, 0.5));
  flex-shrink: 0;
}
.gen-file-chip-remove {
  background: none;
  border: none;
  color: var(--text-muted, rgba(255, 255, 255, 0.5));
  cursor: pointer;
  font-size: 14px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.gen-file-chip-remove:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary, #fff);
}

/* ── Footer / actions ── */
.gen-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 28px 24px 28px;
  flex-shrink: 0;
}
/* Push Cancel / Back to the LEFT corner. Rainy 2026-05-13: bottom-
   right is the spot users instinctively reach for the primary action
   (Generate / Open in Editor), so a Cancel sitting there gets
   misclicked. Pinning the destructive/back buttons against the left
   edge with `margin-right: auto` keeps the right corner reserved for
   the primary action in every state (preview shows Open in Editor at
   the right; input has Generate in the prompt card itself). */
.gen-modal-actions .gen-action-cancel-input,
.gen-modal-actions .gen-action-cancel-progress,
.gen-modal-actions .gen-action-back {
  margin-right: auto;
}

/* Sticky Generate fallback — hidden by default. Surfaces only when:
   (a) the modal is in the input state (so the action is meaningful)
   AND
   (b) `.gen-prompt-offscreen` is set on the overlay (the prompt card
   has scrolled out of view inside `.gen-modal-body`). Rainy 2026-05-
   13: scrolling down to pick a style buried the in-card Generate
   button; this fallback gives the user a way to submit without
   scrolling back up.

   Fades in / slides up briefly so the appearance reads as connected
   to the user's scroll motion rather than a UI pop-in. */
/* Chain `.gen-btn` into the sticky-button selectors to bump specificity
   from (0,0,1,0) → (0,0,2,0), which beats the later `.gen-btn { display:
   inline-flex }` baseline. Otherwise the baseline wins on cascade order
   and the sticky button stays visible by default (Rainy 2026-05-13:
   "还是存在啊" — sticky showed even before scrolling past the prompt). */
.gen-btn.gen-action-generate-sticky {
  display: none;
  align-items: center;
  gap: 8px;
}
.gen-btn.gen-action-generate-sticky svg { stroke-width: 1.8; }
.gen-modal-overlay.gen-prompt-offscreen
  .gen-modal[data-state="input"]
  .gen-btn.gen-action-generate-sticky {
  display: inline-flex;
  animation: genStickyFadeIn 0.18s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes genStickyFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* In full-page mode, float actions on top of content */
.gen-modal[data-state="progress"] .gen-modal-actions,
.gen-modal[data-state="preview"] .gen-modal-actions {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  padding: 16px 28px;
  background: linear-gradient(transparent, var(--surface, #1e293b) 40%);
  z-index: 10;
}

body.light-mode .gen-modal[data-state="progress"] .gen-modal-actions,
body.light-mode .gen-modal[data-state="preview"] .gen-modal-actions {
  background: linear-gradient(transparent, #ffffff 40%);
}

.gen-btn {
  font-family: var(--font-body, 'Manrope', sans-serif);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 12px;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.gen-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary, rgba(255, 255, 255, 0.75));
}
.gen-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #fff);
}
body.light-mode .gen-btn-secondary {
  background: #f1f2f3;
  color: #333;
}
body.light-mode .gen-btn-secondary:hover {
  background: #e6e7e8;
}

.gen-btn-primary {
  background: linear-gradient(90deg, #45d0bd, #44b6e9);
  color: #fff;
  box-shadow: 0 4px 16px rgba(69, 208, 189, 0.35);
}
.gen-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(69, 208, 189, 0.5);
}
.gen-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Spinner ── */
.gen-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(69, 208, 189, 0.18);
  border-top-color: #45d0bd;
  animation: gen-spin 0.85s linear infinite;
  flex-shrink: 0;
}

.gen-spinner-sm {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

@keyframes gen-spin {
  to { transform: rotate(360deg); }
}

.gen-progress-msg {
  font-family: var(--font-heading, 'Sora', sans-serif);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #fff);
  transition: opacity 0.3s ease;
  line-height: 1.3;
}

.gen-progress-sub {
  font-size: 11px;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
}

/* ── Studio layout (progress + preview states) ── */
.gen-state-progress,
.gen-state-preview {
  height: 100%;
}

.gen-studio {
  display: flex;
  height: 100%;
  width: 100%;
}

/* Sidebar */
.gen-studio-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.15);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.light-mode .gen-studio-sidebar {
  background: #f0f2f5;
  border-right-color: rgba(0, 0, 0, 0.08);
}

.gen-studio-sidebar-header {
  padding: 16px 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

body.light-mode .gen-studio-sidebar-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.gen-studio-status {
  flex: 1;
  min-width: 0;
}

.gen-preview-sidebar-header {
  padding: 16px;
}

.gen-preview-header {
  font-family: var(--font-heading, 'Sora', sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #fff);
}

.gen-studio-slide-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Slide thumbnail in sidebar */
.gen-studio-slide-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.gen-studio-slide-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
body.light-mode .gen-studio-slide-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.gen-studio-slide-item.active {
  background: rgba(69, 208, 189, 0.12);
  outline: 2px solid rgba(69, 208, 189, 0.5);
  outline-offset: -2px;
  border-radius: 8px;
}

.gen-studio-slide-num {
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: rgba(69, 208, 189, 0.6);
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.gen-studio-slide-thumb {
  flex: 1;
  min-width: 0;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  /* Enable container queries so the scaled 1920×1080 slide below can self-size
     via `100cqw / 1920` — eliminates the rAF timing gap that caused right-edge
     whitespace when the sidebar width shifted mid-streaming. */
  container-type: inline-size;
}

body.light-mode .gen-studio-slide-thumb {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
}

.gen-studio-slide-thumb > .slide,
.gen-studio-slide-thumb > section.slide {
  transform-origin: top left;
  width: 1920px !important;
  height: 1080px !important;
  pointer-events: none;
  overflow: hidden;
  /* CSS-driven scale — always matches container width exactly, no JS rAF
     timing issues. `100cqw` is the container's inline size in length units;
     dividing by `1920px` (length/length) produces a unitless ratio that
     scale() accepts. Writing `/ 1920` (no unit) would make the result a
     length, which scale() silently rejects → thumb reverts to 1920×1080
     raw and overflows, which is what killed the preview thumbs initially. */
  transform: scale(calc(100cqw / 1920px));
}
/* Force all objects visible in thumbnails (skip entrance animations) */
.gen-studio-slide-thumb .anim-pending {
  opacity: 1 !important;
}

.gen-studio-slide-info {
  flex: 1;
  min-width: 0;
}

.gen-studio-slide-title {
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.gen-studio-slide-type {
  font-family: 'Manrope', sans-serif;
  font-size: 9px;
  font-weight: 500;
  color: rgba(69, 208, 189, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Active slide indicator (writing) */
.gen-studio-slide-item.writing .gen-studio-slide-thumb {
  border-color: rgba(69, 208, 189, 0.4);
  box-shadow: 0 0 12px rgba(69, 208, 189, 0.1);
}

.gen-studio-slide-item.writing::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #45d0bd;
  animation: gen-pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes gen-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Main canvas area */
.gen-studio-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-width: 0;
  position: relative;
  background: rgba(0, 0, 0, 0.08);
}

body.light-mode .gen-studio-main {
  background: #e8eaed;
}

.gen-studio-canvas {
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  /* Matches the biostate-dark slide bg so the generation canvas already looks
     like the slide it's about to produce — no jarring white→dark flash. */
  background: #020d10;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
/* 22×22 white dot-grid overlay — same token as .slide::before in the deck */
.gen-studio-canvas::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
}

/* Force the biostate-dark aesthetic even in light mode while generating */
body.light-mode .gen-studio-canvas {
  background: #020d10;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.gen-studio-canvas > .slide {
  transform-origin: top left;
  width: 1920px !important;
  height: 1080px !important;
  pointer-events: none;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.gen-studio-canvas-label {
  margin-top: 12px;
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
  text-align: center;
  min-height: 20px;
}

/* Empty state — biostate-dark loading with particle ring */
.gen-studio-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
}
/* Particle ring canvas — drawn by _startParticleRing() in generate-modal.js.
   aspect-ratio: 1/1 keeps it a perfect circle regardless of container shape.
   Grid overlay (column/row 1) puts it in the same cell as the text so the
   text sits at the center of the ring instead of stacked below it. */
.gen-particle-ring {
  grid-column: 1;
  grid-row: 1;
  width: min(420px, 55vmin);
  aspect-ratio: 1 / 1;
  height: auto;
  display: block;
  pointer-events: none;
}

.gen-studio-empty-text {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  z-index: 1;
  font-family: 'Manrope', 'Inter', sans-serif;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  line-height: 1.5;
  letter-spacing: 0.01em;
}
.gen-empty-line1 {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
  text-shadow: 0 0 20px rgba(61,214,163,0.3);
}
.gen-empty-line2 {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}
.gen-empty-line3 {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
}
body.light-mode .gen-empty-line1 { color: #ffffff; }
body.light-mode .gen-empty-line2 { color: rgba(255,255,255,0.6); }
body.light-mode .gen-empty-line3 { color: rgba(255,255,255,0.4); }

/* Live content preview in main canvas (during streaming) */
.gen-studio-live {
  position: absolute;
  inset: 0;
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gen-studio-live-badge {
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: rgba(69, 208, 189, 0.8);
  background: rgba(69, 208, 189, 0.1);
  border: 1px solid rgba(69, 208, 189, 0.2);
  padding: 3px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  align-self: flex-start;
}

.gen-studio-live-title {
  font-family: 'Sora', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

body.light-mode .gen-studio-live-title {
  color: rgba(0, 0, 0, 0.8);
}

/* Wireframe layout preview */
.gen-studio-wireframe {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 12px;
  gap: 6px;
  animation: gen-wireframe-in 0.4s ease;
}

@keyframes gen-wireframe-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dark mode for live canvas */
.gen-studio-live.dark .gen-studio-live-title {
  color: rgba(255, 255, 255, 0.85);
}

.gen-studio-live.dark .gen-studio-live-badge {
  color: rgba(69, 208, 189, 0.9);
}

.gen-studio-live-loader {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(69, 208, 189, 0.08);
}

.gen-studio-live-loader-bar {
  width: 35%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(69, 208, 189, 0.6), transparent);
  border-radius: 2px;
  animation: gen-build-sweep 1.5s ease-in-out infinite;
}

/* ── Error inline ── */
.gen-error {
  display: none;
  margin-top: 6px;
  padding: 12px 14px;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: 10px;
  color: #f87171;
  font-size: 13px;
  line-height: 1.4;
}
.gen-error.active { display: block; }

/* ── Featured action card (Dashboard side) ── */
.action-card.action-card-featured {
  background: linear-gradient(135deg, rgba(69, 208, 189, 0.15), rgba(68, 182, 233, 0.12));
  border-color: rgba(69, 208, 189, 0.4);
  position: relative;
}
.action-card.action-card-featured::before {
  opacity: 1 !important;
  background: linear-gradient(135deg, #45d0bd, #44b6e9, #8258c8);
}
.action-card.action-card-featured:hover {
  box-shadow: 0 12px 32px rgba(69, 208, 189, 0.35),
              0 0 0 1px rgba(69, 208, 189, 0.55);
}
.action-card.action-card-featured .action-icon {
  background: linear-gradient(135deg, #45d0bd, #44b6e9);
  color: #fff;
  box-shadow: 0 6px 20px rgba(69, 208, 189, 0.45);
}
.action-card.action-card-featured .action-label {
  background: linear-gradient(90deg, #45d0bd, #44b6e9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}
.action-card.action-card-featured .action-sparkle {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(69, 208, 189, 0.18);
  color: #45d0bd;
  padding: 3px 8px;
  border-radius: 999px;
}

@media (max-width: 768px) {
  .gen-modal { width: 96vw; }
  .gen-modal-body { padding: 20px 18px 22px; }
  .gen-modal-header { padding: 18px 18px 0 18px; }
  .gen-modal-actions { padding: 0 18px 18px 18px; }
}

@keyframes gen-build-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ── Build overlay — Figma-style dashed selection box with handles ── */
.gen-build-overlay {
  position: absolute;
  z-index: 10;
  border: 1.5px dashed rgba(61, 214, 163, 0.7);
  border-radius: 0;
  pointer-events: none;
  opacity: 0;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              top 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
  background: transparent;
}
/* Corner handles — 4 small white squares */
.gen-build-handle {
  position: absolute;
  width: 7px; height: 7px;
  background: #ffffff;
  border: 1px solid rgba(61, 214, 163, 0.8);
  z-index: 11;
  pointer-events: none;
}
.gen-build-handle.tl { top: -4px; left: -4px; }
.gen-build-handle.tr { top: -4px; right: -4px; }
.gen-build-handle.bl { bottom: -4px; left: -4px; }
.gen-build-handle.br { bottom: -4px; right: -4px; }
/* Mid-edge handles */
.gen-build-handle.tm { top: -4px; left: 50%; transform: translateX(-50%); }
.gen-build-handle.bm { bottom: -4px; left: 50%; transform: translateX(-50%); }
.gen-build-handle.ml { top: 50%; left: -4px; transform: translateY(-50%); }
.gen-build-handle.mr { top: 50%; right: -4px; transform: translateY(-50%); }

/* Object type label shown above the selection box */
.gen-build-label {
  position: absolute;
  top: -22px; left: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.5px;
  color: #3dd6a3;
  background: rgba(13, 17, 23, 0.85);
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.gen-build-overlay.active .gen-build-label { opacity: 1; }

/* ── Build layer — single container above ALL slide content ── */
.gen-build-layer {
  position: absolute;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  border-radius: 12px;
}
.gen-build-layer-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.77);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  transition: opacity 0.5s ease;
}

/* ── Typewriter blinking caret (appended via JS during _typewriterEl) ── */
.gen-typing-caret::after {
  content: '';
  display: inline-block;
  width: 0.08em;
  height: 1em;
  margin-left: 2px;
  background: currentColor;
  vertical-align: text-bottom;
  animation: genCaretBlink 0.7s steps(2, start) infinite;
  opacity: 0.85;
}
@keyframes genCaretBlink {
  to { visibility: hidden; }
}

/* ── Particle ring overlay (inside build layer) ── */
.gen-particle-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.gen-particle-overlay canvas {
  width: 100%; height: 100%;
  display: block;
}
.gen-particle-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 9;
  pointer-events: none;
}
.gen-particle-text-main {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px; font-weight: 500;
  color: #ffffff;
  text-shadow: 0 0 20px rgba(61, 214, 163, 0.4);
  line-height: 1.5;
  max-width: 280px;
  margin: 0 auto;
}
.gen-particle-text-sub {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px; font-weight: 400;
  color: #7a9bb5;
  margin-top: 8px;
}

/* ── Dark-theme slide rules scoped to generation containers ──
   These duplicate blocks.css body:not(.light-mode) rules so we never
   need to toggle the body class (which would flash the whole page dark).
   Uses [data-theme-mode="dark"] set by JS on the canvas/thumb element. */
.gen-studio-canvas[data-theme-mode="dark"] .deck-object[data-has-fill="true"],
.gen-studio-slide-thumb[data-theme-mode="dark"] .deck-object[data-has-fill="true"] {
  overflow: hidden;
  border-left: 2px solid #3dd6a3;
}
/* Top-edge shine removed per design system */
.gen-studio-canvas[data-theme-mode="dark"] .deck-object[data-has-fill="true"]::after,
.gen-studio-slide-thumb[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;
}
.gen-studio-canvas[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content,
.gen-studio-slide-thumb[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content {
  position: relative;
  z-index: 1;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.5;
  color: #e8f0f8;
}
/* fact-tag: first strong = small uppercase label */
.gen-studio-canvas[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content strong:first-child,
.gen-studio-slide-thumb[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content strong:first-child {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #3dd6a3;
  display: block;
  margin-bottom: 8px;
}
.gen-studio-canvas[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content strong,
.gen-studio-slide-thumb[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content strong {
  color: #5ee8b5;
  font-weight: 500;
}
.gen-studio-canvas[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-card-inner,
.gen-studio-slide-thumb[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-card-inner {
  position: relative;
  z-index: 1;
}
.gen-studio-canvas[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content strong,
.gen-studio-slide-thumb[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content strong {
  color: #3dd6a3;
}
/* Stat label stays --text-primary (#e8f0f8) per biostate-dark design system
   in gen modal canvas/thumb contexts.
   Specificity (0,0,3,0) beats the dashboard-body-leak rule
   `body.light-mode .stat-label` (0,0,2,1), so this wins even when the
   dashboard is in light mode while previewing a dark-themed slide.
   Does NOT require data-has-fill — stat cards don't set it on the outer deck-object. */
.gen-studio-canvas[data-theme-mode="dark"] .stat-label,
.gen-studio-slide-thumb[data-theme-mode="dark"] .stat-label {
  color: #e8f0f8;
}
.gen-studio-canvas[data-theme-mode="dark"] .stat-desc,
.gen-studio-slide-thumb[data-theme-mode="dark"] .stat-desc {
  color: #7a9bb5;
}

/* Override body.light-mode stat-card rules that would wrongly style
   dark-theme slides inside the generation modal */
.gen-studio-canvas[data-theme-mode="dark"] .stat-card-inner,
.gen-studio-slide-thumb[data-theme-mode="dark"] .stat-card-inner {
  background: rgba(0,229,204,0.04);
  border-color: rgba(0,229,204,0.12);
}
.gen-studio-canvas[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-card-inner,
.gen-studio-slide-thumb[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-card-inner {
  background: transparent;
  border-color: transparent;
}

/* ── Slide background layer CSS (from deck-engine.css, not loaded on dashboard) ── */

/* Aurora canvas bg (Biostate Dark) */
.gen-studio-canvas .aurora-canvas,
.gen-studio-slide-thumb .aurora-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.gen-studio-canvas .aurora-dot-grid,
.gen-studio-slide-thumb .aurora-dot-grid {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 18px 18px;
}
.gen-studio-canvas .aurora-grain,
.gen-studio-slide-thumb .aurora-grain {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: white; opacity: 0.08;
  mix-blend-mode: overlay;
  filter: url(#grain-filter);
}

/* Midnight purple bg */
.gen-studio-canvas .midnight-bg,
.gen-studio-slide-thumb .midnight-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url('midnight-bg.svg') center/cover no-repeat;
}
.gen-studio-canvas .midnight-orb,
.gen-studio-slide-thumb .midnight-orb {
  position: absolute; border-radius: 50%; pointer-events: none;
  mix-blend-mode: screen; z-index: 1;
  animation: midnightBreathe var(--dur, 4s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.gen-studio-canvas .midnight-orb1,
.gen-studio-slide-thumb .midnight-orb1 {
  width: 20%; height: 67%; top: 8%; left: -5%;
  background: radial-gradient(ellipse at 60% 30%, #a0eeff 0%, #4488ff 30%, #6633cc 65%, transparent 100%);
  filter: blur(28px); opacity: 0.75; --dur: 5.2s; --delay: 0s;
}
.gen-studio-canvas .midnight-orb2,
.gen-studio-slide-thumb .midnight-orb2 {
  width: 48%; height: 86%; top: 4%; right: -6%;
  background: radial-gradient(ellipse at 40% 35%, #88aaff 0%, #cc44ff 35%, #6622cc 60%, #330088 80%, transparent 100%);
  filter: blur(32px); opacity: 0.8; --dur: 6.8s; --delay: -2.1s;
}
.gen-studio-canvas .midnight-orb3,
.gen-studio-slide-thumb .midnight-orb3 {
  width: 30%; height: 50%; top: 28%; left: 23%;
  background: radial-gradient(ellipse at 50% 50%, rgba(255,102,187,0.33) 0%, rgba(136,68,255,0.27) 50%, transparent 80%);
  filter: blur(50px); opacity: 0.6; --dur: 8s; --delay: -3.5s;
}
.gen-studio-canvas .midnight-overlay,
.gen-studio-slide-thumb .midnight-overlay {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(135deg, rgba(5,3,20,0.55) 0%, rgba(5,3,20,0.2) 60%, rgba(5,3,20,0.45) 100%);
}
.gen-studio-canvas .midnight-grid,
.gen-studio-slide-thumb .midnight-grid {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0.07;
  background-image:
    repeating-linear-gradient(90deg, white 0px, white 2px, transparent 2px, transparent 12.5%);
}

/* ── Dashboard style-preview modal: JsonRenderer baseline (deck-engine.css mirror) ──
   The style-preview modal (window.openStylePreview, dashboard.html L918) renders
   sample deck.json slides DIRECTLY into the dashboard DOM via JsonRenderer — not
   an iframe — and dashboard.html intentionally does NOT load deck-engine.css to
   keep its main-page namespace clean. Net effect: figma-sample slides rendered
   inside .style-modal-thumb-stage are missing the four foundational rules
   JsonRenderer's output depends on. Mirror just those four here, tightly scoped.

   1. `.slide { container-type: size }` — JsonRenderer emits font-size as
      `max(Npx, Ncqw)`. cqw resolves against the nearest ancestor with
      container-type, and figma samples don't wrap in .slide-scale-inner. Without
      this, cqw falls back to viewport → fontSize=40 becomes ~25px instead of
      40px-at-1920px-stage, and long lines (e.g. bold-forms slide 7 description)
      visibly overflow the text box in the scaled thumbnail.
   2. `.obj-image { overflow: hidden; border-radius: 8px }` — JsonRenderer sets
      `el.style.borderRadius` inline (e.g. "0 136 136 0" on bold-forms slide 6
      visibility image) but doesn't set overflow. Without overflow:hidden the
      child <img> isn't clipped → multi-value radii render as straight corners.
   3. `.obj-text-content` wrap rules — JsonRenderer's per-element overflow-wrap
      catches long-word break but pre-wrap whitespace handling lives here.
   4. `.deck-object` position — JsonRenderer adds `position:absolute` inline so
      not strictly required, but mirrored for parity with editor/viewer paint.

   Source of truth: deck-engine.css §JSON-RENDERED OBJECTS (L339, L1978-2010).
   (Rainy 2026-06-16: bold-forms slide 8 Everywhere body 文字 overflow + slide
   7 Visibility image 圆角不对 — both traced to missing deck-engine.css here.) */
.style-modal-thumb-stage .slide {
  container-type: size;
  container-name: stage;
}
.style-modal-thumb-stage .deck-object {
  position: absolute;
  z-index: 2;
}
.style-modal-thumb-stage .obj-image {
  overflow: hidden;
  border-radius: 8px;
  position: relative;
}
.style-modal-thumb-stage .obj-image .obj-image-inner {
  pointer-events: none;
}
.style-modal-thumb-stage .obj-text-content {
  word-wrap: break-word;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ── Dashboard style-preview modal: midnight custom-bg layers ──
   Mirror the gen-studio midnight rules above, scoped to .style-modal-thumb-stage.
   url() resolves relative to this file (engine/) → engine/midnight-bg.svg.
   Values copied 1:1 from deck-engine.css .midnight-* (L53-92).
   (Rainy 2026-06-12: "midnight purple 的 preview 的 cover 和 close bg 不对".) */
.style-modal-thumb-stage .midnight-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url('midnight-bg.svg') center/cover no-repeat;
}
.style-modal-thumb-stage .midnight-orb {
  position: absolute; border-radius: 50%; pointer-events: none;
  mix-blend-mode: screen; z-index: 1;
  animation: midnightBreathe var(--dur, 4s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.style-modal-thumb-stage .midnight-orb1 {
  width: 20%; height: 67%; top: 8%; left: -5%;
  background: radial-gradient(ellipse at 60% 30%, #a0eeff 0%, #4488ff 30%, #6633cc 65%, transparent 100%);
  filter: blur(28px); opacity: 0.75; --dur: 5.2s; --delay: 0s;
}
.style-modal-thumb-stage .midnight-orb2 {
  width: 48%; height: 86%; top: 4%; right: -6%;
  background: radial-gradient(ellipse at 40% 35%, #88aaff 0%, #cc44ff 35%, #6622cc 60%, #330088 80%, transparent 100%);
  filter: blur(32px); opacity: 0.8; --dur: 6.8s; --delay: -2.1s;
}
.style-modal-thumb-stage .midnight-orb3 {
  width: 30%; height: 50%; top: 28%; left: 23%;
  background: radial-gradient(ellipse at 50% 50%, rgba(255,102,187,0.33) 0%, rgba(136,68,255,0.27) 50%, transparent 80%);
  filter: blur(50px); opacity: 0.6; --dur: 8s; --delay: -3.5s;
}
.style-modal-thumb-stage .midnight-overlay {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(135deg, rgba(5,3,20,0.55) 0%, rgba(5,3,20,0.2) 60%, rgba(5,3,20,0.45) 100%);
}
.style-modal-thumb-stage .midnight-grid {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0.07;
  background-image:
    repeating-linear-gradient(90deg, white 0px, white 2px, transparent 2px, transparent 12.5%);
}

/* Fluid bright bg (Gradient Bloom) */
.gen-studio-canvas .fluid-wrap,
.gen-studio-slide-thumb .fluid-wrap {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.gen-studio-canvas .fluid-wrap svg,
.gen-studio-slide-thumb .fluid-wrap svg {
  width: 100%; height: 100%; display: block; position: absolute; inset: 0;
}
.gen-studio-canvas .fluid-fade,
.gen-studio-slide-thumb .fluid-fade {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 20%;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
  pointer-events: none; z-index: 2;
}
.gen-studio-canvas .fluid-blob,
.gen-studio-slide-thumb .fluid-blob {
  position: absolute; border-radius: 50%;
  mix-blend-mode: multiply;
  will-change: transform;
  pointer-events: none;
  z-index: 1;
}
.gen-studio-canvas .fluid-blob.fb1,
.gen-studio-slide-thumb .fluid-blob.fb1 {
  width: 48%; height: 64%;
  background: radial-gradient(ellipse, rgba(68,182,233,0.55) 0%, rgba(49,121,255,0.35) 50%, transparent 80%);
  top: -11%; left: 14%;
  filter: blur(60px);
  animation: fluidBlob1 8s linear infinite;
}
.gen-studio-canvas .fluid-blob.fb2,
.gen-studio-slide-thumb .fluid-blob.fb2 {
  width: 43%; height: 58%;
  background: radial-gradient(ellipse, rgba(162,245,255,0.50) 0%, rgba(138,191,252,0.30) 55%, transparent 80%);
  top: -9%; right: 7%;
  filter: blur(55px);
  animation: fluidBlob2 11s linear infinite;
}

/* Warm earth bg */
.gen-studio-canvas .warm-wrap,
.gen-studio-slide-thumb .warm-wrap {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.gen-studio-canvas .warm-wrap svg,
.gen-studio-slide-thumb .warm-wrap svg {
  width: 100%; height: 100%; display: block; position: absolute; inset: 0;
}
.gen-studio-canvas .warm-fade,
.gen-studio-slide-thumb .warm-fade {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 18%;
  background: linear-gradient(to bottom, rgba(255,248,240,0) 0%, rgba(255,248,240,1) 100%);
  pointer-events: none; z-index: 1;
}

/* Bold mono bg */
.gen-studio-canvas .bold-wrap,
.gen-studio-slide-thumb .bold-wrap {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.gen-studio-canvas .bold-wrap svg,
.gen-studio-slide-thumb .bold-wrap svg {
  width: 100%; height: 100%; display: block; position: absolute; inset: 0;
}

/* Clean light bg */
.gen-studio-canvas .clean-wrap,
.gen-studio-slide-thumb .clean-wrap {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.gen-studio-canvas .clean-wrap svg,
.gen-studio-slide-thumb .clean-wrap svg {
  width: 100%; height: 100%; display: block; position: absolute; inset: 0;
}
/* .clean-strip rule removed 2026-06-29 alongside its emit. */

/* Mesh bg (default dark) */
.gen-studio-canvas .mesh,
.gen-studio-slide-thumb .mesh {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.45;
  background:
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(0,229,204,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 15% 80%, rgba(123,97,255,0.07) 0%, transparent 50%);
}
.gen-studio-canvas .mesh-lines,
.gen-studio-slide-thumb .mesh-lines {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(0,229,204,0.03) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(0,229,204,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 80% 10%, black 0%, transparent 70%);
}

/* Slide child z-index: content above background layers */
.gen-studio-canvas .slide > *:not(.mesh):not(.mesh-lines):not(.sq-layer):not(.aurora-canvas):not(.aurora-dot-grid):not(.aurora-grain):not(.midnight-bg):not(.midnight-orb):not(.midnight-overlay):not(.midnight-grid):not(.fluid-wrap):not(.fluid-fade):not(.fluid-blob):not(.warm-wrap):not(.warm-fade):not(.bold-wrap):not(.clean-wrap):not(.clean-strip):not(.clean-author):not(.clean-bar),
.gen-studio-slide-thumb .slide > *:not(.mesh):not(.mesh-lines):not(.sq-layer):not(.aurora-canvas):not(.aurora-dot-grid):not(.aurora-grain):not(.midnight-bg):not(.midnight-orb):not(.midnight-overlay):not(.midnight-grid):not(.fluid-wrap):not(.fluid-fade):not(.fluid-blob):not(.warm-wrap):not(.warm-fade):not(.bold-wrap):not(.clean-wrap):not(.clean-strip):not(.clean-author):not(.clean-bar) {
  position: relative; z-index: 2;
}

/* Floating squares layer */
.gen-studio-canvas .sq-layer,
.gen-studio-slide-thumb .sq-layer {
  position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.gen-studio-canvas .fsq,
.gen-studio-slide-thumb .fsq {
  position: absolute;
  border: 1px solid rgba(0,229,204,0.28);
  background: rgba(0,229,204,0.035);
  will-change: transform, opacity;
  animation: driftFloat ease-in-out infinite;
}
@keyframes driftFloat {
  0%   { transform: translate(0px, 0px) rotate(0deg);                       opacity: var(--op-lo); }
  25%  { transform: translate(var(--dx1), var(--dy1)) rotate(var(--dr1));   opacity: var(--op-hi); }
  50%  { transform: translate(var(--dx2), var(--dy2)) rotate(var(--dr2));   opacity: var(--op-lo); }
  75%  { transform: translate(var(--dx3), var(--dy3)) rotate(var(--dr3));   opacity: var(--op-hi); }
  100% { transform: translate(0px, 0px) rotate(0deg);                       opacity: var(--op-lo); }
}

/* Keyframes for animated backgrounds (from deck-engine.css) */
@keyframes midnightBreathe {
  0%   { transform: scale(1);    opacity: var(--op-lo, 0.65); }
  50%  { transform: scale(1.08); opacity: var(--op-hi, 0.90); }
  100% { transform: scale(1);    opacity: var(--op-lo, 0.65); }
}
@keyframes fluidBlob1 {
  0%   { transform: translate(0px, 0px) scale(1.00); }
  25%  { transform: translate(-80px, 60px) scale(1.06); }
  50%  { transform: translate(-50px, 110px) scale(1.03); }
  75%  { transform: translate(70px, 70px) scale(0.97); }
  100% { transform: translate(0px, 0px) scale(1.00); }
}
@keyframes fluidBlob2 {
  0%   { transform: translate(0px, 0px) scale(1.00); }
  25%  { transform: translate(70px, -50px) scale(1.07); }
  50%  { transform: translate(85px, 65px) scale(1.05); }
  75%  { transform: translate(-10px, 80px) scale(1.02); }
  100% { transform: translate(0px, 0px) scale(1.00); }
}

/* ── Core slide/object styles from deck-engine.css (not loaded on dashboard) ── */

/* Legacy (non-template) slides: vertical-center layout used by placeholder/JSON decks.
   HTML-path slides ([data-template]) are scoped OUT so the template's own CSS
   (flex-column with padding 64/80/48, section-divider grid, etc.) fully applies. */
.gen-studio-canvas .slide:not([data-template]),
.gen-studio-slide-thumb .slide:not([data-template]) {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* HTML-path slides: only apply the invariants that must hold regardless of template */
.gen-studio-canvas .slide[data-template],
.gen-studio-slide-thumb .slide[data-template] {
  position: relative;
  overflow: hidden;
  /* display / flex-direction / justify-content come from the template CSS */
}

.gen-studio-canvas .deck-object,
.gen-studio-slide-thumb .deck-object {
  position: absolute;
  z-index: 2;
}

.gen-studio-canvas .obj-text-content,
.gen-studio-slide-thumb .obj-text-content {
  word-wrap: break-word;
  white-space: pre-wrap;
}
.gen-studio-canvas .obj-text-content strong,
.gen-studio-slide-thumb .obj-text-content strong {
  font-weight: 700;
}
/* Card heading (bold) — larger than body to create visual hierarchy */
.gen-studio-canvas .deck-object[data-has-fill="true"] .obj-text-content strong,
.gen-studio-slide-thumb .deck-object[data-has-fill="true"] .obj-text-content strong {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
  display: block;
  margin-bottom: 6px;
}
.gen-studio-canvas .obj-text-content em,
.gen-studio-slide-thumb .obj-text-content em {
  font-style: italic;
}
.gen-studio-canvas .obj-text-content code,
.gen-studio-slide-thumb .obj-text-content code {
  font-family: 'DM Mono', monospace;
  background: rgba(0,229,204,0.08);
  padding: 2px 6px; border-radius: 3px;
}
.gen-studio-canvas .obj-text-content a,
.gen-studio-slide-thumb .obj-text-content a {
  color: var(--teal); text-decoration: underline;
}
.gen-studio-canvas .obj-list-bullet,
.gen-studio-slide-thumb .obj-list-bullet {
  padding-left: 24px; list-style-type: disc;
}
.gen-studio-canvas .obj-list-numbered,
.gen-studio-slide-thumb .obj-list-numbered {
  padding-left: 24px; list-style-type: decimal;
}

/* Card-style text objects with fill need padding */
.gen-studio-canvas .deck-object[data-object-type="text"][data-has-fill="true"][data-has-text-content="true"],
.gen-studio-canvas .deck-object[data-object-type="text"][data-has-border="true"][data-has-text-content="true"],
.gen-studio-slide-thumb .deck-object[data-object-type="text"][data-has-fill="true"][data-has-text-content="true"],
.gen-studio-slide-thumb .deck-object[data-object-type="text"][data-has-border="true"][data-has-text-content="true"] {
  padding: 28px 32px;
}
/* Light mode cards — compact padding */
[data-theme-mode="light"] .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-border="true"][data-has-text-content="true"] {
  padding: 14px 18px;
}

.gen-studio-canvas .obj-image,
.gen-studio-slide-thumb .obj-image {
  overflow: hidden; border-radius: 8px; position: relative;
}
.gen-studio-canvas .obj-shape,
.gen-studio-slide-thumb .obj-shape {
  position: relative; overflow: visible;
}
.gen-studio-canvas .obj-shape svg,
.gen-studio-slide-thumb .obj-shape svg {
  pointer-events: none;
}
.gen-studio-canvas .obj-icon,
.gen-studio-slide-thumb .obj-icon {
  display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden;
}
.gen-studio-canvas .obj-icon svg,
.gen-studio-slide-thumb .obj-icon svg {
  flex-shrink: 0;
}

/* Stat bar (progress indicator in stat cards) */
.gen-studio-canvas .stat-bar,
.gen-studio-slide-thumb .stat-bar {
  margin-top: 16px;
  height: 3px;
  border-radius: 2px;
  background: rgba(120,200,180,0.18);
  overflow: hidden;
}
.gen-studio-canvas .stat-bar-fill,
.gen-studio-slide-thumb .stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--teal), #7eb8f0);
}
.gen-studio-canvas .stat-card-inner.purple .stat-bar-fill,
.gen-studio-slide-thumb .stat-card-inner.purple .stat-bar-fill {
  background: linear-gradient(90deg, var(--purple), #c4b5fd);
}

/* Stat card inner */
.gen-studio-canvas .stat-card-inner,
.gen-studio-slide-thumb .stat-card-inner {
  padding: 24px 20px; text-align: center;
  border-radius: 16px;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.gen-studio-canvas .stat-value,
.gen-studio-slide-thumb .stat-value {
  font-family: 'Sora', sans-serif;
  font-size: 48px; font-weight: 600;
  color: #5ee8b5; line-height: 1;
  margin-bottom: 10px;
  letter-spacing: -1px;
}
.gen-studio-canvas .stat-card-inner.purple .stat-value,
.gen-studio-slide-thumb .stat-card-inner.purple .stat-value {
  color: #c4b5fd;
}
/* Stat label in gen modal canvas/thumb: defer to blocks.css base rule
   (10px / 600 / ls 2.5px / uppercase / #e8f0f8 per biostate-dark spec). */

/* Background decoration objects */
.gen-studio-canvas .obj-background,
.gen-studio-slide-thumb .obj-background {
  pointer-events: none !important;
  z-index: 1 !important;
  animation: bgFloat 12s ease-in-out infinite alternate;
}
@keyframes bgFloat {
  0%   { transform: translateY(0) rotate(var(--bg-rot, 0deg)); }
  50%  { transform: translateY(-8px) rotate(calc(var(--bg-rot, 0deg) + 3deg)); }
  100% { transform: translateY(4px) rotate(calc(var(--bg-rot, 0deg) - 2deg)); }
}
.gen-studio-canvas .obj-background:nth-child(odd),
.gen-studio-slide-thumb .obj-background:nth-child(odd) {
  animation-duration: 14s; animation-delay: -3s;
}
.gen-studio-canvas .obj-background:nth-child(3n),
.gen-studio-slide-thumb .obj-background:nth-child(3n) {
  animation-duration: 10s; animation-delay: -7s;
}

/* ──────────────────────────────────────────────────────────────────────
   Consolidated prompt card (replaces label + textarea + dropzone block).
   Single rounded glass surface holding the textarea + an icon-only
   upload trigger (left) + the gradient Generate button (right). The
   original .gen-dropzone stays in the DOM (hidden) so file-handling JS
   keeps working — the upload icon forwards clicks to it.
   ────────────────────────────────────────────────────────────────────── */
.gen-prompt-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 22px;
  padding: 22px 22px 16px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.95),
    0 1px 2px rgba(35, 31, 32, 0.03),
    0 4px 10px -6px rgba(35, 31, 32, 0.05);
  transition: box-shadow 0.3s ease;
}
.gen-prompt-card:focus-within {
  /* Subtle active state — slightly stronger but still lightweight. */
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 1),
    0 1px 2px rgba(35, 31, 32, 0.04),
    0 6px 14px -6px rgba(35, 31, 32, 0.08);
}
/* Override the boxed textarea look from the legacy .gen-prompt-input
   block — inside the prompt card the textarea is borderless, transparent
   and grows naturally inside the card chrome. */
.gen-prompt-card .gen-prompt-input,
body.light-mode .gen-prompt-card .gen-prompt-input,
body.light-mode .gen-prompt-card .gen-prompt-input:focus {
  width: 100%;
  min-height: 110px;
  max-height: 280px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #231F20;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  resize: none;
  outline: none;
  box-shadow: none;
}
.gen-prompt-card .gen-prompt-input::placeholder {
  color: rgba(35, 31, 32, 0.45);
}

/* Footer row: upload icon (left) + generate button (right) */
/* Prompt length hint — silent until the brief gets long, then advisory.
   Collapsed to zero height when empty so it never reserves space in the
   card; the padding only appears with the text. Amber for "long", red for
   "very long" — neither blocks Generate. (Rainy 2026-07-28.) */
.gen-prompt-hint {
  font: 500 12px/1.45 'Manrope', system-ui, -apple-system, sans-serif;
  color: #8a6d1f;
  /* No transition, on purpose. Animating max-height/opacity into view means
     the hint is only readable if the rendering loop actually advances the
     transition — anywhere it doesn't (a suppressed/offscreen surface, an
     environment with animations disabled) the element keeps the 0-height,
     0-opacity start state and the warning silently never appears. Caught by
     the harness: with the transition removed the same element measured
     60px/23.4px, with it, 0. Whether advice is visible must not depend on an
     animation running. */
  display: none;
  padding: 0 2px;
}
.gen-prompt-hint.is-visible {
  display: block;
  padding: 4px 2px 2px;
}
.gen-prompt-hint.is-warn { color: #b4462f; }
body.dark-mode .gen-prompt-hint,
.gen-modal.dark .gen-prompt-hint { color: #d8b25c; }
body.dark-mode .gen-prompt-hint.is-warn,
.gen-modal.dark .gen-prompt-hint.is-warn { color: #ff9b84; }

.gen-prompt-foot {
  display: flex;
  align-items: flex-start;
  /* No more justify-content: space-between — that spread 3 items
     across the row when we added the URL button between upload and
     Generate. Now upload + URL cluster on the left, Generate pushed
     to the right via `margin-left: auto`. (Rainy 2026-05-26: URL btn
     间距太大.) */
  gap: 4px;
  margin-top: 12px;
}
.gen-prompt-foot .gen-btn-primary,
.gen-prompt-foot .gen-btn-inline {
  margin-left: 0;
}
.gen-prompt-action-stack {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
/* Upload icon button — transparent default, gray-bg + icon-lift on hover */
.gen-prompt-upload {
  position: relative;            /* anchor for the count badge */
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: rgba(35, 31, 32, 0.70);
  cursor: pointer;
  transition: background 0.2s ease;
}
.gen-prompt-upload svg {
  transition: transform 0.25s cubic-bezier(0.65, 0, 0.35, 1), color 0.2s ease;
}
.gen-prompt-upload:hover {
  background: rgba(35, 31, 32, 0.06);
}
.gen-prompt-upload:hover svg {
  transform: translateY(-2px);
}

/* Numeric file-count badge anchored to top-right of upload button.
   Matches the selected-template card check badge style — frosted-glass
   teal→blue gradient + backdrop-blur + inset white highlight + soft
   teal glow. Reuses the same brand visual language so the two
   "selected/active" indicators read as one design system.
   Hidden when textContent is empty via :empty selector.
   (Rainy 2026-05-26: 气泡风格统一. ) */
.gen-prompt-upload-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 50%;
  /* Brand teal → blue gradient at high opacity so the badge stays
     legible on light backgrounds. The selected-template badge
     (gen-style-card.active::after) sits on a dark slide thumbnail so
     0.62 alpha reads fine there; on the white prompt-card background
     it disappears. Pump alpha + use slightly darker brand teal /
     mid-blue. (Rainy 2026-05-26: light mode 看不太出来.) */
  background-image:
    linear-gradient(135deg, rgba(69, 208, 189, 0.95) 0%, rgba(56, 165, 220, 0.95) 100%);
  color: #ffffff;
  font: 700 11px/1 'Manrope', system-ui, sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.85),
    inset 0 -1px 1px rgba(56, 165, 220, 0.30),
    0 4px 14px -2px rgba(16, 128, 128, 0.50);
  letter-spacing: -0.2px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.10);
  pointer-events: none;
}
.gen-prompt-upload-badge:empty {
  display: none;
}

/* URL paste button — sits next to the upload icon. Same visual size
   and hover treatment, different SVG (link / chain). Opens a tiny
   inline popover with URL input + Fetch button.
   (Rainy 2026-05-26: doc→deck URL paste flow.) */
.gen-prompt-url {
  position: relative;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: rgba(35, 31, 32, 0.70);
  cursor: pointer;
  transition: background 0.2s ease;
}
.gen-prompt-url:hover {
  background: rgba(35, 31, 32, 0.06);
}
.gen-prompt-url svg {
  transition: transform 0.25s cubic-bezier(0.65, 0, 0.35, 1);
}
.gen-prompt-url:hover svg {
  transform: rotate(-12deg);
}

/* Wrapper around the URL button — establishes the positioning context
   so the popover anchors to the BUTTON instead of the prompt card.
   Without this, `bottom: calc(100% + 8px)` on the popover puts it
   above the entire prompt card → off-screen at modal top. */
.gen-prompt-url-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Popover container — floats above the foot row when open. Compact
   horizontal layout: input + Fetch button. */
.gen-prompt-url-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  padding: 8px;
  display: flex;
  gap: 6px;
  z-index: 10;
  min-width: 360px;
}
.gen-prompt-url-popover[hidden] { display: none; }
.gen-prompt-url-popover input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  font: 13px/1.4 'Manrope', system-ui, sans-serif;
  color: #111827;
  outline: none;
}
.gen-prompt-url-popover input:focus {
  border-color: #45D0BD;
  box-shadow: 0 0 0 3px rgba(69, 208, 189, 0.18);
}
.gen-prompt-url-popover button {
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(127, 232, 213, 0.95) 0%, rgba(68, 182, 233, 0.95) 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  font: 600 12px/1 'Manrope', system-ui, sans-serif;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.50), 0 2px 8px rgba(16, 128, 128, 0.25);
  white-space: nowrap;
}
.gen-prompt-url-popover button:hover {
  filter: brightness(1.05);
}
.gen-prompt-url-popover button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Dark mode adjustments */
body.dark-mode .gen-prompt-url {
  color: rgba(232, 238, 245, 0.70);
}
body.dark-mode .gen-prompt-url:hover {
  background: rgba(255, 255, 255, 0.06);
}
body.dark-mode .gen-prompt-url-popover {
  background: #0f1320;
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.50);
}
body.dark-mode .gen-prompt-url-popover input {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e8eef5;
}
body.dark-mode .gen-prompt-url-popover input:focus {
  border-color: rgba(69, 208, 189, 0.60);
}

/* Compact file chip row INSIDE the prompt card, just above the
   upload/Generate foot. Horizontal scroll if many chips, each chip
   stays small and visually tied to the upload action.
   (Rainy 2026-05-26: 上传文件移到 prompt 框内.) */
.gen-prompt-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px;
  margin-bottom: 8px;
}
.gen-prompt-files:empty {
  display: none;
}
.gen-prompt-files .gen-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  background: rgba(69, 208, 189, 0.10);
  border: 1px solid rgba(69, 208, 189, 0.24);
  border-radius: 999px;
  font-size: 12px;
  color: rgba(35, 31, 32, 0.85);
  max-width: 240px;
}
.gen-prompt-files .gen-file-chip-icon {
  font-size: 12px;
  line-height: 1;
}
.gen-prompt-files .gen-file-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.gen-prompt-files .gen-file-chip-meta {
  font-size: 10px;
  color: rgba(35, 31, 32, 0.45);
  margin-left: 2px;
  flex-shrink: 0;
}
.gen-prompt-files .gen-file-chip-remove {
  background: transparent;
  border: 0;
  font-size: 14px;
  line-height: 1;
  color: rgba(35, 31, 32, 0.50);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 50%;
  margin-left: 2px;
}
.gen-prompt-files .gen-file-chip-remove:hover {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(35, 31, 32, 0.90);
}

/* Hide the legacy bottom file zone since chips now render in the
   prominent location above. (Kept in DOM for JS that might still
   read its children.) */
.gen-files-zone .gen-file-list {
  display: none;
}

/* Dark mode tweaks for the new prompt-files chip row */
body.dark-mode .gen-prompt-files .gen-file-chip {
  background: rgba(69, 208, 189, 0.14);
  border-color: rgba(69, 208, 189, 0.30);
  color: rgba(232, 238, 245, 0.90);
}
body.dark-mode .gen-prompt-files .gen-file-chip-meta {
  color: rgba(232, 238, 245, 0.55);
}
body.dark-mode .gen-prompt-files .gen-file-chip-remove {
  color: rgba(232, 238, 245, 0.55);
}
body.dark-mode .gen-prompt-files .gen-file-chip-remove:hover {
  background: rgba(255, 255, 255, 0.10);
  color: rgba(232, 238, 245, 0.95);
}

/* Inline gradient generate button — rounded-rectangle (not pill) with
   a dual-SVG arrow that slides diagonally up-right on hover, matching
   the see-more pattern. Wrap the SVGs in .gen-btn-arrow > .gen-btn-arrow-inner
   in markup; CSS handles the slide. */
.gen-btn-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 22px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(110deg, #7FE8D5 0%, #45D0BD 50%, #44B6E9 100%);
  color: #ffffff;
  font-family: var(--font-body, 'Manrope', sans-serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.30),
    0 1px 2px rgba(35, 31, 32, 0.06),
    0 8px 20px -6px rgba(69, 208, 189, 0.45);
  transition: transform 0.2s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}
.gen-btn-inline:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.40),
    0 2px 4px rgba(35, 31, 32, 0.08),
    0 14px 28px -6px rgba(69, 208, 189, 0.55);
}
.gen-btn-inline:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}
/* Dual-SVG arrow window — sliced 14×14, overflow hidden. Both arrows
   (↗) sit in a flex column-equivalent; on hover the inner shifts
   diagonally so the first arrow exits up-right and the second enters
   from the lower-left. Same mechanic as .see-more-btn .arrow-icon. */
.gen-btn-inline .gen-btn-arrow {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  overflow: hidden;
  flex-shrink: 0;
}
.gen-btn-inline .gen-btn-arrow-inner {
  position: absolute;
  inset: 0;
  transition: transform 0.32s cubic-bezier(0.65, 0, 0.35, 1);
}
.gen-btn-inline .gen-btn-arrow-inner svg {
  position: absolute;
  width: 14px;
  height: 14px;
}
.gen-btn-inline .gen-btn-arrow-inner svg:first-child {
  top: 0;
  left: 0;
}
.gen-btn-inline .gen-btn-arrow-inner svg:last-child {
  top: 100%;
  left: -100%;
}
.gen-btn-inline:hover:not(:disabled) .gen-btn-arrow-inner {
  transform: translate(100%, -100%);
}

/* Hide the legacy reference-files block visuals; chips list still
   shows when files are attached (rendered into #genFileList). */
.gen-files-zone .gen-dropzone { display: none !important; }

/* ────────────────────────────────────────────────────────────────
   Mobile — generate-modal becomes a full-screen bottom sheet
   ────────────────────────────────────────────────────────────────
   Center-aligned modals don't work on phones: thumb can't reach
   close-button corners, soft keyboard pushes content off-screen,
   and the cramped padding makes the prompt textarea unusable.
   On ≤640px we slide the modal up from the bottom edge as a
   full-height sheet, with safe-area-aware padding for the home
   indicator. (Rainy 2026-05-26: dashboard mobile pass.)
   ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .gen-modal-overlay {
    /* Anchor sheet to bottom instead of center for thumb reach */
    align-items: flex-end;
    padding: 0;
  }
  .gen-modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    height: 92dvh;          /* leaves a sliver of dimmed bg at top so
                               users see they can swipe / tap to close */
    border-radius: 18px 18px 0 0;
    transform: translateY(100%) scale(1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .gen-modal-overlay.open .gen-modal {
    transform: translateY(0) scale(1);
  }
  /* Already-fullpage states keep filling the screen */
  .gen-modal[data-state="progress"],
  .gen-modal[data-state="preview"] {
    height: 100dvh;
    border-radius: 0;
  }
  /* Tappable close button — bump to 44×44 minimum */
  .gen-modal-close {
    min-width: 44px; min-height: 44px;
  }
  /* Header / body padding tightened for narrow viewports */
  .gen-modal-header {
    padding: 14px 18px;
  }
}

/* Brand Kit row under the prompt card. The AI engine selector now lives
   directly under the Generate button inside the prompt footer. */
.gen-ai-engine-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 20px;
}

/* "Pick a style below to continue" — explains why Generate is disabled.
   Sits directly above the button so the reason and the dead control are
   read together. (Rainy 2026-07-27: style choice is now required.) */
.gen-style-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 12px/1.3 system-ui, -apple-system, sans-serif;
  color: #8a94a3;
  padding: 0 2px 6px;
  white-space: nowrap;
}
.gen-style-hint svg { flex: 0 0 auto; opacity: .85; }
