/* Lucas's Utah Driver Exam Trainer */
@font-face { font-family: 'Baloo 2'; src: url('/fonts/Baloo2-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('/fonts/Baloo2-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('/fonts/Baloo2-ExtraBold.ttf') format('truetype'); font-weight: 800; font-display: swap; }

:root {
  --blue: #1d4e89;
  --blue-dark: #14365f;
  --gold: #f2b134;
  --green: #2e9e5b;
  --green-bg: #e8f7ee;
  --red: #d64545;
  --red-bg: #fdeaea;
  --ink: #22303f;
  --muted: #6b7a8c;
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #dde5ee;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(20, 54, 95, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Baloo 2', Inter, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
#topbar {
  background: var(--blue);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-car { font-size: 26px; }
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: .2px; }
.brand-state {
  background: var(--gold); color: var(--blue-dark);
  font-weight: 800; font-size: 12px; letter-spacing: 1.5px;
  padding: 3px 10px; border-radius: 999px;
}
#topbar-progress { font-size: 14px; opacity: .95; font-weight: 700; }

/* ---------- layout ---------- */
#app { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 22px 16px 60px; }
#foot {
  text-align: center; font-size: 13px; color: var(--muted);
  padding: 16px; border-top: 1px solid var(--line); background: #fff;
}
#foot a { color: var(--blue); }
.loading { text-align: center; color: var(--muted); padding: 60px 0; font-size: 18px; }

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

h1 { font-size: 28px; font-weight: 800; margin: 0 0 6px; }
h2 { font-size: 21px; font-weight: 800; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 15px; margin: 0 0 14px; }

/* ---------- buttons ---------- */
.btn {
  font-family: inherit; font-weight: 800; font-size: 17px;
  border: none; border-radius: 12px; cursor: pointer;
  padding: 13px 22px; transition: transform .06s, filter .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-gold { background: var(--gold); color: var(--blue-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-ghost { background: transparent; color: var(--blue); border: 2px solid var(--blue); }
.btn-danger-ghost { background: transparent; color: var(--red); border: 2px solid var(--red); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- home ---------- */
.mode-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.mode-card { display: flex; flex-direction: column; gap: 8px; }
.mode-card .big-emoji { font-size: 34px; }
.locked-note {
  background: #fff7e6; border: 1px solid #f4d999; color: #7a5c14;
  border-radius: 10px; padding: 10px 14px; font-size: 14px; font-weight: 700;
}
.topic-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 15px; }
.topic-row .tname { flex: 1; font-weight: 700; }
.topic-row .tcount { color: var(--muted); font-size: 13px; min-width: 86px; text-align: right; }
.bar { flex: 2; height: 12px; border-radius: 999px; background: #e7edf5; overflow: hidden; position: relative; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.bar .done { background: var(--green); }
.bar .seen { background: #9db9dd; }
.attempt-list { margin: 8px 0 0; padding: 0; list-style: none; }
.attempt-list li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border-radius: 10px; margin-bottom: 6px;
  background: var(--bg); font-size: 15px; font-weight: 700;
}
.pass-chip { color: var(--green); }
.fail-chip { color: var(--red); }

/* ---------- study / exam question ---------- */
.q-meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
  font-size: 14px; color: var(--muted); font-weight: 700;
}
.chip {
  background: #e8effa; color: var(--blue); border-radius: 999px;
  padding: 3px 12px; font-size: 13px; font-weight: 800;
}
.chip-streak { background: #fff3d6; color: #8a6410; }
.q-text { font-size: 21px; font-weight: 800; line-height: 1.35; margin: 4px 0 14px; }
.q-visual { display: flex; justify-content: center; margin: 6px 0 16px; }
.q-visual svg { max-width: 170px; height: auto; filter: drop-shadow(0 3px 5px rgba(0,0,0,.18)); }

.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  font-family: inherit; font-size: 17px; font-weight: 700; color: var(--ink);
  background: var(--bg); border: 2px solid var(--line); border-radius: 12px;
  padding: 13px 15px; cursor: pointer; transition: border-color .12s, background .12s;
}
.choice:hover:not(:disabled) { border-color: var(--blue); background: #eef4fc; }
.choice:disabled { cursor: default; }
.choice .letter {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.choice.correct { border-color: var(--green); background: var(--green-bg); }
.choice.correct .letter { background: var(--green); }
.choice.wrong { border-color: var(--red); background: var(--red-bg); }
.choice.wrong .letter { background: var(--red); }
.choice.picked-exam { border-color: var(--blue); background: #e2ecfa; }

/* feedback panel */
.feedback { border-radius: 14px; padding: 16px 18px; margin-top: 16px; }
.feedback.good { background: var(--green-bg); border: 2px solid var(--green); }
.feedback.bad { background: var(--red-bg); border: 2px solid var(--red); }
.feedback h3 { margin: 0 0 6px; font-size: 19px; }
.feedback.good h3 { color: var(--green); }
.feedback.bad h3 { color: var(--red); }
.feedback .expl { font-size: 16px; line-height: 1.45; }
.feedback .correct-answer { font-weight: 800; margin: 6px 0; }
.feedback .fb-visual { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.feedback .fb-visual svg { max-width: 130px; height: auto; }
.fb-visual-caption { font-size: 14px; color: var(--muted); font-weight: 700; max-width: 220px; }

/* exam question nav grid */
.exam-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.exam-nav button {
  width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--line);
  background: #fff; font-family: inherit; font-weight: 800; font-size: 13px;
  cursor: pointer; color: var(--muted);
}
.exam-nav button.answered { background: var(--blue); border-color: var(--blue); color: #fff; }
.exam-nav button.current { outline: 3px solid var(--gold); }

/* ---------- results ---------- */
.result-hero { text-align: center; padding: 30px 20px; }
.result-hero .score-big { font-size: 62px; font-weight: 800; line-height: 1; }
.result-hero .verdict { font-size: 30px; font-weight: 800; margin: 8px 0 4px; }
.verdict.pass { color: var(--green); }
.verdict.fail { color: var(--red); }
.result-hero .sub { font-size: 16px; }
.review-item { border-left: 5px solid var(--red); padding-left: 14px; margin-bottom: 20px; }
.review-item .rq { font-weight: 800; font-size: 17px; margin-bottom: 4px; }
.review-item .r-yours { color: var(--red); font-weight: 700; }
.review-item .r-correct { color: var(--green); font-weight: 800; }
.review-item .r-expl { font-size: 15px; color: var(--ink); margin-top: 4px; line-height: 1.4; }
.review-item svg { max-width: 110px; margin-top: 8px; }

/* live availability */
.avail-box {
  background: #eef6ff; border: 1.5px solid #bcd6f2; border-radius: 12px;
  padding: 12px 14px; font-size: 14px; margin-bottom: 10px; color: var(--ink);
}
.avail-head { font-size: 15px; margin-bottom: 6px; }
.avail-day { margin: 3px 0; }
.avail-foot { margin-top: 8px; font-size: 12px; color: var(--muted); font-weight: 700; }
.avail-foot a, .avail-box a { color: var(--blue); }

/* keep-choosing + recap */
.try-again {
  margin-top: 14px; padding: 12px 16px; border-radius: 12px;
  background: #fff3d6; border: 2px solid var(--gold); color: #7a5c14;
  font-weight: 800; font-size: 16px;
}
.recap-item {
  background: #fff; border: 1.5px solid #f0c9c9; border-radius: 10px;
  padding: 10px 14px; margin: 8px 0;
}
.recap-pick { font-weight: 800; color: var(--red); font-size: 15px; }
.recap-why { font-size: 15px; line-height: 1.4; margin-top: 3px; }
.r-why { font-size: 14px; color: #a03030; margin: 2px 0; }

/* progress log */
.log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.log-table th { text-align: left; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 2px solid var(--line); }
.log-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.log-table .log-q { max-width: 340px; }
.pick-bad { color: var(--red); font-weight: 800; }
.pick-good { color: var(--green); font-weight: 800; }

/* confetti */
.confetti { position: fixed; top: -12px; border-radius: 3px; z-index: 999; pointer-events: none;
  animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }

@media (max-width: 560px) {
  .brand-name { font-size: 16px; }
  .q-text { font-size: 18px; }
  .choice { font-size: 15px; }
  h1 { font-size: 23px; }
}
