/* OrientSmile.com — 东方微笑 */

:root {
  --color-primary: #2e5c4a;
  --color-primary-dark: #1f4033;
  --color-primary-light: #3d7560;
  --color-accent: #b8860b;
  --color-accent-soft: #d4a843;
  --color-bg: #f7f2e8;
  --color-bg-alt: #efe6d6;
  --color-surface: #fffdf8;
  --color-text: #2c2416;
  --color-text-muted: #6b5d4a;
  --color-border: #ddd0b8;
  --color-highlight: rgba(184, 134, 11, 0.25);
  --font-serif-zh: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --font-serif-en: "Noto Serif", "Georgia", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --shadow-sm: 0 1px 3px rgba(44, 36, 22, 0.08);
  --shadow-md: 0 4px 20px rgba(44, 36, 22, 0.1);
  --radius: 8px;
  --header-h: 64px;
  --site-shell: 1200px;
  --site-gutter: 1.25rem;
  --toc-w: 300px;
  --reader-shell: var(--site-shell);
  --reader-gutter: var(--site-gutter);
  --reader-font-size: 18px;
  --reader-line-height: 1.85;
}

[data-theme="night"] {
  --color-bg: #1a1814;
  --color-bg-alt: #242018;
  --color-surface: #2a2520;
  --color-text: #e8e0d4;
  --color-text-muted: #a89880;
  --color-border: #3d3528;
  --color-highlight: rgba(212, 168, 67, 0.3);
}

[data-theme="eye"] {
  --color-bg: #e8f0e4;
  --color-bg-alt: #dce8d6;
  --color-surface: #f2f8ef;
  --color-text: #2a3828;
  --color-text-muted: #5a6b58;
  --color-border: #c5d4be;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover { color: var(--color-accent); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--site-shell);
  margin: 0 auto;
  padding: 0 var(--site-gutter);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-text);
  font-weight: 600;
}

.brand:hover { color: var(--color-primary); }

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-serif-zh);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-name {
  font-family: var(--font-serif-zh);
  font-size: 1.15rem;
}

.brand-domain {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-nav a {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--color-primary);
  background: var(--color-bg-alt);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

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

/* Language switcher */
.lang-switch {
  display: inline-flex;
  align-items: stretch;
  padding: 3px;
  gap: 2px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  flex-shrink: 0;
}

.lang-switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 2.75rem;
  padding: 0.35rem 0.65rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.lang-switch-btn:hover:not(.active) {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.45);
}

.lang-switch-btn.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.lang-switch-short {
  font-family: var(--font-serif-zh);
  font-size: 0.9rem;
  font-weight: 600;
}

.lang-switch-full {
  display: none;
}

@media (min-width: 640px) {
  .lang-switch-btn {
    min-width: 4.5rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
  }

  .lang-switch-short {
    display: none;
  }

  .lang-switch-full {
    display: inline;
  }
}

/* Hero */
.hero {
  position: relative;
  padding: 4rem var(--site-gutter) 5rem;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(46, 92, 74, 0.08) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%232e5c4a' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  background: rgba(46, 92, 74, 0.1);
  color: var(--color-primary);
  border-radius: 999px;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  letter-spacing: 0.06em;
}

.hero h1 {
  font-family: var(--font-serif-zh);
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 600;
  margin: 0 0 1rem;
  line-height: 1.35;
  color: var(--color-text);
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  margin: 0 0 2rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* Sections */
.section {
  max-width: var(--site-shell);
  margin: 0 auto;
  padding: 3rem var(--site-gutter);
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-header h2 {
  font-family: var(--font-serif-zh);
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
}

.section-header p {
  color: var(--color-text-muted);
  margin: 0;
}

/* Book cards */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 480px));
  justify-content: center;
  gap: 1.5rem;
}

.book-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}

.book-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.book-card.coming-soon {
  opacity: 0.65;
  pointer-events: none;
}

.book-card-cover {
  height: 140px;
  background: linear-gradient(145deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.book-card-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Ctext x='50' y='58' text-anchor='middle' font-family='serif' font-size='48' fill='rgba(255,255,255,0.12)'%3E典%3C/text%3E%3C/svg%3E") center/80px repeat;
}

.book-card-title-zh {
  font-family: var(--font-serif-zh);
  font-size: 2rem;
  color: #fff;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.book-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.book-card-title-en {
  font-family: var(--font-serif-en);
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.book-card-desc {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-live {
  background: rgba(46, 92, 74, 0.12);
  color: var(--color-primary);
}

.badge-soon {
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
}

.book-card-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.625rem;
  align-items: center;
}

.book-card-actions .btn {
  height: 2.25rem;
  padding: 0 1rem;
  font-size: 0.875rem;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.book-card-actions .store-badges {
  flex-wrap: nowrap;
  flex-shrink: 0;
}

/* Store badges (official Get it on Google Play / App Store artwork) */
.store-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  transition: transform 0.15s, opacity 0.15s;
}

a.store-badge:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.store-badge img {
  display: block;
  height: 2.25rem;
  width: auto;
}

.store-badge--soon {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.app-banner .store-badge--soon {
  opacity: 0.5;
}

/* About */
.about-block {
  max-width: none;
  margin: 0;
  text-align: center;
  padding: 2rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) + 4px);
}

.about-block p {
  color: var(--color-text-muted);
  line-height: 1.8;
  margin: 0;
}

.about-contact {
  margin-top: 1.25rem !important;
}

.about-contact a {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
}

.about-contact a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

.site-footer p { margin: 0.25rem 0; }

.site-footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.site-footer-sep {
  color: var(--color-border);
  user-select: none;
}

.site-footer a {
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer a:hover { color: var(--color-primary); }

/* Scroll to top */
.scroll-top-btn {
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right, 0px));
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  z-index: 900;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  pointer-events: none;
  transition:
    opacity 0.2s,
    visibility 0.2s,
    transform 0.2s,
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.scroll-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-btn:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.scroll-top-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Legal / policy pages */
.legal-page {
  max-width: var(--site-shell);
  margin: 0 auto;
  padding: 2rem var(--site-gutter) 3rem;
}

.legal-page [data-lang-panel] {
  display: none;
}

html:not([data-legal-locale]) .legal-page [data-lang-panel="zh"],
html[data-legal-locale="zh"] .legal-page [data-lang-panel="zh"],
html[data-legal-locale="en"] .legal-page [data-lang-panel="en"] {
  display: block;
}

[data-lang-panel][hidden] {
  display: none !important;
}

.legal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-md);
  padding: 2rem 1.75rem 2.5rem;
}

.legal-page h1 {
  font-family: var(--font-serif-zh);
  font-size: 1.75rem;
  margin: 0 0 0.35rem;
  color: var(--color-primary-dark);
}

.legal-head {
  margin-bottom: 0.25rem;
}

.legal-summary {
  margin: 0 0 1.75rem;
  padding: 1rem 1.15rem;
  background: rgba(46, 92, 74, 0.07);
  border: 1px solid rgba(46, 92, 74, 0.18);
  border-radius: var(--radius);
}

.legal-summary > p {
  margin: 0 0 0.5rem;
  color: var(--color-primary-dark);
}

.legal-summary ul {
  margin: 0;
  padding-left: 1.25rem;
}

.legal-summary li {
  margin: 0.35rem 0;
}

.legal-toc {
  margin: 0 0 2rem;
  padding: 1rem 1.15rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.legal-toc-title {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.legal-toc ol {
  margin: 0;
  padding-left: 1.35rem;
  columns: 2;
  column-gap: 2rem;
}

.legal-toc li {
  margin: 0.25rem 0;
  break-inside: avoid;
}

.legal-toc a {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.92rem;
}

.legal-toc a:hover {
  text-decoration: underline;
}

.legal-page section {
  scroll-margin-top: 5rem;
}

.legal-h3 {
  font-size: 0.98rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
  color: var(--color-text);
}

.legal-dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.95rem;
}

.legal-dl dt {
  margin: 0;
  color: var(--color-text-muted);
  font-weight: 500;
}

.legal-dl dd {
  margin: 0;
}

.legal-dl--contact {
  margin-top: 1rem;
}

[data-lang-panel="en"] h1 {
  font-family: var(--font-serif-en);
}

.legal-meta {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.legal-page h2 {
  font-size: 1.08rem;
  margin: 2rem 0 0.75rem;
  color: var(--color-primary);
}

.legal-page p {
  margin: 0 0 1rem;
}

.legal-page p,
.legal-page li {
  line-height: 1.75;
  color: var(--color-text);
}

.legal-page ul {
  margin: 0.35rem 0 1rem;
  padding-left: 1.35rem;
}

.legal-page li { margin: 0.4rem 0; }

.legal-page code {
  font-size: 0.88em;
  padding: 0.12em 0.35em;
  background: var(--color-bg-alt);
  border-radius: 4px;
  word-break: break-all;
}

.legal-app-box {
  margin: 1.25rem 0 1.75rem;
  padding: 1rem 1.15rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.legal-app-box > p {
  margin: 0 0 0.65rem;
  color: var(--color-primary-dark);
}

.legal-app-box ul {
  margin: 0;
}

.legal-app-box a { word-break: break-all; }

@media (max-width: 640px) {
  .legal-card {
    padding: 1.35rem 1.1rem 1.75rem;
  }

  .legal-page h1 {
    font-size: 1.45rem;
  }

  .legal-toc ol {
    columns: 1;
  }
}

/* App banner */
.app-banner {
  background: linear-gradient(90deg, var(--color-primary-dark), var(--color-primary));
  color: #fff;
  padding: 0.85rem var(--site-gutter);
}

.app-banner-inner {
  max-width: var(--site-shell);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.app-banner-text strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.app-banner-text span {
  font-size: 0.82rem;
  opacity: 0.88;
}

.app-banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.app-banner .btn-primary {
  background: #fff;
  color: var(--color-primary);
}

.app-banner .btn-primary:hover {
  background: var(--color-bg);
}

.app-banner .btn-ghost {
  border-color: rgba(255,255,255,0.4);
  color: rgba(255,255,255,0.9);
}

.app-banner .btn-ghost:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Reader layout */
.reader-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.reader-page .header-inner,
.reader-page .app-banner-inner {
  max-width: var(--reader-shell);
  padding-left: var(--reader-gutter);
  padding-right: var(--reader-gutter);
}

.reader-layout {
  display: flex;
  flex: 1;
  max-width: var(--reader-shell);
  margin: 0 auto;
  width: 100%;
}

.reader-sidebar {
  width: var(--toc-w);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  max-height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
}

.reader-sidebar.hidden-mobile {
  display: none;
}

.sidebar-header {
  padding: 1rem var(--reader-gutter);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
}

.sidebar-header h2 {
  font-family: var(--font-serif-zh);
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
}

.sidebar-header h2 .sidebar-book-link {
  color: inherit;
  text-decoration: none;
}

.sidebar-header h2 .sidebar-book-link:hover {
  color: var(--color-primary);
}

.sidebar-header p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
}

.toc-part {
  border-bottom: 1px solid var(--color-border);
}

.toc-part-title {
  width: 100%;
  padding: 0.65rem var(--reader-gutter);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-bg-alt);
  letter-spacing: 0.04em;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.15s;
}

.toc-part-title:hover {
  background: rgba(46, 92, 74, 0.08);
}

.toc-part-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform 0.15s ease;
  opacity: 0.75;
}

.toc-part--collapsed .toc-part-chevron {
  transform: rotate(-45deg);
}

.toc-part--collapsed .toc-list {
  display: none;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
}

.toc-list a {
  display: block;
  padding: 0.45rem 1rem 0.45rem 1.25rem;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  border-left: 3px solid transparent;
}

.toc-list a:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.toc-list a.active {
  color: var(--color-primary);
  background: rgba(46, 92, 74, 0.06);
  border-left-color: var(--color-primary);
  font-weight: 500;
}

.toc-num {
  display: inline-block;
  min-width: 1.75rem;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.reader-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem var(--site-gutter);
  background: transparent;
  border-bottom: none;
  flex-wrap: wrap;
}

.reader-toolbar .spacer { flex: 1; }

.reader-search {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.85rem;
  width: 160px;
  font-family: inherit;
}

.theme-group {
  display: flex;
  gap: 0.25rem;
}

.theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  cursor: pointer;
  padding: 0;
}

.theme-btn.active { border-color: var(--color-primary); }

.theme-btn[data-theme-pick="day"] { background: #f7f2e8; }
.theme-btn[data-theme-pick="night"] { background: #1a1814; }
.theme-btn[data-theme-pick="eye"] { background: #e8f0e4; }

.font-control {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.font-control input[type="range"] {
  width: 80px;
  accent-color: var(--color-primary);
}

.reader-content-wrap {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 2rem var(--site-gutter) 3rem;
  box-sizing: border-box;
}

.book-intro-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) + 4px);
  padding: 2rem;
  margin-bottom: 2rem;
}

.book-intro-panel h1 {
  font-family: var(--font-serif-zh);
  font-size: 2rem;
  margin: 0 0 0.35rem;
}

.book-intro-panel .subtitle {
  color: var(--color-accent);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.book-intro-panel .intro-text {
  color: var(--color-text-muted);
  line-height: 1.85;
  margin-bottom: 1.5rem;
}

.book-intro-actions {
  margin-top: 1.5rem;
}

.part-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.part-card {
  padding: 1rem;
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.part-card-badge {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
  font-family: var(--font-serif-zh);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.part-card h3 {
  font-family: var(--font-serif-zh);
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.part-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.app-features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.app-feature-tag {
  padding: 0.25rem 0.65rem;
  background: rgba(46, 92, 74, 0.08);
  color: var(--color-primary);
  border-radius: 999px;
  font-size: 0.8rem;
}

.chapter-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.chapter-part-label {
  font-size: 0.85rem;
  color: var(--color-primary);
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.chapter-title {
  font-family: var(--font-serif-zh);
  font-size: clamp(1.4rem, 4vw, 1.85rem);
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.chapter-index {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.reader-body {
  font-family: var(--font-serif-zh);
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
  letter-spacing: 0.02em;
}

html[lang="en"] .reader-body {
  font-family: var(--font-serif-en);
  letter-spacing: 0.01em;
}

.reader-body p {
  margin: 0 0 1.25em;
}

.reader-body mark {
  background: var(--color-highlight);
  color: inherit;
  padding: 0 0.1em;
  border-radius: 2px;
}

.reader-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.reader-nav a {
  flex: 1;
  max-width: 48%;
  padding: 0.85rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.reader-nav a:hover {
  border-color: var(--color-primary);
  background: var(--color-bg-alt);
}

.reader-nav .nav-label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.reader-nav .nav-title {
  display: block;
  color: var(--color-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-nav .next-link { text-align: right; }

.loading-state,
.error-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--color-text-muted);
}

.file-protocol-notice {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  background: #fff8e6;
  border: 1px solid #e6c878;
  border-radius: calc(var(--radius) + 4px);
  color: var(--color-text);
  line-height: 1.75;
}

.file-protocol-notice h2 {
  font-family: var(--font-serif-zh);
  font-size: 1.35rem;
  margin: 0 0 1rem;
  color: #8a5a00;
}

.file-protocol-notice p {
  margin: 0 0 1rem;
}

.file-protocol-notice ol {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}

.file-protocol-notice li {
  margin-bottom: 0.65rem;
}

.file-protocol-notice code {
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.file-protocol-notice a {
  word-break: break-all;
  font-weight: 500;
}

html.file-protocol .app-banner {
  display: none !important;
}

.toc-toggle {
  display: none;
}

.mobile-overlay {
  display: none;
}

@media (max-width: 900px) {
  .site-nav .site-nav-link { display: none; }

  .reader-sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.25s;
    box-shadow: var(--shadow-md);
  }

  .reader-sidebar.open {
    transform: translateX(0);
    display: block;
  }

  .toc-toggle { display: inline-flex; }

  .mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(0,0,0,0.35);
    z-index: 80;
  }

  .mobile-overlay.visible { display: block; }

  .part-cards { grid-template-columns: 1fr; }

  .reader-content-wrap { padding: 1.25rem var(--site-gutter) 2rem; }
}

@media (max-width: 480px) {
  .hero { padding: 2.5rem var(--site-gutter) 3rem; }
  .reader-search { width: 120px; }

  .book-card-actions .btn,
  .book-card-actions .store-badge img {
    height: 2rem;
  }

  .book-card-actions .btn {
    padding: 0 0.75rem;
    font-size: 0.8125rem;
  }
}
