/* Praxis theme — teal accent, plus the learning-specific components. */

:root {
  --accent-50:  #e8f6f4;
  --accent-100: #cdebe7;
  --accent-300: #7fcac1;
  --accent-500: #178a7c;
  --accent-600: #126e63;
  --accent-700: #0d554c;
  --accent-contrast: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-50:  #0d2724;
    --accent-100: #123430;
    --accent-300: #2f8477;
    --accent-500: #4fd1bd;
    --accent-600: #74dccb;
    --accent-700: #9ae7da;
    --accent-contrast: #05201c;
  }
}

:root[data-theme="dark"] {
  --accent-50:#0d2724; --accent-100:#123430; --accent-300:#2f8477;
  --accent-500:#4fd1bd; --accent-600:#74dccb; --accent-700:#9ae7da; --accent-contrast:#05201c;
}

/* ---------------------------- mastery bands --------------------------- *
 * Five bands, not a percentage bar, because "0.82" means nothing to a
 * learner and "nearly there" does. The number is still shown on hover.
 * --------------------------------------------------------------------- */

.band {
  display: inline-flex; align-items: center; gap: .35em;
  font-size: .72rem; font-weight: 680; letter-spacing: .015em;
  padding: .12em .62em; border-radius: var(--radius-pill);
  border: 1px solid; white-space: nowrap;
}
.band--mastered   { background: var(--ok-bg);     color: var(--ok-fg);     border-color: var(--ok-border); }
.band--strong     { background: var(--accent-50); color: var(--accent-700); border-color: var(--accent-300); }
.band--developing { background: var(--info-bg);   color: var(--info-fg);   border-color: var(--info-border); }
.band--shaky      { background: var(--warn-bg);   color: var(--warn-fg);   border-color: var(--warn-border); }
.band--new        { background: var(--bg-sunken); color: var(--text-subtle); border-color: var(--border); }

/* A five-segment mastery track. Segments, not a smooth bar, so progress
   reads as discrete steps rather than an arbitrary-precision measurement. */
.mastery { display: flex; gap: 2px; height: 8px; }
.mastery__seg {
  flex: 1; border-radius: 2px; background: var(--bg-sunken);
  border: 1px solid var(--border); transition: background var(--transition);
}
.mastery__seg--on { background: var(--accent-500); border-color: var(--accent-500); }
.mastery__seg--on.mastery__seg--warn { background: var(--warn-fg); border-color: var(--warn-fg); }

/* ------------------------------ question ------------------------------ */

.stem {
  font-size: 1.22rem; line-height: 1.55; font-weight: 500;
  white-space: pre-wrap; margin: 0 0 var(--space-5) 0;
}
.stem code, .stem .mono { font-size: .95em; }

.choices { display: grid; gap: var(--space-3); }
.choice {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4); border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elevated); cursor: pointer; text-align: left; width: 100%;
  transition: border-color var(--transition), background var(--transition);
}
.choice:hover { border-color: var(--accent-300); background: var(--bg-hover); }
.choice input { margin-top: .22em; flex: none; }
.choice--correct { border-color: var(--ok-border); background: var(--ok-bg); }
.choice--chosen-wrong { border-color: var(--bad-border); background: var(--bad-bg); }
.choice__key {
  flex: none; width: 1.7em; height: 1.7em; border-radius: 50%;
  display: grid; place-items: center; font-size: .78rem; font-weight: 700;
  background: var(--bg-sunken); color: var(--text-muted); border: 1px solid var(--border);
}

/* ------------------------------- hints -------------------------------- *
 * Rungs of a ladder, drawn as one. Spent rungs stay visible: the learner
 * should be able to see how much help they took, because that is the thing
 * worth noticing about their own practice.
 * --------------------------------------------------------------------- */

.ladder { display: grid; gap: var(--space-3); margin: var(--space-4) 0; }
.rung {
  display: grid; grid-template-columns: auto 1fr; gap: var(--space-3);
  align-items: start; padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--accent-300); background: var(--accent-50);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.rung--orient { border-left-color: var(--border-strong); background: var(--bg-sunken); }
.rung--solution { border-left-color: var(--ok-border); background: var(--ok-bg); }
.rung__n {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); padding-top: .15em; white-space: nowrap;
}
.rung__text { margin: 0; line-height: 1.55; }

/* --------------------------- result banner ---------------------------- */

.verdict {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5); border-radius: var(--radius);
  border: 1px solid; font-weight: 600; margin-bottom: var(--space-5);
}
.verdict--right { background: var(--ok-bg);  color: var(--ok-fg);  border-color: var(--ok-border); }
.verdict--wrong { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-border); }
.verdict__mark { font-size: 1.4rem; line-height: 1; }
.verdict__delta { margin-left: auto; font-variant-numeric: tabular-nums; font-size: .85rem; font-weight: 500; }

/* --------------------------- "why this one" --------------------------- *
 * The selector's reasoning, shown rather than hidden. An adaptive system
 * that cannot say why it picked something is indistinguishable from one
 * picking at random, and this is where a learner can check.
 * --------------------------------------------------------------------- */

.why {
  font-size: .82rem; color: var(--text-muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: var(--space-3) var(--space-4); background: var(--bg-sunken);
}
.why__bars { display: grid; gap: 3px; margin-top: var(--space-3); }
.why__bar { display: grid; grid-template-columns: 8.5em 1fr 3em; gap: var(--space-2); align-items: center; }
.why__track { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.why__fill { height: 100%; background: var(--accent-500); }
.why__fill--neg { background: var(--warn-fg); }

/* ------------------------------ streak -------------------------------- */

.streak { display: flex; gap: 3px; }
.streak__day {
  width: 11px; height: 11px; border-radius: 2px;
  background: var(--bg-sunken); border: 1px solid var(--border);
}
.streak__day--l1 { background: var(--accent-100); border-color: var(--accent-300); }
.streak__day--l2 { background: var(--accent-300); border-color: var(--accent-300); }
.streak__day--l3 { background: var(--accent-500); border-color: var(--accent-500); }
.streak__day--l4 { background: var(--accent-700); border-color: var(--accent-700); }

/* ------------------------------ forecast ------------------------------ */

.forecast { display: flex; align-items: flex-end; gap: 3px; height: 54px; }
.forecast__col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.forecast__bar { background: var(--accent-500); border-radius: 2px 2px 0 0; min-height: 2px; }
.forecast__bar--today { background: var(--warn-fg); }

/* ------------------------------- plan --------------------------------- */

.block {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elevated); overflow: hidden;
}
.block__head {
  display: flex; align-items: baseline; gap: var(--space-3);
  padding: var(--space-4) var(--space-5); background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
}
.block__kind {
  font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-600);
}
.block__why { font-size: .84rem; color: var(--text-muted); margin: 0; }
.block__body { padding: var(--space-4) var(--space-5); }

/* ------------------------------- chat --------------------------------- */

.chat { display: grid; gap: var(--space-4); }
.msg { display: grid; gap: var(--space-2); max-width: 46rem; }
.msg--learner { justify-self: end; }
.msg__bubble {
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-elevated);
  line-height: 1.6; white-space: pre-wrap;
}
.msg--learner .msg__bubble {
  background: var(--accent-50); border-color: var(--accent-300);
  border-bottom-right-radius: var(--radius-sm);
}
.msg--tutor .msg__bubble { border-bottom-left-radius: var(--radius-sm); }
.msg__meta { font-size: .7rem; color: var(--text-subtle); }
.msg--learner .msg__meta { text-align: right; }

/* ----------------------------- calibration ---------------------------- */

.calib { display: grid; gap: 2px; }
.calib__row { display: grid; grid-template-columns: 5.5em 1fr 1fr 3.5em; gap: var(--space-2); align-items: center; font-size: .78rem; }
.calib__bar { height: 9px; border-radius: 2px; }
.calib__bar--pred { background: var(--accent-300); }
.calib__bar--act  { background: var(--accent-600); }

/* ------------------------------ sparkline ----------------------------- */

.spark { display: flex; align-items: flex-end; gap: 2px; height: 40px; }
.spark__bar { flex: 1; background: var(--accent-300); border-radius: 1px; min-height: 1px; }
.spark__bar--correct { background: var(--accent-600); }

@media (max-width: 640px) {
  .stem { font-size: 1.08rem; }
  .why__bar { grid-template-columns: 7em 1fr 2.6em; }
  .calib__row { grid-template-columns: 4.5em 1fr 1fr 3em; }
}
