:root {
  --paper: #f8f7f1;
  --ink: #1d1d1f;
  --muted: #6b665f;
  --line: #1b1a17;
  --soft-line: rgba(29, 29, 31, 0.18);
  --red: #b4191f;
  --red-soft: rgba(180, 25, 31, 0.12);
  --shadow: rgba(35, 31, 24, 0.18);
  --choice: #fffef9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  background:
    linear-gradient(rgba(22, 21, 18, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 21, 18, 0.04) 1px, transparent 1px),
    #dedbd0;
  background-size: 28px 28px;
}

button,
a {
  font: inherit;
}

.exam-shell {
  width: min(980px, calc(100% - 28px));
  margin: 24px auto;
}

.paper {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 48px);
  padding: clamp(18px, 3vw, 34px);
  background:
    radial-gradient(circle at 18% 12%, rgba(180, 25, 31, 0.08), transparent 28%),
    linear-gradient(90deg, rgba(29, 29, 31, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 34px 34px, auto;
  border: 2px solid var(--line);
  box-shadow: 10px 12px 0 var(--shadow);
}

.paper::before {
  content: "";
  position: absolute;
  inset: 12px;
  pointer-events: none;
  border: 1px solid rgba(29, 29, 31, 0.2);
}

.exam-header,
.result-header {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 3px double var(--line);
  padding-bottom: 18px;
}

.exam-header {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
  align-items: stretch;
}

.answer-card-head {
  display: grid;
  align-content: start;
}

.kicker {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 6vw, 58px);
  line-height: 1.05;
  letter-spacing: 0;
  white-space: nowrap;
}

.candidate-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-width: 560px;
}

.candidate-number,
.form-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 76px minmax(72px, 0.55fr);
  align-items: end;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
}

.candidate-number {
  grid-template-columns: 78px minmax(0, 1fr);
}

.compact-form-row {
  grid-template-columns: 78px minmax(80px, 0.42fr) 76px minmax(90px, 0.58fr);
}

.candidate-number span,
.form-row span {
  white-space: nowrap;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(22px, 1fr));
  height: 32px;
  border-top: 2px solid var(--line);
  border-left: 2px solid var(--line);
  background: rgba(255, 253, 245, 0.72);
}

.number-grid i {
  display: grid;
  place-items: center;
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  font-style: normal;
  font-size: 15px;
  line-height: 1;
}

.form-row b {
  min-height: 24px;
  padding: 0 6px 2px;
  border-bottom: 3px solid var(--line);
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.exam-notice {
  border: 2px solid var(--line);
  background: rgba(255, 253, 245, 0.7);
}

.exam-notice h2 {
  margin: 0;
  padding: 6px 10px;
  border-bottom: 2px solid var(--line);
  font-size: 20px;
  line-height: 1.2;
  text-align: center;
}

.exam-notice ol {
  margin: 0;
  padding: 9px 13px 9px 29px;
  font-size: 12px;
  line-height: 1.38;
}

.exam-notice li + li {
  margin-top: 3px;
}

.candidate-box {
  min-width: 170px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  background: #fffdf5;
  text-align: center;
}

.candidate-box span,
.score-stamp span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.candidate-box strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  letter-spacing: 0.04em;
}

.question-card {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  padding: clamp(16px, 3vw, 28px);
  border: 2px solid var(--line);
  background: rgba(255, 254, 249, 0.78);
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  font-weight: 800;
  color: var(--red);
}

.question-text {
  margin-bottom: 22px;
  font-size: clamp(18px, 2.5vw, 24px);
  line-height: 1.65;
}

.options {
  display: grid;
  gap: 12px;
}

.option {
  width: 100%;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: stretch;
  min-height: 64px;
  border: 2px solid var(--line);
  background: var(--choice);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.option:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--shadow);
}

.option.selected {
  background: var(--red-soft);
  box-shadow: inset 0 0 0 3px var(--red);
}

.option-letter {
  display: grid;
  place-items: center;
  border-right: 2px solid var(--line);
  font-size: 24px;
  font-weight: 900;
}

.option-text {
  padding: 14px 16px;
  line-height: 1.45;
  font-size: 17px;
}

.quiz-footer,
.result-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  margin-top: 22px;
}

.ghost-button,
.primary-button {
  min-height: 48px;
  padding: 0 18px;
  border: 2px solid var(--line);
  cursor: pointer;
  font-weight: 800;
}

.ghost-button {
  background: #fffdf5;
  color: var(--ink);
}

.primary-button {
  background: var(--ink);
  color: #fffdf5;
}

.ghost-button:disabled,
.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.progress-wrap {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.progress-track {
  height: 12px;
  border: 2px solid var(--line);
  background: #fffdf5;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    var(--red),
    var(--red) 8px,
    #8f1116 8px,
    #8f1116 16px
  );
  transition: width 180ms ease;
}

.hidden {
  display: none !important;
}

.result-paper {
  padding-bottom: 34px;
}

.score-stamp {
  min-width: 152px;
  padding: 10px 14px 14px;
  border: 4px solid var(--red);
  color: var(--red);
  transform: rotate(4deg);
  text-align: center;
  background: rgba(255, 253, 245, 0.72);
}

.score-stamp strong {
  position: relative;
  display: block;
  font-family: "Kaiti SC", "STKaiti", cursive;
  font-size: clamp(48px, 10vw, 88px);
  line-height: 0.9;
  font-weight: 400;
  letter-spacing: -0.04em;
  transform: rotate(-6deg);
  text-shadow: 1px 1px 0 rgba(180, 25, 31, 0.18);
}

.score-stamp strong::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 72px;
  height: 3px;
  background: var(--red);
  transform: translateX(-50%) rotate(-4deg);
  border-radius: 999px;
  opacity: 0.86;
}

.score-comment {
  max-width: 580px;
  margin: 8px 0 0;
  color: var(--red);
  font-family: "Kaiti SC", "STKaiti", cursive;
  font-size: clamp(17px, 2.4vw, 24px);
  line-height: 1.25;
  font-weight: 700;
}

.score-comment:empty {
  display: none;
}

.result-hero,
.analysis-panel,
.radar-panel,
.dimension-panel {
  position: relative;
  z-index: 1;
  border: 2px solid var(--line);
  background: rgba(255, 254, 249, 0.78);
}

.result-hero {
  margin-top: 22px;
  padding: clamp(18px, 4vw, 30px);
}

.label {
  color: var(--muted);
  font-weight: 800;
}

#resultType {
  margin-bottom: 12px;
  max-width: 100%;
  font-size: clamp(32px, 6.4vw, 68px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.verdict {
  max-width: 760px;
  margin-bottom: 14px;
  color: var(--red);
  font-size: clamp(19px, 3vw, 28px);
  font-family: "Kaiti SC", "STKaiti", cursive;
  line-height: 1.35;
}

.companions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  padding: 6px 10px;
  background: #fffdf5;
  font-size: 14px;
}

.achievement-list {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 2px dashed rgba(180, 25, 31, 0.38);
  background: transparent;
}

.achievement-list p {
  margin: 0 0 12px;
  color: var(--red);
  font-family: "Kaiti SC", "STKaiti", cursive;
  font-size: clamp(17px, 2.4vw, 22px);
  font-weight: 800;
  line-height: 1.3;
}

.achievement-list ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.achievement-list li {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 6px 13px;
  border: 2px solid rgba(180, 25, 31, 0.82);
  border-radius: 999px;
  color: var(--red);
  font-family: "Kaiti SC", "STKaiti", cursive;
  font-weight: 900;
  font-size: 17px;
  line-height: 1.2;
  background: rgba(180, 25, 31, 0.035);
  box-shadow: inset 0 0 0 1px rgba(180, 25, 31, 0.2);
  transform: rotate(-2deg);
}

.achievement-list li:nth-child(2) {
  transform: rotate(2deg);
}

.result-grid {
  position: relative;
  z-index: 1;
  margin-top: 18px;
}

.radar-panel,
.analysis-panel {
  padding: 18px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
  font-weight: 900;
}

#radarCanvas {
  width: 100%;
  max-width: 520px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.scorecard-list {
  display: grid;
  gap: 0;
}

.scorecard-row {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) minmax(92px, 42%) minmax(50px, auto);
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(29, 29, 31, 0.16);
}

.scorecard-row:last-child {
  border-bottom: 0;
}

.scorecard-row > span {
  color: var(--ink);
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.scorecard-bar {
  height: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 245, 0.9);
}

.scorecard-bar i {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(135deg, var(--red) 0 12px, #8f1017 12px 20px);
}

.scorecard-row strong {
  color: var(--red);
  font-family: "Kaiti SC", "STKaiti", cursive;
  font-size: 19px;
  line-height: 1;
  white-space: nowrap;
  text-align: right;
}

.analysis-panel {
  margin-top: 18px;
}

.analysis-content {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.75;
}

.analysis-content h3 {
  display: inline-block;
  margin: 14px 0 8px;
  padding: 3px 8px 4px;
  border: 1px solid var(--red);
  background: rgba(180, 25, 31, 0.06);
  color: var(--red);
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
}

.analysis-content h3:first-child {
  margin-top: 0;
}

.analysis-content p {
  margin: 0 0 12px;
}

.analysis-content p:last-child {
  margin-bottom: 0;
}

.result-actions {
  grid-template-columns: 1fr 1fr;
}

.share-output {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.share-output img {
  width: min(360px, 100%);
  border: 2px solid var(--line);
  background: var(--paper);
}

.share-tip {
  max-width: min(360px, 100%);
  margin: 0;
  color: var(--red);
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "楷体", cursive;
  font-size: 15px;
  line-height: 1.45;
}

.share-output a {
  width: fit-content;
  padding: 10px 14px;
  border: 2px solid var(--line);
  background: var(--red);
  color: #fffdf5;
  font-weight: 900;
  text-decoration: none;
}

@media (max-width: 720px) {
  .exam-shell {
    width: min(100% - 16px, 980px);
    margin: 8px auto;
  }

  .paper {
    min-height: calc(100vh - 16px);
    padding: 12px;
    box-shadow: 5px 6px 0 var(--shadow);
  }

  .paper::before {
    inset: 8px;
  }

  .exam-header,
  .result-header,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .exam-header,
  .result-header {
    display: grid;
    gap: 10px;
    padding-bottom: 12px;
  }

  .kicker {
    margin-bottom: 3px;
    font-size: 12px;
  }

  h1 {
    font-size: clamp(28px, 9vw, 46px);
  }

  #resultType {
    font-size: clamp(30px, 9vw, 46px);
  }

  .candidate-form {
    gap: 6px;
    margin-top: 10px;
  }

  .candidate-box,
  .score-stamp {
    width: 100%;
    min-width: 0;
  }

  .candidate-form {
    max-width: none;
  }

  .candidate-number,
  .form-row {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 5px 8px;
    font-size: 13px;
  }

  .compact-form-row {
    grid-template-columns: 68px minmax(0, 0.8fr) 58px minmax(78px, 1fr);
  }

  .number-grid {
    grid-template-columns: repeat(9, minmax(18px, 1fr));
    height: 28px;
  }

  .number-grid i {
    font-size: 13px;
  }

  .form-row b {
    min-height: 21px;
    padding-bottom: 1px;
  }

  .exam-notice ol {
    padding: 7px 10px 7px 26px;
    font-size: 11px;
    line-height: 1.3;
  }

  .exam-notice h2 {
    padding: 4px 8px;
    font-size: 16px;
  }

  .question-card {
    margin-top: 12px;
    padding: 14px;
  }

  .question-meta {
    margin-bottom: 10px;
  }

  .question-text {
    margin-bottom: 14px;
    font-size: 18px;
    line-height: 1.52;
  }

  .options {
    gap: 8px;
  }

  .option {
    min-height: 54px;
  }

  .option-text {
    padding: 10px 12px;
    font-size: 15px;
  }

  .quiz-footer {
    grid-template-columns: 1fr 1fr;
    margin-top: 12px;
  }

  .progress-wrap {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .ghost-button {
    grid-column: 1;
  }

  .primary-button {
    grid-column: 2;
  }

  .option {
    grid-template-columns: 40px 1fr;
  }

}
