/* Walker's Lifesaving Trainer — Lifeguard Prep visual language
   (wave header, SVG lifebuoy+tower logo, letterspaced caps tagline,
    SVG icons throughout, no emoji). */

: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);
  --shadow-path: 0 8px 24px rgba(26, 166, 166, 0.18);
  --radius:      14px;
  --radius-sm:   10px;
  --radius-lg:   18px;
  --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;
  overflow-x: hidden;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 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: wave header band ─────────────────── */
.hero-waves {
  display: block;
  width: calc(100% + 40px);
  margin: 0 -20px 0;
  height: clamp(110px, 24vw, 150px);
  margin-top: max(env(safe-area-inset-top), 0px);
}

/* ── Home: hero ─────────────────────────────── */
.hero {
  text-align: center;
  padding: 8px 8px 4px;
  margin-top: -28px;
  position: relative;
}
.hero-logo {
  display: block;
  width: clamp(120px, 32vw, 150px);
  height: clamp(120px, 32vw, 150px);
  margin: 0 auto 18px;
  filter: drop-shadow(0 6px 14px rgba(26, 166, 166, 0.18));
}
.hero-title {
  margin: 0 0 10px;
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1.1;
}
.tagline {
  margin: 0 auto;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal-deep);
}

.progress-chip {
  display: block;
  width: max-content;
  margin: 18px 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: 14px; margin: 32px 0 36px; }
.path {
  display: grid;
  grid-template-columns: 56px 1fr 24px;
  align-items: center;
  gap: 16px;
  background: var(--bg);
  border: 2px solid var(--teal);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  transition: transform 120ms ease, box-shadow 200ms ease;
}
.path:hover { box-shadow: var(--shadow-path); }
.path:active { transform: scale(0.99); }

.path--primary {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
  box-shadow: 0 6px 20px rgba(26, 166, 166, 0.28);
}
.path--primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); }

.path-icon {
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.path-icon svg { width: 100%; height: 100%; }
.path--primary .path-icon { color: #fff; }
.path--secondary .path-icon { color: var(--teal); }

.path-label {
  display: grid;
  grid-template-rows: auto auto;
  gap: 2px;
}
.path-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.path-meta {
  display: none;
}
.path-desc {
  font-size: 13px;
  line-height: 1.35;
  opacity: 0.85;
}
.path--primary .path-desc { color: rgba(255, 255, 255, 0.9); }
.path--secondary .path-name { color: var(--teal-deep); }
.path--secondary .path-desc { color: var(--ink-soft); }
.path-arrow {
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  align-self: center;
  opacity: 0.85;
}
.path--primary .path-arrow { color: #fff; }
.path--secondary .path-arrow { color: var(--teal); }

/* ── Home: categories ─────────────────────── */
.categories { margin: 28px 0 16px; }
.categories h2 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; 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: 14px;
  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);
  flex-shrink: 0;
}
.cat-icon svg { width: 20px; height: 20px; }
.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: max(env(safe-area-inset-top), 16px) 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 {
  display: inline-flex; align-items: center; justify-content: center;
}
.cat-pill-icon svg { width: 18px; height: 18px; }

.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: 10px; 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 {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
}
.btn-icon svg { width: 100%; height: 100%; }

/* ── Results ───────────────────────────── */
.results-head {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  margin-bottom: 4px;
  padding-top: max(env(safe-area-inset-top), 16px);
}
.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-svg { width: 56px; height: 56px; margin-bottom: 4px; }
.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; }
  .path { grid-template-columns: 48px 1fr 20px; padding: 16px 18px; }
  .path-icon { width: 48px; height: 48px; }
  .path-name { font-size: 20px; }
}

/* ── Study Guide screen ─────────────────────────── */
.study-head {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 14px;
  padding: max(env(safe-area-inset-top), 16px) 0 4px;
}
.study-title { text-align: center; font-size: 18px; font-weight: 700; margin: 0; }

.study-intro {
  margin: 8px 0 18px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}

.study-toc {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 0 0 28px;
}
.study-toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.study-toc-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: baseline;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  transition: background 140ms ease;
}
.study-toc-link:hover { background: var(--teal-soft); }
.study-toc-id {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal-deep);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}
.study-toc-title { color: var(--ink); font-weight: 500; }

.study-body { display: grid; gap: 32px; padding-bottom: 24px; }

.study-section {
  scroll-margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow-sm);
}
.study-section-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
  margin-bottom: 16px;
}
.study-section-id {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--teal); color: #fff;
  font-weight: 700; font-size: 12px;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}
.study-section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.study-section-lede {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 14px;
  font-style: italic;
  line-height: 1.5;
}

.study-section-summary {
  display: block;
  margin: 0 0 22px;
  padding: 14px 16px 16px;
  background: var(--teal-soft);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.study-section-summary-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: 6px;
}
.study-section-summary p {
  margin: 0;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
}

.study-topic { margin-bottom: 18px; }
.study-topic:last-child { margin-bottom: 0; }
.study-topic-heading {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--teal-deep);
  letter-spacing: -0.005em;
}
.study-bullets {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
}
.study-bullets li { padding-left: 2px; }
.study-bullets li::marker { color: var(--teal); }

@media (max-width: 380px) {
  .study-section { padding: 18px 16px 14px; }
  .study-section-title { font-size: 16px; }
  .study-bullets { font-size: 14px; padding-left: 18px; }
}
