:root {
  --paper: #f3efe6;
  --paper-2: #fffdf8;
  --ink: #1b2430;
  --muted: #5c6570;
  --line: #e4d9c8;
  --teal: #0f5e57;
  --teal-2: #18786f;
  --teal-soft: #e5f3f1;
  --gold: #8d6230;
  --gold-soft: #f8efdf;
  --rust: #8e3d32;
  --rust-soft: #f8e8e4;
  --shadow: 0 16px 40px rgba(48, 36, 18, 0.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "PMingLiU", serif;
  --sans: "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  background:
    radial-gradient(1100px 480px at 0% -10%, #e4f2ef 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #f7ead3 0%, transparent 50%),
    var(--paper);
}
a { color: var(--teal); }
img { max-width: 100%; }
button, input { font-family: inherit; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--ink);
  color: white;
  padding: 8px 12px;
  z-index: 20;
}
.skip:focus { top: 12px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 7vw;
  background: rgba(243, 239, 230, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(228, 217, 200, 0.9);
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
}
.mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--teal);
  color: #f4efe6;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 700;
}
.topbar nav { display: flex; gap: 18px; align-items: center; }
.topbar nav a { text-decoration: none; color: var(--ink); font-size: 15px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--teal);
  color: #f7f4ee;
  font-weight: 650;
}
.btn.secondary { background: transparent; color: var(--teal); border: 1px solid var(--teal); }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 42px;
  align-items: center;
  padding: 54px 7vw 20px;
}
.kicker {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 8px;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 650; line-height: 1.25; letter-spacing: -0.02em; }
h1 { font-size: clamp(36px, 5vw, 62px); margin: 0 0 12px; }
h2 { font-size: clamp(28px, 3vw, 40px); margin: 0 0 10px; }
h3 { font-size: 22px; margin: 0 0 8px; }
.lede { font-size: 19px; color: #243040; max-width: 68ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.meta-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 22px; color: var(--muted); font-size: 14px; }
.meta-row strong { color: var(--ink); display: block; font-size: 15px; }

.hero-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.groove {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.groove button {
  border: 1px solid var(--line);
  background: #f7f3ea;
  border-radius: 16px;
  min-height: 92px;
  cursor: pointer;
  color: var(--ink);
}
.groove button strong { display: block; font-family: var(--serif); font-size: 22px; color: var(--teal); }
.groove button small { color: var(--muted); }
.groove button.active { background: var(--teal); color: white; border-color: var(--teal); }
.groove button.active strong, .groove button.active small { color: white; }
.pocket-copy { min-height: 92px; margin: 14px 4px 4px; font-size: 15px; }

.wrap { padding: 10px 7vw 70px; }
.phase {
  margin: 34px 0 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.phase span { color: var(--gold); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; }

.step {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  margin: 18px 0;
}
.num {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: white;
  font-family: var(--serif);
  font-size: 20px;
}
.panel {
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 24px 8px;
  box-shadow: var(--shadow);
}
.panel p { margin-top: 0; }
.grid-2, .grid-3 { display: grid; gap: 12px; margin: 8px 0 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.tile {
  background: #f7f4ee;
  border-radius: 16px;
  padding: 14px 14px 12px;
  border: 1px solid #efe6d8;
}
.tile b { display: block; margin-bottom: 4px; }
.callout {
  border-left: 4px solid var(--teal);
  background: var(--teal-soft);
  border-radius: 0 16px 16px 0;
  padding: 12px 14px;
  margin: 6px 0 18px;
}
.callout.gold { border-color: var(--gold); background: var(--gold-soft); }
.callout.rust { border-color: var(--rust); background: var(--rust-soft); }

table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 6px 0 18px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 650; }
.bars { display: grid; gap: 8px; margin: 8px 0 18px; }
.bar-row { display: grid; grid-template-columns: 210px 1fr 72px; gap: 8px; align-items: center; font-size: 14px; }
.track { height: 12px; background: #efe6d8; border-radius: 99px; overflow: hidden; }
.track span { display: block; height: 100%; background: linear-gradient(90deg, #c4a15a, var(--teal)); border-radius: 99px; }
.kd { font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; }

.sym-lab { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.sym-card { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: #fff; }
.sites { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; transition: transform .45s ease; }
.sites div { background: var(--teal-soft); border-radius: 12px; text-align: center; padding: 10px 4px; font-size: 13px; }
.sites div em { display: block; font-style: normal; color: var(--gold); font-weight: 700; }
.sites.flipped { transform: rotate(180deg); }
.sites.flipped div { transform: rotate(180deg); }
.sym-card p { min-height: 72px; font-size: 15px; }

.checklist { list-style: none; padding: 0; margin: 0 0 18px; }
.checklist li { margin: 6px 0; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.flow div { background: white; border: 1px dashed #d9cbb6; border-radius: 14px; padding: 10px; font-size: 14px; }
.flow strong { color: var(--teal); }

.refs { font-size: 14px; color: var(--muted); }
.refs li { margin: 6px 0; }
footer { padding: 10px 7vw 40px; color: var(--muted); font-size: 14px; }

.quiz-shell { padding: 28px 7vw 64px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 18px; }
.stats div { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; min-width: 120px; }
.stats b { display: block; font-family: var(--serif); font-size: 24px; }
.map { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.gate {
  text-align: left;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: white;
  padding: 12px;
  cursor: pointer;
  color: var(--ink);
  min-height: 112px;
}
.gate small { color: var(--muted); display: block; }
.gate.locked { opacity: 0.55; }
.gate.cleared { border-color: var(--teal); background: var(--teal-soft); }
.gate.current { outline: 2px solid var(--gold); }
.qcard { margin-top: 16px; background: white; border: 1px solid var(--line); border-radius: 24px; padding: 20px; box-shadow: var(--shadow); }
.options { display: grid; gap: 8px; margin: 12px 0; }
.options button { text-align: left; border-radius: 14px; border: 1px solid var(--line); background: #fffdf8; padding: 10px 12px; cursor: pointer; color: var(--ink); }
.options button:hover:not(:disabled) { border-color: var(--teal); }
.options button.right { background: var(--teal-soft); border-color: var(--teal); }
.options button.wrong { background: var(--rust-soft); border-color: var(--rust); }
.why { background: var(--gold-soft); border-radius: 14px; padding: 10px 12px; }
.q-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.progress-pips { display: flex; gap: 6px; }
.progress-pips i { width: 28px; height: 8px; border-radius: 99px; background: #e6dccb; display: block; }
.progress-pips i.on { background: var(--teal); }

@media (max-width: 980px) {
  .hero, .step, .grid-2, .grid-3, .sym-lab, .flow, .map { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr; }
  .topbar { padding: 12px 18px; }
  .hero, .wrap, .quiz-shell, footer { padding-left: 18px; padding-right: 18px; }
  .map { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sites, .sites div { transition: none; }
}
