* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f6f6f6;
  color: #222;
}

.page {
  min-height: 100vh;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: linear-gradient(135deg, #2f3b52 0%, #1f2937 100%);
  color: #f8fafc;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.2);
  z-index: 100;
}

.topbar .controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.topbar input[type="range"] {
  vertical-align: middle;
}

.sidebar {
  position: fixed;
  top: 56px;
  bottom: 0;
  width: 280px;
  background: #fff;
  border-right: 1px solid #e1e1e1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar nav li {
  margin: 0.25rem 0;
}

.sidebar nav a {
  color: #1f2933;
  text-decoration: none;
  display: block;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: #e3f2fd;
}

.content {
  margin-left: 280px;
  padding: 2rem;
  padding-top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  background: #fefefe;
  line-height: 1.75;
  font-size: 18px;
}

.content .chapter {
  max-width: 720px;
  margin: 0 auto;
}

.content h1,
.content h2,
.content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.75em;
}

.content p {
  margin: 0.75em 0;
}

.content [data-lang="original"] {
  color: #2f4858;
}

.content [data-lang="translation"] {
  color: #222;
}

body.hide-original [data-lang="original"] {
  display: none;
}

body.hide-translation [data-lang="translation"] {
  display: none;
}

.tepub-img {
  max-width: 100%;
  height: auto;
}

.search-highlight {
  background: #ffe0b2;
}

.content img, .content svg {
  display: block;
  margin: 1.5rem auto;
  max-width: 85%;
  height: auto;
}

.content h1, .content h2 {
  text-align: center;
}

.chapter-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: #334155;       /* 根据顶栏颜色再选 */
  font-size: 3.5rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.chapter-nav:hover { color: #1d2755; transform: translateY(-50%) scale(1.05); }
.chapter-nav:disabled { opacity: 0.3; cursor: default; transform: translateY(-50%); }

.chapter-nav.prev {
  left: calc(280px + 16px);
}
.chapter-nav.next {
  right: 24px;
}
@media (max-width: 1024px) {
  .chapter-nav.prev { left: 16px; }
  .chapter-nav.next { right: 16px; }
  .sidebar { width: 220px; }
  .content { margin-left: 220px; padding: calc(2rem + 56px) 1.75rem 2rem; }
}
