:root {
  color-scheme: light;
  --navy: #10253c;
  --teal: #1e777b;
  --teal-light: #e5f5f2;
  --gold: #f4c95d;
  --ink: #1c354b;
  --muted: #748594;
  --line: #e2ebef;
  --bg: #f5f7fa;
  --card: #ffffff;
  --danger: #b25749;
  --success: #1c876e;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
}

.page {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 22px 18px 120px;
}

.hero,
.result-hero,
.subpage-hero {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  color: #ffffff;
  background: linear-gradient(135deg, #10253c 0%, #1c5268 58%, #1e777b 100%);
  box-shadow: 0 18px 46px rgba(16, 37, 60, 0.18);
}

.hero {
  padding: 38px 28px 30px;
}

.hero::after,
.result-hero::after,
.subpage-hero::after {
  position: absolute;
  right: -130px;
  bottom: -170px;
  width: 340px;
  height: 340px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  content: "";
}

.eyebrow,
.hero-title,
.hero-subtitle,
.hero-actions,
.result-hero > *,
.subpage-hero > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  color: #a8e6d9;
  font-size: 13px;
  letter-spacing: 2px;
}

.hero-title {
  margin-top: 8px;
  font-size: clamp(34px, 10vw, 54px);
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.2;
}

.hero-subtitle {
  max-width: 620px;
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 15px;
  line-height: 1.8;
}

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

.hero-actions {
  margin-top: 24px;
}

.primary-button,
.secondary-button,
.submit-button,
.judge-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.primary-button,
.submit-button {
  color: var(--navy);
  background: var(--gold);
  box-shadow: 0 8px 18px rgba(244, 201, 93, 0.2);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--teal);
  background: #ffffff;
}

.hero .secondary-button {
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.11);
}

button:active {
  transform: translateY(1px);
}

.stats-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.stat-card,
.summary-item,
.card,
.question-card,
.chapter-card,
.unit-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(20, 50, 73, 0.04);
}

.stat-card,
.summary-item {
  padding: 18px 12px;
  text-align: center;
}

.stat-number,
.summary-number {
  display: block;
  color: var(--teal);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}

.stat-label,
.summary-label {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.section-heading,
.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 32px 0 14px;
}

.section-heading h2,
.section-title h2 {
  margin: 0;
  color: var(--navy);
  font-size: 24px;
  line-height: 1.3;
}

.section-heading p,
.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.card {
  padding: 22px;
}

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

.unit-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.unit-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.unit-title {
  color: var(--navy);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
}

.unit-counts {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.unit-start-button {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  color: #ffffff;
  background: var(--teal);
  font-weight: 800;
}

.unit-start-button.compact {
  margin-top: 16px;
  background: var(--navy);
}

.feature-list {
  display: grid;
  gap: 16px;
}

.feature-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.feature-index,
.chapter-number,
.question-number,
.result-number {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  color: #ffffff;
  background: var(--teal);
  font-weight: 800;
}

.feature-index {
  width: 38px;
  height: 38px;
  font-size: 12px;
}

.feature-title {
  color: var(--navy);
  font-weight: 800;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.warning,
.success,
.error {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.7;
}

.warning {
  border-left: 4px solid #d29d24;
  color: #6c5010;
  background: #fff8df;
}

.success {
  color: var(--success);
  background: #e8f8f1;
}

.error {
  color: var(--danger);
  background: #fff0eb;
}

.exam-topbar,
.question-meta,
.result-question-head,
.chapter-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.exam-topbar {
  justify-content: space-between;
}

.exam-kicker {
  color: var(--muted);
  font-size: 13px;
}

.exam-title {
  margin-top: 4px;
  color: var(--navy);
  font-size: 28px;
  font-weight: 800;
}

.progress-badge,
.mark {
  padding: 7px 12px;
  border-radius: 999px;
  color: #146c68;
  background: var(--teal-light);
  font-size: 13px;
  font-weight: 800;
}

.progress-track {
  height: 9px;
  margin: 20px 0 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ebef;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2c9b91, var(--gold));
  transition: width 0.2s ease;
}

.exam-tip {
  padding: 14px 16px;
  border-radius: 14px;
  color: #526777;
  background: #edf7f7;
  font-size: 14px;
  line-height: 1.7;
}

.type-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 14px;
  padding: 18px 20px;
  border-radius: 18px;
  color: #ffffff;
  background: var(--navy);
}

.type-heading.judge-heading {
  margin-top: 38px;
  background: var(--teal);
}

.type-title {
  font-size: 20px;
  font-weight: 800;
}

.type-subtitle {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.type-count {
  color: var(--gold);
  font-size: 30px;
  font-weight: 800;
}

.question-card,
.result-card,
.chapter-card {
  margin-bottom: 14px;
  padding: 20px;
}

.question-meta {
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.question-number,
.result-number {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.question-type,
.result-question-label {
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

.question-source {
  overflow: hidden;
  color: #92a0a9;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-content,
.result-content {
  color: #233c50;
  font-size: 17px;
  line-height: 2;
  word-break: break-word;
}

.answer-input {
  width: min(180px, 42vw);
  height: 36px;
  margin: 0 4px;
  padding: 0 8px;
  border: 0;
  border-bottom: 2px solid var(--teal);
  border-radius: 8px 8px 0 0;
  outline: none;
  color: var(--ink);
  background: #eff9f7;
  font-size: 16px;
  text-align: center;
  vertical-align: middle;
}

.answer-input:focus {
  box-shadow: 0 0 0 3px rgba(30, 119, 123, 0.13);
}

.judge-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.judge-button {
  border: 1px solid var(--line);
  color: #5e7180;
  background: #f8fafb;
}

.judge-button.selected-correct {
  border-color: var(--success);
  color: #ffffff;
  background: var(--success);
}

.judge-button.selected-wrong {
  border-color: var(--danger);
  color: #ffffff;
  background: var(--danger);
}

.submit-button {
  width: 100%;
  margin-top: 28px;
  font-size: 17px;
}

.result-hero,
.subpage-hero {
  padding: 30px 24px;
  text-align: center;
}

.result-kicker {
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
}

.score-line {
  margin-top: 12px;
  line-height: 1;
}

.score-number {
  font-size: 76px;
  font-weight: 800;
}

.score-total {
  color: rgba(255, 255, 255, 0.72);
  font-size: 30px;
}

.score-percent {
  margin-top: 12px;
  color: var(--gold);
  font-size: 20px;
  font-weight: 800;
}

.result-meta {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.result-actions {
  margin: 18px 0 28px;
}

.result-question-head {
  margin-bottom: 14px;
}

.result-question-label {
  flex: 1;
}

.mark-correct {
  color: var(--success);
  background: #def5ed;
}

.mark-wrong {
  color: var(--danger);
  background: #fff0eb;
}

.filled-answer {
  display: inline-block;
  min-width: 54px;
  margin: 0 3px;
  padding: 0 6px;
  border-bottom: 2px solid currentColor;
  font-weight: 800;
  text-align: center;
}

.answer-correct {
  color: var(--success);
  background: #effaf6;
}

.answer-wrong {
  color: var(--danger);
  background: #fff3ef;
}

.judge-answer,
.user-answer,
.source-line {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.judge-answer-value {
  color: var(--teal);
  font-weight: 800;
}

.source-line {
  padding-top: 12px;
  border-top: 1px solid #edf1f4;
  color: #99a5ad;
  font-size: 12px;
}

.chapter-head {
  margin-bottom: 14px;
}

.chapter-number {
  width: 42px;
  height: 42px;
  font-size: 14px;
}

.chapter-topic {
  color: var(--navy);
  font-size: 18px;
  font-weight: 800;
}

.chapter-stats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.guide-title {
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 18px;
  font-weight: 800;
}

.code-sample {
  margin-top: 14px;
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  color: #476276;
  background: #f2f6f8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  white-space: nowrap;
}

.file-input {
  display: none;
}

.json-input {
  width: 100%;
  min-height: 250px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
}

.json-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(30, 119, 123, 0.13);
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.back-button {
  padding: 6px 0;
  color: var(--teal);
  background: transparent;
  font-weight: 800;
}

.nav-brand {
  color: var(--navy);
  font-size: 15px;
  font-weight: 800;
}

.empty {
  padding: 50px 20px;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 720px) {
  .page {
    padding-top: 36px;
  }

  .hero {
    padding: 52px 48px 42px;
  }

  .question-content,
  .result-content {
    font-size: 18px;
  }
}

@media (max-width: 520px) {
  .unit-grid {
    grid-template-columns: 1fr;
  }
}
