:root {
  color-scheme: light dark;
  --bg: #f7f4ef;
  --surface: #fffdf9;
  --text: #1c1917;
  --muted: #78716c;
  --border: #e7e5e4;
  --accent: #b45309;
  --accent-soft: #fef3c7;
  --segment-hover: rgba(180, 83, 9, 0.06);
  --font-serif: "Songti SC", "Noto Serif TC", "Source Han Serif TC", "PMingLiU", serif;
  --font-sans: "PingFang TC", "Noto Sans TC", "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0a09;
    --surface: #1c1917;
    --text: #fafaf9;
    --muted: #a8a29e;
    --border: #292524;
    --accent: #fbbf24;
    --accent-soft: #422006;
    --segment-hover: rgba(251, 191, 36, 0.08);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.body--page {
  overflow: auto;
}

body.body--reader {
  overflow: hidden;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.site-brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

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

.site-tabs {
  display: inline-flex;
  flex-shrink: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}

.site-tab {
  padding: 0.4rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.site-tab + .site-tab {
  border-left: 1px solid var(--border);
}

.site-tab:hover {
  color: var(--text);
  background: var(--segment-hover);
}

.site-tab.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.page-main {
  flex: 1;
}

.page-inner {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.page-inner--narrow {
  max-width: 40rem;
}

.page-header h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  line-height: 1.3;
}

.page-header--home h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
}

.page-lead {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 40rem;
}

.edit-mode-banner {
  margin: 0 0 1.25rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 0.45rem;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.45;
}

[data-editable].is-editing {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  border-radius: 0.25rem;
  cursor: text;
}

[data-editable].is-editing:focus {
  outline-style: solid;
}

.book-section {
  margin-top: 2.5rem;
}

.book-section-heading {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.book-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.book-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  list-style: none;
}

.book-card--loading {
  justify-content: center;
}

.book-card-info {
  min-width: 0;
  flex: 1;
}

.book-card-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
}

.book-card-en {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.book-card-read {
  flex-shrink: 0;
  padding: 0.5rem 1.15rem;
  border-radius: 0.45rem;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}

.book-card-read:hover {
  filter: brightness(0.97);
}

.book-card-read--disabled {
  opacity: 0.55;
  border-color: var(--border);
  background: var(--bg);
  color: var(--muted);
  font-weight: 500;
}

.about-prose {
  font-size: 1rem;
  line-height: 1.75;
}

.about-lead {
  margin: 0 0 1.5rem;
  font-size: 1.05rem;
  color: var(--text);
}

.about-note {
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--muted);
}

.knowledge-prose {
  font-size: 1rem;
  line-height: 1.75;
}

.knowledge-placeholder {
  margin: 0;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

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

@media (max-width: 720px) {
  .site-nav {
    flex-wrap: wrap;
    padding-inline: 1rem;
  }

  .site-tabs {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .site-tab {
    flex: 1 1 auto;
    text-align: center;
    white-space: nowrap;
  }

  .book-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .book-card-read {
    align-self: stretch;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
