:root {
  color-scheme: light;
  --ink: #1d2428;
  --muted: #647276;
  --line: #dbe3df;
  --paper: #fbfbf7;
  --panel: #ffffff;
  --green: #2d5a4c;
  --green-dark: #1f4339;
  --amber: #c27b2d;
  --blue: #376c8c;
  --red: #a64949;
  --shadow: 0 18px 50px rgba(30, 44, 40, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(45, 90, 76, 0.08), rgba(55, 108, 140, 0.05) 48%, rgba(194, 123, 45, 0.08)),
    var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  background: var(--green);
  color: #fff;
  border-radius: 8px;
}

.brand-mark svg {
  width: 38px;
  height: 38px;
}

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

h1 {
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.brand-block p,
#reportSubtitle {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.timer-panel {
  display: grid;
  gap: 2px;
  min-width: 142px;
  padding: 12px 16px;
  border: 1px solid rgba(45, 90, 76, 0.24);
  background: #f3f8f5;
  text-align: right;
}

.timer-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.timer-panel strong {
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--green-dark);
}

.timer-panel.warning strong {
  color: var(--amber);
}

.timer-panel.danger strong {
  color: var(--red);
}

.candidate-strip {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.question-title,
.section-heading p {
  display: block;
}

.candidate-strip label {
  display: grid;
  gap: 6px;
}

.candidate-strip span {
  color: var(--muted);
  font-size: 0.85rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cbd7d2;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input[type="radio"],
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--green);
}

input {
  height: 44px;
  padding: 0 12px;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45, 90, 76, 0.13);
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  background: var(--green);
  color: #fff;
}

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

.primary-button:disabled {
  cursor: not-allowed;
  background: #9dafaa;
}

.secondary-button {
  background: #fff;
  color: var(--green-dark);
  border-color: #cbd7d2;
}

.secondary-button:hover,
.icon-button:hover {
  background: #f3f8f5;
}

.icon-button {
  width: 44px;
  padding: 0;
  color: var(--green-dark);
  background: #fff;
  border-color: #cbd7d2;
}

button svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.primary-button svg path:first-child {
  fill: currentColor;
}

#submitBtn svg path,
#printBtn svg path,
#newTestBtn svg path,
#sampleBtn svg path {
  fill: none;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 14px;
  margin-top: 14px;
}

.material-panel,
.answer-panel,
.report-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.material-panel,
.answer-panel {
  min-height: 620px;
  padding: 20px;
}

.material-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-heading p {
  font-size: 1.08rem;
  font-weight: 800;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.88rem;
}

.material-text {
  display: grid;
  gap: 14px;
  color: #263136;
  line-height: 1.85;
  font-size: 1rem;
}

.answer-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.question-list {
  display: grid;
  gap: 14px;
}

.question-block {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid #dce5e1;
  background: #fff;
  border-radius: 8px;
}

.question-block legend {
  width: 100%;
  padding: 0;
}

.question-title {
  font-weight: 800;
  line-height: 1.55;
}

.question-meta {
  margin-top: 2px;
  color: var(--blue);
  font-size: 0.85rem;
  font-weight: 700;
}

.option-grid {
  display: grid;
  gap: 8px;
}

.option-card {
  display: grid;
  grid-template-columns: 18px 30px 1fr;
  align-items: start;
  gap: 10px;
  min-height: 46px;
  padding: 10px;
  border: 1px solid #dce5e1;
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  line-height: 1.55;
}

.option-card:has(input:checked) {
  border-color: rgba(45, 90, 76, 0.6);
  background: #f0f7f3;
  box-shadow: inset 0 0 0 1px rgba(45, 90, 76, 0.2);
}

.option-card:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.64;
}

.option-card:has(input:not(:disabled)) {
  cursor: pointer;
}

.option-key {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #e8efeb;
  color: var(--green-dark);
  font-weight: 800;
  font-size: 0.86rem;
}

.option-text {
  min-width: 0;
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: auto;
}

.report-panel {
  margin-top: 14px;
  padding: 22px;
}

.report-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--amber);
  font-weight: 800;
}

.report-header h2 {
  font-size: 1.65rem;
  line-height: 1.2;
}

.score-badge {
  display: grid;
  place-items: center;
  min-width: 112px;
  min-height: 112px;
  border: 2px solid rgba(45, 90, 76, 0.22);
  background: #f3f8f5;
}

.score-badge span {
  color: var(--muted);
  font-weight: 700;
}

.score-badge strong {
  color: var(--green-dark);
  font-size: 3rem;
  line-height: 1;
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(300px, 1.15fr);
  gap: 16px;
  margin-top: 18px;
}

.radar-box,
.diagnosis-box,
.insight-grid article,
.teacher-rubric {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
}

.radar-box {
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 12px;
}

#radarChart {
  width: min(100%, 420px);
  height: auto;
}

.diagnosis-box {
  padding: 18px;
}

.diagnosis-box h3,
.insight-grid h3,
.teacher-rubric h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.diagnosis-box p {
  color: var(--muted);
  line-height: 1.7;
}

.metric-list {
  display: grid;
  gap: 11px;
  margin-top: 16px;
}

.metric-item {
  display: grid;
  gap: 6px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
}

.metric-row strong {
  font-variant-numeric: tabular-nums;
}

.metric-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1ef;
}

.metric-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.insight-grid article,
.teacher-rubric {
  padding: 18px;
}

ul {
  margin: 0;
  padding-left: 20px;
}

li {
  margin: 8px 0;
  line-height: 1.6;
}

.teacher-rubric {
  margin-top: 16px;
}

.rubric-table {
  display: grid;
  border: 1px solid var(--line);
}

.rubric-table > div {
  display: grid;
  grid-template-columns: 0.75fr 2.2fr 0.7fr;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}

.rubric-table > div:last-child {
  border-bottom: 0;
}

.rubric-table span,
.rubric-table strong {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  line-height: 1.5;
}

.rubric-table span:last-child,
.rubric-table strong:last-child {
  border-right: 0;
}

.rubric-table strong {
  background: #f3f8f5;
}

.report-actions {
  margin-top: 16px;
}

@media (max-width: 940px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .report-header {
    flex-direction: column;
    align-items: stretch;
  }

  .timer-panel {
    text-align: left;
  }

  .candidate-strip,
  .workspace,
  .report-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .material-panel,
  .answer-panel {
    min-height: auto;
  }

  .material-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 560px) {
  .brand-block {
    align-items: flex-start;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .candidate-strip {
    align-items: stretch;
  }

  .primary-button,
  .secondary-button,
  .icon-button {
    width: 100%;
  }

  .icon-button {
    width: 100%;
  }

  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .score-badge {
    min-width: 100%;
  }

  .rubric-table {
    border: 0;
    gap: 10px;
  }

  .rubric-table > div {
    grid-template-columns: 1fr;
    border: 1px solid var(--line);
  }

  .rubric-table span,
  .rubric-table strong {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rubric-table span:last-child,
  .rubric-table strong:last-child {
    border-bottom: 0;
  }
}

@media print {
  body {
    background: #fff;
  }

  .candidate-strip,
  .workspace,
  .report-actions {
    display: none;
  }

  .app-shell {
    padding: 0;
  }

  .topbar,
  .report-panel {
    box-shadow: none;
    border: 0;
  }
}
