/* The learning system: progress, planner, reviews, mistakes, mocks,
   diagnostic, the home "continue" card and the roadmap progress marks.
   Only uses the shared tokens from style.css, so light and dark both work. */

.lp { --lp-mark: var(--series-7); }
.lp-tight { margin: 0; gap: 8px 12px; }
.lp-good { color: var(--good); font-weight: 600; }
.lp-bad { color: var(--bad); font-weight: 600; }
.lp-big { font: 700 30px var(--display); margin: 4px 0 8px; }
.lp-big b { font: inherit; }

/* Links between the learning pages */
.lp-subnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 18px; }
.lp-subnav a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; }
.lp-subnav a:hover { border-color: var(--accent); }
.lp-subnav a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.lp-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 700 12px var(--mono); text-align: center; }
.lp-subnav a[aria-current="page"] .lp-count { background: var(--bg); }

/* Rings, bars, badges */
.lp-ring { flex: none; vertical-align: middle; }
.lp-ring circle { fill: none; stroke-width: 3.2; }
.lp-ring-bg { stroke: var(--line); }
.lp-ring-fg { stroke: var(--lp-ring, var(--accent)); stroke-linecap: round; }
.lp-bar { display: block; height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; min-width: 0; }
.lp-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.lp-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font: 600 12px var(--body); white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.lp-badge.lp-seen { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.lp-badge.lp-practising { background: var(--warn-soft); color: var(--text); border-color: transparent; }
.lp-badge.lp-mastered { background: var(--good-soft); color: var(--good); border-color: transparent; }
.lp-badge.lp-review { background: color-mix(in srgb, var(--series-2) 16%, var(--surface)); color: var(--text); border-color: var(--series-2); }
.lp-status { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.lp-status:has(.lp-mastered) { --lp-ring: var(--good); }
.lp-status:has(.lp-review) { --lp-ring: var(--series-2); }
.lp-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; cursor: pointer; }
.lp-check input { width: 17px; height: 17px; accent-color: var(--good); margin: 0; }
.lp-inline { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }

/* Roadmap marks */
.lp-stage-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; margin: 8px 0 12px; max-width: 520px; }
.rm-stage .lp-stage-bar .lp-bar i { background: var(--c, var(--accent)); }
.rm-chip[data-state="seen"]::before, .rm-chip[data-state="practising"]::before, .rm-chip[data-state="mastered"]::before, .rm-chip[data-state="review"]::before { display: inline-block; margin-right: 5px; font-weight: 700; }
.rm-chip[data-state="seen"]::before { content: "○"; color: var(--accent); }
.rm-chip[data-state="practising"]::before { content: "◐"; color: var(--accent); }
.rm-chip[data-state="mastered"]::before { content: "✓"; color: var(--good); }
.rm-chip[data-state="review"]::before { content: "↻"; color: var(--series-2); }
.rm-chip[data-state="mastered"] { border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.lp-next { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin-top: 20px; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.lp-next .eyebrow { margin-bottom: 2px; }
.lp-next-title { margin: 0; font: 600 18px var(--display); }
.lp-stage-test { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.lp-stage-test p { margin: 0 0 12px; }

/* Dashboard */
.lp-facts { margin: 0 0 16px; }
.lp-actions h2 { margin-bottom: 10px; }
.lp-action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.lp-action { display: grid; gap: 2px; align-content: start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); text-decoration: none; }
.lp-action:hover { border-color: var(--accent); }
.lp-action b { font-weight: 600; color: var(--accent); }
.lp-week { list-style: none; padding: 0; margin: 4px 0 8px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 520px; }
.lp-week li { display: grid; justify-items: center; gap: 4px; min-width: 0; }
.lp-week-n { font: 600 12px var(--mono); min-height: 16px; color: var(--muted); }
.lp-week-col { position: relative; width: 100%; max-width: 40px; height: 90px; border-radius: 8px; background: var(--surface-2); display: flex; align-items: flex-end; overflow: hidden; }
.lp-week-col i { display: block; width: 100%; background: color-mix(in srgb, var(--accent) 55%, var(--surface)); border-radius: 6px 6px 0 0; }
.lp-week-acc { position: absolute; left: 50%; width: 9px; height: 9px; margin: 0 0 -4.5px -4.5px; border-radius: 50%; background: var(--good); border: 2px solid var(--surface); }
.lp-week-day { font-size: 12.5px; font-weight: 600; }
.lp-week li.today .lp-week-day { color: var(--accent); }
.lp-week-acc-text { font-size: 11.5px; min-height: 16px; }
.lp-stages { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.lp-stages li { display: grid; grid-template-columns: minmax(0, 15em) minmax(60px, 1fr) auto; align-items: center; gap: 4px 12px; }
.lp-stages a { color: var(--text); text-decoration: none; font-weight: 500; font-size: 14.5px; border-left: 4px solid var(--c); padding-left: 8px; }
.lp-stages a:hover { color: var(--accent); }
.lp-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 0; }
.lp-list li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.lp-list li:first-child { border-top: 0; }
.lp-list li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.lp-file { display: none; }
.btn.lp-danger { color: var(--bad); }
.lp-empty p { max-width: 46em; }

/* Planner */
.lp-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 12px 16px; margin: 6px 0 4px; }
.lp-field { display: grid; gap: 4px; align-content: start; font-weight: 600; font-size: 14px; }
.lp-field input, .lp-field select { width: 100%; font-weight: 400; }
.lp-field input[type="date"] { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; min-width: 0; }
.lp-field .muted { font-weight: 400; }
.lp-today { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.lp-today h2 { margin-bottom: 8px; }
.lp-tasks, .lp-day ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lp-task a { font-weight: 600; }
.lp-days { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.lp-day { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.lp-day:first-child { border-top: 0; }
.lp-day-date { font: 600 13.5px var(--mono); color: var(--muted); padding-top: 1px; }
.lp-day.revise .lp-day-date { color: var(--series-2); }
.lp-more summary { cursor: pointer; font-weight: 600; }
.lp-more[open] summary { margin-bottom: 8px; }

/* Questions */
.lp-q .eyebrow { margin-bottom: 10px; }
.lp-sol summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.lp-mistake .gate-meta { flex-wrap: wrap; }
.lp-stem summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.lp-stem[open] summary { margin-bottom: 4px; }
.lp-mistake .gate-q { margin: 10px 0 0; padding: 0; border: 0; box-shadow: none; }
.lp-progress { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; margin: 0 0 12px; }
.lp-subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 0 16px; }
.lp-subjects h2 { margin-bottom: 0; }
.lp-review-list { margin: 0; padding-left: 26px; display: grid; gap: 6px; }
.lp-review-list summary { cursor: pointer; padding: 4px 0; }
.lp-review-list details[open] { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.lp-table td:first-child, .lp-table th:first-child { text-align: left; font-family: var(--body); }

/* Mock tests: palette colours follow the GATE screen */
.lp-pal { display: inline-grid; place-items: center; min-width: 36px; height: 34px; padding: 0 4px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--text); font: 600 13px var(--mono); cursor: pointer; position: relative; }
.lp-pal.na { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.lp-pal.ans { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.lp-pal.mr, .lp-pal.amr { background: color-mix(in srgb, var(--lp-mark) 18%, var(--surface)); border-color: var(--lp-mark); color: var(--text); border-radius: 50%; }
.lp-pal.amr::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--good); border: 2px solid var(--surface); }
.lp-pal[aria-current="true"] { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.lp-legend { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.lp-legend li { display: inline-flex; align-items: center; gap: 6px; }
.lp-legend .lp-pal { min-width: 18px; height: 18px; cursor: default; }
.lp-legend .lp-pal.amr::after { width: 8px; height: 8px; }
.lp-exam { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.lp-exam-q { min-height: 320px; }
.lp-palette h2 { font-size: 17px; margin-bottom: 10px; }
.lp-palette-grid { display: grid; grid-template-columns: repeat(auto-fill, 38px); gap: 6px; max-height: 360px; overflow-y: auto; padding: 4px; }
.lp-palette .lp-legend { font-size: 12.5px; }
.lp-exam-actions { margin-top: 16px; }
.lp-exam-bar { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 16px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); box-shadow: 0 -4px 16px -8px rgb(0 0 0 / 0.25); }
.lp-exam-bar b { min-width: 0; overflow-wrap: anywhere; }
.lp-clock { font: 700 18px var(--mono); padding: 2px 10px; border-radius: 8px; background: var(--surface-2); }
.lp-clock.warn { background: var(--bad-soft); color: var(--bad); }
.lp-resume { border-color: var(--series-4); }

/* Home: continue where you left off */
.lp-continue { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.lp-continue h2 { font-size: 18px; margin: 0; }
.lp-continue-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.lp-continue-list li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.lp-continue-list a { font-weight: 600; overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .lp-exam { grid-template-columns: 1fr; }
  .lp-palette-grid { max-height: none; }
}
@media (max-width: 560px) {
  .lp-stages li { grid-template-columns: minmax(0, 1fr) auto; }
  .lp-stages li .lp-bar { grid-column: 1 / -1; grid-row: 2; }
  .lp-day { grid-template-columns: 1fr; }
  .lp-status { margin-left: 0; width: 100%; }
  .lp-big { font-size: 26px; }
  .lp-exam-actions .btn { flex: 1 1 calc(50% - 8px); }
}
.lp-exam-title { font-size: 22px; margin: 4px 0 14px; }
@media (max-width: 420px) { .lp-exam-bar > b { display: none; } }
.lp-mistake .gate-q > .gate-meta { display: none; }
