:root {
  --ink: #172d2a;
  --ink-soft: #52635e;
  --jade: #183a36;
  --jade-light: #2f5a52;
  --cinnabar: #a7352b;
  --cinnabar-dark: #7f241e;
  --paper: #f7f0df;
  --paper-deep: #ede1c8;
  --gold: #ba8d47;
  --line: rgba(44, 57, 50, 0.18);
  --shadow: 0 24px 60px rgba(34, 41, 35, 0.12);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: #dcd2bd;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 16px;
  line-height: 1.65;
  background:
    radial-gradient(circle at 9% 14%, rgba(24, 58, 54, 0.11), transparent 24rem),
    radial-gradient(circle at 91% 74%, rgba(167, 53, 43, 0.08), transparent 28rem),
    #dcd2bd;
}

button, a { font: inherit; }

button { color: inherit; }

button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(167, 53, 43, 0.42);
  outline-offset: 3px;
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  overflow: hidden;
  border: 1px solid rgba(72, 58, 40, 0.25);
  background:
    linear-gradient(rgba(122, 94, 50, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 94, 50, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  box-shadow: var(--shadow);
  position: relative;
}

.page-shell::before,
.page-shell::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.page-shell::before {
  width: 340px;
  height: 340px;
  right: -170px;
  top: 130px;
  border: 1px solid rgba(24, 58, 54, 0.11);
  border-radius: 50%;
  box-shadow: 0 0 0 54px rgba(24, 58, 54, 0.025), 0 0 0 110px rgba(24, 58, 54, 0.02);
}

.page-shell::after {
  width: 220px;
  height: 220px;
  left: -110px;
  bottom: 240px;
  background: radial-gradient(circle, rgba(167, 53, 43, 0.08), transparent 66%);
}

.site-header,
main,
footer { position: relative; z-index: 1; }

.site-header {
  height: 82px;
  padding: 0 clamp(24px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-seal {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff8e9;
  background: var(--cinnabar);
  border-radius: 4px 8px 5px 7px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 24px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.26);
  transform: rotate(-2deg);
}

.brand strong,
.brand small { display: block; }

.brand strong {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 21px;
  letter-spacing: 0.12em;
  line-height: 1.1;
}

.brand small {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.16em;
}

.header-note {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.brush-dot {
  width: 8px;
  height: 8px;
  border-radius: 50% 45% 55% 48%;
  background: var(--cinnabar);
}

main {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.intro {
  min-height: 300px;
  padding: 54px 0 42px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 64px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--cinnabar);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eyebrow span + span::before {
  content: "";
  display: inline-block;
  width: 34px;
  height: 1px;
  margin-right: 12px;
  vertical-align: middle;
  background: var(--gold);
}

.intro h1 {
  max-width: 720px;
  margin: 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(42px, 5.3vw, 76px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0.04em;
}

.intro h1 em {
  color: var(--jade);
  font-style: normal;
}

.intro-text {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-size: 17px;
}

.intro-verse {
  width: 90px;
  height: 190px;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(24, 58, 54, 0.18);
  background: rgba(255, 253, 246, 0.48);
  box-shadow: 12px 12px 0 rgba(24, 58, 54, 0.045);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 22px;
}

.intro-verse i {
  width: 1px;
  height: 18px;
  background: var(--gold);
}

.learning-map,
.trial {
  border: 1px solid rgba(52, 61, 52, 0.2);
  background: rgba(255, 253, 247, 0.72);
  box-shadow: 0 20px 50px rgba(47, 42, 30, 0.08);
}

.section-heading {
  min-height: 112px;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2,
.trial h2 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(29px, 3vw, 38px);
  font-weight: 500;
  letter-spacing: 0.06em;
}

.section-heading .section-kicker { margin-bottom: 5px; }

#selection-summary {
  margin: 0;
  padding: 8px 14px;
  color: var(--jade);
  border: 1px solid rgba(24, 58, 54, 0.22);
  background: rgba(24, 58, 54, 0.045);
  font-size: 14px;
}

.stage-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.stage-tab {
  min-height: 112px;
  padding: 22px 26px;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 16px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, transform .2s ease;
}

.stage-tab:last-child { border-right: 0; }

.stage-tab:hover { background: rgba(24, 58, 54, 0.055); }

.stage-tab.is-active {
  color: #fffaf0;
  background: var(--jade);
}

.stage-tab.is-active .stage-mark {
  color: #fffaf0;
  border-color: rgba(255,255,255,.45);
}

.stage-tab.is-active small { color: rgba(255,255,255,.68); }

.stage-tab strong,
.stage-tab small { display: block; }

.stage-tab strong {
  font-size: 20px;
  letter-spacing: 0.08em;
}

.stage-tab small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 13px;
}

.stage-tab b {
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 400;
  opacity: .42;
}

.stage-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(167, 53, 43, .4);
  color: var(--cinnabar);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 21px;
  transform: rotate(-2deg);
}

.grade-panel {
  display: grid;
  grid-template-columns: 35% 65%;
  min-height: 320px;
}

.stage-overview {
  position: relative;
  overflow: hidden;
  padding: 38px 34px;
  color: #f8f2e5;
  background: var(--jade-light);
}

.overview-number {
  position: absolute;
  right: -8px;
  bottom: -30px;
  color: rgba(255,255,255,.07);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 116px;
  line-height: 1;
  white-space: nowrap;
}

.stage-overview .section-kicker { color: #e2bd78; }

.stage-overview h3 {
  margin: 0 0 15px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 40px;
  font-weight: 400;
}

.stage-overview > p:not(.section-kicker):not(.overview-tip) {
  max-width: 290px;
  margin: 0;
  color: rgba(255,255,255,.78);
}

.ink-rule {
  width: 100%;
  height: 1px;
  margin: 30px 0 18px;
  background: rgba(255,255,255,.16);
}

.ink-rule span {
  display: block;
  width: 36%;
  height: 1px;
  background: #dbb76f;
}

.overview-tip {
  margin: 0;
  color: rgba(255,255,255,.58);
  font-size: 14px;
}

.grade-choice { padding: 36px; }

.grade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.grade-button {
  min-height: 102px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(247, 240, 223, .48);
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: border-color .2s ease, transform .2s ease, background .2s ease, box-shadow .2s ease;
}

.grade-button::after {
  content: "入";
  position: absolute;
  right: 12px;
  bottom: -12px;
  color: rgba(167, 53, 43, .055);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 62px;
}

.grade-button:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 53, 43, .42);
  box-shadow: 0 8px 18px rgba(64, 51, 33, .08);
}

.grade-button.is-selected {
  border-color: var(--cinnabar);
  background: rgba(167, 53, 43, .075);
  box-shadow: inset 4px 0 0 var(--cinnabar);
}

.grade-button strong,
.grade-button small { display: block; position: relative; z-index: 1; }

.grade-button strong {
  margin-bottom: 6px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 23px;
  font-weight: 500;
}

.grade-button small {
  color: var(--ink-soft);
  font-size: 13px;
}

.trial {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 38% 62%;
}

.trial-copy {
  padding: 42px 38px;
  border-right: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(186,141,71,.12), transparent 62%);
}

.trial-copy > p:not(.section-kicker) {
  margin: 16px 0 28px;
  color: var(--ink-soft);
}

.trial-copy small { color: var(--ink-soft); font-size: 13px; }

.progress-line {
  height: 5px;
  margin-bottom: 10px;
  overflow: hidden;
  background: rgba(24, 58, 54, .1);
}

.progress-line span {
  display: block;
  height: 100%;
  background: var(--cinnabar);
}

.question-card { padding: 34px 40px 38px; }

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  color: var(--cinnabar);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .12em;
}

.question-seal {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--cinnabar);
  border: 2px solid currentColor;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 18px;
  transform: rotate(4deg);
}

.question-card h3 {
  margin: 0 0 24px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(24px, 2.7vw, 32px);
  font-weight: 500;
}

.answer-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.answer-button {
  min-height: 54px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  background: #fffdf7;
  cursor: pointer;
  text-align: left;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.answer-button:hover:not(:disabled) {
  border-color: var(--jade-light);
  background: rgba(24,58,54,.055);
}

.answer-button.is-correct {
  border-color: var(--jade-light);
  color: #fff;
  background: var(--jade-light);
}

.answer-button.is-wrong {
  border-color: var(--cinnabar);
  color: var(--cinnabar-dark);
  background: rgba(167,53,43,.08);
}

.feedback {
  min-height: 26px;
  margin: 16px 0 0;
  color: var(--jade);
  font-weight: 700;
}

.reset-button {
  padding: 8px 0 2px;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--cinnabar);
  background: transparent;
  cursor: pointer;
}

.reset-button[hidden] { display: none; }

footer {
  min-height: 112px;
  margin-top: 52px;
  padding: 30px clamp(24px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: rgba(255,255,255,.7);
  background: var(--ink);
  font-size: 14px;
}

footer span { color: #f2d9a8; letter-spacing: .12em; }
footer p { margin: 0; }

@media (max-width: 860px) {
  .stage-tab { grid-template-columns: 42px 1fr; padding: 20px; }
  .stage-tab b { display: none; }
  .grade-panel { grid-template-columns: 1fr; }
  .stage-overview { min-height: 245px; }
  .trial { grid-template-columns: 1fr; }
  .trial-copy { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .page-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border: 0;
  }
  .site-header { height: 72px; padding: 0 18px; }
  .header-note { display: none; }
  main { width: min(100% - 28px, 1180px); }
  .intro { min-height: 0; padding: 42px 4px 34px; grid-template-columns: 1fr; }
  .intro h1 { font-size: clamp(39px, 12vw, 58px); }
  .intro-text { font-size: 16px; }
  .intro-verse { display: none; }
  .section-heading { padding: 22px 20px; align-items: flex-start; flex-direction: column; gap: 12px; }
  .stage-tabs { grid-template-columns: 1fr; }
  .stage-tab { min-height: 86px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-tab:last-child { border-bottom: 0; }
  .stage-tab b { display: block; }
  .stage-overview { min-height: 232px; padding: 30px 24px; }
  .grade-choice { padding: 28px 20px; }
  .grade-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grade-button { min-height: 92px; padding: 15px; }
  .trial { margin-top: 18px; }
  .trial-copy, .question-card { padding: 30px 22px; }
  .answer-list { grid-template-columns: 1fr; }
  footer { margin-top: 36px; flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
