/* Walker's Lifesaving Trainer — teal-on-white minimalist with confetti results.
   Matches the 2026-05-02 design mockups: pill category badges, white option pills
   with teal outline + radio circles, trophy + confetti results screen. */

:root {
  --teal:      #1aa6a6;
  --teal-deep: #148c8c;
  --teal-soft: rgba(26, 166, 166, 0.10);
  --teal-mid:  rgba(26, 166, 166, 0.40);
  --ink:       #0f1d2c;
  --ink-soft:  #5a6573;
  --rule:      #e5e9ee;
  --rule-strong: #c8d0d9;
  --bg:        #ffffff;
  --bg-soft:   #f6f9fb;
  --good:      #14a86b;
  --bad:       #c83545;
  --navy:      #173b6a;
  --shadow-sm: 0 1px 2px rgba(15, 29, 44, 0.04);
  --shadow:    0 4px 16px rgba(15, 29, 44, 0.06);
  --radius:    14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 24px) 20px max(env(safe-area-inset-bottom), 32px);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.screen { display: none; }
.screen.active { display: block; animation: fadeIn 200ms ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Home: hero ─────────────────────────────── */
.hero { text-align: center; padding: 24px 8px 18px; }
.hero-emblem { font-size: 40px; line-height: 1; }
.hero h1 {
  margin: 14px 0 6px;
  font-size: clamp(26px, 6vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.hero-sub { color: var(--ink-soft); margin: 0 auto; max-width: 36ch; font-size: 15px; }

.progress-chip {
  display: block;
  width: max-content;
  margin: 8px auto 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--teal-deep);
  background: var(--teal-soft);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
}

/* ── Home: paths ─────────────────────────────── */
.paths { display: grid; gap: 12px; margin: 28px 0 32px; }
.path {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 12px;
  background: var(--bg);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}
.path:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.path:active { transform: scale(0.99); }
.path--primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.path--primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.path--primary .path-meta { color: rgba(255, 255, 255, 0.78); }
.path--primary .path-desc { color: rgba(255, 255, 255, 0.86); }
.path--primary .path-name { color: #fff; }
.path-name { grid-column: 1; grid-row: 1; font-size: 18px; font-weight: 700; letter-spacing: -0.005em; }
.path-meta {
  grid-column: 2; grid-row: 1; align-self: center;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.path-desc { grid-column: 1 / -1; grid-row: 2; color: var(--ink-soft); font-size: 14px; }
.path-arrow { display: none; }

/* ── Home: categories ─────────────────────── */
.categories { margin: 28px 0 16px; }
.categories h2 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft); margin: 0 0 12px;
}
.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cat-link {
  width: 100%;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color 160ms ease, transform 120ms ease;
}
.cat-link:hover { border-color: var(--teal); }
.cat-link:active { transform: scale(0.995); }
.cat-link[disabled] { opacity: 0.5; cursor: not-allowed; }
.cat-icon {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--teal-soft); color: var(--teal-deep);
  border-radius: var(--radius-pill);
  font-size: 18px;
}
.cat-name { font-weight: 600; color: var(--ink); }
.cat-count {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
}

/* ── Home: misc ─────────────────────────── */
.last-result { margin: 18px 0 0; text-align: center; font-size: 13px; color: var(--ink-soft); }
.install {
  display: block; margin: 24px auto 0; padding: 11px 18px;
  font-size: 14px; font-weight: 600;
  background: transparent; color: var(--teal-deep);
  border: 1.5px solid var(--teal); border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.install:hover { background: var(--teal); color: #fff; }
.colophon {
  margin: 48px 0 0; padding-top: 20px;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft); font-size: 12px; line-height: 1.55;
}
.colophon p { margin: 0; }

/* ── Quiz screen ─────────────────────────── */
.quiz-bar { display: flex; align-items: center; gap: 14px; padding: 4px 0 18px; }
.back {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1.5px solid var(--rule);
  background: var(--bg); color: var(--ink);
  font-size: 18px; flex-shrink: 0;
  transition: border-color 160ms ease;
}
.back:hover { border-color: var(--teal); }
.progress-track {
  flex: 1; height: 5px;
  background: var(--rule);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--teal);
  transition: width 240ms ease;
  width: 0%;
  border-radius: var(--radius-pill);
}

.quiz-body { padding: 0 0 24px; text-align: center; }
.quiz-counter {
  font-size: 14px; color: var(--teal-deep);
  font-weight: 600; margin: 0 0 14px;
  font-variant-numeric: tabular-nums;
}
.cat-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--teal-soft); color: var(--teal-deep);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-weight: 600; font-size: 14px;
  margin: 0 auto 26px;
}
.cat-pill-icon { font-size: 16px; line-height: 1; }

.question {
  font-size: clamp(20px, 4.5vw, 24px);
  line-height: 1.32; font-weight: 700;
  color: var(--ink);
  margin: 0 auto 28px; letter-spacing: -0.01em;
  text-align: left; max-width: 38ch;
}

.options { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; text-align: left; }
.option {
  display: flex; width: 100%;
  align-items: center; gap: 14px;
  background: var(--bg);
  border: 1.5px solid var(--teal-mid);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 15px; line-height: 1.4; color: var(--ink);
  transition: border-color 160ms ease, background 160ms ease, transform 120ms ease;
}
.option:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-soft); }
.option:active:not(:disabled) { transform: scale(0.995); }
.option-radio {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  background: var(--bg);
  flex-shrink: 0; position: relative;
}
.option.correct { border-color: var(--good); background: rgba(20, 168, 107, 0.06); color: var(--ink); }
.option.correct .option-radio { border-color: var(--good); background: var(--good); }
.option.correct .option-radio::after {
  content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #fff;
}
.option.incorrect { border-color: var(--bad); background: rgba(200, 53, 69, 0.06); }
.option.incorrect .option-radio { border-color: var(--bad); background: var(--bad); }
.option:disabled { cursor: default; }

.feedback {
  margin-top: 24px; padding: 16px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-align: left;
}
.verdict { font-weight: 700; font-size: 15px; margin: 0 0 8px; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.explain { color: var(--ink-soft); margin: 0 0 16px; font-size: 14px; line-height: 1.55; }

/* ── Buttons ───────────────────────────── */
.primary, .secondary {
  font-size: 15px; font-weight: 600;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 120ms ease;
}
.primary { background: var(--navy); color: #fff; border: 1.5px solid var(--navy); }
.primary:hover { background: #112c52; }
.primary:active { transform: scale(0.99); }
.secondary { background: var(--bg); color: var(--teal-deep); border: 1.5px solid var(--teal); }
.secondary:hover { background: var(--teal-soft); }
.btn-icon { font-size: 16px; line-height: 1; }

/* ── Results ───────────────────────────── */
.results-head {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  margin-bottom: 4px;
}
.results-title { text-align: center; font-size: 18px; font-weight: 700; margin: 0; }
.back-spacer { width: 36px; height: 36px; }

.trophy-stage {
  position: relative;
  margin: 8px auto 18px;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 320 / 280;
}
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.trophy-disc {
  position: absolute;
  inset: 24px 50% auto 50%;
  transform: translateX(-50%);
  width: 220px; height: 220px;
  background: var(--bg);
  border: 2px solid var(--teal-soft);
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 0 0 8px rgba(26, 166, 166, 0.04);
}
.trophy-icon { font-size: 38px; line-height: 1; margin-bottom: 6px; }
.score {
  font-size: 42px; font-weight: 800;
  color: var(--teal-deep); line-height: 1;
  margin: 4px 0 6px; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.score-pct {
  font-size: 22px; font-weight: 700;
  color: var(--teal); margin: 0;
  font-variant-numeric: tabular-nums;
}

.results-sub { text-align: center; margin: 8px 0 28px; color: var(--ink-soft); font-size: 14px; }

.weak { margin-bottom: 24px; }
.weak-title { font-size: 16px; font-weight: 700; color: var(--ink); margin: 0 0 14px; }
.weak-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.weak-list li {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 12px;
  align-items: center;
}
.weak-name { font-size: 14px; color: var(--ink); font-weight: 500; }
.weak-bar {
  height: 8px;
  background: var(--rule);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.weak-bar-fill {
  height: 100%; background: var(--teal);
  border-radius: var(--radius-pill);
  transition: width 280ms ease;
}
.weak-pct {
  font-size: 12px; color: var(--teal-deep); font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 32px; text-align: right;
}

.results-actions { display: grid; gap: 10px; margin-top: 12px; }

@media (max-width: 380px) {
  .weak-list li { grid-template-columns: 100px 1fr auto; }
  .question { font-size: 18px; }
}
