:root {
  color-scheme: light;
  --ink: #12212a;
  --muted: #64727a;
  --paper: #ffffff;
  --canvas: #edf1f2;
  --line: #d6dde0;
  --navy: #10202b;
  --navy-soft: #1a3343;
  --safety: #f2c230;
  --safety-dark: #9d7100;
  --success: #177245;
  --success-bg: #e9f6ef;
  --danger: #b42318;
  --danger-bg: #fff0ef;
  --shadow: 0 18px 55px rgba(16, 32, 43, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(16, 32, 43, 0.04) 25%, transparent 25%) 0 0 / 22px 22px,
    var(--canvas);
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  padding: 10px clamp(18px, 4vw, 48px);
  color: #fff;
  border-bottom: 4px solid var(--safety);
  background: var(--navy);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 750;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--navy);
  border-radius: 8px;
  background: var(--safety);
}

.app-shell {
  width: min(860px, calc(100% - 32px));
  margin: 30px auto 64px;
}

.status-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 10px;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#progressText {
  font-size: 1.2rem;
}

.score-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.score-summary span {
  white-space: nowrap;
}

.score-summary strong {
  color: var(--ink);
}

.progress-track {
  overflow: hidden;
  height: 8px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: #d6dde0;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--safety);
  transition: width 220ms ease;
}

.question-card,
.completion-card {
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.question-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.type-badge {
  padding: 6px 10px;
  color: var(--navy);
  border: 1px solid #d4ae2e;
  border-radius: 7px;
  background: #fff6cc;
  font-size: 0.82rem;
  font-weight: 750;
}

.question-number {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.question-figure {
  display: grid;
  min-height: 220px;
  margin: 0 0 26px;
  padding: 18px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(16, 32, 43, 0.025) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(rgba(16, 32, 43, 0.025) 1px, transparent 1px) 0 0 / 18px 18px,
    #fafcfc;
}

.question-figure img {
  display: block;
  max-width: 100%;
  max-height: 430px;
  object-fit: contain;
}

#questionPrompt {
  margin: 0;
  font-size: clamp(1.08rem, 2.2vw, 1.3rem);
  line-height: 1.72;
  white-space: normal;
}

.selection-hint {
  margin: 9px 0 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.option {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  text-align: left;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.option:hover:not(:disabled) {
  border-color: #8ea0a9;
  transform: translateY(-1px);
}

.option:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(242, 194, 48, 0.55);
  outline-offset: 2px;
}

.option-key {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #aab6bc;
  border-radius: 8px;
  font-weight: 800;
}

.option-text {
  padding-top: 3px;
  font-size: 1rem;
  line-height: 1.65;
  white-space: normal;
}

.option.selected {
  border-color: var(--navy-soft);
  background: #f1f6f8;
}

.option.selected .option-key {
  color: white;
  border-color: var(--navy);
  background: var(--navy);
}

.option.correct {
  border-color: #5ca47d;
  background: var(--success-bg);
}

.option.correct .option-key {
  color: white;
  border-color: var(--success);
  background: var(--success);
}

.option.wrong {
  border-color: #dc8179;
  background: var(--danger-bg);
}

.option.wrong .option-key {
  color: white;
  border-color: var(--danger);
  background: var(--danger);
}

.result-message {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 0.98rem;
  font-weight: 700;
}

.result-message.success {
  color: var(--success);
  background: var(--success-bg);
}

.result-message.error {
  color: var(--danger);
  background: var(--danger-bg);
}

.action-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.primary-button,
.quiet-button,
.danger-button {
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 750;
  cursor: pointer;
}

.primary-button {
  min-width: 150px;
  color: #fff;
  border: 1px solid var(--navy);
  background: var(--navy);
}

.primary-button:hover:not(:disabled) {
  background: var(--navy-soft);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.quiet-button {
  color: inherit;
  border: 1px solid currentColor;
  background: transparent;
}

.site-header .quiet-button:hover {
  color: var(--navy);
  background: var(--safety);
}

.completion-card {
  padding-block: 70px;
  text-align: center;
}

.completion-card h1 {
  margin: 6px 0 12px;
}

.completion-card p:not(.eyebrow) {
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.05rem;
}

.completion-icon {
  display: grid;
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: var(--success);
  font-size: 2rem;
  font-weight: 800;
}

dialog {
  width: min(430px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.3);
}

dialog::backdrop {
  background: rgba(7, 18, 25, 0.65);
}

.dialog-body {
  padding: 26px;
}

.dialog-body h2 {
  margin: 0 0 8px;
}

.dialog-body p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.danger-button {
  color: white;
  border: 1px solid var(--danger);
  background: var(--danger);
}

[hidden] {
  display: none !important;
}

@media (max-width: 620px) {
  .site-header {
    min-height: 62px;
    padding-inline: 14px;
  }

  .brand {
    font-size: 0.96rem;
  }

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

  .site-header .quiet-button {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 0.85rem;
  }

  .app-shell {
    width: min(100% - 20px, 860px);
    margin-top: 18px;
  }

  .question-card {
    padding: 18px 15px 20px;
    border-radius: 14px;
  }

  .question-figure {
    min-height: 170px;
    padding: 10px;
  }

  .option {
    padding: 12px;
  }

  .score-summary {
    gap: 10px;
    font-size: 0.82rem;
  }

  .action-row,
  .action-row button {
    width: 100%;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
