:root {
  --ink: #14211d;
  --muted: #69726d;
  --paper: #f4f1e8;
  --surface: #fffdf8;
  --surface-2: #ece8dd;
  --green: #164b3b;
  --green-2: #0d3b2f;
  --mint: #dbe9e0;
  --coral: #e86445;
  --coral-soft: #f8ded5;
  --red: #b54136;
  --shadow: 0 2px 3px rgba(20, 33, 29, 0.04), 0 18px 50px rgba(20, 33, 29, 0.08);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, select, input { font: inherit; }
button { color: inherit; }
button, select { min-height: 44px; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid rgba(232, 100, 69, 0.28); outline-offset: 3px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.setup-shell, .results-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 11px; min-height: 88px; font-size: 18px; font-weight: 800; letter-spacing: 0.08em; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; color: var(--surface); background: var(--green); border-radius: 50%; font-family: Georgia, "Songti SC", serif; font-weight: 700; }
.brand-mark.small { width: 38px; height: 38px; font-size: 16px; }

.hero { padding: 62px 0 58px; border-top: 1px solid rgba(20, 33, 29, 0.12); }
.eyebrow { margin: 0 0 18px; color: var(--coral); font-size: 11px; font-weight: 800; letter-spacing: 0.2em; }
.hero h1, .result-hero h1 { max-width: 850px; margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(44px, 7vw, 82px); font-weight: 500; line-height: 1.06; letter-spacing: -0.045em; text-wrap: balance; }
.hero h1 em { color: var(--green); font-style: italic; }
.hero-copy { max-width: 650px; margin: 26px 0 0; color: var(--muted); font-size: 17px; line-height: 1.8; text-wrap: pretty; }

.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; padding-bottom: 68px; }
.setup-panel, .source-card, .question-card, .question-map, .breakdown-card, .action-card, .review-list { background: var(--surface); box-shadow: var(--shadow); }
.setup-panel { padding: 34px; border-radius: var(--radius-lg); }
.panel-heading, .field-label, .setup-footer, .source-top, .map-heading, .question-meta, .result-heading, .review-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading > div, .field-label { display: flex; align-items: center; gap: 12px; }
.panel-heading h2, .field-label h2 { margin: 0; font-size: 17px; }
.step-number { color: var(--coral); font-family: Georgia, serif; font-size: 13px; font-weight: 700; }
.question-total { padding: 8px 12px; color: var(--green); background: var(--mint); border-radius: 999px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.mode-card { position: relative; display: grid; grid-template-columns: 46px 1fr 16px; gap: 12px; align-items: center; min-height: 88px; padding: 15px; text-align: left; background: #f7f5ef; border: 0; border-radius: var(--radius-md); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(20, 33, 29, 0.08); transition-property: transform, background-color, box-shadow; transition-duration: 160ms; }
.mode-card:hover { background: #fff; box-shadow: inset 0 0 0 1px rgba(22, 75, 59, 0.25), 0 8px 20px rgba(20, 33, 29, 0.06); }
.mode-card:active, .primary-button:active, .secondary-button:active, .submit-button:active, .icon-button:active, .section-chip:active, .option:active, .number-button:active { transform: scale(0.96); }
.mode-card.is-selected { background: var(--green); color: white; box-shadow: 0 12px 25px rgba(22, 75, 59, 0.18); }
.mode-card strong, .mode-card small { display: block; }
.mode-card strong { margin-bottom: 5px; font-size: 14px; }
.mode-card small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.mode-card.is-selected small { color: rgba(255, 255, 255, 0.68); }
.mode-icon { display: grid; width: 46px; height: 46px; place-items: center; color: var(--green); background: var(--mint); border-radius: 12px; font-family: Georgia, "Songti SC", serif; font-weight: 800; }
.mode-card i { width: 16px; height: 16px; border: 2px solid rgba(20, 33, 29, 0.22); border-radius: 50%; }
.mode-card.is-selected i { border: 5px solid white; }

.field-group { margin-top: 34px; }
.text-button { min-height: 40px; margin-left: auto; padding: 0; color: var(--green); background: transparent; border: 0; cursor: pointer; font-size: 12px; font-weight: 700; }
.section-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.section-chip { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; gap: 1px 10px; align-items: center; min-height: 68px; padding: 10px 12px; text-align: left; background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(20, 33, 29, 0.1); transition-property: transform, background-color, box-shadow; transition-duration: 160ms; }
.section-chip > span { grid-row: 1 / 3; display: grid; width: 34px; height: 34px; place-items: center; color: var(--green); background: var(--mint); border-radius: 9px; font-size: 11px; font-weight: 800; }
.section-chip strong { overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.section-chip small { color: var(--muted); font-size: 10px; }
.section-chip.is-selected { background: #eff5f0; box-shadow: inset 0 0 0 2px var(--green); }
.section-chip.is-selected > span { color: white; background: var(--green); }

.setup-footer { flex-wrap: wrap; margin-top: 30px; padding-top: 26px; border-top: 1px solid rgba(20, 33, 29, 0.1); }
.count-picker { display: flex; align-items: center; gap: 10px; }
.count-picker label, .switch-row { color: var(--muted); font-size: 12px; font-weight: 700; }
.count-picker select { padding: 0 34px 0 12px; color: var(--ink); background: #f3f0e7; border: 0; border-radius: 10px; cursor: pointer; }
.switch-row { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 42px; height: 24px; background: #d5d3ca; border-radius: 999px; transition-property: background-color; transition-duration: 160ms; }
.switch i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: white; border-radius: 50%; box-shadow: 0 2px 5px rgba(20, 33, 29, 0.2); transition-property: transform; transition-duration: 160ms; }
.switch-row input:checked + .switch { background: var(--green); }
.switch-row input:checked + .switch i { transform: translateX(18px); }

.primary-button, .secondary-button, .submit-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 20px; border: 0; border-radius: 12px; cursor: pointer; font-size: 13px; font-weight: 800; transition-property: transform, background-color, box-shadow; transition-duration: 160ms; }
.primary-button { min-height: 48px; color: white; background: var(--coral); box-shadow: 0 10px 22px rgba(232, 100, 69, 0.22); }
.primary-button:hover { background: #d95739; }
.primary-button svg { width: 17px; }
.primary-button.compact { min-width: 140px; }
.secondary-button { color: var(--green); background: var(--mint); }
.secondary-button:hover { background: #cfe0d5; }
.secondary-button:disabled { opacity: 0.4; cursor: not-allowed; }
.setup-error { min-height: 18px; margin: 12px 0 0; color: var(--red); font-size: 12px; text-align: right; }
.resume-button { display: grid; grid-template-columns: 38px 1fr 20px; gap: 12px; align-items: center; width: 100%; margin-top: 8px; padding: 12px 14px; text-align: left; color: var(--green); background: var(--mint); border: 0; border-radius: 14px; cursor: pointer; }
.resume-button > span:first-child { display: grid; width: 38px; height: 38px; place-items: center; background: rgba(255, 255, 255, 0.6); border-radius: 10px; }
.resume-button strong, .resume-button small { display: block; }
.resume-button strong { font-size: 13px; }
.resume-button small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.source-card { padding: 22px; border-radius: var(--radius-lg); }
.source-top { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.document-preview { position: relative; overflow: hidden; height: 255px; margin: 18px 0; padding: 32px 25px; color: white; background: var(--green); border-radius: var(--radius-md); }
.document-preview::after { content: "100"; position: absolute; right: -6px; bottom: -42px; color: rgba(255, 255, 255, 0.06); font-family: Georgia, serif; font-size: 150px; line-height: 1; }
.document-preview strong { position: relative; z-index: 1; display: block; font-family: Georgia, "Songti SC", serif; font-size: 40px; font-weight: 500; line-height: 1.18; }
.document-preview small { position: absolute; bottom: 28px; left: 25px; color: rgba(255, 255, 255, 0.64); font-size: 9px; font-weight: 800; letter-spacing: 0.2em; }
.paper-lines { position: absolute; top: 0; right: 24px; width: 1px; height: 100%; background: rgba(255, 255, 255, 0.1); box-shadow: 8px 0 rgba(255, 255, 255, 0.06), 16px 0 rgba(255, 255, 255, 0.03); }
.source-card > p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.source-note { display: flex; gap: 9px; margin-top: 16px; padding: 12px; color: #715449; background: var(--coral-soft); border-radius: 12px; font-size: 10px; line-height: 1.6; }
.source-note span { display: grid; flex: 0 0 auto; width: 18px; height: 18px; place-items: center; color: white; background: var(--coral); border-radius: 50%; font-family: Georgia, serif; font-weight: 800; }
.site-footer { padding: 28px 20px; color: var(--muted); border-top: 1px solid rgba(20, 33, 29, 0.1); text-align: center; font-size: 11px; letter-spacing: 0.1em; }

.reveal-1, .reveal-2, .reveal-3 { animation: reveal 500ms cubic-bezier(0.2, 0, 0, 1) both; }
.reveal-2 { animation-delay: 80ms; }
.reveal-3 { animation-delay: 160ms; }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.quiz-shell { min-height: 100vh; }
.quiz-header { position: sticky; z-index: 10; top: 0; display: grid; grid-template-columns: 52px 1fr minmax(150px, 320px) 84px; gap: 16px; align-items: center; min-height: 78px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); background: rgba(244, 241, 232, 0.93); box-shadow: 0 1px rgba(20, 33, 29, 0.1); backdrop-filter: blur(14px); }
.icon-button { display: grid; width: 44px; height: 44px; place-items: center; background: transparent; border: 0; border-radius: 50%; cursor: pointer; transition-property: transform, background-color; transition-duration: 160ms; }
.icon-button:hover { background: var(--surface-2); }
.quiz-brand { display: flex; align-items: center; gap: 10px; }
.quiz-brand strong, .quiz-brand small { display: block; }
.quiz-brand strong { font-size: 14px; }
.quiz-brand small { margin-top: 1px; color: var(--muted); font-size: 9px; }
.header-progress { display: grid; grid-template-columns: 62px 1fr; gap: 10px; align-items: center; }
.header-progress span { color: var(--muted); font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; }
.header-progress b { color: var(--ink); }
.header-progress > div { overflow: hidden; height: 5px; background: #dcd8cd; border-radius: 999px; }
.header-progress i { display: block; height: 100%; background: var(--coral); border-radius: inherit; transition-property: width; transition-duration: 260ms; }
.submit-button { min-height: 42px; color: white; background: var(--green); }

.quiz-layout { display: grid; grid-template-columns: 250px minmax(0, 760px); gap: 42px; justify-content: center; width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }
.question-map { position: sticky; top: 112px; align-self: start; padding: 20px; border-radius: var(--radius-md); }
.map-heading { padding-bottom: 14px; border-bottom: 1px solid rgba(20, 33, 29, 0.1); }
.map-heading span { font-size: 13px; font-weight: 800; }
.map-heading small { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.number-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 16px; max-height: 375px; overflow: auto; }
.number-button { min-width: 0; min-height: 36px; padding: 0; color: var(--muted); background: #f2efe7; border: 0; border-radius: 8px; cursor: pointer; font-size: 10px; font-variant-numeric: tabular-nums; transition-property: transform, color, background-color; transition-duration: 140ms; }
.number-button.is-answered { color: var(--green); background: var(--mint); font-weight: 800; }
.number-button.is-current { color: white; background: var(--coral); font-weight: 800; }
.map-key { display: flex; gap: 16px; margin-top: 18px; color: var(--muted); font-size: 9px; }
.map-key span { display: flex; align-items: center; gap: 5px; }
.map-key i { display: block; width: 8px; height: 8px; background: #ddd9ce; border-radius: 50%; }
.map-key .answered-dot { background: var(--mint); box-shadow: inset 0 0 0 2px var(--green); }

.question-stage { min-width: 0; }
.question-meta { margin-bottom: 14px; }
.section-tag { padding: 7px 11px; color: var(--green); background: var(--mint); border-radius: 999px; font-size: 10px; font-weight: 800; }
.question-index { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.question-index b { color: var(--ink); font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.question-card { min-height: 500px; padding: clamp(28px, 5vw, 52px); border-radius: var(--radius-lg); }
.type-label { margin: 0 0 14px; color: var(--coral); font-size: 10px; font-weight: 800; letter-spacing: 0.12em; }
.question-card h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(22px, 3vw, 31px); font-weight: 600; line-height: 1.5; letter-spacing: -0.015em; text-wrap: pretty; }
.options { display: grid; gap: 11px; margin-top: 34px; }
.option { display: grid; grid-template-columns: 42px 1fr 24px; gap: 14px; align-items: center; min-height: 62px; padding: 10px 16px 10px 10px; text-align: left; background: #f6f3eb; border: 0; border-radius: 14px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(20, 33, 29, 0.08); transition-property: transform, background-color, box-shadow; transition-duration: 160ms; }
.option:hover:not(:disabled) { background: white; box-shadow: inset 0 0 0 1px rgba(22, 75, 59, 0.28), 0 6px 16px rgba(20, 33, 29, 0.06); }
.option-key { display: grid; width: 42px; height: 42px; place-items: center; color: var(--green); background: white; border-radius: 10px; font-family: Georgia, serif; font-weight: 700; box-shadow: 0 3px 10px rgba(20, 33, 29, 0.07); }
.option > span:nth-child(2) { font-size: 14px; line-height: 1.55; }
.option > i { display: none; color: white; }
.option.is-selected { background: var(--mint); box-shadow: inset 0 0 0 2px var(--green); }
.option.is-selected .option-key { color: white; background: var(--green); }
.option.is-correct { background: #deeee4; box-shadow: inset 0 0 0 2px #2d7b57; }
.option.is-correct > i, .option.is-wrong > i { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; }
.option.is-correct > i { background: #2d7b57; }
.option.is-wrong { background: #f8e2dc; box-shadow: inset 0 0 0 2px var(--red); }
.option.is-wrong .option-key { background: var(--red); }
.option.is-wrong > i { background: var(--red); }
.option > i svg { width: 14px; height: 14px; }
.feedback { display: flex; gap: 12px; margin-top: 20px; padding: 16px; border-radius: 14px; }
.feedback > span { display: grid; flex: 0 0 auto; width: 32px; height: 32px; place-items: center; color: white; border-radius: 50%; }
.feedback > span svg { width: 17px; }
.feedback strong { font-size: 13px; }
.feedback p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.feedback.correct { background: #e7f1e9; }
.feedback.correct > span { background: #2d7b57; }
.feedback.wrong { background: var(--coral-soft); }
.feedback.wrong > span { background: var(--red); }
.question-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }

.results-header { display: flex; align-items: center; justify-content: space-between; min-height: 90px; border-bottom: 1px solid rgba(20, 33, 29, 0.1); }
.results-header .brand { min-height: auto; }
.result-hero { display: grid; grid-template-columns: 220px 1fr; gap: 60px; align-items: center; padding: 72px 0; }
.result-hero h1 { font-size: clamp(38px, 6vw, 68px); }
.result-hero > div:last-child > p:last-child { max-width: 630px; color: var(--muted); line-height: 1.8; }
.score-ring { position: relative; display: grid; width: 210px; height: 210px; place-items: center; background: conic-gradient(var(--coral) var(--score), #dedacf 0); border-radius: 50%; transform: rotate(-90deg); }
.score-ring::before { content: ""; position: absolute; width: 170px; height: 170px; background: var(--paper); border-radius: 50%; }
.score-ring div { position: relative; z-index: 1; display: flex; align-items: baseline; transform: rotate(90deg); }
.score-ring strong { font-family: Georgia, serif; font-size: 64px; font-weight: 500; font-variant-numeric: tabular-nums; }
.score-ring span { color: var(--muted); font-size: 14px; }
.result-grid { display: grid; grid-template-columns: 1fr 310px; gap: 24px; }
.breakdown-card, .action-card { padding: 28px; border-radius: var(--radius-lg); }
.result-heading { padding-bottom: 18px; border-bottom: 1px solid rgba(20, 33, 29, 0.1); }
.result-heading span { font-weight: 800; }
.result-heading small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.breakdown-row { margin-top: 18px; }
.breakdown-row > div:first-child { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; font-size: 12px; }
.breakdown-row b { font-variant-numeric: tabular-nums; }
.breakdown-bar { overflow: hidden; height: 7px; background: #ece8de; border-radius: 999px; }
.breakdown-bar i { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.action-card { display: flex; flex-direction: column; align-items: flex-start; color: white; background: var(--green); }
.action-card > span { display: grid; width: 44px; height: 44px; place-items: center; background: rgba(255, 255, 255, 0.12); border-radius: 12px; }
.action-card h2 { margin: 48px 0 8px; font-family: Georgia, "Songti SC", serif; font-size: 28px; font-weight: 500; }
.action-card p { margin: 0 0 24px; color: rgba(255, 255, 255, 0.66); font-size: 12px; line-height: 1.7; }
.action-card .primary-button { margin-top: auto; }
.review-section { padding: 74px 0 90px; }
.review-title h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 38px; font-weight: 500; }
.review-title > span { display: grid; width: 52px; height: 52px; place-items: center; color: var(--coral); background: var(--coral-soft); border-radius: 50%; font-weight: 800; font-variant-numeric: tabular-nums; }
.review-list { margin-top: 24px; padding: 8px 28px; border-radius: var(--radius-lg); }
.review-item { display: grid; grid-template-columns: 45px 1fr; gap: 18px; padding: 26px 0; border-bottom: 1px solid rgba(20, 33, 29, 0.1); }
.review-item:last-child { border-bottom: 0; }
.review-number { font-family: Georgia, serif; color: var(--coral); font-size: 18px; font-variant-numeric: tabular-nums; }
.review-item small { color: var(--muted); font-size: 10px; }
.review-item h3 { margin: 7px 0 14px; font-family: Georgia, "Songti SC", serif; font-size: 18px; line-height: 1.6; }
.review-item p { margin: 5px 0; font-size: 12px; line-height: 1.6; }
.your-answer { color: var(--red); }
.right-answer { color: #26704e; }
.perfect-state { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 180px; margin-top: 24px; color: var(--green); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.perfect-state svg { width: 28px; height: 28px; }

@media (max-width: 900px) {
  .setup-grid { grid-template-columns: 1fr; }
  .source-card { display: grid; grid-template-columns: 1fr 170px; column-gap: 24px; }
  .source-top { grid-column: 1 / 3; }
  .document-preview { grid-row: 2 / 5; grid-column: 2; height: 210px; }
  .quiz-layout { grid-template-columns: 1fr; }
  .question-map { position: static; order: 2; }
  .number-grid { grid-template-columns: repeat(10, 1fr); max-height: none; }
  .result-grid { grid-template-columns: 1fr; }
  .action-card h2 { margin-top: 30px; }
}

@media (max-width: 640px) {
  .setup-shell, .results-shell, .quiz-layout { width: min(100% - 24px, 1180px); }
  .brand { min-height: 72px; }
  .hero { padding: 40px 0; }
  .hero h1 { font-size: 43px; }
  .hero-copy { font-size: 14px; }
  .setup-panel { padding: 20px; border-radius: 20px; }
  .mode-grid { grid-template-columns: 1fr; }
  .section-grid { grid-template-columns: 1fr 1fr; }
  .section-chip { grid-template-columns: 30px 1fr; padding: 8px; }
  .section-chip > span { width: 30px; height: 30px; }
  .setup-footer { align-items: stretch; }
  .setup-footer .primary-button { width: 100%; }
  .source-card { display: block; }
  .document-preview { height: 210px; }
  .quiz-header { grid-template-columns: 44px 1fr 72px; gap: 8px; min-height: 68px; padding: 0 12px; }
  .quiz-brand .brand-mark { display: none; }
  .header-progress { position: absolute; right: 12px; bottom: -8px; left: 12px; grid-template-columns: 1fr; }
  .header-progress span { display: none; }
  .question-card { min-height: 0; padding: 24px 18px; border-radius: 20px; }
  .question-card h1 { font-size: 21px; }
  .option { grid-template-columns: 38px 1fr 22px; gap: 10px; padding-right: 10px; }
  .option-key { width: 38px; height: 38px; }
  .question-nav { flex-wrap: wrap; }
  .question-nav .primary-button, .question-nav .secondary-button { flex: 1; padding: 0 10px; }
  .number-grid { grid-template-columns: repeat(5, 1fr); }
  .result-hero { grid-template-columns: 1fr; gap: 35px; padding: 48px 0; text-align: center; }
  .score-ring { width: 170px; height: 170px; margin: 0 auto; }
  .score-ring::before { width: 138px; height: 138px; }
  .score-ring strong { font-size: 54px; }
  .review-list { padding: 6px 18px; }
  .review-item { grid-template-columns: 32px 1fr; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
