:root {
  --bg: #0a0a0f;
  --bg-warm: #0f0e14;
  --fg: #e8e4dc;
  --fg-dim: #9a9590;
  --accent: #c9a84c;
  --accent-glow: #e8c45a;
  --accent-dark: #8a6e2f;
  --surface: #16151e;
  --surface-border: #2a2835;
  --romance: #8b2252;
  --thriller: #1a3a5c;
  --fantasy: #2d1b4e;
  --scifi: #0d3b3b;
  --horror: #2a0a0a;
  --literary: #1a1a2e;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ============ HERO ============ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 2rem;
  background: radial-gradient(ellipse at 30% 50%, rgba(201,168,76,0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 30%, rgba(139,34,82,0.04) 0%, transparent 50%),
              var(--bg);
}

.hero-bg-text {
  position: absolute;
  font-family: var(--font-display);
  font-size: clamp(15rem, 25vw, 30rem);
  font-weight: 900;
  color: rgba(201,168,76,0.03);
  letter-spacing: -0.03em;
  user-select: none;
  pointer-events: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.hero-content {
  max-width: 800px;
  position: relative;
  z-index: 1;
}

.hero-kicker {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.hero-accent {
  color: var(--accent);
  font-style: italic;
}

.hero-lede {
  font-size: 1.15rem;
  color: var(--fg-dim);
  max-width: 600px;
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.hero-cta {
  display: inline-block;
  padding: 0.9rem 2.25rem;
  background: var(--accent);
  color: #0a0a0f;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 6px;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background 0.2s, transform 0.15s;
}

.hero-cta:hover {
  background: var(--accent-glow);
  transform: translateY(-2px);
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
}

.scroll-line {
  width: 1px;
  height: 60px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ============ PIPELINE ============ */
.pipeline {
  padding: 6rem 2rem;
  background: var(--bg-warm);
}

.pipeline-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.section-label {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  color: var(--fg-dim);
  font-size: 1.05rem;
  margin-bottom: 3.5rem;
  max-width: 550px;
}

.pipeline-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.step {
  flex: 1;
  padding: 2rem 1.5rem;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 0.3s, transform 0.3s;
}

.step:hover {
  border-color: var(--accent-dark);
  transform: translateY(-4px);
}

.step-number {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent);
  opacity: 0.4;
  line-height: 1;
  margin-bottom: 1rem;
}

.step h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.step p {
  color: var(--fg-dim);
  font-size: 0.92rem;
  line-height: 1.6;
}

.step-arrow {
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  font-size: 1.5rem;
  color: var(--accent-dark);
  margin-top: 3rem;
}

/* ============ NUMBERS ============ */
.numbers {
  padding: 5rem 2rem;
  border-top: 1px solid var(--surface-border);
  border-bottom: 1px solid var(--surface-border);
}

.numbers-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
}

.number-item { text-align: center; }

.number-value {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.number-label {
  font-size: 0.85rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.number-divider {
  width: 1px;
  height: 50px;
  background: var(--surface-border);
}

/* ============ GENRES ============ */
.genres {
  padding: 6rem 2rem;
  background: var(--bg-warm);
}

.genres-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.genres .section-subtitle {
  max-width: 700px;
  margin-bottom: 3rem;
}

.genre-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.genre-card {
  padding: 2.5rem 2rem;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.3s, border-color 0.3s;
}

.genre-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-dark);
}

.genre-romance { background: linear-gradient(135deg, var(--romance) 0%, var(--surface) 100%); }
.genre-thriller { background: linear-gradient(135deg, var(--thriller) 0%, var(--surface) 100%); }
.genre-fantasy { background: linear-gradient(135deg, var(--fantasy) 0%, var(--surface) 100%); }
.genre-scifi { background: linear-gradient(135deg, var(--scifi) 0%, var(--surface) 100%); }
.genre-horror { background: linear-gradient(135deg, var(--horror) 0%, var(--surface) 100%); }
.genre-literary { background: linear-gradient(135deg, var(--literary) 0%, var(--surface) 100%); }

.genre-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}

.genre-detail {
  font-size: 0.9rem;
  color: var(--fg-dim);
}

/* ============ CLOSING ============ */
.closing {
  padding: 8rem 2rem;
  text-align: center;
  background: radial-gradient(ellipse at 50% 50%, rgba(201,168,76,0.06) 0%, transparent 70%),
              var(--bg);
}

.closing-inner {
  max-width: 700px;
  margin: 0 auto;
}

.closing h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  font-style: italic;
  color: var(--accent-glow);
}

.closing p {
  color: var(--fg-dim);
  font-size: 1.1rem;
  line-height: 1.8;
}

/* ============ FOOTER ============ */
.site-footer {
  padding: 2rem;
  border-top: 1px solid var(--surface-border);
  text-align: center;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
}

.footer-sep {
  color: var(--surface-border);
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--fg-dim);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .pipeline-steps {
    flex-direction: column;
    gap: 1rem;
  }
  .step-arrow {
    transform: rotate(90deg);
    margin: 0 auto;
    padding: 0.5rem 0;
  }
  .genre-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .numbers-inner {
    flex-wrap: wrap;
    gap: 2rem;
  }
  .number-divider {
    display: none;
  }
}

@media (max-width: 600px) {
  .genre-grid {
    grid-template-columns: 1fr;
  }
  .hero {
    padding: 2rem 1.5rem;
  }
  .hero-bg-text {
    font-size: 8rem;
  }
  .numbers-inner {
    flex-direction: column;
    gap: 2.5rem;
  }
}

/* ============ NAV ============ */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(42,40,53,0.5);
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.2rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-cta {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: #0a0a0f;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.2s;
}

.nav-cta:hover { background: var(--accent-glow); }

/* ============ FORGE APP ============ */
.forge-app {
  min-height: 100vh;
  background: var(--bg);
  padding: 6rem 2rem 4rem;
}

.forge-step { display: block; }
.forge-step--hidden { display: none !important; }

.forge-inner {
  max-width: 720px;
  margin: 0 auto;
}

.forge-inner--centered {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding-top: 4rem;
}

.forge-heading {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.forge-sub {
  color: var(--fg-dim);
  font-size: 1rem;
  margin-bottom: 2rem;
}

/* ── Form ── */
.forge-form { display: flex; flex-direction: column; gap: 1.5rem; }

.forge-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  padding: 1rem 1.25rem;
  resize: vertical;
  transition: border-color 0.2s;
  outline: none;
}

.forge-textarea:focus { border-color: var(--accent-dark); }
.forge-textarea::placeholder { color: var(--fg-dim); opacity: 0.6; }

/* ── Genre pills ── */
.genre-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 0.75rem;
}

.genre-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.genre-pill {
  padding: 0.45rem 1rem;
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--fg-dim);
  user-select: none;
}

.genre-pill:hover { border-color: var(--accent-dark); color: var(--fg); }
.genre-pill.active { border-color: var(--accent); color: var(--accent); background: rgba(201,168,76,0.08); }

/* ── Primary button ── */
.forge-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  background: var(--accent);
  color: #0a0a0f;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  text-decoration: none;
  align-self: flex-start;
}

.forge-btn:hover { background: var(--accent-glow); transform: translateY(-1px); }
.forge-btn:active { transform: translateY(0); }

.forge-btn--outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.forge-btn--outline:hover { background: rgba(201,168,76,0.08); }

.forge-btn-arrow { font-size: 1.1rem; }

/* ── Spinner ── */
.forge-spinner { position: relative; width: 64px; height: 64px; }

.spinner-ring {
  width: 64px; height: 64px;
  border: 3px solid var(--surface-border);
  border-top-color: var(--fg-dim);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

.spinner-ring--gold {
  border-top-color: var(--accent);
}

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

/* ── Progress bar ── */
.forge-progress-bar {
  width: 100%;
  max-width: 400px;
  height: 3px;
  background: var(--surface-border);
  border-radius: 2px;
  overflow: hidden;
}

.forge-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease-out;
}

.forge-progress-fill--slow {
  transition: width 0.5s ease-out;
}

/* ── Outline ── */
.forge-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.forge-tagline {
  color: var(--fg-dim);
  font-size: 1.1rem;
  font-style: italic;
  margin-bottom: 2rem;
}

.outline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
}

.meta-block { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; min-width: 200px; }
.meta-label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); }
.meta-value { font-size: 0.92rem; color: var(--fg); }

.chapters-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.chapters-list::-webkit-scrollbar { width: 4px; }
.chapters-list::-webkit-scrollbar-track { background: var(--surface); }
.chapters-list::-webkit-scrollbar-thumb { background: var(--surface-border); border-radius: 2px; }

.outline-chapter {
  display: flex;
  gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
}

.outline-ch-num {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--accent);
  opacity: 0.5;
  min-width: 28px;
  line-height: 1.4;
}

.outline-ch-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.outline-ch-summary {
  font-size: 0.85rem;
  color: var(--fg-dim);
  line-height: 1.5;
}

/* ── Chapter reader ── */
.word-count-banner {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.chapter-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.chapter-tab {
  padding: 0.4rem 1rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 4px;
  color: var(--fg-dim);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.chapter-tab:hover { border-color: var(--accent-dark); color: var(--fg); }
.chapter-tab--active { border-color: var(--accent); color: var(--accent); background: rgba(201,168,76,0.08); }

.chapter-heading {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.chapter-wordcount {
  font-size: 0.8rem;
  color: var(--fg-dim);
  margin-bottom: 2rem;
  letter-spacing: 0.05em;
}

.chapter-content {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.5rem;
  margin-bottom: 2rem;
}

.chapter-content::-webkit-scrollbar { width: 4px; }
.chapter-content::-webkit-scrollbar-track { background: var(--surface); }
.chapter-content::-webkit-scrollbar-thumb { background: var(--surface-border); border-radius: 2px; }

.chapter-para {
  margin-bottom: 1.25em;
  line-height: 1.85;
  font-size: 1.05rem;
  text-indent: 1.5em;
}

.chapter-para:first-of-type { text-indent: 0; }

.forge-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── Error state ── */
.forge-error-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .forge-app { padding: 5rem 1rem 3rem; }
  .forge-btn { align-self: stretch; justify-content: center; }
  .forge-actions { flex-direction: column; }
}