/* ParaPrep, Dose Calculation Trainer (Brief 10) page styles.
   Reuses the design tokens + base components from styles.css; only adds what
   the trainer, stats panel and gating need. Shared chrome (footer-rich,
   demo-bar, gate) is duplicated per page by project convention. */

/* ---- Shared chrome (matches tracks.css / pricing.css) ---- */
.footer-rich {
  max-width: 1000px; margin: 0 auto; padding: 1.5rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between;
  color: var(--muted); font-size: .8rem;
}
.footer-rich a { color: var(--muted); }
.footer-rich a:hover { color: var(--teal-dark); }
.footer-rich .legal-links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---- Demo dev bar (only shown in demo mode) ---- */
.demo-bar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: #eef5f4; border: 1px dashed var(--teal); color: var(--teal-dark);
  border-radius: var(--radius); padding: .6rem .9rem; margin-bottom: 1.5rem; font-size: .82rem;
}
.demo-bar strong { font-weight: 700; }
.demo-bar .spacer { margin-left: auto; }
.btn.tiny { padding: .35rem .7rem; font-size: .8rem; }

/* ---- Upgrade prompt (paid gate) ---- */
.gate {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff; border-radius: var(--radius); padding: 2.2rem; box-shadow: var(--shadow);
}
.gate .lock { font-size: 2rem; }
.gate h2 { margin: .4rem 0 .5rem; font-size: 1.6rem; }
.gate p { margin: 0 0 1.2rem; opacity: .95; max-width: 60ch; }
.gate .gate-actions { display: flex; gap: .7rem; flex-wrap: wrap; }
.btn.on-teal { background: #fff; color: var(--teal-dark); }
.btn.on-teal:hover { background: #eef3ff; }
.btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); }
.gate ul.preview { margin: 1.3rem 0 0; padding: 0 0 0 1.1rem; opacity: .95; font-size: .92rem; }
.gate ul.preview li { margin: .25rem 0; }

/* ---- Controls (category picker + level) ---- */
.trainer-controls {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1.4rem;
}
.control { display: flex; flex-direction: column; gap: .3rem; }
.control label { font-size: .82rem; font-weight: 700; }
.control select {
  padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 9px;
  font-size: .92rem; background: #fff; min-width: 220px;
}
.level-readout { margin-left: auto; text-align: right; }
.level-readout .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.level-pill {
  display: inline-block; font-weight: 800; font-size: .9rem; padding: .25rem .7rem; border-radius: 999px;
  background: var(--teal-soft); color: var(--teal-dark); text-transform: capitalize;
}
.level-pill.easy { background: var(--teal-soft); color: var(--teal-dark); }
.level-pill.medium { background: var(--amber-bg); color: var(--amber); }
.level-pill.hard { background: #fbe9e7; color: var(--red); }

/* ---- Stats panel ---- */
.stats-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.4rem;
}
.stats-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.stats-head h3 { margin: 0; font-size: 1.05rem; }
.accuracy-big { font-size: 2.1rem; font-weight: 800; color: var(--teal-dark); line-height: 1; }
.accuracy-sub { color: var(--muted); font-size: .82rem; }
.cat-stats { margin-top: 1rem; display: grid; gap: .55rem; }
.cat-stat { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; align-items: center; font-size: .85rem; }
.cat-stat .cat-name { font-weight: 600; }
.cat-stat .cat-acc { font-variant-numeric: tabular-nums; color: var(--muted); }
.cat-stat .bar { grid-column: 1 / -1; height: 7px; }
.stats-empty { color: var(--muted); font-size: .88rem; margin: .6rem 0 0; }

/* ---- Problem card ---- */
.problem-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow); max-width: 720px;
}
.q-meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.q-meta .chip { background: var(--teal-soft); color: var(--teal-dark); font-size: .74rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; }
.q-meta .chip.diff { text-transform: capitalize; background: #eef2f4; color: var(--muted); }
.q-prompt { font-size: 1.15rem; font-weight: 600; margin: 0 0 1.1rem; line-height: 1.45; }

.answer-row { display: flex; gap: .6rem; align-items: stretch; flex-wrap: wrap; }
.answer-field { position: relative; display: flex; align-items: center; flex: 1 1 220px; }
.answer-field input {
  width: 100%; padding: .7rem 4.2rem .7rem 1rem; border: 1px solid var(--line);
  border-radius: 9px; font-size: 1.05rem; background: #fff; font-variant-numeric: tabular-nums;
}
.answer-field input:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
.answer-field .unit {
  position: absolute; right: .9rem; color: var(--muted); font-size: .9rem; font-weight: 700; pointer-events: none;
}
.answer-row .btn { white-space: nowrap; }

.feedback { margin: 1.1rem 0 0; padding: .9rem 1rem; border-radius: 9px; font-size: .92rem; display: none; }
.feedback.show { display: block; }
.feedback.correct { background: #e6f5ec; border: 1px solid var(--green); color: #1f5b3c; }
.feedback.incorrect { background: #fbe9e7; border: 1px solid var(--red); color: #8a2a1e; }
.feedback.invalid { background: var(--amber-bg); border: 1px solid #f0e3c4; color: var(--amber); }
.feedback strong { font-weight: 800; }
.feedback .tol { color: inherit; opacity: .8; font-size: .82rem; display: block; margin-top: .2rem; }

/* ---- Worked solution ---- */
.worked { margin: 1rem 0 0; background: var(--teal-soft); border-radius: 9px; padding: .9rem 1rem 1rem; display: none; }
.worked.show { display: block; }
.worked h4 { margin: 0 0 .5rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--teal-dark); }
.worked ol { margin: 0; padding-left: 1.2rem; }
.worked li { margin: .25rem 0; font-size: .92rem; }
.worked li:last-child { font-weight: 700; color: var(--teal-dark); }

.next-row { margin-top: 1.3rem; display: flex; gap: .7rem; flex-wrap: wrap; }

.view-hint { color: var(--muted); font-size: .85rem; margin: .2rem 0 1.4rem; }

@media (max-width: 620px) {
  .control select { min-width: 0; width: 100%; }
  .level-readout { margin-left: 0; text-align: left; }
  .answer-row .btn { width: 100%; }
}
