:root {
  --bg: #f6f7f2;
  --surface: #ffffff;
  --ink: #16211f;
  --muted: #66736d;
  --line: #dce2dc;
  --teal: #0f766e;
  --teal-dark: #0b5c56;
  --amber: #b7791f;
  --rose: #be3a4a;
  --green: #168457;
  --shadow: 0 14px 40px rgba(22, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 260px),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px calc(92px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 2px 14px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.08;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--teal-dark);
  font-size: 22px;
  box-shadow: var(--shadow);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  min-width: 0;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
}

.stat span {
  display: block;
  font-size: 18px;
  font-weight: 800;
}

.stat small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.stat.danger span {
  color: var(--rose);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9eee8;
}

.segment {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment.active {
  background: var(--surface);
  color: var(--teal-dark);
  box-shadow: 0 4px 12px rgba(22, 33, 31, 0.08);
}

.question-panel,
.answer-panel,
.list-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.question-panel {
  padding: 16px;
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e2f3ef;
  color: var(--teal-dark);
}

.pill.multi {
  background: #fff2d8;
  color: var(--amber);
}

.question-text {
  margin: 14px 0 16px;
  font-size: 17px;
  line-height: 1.58;
}

.review-toggle {
  width: 100%;
  min-height: 38px;
  margin-top: 12px;
  border: 1px solid #b9d8d3;
  border-radius: 8px;
  background: #eef8f6;
  color: var(--teal-dark);
  font-weight: 800;
}

.review-toggle.active {
  background: var(--teal);
  color: #fff;
}

.review-panel {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.review-head strong {
  color: var(--teal-dark);
  font-size: 13px;
}

.review-panel {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.review-panel img {
  display: block;
  width: 680px;
  max-width: none;
  height: auto;
  border-radius: 6px;
  background: #fff;
}

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

.option {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  text-align: left;
}

.option .label {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #eef2ee;
  color: var(--muted);
  font-weight: 800;
}

.option .text {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.48;
}

.option.selected {
  border-color: var(--teal);
  background: #edf8f5;
}

.option.selected .label,
.option.correct .label {
  background: var(--green);
  color: #fff;
}

.option.wrong {
  border-color: rgba(190, 58, 74, 0.55);
  background: #fff1f3;
}

.option.wrong .label {
  background: var(--rose);
  color: #fff;
}

.answer-panel {
  margin-top: 12px;
  padding: 14px;
}

.answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.answer-head strong {
  font-size: 16px;
}

.answer-head span {
  color: var(--teal-dark);
  font-weight: 800;
}

.answer-panel p {
  margin: 8px 0 0;
  color: #27332f;
  line-height: 1.55;
}

.option-reasons {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.reason-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 9px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.reason-row .reason-label {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eef2ee;
  color: var(--muted);
  font-weight: 800;
}

.reason-row.correct {
  border-color: rgba(22, 132, 87, 0.35);
  background: #effaf4;
}

.reason-row.correct .reason-label {
  background: var(--green);
  color: #fff;
}

.reason-row.wrong {
  border-color: rgba(190, 58, 74, 0.25);
}

.reason-row.wrong .reason-label {
  background: #f7d8dd;
  color: var(--rose);
}

.reason-body strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.reason-body p {
  margin: 0;
  color: #27332f;
  line-height: 1.5;
}

.tip {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--amber) !important;
  font-weight: 700;
}

.bottom-actions {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 8px;
  width: min(100%, 760px);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: rgba(246, 247, 242, 0.92);
  backdrop-filter: blur(16px);
}

.primary-btn,
.secondary-btn {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-btn {
  border: 0;
  background: var(--teal);
  color: #fff;
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.45;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--teal-dark);
}

#submitBtn {
  width: 100%;
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

.list-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
}

.jump-row {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 46px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.jump-row button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: #e2f3ef;
  color: var(--teal-dark);
  font-weight: 800;
}

.jump-row p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (max-width: 390px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .stats-grid {
    gap: 6px;
  }

  .stat {
    padding-left: 4px;
    padding-right: 4px;
  }

  .question-panel {
    padding: 14px;
  }

  .question-text {
    font-size: 16px;
  }

  .bottom-actions {
    padding-left: 10px;
    padding-right: 10px;
  }
}
