:root {
  color-scheme: light;
  --ink: #203040;
  --muted: #5e6f82;
  --line: #d8e2ea;
  --paper: #f6fbff;
  --surface: #ffffff;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #dbeafe;
  --gold: #f59e0b;
  --rose: #ef4444;
  --mint: #22c55e;
  --shadow: 0 18px 44px rgba(26, 41, 64, 0.12);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.16), transparent 24%),
    linear-gradient(180deg, #fafdff 0%, #eef6ff 42%, #f6fbff 100%),
    var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  min-height: 88px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 3.2rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.85rem;
}

.bank-pill {
  min-width: 180px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  margin-top: 24px;
}

.control-panel,
.test-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
}

.student-box {
  display: grid;
  gap: 8px;
}

.student-box label,
.settings-box span,
.metric-grid span,
.result-grid span {
  color: var(--muted);
  font-size: 0.82rem;
}

.student-box input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
}

.student-box input:focus {
  outline: 3px solid var(--accent-soft);
  border-color: var(--accent);
}

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

.metric-grid div,
.result-grid div,
.settings-box div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f6fbff);
}

.metric-grid div,
.result-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.metric-grid strong,
.result-grid strong {
  overflow-wrap: anywhere;
  font-size: 1.25rem;
}

.settings-box {
  display: grid;
  gap: 8px;
}

.settings-box div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.action-row,
.result-actions {
  display: flex;
  gap: 10px;
}

.report-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-actions .primary-btn,
.report-actions .secondary-btn {
  width: 100%;
  min-width: 0;
}

.primary-btn,
.secondary-btn,
.file-btn,
.icon-btn {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-btn {
  flex: 1;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: white;
  font-weight: 800;
}

.primary-btn:hover,
.primary-btn:focus-visible {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
}

.secondary-btn,
.file-btn {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 700;
}

.file-btn {
  display: grid;
  min-height: 44px;
  place-items: center;
  text-align: center;
}

.icon-btn {
  width: 48px;
  flex: 0 0 48px;
  border-color: var(--line);
  background: linear-gradient(180deg, #ffffff, #f2f7ff);
  color: var(--accent-dark);
  font-size: 1.25rem;
}

.primary-btn:active,
.secondary-btn:active,
.file-btn:active,
.icon-btn:active,
.option-btn:active {
  transform: translateY(1px);
}

.large {
  width: min(260px, 70vw);
  flex: none;
}

.test-stage {
  min-height: 640px;
  padding: 18px;
}

.idle-state,
.question-card,
.result-card,
.feedback-card,
.media-card {
  min-height: 604px;
}

.idle-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 32px;
}

.hero-copy {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  max-width: 520px;
}

.hero-copy h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.hero-desc {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.profile-card {
  display: grid;
  gap: 18px;
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 4px;
}

.profile-head {
  display: grid;
  gap: 6px;
  text-align: center;
}

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

.profile-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f6fbff);
  box-shadow: 0 10px 20px rgba(26, 41, 64, 0.04);
}

.profile-field span,
.profile-field legend {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.profile-field input,
.profile-field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
}

.profile-field input:focus,
.profile-field select:focus {
  outline: 3px solid var(--accent-soft);
  border-color: var(--accent);
}

.profile-field fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.gender-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--ink);
}

.gender-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.gender-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.profile-field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent-dark) 50%),
    linear-gradient(135deg, var(--accent-dark) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.character-field {
  display: grid;
  grid-template-columns: repeat(4, 72px);
  gap: 12px;
}

.character-field span {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #eef4ff);
  color: var(--accent-dark);
  font-size: 2rem;
  font-weight: 800;
}

.question-card {
  display: grid;
  grid-template-rows: auto 84px auto;
  gap: 18px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 20%, rgba(59, 130, 246, 0.18), transparent 22%),
    radial-gradient(circle at 82% 30%, rgba(245, 158, 11, 0.16), transparent 18%),
    radial-gradient(circle at 60% 85%, rgba(34, 197, 94, 0.12), transparent 22%),
    linear-gradient(180deg, #ffffff 0%, #f2f8ff 100%);
  padding: 18px;
}

.audio-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(320px, 80vw);
  min-height: 84px;
  padding: 12px 18px 12px 12px;
  place-self: center;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #f3f8ff);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.12);
}

.audio-button:focus-visible {
  outline: 4px solid var(--accent-soft);
}

.audio-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  color: white;
  font-size: 1.4rem;
  padding-left: 4px;
}

.audio-label {
  display: none;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(var(--option-count, 5), minmax(88px, 1fr));
  gap: 12px;
}

.option-btn {
  display: grid;
  min-height: 108px;
  place-items: center;
  border: 2px solid rgba(37, 99, 235, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #eef5ff);
  color: var(--ink);
  font-size: clamp(1.55rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.08);
  transition: transform 140ms ease, border-color 140ms ease, outline-color 140ms ease, box-shadow 140ms ease;
}

.unknown-option {
  color: var(--accent-dark);
  font-size: 1.35rem;
}

.option-btn:hover,
.option-btn:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
  transform: translateY(-1px);
}

.result-card {
  display: grid;
  align-content: center;
  gap: 20px;
  max-width: 680px;
  margin: 0 auto;
}

.report-card {
  display: grid;
  gap: 18px;
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 0 4px;
}

.report-head {
  display: grid;
  gap: 6px;
  text-align: center;
}

.report-head h2 {
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.report-section {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.report-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.18rem;
}

.report-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.report-table div {
  display: grid;
  grid-template-columns: minmax(118px, 0.42fr) 1fr;
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.report-table div:nth-child(2n) {
  border-right: 0;
}

.report-table div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.report-table span,
.report-table strong {
  min-width: 0;
  padding: 11px 12px;
  line-height: 1.5;
}

.report-table span {
  color: var(--muted);
  background: #f0f7ff;
  font-weight: 700;
}

.report-table strong {
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.report-standard-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.report-standard-table th,
.report-standard-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.report-standard-table th {
  color: var(--muted);
  background: #f0f7ff;
  font-size: 0.92rem;
}

.report-standard-table tr:last-child td {
  border-bottom: 0;
}

.report-copy {
  margin: 0;
  color: var(--ink);
  line-height: 1.75;
}

.report-copy strong {
  color: var(--accent-dark);
}

.report-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.norm-chart-block {
  display: grid;
  gap: 12px;
}

.growth-chart {
  width: 100%;
  min-height: 270px;
  aspect-ratio: 2 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f3fbf7);
}

.norm-band {
  fill: rgba(34, 197, 94, 0.17);
}

.norm-boundary {
  fill: none;
  stroke: rgba(34, 197, 94, 0.34);
  stroke-linecap: round;
  stroke-width: 3;
}

.norm-mean {
  fill: none;
  stroke: var(--mint);
  stroke-linecap: round;
  stroke-width: 5;
}

.norm-axis,
.norm-x-tick {
  stroke: rgba(86, 101, 116, 0.5);
  stroke-width: 1.5;
}

.norm-grid-line {
  stroke: rgba(86, 101, 116, 0.16);
  stroke-dasharray: 4 6;
  stroke-width: 1;
}

.norm-y-label,
.norm-x-label,
.norm-axis-title,
.norm-line-label {
  fill: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.norm-axis-title,
.norm-line-label.strong {
  fill: var(--mint-dark);
}

.norm-point {
  fill: var(--accent);
  stroke: #ffffff;
  stroke-width: 4;
  filter: drop-shadow(0 4px 7px rgba(37, 99, 235, 0.28));
}

.norm-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.norm-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-point,
.legend-line,
.legend-band {
  display: inline-block;
  flex: 0 0 auto;
}

.legend-point {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.legend-line {
  width: 22px;
  height: 4px;
  border-radius: 999px;
  background: var(--mint);
}

.legend-band {
  width: 18px;
  height: 12px;
  border-radius: 3px;
  background: rgba(34, 197, 94, 0.18);
}

.feedback-card {
  display: grid;
  align-content: center;
  gap: 22px;
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 0 4px;
}

.feedback-head {
  display: grid;
  gap: 8px;
  text-align: center;
}

.feedback-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 4vw, 2.7rem);
  line-height: 1.2;
}

.feedback-form {
  display: grid;
  gap: 14px;
}

.rating-field {
  display: grid;
  grid-template-columns: minmax(118px, 0.42fr) 1fr;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.rating-field legend {
  display: contents;
  color: var(--ink);
  font-weight: 800;
}

.star-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.star-btn {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 8px;
  background: #fff9ed;
  color: #d1d5db;
  font-size: 1.7rem;
  line-height: 1;
  transition: transform 140ms ease, color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.star-btn.selected,
.star-btn:hover,
.star-btn:focus-visible {
  border-color: rgba(245, 158, 11, 0.52);
  background: #fff3d8;
  color: #f59e0b;
}

.star-btn:active {
  transform: translateY(1px) scale(0.98);
}

.feedback-comment {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.feedback-comment span {
  color: var(--ink);
  font-weight: 800;
}

.feedback-comment textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 15px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  line-height: 1.7;
}

.feedback-comment textarea:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
}

.feedback-status {
  min-height: 26px;
  margin: 0;
  color: var(--accent-dark);
  font-weight: 700;
  text-align: center;
}

.feedback-submit {
  width: min(280px, 100%);
  justify-self: center;
}

.media-card {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
}

.practice-ready-card {
  position: relative;
  display: grid;
  min-height: 604px;
  place-items: center;
  padding: 48px 24px 96px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.16), transparent 24%),
    radial-gradient(circle at 82% 24%, rgba(34, 197, 94, 0.14), transparent 22%),
    linear-gradient(180deg, #ffffff, #f3f8ff);
  text-align: center;
}

.practice-ready-card h2 {
  max-width: 680px;
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.25;
}

.media-card img {
  width: 100%;
  height: 100%;
  min-height: 604px;
  object-fit: contain;
  background: linear-gradient(180deg, #ffffff, #f5f9ff);
}

.media-next {
  position: absolute;
  right: 22px;
  bottom: 22px;
  width: min(180px, calc(100% - 44px));
  flex: none;
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.18);
}

.result-head {
  display: grid;
  gap: 4px;
}

.stop-reason {
  min-height: 28px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 880px) {
  .app-shell {
    width: min(100vw - 20px, 680px);
    padding: 16px 0;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .test-stage {
    min-height: 560px;
  }

  .idle-state,
  .question-card,
  .result-card,
  .feedback-card,
  .media-card {
    min-height: 524px;
  }

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

  .option-btn {
    min-height: 86px;
  }

  .question-banner {
    font-size: 1.15rem;
  }

  .audio-label {
    font-size: 1rem;
  }

  .character-field {
    grid-template-columns: repeat(4, 58px);
  }

  .character-field span {
    width: 58px;
    height: 58px;
    font-size: 1.6rem;
  }

  .rating-field {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .star-row {
    justify-content: flex-start;
  }
}

@media (max-width: 460px) {
  .metric-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

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

  .star-btn {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .question-head,
  .settings-box div {
    display: grid;
  }

  .audio-button {
    width: min(100%, 320px);
    justify-content: center;
  }

  .audio-icon {
    width: 46px;
    height: 46px;
    font-size: 1.2rem;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

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