/* study.css — see docs/LEARNING.md §6.3. Brand tokens from app.css only; everything works at 360 px.
   Practice additions (smart practice, review link, lesson links, pace timer, Math tools, review feedback — the base
   .prc-* practice styles are in report.css) and the mistake review page (.rev-*). */

/* =========================================================================
   Practice picker
   ========================================================================= */
.prc-smart { margin-bottom: 16px; border-color: var(--brand-line); background: linear-gradient(135deg, var(--brand-soft), var(--card) 65%); }
.prc-smart-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.prc-smart-icon { flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.prc-smart-text { min-width: 0; }
.prc-smart-title { font-size: 18px; margin: 0 0 2px; }
.prc-smart-text p { margin: 0; max-width: 640px; }
.prc-smart-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.prc-smart-btn { white-space: normal; text-align: center; line-height: 1.2; }
@media (max-width: 560px) { .prc-smart-actions { grid-template-columns: minmax(0, 1fr); } }

.prc-review-due {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 12px 14px; border: 1px solid var(--warn-line);
  border-radius: var(--radius); background: var(--warn-soft); color: var(--warn-text-strong); font-size: 14px; text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.prc-review-due:hover { border-color: var(--warn); box-shadow: var(--shadow); }
.prc-review-due-icon { flex: none; display: inline-flex; }
.prc-review-due-text { flex: 1 1 auto; min-width: 0; }
.prc-review-due-text strong { color: var(--ink); }
.prc-review-due-go { flex: none; display: inline-flex; align-items: center; gap: 2px; font-weight: 700; white-space: nowrap; }

/* A skill row is the skill button plus a small "Lesson" link beside it (a link cannot sit inside a button). */
.prc-skill-row { display: flex; align-items: stretch; gap: 6px; }
.prc-skill-row > .prc-skill { flex: 1 1 auto; width: auto; min-width: 0; }
.prc-lesson-link {
  flex: none; width: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--muted); font-size: 11px; font-weight: 700;
  text-decoration: none; transition: border-color .15s, background .15s, color .15s;
}
.prc-lesson-link:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
@media (max-width: 380px) { .prc-lesson-link { width: 48px; } }

/* =========================================================================
   Practice session
   ========================================================================= */
/* Pace timer: time on the question against the SAT pace (R&W 1:11, Math 1:35); amber + alert icon when over. */
.prc-timer { padding: 3px 8px; border: 1px solid transparent; border-radius: 999px; white-space: nowrap; }
.prc-timer-icon { display: inline-flex; }
.prc-pace { margin-left: 2px; font-size: 12px; font-weight: 500; color: var(--muted); }
.prc-timer.is-over { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.prc-timer.is-over .prc-pace { color: var(--warn-text); }

/* Math tools under the question bar. */
.prc-qtools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.prc-tool .icon, .prc-tool svg { flex: none; }
.prc-tool.is-active { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.prc-tool.is-active:hover:not(:disabled) { background: #000; border-color: #000; }

/* After checking: review-queue feedback, the smart-practice reason and the lesson link. */
.prc-fb-review { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .7); font-size: 14px; font-weight: 600; }
.prc-fb-review .icon { flex: none; margin-top: 2px; }
.prc-fb-review.is-ok { color: var(--ok-text-strong); }
.prc-fb-review.is-bad { color: var(--bad-text-strong); }
.prc-fb-review.is-mastered { background: var(--card); box-shadow: inset 0 0 0 1px var(--ok-line); }
.prc-fb-reason { display: flex; align-items: flex-start; gap: 6px; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.prc-fb-reason .icon { flex: none; margin-top: 2px; }
.prc-fb-reason-label { font-weight: 700; color: var(--ink); }
.prc-fb-more { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(0, 0, 0, .08); }
.prc-fb-lesson { max-width: 100%; height: auto; min-height: 36px; padding: 6px 12px; justify-content: flex-start; text-align: left; white-space: normal; line-height: 1.3; }
.prc-fb-lesson .icon { flex: none; }

/* Desmos calculator + reference sheet (runner/tools panels) in a fixed layer under the app bar. Desktop: floating
   windows anywhere below the bar. Phones: a sheet over the lower part of the screen, above the bottom nav, so the
   question stays readable (and scrollable — .prc-tool-open adds room) above it. Landscape phones: the whole area. */
.prc-tools-layer { position: fixed; z-index: 39; top: var(--topbar-h); right: 0; bottom: 0; left: 0; pointer-events: none; }
.prc-tools-layer .prc-tools-main { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: transparent; visibility: hidden; pointer-events: none; }
.prc-tools-layer .bb-panel { pointer-events: auto; color-scheme: light; } /* Bluebook tools stay light in both themes */
@media (max-width: 760px) {
  .prc-tools-layer { bottom: calc(var(--bottomnav-h) + var(--safe-b)); }
  /* The bottom nav already keeps the sheet out of the home-indicator area. */
  .prc-tools-layer .bb-panel.is-sheet .bb-panel-body { padding-bottom: 0; }
  .prc-tools-layer .bb-panel.is-sheet .bb-calc-body { bottom: 0; }
  .prc-tools-layer .bb-panel.is-sheet .bb-ref-body { padding-bottom: 24px; }
}
@media (max-width: 759.98px) and (min-height: 520.02px) {
  .prc-tools-layer { top: auto; height: 55vh; height: 55dvh; }
  .prc-host.prc-tool-open { padding-bottom: 55vh; padding-bottom: 55dvh; }
}
/* An expanded desktop calculator docks on the left: the session page moves to its right (practiceSession.js). */
.prc-session.prc-docked { transition: margin-left .15s ease; }
.prc-docked .prc-qbody.prc-split { display: block; }
.prc-docked .prc-split .prc-pane-passage { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }

/* =========================================================================
   Mistake review (#/review)
   ========================================================================= */
.rev [hidden] { display: none !important; }
.rev-hero { margin-bottom: 16px; }
.rev-hero-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.rev-hero-main { display: flex; align-items: flex-start; gap: 14px; flex: 1 1 320px; min-width: 0; }
.rev-hero-icon { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.rev-hero-count {
  flex: none; min-width: 60px; height: 60px; padding: 0 10px; border-radius: 16px; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.rev-hero-text { min-width: 0; }
.rev-hero-title { font-size: 20px; margin: 2px 0 4px; overflow-wrap: anywhere; }
.rev-hero-text p { margin: 0; max-width: 620px; }
.rev-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rev-hero.is-due { border-color: var(--brand-line); background: linear-gradient(135deg, var(--brand-soft), var(--card) 60%); }
.rev-hero.is-clear .rev-hero-icon { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 640px) {
  .rev-hero-title { font-size: 18px; }
  .rev-hero-actions { width: 100%; flex-direction: column; }
  .rev-hero-actions .btn { width: 100%; white-space: normal; text-align: center; }
}

.rev-totals { margin-bottom: 20px; }
.rev-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rev-kpi { padding: 14px 16px; }
.rev-kpi.is-due .kpi-value { color: var(--brand-dark); }
.rev-kpi.is-mastered .kpi-value { color: var(--ok); }
@media (max-width: 480px) {
  .rev-kpis { gap: 8px; }
  .rev-kpi { padding: 10px; }
  .rev-kpi .kpi-label { font-size: 12px; }
  .rev-kpi .kpi-value { font-size: 22px; }
  .rev-kpi .kpi-sub { font-size: 11px; line-height: 1.3; }
}
.rev-mastery { margin-top: 12px; }
.rev-mastery-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.rev-mastery-top strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.rev-mastery-bar > span, .rev-skill-bar > span { background: var(--ok); }

.rev-skills { margin-bottom: 20px; }
.rev-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 900px) { .rev-sections { grid-template-columns: minmax(0, 1fr); } }
.rev-section .card-header { flex-wrap: wrap; }
.rev-section .card-header h3 { font-size: 16px; }
.rev-skill-list { list-style: none; margin: 0; padding: 0; }
.rev-skill { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.rev-skill:last-child { border-bottom: 0; }
.rev-skill-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rev-skill-name { font-size: 14px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.rev-skill-domain { font-size: 12px; color: var(--muted); }
.rev-skill-counts { display: flex; flex-wrap: wrap; gap: 4px; }
.rev-skill-bar { height: 6px; max-width: 220px; }
.rev-skill-actions { display: flex; align-items: center; gap: 6px; }
.rev-skill-actions .prc-lesson-link { width: auto; min-height: 34px; flex-direction: row; gap: 6px; padding: 0 10px; font-size: 13px; }
.rev-skill-done { padding: 6px 10px; }
@media (max-width: 420px) {
  .rev-skill { grid-template-columns: minmax(0, 1fr); padding: 12px 14px; }
  .rev-skill-actions .btn { flex: 1 1 auto; }
}

.rev-how-title { margin: 0; }
.rev-ladder { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.rev-step { flex: 1 1 86px; display: flex; flex-direction: column; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 12px; }
.rev-step strong { color: var(--ink); font-size: 14px; }
.rev-step.is-last { border-color: var(--ok-line); background: var(--ok-soft); }
.rev-step.is-last strong { color: var(--ok-text); }
.rev-how p { margin: 0; }

/* ---------- Dark theme ---------- */
/* The active tool is an --ink fill; its hover goes one step further from the page (black in light, white in dark). */
:root[data-theme="dark"] .prc-tool.is-active:hover:not(:disabled) { background: #FFFFFF; border-color: #FFFFFF; }
/* Review note on the feedback tint: light uses white at 70%, dark the card colour at 70%. */
:root[data-theme="dark"] .prc-fb-review { background: rgba(23, 27, 34, .7); }
/* The rule above out-ranks .prc-fb-review.is-mastered, so its solid card background is repeated. */
:root[data-theme="dark"] .prc-fb-review.is-mastered { background: var(--card); }
/* Hairline inside the feedback tint: black at 8% vanishes on the dark tints. */
:root[data-theme="dark"] .prc-fb-more { border-top-color: rgba(255, 255, 255, .12); }
