/* ============================================================
   InkSlide — Design System & Slide Themes
   ============================================================ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'DM Sans', sans-serif;
  background: #0c1220;
  color: #e2d9c9;
  font-size: 14px;
  line-height: 1.5;
}
a { color: #d4a843; text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
textarea, input, select { font-family: inherit; font-size: 13px; }
.hidden { display: none !important; }

/* ── App Shell (3-column grid) ── */
#app {
  display: grid;
  grid-template-columns: 300px 1fr 170px;
  grid-template-rows: 100vh;
  height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════════════════
   LEFT SIDEBAR
══════════════════════════════════════════ */
#sidebar {
  background: #111827;
  border-right: 1px solid #1e2d42;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #1e2d42 transparent;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: #1e2d42; border-radius: 2px; }

/* Brand */
.sidebar-brand {
  padding: 22px 20px 16px;
  border-bottom: 1px solid #1e2d42;
  flex-shrink: 0;
}
.brand-logo { font-family: 'Cormorant Garamond', serif; font-size: 26px; font-weight: 600; letter-spacing: 0.02em; }
.brand-ink { color: #d4a843; }
.brand-slide { color: #e2d9c9; }
.brand-tagline { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #687a8f; margin-top: 2px; }

/* Step Nav */
.step-nav {
  display: flex;
  flex-direction: row;
  border-bottom: 1px solid #1e2d42;
  flex-shrink: 0;
}
.step-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  color: #4a5b6e;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-right: 1px solid #1e2d42;
  transition: background 0.2s, color 0.2s;
}
.step-btn:last-child { border-right: none; }
.step-btn:hover { background: #1a2535; color: #8b9bb4; }
.step-btn.active { color: #d4a843; background: #141f31; }
.step-btn.done { color: #5a8a6a; }
.step-num { font-size: 15px; font-weight: 600; font-family: 'Cormorant Garamond', serif; }
.step-label { font-size: 9px; margin-top: 2px; }

/* Panels */
.step-panel { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.step-panel.active { display: flex; }
.panel-heading {
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
  font-weight: 600;
  color: #d4a843;
  letter-spacing: 0.03em;
  border-bottom: 1px solid #1e2d42;
  padding-bottom: 8px;
}

/* Input tabs */
.tab-row { display: flex; gap: 0; border: 1px solid #1e2d42; border-radius: 6px; overflow: hidden; }
.tab-btn {
  flex: 1; padding: 7px; font-size: 12px; color: #687a8f;
  background: #0c1220; transition: all 0.2s;
}
.tab-btn.active { background: #1a2535; color: #d4a843; font-weight: 500; }
.tab-btn:hover:not(.active) { background: #141f31; color: #8b9bb4; }

/* Fields */
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #8b9bb4; }
.field-hint { font-size: 11px; color: #4a5b6e; }
.field-hint a { color: #d4a843; }
.field-hint-inline { font-size: 10px; color: #4a5b6e; font-weight: 400; text-transform: none; letter-spacing: 0; }
.field-input, .field-textarea, .field-select {
  background: #0c1220;
  border: 1px solid #1e2d42;
  border-radius: 6px;
  color: #e2d9c9;
  padding: 8px 10px;
  width: 100%;
  transition: border-color 0.2s;
  resize: vertical;
}
.field-input:focus, .field-textarea:focus, .field-select:focus {
  outline: none;
  border-color: #d4a843;
}
.field-select { appearance: none; cursor: pointer; }
.field-textarea { resize: vertical; min-height: 80px; }
.edit-field { background: #141f31; border-color: #253650; }
.char-count { font-size: 10px; color: #4a5b6e; text-align: right; }

/* API key row */
.api-key-row { display: flex; gap: 6px; }
.api-key-row .field-input { flex: 1; }
.key-toggle-btn {
  background: #1a2535; border: 1px solid #1e2d42; border-radius: 6px;
  padding: 0 10px; font-size: 14px; color: #687a8f;
  flex-shrink: 0; transition: background 0.2s;
}
.key-toggle-btn:hover { background: #253650; }

/* Drop zone */
.drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed #1e2d42; border-radius: 10px; padding: 24px 16px; gap: 6px;
  cursor: pointer; transition: border-color 0.2s, background 0.2s; text-align: center;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: #d4a843; background: #141f31; }
.drop-icon { font-size: 28px; }
.drop-title { font-size: 13px; font-weight: 500; color: #e2d9c9; }
.drop-formats { font-size: 10px; color: #d4a843; letter-spacing: 0.1em; text-transform: uppercase; }
.drop-hint { font-size: 11px; color: #4a5b6e; }

/* File status */
.file-status {
  font-size: 12px; padding: 8px 10px; border-radius: 6px;
  background: #141f31; border: 1px solid #1e2d42; color: #8b9bb4;
}
.file-status.success { border-color: #2a5a3a; color: #5cb85c; }
.file-status.error { border-color: #5a2020; color: #e05c5c; }

/* Cover upload */
.cover-upload-btn {
  display: block; width: 100%; padding: 8px; border: 1px dashed #1e2d42;
  border-radius: 6px; text-align: center; font-size: 12px; color: #687a8f;
  cursor: pointer; transition: all 0.2s;
}
.cover-upload-btn:hover { border-color: #d4a843; color: #d4a843; }
.cover-preview-img { width: 100%; border-radius: 6px; display: block; }
.cover-remove-btn {
  margin-top: 6px; width: 100%; padding: 5px; font-size: 11px;
  color: #e05c5c; border: 1px solid #3a2020; border-radius: 6px; background: #1a1212;
}

/* URL input row */
.url-input-row { display: flex; gap: 6px; }
.url-input-row .field-input { flex: 1; }
.btn-fetch {
  background: #1a3a6a; border: 1px solid #2a5aa8; color: #8bd4f0;
  border-radius: 6px; padding: 0 14px; font-size: 12px; font-weight: 600;
  flex-shrink: 0; transition: background 0.2s;
}
.btn-fetch:hover { background: #2a5aa8; color: #fff; }
.btn-fetch:disabled { opacity: 0.5; cursor: not-allowed; }

/* Buttons */
.btn-primary {
  width: 100%; padding: 10px; border-radius: 8px; font-size: 13px;
  font-weight: 600; letter-spacing: 0.04em;
  background: linear-gradient(135deg, #c9963a, #d4a843);
  color: #0c1220; transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-gold { background: linear-gradient(135deg, #b8860b, #d4a843); }
.btn-analyze { background: linear-gradient(135deg, #1a3a6a, #2a5aa8); color: #e2d9c9; }
.btn-ghost {
  width: 100%; padding: 8px; border-radius: 8px; font-size: 12px;
  color: #687a8f; border: 1px solid #1e2d42; background: transparent;
  transition: all 0.2s;
}
.btn-ghost:hover { border-color: #d4a843; color: #d4a843; }
.btn-sm { padding: 6px 10px; font-size: 11px; }

/* Progress panel */
.progress-panel { display: flex; flex-direction: column; gap: 8px; }
.prog-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #4a5b6e; padding: 6px 10px; border-radius: 6px; }
.prog-item.active { color: #d4a843; background: #141f31; }
.prog-item.done { color: #5cb85c; }
.prog-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.prog-item.active .prog-dot { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Analysis summary */
.analysis-summary {
  background: #141f31; border: 1px solid #1e3a5a; border-radius: 8px;
  padding: 12px; font-size: 12px; color: #e2d9c9; line-height: 1.7;
}
.analysis-row { display: flex; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.analysis-label { color: #d4a843; font-weight: 600; white-space: nowrap; }
.trope-chip {
  display: inline-block; background: #1e3a5a; border: 1px solid #2a5070;
  border-radius: 12px; padding: 2px 8px; font-size: 11px; color: #8bd4f0; margin: 2px;
}

/* Error box */
.error-box {
  background: #2a1212; border: 1px solid #5a2020; border-radius: 8px;
  padding: 10px 12px; font-size: 12px; color: #e87070; line-height: 1.5;
}

/* Slide type badge */
.slide-type-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  background: #1a2535; color: #d4a843; border: 1px solid #d4a843;
  align-self: flex-start;
}

/* Export */
.export-desc { font-size: 12px; color: #8b9bb4; line-height: 1.5; }
.export-status { font-size: 12px; color: #d4a843; text-align: center; padding: 6px; }
.tip-card { background: #141f31; border: 1px solid #1e2d42; border-radius: 8px; padding: 12px; }
.tip-title { font-size: 12px; font-weight: 600; color: #d4a843; margin-bottom: 8px; }
.tip-list { padding-left: 16px; display: flex; flex-direction: column; gap: 5px; }
.tip-list li { font-size: 11px; color: #8b9bb4; }

/* Library */
#library-section {
  margin-top: auto; border-top: 1px solid #1e2d42; flex-shrink: 0;
}
.library-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; font-size: 12px; font-weight: 600; color: #8b9bb4;
  letter-spacing: 0.06em; text-transform: uppercase;
  background: #0f1823; transition: background 0.2s;
}
.library-toggle:hover { background: #141f31; color: #d4a843; }
.lib-count {
  background: #d4a843; color: #0c1220; border-radius: 10px;
  padding: 1px 7px; font-size: 10px; font-weight: 700; margin-left: 6px;
}
.lib-chevron { font-size: 10px; color: #4a5b6e; transition: transform 0.2s; }
.lib-chevron.open { transform: rotate(180deg); }
.library-panel { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.library-empty { font-size: 11px; color: #4a5b6e; text-align: center; padding: 10px; }
.library-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: #141f31; border: 1px solid #1e2d42; border-radius: 8px;
  cursor: pointer; transition: border-color 0.2s;
}
.library-item:hover { border-color: #d4a843; }
.lib-item-info { flex: 1; min-width: 0; }
.lib-item-title { font-size: 12px; font-weight: 500; color: #e2d9c9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item-meta { font-size: 10px; color: #4a5b6e; }
.lib-item-delete { font-size: 12px; color: #4a5b6e; padding: 2px 6px; transition: color 0.2s; }
.lib-item-delete:hover { color: #e05c5c; }

/* ══════════════════════════════════════════
   CENTER PREVIEW
══════════════════════════════════════════ */
#preview-main {
  display: flex; flex-direction: column; background: #080d15;
  overflow: hidden; position: relative; gap: 0;
}
#slide-viewport {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: hidden; position: relative;
}
#slide-stage {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}

/* Welcome screen */
.welcome-screen {
  text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 12px; padding: 40px;
}
.ws-icon { font-size: 48px; opacity: 0.5; }
.ws-title { font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 500; color: #4a5b6e; }
.ws-sub { font-size: 13px; color: #2a3d52; max-width: 320px; line-height: 1.6; }

/* Slide canvas (always 1080×1350, scaled via JS) */
.slide-canvas {
  width: 1080px;
  height: 1350px;
  position: relative;
  overflow: hidden;
  transform-origin: center center;
  flex-shrink: 0;
  border-radius: 4px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.7);
}

/* Export canvas (hidden, full res) */
#export-canvas-wrap {
  position: fixed; left: -1200px; top: 0;
  pointer-events: none; opacity: 0;
}
.export-canvas-hidden { transform: none !important; box-shadow: none !important; }

/* Slide navigation */
.slide-controls {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 12px 24px; border-top: 1px solid #1e2d42; background: #0c1220;
  flex-shrink: 0;
}
.nav-btn {
  width: 36px; height: 36px; border-radius: 50%; background: #1a2535;
  border: 1px solid #1e2d42; color: #8b9bb4; font-size: 20px; line-height: 1;
  transition: all 0.2s; display: flex; align-items: center; justify-content: center;
}
.nav-btn:hover:not(:disabled) { background: #253650; color: #d4a843; border-color: #d4a843; }
.nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.slide-dots { display: flex; gap: 6px; align-items: center; }
.slide-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #1e2d42;
  cursor: pointer; transition: all 0.2s;
}
.slide-dot.active { width: 18px; border-radius: 3px; background: #d4a843; }

/* ══════════════════════════════════════════
   RIGHT THUMBNAILS
══════════════════════════════════════════ */
#thumbs-sidebar {
  background: #0f1823; border-left: 1px solid #1e2d42;
  display: flex; flex-direction: column; overflow: hidden;
}
.thumbs-header {
  padding: 12px; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: #4a5b6e; border-bottom: 1px solid #1e2d42; flex-shrink: 0;
}
.thumb-list {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 8px;
  display: flex; flex-direction: column; gap: 8px;
  scrollbar-width: thin; scrollbar-color: #1e2d42 transparent;
}
.thumbs-placeholder { font-size: 11px; color: #2a3d52; text-align: center; padding: 20px 8px; }
.thumb-item {
  width: 100%; aspect-ratio: 1; border-radius: 6px; overflow: hidden;
  border: 2px solid #1e2d42; cursor: pointer; transition: border-color 0.2s;
  position: relative; flex-shrink: 0; background: #141f31;
}
.thumb-item:hover { border-color: #8b9bb4; }
.thumb-item.active { border-color: #d4a843; }
.thumb-num {
  position: absolute; top: 3px; left: 3px; background: rgba(0,0,0,0.7);
  color: #fff; font-size: 9px; padding: 1px 4px; border-radius: 3px; font-weight: 600;
}

/* ══════════════════════════════════════════
   SLIDE THEMES — Base structure shared
══════════════════════════════════════════ */
.slide-canvas {
  font-family: 'Playfair Display', Georgia, serif;
  display: flex; flex-direction: column;
}

/* Slide inner wrapper */
.slide-inner {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 80px 140px; text-align: center; position: relative;
  gap: 24px;
}

/* Slide elements */
.s-eyebrow {
  font-size: 22px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85); /* Use rgba instead of element opacity to protect text-shadows */
}
.s-headline {
  font-size: 72px; font-weight: 700; line-height: 1.1;
  font-family: 'Playfair Display', serif;
}
.s-body { font-size: 40px; line-height: 1.4; opacity: 0.9; max-width: 760px; margin: 0 auto; }
.s-list {
  list-style: none; display: flex; flex-direction: column; gap: 20px;
  text-align: left; width: 100%; max-width: 860px;
}
.s-list-item {
  display: flex; align-items: center; gap: 24px;
  font-size: 44px; line-height: 1.2; font-family: 'Lora', serif;
}
.s-list-bullet { font-size: 32px; flex-shrink: 0; opacity: 0.8; }

.s-trope-stack {
  display: flex; flex-direction: column; gap: 24px; width: 100%; max-width: 800px;
}
.s-trope-block {
  padding: 32px 40px; font-size: 42px; font-weight: 600;
  border-radius: 20px; border-left: 8px solid currentColor;
  background: rgba(255,255,255,0.05); text-align: left;
  letter-spacing: 0.03em;
}

.s-vibe-cloud {
  display: flex; flex-wrap: wrap; gap: 20px; justify-content: center;
  align-items: center; padding: 20px; margin-top: 40px;
}
.s-vibe-word { font-family: 'Playfair Display', serif; font-style: italic; }
.s-char-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; width: 100%; }
.s-char-block { display: flex; flex-direction: column; gap: 10px; padding: 30px; border-radius: 12px; }
.s-char-role { font-size: 22px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255, 255, 255, 0.8); }
.s-char-name { font-size: 52px; font-weight: 700; line-height: 1.1; font-family: 'Playfair Display', serif; }
.s-char-desc { font-size: 28px; line-height: 1.3; opacity: 0.8; font-family: 'Lora', serif; font-style: italic; }
.s-quote-mark { font-size: 140px; line-height: 0.7; opacity: 0.2; font-family: Georgia, serif; }
.s-quote-text { font-size: 52px; font-style: italic; line-height: 1.3; font-family: 'Lora', serif; font-weight: 500; }
.s-quote-attr { font-size: 26px; color: rgba(255, 255, 255, 0.8); letter-spacing: 0.06em; }
.s-cta-title { font-size: 60px; font-weight: 700; line-height: 1.1; font-family: 'Playfair Display', serif; }
.s-cta-series { font-size: 30px; color: rgba(255, 255, 255, 0.85); letter-spacing: 0.06em; }
.s-cta-cover { max-height: 340px; max-width: 240px; object-fit: contain; border-radius: 6px; }
.s-handle { font-size: 26px; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.85); font-family: 'DM Sans', sans-serif; font-weight: 500; }
.s-swipe { font-size: 22px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.s-divider { width: 80px; height: 2px; border-radius: 1px; opacity: 0.5; }
.s-screen-bottom { position: absolute; bottom: 48px; left: 0; right: 0; text-align: center; }
.s-screen-top { position: absolute; top: 48px; left: 0; right: 0; text-align: center; }

/* ── Image Background Overlay ── */
.s-bg-overlay {
  position: absolute;
  inset: 0;
  /* Heavier vignette: edges AND center are darkened for full readability */
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0.30) 25%,
    rgba(0,0,0,0.30) 75%,
    rgba(0,0,0,0.65) 100%
  );
  pointer-events: none;
  z-index: 0;
}
.s-bg-overlay + * { 
  position: relative; 
  z-index: 10; 
}
.slide-inner > *, .s-screen-top, .s-screen-bottom, .s-swipe, .s-handle {
  z-index: 1; /* Keep content above overlay */
  text-shadow:
    0px 2px 4px rgba(0,0,0,0.98),
    0px 4px 12px rgba(0,0,0,0.95),
    0px 8px 32px rgba(0,0,0,0.85);
}
/* Small utility text (swipe hint, eyebrow, handle) get a pill backdrop when over images */
.has-bg-image .s-swipe,
.has-bg-image .s-eyebrow,
.has-bg-image .s-handle {
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 40px;
  padding: 6px 24px;
}

/* ── THEME: AI Dynamic ── */
.theme-ai-dynamic {
  background: var(--ai-bg, #1a1a24);
  color: var(--ai-text, #f0f0f0);
}
.theme-ai-dynamic .s-headline { color: var(--ai-text, #f0f0f0); font-family: 'Playfair Display', serif; }
.theme-ai-dynamic .s-eyebrow { color: var(--ai-accent, #d4a843); }
.theme-ai-dynamic .s-divider { background: var(--ai-accent, #d4a843); width: 100px; height: 3px; }
.theme-ai-dynamic .s-list-bullet { color: var(--ai-accent, #d4a843); }
.theme-ai-dynamic .s-trope-block { color: var(--ai-accent, #d4a843); border-color: var(--ai-accent, #d4a843); background: rgba(0,0,0,0.2); }
.theme-ai-dynamic .s-char-block { background: rgba(0,0,0,0.15); border: 1px solid var(--ai-accent, #d4a843); }
.theme-ai-dynamic .s-char-role { color: var(--ai-accent, #d4a843); }
.theme-ai-dynamic .s-quote-mark { color: var(--ai-accent, #d4a843); opacity: 0.3; }
.theme-ai-dynamic .s-handle { color: var(--ai-accent, #d4a843); }
.theme-ai-dynamic::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}

/* ── THEME: Navy & Gold ── */
.theme-navy-gold {
  background: linear-gradient(150deg, #0a1929 0%, #0f2944 50%, #0a1929 100%);
  color: #f5f0e4;
}
.theme-navy-gold .s-headline { color: #f5f0e4; }
.theme-navy-gold .s-eyebrow { color: #d4a843; }
.theme-navy-gold .s-divider { background: #d4a843; }
.theme-navy-gold .s-list-bullet { color: #d4a843; }
.theme-navy-gold .s-trope-block { color: #d4a843; border-color: #d4a843; }
.theme-navy-gold .s-char-block { background: rgba(212,168,67,0.08); border: 1px solid rgba(212,168,67,0.2); }
.theme-navy-gold .s-char-role { color: #d4a843; }
.theme-navy-gold .s-quote-mark { color: #d4a843; }
.theme-navy-gold .s-handle { color: #d4a843; }
.theme-navy-gold::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 80% 20%, rgba(212,168,67,0.06) 0%, transparent 60%);
  pointer-events: none;
}
/* Gold corner ornaments */
.theme-navy-gold .ornament-tl,
.theme-navy-gold .ornament-br {
  position: absolute; width: 60px; height: 60px; opacity: 0.3;
  border-color: #d4a843; border-style: solid; border-width: 0;
}
.theme-navy-gold .ornament-tl { top: 40px; left: 40px; border-top-width: 2px; border-left-width: 2px; }
.theme-navy-gold .ornament-br { bottom: 40px; right: 40px; border-bottom-width: 2px; border-right-width: 2px; }

/* ── THEME: Dark Suspense ── */
.theme-dark-suspense {
  background: #0a0a0e;
  color: #f0f0f0;
}
.theme-dark-suspense::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(139,26,26,0.15) 100%);
  pointer-events: none;
}
.theme-dark-suspense .s-headline {
  font-family: 'Bebas Neue', sans-serif; font-weight: 400;
  letter-spacing: 0.04em; font-size: 88px; color: #f0f0f0;
}
.theme-dark-suspense .s-eyebrow { color: #8b1a1a; letter-spacing: 0.2em; font-family: 'DM Sans', sans-serif; }
.theme-dark-suspense .s-divider { background: #8b1a1a; width: 120px; height: 3px; }
.theme-dark-suspense .s-list-bullet { color: #c0392b; }
.theme-dark-suspense .s-trope-block { color: #c0392b; border-color: #8b1a1a; }
.theme-dark-suspense .s-list-item { font-family: 'DM Sans', sans-serif; }
.theme-dark-suspense .s-char-role { font-family: 'DM Sans', sans-serif; color: #8b1a1a; }
.theme-dark-suspense .s-char-name { font-family: 'Bebas Neue', sans-serif; font-weight: 400; }
.theme-dark-suspense .s-char-block { background: rgba(255,255,255,0.03); border: 1px solid rgba(139,26,26,0.3); }
.theme-dark-suspense .s-quote-mark { color: #8b1a1a; }
.theme-dark-suspense .s-handle { color: #c0392b; font-family: 'DM Sans', sans-serif; }
.theme-dark-suspense .s-quote-text { font-family: 'DM Sans', sans-serif; font-style: normal; }

/* ── THEME: Warm Parchment ── */
.theme-warm-parchment {
  background: #f4ede0;
  color: #2d1f14;
}
.theme-warm-parchment::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(192,128,104,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.theme-warm-parchment .s-headline { font-family: 'Cormorant Garamond', serif; font-style: italic; color: #2d1f14; font-size: 78px; }
.theme-warm-parchment .s-eyebrow { color: #c08068; font-family: 'Cormorant Garamond', serif; font-style: italic; }
.theme-warm-parchment .s-body { font-family: 'Lora', serif; }
.theme-warm-parchment .s-divider { background: #c08068; }
.theme-warm-parchment .s-list-bullet { color: #c08068; }
.theme-warm-parchment .s-trope-block { color: #2d1f14; border-color: #c08068; background: rgba(192,128,104,0.1); }
.theme-warm-parchment .s-char-block { background: rgba(192,128,104,0.08); border: 1px solid rgba(192,128,104,0.25); }
.theme-warm-parchment .s-char-role { color: #c08068; }
.theme-warm-parchment .s-quote-mark { color: #c08068; opacity: 0.3; }
.theme-warm-parchment .s-handle { color: #a06048; }
.theme-warm-parchment .s-swipe { color: #7a5040; }

/* ── THEME: Clean Editorial ── */
.theme-clean-editorial {
  background: #ffffff;
  color: #111111;
}
.theme-clean-editorial .s-headline { font-family: 'DM Sans', sans-serif; font-weight: 700; letter-spacing: -0.02em; font-size: 82px; }
.theme-clean-editorial .s-eyebrow { font-family: 'DM Sans', sans-serif; font-weight: 600; color: #1a2744; letter-spacing: 0.2em; }
.theme-clean-editorial .s-divider { background: #1a2744; width: 100px; height: 4px; }
.theme-clean-editorial .s-list-item { font-family: 'DM Sans', sans-serif; border-bottom: 1px solid #eee; padding-bottom: 16px; }
.theme-clean-editorial .s-list-bullet { color: #1a2744; }
.theme-clean-editorial .s-trope-block { color: #1a2744; border-color: #1a2744; background: #f5f5f5; }
.theme-clean-editorial .s-char-block { background: #f5f5f5; border: none; border-left: 6px solid #1a2744; border-radius: 4px; }
.theme-clean-editorial .s-char-role { font-family: 'DM Sans', sans-serif; color: #1a2744; }
.theme-clean-editorial .s-char-name { font-family: 'DM Sans', sans-serif; }
.theme-clean-editorial .s-quote-mark { color: #1a2744; }
.theme-clean-editorial .s-handle { color: #1a2744; font-weight: 600; }

/* ══════════════════════════════════════════════════════
   AUTH OVERLAYS (login + paywall)
   ══════════════════════════════════════════════════════ */

.auth-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(160deg, #050a12 0%, #0a1220 40%, #0e1830 80%, #0a0f1a 100%);
  display: flex; align-items: center; justify-content: center;
  overflow-y: auto; padding: 40px 20px;
}
/* Subtle radial glow behind the center content */
.auth-overlay::before {
  content: ''; position: absolute;
  top: 15%; left: 50%; transform: translateX(-50%);
  width: 600px; height: 400px;
  background: radial-gradient(ellipse, rgba(212,168,67,0.06) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}
.auth-overlay-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 36px; width: 100%; max-width: 480px;
  position: relative; z-index: 1;
}
.auth-brand { text-align: center; }
.auth-brand-logo {
  font-family: 'Cinzel', serif; font-size: 46px; font-weight: 700;
  letter-spacing: 3px; line-height: 1; margin-bottom: 14px;
}
.auth-brand-logo .brand-ink  {
  background: linear-gradient(135deg, #f0e6d4 0%, #d4a843 50%, #f0e6d4 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: auth-shimmer 4s ease-in-out infinite;
}
.auth-brand-logo .brand-slide {
  color: #d4a843;
  text-shadow: 0 0 30px rgba(212,168,67,0.2);
}
@keyframes auth-shimmer {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 200% center; }
}
.auth-tagline {
  font-size: 15px; color: #8b9bb4; line-height: 1.6;
  max-width: 360px; margin: 0 auto;
  letter-spacing: 0.01em;
}
/* ── Clerk Sign-In Component Overrides ──
   Direct CSS targeting of Clerk's .cl-* classes.
   Uses !important to override Clerk's inline styles reliably
   across all browsers (including Brave which blocks backdrop-filter). */
#clerk-sign-in-mount {
  width: 100%;
}

/* Card container */
#clerk-sign-in-mount .cl-card,
#clerk-sign-in-mount .cl-signIn-root .cl-card,
#clerk-sign-in-mount [class*="cl-card"] {
  background: #111b2c !important;
  border: 1px solid rgba(212,168,67,0.18) !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 60px rgba(212,168,67,0.05) !important;
}

/* Header text */
#clerk-sign-in-mount .cl-headerTitle,
#clerk-sign-in-mount [class*="cl-headerTitle"] {
  color: #e2d9c9 !important;
}
#clerk-sign-in-mount .cl-headerSubtitle,
#clerk-sign-in-mount [class*="cl-headerSubtitle"] {
  color: #687a8f !important;
}

/* Social / OAuth buttons */
#clerk-sign-in-mount .cl-socialButtonsBlockButton,
#clerk-sign-in-mount [class*="cl-socialButtonsBlockButton"] {
  background: #0e1726 !important;
  border: 1px solid #1e2d42 !important;
  color: #c4b898 !important;
}
#clerk-sign-in-mount .cl-socialButtonsBlockButton:hover,
#clerk-sign-in-mount [class*="cl-socialButtonsBlockButton"]:hover {
  background: #162236 !important;
  border-color: #2a3d56 !important;
}

/* Divider ("or") */
#clerk-sign-in-mount .cl-dividerLine,
#clerk-sign-in-mount [class*="cl-dividerLine"] {
  background: #1e2d42 !important;
}
#clerk-sign-in-mount .cl-dividerText,
#clerk-sign-in-mount [class*="cl-dividerText"] {
  color: #8b9bb4 !important;
}

/* Form labels */
#clerk-sign-in-mount .cl-formFieldLabel,
#clerk-sign-in-mount [class*="cl-formFieldLabel"] {
  color: #8b9bb4 !important;
}

/* Input fields */
#clerk-sign-in-mount .cl-formFieldInput,
#clerk-sign-in-mount [class*="cl-formFieldInput"],
#clerk-sign-in-mount input[type="email"],
#clerk-sign-in-mount input[type="text"],
#clerk-sign-in-mount input[type="password"] {
  background: #0a1019 !important;
  border: 1px solid #1e2d42 !important;
  color: #e2d9c9 !important;
  border-radius: 10px !important;
}
#clerk-sign-in-mount .cl-formFieldInput:focus,
#clerk-sign-in-mount [class*="cl-formFieldInput"]:focus,
#clerk-sign-in-mount input:focus {
  border-color: #d4a843 !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(212,168,67,0.15) !important;
}

/* Primary action button (Continue) */
#clerk-sign-in-mount .cl-formButtonPrimary,
#clerk-sign-in-mount [class*="cl-formButtonPrimary"] {
  background: linear-gradient(135deg, #c9963a, #d4a843) !important;
  color: #0c1220 !important;
  font-weight: 700 !important;
  border: none !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 16px rgba(212,168,67,0.3) !important;
}
#clerk-sign-in-mount .cl-formButtonPrimary:hover,
#clerk-sign-in-mount [class*="cl-formButtonPrimary"]:hover {
  box-shadow: 0 6px 24px rgba(212,168,67,0.4) !important;
}

/* Footer links (Sign up, etc.) */
#clerk-sign-in-mount .cl-footerActionLink,
#clerk-sign-in-mount [class*="cl-footerActionLink"] {
  color: #d4a843 !important;
}
#clerk-sign-in-mount .cl-footerActionText,
#clerk-sign-in-mount [class*="cl-footerActionText"] {
  color: #8b9bb4 !important;
}

/* "Secured by Clerk" footer */
#clerk-sign-in-mount .cl-footer,
#clerk-sign-in-mount [class*="cl-footer"] {
  opacity: 0.5;
}

/* Internal links */
#clerk-sign-in-mount .cl-footerAction a,
#clerk-sign-in-mount a[class*="cl-footerActionLink"] {
  color: #d4a843 !important;
}

.paywall-card {
  background: #111b2c;
  border: 1px solid rgba(212,168,67,0.25); border-radius: 20px;
  padding: 36px 40px; width: 100%; text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.paywall-plan-name { font-family: 'Cinzel', serif; font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: #d4a843; margin-bottom: 16px; }
.paywall-price { margin-bottom: 6px; line-height: 1; }
.paywall-amount { font-family: 'Cormorant Garamond', serif; font-size: 72px; font-weight: 300; color: #e2d9c9; }
.paywall-period { font-size: 18px; color: #8b9bb4; margin-left: 4px; }
.paywall-trial-badge {
  display: inline-block;
  background: rgba(212,168,67,0.12); border: 1px solid rgba(212,168,67,0.35);
  border-radius: 20px; padding: 6px 18px; font-size: 12px;
  color: #d4a843; letter-spacing: 0.5px; margin: 14px 0 24px;
}
.paywall-features { list-style: none; text-align: left; margin-bottom: 28px; display: flex; flex-direction: column; gap: 10px; }
.paywall-features li { font-size: 14px; color: #c4b898; padding-left: 4px; }
.paywall-cta {
  width: 100%; background: linear-gradient(135deg, #c9963a, #d4a843);
  color: #0c1220; font-family: 'DM Sans', sans-serif;
  font-size: 16px; font-weight: 700; padding: 16px 32px;
  border-radius: 12px; border: none; cursor: pointer;
  letter-spacing: 0.5px; transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 20px rgba(212,168,67,0.3);
}
.paywall-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(212,168,67,0.45); }
.paywall-fine-print { margin-top: 14px; font-size: 12px; color: #4a5b6e; }
.paywall-signout { background: none; border: none; color: #4a5b6e; font-size: 13px; cursor: pointer; padding: 8px; transition: color 0.15s; }
.paywall-signout:hover { color: #8b9bb4; }

.user-avatar-wrap {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 8px 12px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; position: relative; cursor: pointer;
}
.user-avatar-wrap:hover .user-avatar-menu { display: flex; }
.user-avatar-img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(212,168,67,0.4); }
.user-avatar-name { font-size: 12px; color: #c4b898; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar-menu {
  display: none; flex-direction: column;
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0;
  background: #131e30; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; overflow: hidden; z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.avatar-menu-btn { background: none; border: none; color: #c4b898; font-size: 13px; padding: 11px 16px; text-align: left; cursor: pointer; transition: background 0.15s; }
.avatar-menu-btn:hover { background: rgba(255,255,255,0.05); }
.avatar-menu-signout { color: #e07070; }
.avatar-menu-signout:hover { background: rgba(224,112,112,0.08); }
