:root {
  color-scheme: light;
  --bg: #eef4fb;
  --panel: #ffffff;
  --ink: #102033;
  --muted: #607086;
  --line: #d7e1ee;
  --primary: #1e3a8a;
  --primary-strong: #1d4ed8;
  --success: #167a3a;
  --success-bg: #ecfdf3;
  --danger: #b42318;
  --danger-bg: #fef2f2;
  --warn-bg: #fff8e7;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button {
  font: inherit;
}

.practice-shell {
  min-height: 100vh;
  padding: 24px 14px;
}

.practice-shell.is-answering {
  display: flex;
  align-items: center;
  padding-block: 18px;
}

.practice-panel {
  width: min(980px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 22px;
}

.practice-shell.is-answering .practice-panel {
  width: min(860px, 100%);
}

.practice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.practice-head span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.practice-head h1 {
  margin: 6px 0 0;
  font-size: 32px;
  letter-spacing: 0;
}

.back-link,
.mode-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--primary);
  padding: 0 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.mode-action.primary {
  border-color: var(--primary-strong);
  background: var(--primary-strong);
  color: #fff;
}

.mode-action:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.captcha-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 14px;
}

.captcha-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.captcha-actions span {
  min-width: 0;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: break-word;
}

.captcha-actions button {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 800;
}

.geetest-captcha-box {
  min-height: 46px;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.captcha-panel.captcha-verified .geetest-captcha-box {
  pointer-events: none;
  border-color: #86efac;
  background: #f0fdf4;
}

.captcha-panel.captcha-success-state #captchaStatus {
  color: var(--success);
  font-weight: 800;
}

.captcha-panel.captcha-error .geetest-captcha-box {
  border-color: #ef4444;
  background: var(--danger-bg);
}

.captcha-panel.captcha-error #captchaStatus {
  color: var(--danger);
  font-weight: 800;
}

.captcha-panel.captcha-shake {
  animation: captchaShake 360ms ease;
}

@keyframes captchaShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.captcha-success {
  display: grid;
  gap: 2px;
  color: var(--success);
  font-weight: 800;
}

.captcha-success span {
  color: #3f7b52;
  font-size: 13px;
  font-weight: 700;
}

.practice-home {
  display: grid;
  gap: 16px;
}

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

.mode-panel .mode-action {
  min-height: 76px;
  font-size: 18px;
  line-height: 1.35;
  white-space: normal;
  text-align: center;
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary-panel article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 13px;
}

.summary-panel span,
.question-progress,
.message {
  color: var(--muted);
}

.summary-panel strong {
  font-size: 24px;
  overflow-wrap: break-word;
}

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

.question-progress {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
}

.question-panel h2 {
  margin: 0;
  color: #17243a;
  font-size: 22px;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.option-list {
  display: grid;
  gap: 10px;
}

.option-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 13px;
  text-align: left;
  cursor: pointer;
}

.option-button strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary);
}

.option-button span {
  min-width: 0;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.option-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #1d4ed8;
  color: #fff;
  font-style: normal;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.82);
}

.option-button.selected {
  border-color: var(--primary-strong);
  background: #eff6ff;
}

.option-button.selected .option-check,
.option-button.correct .option-check,
.option-button.wrong .option-check {
  opacity: 1;
  transform: scale(1);
}

.option-button.correct .option-check {
  background: var(--success);
}

.option-button.wrong .option-check {
  background: var(--danger);
}

.option-button.correct {
  border-color: #86efac;
  background: var(--success-bg);
  color: #14532d;
}

.option-button.wrong {
  border-color: #fca5a5;
  background: var(--danger-bg);
  color: #7f1d1d;
}

.question-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

.question-actions #submitMultiBtn {
  flex: 1 0 100%;
}

.question-actions #prevBtn,
.question-actions #nextBtn {
  flex: 0 0 calc(50% - 5px);
}

.answer-message {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

.answer-message.ok {
  color: var(--success);
}

.answer-message.error {
  color: var(--danger);
}

.message {
  min-height: 24px;
  margin: 12px 0 0;
  line-height: 1.5;
}

.message.error {
  color: var(--danger);
  font-weight: 800;
}

.message.success {
  color: var(--success);
  font-weight: 800;
}

.round-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.52);
  padding: 18px;
}

.round-dialog {
  width: min(620px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
  padding: 22px;
}

.round-dialog h2 {
  margin: 0 0 16px;
  color: #17243a;
  font-size: 24px;
  letter-spacing: 0;
}

.round-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.round-stats article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
}

.round-stats span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.round-stats strong {
  color: var(--ink);
  font-size: 24px;
  overflow-wrap: break-word;
}

.round-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .practice-shell,
  .practice-shell.is-answering {
    align-items: stretch;
    padding: 12px;
  }

  .practice-panel {
    padding: 16px;
  }

  .practice-head,
  .captcha-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-panel {
    grid-template-columns: 1fr;
  }

  .mode-panel,
  .round-stats,
  .round-actions {
    grid-template-columns: 1fr;
  }

  .mode-panel .mode-action {
    min-height: 64px;
    font-size: 17px;
  }

  .question-panel h2 {
    font-size: 19px;
  }

  .mode-action,
  .back-link {
    width: 100%;
  }

  .question-actions #prevBtn,
  .question-actions #nextBtn {
    width: auto;
  }

  .round-dialog {
    padding: 16px;
  }
}
