@page {
  size: A4;
  margin: 2.5cm 2cm;
  @bottom-center {
    content: counter(page);
    font-size: 9pt;
    color: #888;
  }
}

body {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 11pt;
  line-height: 1.65;
  color: #1a1a1a;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5em 1em;
}

h1 {
  font-family: "Helvetica Neue", "Arial", sans-serif;
  font-size: 22pt;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2.5em;
  margin-bottom: 0.6em;
  page-break-before: always;
  page-break-after: avoid;
}

h1:first-of-type {
  page-break-before: avoid;
}

h2 {
  font-family: "Helvetica Neue", "Arial", sans-serif;
  font-size: 14pt;
  font-weight: 500;
  margin-top: 1.8em;
  letter-spacing: 0.01em;
  color: #444;
}

h3 {
  font-size: 12pt;
  font-weight: 600;
  color: #555;
  margin-top: 1.5em;
}

p {
  margin: 0 0 1em;
  text-align: left;
  hyphens: auto;
}

blockquote {
  border-left: 3px solid #d0d0d0;
  padding-left: 1.2em;
  margin: 1.5em 0;
  color: #555;
  font-style: italic;
}

code, pre {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 9.5pt;
}

code {
  background: #f4f4f4;
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

pre {
  background: #f7f7f7;
  padding: 0.9em 1em;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.45;
  page-break-inside: avoid;
}

hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 2em 0;
}

a {
  color: #0a3a8c;
  text-decoration: none;
  border-bottom: 1px dotted #0a3a8c;
}

em { color: #444; }

strong { color: #000; }

#TOC { page-break-after: always; }

#TOC ul { list-style: none; padding-left: 0; }
#TOC li { margin: 0.4em 0; }
#TOC a { border-bottom: none; color: #1a1a1a; }

/* ═══════════════════════════════════════════════════════════════
   Screen-only dark mode (matches /writing, /days, /saga/en design
   tokens). Print PDFs continue to use the rules above.
   ═══════════════════════════════════════════════════════════════ */
@media screen {
  body {
    background: #09090f;
    color: #e8e8ea;
    font-size: 17px;
    line-height: 1.75;
    max-width: 720px;
    padding: 4.5rem 1.4rem 5rem;
  }
  h1 {
    color: #f1f1f3;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    font-size: 1.9rem;
    page-break-before: auto;
    margin-top: 0;
    letter-spacing: -0.02em;
  }
  h2 {
    color: #d0d0dc;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    font-size: 1.25rem;
    margin-top: 2.2rem;
  }
  h3 { color: #c0c0cc; }
  blockquote {
    border-left: 3px solid #ffaa3c;
    color: #b8b8c8;
  }
  hr {
    border-top: 1px solid rgba(139, 92, 246, 0.18);
    margin: 2.4rem 0;
  }
  a {
    color: #a78bfa;
    border-bottom: 1px dotted rgba(167, 139, 250, 0.35);
  }
  a:hover { color: #f1f1f3; border-bottom-color: #f1f1f3; }
  em { color: #b8b8c8; }
  strong { color: #f1f1f3; }
  code {
    background: #1a1a2e;
    color: #ffaa3c;
    padding: 0.12em 0.42em;
    border-radius: 3px;
    font-size: 0.92em;
  }
  pre {
    background: #141420;
    color: #e8e8ea;
    border: 1px solid rgba(139, 92, 246, 0.18);
  }
  #title-block-header { display: none; }
  #TOC a { color: #e8e8ea; }
}

/* ── Chapter nav (injected by chapter-nav.js) ── */
@media screen {
  .chap-nav {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 80;
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem;
    padding: 0.7rem 1.2rem;
    background: rgba(9,9,15,0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.25);
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.85rem;
  }
  .chap-nav a, .chap-nav span {
    color: #a8a8be;
    text-decoration: none;
    border-bottom: none;
    transition: color 0.2s;
  }
  .chap-nav a:hover { color: #a78bfa; }
  .chap-nav .chap-toc {
    color: #f1f1f3; font-weight: 600;
  }
  .chap-nav .chap-progress {
    font-family: 'JetBrains Mono', "SF Mono", monospace;
    font-size: 0.78rem;
    color: #888;
  }
  .chap-nav .chap-disabled { opacity: 0.3; cursor: default; }
  @media (max-width: 600px) {
    .chap-nav { padding: 0.55rem 0.9rem; font-size: 0.8rem; }
    .chap-nav .chap-progress { display: none; }
  }
  .chap-foot {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(139, 92, 246, 0.15);
    display: flex; justify-content: space-between; gap: 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
  }
  .chap-foot a { color: #a78bfa; border-bottom: none; }
  .chap-foot a:hover { color: #f1f1f3; }
  .chap-foot-spacer { flex: 1; }
}
