
:root {
  --bg: #f7f3ea;
  --bg-card: #ffffff;
  --text: #2a2420;
  --text-dim: #7a7267;
  --accent: #8a2e2e;
  --border: #e3dbc9;
  --link: #6b3fa0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --bg-card: #211d17;
    --text: #ece5d8;
    --text-dim: #a89f8f;
    --accent: #e0a35c;
    --border: #3a332a;
    --link: #c9a7ff;
  }
}
* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Serif", "Georgia", "Times New Roman", serif;
  margin: 0;
  padding: 0;
  line-height: 1.75;
}
.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}
header.top {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 14px;
  margin-bottom: 24px;
}
header.top h1 {
  font-size: 1.5rem;
  margin: 0 0 4px;
}
header.top .subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.progress-bar {
  background: var(--border);
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
  margin: 10px 0 4px;
}
.progress-bar > div {
  background: var(--accent);
  height: 100%;
}
.progress-label { font-size: 0.85rem; color: var(--text-dim); }

.search-box {
  width: 100%;
  padding: 10px 12px;
  margin: 16px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
}

.chapter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.chapter-list li a {
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapter-list li a .badge {
  color: var(--accent);
  margin-right: 4px;
}
.chapter-list li a.raw { color: var(--text-dim); }

.chapter-header {
  margin-bottom: 20px;
}
.chapter-header h1 { font-size: 1.3rem; margin: 0 0 6px; }
.badge-status {
  display: inline-block;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.badge-status.edited { color: var(--accent); border-color: var(--accent); }

.chapter-content p {
  margin: 0 0 1.1em;
  font-size: 1.18rem;
  line-height: 1.85;
}
.chapter-content p.dialogue { padding-left: 4px; }
.chapter-content strong.sfx {
  color: var(--accent);
  letter-spacing: 0.02em;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.nav-buttons a, .nav-buttons span {
  flex: 1;
  text-align: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}
.nav-buttons span.disabled { color: var(--text-dim); }
.back-index { text-align: center; display: block; margin-top: 10px; }
