:root {
  --bg: #fffaf4;
  --bg-soft: #fff4ea;
  --surface: #ffffff;
  --surface-soft: #fdf7f0;
  --text: #081636;
  --text-muted: #5f6678;
  --accent: #ff6b5f;
  --accent-dark: #e65349;
  --accent-soft: #ffe2dc;
  --navy: #071433;
  --border: #eadfd4;
  --shadow: rgba(8, 22, 54, 0.10);
  --green: #1e8f68;
  --blue: #2d6cdf;
  --ink: #151722;
  --font-ui: "Inter", "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
textarea { resize: vertical; }

.container { width: min(1424px, calc(100% - 96px)); margin: 0 auto; }
.serif, h1, h2, h3 { font-family: var(--font-display); letter-spacing: 0; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 250, 244, .92);
  border-bottom: 1px solid rgba(234, 223, 212, .8);
  backdrop-filter: blur(18px);
}

.nav {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 34px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 27px; }
.brand img { width: 36px; height: 36px; }
.nav-links { display: flex; align-items: center; gap: 52px; color: var(--ink); font-size: 14px; }
.nav-actions { display: flex; align-items: center; gap: 14px; }
.account-chip {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  max-width: 190px;
  overflow: hidden;
  padding: 10px 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--text);
  cursor: pointer;
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 13px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  font-weight: 800;
  cursor: pointer;
}

.btn.primary { background: var(--accent); color: white; box-shadow: 0 12px 24px rgba(255, 107, 95, .22); }
.btn.primary:hover { background: var(--accent-dark); }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.navy { background: var(--navy); color: white; }
.btn.small { min-height: 38px; padding: 9px 14px; font-size: 13px; }
.btn.block { width: 100%; }

.hero {
  display: grid;
  grid-template-columns: minmax(410px, .75fr) minmax(700px, 1.25fr);
  gap: 70px;
  align-items: center;
  padding: 74px 0 34px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(50px, 4.85vw, 76px);
  line-height: .98;
  max-width: 620px;
}

.accent-text { color: var(--accent); }
.hero-copy { margin: 24px 0 28px; max-width: 575px; color: var(--text-muted); font-size: 18px; line-height: 1.75; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 16px; }

.micro-features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-top: 54px;
  max-width: 640px;
}

.micro-feature { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 14px; }
.mini-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}

.mockup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 30px 75px var(--shadow);
  overflow: hidden;
  width: 100%;
}

.mockup-top {
  height: 64px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
}

.mockup-grid {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: 500px;
}

.mockup-sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface-soft);
  padding: 18px;
}

.panel-title { color: var(--text-muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.file-chip, .chapter-row, .recent-row {
  border-radius: 8px;
  padding: 10px;
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 12px;
}
.file-chip { background: white; border: 1px solid var(--border); margin: 12px 0 18px; }
.chapter-row.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 900; }
.recent-row { color: var(--text-muted); border-bottom: 1px solid rgba(234,223,212,.7); border-radius: 0; }

.mockup-main { padding: 20px 24px 24px; }
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs span { padding-bottom: 12px; color: var(--text-muted); font-size: 13px; font-weight: 800; }
.tabs .active { color: var(--text); border-bottom: 2px solid var(--text); }
.book-preview { display: grid; grid-template-columns: 265px 1fr; gap: 30px; align-items: stretch; }
.cover-art {
  min-height: 342px;
  border-radius: 6px;
  background: url("/assets/coverauto.png") center / cover;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.page-preview { border: 1px solid var(--border); border-radius: 8px; padding: 36px; background: #fffdf9; }
.page-preview h3 { margin: 0 0 22px; font-size: 26px; }
.page-preview p { color: #27314b; line-height: 1.7; }

.section { padding: 42px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-heading.center { display: block; text-align: center; }
.section-heading h2 { margin: 0; font-size: 34px; }
.section-heading p { margin: 10px auto 0; max-width: 660px; color: var(--text-muted); line-height: 1.65; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.feature-card { padding: 28px 30px; border-right: 1px solid var(--border); min-height: 190px; }
.feature-card:last-child { border-right: 0; }
.feature-card .mini-icon { width: 48px; height: 48px; margin-bottom: 22px; font-size: 22px; }
.feature-card h3 { font-family: inherit; margin: 0 0 12px; font-size: 16px; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.6; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 50px; text-align: center; margin-top: 28px; }
.step-icon { position: relative; margin: 0 auto 16px; width: 86px; height: 86px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 32px; }
.step-number { position: absolute; top: -8px; right: -4px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: white; display: grid; place-items: center; font-weight: 900; font-size: 13px; }
.step h3 { font-family: inherit; margin: 0 0 10px; }
.step p { margin: 0; color: var(--text-muted); line-height: 1.6; }

.template-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
.template-card, .testimonial, .price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(8, 22, 54, .04);
}
.template-card { display: grid; grid-template-columns: 105px 1fr; gap: 16px; padding: 14px; }
.book-thumb { min-height: 152px; border-radius: 6px; display: grid; place-items: center; text-align: center; padding: 12px; font-family: var(--font-display); font-weight: 800; }
.book-thumb.serenity { color: white; background: linear-gradient(140deg, #18385c, #80a5bd); }
.book-thumb.classic { color: #7a5943; background: linear-gradient(140deg, #fff8ef, #ead3bd); border: 1px solid #e3c4aa; }
.book-thumb.noir { color: white; background: linear-gradient(140deg, #080b12, #30343d); }
.book-thumb.minimal { color: #0d1830; background: #fffdf8; border: 1px solid #e5dfd5; }
.book-thumb.fantasy { color: #f8dc93; background: linear-gradient(140deg, #123139, #1b2351); }
.book-thumb.romance { color: #fff7fb; background: linear-gradient(140deg, #7c3249, #b9788b); }
.book-thumb.scifi { color: #bfe8ff; background: linear-gradient(140deg, #0d3854, #123c56); font-family: var(--font-ui); }
.book-thumb.illustrated { color: #fff4d5; background: linear-gradient(140deg, #2f4f3c, #9d7a35); }
.template-card h3 { font-family: inherit; margin: 8px 0 8px; }
.template-card p { color: var(--text-muted); font-size: 13px; line-height: 1.45; margin: 0 0 14px; }
.swatches { display: flex; gap: 7px; }
.swatches span { width: 13px; height: 13px; border-radius: 50%; border: 1px solid var(--border); }

.testimonials { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.testimonial { padding: 28px; }
.quote { color: var(--accent); font-size: 32px; line-height: 1; }
.testimonial p { color: var(--text-muted); line-height: 1.7; }
.person { display: flex; align-items: center; gap: 12px; font-weight: 900; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(145deg, var(--accent-soft), #dbe7ff); display: grid; place-items: center; color: var(--navy); }

.final-cta {
  margin: 18px auto 48px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 34px 42px;
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  align-items: center;
  gap: 34px;
}
.open-book { height: 94px; background: url("/assets/brand-mark.svg") center / contain no-repeat; opacity: .9; }
.final-cta h2 { margin: 0 0 8px; font-size: 34px; }
.final-cta p { margin: 0; color: var(--text-muted); line-height: 1.55; }

.footer { border-top: 1px solid var(--border); padding: 38px 0; background: #fffdf9; }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr) 1.4fr; gap: 32px; }
.footer h4 { margin: 0 0 14px; }
.footer a, .footer p { display: block; color: var(--text-muted); margin: 8px 0; font-size: 14px; }
.donation-block p { line-height: 1.45; max-width: 280px; }
.btn.coffee {
  display: inline-flex;
  width: fit-content;
  background: #ffdd00;
  border-color: #f2c800;
  color: #081636;
  box-shadow: 0 14px 30px rgba(255, 197, 0, .22);
}
.btn.coffee:hover { filter: brightness(.98); }
.input { border: 1px solid var(--border); border-radius: 8px; min-height: 42px; padding: 0 12px; background: white; width: 100%; }
.hidden-input { display: none; }

.page-shell { padding: 34px 0 56px; }
.app-header { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--border); background: #fffdf9; }
.app-nav { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.nav-menu-btn {
  display: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  min-height: 38px;
  padding: 9px 13px;
}
.app-layout { display: grid; grid-template-columns: 310px minmax(330px, 1fr) 360px; gap: 18px; align-items: start; }
.app-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-height: 620px; overflow: hidden; }
.app-panel-header { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--border); }
.app-panel-header h2 { font-family: inherit; font-size: 16px; margin: 0; }
.app-panel-body { padding: 18px; }
.dropzone { border: 1px dashed #dfb9b2; background: var(--surface-soft); border-radius: 8px; padding: 24px 20px; text-align: center; display: grid; justify-items: center; gap: 10px; }
.dropzone input { display: none; }
.dropzone strong { color: var(--accent-dark); font-weight: 900; font-size: 16px; line-height: 1.2; }
.dropzone p { margin: 0; color: var(--text-muted); line-height: 1.45; max-width: 230px; }
.dropzone .chapter-meta { font-size: 12px; }
.upload-trigger { cursor: pointer; width: 42px; height: 42px; color: var(--accent); background: var(--accent-soft); }
.field { display: grid; gap: 8px; margin-top: 16px; }
.field label { color: var(--text-muted); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.field textarea { min-height: 210px; border: 1px solid var(--border); border-radius: 8px; padding: 14px; line-height: 1.55; }
.book-details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf9;
  margin-top: 16px;
  padding: 10px;
}
.book-details summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--text);
}
.book-details .field { margin-top: 12px; }
.field textarea.small-textarea { min-height: 88px; }
.recent-list { margin-top: 18px; }
.status { margin-top: 14px; color: var(--green); font-weight: 800; font-size: 13px; }
.status.error { color: #b42318; }
.status.loading { color: var(--text-muted); }
.save-meta { margin-top: 6px; color: var(--text-muted); font-size: 12px; }

.chapter-list { display: grid; gap: 9px; }
.chapter-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf9;
  cursor: pointer;
}
.chapter-item.active { border-color: #ffbab2; background: #fff3ef; }
.chapter-item input { width: 100%; border: 0; background: transparent; font-weight: 900; color: var(--text); }
.chapter-meta { color: var(--text-muted); font-size: 12px; }
.preview-book-details {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}
.preview-book-details p {
  font-family: inherit;
  margin: 0 0 10px;
}
.chapter-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.ai-settings {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf9;
  margin-bottom: 14px;
  overflow: hidden;
}
.ai-settings summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  font-weight: 900;
  color: var(--text);
}
.ai-settings summary span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}
.ai-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 12px 12px;
}
.ai-settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ai-settings-grid select {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  padding: 9px 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.ai-settings-grid .ai-check {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--text);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}
.chapter-editor { margin-top: 16px; }
.chapter-editor textarea { min-height: 230px; width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 14px; line-height: 1.6; }

.preview-cover {
  min-height: 210px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 26px;
  color: white;
  background: linear-gradient(135deg, #071433, #3d6088);
}
.preview-cover h3 { margin: 0; font-size: 30px; }
.preview-cover.serenity { background: linear-gradient(135deg, #071433, #3d6088); }
.preview-cover.classic { background: linear-gradient(135deg, #3f2b1d, #8b6b4e); }
.preview-cover.noir { background: linear-gradient(135deg, #0b0c10, #343942); }
.preview-cover.minimal { background: linear-gradient(135deg, #f7f7f4, #dfe3e8); color: #111827; }
.preview-cover.fantasy { background: linear-gradient(135deg, #173a42, #b69552); }
.preview-cover.romance { background: linear-gradient(135deg, #532638, #b9788b); }
.preview-cover.scifi { background: linear-gradient(135deg, #062238, #2d8bb8); }
.preview-cover.illustrated { background: linear-gradient(135deg, #244532, #b69552); }
.preview-cover.has-cover > div { display: none; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.stat { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.stat strong { display: block; font-size: 24px; }
.template-select { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.template-option {
  border: 1px solid var(--border);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.template-option.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.template-card-option {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 9px;
  min-height: 88px;
  padding: 9px;
}
.template-mini {
  align-self: stretch;
  border-radius: 6px;
  color: white;
  display: grid;
  font-family: var(--font-display);
  font-size: 10px;
  line-height: 1.1;
  padding: 7px;
  place-items: center;
  text-align: center;
}
.template-mini.serenity { background: #24466f; }
.template-mini.classic { background: #6b4b34; }
.template-mini.noir { background: #11131a; }
.template-mini.minimal { background: #f7f7f4; border: 1px solid #d7d7d2; color: #101827; }
.template-mini.fantasy { background: #173a42; color: #f3dfae; }
.template-mini.romance { background: #8f4860; }
.template-mini.scifi { background: #123c56; color: #bfe8ff; font-family: var(--font-ui); }
.template-mini.illustrated { background: #365f48; color: #fff4d5; }
.template-card-copy { display: grid; gap: 3px; min-width: 0; }
.template-card-copy strong { color: var(--text); font-size: 12px; line-height: 1.1; }
.template-card-copy span { color: var(--text-muted); font-size: 10px; font-weight: 800; line-height: 1.15; text-transform: uppercase; }
.template-card-copy small { color: var(--text-muted); font-size: 11px; font-weight: 600; line-height: 1.25; }
.template-settings {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 11px;
}
.template-settings summary {
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.template-settings-grid { display: grid; gap: 8px; margin-top: 10px; }
.template-settings-grid label {
  color: var(--text-muted);
  display: grid;
  gap: 5px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.template-settings-grid select {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font: inherit;
  padding: 8px 9px;
}
.template-settings-grid .ai-check {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--text);
  font-size: 12px;
  text-transform: none;
}
.cover-workspace {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 12px;
  align-items: start;
}
.cover-preview-a5 {
  aspect-ratio: 1 / 1.414;
  width: 118px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fffaf4;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  background-position: center;
  background-repeat: no-repeat;
}
.cover-controls {
  display: grid;
  gap: 9px;
}
.cover-controls input { display: none; }
.cover-mode {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}
.cover-mode button {
  border: 1px solid var(--border);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  padding: 9px 8px;
}
.cover-mode button.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent-dark);
}
.image-tools input { display: none; }
.image-gallery { display: grid; gap: 10px; margin-top: 10px; max-height: 260px; overflow: auto; }
.image-empty { border: 1px dashed var(--border); border-radius: 8px; padding: 14px; color: var(--text-muted); font-size: 13px; line-height: 1.45; }
.image-item { display: grid; grid-template-columns: 58px 1fr; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: #fffdf9; }
.image-item img { width: 58px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.image-item strong { display: block; font-size: 13px; }
.image-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 7px; }
.image-layout select {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  padding: 6px 7px;
  font-size: 12px;
}
.image-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.image-actions button { border: 1px solid var(--border); border-radius: 7px; background: white; padding: 5px 8px; cursor: pointer; font-size: 12px; font-weight: 800; }
.image-chapter-select { width: 100%; margin-top: 7px; border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px; background: white; font-size: 12px; }
.ebook-page { margin-top: 16px; background: #fffefc; border: 1px solid var(--border); border-radius: 8px; padding: 26px; min-height: 270px; font-family: var(--font-display); line-height: 1.7; }
.ebook-page h3 { margin-top: 0; }
.preview-figure { margin: 0 0 18px; }
.preview-figure img { width: 100%; max-height: 280px; object-fit: contain; border-radius: 6px; border: 1px solid var(--border); background: #fffaf4; }
.preview-figure.half img { width: 58%; }
.preview-figure.full img, .preview-figure.full-page img { width: 100%; max-height: 520px; }
.preview-figure.full-page { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 16px 0; }
.preview-figure figcaption { color: var(--text-muted); font-family: var(--font-ui); font-size: 12px; margin-top: 6px; }
.export-stack { display: grid; gap: 10px; margin-top: 14px; }
.viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(12, 17, 26, .78);
  padding: 24px;
}
.viewer-modal[hidden] { display: none; }
.viewer-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #f7f2eb;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.34);
}
.viewer-bar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: #fffdf9;
  border-bottom: 1px solid var(--border);
}
.viewer-bar h2 { margin: 0; font-family: inherit; font-size: 16px; }
.viewer-actions { display: flex; gap: 8px; align-items: center; }
.viewer-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #2b2d33;
}
.ai-review-modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(12, 17, 26, .72);
  padding: 24px;
}
.ai-review-modal[hidden] { display: none; }
.login-required-modal {
  position: fixed;
  inset: 0;
  z-index: 1002;
  display: grid;
  place-items: center;
  background: rgba(12, 17, 26, .72);
  padding: 20px;
}
.login-required-modal[hidden] { display: none; }
.login-required-card {
  width: min(430px, 100%);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 8px;
  background: #fffdf9;
  box-shadow: 0 30px 90px rgba(0,0,0,.34);
  padding: 22px;
}
.login-required-card h2 {
  margin: 0 0 10px;
  font-family: inherit;
  font-size: 20px;
}
.login-required-card p {
  margin: 0 0 18px;
  color: var(--text-muted);
  line-height: 1.55;
}
.ai-review-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: #fffdf9;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.34);
}
.ai-history-shell {
  height: min(760px, 100%);
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: #fffdf9;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.34);
}
.cover-prompt-shell {
  height: min(720px, 100%);
  max-width: 880px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: #fffdf9;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.34);
}
.cover-prompt-body {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  background: #fffaf4;
}
.cover-prompt-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cover-prompt-options button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  padding: 10px 12px;
}
.cover-prompt-options button.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent-dark);
}
#coverPromptText {
  min-height: 0;
  width: 100%;
  height: 100%;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: #fffefc;
  color: var(--navy);
  line-height: 1.55;
  font-size: 14px;
}
.ai-review-meta {
  padding: 10px 16px;
  color: var(--text-muted);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.ai-review-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.ai-review-grid section {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-right: 1px solid var(--border);
}
.ai-review-grid section:last-child { border-right: 0; }
.ai-review-grid h3 {
  margin: 0;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}
.ai-diff-text {
  margin: 0;
  padding: 18px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--navy);
  background: #fffefc;
}
.diff-token {
  border-radius: 4px;
  padding: 1px 2px;
}
.diff-token.removed {
  background: #ffe3e0;
  color: #9d2f27;
  text-decoration: line-through;
}
.diff-token.added {
  background: #e5f7ec;
  color: #17643a;
}
.ai-history-list {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  background: #fffaf4;
}
.ai-history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf9;
  padding: 12px;
}
.ai-history-item h3 {
  margin: 0 0 5px;
  font-family: inherit;
  font-size: 15px;
}
.ai-history-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}
.ai-history-empty {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 24px;
  color: var(--text-muted);
  text-align: center;
  background: #fffdf9;
}
.mobile-tabs { display: none; }

.projects-page { padding: 44px 0 70px; }
.projects-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.projects-heading h1 { margin: 0; font-size: 48px; }
.project-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.project-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 300px);
  gap: 10px;
  justify-items: end;
}
.project-filters button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 800;
  padding: 10px 12px;
}
.project-filters button.active {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.project-card {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 16px 34px rgba(8, 22, 54, .04);
}
.project-cover {
  aspect-ratio: 1 / 1.414;
  border-radius: 6px;
  background: var(--surface-soft) center / cover no-repeat;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  overflow: hidden;
}
.project-info h2 {
  font-family: inherit;
  font-size: 18px;
  margin: 8px 0 4px;
}
.project-info p { margin: 0 0 10px; color: var(--text-muted); }
.project-meta { color: var(--text-muted); font-size: 12px; margin-top: 5px; }
.project-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.project-status.working { color: #8a4b00; background: #fff4df; border-color: #f2cf91; }
.project-status.layout { color: #2457a6; background: #eaf2ff; border-color: #c9dcff; }
.project-status.complete { color: var(--green); background: #eaf8f1; border-color: #bfe6d2; }
.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}
.projects-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 42px;
  text-align: center;
}
.projects-empty h2 { margin: 0 0 10px; }
.projects-empty p { color: var(--text-muted); margin: 0 0 18px; }

.auth-page {
  min-height: calc(100vh - 82px);
  display: grid;
  place-items: center;
  padding: 44px 0;
}
.auth-card {
  width: min(520px, 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px var(--shadow);
  padding: 28px;
}
.auth-card h1 {
  margin: 0;
  font-size: 42px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 22px 0 4px;
}
.auth-tabs button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-weight: 900;
  padding: 12px;
}
.auth-tabs button.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent-dark);
}
.auth-form[hidden] { display: none; }

.simple-page { padding: 70px 0; }
.simple-page h1 { font-size: 54px; margin: 0 0 16px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 26px; }
.price-card { padding: 28px; }
.price { font-size: 42px; font-weight: 900; margin: 18px 0; }
.price-card ul { padding-left: 18px; color: var(--text-muted); line-height: 1.9; }
.content-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.content-grid.two { grid-template-columns: repeat(2, 1fr); }
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 16px 34px rgba(8, 22, 54, .04);
}
.content-card h2, .content-card h3 { margin: 0 0 12px; font-size: 25px; }
.content-card p { color: var(--text-muted); line-height: 1.7; margin: 0 0 16px; }
.content-card ul { color: var(--text-muted); line-height: 1.9; padding-left: 18px; margin: 0; }
.article-meta { color: var(--accent-dark); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.page-band {
  margin-top: 38px;
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 44px 0;
}
.faq-list { display: grid; gap: 12px; margin-top: 26px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 20px 24px; }
.faq-item h3 { font-family: inherit; font-size: 17px; margin: 0 0 8px; }
.faq-item p { margin: 0; color: var(--text-muted); line-height: 1.65; }
.comparison {
  width: 100%;
  border-collapse: collapse;
  margin-top: 26px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.comparison th, .comparison td { padding: 16px 18px; border-bottom: 1px solid var(--border); text-align: left; }
.comparison th { background: var(--surface-soft); }
.comparison tr:last-child td { border-bottom: 0; }
.timeline { display: grid; gap: 14px; margin-top: 26px; }
.timeline-item { display: grid; grid-template-columns: 150px 1fr; gap: 22px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 22px; }
.timeline-item time { color: var(--accent-dark); font-weight: 900; }

@media (max-width: 1180px) {
  .nav-links { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .micro-features { max-width: none; }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .feature-card:nth-child(3) { border-right: 0; }
  .feature-card:nth-child(n+4) { border-top: 1px solid var(--border); }
  .template-row { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .content-grid.two, .pricing-grid, .projects-grid { grid-template-columns: 1fr 1fr; }
  .app-layout { grid-template-columns: 1fr 1fr; }
  .preview-panel { grid-column: 1 / -1; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .container { width: min(100% - 24px, 1180px); }
  .brand { font-size: 20px; }
  .nav { min-height: 62px; }
  .app-nav {
    position: relative;
    min-height: 58px;
    gap: 10px;
  }
  .app-nav .brand {
    min-width: 0;
    font-size: 22px;
    gap: 7px;
  }
  .app-nav .brand img {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
  }
  .app-nav > .nav-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
  }
  .app-nav > .nav-actions {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    display: none;
    width: min(280px, calc(100vw - 24px));
    max-height: calc(100vh - 92px);
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fffdf9;
    box-shadow: 0 18px 48px rgba(8, 22, 54, .16);
  }
  .app-nav > .nav-actions.open {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .app-nav > .nav-actions .btn,
  .app-nav > .nav-actions label,
  .app-nav > .nav-actions .account-chip {
    width: 100%;
    justify-content: center;
  }
  .nav-actions .icon-button { display: none; }
  .hero h1 { font-size: 43px; }
  .hero-copy { font-size: 16px; }
  .micro-features, .steps, .testimonials, .pricing-grid, .content-grid, .content-grid.two { grid-template-columns: 1fr; }
  .mockup-grid, .book-preview, .final-cta, .footer-grid { grid-template-columns: 1fr; }
  .mockup-sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card { border-right: 0; border-top: 1px solid var(--border); }
  .feature-card:first-child { border-top: 0; }
  .template-row { grid-template-columns: 1fr; }
  .template-select { grid-template-columns: 1fr; }
  .final-cta { text-align: center; }
  .app-layout { grid-template-columns: 1fr; }
  .ai-settings-grid { grid-template-columns: 1fr; }
  .ai-review-modal { padding: 0; }
  .ai-review-shell { border-radius: 0; }
  .ai-review-grid { grid-template-columns: 1fr; overflow: auto; }
  .ai-review-grid section { min-height: 360px; border-right: 0; border-bottom: 1px solid var(--border); }
  .ai-diff-text { font-size: 16px; }
  .projects-heading { align-items: start; flex-direction: column; }
  .project-toolbar { width: 100%; justify-items: stretch; }
  .project-filters { justify-content: flex-start; }
  .projects-grid { grid-template-columns: 1fr; }
  .project-card { grid-template-columns: 92px 1fr; }
  .app-panel { display: none; min-height: auto; }
  .app-panel.active { display: block; }
  .mobile-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
  .mobile-tabs button { border: 1px solid var(--border); border-radius: 8px; background: white; padding: 10px 6px; font-weight: 800; color: var(--text-muted); }
  .mobile-tabs .active { background: var(--navy); color: white; border-color: var(--navy); }
  .timeline-item { grid-template-columns: 1fr; }
  .viewer-modal { padding: 0; }
  .viewer-shell { border-radius: 0; border: 0; }
  .viewer-bar { align-items: stretch; flex-direction: column; }
  .viewer-actions { display: grid; grid-template-columns: 1fr 1fr; }
}
