
:root {
  --bg: #f8f4e8;
  --text: #2c2416;
  --accent: #8b4513;
  --border: #d4c4a8;
  --header-bg: #f0e6d2;
  --link: #6b3a1f;
  --muted: #6b5b4b;
}

[data-theme="sepia"] {
  --bg: #f4ecd8;
  --text: #5b4636;
  --accent: #704214;
  --border: #c9b896;
  --header-bg: #ebe0c8;
  --link: #8b5a2b;
  --muted: #7a6a55;
}

[data-theme="night"] {
  --bg: #1a1a1a;
  --text: #e0e0e0;
  --accent: #d4a574;
  --border: #333;
  --header-bg: #222;
  --link: #e8c49a;
  --muted: #999;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: "Times New Roman", "Liberation Serif", "Noto Serif", Georgia, serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background 0.3s, color 0.3s;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.header a {
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
}

.header a:hover { text-decoration: underline; }

.controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.controls button {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.controls button:hover, .controls button.active {
  background: var(--accent);
  color: var(--bg);
}

.progress-bar {
  height: 3px;
  background: var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 101;
}

.progress-bar-inner {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

h1.book-title {
  text-align: center;
  font-size: 1.8rem;
  margin: 2rem 0 1.5rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

h2.chapter-title {
  font-size: 1.35rem;
  margin: 2.5rem 0 1rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

h3.subtitle {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.8rem;
  color: var(--muted);
}

p {
  margin: 0 0 0.9em;
  text-align: justify;
  text-indent: 1.5em;
  hyphens: auto;
}

p.center, .center {
  text-align: center;
  text-indent: 0;
}

.nav-pages {
  display: flex;
  justify-content: space-between;
  margin: 3rem 0 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-pages a {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background: var(--header-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--link);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-pages a:hover {
  background: var(--accent);
  color: var(--bg);
}

.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.index-hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.index-hero h1 {
  font-size: 2.2rem;
  margin: 0.5rem 0;
  color: var(--accent);
}

.index-hero .author {
  font-size: 1.3rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.index-hero .quote {
  font-style: italic;
  max-width: 500px;
  margin: 1.5rem auto;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  text-align: left;
}

.toc {
  max-width: 700px;
  margin: 0 auto;
}

.toc-book {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.toc-book-header {
  background: var(--header-bg);
  padding: 0.9rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toc-book-header a {
  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
  font-size: 1.15rem;
}

.toc-book-header .desc {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: normal;
  margin-top: 0.2rem;
}

.cover-img {
  max-width: 280px;
  margin: 1rem auto;
  display: block;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

@media (max-width: 600px) {
  html { font-size: 16px; }
  .container { padding: 1.2rem 1rem 3rem; }
  h1.book-title { font-size: 1.5rem; }
}

@font-face {
  font-family: 'Times New Roman';
  font-style: normal;
  font-weight: 400;
  src: url('fonts/Times-New-Roman-400-66ca9384-777c-4d20-9f1d-8f1ab849e4f9.otf') format('opentype');
}
@font-face {
  font-family: 'Times New Roman';
  font-style: italic;
  font-weight: 400;
  src: url('fonts/Times-New-Roman-400-Italic-66ca9384-777c-4d20-9f1d-8f1ab849e4f9.otf') format('opentype');
}
@font-face {
  font-family: 'Times New Roman';
  font-style: normal;
  font-weight: 700;
  src: url('fonts/Times-New-Roman-700-66ca9384-777c-4d20-9f1d-8f1ab849e4f9.otf') format('opentype');
}
