:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e4e9f2;
  --text: #1f2733;
  --muted: #6b7787;
  --brand: #2b6cf6;
  --brand-soft: #eaf1ff;
  --ok: #17a673;
  --ok-soft: #e6f7f1;
  --bad: #e5484d;
  --bad-soft: #fdecec;
  --warn: #d9822b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: 78px; }

a { color: var(--brand); text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 { font-size: 17px; margin: 0; flex: 1; }
.topbar .sub { font-size: 12px; color: var(--muted); }

.wrap { max-width: 900px; margin: 0 auto; padding: 14px 14px 40px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.card h2 { font-size: 15px; margin: 0 0 10px; }

.grid { display: grid; gap: 10px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 620px) {
  .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.stat b { display: block; font-size: 22px; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--muted); }

button, .btn {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: 0.15s;
}

button:hover, .btn:hover { border-color: #c9d4e6; }

button.primary, .btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
button.primary:hover { background: #1f5be0; }

button.ghost { background: transparent; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  margin: 0 6px 6px 0;
}

.chip.sel { background: var(--brand); color: #fff; }
.chip.gray { background: #eef1f6; color: var(--muted); }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); font-size: 13px; }

.q-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
}
.q-head .no { font-weight: 600; color: var(--brand); }

.stem { font-size: 16px; line-height: 1.8; word-break: break-word; }
.stem img { max-width: 100%; height: auto; }
.stem p { margin: 0 0 6px; }

.opts { margin-top: 14px; display: grid; gap: 10px; }

.opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  cursor: pointer;
  background: #fff;
  line-height: 1.7;
}
.opt:hover { border-color: #bcd0f5; }
.opt .badge {
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #cbd5e6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 auto;
}
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.sel .badge { border-color: var(--brand); color: var(--brand); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .badge { border-color: var(--ok); color: var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .badge { border-color: var(--bad); color: var(--bad); }
.opt img { max-width: 100%; }
.opt p { margin: 0 0 4px; }

textarea, input[type="text"], input[type="number"], select {
  font: inherit;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 92px; resize: vertical; }

.verdict {
  margin-top: 14px;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 600;
}
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); }

.analysis {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fbfcff;
  line-height: 1.85;
  font-size: 15px;
}
.analysis img { max-width: 100%; }
.analysis .ans { color: var(--ok); font-weight: 700; }

.kbox {
  margin-top: 10px;
  border-radius: 10px;
  border: 1px dashed #cdd8ea;
  background: #f7f9fd;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.8;
}
.kbox b { color: var(--brand); }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav button {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 10px 4px 9px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bottom-nav button.on { color: var(--brand); font-weight: 600; }
.bottom-nav .ico { font-size: 17px; }

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #e8edf6;
  overflow: hidden;
}
.progress-bar i { display: block; height: 100%; background: var(--brand); }

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.list-item:last-child { border-bottom: none; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: rgba(31, 39, 51, 0.92);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  z-index: 60;
}
.toast.show { opacity: 1; }

.hidden { display: none !important; }

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.timer.warn { color: var(--bad); }
