@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@400;600;700;900&family=Noto+Sans+TC:wght@400;500;700&display=swap');

:root {
  --parchment: #ECE3CC;
  --parchment-deep: #E1D5B0;
  --ink: #221E1A;
  --ink-soft: #4A433A;
  --gold: #A9792C;
  --bible: #A9792C;              /* 聖經 */
  --theology: #7A2E2E;           /* 神學 */
  --systematic: #344A6B;         /* 系統神學 */
  --practical: #51643E;          /* 實踐神學 */
  --church-history: #6B4423;     /* 教會歷史 */
  --evangelism: #B5563C;         /* 福音神學 */
  --spiritual: #5C4F6B;          /* 靈修神學 */
  --servant: #3B6E64;            /* 僕人神學 */
  --missional: #9C4A2E;          /* 宣教神學 */
  --workplace: #5A5550;          /* 職場神學 */
  --ot-history: #8A6D3B;         /* 舊約歷史 */
  --nt-history: #4A6B5C;         /* 新約歷史 */
  --correct: #51643E;
  --wrong: #7A2E2E;
  --card-shadow: rgba(34, 30, 26, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--parchment);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(169,121,44,0.06), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(122,46,46,0.05), transparent 45%);
  color: var(--ink);
  font-family: 'Noto Sans TC', sans-serif;
  min-height: 100vh;
}

h1, h2 {
  font-family: 'Noto Serif TC', serif;
  margin: 0;
}

/* ---------- 頂部帳冊條 ---------- */
.ledger-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--ink);
  color: var(--parchment);
  border-bottom: 4px solid var(--gold);
}
.ledger-bar__title { display: flex; align-items: center; gap: 10px; }
.ledger-bar__mark {
  font-family: 'Noto Serif TC', serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}
.ledger-bar h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.ledger-bar__stat {
  font-size: 12px;
  letter-spacing: 0.08em;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: 2px;
  white-space: nowrap;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}

.intro {
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.7;
  margin: 4px 0 22px;
}

/* ---------- 類別「抽屜」 ---------- */
.drawers {
  display: grid;
  gap: 14px;
}
.drawer {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--parchment-deep);
  border: none;
  border-left: 8px solid var(--cat-color, var(--gold));
  border-radius: 3px;
  padding: 16px 16px 14px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 2px 0 var(--card-shadow);
  transition: transform 0.12s ease;
  font-family: inherit;
}
.drawer:active { transform: translateY(1px); }
.drawer__label {
  font-family: 'Noto Serif TC', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.drawer__meta {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
}
.drawer__handle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 8px;
  border-radius: 4px;
  background: var(--cat-color, var(--gold));
  opacity: 0.55;
}

/* ---------- 表單 / 設定頁 ---------- */
.back-link {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
  padding: 0 0 14px;
  font-family: inherit;
}
#view-setup h2 {
  font-size: 22px;
  margin-bottom: 16px;
  color: var(--cat-color, var(--ink));
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field select, .field input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #c9bb95;
  border-radius: 3px;
  background: #fff8ea;
  color: var(--ink);
  font-family: inherit;
}

.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  font-family: 'Noto Serif TC', serif;
  letter-spacing: 0.03em;
}
.btn-primary {
  background: var(--ink);
  color: var(--parchment);
  width: 100%;
}
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}

/* ---------- 測驗進度 ---------- */
.quiz-progress { margin-bottom: 16px; }
#quizProgressText {
  font-size: 12.5px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}
.quiz-progress__bar {
  margin-top: 6px;
  height: 4px;
  background: var(--parchment-deep);
  border-radius: 2px;
  overflow: hidden;
}
#quizProgressFill {
  height: 100%;
  background: var(--cat-color, var(--gold));
  width: 0%;
  transition: width 0.25s ease;
}

/* ---------- 題卡（索引卡） ---------- */
.card {
  position: relative;
  background: #FBF6E8;
  border: 1px solid #d9c89a;
  border-radius: 2px;
  padding: 28px 20px 22px;
  box-shadow: 0 6px 0 var(--card-shadow);
  margin-bottom: 18px;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, transparent 0 6px, #d9c89a 6px 7px);
  opacity: 0.6;
}
.card__tab {
  position: absolute;
  top: -10px;
  left: 20px;
  font-family: 'Noto Serif TC', serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #fff;
  background: var(--cat-color, var(--gold));
  padding: 4px 10px 3px;
  border-radius: 2px;
}
.card__stamp {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  border: 1px solid var(--ink-soft);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transform: rotate(-8deg);
  opacity: 0.7;
}
.card__subcat {
  margin: 14px 0 4px;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
}
.card__question {
  font-size: 18px;
  line-height: 1.55;
  margin: 4px 0 18px;
}
.card__options { display: grid; gap: 10px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1.5px solid #d9c89a;
  border-radius: 3px;
  cursor: pointer;
  background: #fff;
  font-size: 14.5px;
  line-height: 1.5;
}
.option__letter {
  font-family: 'Noto Serif TC', serif;
  font-weight: 700;
  color: var(--cat-color, var(--gold));
  flex-shrink: 0;
}
.option.selected { border-color: var(--ink); background: #f3ecd8; }
.option.correct { border-color: var(--correct); background: #e7eee0; }
.option.wrong { border-color: var(--wrong); background: #f3e3e1; }
.option.disabled { cursor: default; }

.card__feedback {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 3px;
  font-size: 13.5px;
  line-height: 1.6;
  background: #f3ecd8;
  border-left: 4px solid var(--cat-color, var(--gold));
}

.quiz-nav { display: flex; gap: 10px; }
.quiz-nav .btn-secondary, .quiz-nav .btn-primary { flex: 1; }

/* ---------- 結果頁 ---------- */
.result-seal {
  text-align: center;
  margin: 10px 0 28px;
}
.result-seal__score {
  font-family: 'Noto Serif TC', serif;
  font-weight: 900;
  font-size: 48px;
  color: var(--ink);
}
.result-seal__label {
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}
.result-item {
  border: 1px solid #d9c89a;
  border-left: 5px solid var(--gold);
  border-radius: 2px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #FBF6E8;
  font-size: 13.5px;
  line-height: 1.6;
}
.result-item.correct { border-left-color: var(--correct); }
.result-item.wrong { border-left-color: var(--wrong); }
.result-item__q { font-weight: 700; margin-bottom: 4px; }
.result-item__meta { color: var(--ink-soft); font-size: 12.5px; }
.result-actions { display: flex; gap: 10px; margin-top: 18px; }
.result-actions .btn-secondary, .result-actions .btn-primary { flex: 1; }

.footer-note {
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-soft);
  padding: 20px 0 30px;
  letter-spacing: 0.03em;
}

.view[hidden] { display: none; }

@media (min-width: 600px) {
  .card__question { font-size: 19px; }
}
