:root {
  --ink: #39245d;
  --ink-strong: #23153b;
  --pink: #ed3c91;
  --cream: #fffaf1;
  --paper: #ffffff;
  --muted: #5d5469;
  --blue: #244e88;
  --gold: #e9bb45;
  --border: #eedce8;
  --shadow: 0 12px 32px rgba(57, 36, 93, 0.07);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink-strong);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: #fff;
  color: var(--ink-strong);
  padding: 10px 14px;
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus { left: 10px; outline: 3px solid var(--pink); }

.site-header {
  background: #302b50;
  color: #fffaf1;
  padding: 14px 18px;
  border-bottom: 3px solid var(--gold);
}

.header-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-link {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand-link span { color: #ffb8d5; }

.back-site {
  font-size: 0.9rem;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 250, 241, 0.35);
  transition: background 0.18s ease;
}
.back-site:hover, .back-site:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.book-hero {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.cover-frame {
  border-radius: 16px;
  background: linear-gradient(155deg, #302b50 0%, #39245d 52%, #244e88 100%);
  color: #fffaf1;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 250px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(233, 187, 69, 0.45);
}

.cover-frame.has-cover {
  padding: 0;
  background: transparent;
  border: none;
  min-height: 0;
  box-shadow: 0 12px 28px rgba(48, 43, 80, 0.18);
}

.cover-frame.has-cover::after {
  display: none;
}

.cover-frame::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 250, 241, 0.22);
  border-radius: 10px;
  pointer-events: none;
}

.cover-frame img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

.cover-badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--gold);
  font-weight: 700;
}

.cover-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  line-height: 1.2;
  margin: 14px 0 8px;
  font-weight: 400;
}

.cover-author {
  font-size: 0.92rem;
  color: #f3dce8;
}

.eyebrow {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--pink);
  margin-bottom: 6px;
}

.book-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  line-height: 1.18;
  margin: 0 0 8px;
  color: var(--ink);
  font-weight: 400;
}

.book-meta {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0 0 14px;
}

.book-synopsis {
  font-size: 1rem;
  color: var(--ink-strong);
  margin: 0 0 18px;
}

.editorial-note {
  font-size: 0.86rem;
  color: var(--muted);
  background: #fdf6ec;
  border-left: 3px solid var(--gold);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.progress-box {
  background: #faf5fc;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.progress-bars {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.bar-track {
  height: 7px;
  background: #e9dfef;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--ink));
  width: 0%;
  border-radius: 999px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.96rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--ink);
  color: #fffaf1;
}
.btn-primary:hover { background: #4a3077; }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: #d6c5e0;
}
.btn-secondary:hover { background: #f6effa; }

.parts-section {
  margin-top: 28px;
  display: grid;
  gap: 20px;
}

.part-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.part-header {
  margin-bottom: 14px;
}
.part-header h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
  font-weight: 400;
  margin: 0 0 4px;
  color: var(--ink);
}
.part-header p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.chapter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.chapter-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid #efe6f2;
  background: #fffdfb;
  text-decoration: none;
  min-height: 48px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.chapter-link:hover, .chapter-link:focus-visible {
  border-color: var(--pink);
  background: #fff5fa;
  outline: none;
}

.chapter-name {
  font-weight: 600;
  color: var(--ink-strong);
}

.chapter-badge {
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f2ecf7;
  color: var(--ink);
  white-space: nowrap;
}
.chapter-badge.done {
  background: #e7f6ec;
  color: #1f6b3b;
}

.extras-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.extra-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
}
.extra-card h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: 400;
  margin: 0 0 8px;
  color: var(--ink);
}
.extra-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.extra-list li {
  font-size: 0.9rem;
  padding: 10px 12px;
  background: #fcf9fe;
  border-radius: 10px;
  border: 1px solid #f0e6f5;
}

.site-footer {
  text-align: center;
  padding: 26px 16px;
  background: #302b50;
  color: #f5edf9;
  font-size: 0.85rem;
}

.error-box {
  background: #fff1f3;
  border: 1px solid #f5b8c2;
  color: #7a1c2e;
  padding: 16px;
  border-radius: 14px;
}

@media (min-width: 720px) {
  .container { padding: 34px 24px 72px; }
  .book-hero {
    grid-template-columns: 240px 1fr;
    padding: 28px;
    gap: 28px;
  }
  .chapter-list {
    grid-template-columns: repeat(2, 1fr);
  }
  .extras-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .chapter-link, .back-site { transition: none; }
}
