:root {
  color-scheme: light;
  --ink: #253644;
  --muted: #687681;
  --accent: #b47339;
  --line: #dfddd5;
  --paper: #fffefa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: #f5f3ed;
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.65;
}

button, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.quiz-page { min-height: 100vh; display: flex; flex-direction: column; }

.quiz-header {
  min-height: 78px;
  padding: 15px max(24px, calc((100vw - 1160px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #fff;
  background: #253c49;
}

.quiz-home { font-size: 20px; font-weight: 750; letter-spacing: .06em; white-space: nowrap; }
.quiz-home span { font-size: 14px; font-weight: 400; opacity: .78; }
.quiz-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; font-size: 14px; }
.quiz-header nav a { opacity: .8; }
.quiz-header nav a:hover, .quiz-header nav a[aria-current] { opacity: 1; color: #f2c38f; }

.quiz-main { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0 80px; flex: 1; }
.quiz-intro { max-width: 730px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .17em; }
.quiz-intro h1 { margin: 0 0 13px; font-size: clamp(30px, 4.5vw, 48px); letter-spacing: .05em; line-height: 1.25; }
.quiz-intro > p:last-child { margin: 0; color: var(--muted); font-size: 16px; }
.quiz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 24px; align-items: start; }

.question-card, .score-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(40, 50, 44, .055);
}
.question-card { padding: clamp(24px, 4vw, 42px); background: var(--paper); }
.question-topline { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.round-label, .category-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.round-label { color: #94592c; background: #faebda; padding: 5px 12px; border-radius: 100px; }
.category-label { color: var(--muted); }
.question-card h2 { margin: 23px 0 27px; font-size: clamp(22px, 3vw, 30px); letter-spacing: .025em; }
.clue { padding: 20px 23px; border-radius: 11px; background: #f4f7f5; margin: 0 0 13px; }
.explanation-clue { background: #f8f4ee; }
.audio-clue { background: #edf3f4; }
.audio-clue audio { display: block; width: 100%; margin-top: 10px; }
.clue-label { display: block; margin-bottom: 7px; color: #63756c; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.clue p { margin: 0; overflow-wrap: anywhere; white-space: normal; }
.clue .pinyin { font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1.55; color: #183d49; }
.answer-form { margin-top: 31px; }
.answer-form label { display: block; margin-bottom: 9px; font-weight: 750; }
.answer-form textarea { display: block; width: 100%; padding: 15px 17px; resize: vertical; min-height: 110px; border: 1px solid #c6ccc7; border-radius: 9px; background: #fff; color: var(--ink); font-size: 18px; outline: none; }
.answer-form textarea:focus { border-color: #426f77; box-shadow: 0 0 0 3px rgba(66, 111, 119, .15); }
.form-bottom { margin-top: 15px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.form-bottom > span { color: var(--muted); font-size: 13px; }
.primary-button { border: 0; border-radius: 8px; background: #ad6d37; color: #fff; font-weight: 750; padding: 12px 19px; cursor: pointer; white-space: nowrap; }
.primary-button:hover, .primary-button:focus-visible { background: #8e5427; }
.primary-button span { margin-left: 8px; }
.notice { padding: 12px 15px; border: 1px solid #e6bd9d; border-radius: 8px; color: #874c25; background: #fff4ea; }

.result { margin-top: 30px; padding: 24px; border: 1px solid #ead6bd; border-radius: 11px; background: #fff8ee; }
.result-perfect { background: #f1f8f3; border-color: #bcd8c4; }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.result-heading h3 { margin: 0; font-size: 24px; }
.result-heading strong { color: #995c2d; font-size: 35px; white-space: nowrap; }
.result-perfect .result-heading strong { color: #3b7a53; }
.result-heading small { font-size: 15px; font-weight: 500; }
.result dl { margin: 18px 0 0; }
.result dl div { padding: 10px 0; border-top: 1px solid rgba(83, 77, 63, .14); }
.result dt { color: var(--muted); font-size: 13px; }
.result dd { margin: 3px 0 0; font-size: 19px; font-weight: 650; overflow-wrap: anywhere; }
.answer-difference { color: #c23232; font-weight: 850; }
.difference-note { display: block; margin-top: 8px; color: #a43838; font-size: 12px; }
.next-form { margin-top: 20px; text-align: right; }

.score-card { padding: 28px; background: #fff; }
.score-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 21px; border-radius: 50%; color: #925c33; background: #f9ead7; font-size: 22px; }
.score-card h2 { margin: 0 0 20px; font-size: 21px; }
.average { padding: 15px 0 22px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 8px; }
.average strong { font-size: 52px; line-height: 1; font-weight: 750; color: #a26535; }
.average span { color: var(--muted); font-size: 13px; }
.score-row { display: flex; justify-content: space-between; gap: 12px; padding-top: 16px; font-size: 14px; }
.score-row span, .score-note { color: var(--muted); }
.score-note { font-size: 12px; margin: 26px 0 0; }
.reset-button { margin-top: 15px; padding: 0; border: 0; background: none; color: #915527; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.quiz-footer { padding: 22px; text-align: center; color: #768077; font-size: 12px; border-top: 1px solid #e6e3dc; }

@media (max-width: 820px) {
  .quiz-header { align-items: flex-start; flex-direction: column; gap: 12px; }
  .quiz-header nav { gap: 15px; }
  .quiz-layout { grid-template-columns: 1fr; }
  .quiz-main { padding-top: 40px; }
}

@media (max-width: 550px) {
  .quiz-main { width: min(100% - 28px, 1160px); }
  .quiz-home { font-size: 17px; }
  .quiz-home span { font-size: 12px; }
  .question-card, .score-card { padding: 22px; }
  .clue { padding: 17px; }
  .clue .pinyin { font-size: 20px; }
  .form-bottom { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
}
