/* ============================================================
   StoryForge — Luxury Dark Editorial Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,900;1,400;1,700&family=Crimson+Pro:ital,wght@0,300;0,400;0,500;1,300;1,400&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --ink:        #0a0908;
  --deep:       #111010;
  --surface:    #181614;
  --card:       #1f1d1b;
  --border:     #2e2b27;
  --muted:      #4a4640;
  --subtle:     #6b6560;
  --text:       #e8e3da;
  --text-dim:   #a09890;
  --gold:       #c9a84c;
  --gold-light: #e8c97a;
  --gold-dim:   #7a6230;
  --amber:      #d4841a;
  --rose:       #c4645a;
  --sage:       #6b8f71;
  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  20px;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.4);
  --shadow:     0 8px 32px rgba(0,0,0,.5);
  --shadow-lg:  0 24px 64px rgba(0,0,0,.6);
  --glow:       0 0 40px rgba(201,168,76,.12);
  --transition: all .25s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Crimson Pro', Georgia, serif;
  background: var(--ink);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(201,168,76,.06) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.03'/%3E%3C/svg%3E");
}

/* ── Typography ── */
h1,h2,h3,h4,h5,h6 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.2;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(2rem,5vw,3.5rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem,3vw,2.25rem); font-weight: 600; }
h3 { font-size: 1.5rem; font-weight: 600; }
h4 { font-size: 1.2rem; font-weight: 600; }

p { color: var(--text-dim); font-size: 1.05rem; }

a { color: var(--gold); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold-light); }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 760px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,9,8,.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: .9rem 0;
}
.navbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.navbar-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text) !important;
  display: flex; align-items: center; gap: .5rem;
}
.navbar-brand span { color: var(--gold); }
.navbar-brand .logo-icon {
  width: 36px; height: 36px; background: var(--gold);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--ink);
}
.nav-links {
  display: flex; align-items: center; gap: .25rem; list-style: none;
}
.nav-links a {
  color: var(--text-dim); font-family: 'DM Sans', sans-serif;
  font-size: .9rem; font-weight: 400; padding: .5rem .9rem;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text); background: var(--surface);
}
.nav-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold-dim); border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif; font-size: .9rem; color: var(--gold-light);
  cursor: pointer;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: 'DM Sans', sans-serif; font-size: .9rem; font-weight: 500;
  padding: .65rem 1.4rem; border-radius: var(--radius-sm);
  border: none; cursor: pointer; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--amber) 100%);
  color: var(--ink); font-weight: 600;
  box-shadow: 0 4px 20px rgba(201,168,76,.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  color: var(--ink); transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(201,168,76,.4);
}
.btn-outline {
  background: transparent; color: var(--gold);
  border: 1px solid var(--gold-dim);
}
.btn-outline:hover {
  background: rgba(201,168,76,.08); border-color: var(--gold); color: var(--gold-light);
}
.btn-ghost {
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-danger {
  background: rgba(196,100,90,.15); color: var(--rose);
  border: 1px solid rgba(196,100,90,.3);
}
.btn-danger:hover { background: rgba(196,100,90,.25); }
.btn-lg { padding: .85rem 2rem; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: .4rem .85rem; font-size: .82rem; }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover { border-color: var(--gold-dim); box-shadow: var(--glow); }
.card-body { padding: 1.5rem; }
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.01);
}

/* ── Book Cards ── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}
.book-card {
  position: relative; border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: var(--transition);
  background: var(--card); border: 1px solid var(--border);
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg), var(--glow); border-color: var(--gold-dim); }
.book-cover {
  aspect-ratio: 3/4; overflow: hidden;
  background: linear-gradient(135deg, var(--surface), var(--muted));
  position: relative;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.book-card:hover .book-cover img { transform: scale(1.05); }
.book-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: .75rem;
  background: linear-gradient(135deg, #1f1d1b, #2e2b27);
  color: var(--gold-dim);
}
.book-cover-placeholder .title-preview {
  font-family: 'Playfair Display', serif;
  font-size: 1rem; text-align: center; padding: 0 1rem;
  color: var(--text-dim);
}
.book-meta { padding: 1rem; }
.book-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem; font-weight: 600; color: var(--text);
  margin-bottom: .35rem; line-height: 1.3;
}
.book-info {
  font-family: 'DM Sans', sans-serif;
  font-size: .78rem; color: var(--subtle);
  display: flex; gap: .75rem; flex-wrap: wrap;
}
.book-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .6rem; border-radius: 20px;
  font-family: 'DM Sans', sans-serif; font-size: .72rem; font-weight: 500;
  background: rgba(201,168,76,.1); color: var(--gold); border: 1px solid rgba(201,168,76,.2);
}
.book-badge.status-generating {
  background: rgba(212,132,26,.1); color: var(--amber); border-color: rgba(212,132,26,.2);
}
.book-badge.status-complete {
  background: rgba(107,143,113,.1); color: var(--sage); border-color: rgba(107,143,113,.2);
}
.book-badge.status-failed {
  background: rgba(196,100,90,.1); color: var(--rose); border-color: rgba(196,100,90,.2);
}

/* ── Forms ── */
.form-group { margin-bottom: 1.4rem; }
.form-label {
  display: block; margin-bottom: .5rem;
  font-family: 'DM Sans', sans-serif; font-size: .85rem; font-weight: 500;
  color: var(--text-dim); letter-spacing: .03em; text-transform: uppercase;
}
.form-control {
  width: 100%; padding: .75rem 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: 'Crimson Pro', serif; font-size: 1rem;
  transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(201,168,76,.1); }
.form-control::placeholder { color: var(--muted); }
.form-select {
  width: 100%; padding: .75rem 2.5rem .75rem 1rem;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23c9a84c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 1rem center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: 'DM Sans', sans-serif; font-size: .9rem;
  transition: var(--transition); outline: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.form-select:focus { border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(201,168,76,.1); }

/* ── Option Cards (Radio Buttons Styled) ── */
.option-grid { display: grid; gap: .75rem; }
.option-grid-2 { grid-template-columns: 1fr 1fr; }
.option-grid-3 { grid-template-columns: repeat(3,1fr); }
.option-card input[type="radio"] { display: none; }
.option-card label {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  padding: 1rem .75rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer;
  transition: var(--transition); text-align: center;
}
.option-card label:hover { border-color: var(--gold-dim); background: rgba(201,168,76,.04); }
.option-card input:checked + label {
  border-color: var(--gold); background: rgba(201,168,76,.1);
  box-shadow: 0 0 0 3px rgba(201,168,76,.15);
}
.option-card .option-icon { font-size: 1.5rem; }
.option-card .option-title {
  font-family: 'DM Sans', sans-serif; font-size: .85rem; font-weight: 500; color: var(--text);
}
.option-card .option-desc {
  font-family: 'DM Sans', sans-serif; font-size: .72rem; color: var(--subtle); line-height: 1.4;
}

/* ── Alerts / Flash ── */
.alert {
  padding: .9rem 1.2rem; border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif; font-size: .9rem;
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: 1.25rem;
}
.alert-success { background: rgba(107,143,113,.15); border: 1px solid rgba(107,143,113,.3); color: #8db595; }
.alert-error { background: rgba(196,100,90,.15); border: 1px solid rgba(196,100,90,.3); color: #d4837a; }
.alert-info { background: rgba(201,168,76,.1); border: 1px solid rgba(201,168,76,.25); color: var(--gold); }
.alert-warning { background: rgba(212,132,26,.12); border: 1px solid rgba(212,132,26,.3); color: var(--amber); }

/* ── Hero ── */
.hero {
  min-height: 88vh; display: flex; align-items: center;
  position: relative; overflow: hidden;
  padding: 5rem 0;
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 60% 70% at 70% 50%, rgba(201,168,76,.08) 0%, transparent 55%),
    radial-gradient(ellipse 40% 60% at 20% 80%, rgba(196,100,90,.06) 0%, transparent 50%);
}
.hero-content { position: relative; z-index: 1; max-width: 680px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .35rem 1rem; border-radius: 20px;
  background: rgba(201,168,76,.1); border: 1px solid rgba(201,168,76,.2);
  font-family: 'DM Sans', sans-serif; font-size: .8rem; font-weight: 500;
  color: var(--gold); letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 1.5rem;
}
.hero h1 { margin-bottom: 1.25rem; }
.hero h1 em { font-style: italic; color: var(--gold); }
.hero p { font-size: 1.15rem; max-width: 520px; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-image-side {
  position: absolute; right: 0; top: 0; bottom: 0; width: 45%;
  background: linear-gradient(135deg, var(--card) 0%, var(--surface) 100%);
  clip-path: polygon(8% 0, 100% 0, 100% 100%, 0 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.hero-books-preview {
  display: flex; gap: 1rem; padding: 2rem; transform: rotate(-5deg);
}
.hero-book-thumb {
  width: 90px; border-radius: 8px; overflow: hidden;
  box-shadow: var(--shadow);
  animation: float 4s ease-in-out infinite;
}
.hero-book-thumb:nth-child(2) { animation-delay: .8s; margin-top: 1.5rem; }
.hero-book-thumb:nth-child(3) { animation-delay: 1.6s; }
.hero-book-thumb img { width: 100%; display: block; }
@keyframes float { 0%,100%{transform:translateY(0)}50%{transform:translateY(-8px)} }

/* ── Stats Strip ── */
.stats-strip {
  padding: 2rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; text-align: center; }
.stat-value {
  font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700;
  color: var(--gold); line-height: 1;
}
.stat-label {
  font-family: 'DM Sans', sans-serif; font-size: .8rem; color: var(--subtle);
  margin-top: .35rem; letter-spacing: .05em; text-transform: uppercase;
}

/* ── Section ── */
.section { padding: 5rem 0; }
.section-header { margin-bottom: 3rem; }
.section-eyebrow {
  font-family: 'DM Sans', sans-serif; font-size: .8rem; font-weight: 500;
  color: var(--gold); letter-spacing: .1em; text-transform: uppercase;
  margin-bottom: .75rem;
}
.section-title { margin-bottom: .75rem; }
.section-subtitle { font-size: 1.1rem; max-width: 520px; }

/* ── Story Builder ── */
.builder-layout {
  display: grid; grid-template-columns: 340px 1fr; gap: 2rem; align-items: start;
}
.builder-steps {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  position: sticky; top: 5rem;
}
.builder-step {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  cursor: pointer; transition: var(--transition);
}
.builder-step:last-child { border-bottom: none; }
.builder-step.active { background: rgba(201,168,76,.06); }
.builder-step.done .step-num { background: var(--gold); color: var(--ink); }
.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Sans', sans-serif; font-size: .82rem; font-weight: 600;
  color: var(--text-dim); flex-shrink: 0; transition: var(--transition);
}
.step-info .step-title {
  font-family: 'DM Sans', sans-serif; font-size: .9rem; font-weight: 500; color: var(--text);
}
.step-info .step-subtitle {
  font-family: 'DM Sans', sans-serif; font-size: .78rem; color: var(--subtle); margin-top: .15rem;
}
.builder-panel { display: none; }
.builder-panel.active { display: block; animation: fadeSlideIn .3s ease; }

/* ── Book Reader ── */
.reader-container { max-width: 900px; margin: 0 auto; }
.reader-header {
  text-align: center; padding: 3rem 1.5rem 2rem;
  border-bottom: 1px solid var(--border); margin-bottom: 2.5rem;
}
.reader-cover {
  width: 160px; height: 213px; border-radius: var(--radius);
  overflow: hidden; margin: 0 auto 1.5rem;
  box-shadow: var(--shadow-lg);
}
.reader-cover img { width: 100%; height: 100%; object-fit: cover; }
.page-container { margin-bottom: 3rem; }
.page-wrapper {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: 1.5rem;
}
.page-image {
  width: 100%; aspect-ratio: 16/9; overflow: hidden;
  background: var(--surface);
}
.page-image img { width: 100%; height: 100%; object-fit: cover; }
.page-image-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--surface) 0%, var(--card) 100%);
  color: var(--muted); font-size: 2.5rem;
}
.page-text-container { padding: 2rem 2.5rem; }
.page-number-label {
  font-family: 'DM Sans', sans-serif; font-size: .75rem; font-weight: 500;
  color: var(--gold); letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: 1.25rem; display: flex; align-items: center; gap: .5rem;
}
.page-number-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.page-text {
  font-family: 'Crimson Pro', serif; font-size: 1.15rem; color: var(--text);
  line-height: 1.85; max-width: 65ch;
}
.page-text p { color: var(--text); margin-bottom: 1em; }
.page-text p:last-child { margin-bottom: 0; }

/* ── Sidebar ── */
.page-sidebar { position: sticky; top: 5rem; }
.toc-list { list-style: none; }
.toc-list li a {
  display: block; padding: .6rem .9rem;
  border-radius: var(--radius-sm); font-family: 'DM Sans', sans-serif;
  font-size: .85rem; color: var(--text-dim); transition: var(--transition);
  border-left: 2px solid transparent;
}
.toc-list li a:hover, .toc-list li a.active {
  color: var(--gold); background: rgba(201,168,76,.06);
  border-left-color: var(--gold);
}

/* ── Progress Bar ── */
.progress-bar-wrap {
  width: 100%; background: var(--border); border-radius: 20px;
  height: 6px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--gold), var(--amber));
  border-radius: 20px; transition: width .5s ease;
}

/* ── Generation Progress ── */
.generation-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(10,9,8,.92); backdrop-filter: blur(8px);
  flex-direction: column; align-items: center; justify-content: center; gap: 2rem;
}
.generation-overlay.visible { display: flex; }
.gen-spinner {
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gen-title {
  font-family: 'Playfair Display', serif; font-size: 1.75rem; font-weight: 700;
  text-align: center;
}
.gen-subtitle {
  font-family: 'DM Sans', sans-serif; color: var(--text-dim); text-align: center;
}
.gen-log {
  width: 100%; max-width: 480px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; max-height: 160px; overflow-y: auto;
  font-family: 'DM Mono', monospace, 'DM Sans', sans-serif;
  font-size: .78rem; color: var(--subtle);
}
.gen-log p { margin-bottom: .25rem; color: var(--text-dim); }
.gen-log p.success { color: var(--sage); }
.gen-log p.error { color: var(--rose); }

/* ── Pagination ── */
.pagination { display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif; font-size: .85rem;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-dim); transition: var(--transition);
}
.page-link:hover { border-color: var(--gold-dim); color: var(--gold); }
.page-link.active { background: var(--gold); color: var(--ink); border-color: var(--gold); font-weight: 600; }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-family: 'DM Sans', sans-serif; font-size: .78rem; font-weight: 500;
  color: var(--subtle); text-transform: uppercase; letter-spacing: .06em;
  padding: .75rem 1rem; text-align: left;
  border-bottom: 1px solid var(--border); background: rgba(255,255,255,.02);
}
.data-table td {
  padding: 1rem; border-bottom: 1px solid var(--border);
  font-family: 'DM Sans', sans-serif; font-size: .88rem; color: var(--text-dim);
  vertical-align: middle;
}
.data-table tr:hover td { background: rgba(255,255,255,.02); }
.data-table tr:last-child td { border-bottom: none; }

/* ── Admin Sidebar ── */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--deep); border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-sidebar-brand {
  padding: .5rem 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border); margin-bottom: 1rem;
  font-family: 'Playfair Display', serif; font-size: 1.1rem; color: var(--text);
}
.admin-sidebar-brand small {
  display: block; font-family: 'DM Sans', sans-serif;
  font-size: .72rem; color: var(--gold); letter-spacing: .1em; text-transform: uppercase;
}
.admin-nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1.5rem; font-family: 'DM Sans', sans-serif;
  font-size: .88rem; color: var(--text-dim); transition: var(--transition);
  border-left: 2px solid transparent;
}
.admin-nav-item:hover { color: var(--text); background: rgba(255,255,255,.03); }
.admin-nav-item.active { color: var(--gold); border-left-color: var(--gold); background: rgba(201,168,76,.06); }
.admin-nav-item .nav-icon { font-size: 1rem; width: 18px; text-align: center; }
.admin-main { flex: 1; padding: 2rem; overflow: auto; }
.admin-header { margin-bottom: 2rem; }
.admin-header h2 { font-family: 'Playfair Display', serif; }
.admin-header p { font-family: 'DM Sans', sans-serif; color: var(--subtle); font-size: .9rem; }

/* ── Stat Cards ── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.stat-card-value {
  font-family: 'Playfair Display', serif; font-size: 2.25rem;
  font-weight: 700; color: var(--text); line-height: 1;
}
.stat-card-label {
  font-family: 'DM Sans', sans-serif; font-size: .8rem;
  color: var(--subtle); margin-top: .4rem;
  text-transform: uppercase; letter-spacing: .06em;
}
.stat-card-icon {
  position: absolute; right: 1.25rem; top: 1.25rem;
  font-size: 1.75rem; opacity: .2;
}

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 2rem 0; }
.divider-text {
  display: flex; align-items: center; gap: 1rem;
  color: var(--subtle); font-family: 'DM Sans', sans-serif; font-size: .82rem;
  margin: 1.5rem 0;
}
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .65rem; border-radius: 20px;
  font-family: 'DM Sans', sans-serif; font-size: .72rem; font-weight: 500;
}
.badge-gold { background: rgba(201,168,76,.15); color: var(--gold); }
.badge-green { background: rgba(107,143,113,.15); color: var(--sage); }
.badge-red { background: rgba(196,100,90,.15); color: var(--rose); }
.badge-amber { background: rgba(212,132,26,.12); color: var(--amber); }

/* ── Modal ── */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: rgba(10,9,8,.85); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.modal-backdrop.visible { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 520px;
  margin: 1rem; box-shadow: var(--shadow-lg); animation: scaleIn .25s ease;
}
.modal-header {
  padding: 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-family: 'Playfair Display', serif; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; justify-content: flex-end; }

/* ── Animations ── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}
.fade-in { animation: fadeSlideIn .4s ease both; }
.fade-in-delay-1 { animation-delay: .1s; }
.fade-in-delay-2 { animation-delay: .2s; }
.fade-in-delay-3 { animation-delay: .3s; }

/* ── Utility ── */
.text-gold { color: var(--gold); }
.text-muted { color: var(--subtle); }
.text-dim { color: var(--text-dim); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.p-0 { padding: 0; }
.w-100 { width: 100%; }
.flex-1 { flex: 1; }
.italic { font-style: italic; }

/* ── Footer ── */
.footer {
  padding: 3rem 0; border-top: 1px solid var(--border);
  text-align: center; background: var(--deep);
  font-family: 'DM Sans', sans-serif; color: var(--subtle); font-size: .85rem;
}
.footer-brand {
  font-family: 'Playfair Display', serif; font-size: 1.2rem;
  color: var(--text); margin-bottom: .5rem;
}
.footer-brand span { color: var(--gold); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .builder-layout { grid-template-columns: 1fr; }
  .builder-steps { position: static; }
  .hero-image-side { display: none; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .option-grid-3 { grid-template-columns: 1fr 1fr; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; }
  .reader-layout { flex-direction: column; }
}
@media (max-width: 480px) {
  .option-grid-2, .option-grid-3 { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
  h1 { font-size: 2rem; }
}

/* ── Loading Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--card) 50%, var(--surface) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { from{background-position:100% 0} to{background-position:-100% 0} }

/* ── Toast ── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999;
  display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  padding: .85rem 1.25rem; border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif; font-size: .88rem;
  box-shadow: var(--shadow-lg); min-width: 260px;
  animation: slideInRight .25s ease;
  display: flex; align-items: center; gap: .6rem;
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast-success { background: #1a2e1d; border: 1px solid rgba(107,143,113,.4); color: #8db595; }
.toast-error   { background: #2e1a1a; border: 1px solid rgba(196,100,90,.4);  color: #d4837a; }
.toast-info    { background: #2a2510; border: 1px solid rgba(201,168,76,.3);  color: var(--gold); }
