/* Dashboard stat bubbles — spaced grid, centered column layout per tile */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

.stat-card .stat-icon {
  font-size: 28px;
  margin-bottom: 8px;
  line-height: 1;
}

.stat-card .stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  width: 100%;
  text-align: center;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  width: 100%;
  text-align: center;
  line-height: 1.35;
}

/* Chapter cards on dashboard — a bit more air between tiles */
.chapters-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

/* Guided chapter stepper — no horizontal connector lines; space between step bubbles */
.ch-stepper {
  gap: 12px;
}

/* Ask Study Buddy — more separation, no heavy borders between messages */
.sb-ask-dlg-log {
  gap: 16px;
}

.sb-ask-msg--user,
.sb-ask-msg--ai {
  border: none;
  box-shadow: 0 1px 5px rgba(32, 33, 36, 0.08);
}

@media (max-width: 900px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .chapters-grid {
    grid-template-columns: 1fr;
  }
}

/* Bottom nav: two-line label for “Continue learning” */
#bottom-nav .bn-item .bn-label {
  display: block;
  line-height: 1.12;
  text-align: center;
  max-width: 5.5rem;
  hyphens: auto;
}

/* ===== Per-lesson knowledge check (knowledge-check.js) ===== */
.knowledge-check { margin: 20px 0 8px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); }
.kc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.kc-title { font-size: 16px; font-weight: 700; color: var(--text); }
.kc-pill { font-size: 12px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.kc-lead { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.kc-question { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.kc-question legend { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.5; margin-bottom: 8px; padding: 0; }
.kc-number { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 2px; }
.kc-options { display: grid; gap: 6px; }
.kc-option { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 14px; line-height: 1.5; color: var(--text); background: var(--card-bg); }
.kc-option input { margin-top: 4px; flex-shrink: 0; }
.kc-option:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.kc-option.is-picked { border-color: var(--primary); background: rgba(0,120,212,0.08); }
.kc-option.is-answer { border: 2px solid var(--accent); }
.kc-option.is-wrong { border: 2px solid var(--danger); }
.kc-letter { font-weight: 700; min-width: 1.2em; }
.kc-option-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.kc-option-note { display: block; font-size: 12px; font-weight: 700; margin-top: 2px; }
.kc-feedback { margin-top: 8px; padding: 10px 12px; border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.6; }
.kc-feedback.no { border-left-color: var(--danger); }
.kc-feedback-title { font-weight: 700; margin-bottom: 4px; }
.kc-feedback-body { margin-bottom: 6px; }
.kc-ref { color: var(--text); text-decoration: underline; overflow-wrap: anywhere; }
.kc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.kc-score { font-weight: 700; color: var(--text); flex-basis: 100%; }
.kc-error { color: var(--danger); font-weight: 600; flex-basis: 100%; }
.kc-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===== Numbers to Know (numbers.js, chapter Summary tab) ===== */
.ntk-card { margin-bottom: 20px; }
.ntk-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.ntk-lead { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
/* contain: the app shell (#main) is a flex item with min-width:auto, so an uncontained table would widen the page. */
.ntk-scroll { position: relative; overflow-x: auto; max-width: 100%; contain: inline-size; }
.ntk-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.5; color: var(--text); }
.ntk-table th, .ntk-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.ntk-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); }
.ntk-table tbody th { font-weight: 600; }
.ntk-value { font-weight: 700; white-space: nowrap; }
.ntk-table a { color: var(--text); text-decoration: underline; white-space: nowrap; }
.ntk-subtitle { font-size: 14px; font-weight: 700; color: var(--text); margin: 16px 0 8px; }
.ntk-confused { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13px; color: var(--text); }
.ntk-confused li { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.ntk-tip { display: block; color: var(--text-muted); margin-top: 2px; }
@media (max-width: 700px) {
  .ntk-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .ntk-table, .ntk-table tbody, .ntk-table tr, .ntk-table th, .ntk-table td { display: block; width: 100%; }
  .ntk-table tr { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; padding: 4px 0; }
  .ntk-table th, .ntk-table td { border-bottom: 0; padding: 4px 12px; }
  .ntk-table td::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
  .ntk-value { white-space: normal; }
}
