/* ============================================================
   Wool & Wild — Colourful Professional Stylesheet
   Matches the HTML structure with:
     - Design tokens (CSS variables)
     - App bar + search
     - Home (hero + rails)
     - Catalog (grid + filters)
     - Series detail (cover + meta + chapters)
     - Reader (TOC + parts + comic pages)
     - Floating toolbar + progress bar
     - Footer
     - Dark mode
     - Responsive
   ============================================================ */

/* ---------- 1. DESIGN TOKENS ---------- */
:root {
  --reader-font-scale: 100%;

  /* Colours — light theme */
  --bg: #fffaf4;
  --bg-elev: #ffffff;
  --bg-soft: #fdf7ff;
  --ink: #3a2f3f;
  --ink-soft: #8a7a9a;
  --ink-mute: #b0a4bd;
  --line: #f0d9ea;

  --brand: #6b3fa0;
  --brand-2: #7b3fa0;
  --accent-pink: #ffb3d1;
  --accent-blue: #a8d4ff;
  --accent-mint: #c7f0d8;
  --accent-gold: #ffe3a3;

  /* Radii */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 30px;

  /* Shadows */
  --shadow-sm: 0 2px 6px rgba(150, 120, 200, 0.08);
  --shadow: 0 10px 30px rgba(150, 120, 200, 0.12);
  --shadow-lg: 0 18px 40px rgba(150, 120, 200, 0.18);

  /* Fonts */
  --font-ui: 'Quicksand', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Baloo 2', 'Quicksand', cursive;
  --font-mm: 'Padauk', 'Noto Sans Myanmar', 'Quicksand', sans-serif;

  --header-h: 72px;
}

/* ---------- 2. RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 220, 235, 0.95) 0%, transparent 42%),
    radial-gradient(circle at 90% 10%, rgba(210, 240, 255, 0.95) 0%, transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(255, 245, 200, 0.95) 0%, transparent 45%),
    radial-gradient(circle at 20% 85%, rgba(220, 255, 230, 0.95) 0%, transparent 45%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -48px; left: 8px;
  background: var(--brand); color: #fff;
  padding: 10px 16px; border-radius: 8px;
  z-index: 100;
  transition: top .2s;
  font-weight: 700;
}
.skip-link:focus { top: 8px; }

::selection { background: #ffd6e8; color: #5a2a6a; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #fff5fb; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ffc4dd, #c7b3ff);
  border-radius: 10px;
  border: 3px solid #fff5fb;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ffb3d1, #b3a3ff);
}

/* ---------- 3. APP BAR ---------- */
.app-bar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 250, 244, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.app-bar__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr minmax(200px, 340px);
  gap: 1rem;
  align-items: center;
  min-height: var(--header-h);
}

.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand__mark { font-size: 1.8rem; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.3px;
}
.brand__text small {
  color: var(--ink-soft);
  font-size: 0.72rem;
  letter-spacing: 1px;
}

.app-nav {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
}
.app-nav__link {
  background: transparent;
  border: 0;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.92rem;
  transition: background .2s, color .2s, transform .15s;
}
.app-nav__link:hover {
  background: #ffeef7;
  color: var(--brand);
  transform: translateY(-1px);
}

.search { position: relative; }
.search input {
  width: 100%;
  padding: 0.65rem 2.5rem 0.65rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.92rem;
  transition: border-color .2s, box-shadow .2s;
}
.search input::placeholder { color: var(--ink-mute); }
.search input:focus {
  outline: none;
  border-color: var(--accent-pink);
  box-shadow: 0 0 0 4px rgba(255, 179, 209, 0.25);
}
.search__icon {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.55;
  pointer-events: none;
}

/* ---------- 4. MAIN LAYOUT ---------- */
.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  position: relative;
  z-index: 1;
}

.view[hidden] { display: none; }

/* ---------- 5. HOME — HERO ---------- */
.hero {
  text-align: center;
  padding: 2.75rem 1rem 3rem;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  color: var(--brand);
  margin: 0 0 0.75rem;
  letter-spacing: -0.5px;
  text-shadow:
    3px 3px 0 #ffe3f1,
    6px 6px 0 rgba(180, 160, 255, 0.22);
}
.hero h1 span {
  color: #c04a9c;
  background: linear-gradient(135deg, #ff8ec4, #a06bff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 auto 1.75rem;
  font-size: 1.05rem;
}
.hero__cta {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- 6. RAILS ---------- */
.rail { margin-bottom: 3rem; }

.rail__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.rail__head h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #4a3b6b;
  margin: 0;
}

.rail__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 220px);
  gap: 1rem;
  overflow-x: auto;
  padding: 0.25rem 0.25rem 0.9rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.rail__track > * { scroll-snap-align: start; }

/* ---------- 7. VIEW HEADER (catalog) ---------- */
.view__head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.view__head h1 {
  font-family: var(--font-display);
  color: var(--brand);
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  margin: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chip {
  background: #fff;
  border: 1.5px solid var(--line);
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.85rem;
  transition: all .2s;
}
.chip:hover {
  border-color: var(--accent-pink);
  color: var(--brand);
  transform: translateY(-1px);
}
.chip.is-active {
  background: linear-gradient(90deg, #ffe3f1, #e3d6ff);
  color: #5a2a6a;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(200, 150, 230, 0.25);
}

/* ---------- 8. CATALOG GRID ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.25rem;
}
.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 3rem 1rem;
  font-style: italic;
}

/* ---------- 9. SERIES CARD ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  border: 2px dashed var(--line);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 100px; height: 100px;
  background: radial-gradient(circle, #fff0f8 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.card:hover {
  transform: translateY(-5px) rotate(-0.4deg);
  border-color: var(--accent-pink);
  box-shadow: var(--shadow-lg);
}
.card__cover {
  aspect-ratio: 3/4;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(135deg, #ffeef8, #e8f4ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  color: var(--brand);
  border: 3px solid #fff;
  box-shadow: var(--shadow-sm);
}
.card__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand);
  margin: 0;
  line-height: 1.3;
}
.card__meta {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
}
.card__status {
  position: absolute;
  top: 0.7rem; right: 0.7rem;
  background: rgba(255,255,255,0.96);
  color: #4a7ab0;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid #d6ecff;
  z-index: 1;
}
.card__status--ongoing {
  color: #b04a7a;
  border-color: #ffc4dd;
  background: #fff5fb;
}

/* ---------- 10. SERIES DETAIL ---------- */
.series__head {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  background: linear-gradient(160deg, #ffffff 0%, #fff8fc 100%);
  border: 2px dashed #c7e3ff;
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  position: relative;
}
.series__head::before {
  content: "🪷";
  position: absolute;
  top: 1rem; right: 1.5rem;
  font-size: 2rem;
  opacity: 0.5;
  transform: rotate(8deg);
}
.series__cover {
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffeef8, #e8f4ff);
  border: 4px solid #fff;
  box-shadow: 0 8px 22px rgba(180, 140, 220, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--brand);
}
.series__meta h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  color: #3f6ea0;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}
.series__synopsis {
  color: var(--ink-soft);
  margin: 0 0 1.25rem;
  max-width: 62ch;
}
.series__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}
.series__facts > div {
  background: #fbfdff;
  border: 1px solid #e0eefc;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
}
.series__facts dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-mute);
  font-weight: 700;
}
.series__facts dd {
  margin: 0.2rem 0 0;
  font-weight: 700;
  color: #35608a;
}

.tags {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tags li {
  background: #f0f8ff;
  color: #4a7ab0;
  border: 1px solid #d6ecff;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.series__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ---------- 11. CHAPTERS ---------- */
.chapters { margin-top: 1rem; }
.chapters h2 {
  font-family: var(--font-display);
  color: #4a7ab0;
  font-size: 1.4rem;
  margin: 0 0 1rem;
}
.chapters__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}
.chapter-group {
  margin-top: 1rem;
  font-family: var(--font-display);
  color: #35608a;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.25rem 0.25rem;
  border-bottom: 2px dotted #d6ecff;
}
.chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #fff;
  border: 1px solid #e0eefc;
  border-left: 6px solid #c7e3ff;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.chapter-item:hover {
  transform: translateX(4px);
  border-color: #a8d4ff;
  box-shadow: var(--shadow-sm);
}
.chapter-item__title { font-weight: 700; color: #2f3e4f; }
.chapter-item__meta {
  color: var(--ink-mute);
  font-size: 0.82rem;
  margin-top: 0.15rem;
}
.chapter-item__read {
  background: #f0f8ff;
  color: #35608a;
  border: 1px solid #d6ecff;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background .2s, transform .15s;
  flex-shrink: 0;
}
.chapter-item__read:hover {
  background: #d6ecff;
  transform: translateY(-1px);
}

/* ---------- 12. READER VIEW ---------- */
.view--reader { max-width: 820px; margin: 0 auto; }

.reader__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.reader__titles { flex: 1; min-width: 200px; }
.reader__titles h1 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  color: var(--brand);
  margin: 0;
}
.reader__titles p {
  color: var(--ink-soft);
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
}
.badge {
  display: inline-block;
  background: linear-gradient(90deg, #ffe3f1, #e3d6ff);
  color: #5a2a6a;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
}

/* Table of contents */
.toc {
  background: #fbfdff;
  border: 1px solid #e0eefc;
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.5rem;
}
.toc summary {
  cursor: pointer;
  font-weight: 700;
  color: #35608a;
  font-family: var(--font-display);
  font-size: 1.05rem;
  padding: 0.2rem 0;
  list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::before {
  content: "▸ ";
  color: var(--accent-pink);
  margin-right: 0.3rem;
  transition: transform .2s;
  display: inline-block;
}
.toc[open] summary::before { transform: rotate(90deg); }

.toc__list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}
.toc__chapter {
  font-family: var(--font-display);
  font-weight: 700;
  color: #4a7ab0;
  margin: 0.75rem 0 0.35rem;
  font-size: 0.95rem;
  border-bottom: 1px dotted #d6ecff;
  padding-bottom: 0.25rem;
}
.toc__item a {
  display: block;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  transition: background .15s, color .15s, transform .15s;
}
.toc__item a:hover {
  background: #fff0f8;
  color: var(--brand);
  transform: translateX(3px);
}

/* Reader body — parts */
.reader__body {
  font-size: calc(1rem * var(--reader-font-scale) / 100);
}
.part {
  background: #fff;
  border: 1px solid #e0eefc;
  border-left: 6px solid #c7e3ff;
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, border-color .2s, transform .2s;
  scroll-margin-top: calc(var(--header-h) + 20px);
  position: relative;
}
.part::before {
  content: "📜";
  position: absolute;
  top: -10px;
  left: -8px;
  font-size: 1.1rem;
  background: #fff;
  border-radius: 50%;
  padding: 2px 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.part:hover {
  box-shadow: var(--shadow);
  border-color: #a8d4ff;
}
.part.is-highlight {
  border-color: #ffb3d1;
  box-shadow: 0 0 0 4px rgba(255, 179, 209, 0.25), var(--shadow);
}
.part__title {
  font-family: var(--font-mm);
  font-size: calc(1.15rem * var(--reader-font-scale) / 100);
  font-weight: 700;
  color: #35608a;
  margin: 0 0 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 2px dotted #d6ecff;
}
.part__text {
  font-family: var(--font-mm);
  font-size: calc(1.05rem * var(--reader-font-scale) / 100);
  line-height: 2;
  color: #2f3e4f;
  white-space: pre-line;
  letter-spacing: 0.2px;
  margin: 0;
}

/* Comic pages */
.comic-page img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 3px solid #fff;
  box-shadow: var(--shadow);
}

.part__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dotted #e0eefc;
  flex-wrap: wrap;
}
.part__nav-label {
  color: var(--ink-mute);
  font-size: 0.82rem;
  font-weight: 700;
}

.reader__nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ---------- 13. BUTTONS ---------- */
.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  font-weight: 700;
  font-size: 0.92rem;
  transition: transform .15s, box-shadow .2s, background .2s, color .2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.btn--primary {
  background: linear-gradient(135deg, #ffb3d1, #c7b3ff);
  color: #fff;
  box-shadow: 0 6px 16px rgba(180, 140, 220, 0.35);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.btn--ghost {
  background: #fff;
  color: var(--brand);
  border: 1.5px solid var(--line);
}
.btn--ghost:hover {
  border-color: var(--accent-pink);
  background: #fff5fb;
  transform: translateY(-1px);
}
.btn--back {
  background: transparent;
  color: var(--ink-soft);
  padding-left: 0;
  margin-bottom: 1rem;
}
.btn--back:hover {
  color: var(--brand);
  transform: translateX(-2px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- 14. PROGRESS BAR + TOOLBAR ---------- */
.reading-progress {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  height: 3px;
  background: transparent;
  z-index: 25;
  pointer-events: none;
}
.reading-progress__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ffb3d1, #c7b3ff, #a8d4ff);
  transition: width .1s linear;
}

.reader-toolbar {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tool-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: var(--brand);
  box-shadow: var(--shadow);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.tool-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-lg);
  background: #fff5fb;
}

/* ---------- 15. FOOTER ---------- */
.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}
.site-footer nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer a { transition: color .2s; }
.site-footer a:hover { color: var(--brand); }

/* ---------- 16. RESPONSIVE ---------- */
@media (max-width: 860px) {
  .app-bar__inner {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "brand search"
      "nav   nav";
    gap: 0.6rem;
  }
  .brand { grid-area: brand; }
  .search { grid-area: search; }
  .app-nav {
    grid-area: nav;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
  .series__head {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 1.5rem;
  }
  .series__cover {
    max-width: 200px;
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  .app-main { padding: 1rem 0.9rem 3rem; }
  .hero { padding: 1.75rem 0.5rem 2rem; }
  .hero h1 { text-shadow: 2px 2px 0 #ffe3f1, 4px 4px 0 rgba(180, 160, 255, 0.22); }
  .rail__track { grid-auto-columns: minmax(150px, 160px); }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
  }
  .part { padding: 1.1rem 1rem 1.25rem; }
  .reader-toolbar { bottom: 0.9rem; right: 0.9rem; }
  .tool-btn { width: 42px; height: 42px; }
}

@media (max-width: 420px) {
  .hero h1 { font-size: 1.9rem; }
  .grid { grid-template-columns: 1fr 1fr; }
  .card__title { font-size: 0.95rem; }
  .card__meta { font-size: 0.72rem; }
}

/* ---------- 17. DARK MODE ---------- */
[data-theme="dark"] {
  --bg: #1a1420;
  --bg-elev: #241b2e;
  --bg-soft: #2a1f36;
  --ink: #e8e0ee;
  --ink-soft: #b9a9c9;
  --ink-mute: #857397;
  --line: #3a2b48;
  --brand: #c7a3ff;
  --brand-2: #d8b8ff;
  --accent-pink: #ff9ec7;
  --accent-blue: #8bb8e0;

  background:
    radial-gradient(circle at 10% 20%, rgba(120, 60, 140, 0.4) 0%, transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(60, 90, 140, 0.4) 0%, transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(140, 90, 60, 0.28) 0%, transparent 45%),
    var(--bg);
  background-attachment: fixed;
}

[data-theme="dark"] .app-bar {
  background: rgba(26, 20, 32, 0.88);
  border-bottom-color: var(--line);
}
[data-theme="dark"] .brand__text strong { color: var(--brand); }
[data-theme="dark"] .search input {
  background: var(--bg-elev);
  color: var(--ink);
  border-color: var(--line);
}
[data-theme="dark"] .card,
[data-theme="dark"] .series__head,
[data-theme="dark"] .part,
[data-theme="dark"] .chapter-item,
[data-theme="dark"] .toc,
[data-theme="dark"] .chip,
[data-theme="dark"] .btn--ghost,
[data-theme="dark"] .tool-btn {
  background: var(--bg-elev);
  color: var(--ink);
  border-color: var(--line);
}
[data-theme="dark"] .series__facts > div {
  background: var(--bg-soft);
  border-color: var(--line);
}
[data-theme="dark"] .series__facts dd { color: var(--brand); }
[data-theme="dark"] .series__meta h1,
[data-theme="dark"] .chapters h2,
[data-theme="dark"] .chapter-group,
[data-theme="dark"] .part__title { color: var(--brand); }
[data-theme="dark"] .part__text { color: var(--ink); }
[data-theme="dark"] .chapter-item__title { color: var(--ink); }
[data-theme="dark"] .hero h1 {
  color: var(--brand);
  text-shadow: 3px 3px 0 #3a1f4a, 6px 6px 0 rgba(120, 80, 180, 0.25);
}
[data-theme="dark"] .hero h1 span {
  background: linear-gradient(135deg, #ff9ec7, #b48aff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="dark"] .card::before { background: radial-gradient(circle, rgba(120,60,140,0.25) 0%, transparent 70%); }
[data-theme="dark"] ::-webkit-scrollbar-track { background: #1a1420; }
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6a4a8a, #4a3a6a);
  border-color: #1a1420;
}
[data-theme="dark"] ::selection { background: #6a3a6a; color: #fff; }