:root {
  --bg: #fbf7f0;
  --card: rgba(255, 255, 255, 0.72);
  --border: #f0e1cc;
  --accent: #c58a3e;
  --accent-soft: rgba(197, 138, 62, 0.12);
  --accent-line: rgba(197, 138, 62, 0.3);
  --text: #3b2e21;
  --muted: rgba(59, 46, 33, 0.62);
  --faint: rgba(59, 46, 33, 0.4);
  --link: #7a4b12;
  --shadow: 0 1px 2px rgba(59, 46, 33, 0.06), 0 8px 24px rgba(59, 46, 33, 0.05);
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC",
    "Microsoft JhengHei", sans-serif;
  --font-heading: "Noto Serif TC", "Songti TC", "PMingLiU", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1713;
    --card: rgba(255, 248, 238, 0.05);
    --border: #3a3027;
    --accent: #e0a95e;
    --accent-soft: rgba(224, 169, 94, 0.14);
    --accent-line: rgba(224, 169, 94, 0.32);
    --text: #f2e9dc;
    --muted: rgba(242, 233, 220, 0.66);
    --faint: rgba(242, 233, 220, 0.42);
    --link: #f0bf7c;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; }

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(48px, env(safe-area-inset-top)) 16px 48px;
}

.page--center { justify-content: center; }

.wrap { width: 100%; max-width: 36rem; text-align: center; }

/* 頂部小標籤 */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
  padding: 6px 12px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}
.eyebrow svg { width: 16px; height: 16px; flex: none; }

/* 經文卡片 */
.card {
  margin: 0;
  padding: 48px 28px 36px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}
@media (min-width: 640px) { .card { padding: 56px 40px 40px; } }

.card blockquote {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 24px;
  line-height: 1.75;
  letter-spacing: 0.02em;
  white-space: pre-line;
  text-wrap: pretty;
}
@media (min-width: 640px) { .card blockquote { font-size: 28px; } }

.card figcaption {
  margin-top: 24px;
  color: var(--muted);
  font-family: var(--font-heading);
  font-size: 15px;
  letter-spacing: 0.04em;
}
.card figcaption .tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--faint);
  vertical-align: 1px;
}

.card.fade { animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .card.fade { animation: none; } }

.tagline { margin: 32px 0 0; font-size: 18px; color: var(--text); opacity: 0.85; }
.subtext { margin: 8px 0 0; font-size: 16px; color: var(--muted); }

/* 按鈕 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.btn:active { transform: scale(0.97); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn { color: #1b1713; } }

.text-link {
  color: var(--link);
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 卡片下方動作列 */
.actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 68px;
  padding: 10px 8px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.icon-btn[aria-pressed="true"] svg { fill: currentColor; }

/* 主題篩選 */
.section-title {
  margin: 56px 0 14px;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  text-align: left;
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 2px 16px 10px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

/* 經文列表 */
.list { list-style: none; margin: 8px 0 0; padding: 0; text-align: left; }
.list li + li { border-top: 1px solid var(--border); }
.list button {
  display: block;
  width: 100%;
  padding: 16px 4px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.list .t { font-family: var(--font-heading); font-size: 16px; line-height: 1.7; }
.list .r { margin-top: 4px; color: var(--faint); font-size: 13px; }
.list .empty { padding: 32px 0; color: var(--faint); text-align: center; font-size: 14px; }

.footer { margin-top: 48px; color: var(--faint); font-size: 12px; }

/* 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

[hidden] { display: none !important; }
