:root {
  --paper: #f5efe4;
  --paper-light: #fffaf1;
  --ink: #292823;
  --tea: #6d5747;
  --jade: #416c5c;
  --jade-dark: #2f5247;
  --line: rgba(78, 67, 55, 0.18);
  --error: #8b3e36;
  --wood: #66805f;
  --fire: #b36b5c;
  --earth: #aa8554;
  --metal: #767773;
  --water: #557180;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-synthesis: none;
  line-height: 1.7;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(65, 108, 92, 0.1), transparent 28rem),
    linear-gradient(115deg, transparent 0 49%, rgba(86, 70, 53, 0.025) 50%, transparent 51%) 0 0 / 19px 23px,
    var(--paper);
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #166b57; outline-offset: 3px; }
[hidden] { display: none !important; }

.shell { width: min(100% - 2rem, 44rem); margin: 0 auto; padding: 1.25rem 0 4rem; }
.brand-header { padding: 2.4rem 0 2rem; text-align: center; }
.brand-header h1, .paper-card h2, fieldset legend {
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-weight: 600;
  letter-spacing: 0.07em;
}
.brand-header h1 { margin: 0.35rem 0 0.5rem; font-size: clamp(2.2rem, 10vw, 3.8rem); line-height: 1.15; }
.brand-header p:last-child { max-width: 30rem; margin: 0 auto; color: var(--tea); }
.eyebrow, .step-label { color: var(--tea); font-size: 0.72rem; letter-spacing: 0.16em; }

.five-strokes { display: flex; justify-content: center; align-items: flex-end; gap: 0.4rem; height: 2.6rem; }
.five-strokes i { width: 0.33rem; border-radius: 10rem; animation: settle 650ms ease-out both; }
.five-strokes i:nth-child(1) { height: 1.35rem; background: var(--wood); transform: rotate(-9deg); }
.five-strokes i:nth-child(2) { height: 2.1rem; background: var(--fire); transform: rotate(-4deg); animation-delay: 50ms; }
.five-strokes i:nth-child(3) { height: 2.55rem; background: var(--earth); animation-delay: 100ms; }
.five-strokes i:nth-child(4) { height: 1.9rem; background: var(--metal); transform: rotate(4deg); animation-delay: 150ms; }
.five-strokes i:nth-child(5) { height: 1.2rem; background: var(--water); transform: rotate(9deg); animation-delay: 200ms; }

.paper-card {
  padding: clamp(1.25rem, 5vw, 2.4rem);
  border: 1px solid rgba(106, 82, 60, 0.16);
  border-radius: 1.4rem;
  background: rgba(255, 250, 241, 0.88);
  box-shadow: 0 18px 55px rgba(73, 55, 39, 0.1);
}
.paper-card h2 { margin: 0.35rem 0 0.8rem; font-size: clamp(1.55rem, 6vw, 2.1rem); }
.plain-list { padding-left: 1.35rem; color: var(--tea); }

.primary-button, .secondary-button, .text-button {
  min-height: 3.1rem;
  padding: 0.72rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
}
.primary-button { color: #fffdf8; background: var(--jade-dark); box-shadow: 0 9px 22px rgba(47, 82, 71, 0.2); }
.secondary-button { color: var(--jade-dark); border-color: rgba(47, 82, 71, 0.35); background: transparent; }
.text-button { min-height: 2.5rem; color: var(--tea); background: transparent; text-decoration: underline; text-underline-offset: 0.2em; }
button:disabled, [aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.link-button { display: grid; place-items: center; text-decoration: none; }

.progress-row { display: flex; justify-content: space-between; gap: 1rem; color: var(--tea); font-size: 0.9rem; }
.progress-track, .score-track { display: block; height: 0.5rem; overflow: hidden; border-radius: 10rem; background: #e8ddcb; }
.progress-track { margin: 0.55rem 0 2rem; }
#progress-fill { display: block; height: 100%; border-radius: inherit; background: var(--jade); transition: width 220ms ease; }
fieldset { min-width: 0; padding: 0; border: 0; }
fieldset legend { width: 100%; margin-bottom: 1rem; font-size: clamp(1.35rem, 5vw, 1.7rem); line-height: 1.55; }
.option-list { display: grid; gap: 0.65rem; }
.option-card {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.95rem;
  background: rgba(245, 239, 228, 0.62);
  cursor: pointer;
}
.option-card:has(input:checked) { border-color: var(--jade); background: rgba(213, 229, 220, 0.72); }
.option-card input { width: 1.2rem; height: 1.2rem; margin: 0.25rem 0 0; flex: none; accent-color: var(--jade-dark); }
.button-row { display: grid; grid-template-columns: 1fr 1.35fr; gap: 0.75rem; margin-top: 1.4rem; }
.error-text { margin: 1rem 0 0; color: var(--error); font-weight: 700; }

.result-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 1.3rem 0; }
.result-pair div { padding: 1rem; border-radius: 1rem; background: var(--paper); text-align: center; }
.result-pair span { display: block; color: var(--tea); font-size: 0.8rem; }
.result-pair strong { display: block; margin-top: 0.25rem; color: var(--jade-dark); font-family: "Noto Serif TC", serif; font-size: 2rem; }
.result-copy { padding: 1rem 0; border-block: 1px solid var(--line); }
.score-list { display: grid; gap: 0.8rem; margin: 1.4rem 0; }
.score-row > div { display: flex; justify-content: space-between; }
.score-row i { display: block; height: 100%; border-radius: inherit; }
.score-wood i { background: var(--wood); }.score-fire i { background: var(--fire); }.score-earth i { background: var(--earth); }.score-metal i { background: var(--metal); }.score-water i { background: var(--water); }
.boundary-note, .setup-note { color: var(--tea); font-size: 0.9rem; }
.button-stack { display: grid; gap: 0.7rem; margin-top: 1.3rem; }
.setup-note { text-align: center; }

@keyframes settle { from { opacity: 0; transform: translateY(-0.7rem) scaleY(0.35); } }
@media (max-width: 420px) {
  .shell { width: min(100% - 1.2rem, 44rem); }
  .paper-card { border-radius: 1.05rem; }
  .progress-row { font-size: 0.82rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
