:root {
  color-scheme: light;
  --paper: #fbfaf6;
  --wash: #f2efe7;
  --ink: #17212f;
  --muted: #617083;
  --line: #d8d2c5;
  --teal: #0f766e;
  --teal-dark: #0b4f49;
  --coral: #c2410c;
  --amber: #b45309;
  --leaf: #386641;
  --white: #ffffff;
  --shadow: 0 24px 80px rgba(23, 33, 47, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--wash);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}

.progress-rail {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 40px 32px;
  background: #17212f;
  color: #f8f3e8;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(248, 243, 232, 0.3);
  border-radius: 8px;
  background: var(--teal);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 4px;
  color: #f3c88c;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.7rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.reference-note {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(248, 243, 232, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #efe7d4;
  line-height: 1.55;
}

.reference-note strong {
  color: #ffffff;
}

.reference-note span {
  font-size: 0.92rem;
}

.step-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  color: rgba(248, 243, 232, 0.62);
  font-size: 0.94rem;
}

.step-list .dot {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(248, 243, 232, 0.22);
  border-radius: 50%;
  color: rgba(248, 243, 232, 0.76);
  font-size: 0.8rem;
}

.step-list li.is-current {
  color: #ffffff;
  font-weight: 700;
}

.step-list li.is-current .dot {
  border-color: #f3c88c;
  background: #f3c88c;
  color: #17212f;
}

.step-list li.is-done {
  color: rgba(248, 243, 232, 0.9);
}

.step-list li.is-done .dot {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.question-surface {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 34px 44px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2)),
    var(--paper);
}

.topbar {
  display: grid;
  grid-template-columns: 44px minmax(120px, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}

.ghost-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 1.9rem;
  line-height: 1;
}

.ghost-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.meter {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ded1;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 180ms ease;
}

.progress-text {
  min-width: 48px;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: right;
}

#assessmentForm {
  width: min(880px, 100%);
  margin: 0 auto;
}

.question-card {
  display: grid;
  gap: 24px;
}

.question-heading {
  display: grid;
  gap: 10px;
}

.question-heading h2 {
  margin: 0;
  max-width: 760px;
  font-size: 2rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.question-heading p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.choice-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-button {
  min-height: 86px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.choice-button strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.04rem;
}

.choice-button span {
  display: block;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.9rem;
}

.choice-button:hover,
.choice-button.is-selected {
  border-color: var(--teal);
  box-shadow: 0 10px 26px rgba(15, 118, 110, 0.12);
}

.choice-button.is-selected {
  background: #edf9f6;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: #334155;
  font-size: 0.93rem;
  font-weight: 700;
}

.required-mark {
  margin-left: 4px;
  color: var(--coral);
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(15, 118, 110, 0.15);
}

.hint-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.exam-list {
  display: grid;
  gap: 12px;
}

.exam-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
}

.chip.is-selected {
  border-color: var(--teal);
  background: #edf9f6;
  color: var(--teal-dark);
  font-weight: 700;
}

.error-box {
  padding: 12px 14px;
  border: 1px solid #f3b08e;
  border-radius: 8px;
  background: #fff4ed;
  color: #8a2f10;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 34px;
}

.primary-button {
  min-width: 154px;
  min-height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.report {
  display: grid;
  gap: 22px;
}

.report-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.report-head h2 {
  margin: 0 0 10px;
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.report-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff5e4;
  color: #7c3d05;
  font-weight: 800;
  white-space: nowrap;
}

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

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 144px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 14px 40px rgba(23, 33, 47, 0.06);
}

.report > * {
  animation: revealUp 420ms ease both;
}

.report > *:nth-child(2) {
  animation-delay: 120ms;
}

.report > *:nth-child(3) {
  animation-delay: 240ms;
}

.report > *:nth-child(4) {
  animation-delay: 360ms;
}

.report > *:nth-child(5) {
  animation-delay: 480ms;
}

.report > *:nth-child(6) {
  animation-delay: 600ms;
}

.report > *:nth-child(7) {
  animation-delay: 720ms;
}

.report > *:nth-child(8) {
  animation-delay: 840ms;
}

@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.metric-label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.metric-value {
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: 0;
}

.metric-card.teal {
  border-top: 4px solid var(--teal);
}

.metric-card.coral {
  border-top: 4px solid var(--coral);
}

.metric-card.leaf {
  border-top: 4px solid var(--leaf);
}

.report-section {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.report-section h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.subject-score-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.subject-score-card {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 12px;
  border: 1px solid #e7e0d2;
  border-radius: 8px;
  background: #fffdf8;
}

.subject-score-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.subject-score-card strong {
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1.1;
  font-weight: 900;
}

.subject-score-card em {
  color: #7a8796;
  font-size: 0.78rem;
  font-style: normal;
}

.follow-up-card {
  border-color: rgba(15, 118, 110, 0.25);
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.86));
}

.follow-up-card p {
  margin: 0;
  color: #24423d;
  line-height: 1.7;
  font-weight: 700;
}

.bar-stack {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 12px;
  color: #334155;
  font-size: 0.92rem;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e0d2;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pill-list li {
  padding: 8px 11px;
  border-radius: 999px;
  background: #eef6f2;
  color: #22543d;
  font-size: 0.9rem;
  font-weight: 700;
}

.advice-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.advice-list li {
  position: relative;
  padding-left: 24px;
  color: #334155;
  line-height: 1.6;
}

.advice-list li::before {
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--amber);
  content: "";
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.secondary-button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-weight: 800;
}

.ai-analyzing {
  display: grid;
  justify-items: center;
  gap: 22px;
  padding: 34px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.ai-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 106px;
  height: 106px;
  border-radius: 50%;
  background: #e8f7f4;
  color: var(--teal-dark);
  font-weight: 900;
  font-size: 1.35rem;
}

.ai-orbit::before,
.ai-orbit::after {
  position: absolute;
  inset: -10px;
  border: 2px solid transparent;
  border-top-color: var(--teal);
  border-right-color: rgba(15, 118, 110, 0.35);
  border-radius: 50%;
  content: "";
  animation: orbitSpin 1.25s linear infinite;
}

.ai-orbit::after {
  inset: -20px;
  border-top-color: #c2410c;
  border-right-color: rgba(194, 65, 12, 0.28);
  animation-duration: 1.9s;
  animation-direction: reverse;
}

@keyframes orbitSpin {
  to {
    transform: rotate(360deg);
  }
}

.analysis-status {
  min-height: 28px;
  margin: 0;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
  line-height: 1.5;
}

.analysis-status.is-changing {
  animation: statusPulse 520ms ease both;
}

@keyframes statusPulse {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.analysis-progress {
  width: min(520px, 100%);
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ded1;
}

.analysis-progress span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transform-origin: left;
  animation: analysisFill var(--analysis-duration, 10s) ease-in-out both;
}

@keyframes analysisFill {
  from {
    transform: scaleX(0.08);
  }
  55% {
    transform: scaleX(0.72);
  }
  to {
    transform: scaleX(1);
  }
}

.analysis-steps {
  display: grid;
  gap: 10px;
  width: min(520px, 100%);
  margin: 0;
  padding: 0;
  list-style: none;
}

.analysis-steps li {
  position: relative;
  padding-left: 24px;
  color: #334155;
  line-height: 1.5;
  opacity: 0;
  animation: stepFade 420ms ease both;
}

.analysis-steps li:nth-child(1) {
  animation-delay: 180ms;
}

.analysis-steps li:nth-child(2) {
  animation-delay: 780ms;
}

.analysis-steps li:nth-child(3) {
  animation-delay: 1380ms;
}

.analysis-steps li:nth-child(4) {
  animation-delay: 1980ms;
}

.analysis-steps li:nth-child(5) {
  animation-delay: 2580ms;
}

.analysis-steps li::before {
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  content: "";
}

@keyframes stepFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.image-preview {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(23, 33, 47, 0.72);
}

.image-preview-panel {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  max-height: 92vh;
  padding: 16px;
  overflow: auto;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.image-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-preview-top strong {
  color: var(--ink);
  font-size: 1rem;
}

.image-preview-top button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
}

.image-preview-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.image-preview-panel img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.image-download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .progress-rail {
    padding: 24px 20px;
  }

  .step-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .step-list li {
    grid-template-columns: 22px 1fr;
    font-size: 0.84rem;
  }

  .step-list .dot {
    width: 22px;
    height: 22px;
  }

  .question-surface {
    padding: 24px 20px 32px;
  }

  .question-heading h2,
  .report-head h2 {
    font-size: 1.55rem;
  }

  .choice-grid,
  .choice-grid.three,
  .field-grid,
  .field-grid.three,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .subject-score-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .report-head {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .progress-rail {
    gap: 18px;
  }

  .reference-note {
    padding: 12px;
  }

  .step-list {
    grid-template-columns: 1fr 1fr;
  }

  .topbar {
    grid-template-columns: 40px minmax(80px, 1fr) auto;
  }

  .ghost-button {
    width: 40px;
    height: 40px;
  }

  .exam-row {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .subject-score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .subject-score-card {
    min-height: 84px;
  }
}
