/* 正源左右辨别训练 — clean clinic style, mobile first, no dependencies. */
:root {
  --gold: #b08a2e;
  --gold-dark: #8f6f22;
  --ink: #2f3a37;
  --muted: #6b7a76;
  --line: #e3e8e6;
  --bg: #ffffff;
  --soft: #f4f6f5;
  --good: #1e7d4f;
  --bad: #c0392b;
  --warn: #b7791f;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

.brand {
  text-align: center;
  padding: 22px 16px 8px;
  border-bottom: 3px solid var(--gold);
}
.brand-name {
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--muted);
}
.brand h1 {
  margin: 6px 0 10px;
  font-size: 26px;
  line-height: 1.3;
  color: var(--ink);
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

h2 { font-size: 20px; margin: 22px 0 10px; }
h3 { font-size: 17px; margin: 22px 0 10px; }

.intro { margin: 6px 0 18px; color: var(--ink); }
.hint { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.error { color: var(--bad); }

/* Region cards */
.region-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.region-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.region-card:active { border-color: var(--gold); background: #fbf7ea; }
.region-card:disabled { opacity: 0.55; cursor: default; }
.region-name { font-size: 19px; font-weight: 700; }
.region-meta { margin-top: 6px; font-size: 14px; color: var(--muted); }
.region-best { margin-top: 2px; font-size: 14px; color: var(--gold-dark); font-weight: 700; }

/* History */
.history-list { display: grid; gap: 8px; }
.history-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
}
.history-row .h-date { color: var(--muted); }
.history-empty { color: var(--muted); font-size: 15px; }

/* Session */
.session-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.progress-wrap { flex: 1; }
.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
}
.progress-bar {
  height: 8px;
  background: var(--soft);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.timer-bar {
  height: 4px;
  background: var(--soft);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}
.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--gold);
}
.timer-fill.run { transition: width 3s linear; width: 0; }

.stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--soft);
  aspect-ratio: 1 / 1;
}
.stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f4f6f5;
}
.badge-placeholder {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(47, 58, 55, 0.85);
  color: #fff;
  font-size: 13px;
  padding: 3px 9px;
  border-radius: 20px;
}
.feedback {
  position: absolute;
  inset: auto 0 0 0;
  padding: 14px 12px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: #fff;
}
.feedback.good { background: rgba(30, 125, 79, 0.92); }
.feedback.bad { background: rgba(192, 57, 43, 0.92); }
.feedback.timeout { background: rgba(183, 121, 31, 0.94); }

.answer-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

/* Buttons */
.btn {
  font: inherit;
  font-size: 18px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 56px;
}
.btn:active { background: var(--soft); }
.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
  font-weight: 700;
}
.btn-primary:active { background: var(--gold-dark); }
.btn-ghost {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 15px;
}
.btn-answer {
  min-height: 72px;
  font-size: 26px;
  font-weight: 700;
  border: 2px solid var(--gold);
  color: var(--gold-dark);
}
.btn-answer:active { background: #fbf7ea; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* Results */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  background: var(--soft);
}
.stat-num { font-size: 26px; font-weight: 800; color: var(--gold-dark); }
.stat-label { font-size: 14px; color: var(--muted); margin-top: 2px; }

.miss-list { display: grid; gap: 10px; }
.miss-row {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}
.miss-row img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: #f4f6f5;
  border-radius: 8px;
  flex: none;
}
.miss-text { font-size: 15px; line-height: 1.5; }
.miss-none { color: var(--muted); }
.miss-none.good { color: var(--good); font-weight: 700; }

.result-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

footer {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 28px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* About: what this training is for */
.about { margin-top: 8px; }
.about h3 { margin: 18px 0 6px; color: var(--gold-dark); }
.about p { margin: 6px 0; font-size: 16px; }
.about ul { margin: 6px 0; padding-left: 20px; font-size: 16px; }
.about li { margin: 4px 0; }
.about .note { font-size: 14px; color: var(--muted); }

@media (min-width: 560px) {
  .stat-grid { grid-template-columns: 1fr 1fr 1fr; }
}
