/* Self Study Portal styles. Paper-and-ink palette; the ladder rail in the question player is the one bold element. */
:root {
  --paper: #FFFFFF;
  --surface: #FFFFFF;
  --ink: #1F2430;
  --ink-2: #5B6170;
  --rule: #E4E2DF;
  --grid: rgba(31, 36, 48, 0.035);
  --accent: #C2410C;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(234, 88, 12, 0.10);
  --paya: #1D4ED8;
  --paya-soft: rgba(29, 78, 216, 0.08);
  --ok: #15803D;
  --mid: #A16207;
  --bad: #B91C1C;
  --field: #FAF8F6;
  --radius-s: 6px;
  --radius-m: 10px;
  --font: 'Lexend', 'Noto Sans Devanagari', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: only light;   /* stops Chrome's "dark theme for sites" from auto-darkening the light theme (figures stayed navy on black) */
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1626; --surface: #172138; --ink: #E6EBF3; --ink-2: #A5B1C6; --rule: #2B3856;
    --grid: rgba(230, 235, 243, 0.035); --accent: #45B6C0; --accent-ink: #0B1220; --accent-soft: rgba(69, 182, 192, 0.14);
    --paya: #E2A944; --paya-soft: rgba(226, 169, 68, 0.14); --ok: #63C38D; --mid: #D9B44A; --bad: #F2766B; --field: #0F1626;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0F1626; --surface: #172138; --ink: #E6EBF3; --ink-2: #A5B1C6; --rule: #2B3856;
  --grid: rgba(230, 235, 243, 0.035); --accent: #45B6C0; --accent-ink: #0B1220; --accent-soft: rgba(69, 182, 192, 0.14);
  --paya: #E2A944; --paya-soft: rgba(226, 169, 68, 0.14); --ok: #63C38D; --mid: #D9B44A; --bad: #F2766B; --field: #0F1626;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: inherit; }
html { height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; min-height: 100%;
  font-family: var(--font); font-size: 17px; line-height: 1.55; color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
img, svg { max-width: 100%; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* top bar */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px clamp(16px, 4vw, 40px); background: var(--surface); border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.brand svg { color: var(--accent); }
.topbar-end { display: flex; align-items: center; gap: 4px; }
.who { color: var(--ink-2); font-size: 14px; margin-right: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--ink); }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.icon-btn[hidden] { display: none; }

main { max-width: 1120px; margin: 0 auto; padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 96px; }

h1 { font-size: clamp(28px, 4.2vw, 40px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; margin: 4px 0 20px; }
h2 { font-size: 20px; font-weight: 600; margin: 40px 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
p { margin: 0 0 14px; max-width: 68ch; }
.muted, .fine { color: var(--ink-2); }
.fine { font-size: 14px; }
.lede { font-size: 19px; color: var(--ink-2); }
.kicker { color: var(--ink-2); font-size: 15px; margin: 0; }
.back { display: inline-block; font-size: 15px; text-decoration: none; margin-bottom: 8px; }
.back::before { content: "‹ "; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }

/* buttons */
.btn {
  font: inherit; font-size: 16px; font-weight: 500; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 10px 18px; border-radius: var(--radius-s); border: 1.5px solid var(--rule);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
}
.btn:hover:not(:disabled) { border-color: var(--ink-2); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { border-color: var(--accent); filter: brightness(1.06); }
.btn-paya { border-color: var(--paya); color: var(--paya); }
.btn-paya:hover:not(:disabled) { border-color: var(--paya); background: var(--paya-soft); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--accent); padding-left: 0; padding-right: 0; }
.btn-quiet:hover:not(:disabled) { border-color: transparent; text-decoration: underline; }
.btn-wide { width: 100%; }
.btn-wide + .fine { margin-top: 10px; }

/* gate screens */
.gate { max-width: 460px; margin: 6vh auto 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: clamp(24px, 5vw, 40px); }
.gate-wide { max-width: 600px; }
.gate .mark { color: var(--accent); margin-bottom: 8px; }
.plain { padding-left: 20px; margin: 0 0 14px; }
.plain li { margin-bottom: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0; font-weight: 500; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); }

/* front page */
.subjects { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.subject {
  display: flex; flex-direction: column; gap: 10px; min-height: 140px; padding: 22px;
  background: var(--surface); border: 1px solid var(--rule); border-left: 6px solid var(--accent); border-radius: var(--radius-s);
  color: var(--ink); text-decoration: none;
}
.subject:hover { border-color: var(--ink-2); border-left-color: var(--accent); }
.subject-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.subject-name { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.subject-meta { display: flex; flex-direction: column; gap: 2px; color: var(--ink-2); font-size: 15px; margin-top: auto; }
.subject.is-ended { border-left-color: var(--rule); opacity: 0.75; cursor: default; }
.due { color: var(--paya); font-weight: 600; }
.until.warn { color: var(--warn, #c47800); font-weight: 500; }
.until.urgent { color: var(--danger, #c0392b); font-weight: 600; }
.expiry-banner { display: flex; flex-direction: column; gap: 2px; max-width: 560px; margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius-s); background: color-mix(in srgb, var(--warn, #c47800) 12%, var(--surface)); border-left: 3px solid var(--warn, #c47800); font-size: 15px; }
.expiry-banner.urgent { background: color-mix(in srgb, var(--danger, #c0392b) 12%, var(--surface)); border-left-color: var(--danger, #c0392b); }
.expiry-banner .expiry-note { font-size: 13px; color: var(--ink-2); }
.qp-notice { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; max-width: 560px; margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius-s); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-left: 3px solid var(--accent); font-size: 14px; color: var(--ink-2); }
.btn-close-notice { background: none; border: none; cursor: pointer; color: var(--ink-2); font-size: 14px; padding: 0 2px; flex-shrink: 0; }

/* subject page: built for 50+ lectures */
.sub-summary { color: var(--ink-2); margin-top: -8px; }
.sub-summary b { color: var(--ink); }
.resume {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label badge" "name badge"; align-items: center; gap: 2px 12px;
  max-width: 560px; margin: 4px 0 18px; padding: 14px 18px; border-radius: var(--radius-s);
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
}
.resume:hover { filter: brightness(1.06); }
.resume-label { grid-area: label; font-size: 14px; opacity: 0.85; }
.resume-name { grid-area: name; font-size: 19px; font-weight: 600; }
.resume .badge { grid-area: badge; background: var(--accent-ink); color: var(--accent); }
.list-tools { margin: 0 0 12px; }
.lectures { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.lecture {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "code badge" "main main" "bar bar";
  gap: 4px 8px; height: 100%; align-content: start; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius-s); color: var(--ink); text-decoration: none;
}
.lecture:hover { border-color: var(--ink-2); }
.lec-code { grid-area: code; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--accent); line-height: 1.2; }
.lec-badge { grid-area: badge; align-self: start; }
.lec-main { grid-area: main; display: grid; gap: 2px; min-width: 0; }
.lec-name { font-weight: 500; line-height: 1.3; }
.lec-foot { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 14px; color: var(--ink-2); }
.lec-bar { grid-area: bar; height: 5px; margin-top: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.lec-bar i { display: block; height: 100%; background: var(--accent); }
.lecture.is-empty { background: transparent; }
/* Entrance Exam topic chooser: a coloured icon and the topic name */
.topic-tile { display: flex; align-items: center; gap: 12px; }
.topic-ico { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--tc); background: color-mix(in srgb, var(--tc) 15%, var(--surface)); }
.topic-ico svg { display: block; }
.topic-tile .lec-name { min-width: 0; overflow-wrap: break-word; }
@media (min-width: 601px) { .lectures.topics { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }
.tc-0 { --tc: var(--accent); } .tc-1 { --tc: var(--paya); } .tc-2 { --tc: var(--ok); }
.tc-3 { --tc: #8B6FE8; } .tc-4 { --tc: #D9578F; } .tc-5 { --tc: var(--mid); }
.topic-tile.is-empty .topic-ico { filter: grayscale(1); opacity: 0.7; }
.gate.stop .stop-ico svg { width: 48px; height: 48px; }

.lecture.is-empty .lec-code { color: var(--ink-2); }
.later { margin-top: 22px; border-top: 1px solid var(--rule); padding-top: 12px; }
.later summary { cursor: pointer; font-weight: 500; color: var(--ink-2); padding: 6px 0; }
.later-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 0; }
.later-list li { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); color: var(--ink-2); font-size: 15px; }
.later-list .lec-code { font-size: 16px; color: var(--ink-2); }

/* phones: lectures as compact rows, so 48 of them stay scannable */
@media (max-width: 600px) {
  .lectures { grid-template-columns: 1fr; gap: 0; border-top: 1px solid var(--rule); }
  .lecture {
    grid-template-columns: 50px 1fr auto; grid-template-areas: "code main badge" "code bar bar";
    gap: 0 10px; padding: 10px 4px; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; background: transparent;
  }
  .lec-code { font-size: 18px; align-self: start; padding-top: 1px; }
  .lec-badge { align-self: center; }
  .lec-bar { margin-top: 6px; height: 4px; }
}

/* lecture hub */
.banner { background: var(--accent-soft); border-radius: var(--radius-s); padding: 12px 16px; max-width: none; }
.meters { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 8px 0 24px; }
.meter-head { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 6px; }
.meter-head span:first-child { font-weight: 600; }
.meter-head span:last-child { color: var(--ink-2); }
.meter-bar { position: relative; height: 12px; background: var(--rule); border-radius: 6px; overflow: visible; }
.meter-bar i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.meter-bar b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--paya); }
.meter-paya .meter-bar i { background: var(--paya); }
.meter-paya.is-locked .meter-head span:last-child { color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.switch { display: inline-flex; gap: 10px; align-items: center; font-size: 15px; color: var(--ink-2); cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.attempts { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.attempts li { display: grid; grid-template-columns: 72px 1fr auto auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
.att-q { font-weight: 600; font-variant-numeric: tabular-nums; }
.att-t, .att-d { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ok { color: var(--ok); } .mid { color: var(--mid); } .bad { color: var(--bad); }


/* to-do counts, like unread messages */
.badge {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px;
  background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums; flex: none;
}
.badge.due { background: var(--paya); color: #FFFFFF; }
.badge.on-primary { background: var(--accent-ink); color: var(--accent); min-width: 24px; height: 24px; }
.btn .badge { margin-left: 4px; }

/* question player */
.player-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.player-head .back { margin: 0; }
.mode { font-weight: 600; }
.is-paya .mode { color: var(--paya); }
.pos { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.head-end { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.clock { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 18px; }
.player-grid { display: grid; gap: clamp(20px, 3.5vw, 44px); grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
.prose p { margin-bottom: 10px; }
.prose-lg { font-size: 20px; line-height: 1.6; }
.fig { margin: 16px 0 0; padding: 12px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-s); color: var(--ink); }
.fig svg { display: block; width: 100%; height: auto; max-height: 340px; }
/* Entrance Exam drawings carry class "fig" themselves: inside the frame they must not draw a second frame */
figure.fig svg.fig { margin: 0 auto; padding: 0; border: 0; border-radius: 0; background: none; }
.fig .dg text { font-family: var(--font); }

.link {
  font: inherit; font-weight: 500; color: var(--accent); background: none; border: 0; padding: 6px 0; min-height: 36px; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.link:hover { text-decoration-thickness: 2px; }
.link-quiet { color: var(--ink-2); font-weight: 400; font-size: 15px; }

/* the ladder: unopened rungs are a single line; opened ones become cards */
.ladder { list-style: none; margin: 0; padding: 0; position: relative; }
.ladder::before { content: ""; position: absolute; left: 11px; top: 14px; bottom: 14px; width: 3px; background: var(--rule); border-radius: 2px; }
.rung { position: relative; padding: 0 0 14px 40px; scroll-margin-top: calc(var(--topbar-h, 50px) + 60px); scroll-margin-bottom: 16px; }
.rung .node { position: absolute; left: 3px; top: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--paper); border: 3px solid var(--rule); }
.rung-line { padding-bottom: 8px; }
.rung-line .node { top: 9px; }
.rung-text { min-height: 36px; display: flex; align-items: center; }
.rung-open .node { border-color: var(--accent); }
.rung-used .node { border-color: var(--accent); background: var(--accent); }
.rung-body { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 14px 16px; }
.rung-open .rung-body { border-color: var(--accent); }
.rung-body:focus, .next-panel:focus, .feedback:focus { outline: none; }
.is-paya .rung-open .node, .is-paya .rung-used .node, .is-paya .rung-open .rung-body { border-color: var(--paya); }
.is-paya .rung-used .node { background: var(--paya); }
.is-paya .link { color: var(--paya); }

.answer { display: grid; gap: 10px; }
.part { display: grid; grid-template-columns: minmax(64px, auto) 1fr; align-items: center; gap: 10px; font-weight: 500; }
.part input {
  font: inherit; font-size: 19px; min-height: 46px; padding: 8px 12px; width: 100%;
  border: 1.5px solid var(--rule); border-radius: var(--radius-s); background: var(--field); color: var(--ink);
}
.part input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.keys { display: flex; gap: 6px; flex-wrap: wrap; }
.key { font: inherit; font-size: 18px; min-width: 44px; min-height: 40px; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--field); color: var(--ink); cursor: pointer; }
.key:hover { border-color: var(--ink-2); }
.answer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.answer-row .fine { margin: 0; }
.options { display: grid; gap: 8px; }
.opt {
  font: inherit; font-size: 18px; text-align: left; min-height: 48px; padding: 10px 14px; cursor: pointer;
  border: 1.5px solid var(--rule); border-radius: var(--radius-s); background: var(--paper); color: var(--ink);
}
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt.is-wrong { text-decoration: line-through; color: var(--bad); border-color: var(--bad); opacity: 0.8; }
.opt.is-right { border-color: var(--ok); color: var(--ok); font-weight: 600; }
.opt:disabled { cursor: default; }
.feedback { margin: 10px 0 0; font-weight: 500; }
.fb-ok { color: var(--ok); } .fb-bad { color: var(--bad); } .fb-warn { color: var(--mid); }
.final { font-weight: 600; margin-top: 8px; }
.past { background: var(--paya-soft); border-radius: var(--radius-s); padding: 12px 16px; margin-bottom: 16px; }
.past ul { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.past li { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; padding: 2px 0; }
.past h3 { font-size: 15px; margin: 0 0 4px; }

/* correct answer */
.result { display: flex; align-items: center; gap: 14px; }
.tick {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--ok); color: #FFFFFF; font-size: 24px; font-weight: 600;
  animation: pop 320ms ease-out;
}
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
.result-title { margin: 0; font-size: 20px; font-weight: 600; color: var(--ok); }
.result-echo { margin: 0; color: var(--ink-2); }

/* what next: one big step forward, the solution beside it, the exit kept quiet */
.next-panel { margin: 4px 0 8px 40px; display: grid; gap: 10px; scroll-margin-bottom: 16px; }
.next-main { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-next { flex: 1 1 auto; min-height: 52px; font-size: 18px; }
.next-main .btn:not(.btn-next) { min-height: 52px; }
.auto-note { margin: 0; color: var(--ink-2); font-size: 15px; display: flex; align-items: center; gap: 12px; }
.auto-note b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.next-sub { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
.mini-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.mini-check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* question peek (phone held upright) */
.peek {
  position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h, 50px)); z-index: 4;
  display: flex; align-items: center; gap: 12px; padding: 4px 16px;
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.peek[hidden] { display: none; }
.peek-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; color: var(--ink-2); }
.peek-text b { color: var(--ink); margin-right: 4px; }
.peek .link { white-space: nowrap; }
.sheet {
  width: min(100vw, 680px); max-width: 100vw; max-height: 88vh; margin: auto auto 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border: none; border-radius: 14px 14px 0 0; background: var(--surface); color: var(--ink);
}
.sheet::backdrop { background: rgba(10, 16, 28, 0.55); }
.sheet .btn { width: 100%; margin-top: 16px; }

/* done for now */
.tally { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 8px 0 24px; }
.tally div { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 14px 16px; }
.tally dt { color: var(--ink-2); font-size: 14px; }
.tally dd { margin: 4px 0 0; font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.still { font-size: 18px; }

/* toast and demo bar */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  max-width: min(92vw, 520px); padding: 12px 18px; border-radius: var(--radius-s); background: var(--ink); color: var(--paper); font-size: 15px;
}
.demo {
  position: fixed; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 15;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); font-size: 14px; max-width: calc(100vw - 24px);
}
.demo summary { cursor: pointer; padding: 6px 12px; font-weight: 600; color: var(--paya); font-size: 13px; }
.demo-body { display: grid; gap: 6px; padding: 0 14px 12px; width: 260px; max-width: 100%; }
.demo-body button { font: inherit; font-size: 14px; text-align: left; padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--paper); color: var(--ink); cursor: pointer; }
.demo-body p { margin: 0; color: var(--ink-2); font-size: 13px; }

/* ===== layouts ===== */

/* Laptop, tablet, phone on its side: the player fits one screen; each side scrolls on its own if it must. */
@media (min-width: 601px), (orientation: landscape) {
  body.on-player main {
    max-width: 1280px; padding-top: 12px; padding-bottom: 0;
    height: calc(100dvh - var(--topbar-h, 50px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }
  body.on-player .player { height: 100%; display: flex; flex-direction: column; }
  body.on-player .player-head { flex: none; }
  body.on-player .player-grid { flex: 1; min-height: 0; height: 100%; align-items: stretch; }
  body.on-player .stmt, body.on-player .climb { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 20px; }
  body.on-player .stmt .fig svg { max-height: calc(100dvh - var(--topbar-h, 50px) - 260px); min-height: 180px; }
  body.on-player .peek { display: none; }
  body.on-player .toast { bottom: 12px; }
}

/* Tablet held upright: question on top, the ladder below. */
@media (min-width: 601px) and (max-width: 1024px) and (orientation: portrait) {
  body.on-player .player-grid { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 16px; }
  body.on-player .stmt { max-height: 48vh; border-bottom: 1px solid var(--rule); padding-bottom: 12px; }
  body.on-player .stmt .fig svg { max-height: 32vh; min-height: 0; }
}

/* Phone on its side: a slimmer bar and tighter type so both columns fit. */
@media (orientation: landscape) and (max-height: 520px) {
  .topbar { padding-top: 4px; padding-bottom: 4px; }
  .brand span, .who { display: none; }
  .icon-btn { width: 36px; height: 36px; }
  body.on-player main { padding: 8px 16px 0; }
  body.on-player .player-head { margin-bottom: 8px; padding-bottom: 6px; font-size: 15px; }
  body.on-player .player-grid { gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  body.on-player .prose-lg { font-size: 17px; }
  body.on-player .stmt .fig { margin-top: 10px; padding: 6px; }
  body.on-player .stmt .fig svg { max-height: calc(100dvh - var(--topbar-h, 44px) - 175px); min-height: 0; }
  .rung-body { padding: 10px 12px; }
  .part input { min-height: 40px; font-size: 17px; }
  .key { min-height: 36px; }
  .btn-next { min-height: 46px; }
}

/* Phone held upright: one column; the peek bar keeps the question close. */
@media (max-width: 600px) and (orientation: portrait) {
  body { font-size: 16px; }
  .player-grid { grid-template-columns: 1fr; gap: 18px; }
  .player-head { gap: 4px 12px; font-size: 15px; margin-bottom: 12px; }
  .prose-lg { font-size: 18px; }
  .fig svg { max-height: 36vh; }
  .attempts li { grid-template-columns: 60px 1fr auto; }
  .att-d { display: none; }
  .next-panel { margin-left: 0; }
  .btn-next { width: 100%; }
  .next-main .btn:not(.btn-next) { width: 100%; min-height: 46px; }
  .who { display: none; }
}

@media (max-width: 860px) and (min-width: 601px) { .player-grid { gap: 20px; } }

/* typing an answer on a phone or tablet: only the answer card is shown */
.q-link { display: none; }
body.typing .topbar, body.typing .player-head, body.typing .stmt, body.typing .peek, body.typing .past,
body.typing .next-panel, body.typing .demo, body.typing .toast, body.typing .ladder > li:not(#rung-ans) { display: none !important; }
body.typing .ladder::before, body.typing #rung-ans .node { display: none; }
body.typing #rung-ans { padding: 0; }
body.typing.on-player main { height: auto; padding: 8px 12px 0; }
body.typing .player-grid { display: block; height: auto; }
body.typing .climb { overflow: visible; padding-bottom: 0; }
body.typing #rung-ans h3 { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
body.typing .q-link { display: inline; font-size: 15px; min-height: 0; padding: 0; }
body.typing .answer { grid-template-columns: 1fr auto; align-items: center; gap: 8px 10px; }
body.typing .answer .part { grid-column: 1 / -1; }
body.typing .answer .keys { grid-column: 1; }
body.typing .answer-row { grid-column: 2; }
body.typing .answer-row .fine { display: none; }
@media (max-width: 600px) and (orientation: portrait) {
  body.typing .answer { grid-template-columns: 1fr; }
  body.typing .answer .keys, body.typing .answer-row { grid-column: 1; }
  body.typing .keys { flex-wrap: nowrap; }
  body.typing .key { flex: 1; min-width: 0; }
  body.typing .answer-row .btn { width: 100%; }
}
@media (orientation: landscape) and (max-height: 520px) {
  body.typing .rung-body { padding: 8px 12px; }
  body.typing #rung-ans h3 { margin-bottom: 4px; }
  body.typing .part input { min-height: 36px; padding: 4px 10px; }
  body.typing .answer { gap: 6px 10px; }
  body.typing .key { min-height: 34px; min-width: 40px; }
  body.typing .answer-row .btn { min-height: 36px; padding: 6px 14px; }
}

/* self-checked questions */
.self-intro { font-weight: 500; margin-bottom: 6px; }
.self-steps { margin: 0 0 14px; padding-left: 22px; color: var(--ink-2); }
.self-steps li { padding: 2px 0; }
.self-steps li.now { color: var(--ink); font-weight: 600; }
.self-steps li.done { text-decoration: line-through; text-decoration-color: var(--rule); }
.rate { display: grid; gap: 8px; margin-top: 16px; }
.rate-q { margin: 0; font-weight: 600; font-size: 18px; }
.rate-card {
  display: grid; grid-template-columns: 40px 1fr; grid-template-areas: "mark title" "mark desc"; align-items: center; gap: 0 12px;
  text-align: left; font: inherit; padding: 10px 14px; min-height: 56px; cursor: pointer;
  border: 1.5px solid var(--rule); border-radius: var(--radius-s); background: var(--paper); color: var(--ink);
}
.rate-card:hover { border-color: var(--ink-2); }
.rate-mark { grid-area: mark; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-weight: 700; font-size: 18px; }
.rate-title { grid-area: title; font-weight: 600; }
.rate-desc { grid-area: desc; font-size: 14px; color: var(--ink-2); }
.rate-got .rate-mark { background: var(--ok); color: #FFFFFF; }
.rate-partly .rate-mark { background: var(--mid); color: #FFFFFF; }
.rate-no .rate-mark { background: var(--rule); color: var(--ink); }
.rate .fine { margin: 2px 0 0; }

/* resume button on the front page (shares the .resume look) */
button.resume { font: inherit; border: 0; cursor: pointer; text-align: left; width: 100%; grid-template-areas: "label" "name" "what"; grid-template-columns: 1fr; }
.resume-what { font-size: 14px; opacity: 0.85; }

/* on-screen keyboard open: give the answer box the room */
body.kb-open.on-player main { height: calc(var(--vvh, 100dvh) - var(--topbar-h, 50px)); }
body.kb-open .peek, body.kb-open .demo, body.kb-open .toast { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  body.kb-open .topbar, body.kb-open .player-head { display: none; }
  body.kb-open.on-player main { height: var(--vvh, 100dvh); padding-top: 4px; }
  body.kb-open .stmt .fig { display: none; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }


/* ===== round 6 ===== */
.part input.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.part input.is-wrong { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 15%, transparent); }
.part input.is-right { border-color: var(--ok); }
.rate-note { margin: -4px 0 4px; }

/* answer keypad (phones and tablets): no system keyboard needed */
.pad { margin-top: 4px; max-width: 460px; }
.pad-grid { display: grid; gap: 6px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pad-actions { display: flex; gap: 6px; margin-top: 6px; }
.pad-actions .pk { padding: 0 14px; }
.pad-actions .pk-check { flex: 1; }
.pad-l { display: none; }
.has-pad .pad-s2 { display: none; }
.has-pad.pad2 .pad-s1 { display: none; }
.has-pad.pad2 .pad-grid.pad-s2 { display: grid; }
.has-pad.pad2 span.pad-s2 { display: contents; }
.has-pad span.pad-s1 { display: contents; }
.has-pad.pad2 span.pad-s1 { display: none; }
.pk {
  font: inherit; font-size: 20px; font-weight: 500; min-height: 48px; padding: 0; border-radius: var(--radius-s);
  border: 1px solid var(--rule); background: var(--field); color: var(--ink); cursor: pointer; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
.pk:active { background: var(--accent-soft); border-color: var(--accent); }
.pk-sym { color: var(--accent); }
.pk-fn { font-size: 16px; color: var(--ink-2); }
.pk-more { font-size: 15px; font-weight: 600; color: var(--ink); }
.pk-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 600; }
.pad-hint { margin: -2px 0 0; }
.pad-off { justify-self: start; font-size: 14px; }
.has-pad .part input { caret-color: var(--accent); }
@media (orientation: landscape) and (max-height: 520px) {
  .pad { max-width: none; }
  .pad-p { display: none; }
  .pad-l { display: block; }
  .pad-l .pad-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
  .pk { min-height: 38px; font-size: 17px; }
  .pk-check { font-size: 14px; }
  .pk-fn, .pk-more { font-size: 14px; }
  .pad-hint { display: none; }
}

/* correct: the ladder lights up from the bottom, the tick pops with a ring, today's count bumps */
.ladder.won::after {
  content: ""; position: absolute; left: 11px; bottom: 14px; width: 3px; border-radius: 2px; background: var(--ok);
  animation: climb 700ms ease-out forwards;
}
@keyframes climb { from { height: 0; } to { height: calc(100% - 28px); } }
.ladder.won .rung .node { animation: node-pop 300ms ease-out backwards; }
.ladder.won .rung:nth-last-child(1) .node { animation-delay: 0ms; }
.ladder.won .rung:nth-last-child(2) .node { animation-delay: 140ms; }
.ladder.won .rung:nth-last-child(3) .node { animation-delay: 280ms; }
.ladder.won .rung:nth-last-child(4) .node { animation-delay: 420ms; }
@keyframes node-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.35); background: var(--ok); border-color: var(--ok); } 100% { transform: scale(1); } }
.tick { position: relative; }
.tick::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--ok); opacity: 0;
  animation: ring 700ms ease-out 120ms;
}
@keyframes ring { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(2.4); opacity: 0; } }
.chip {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 13px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chip-streak { background: var(--ok); color: #FFFFFF; }
.chip.bump { animation: bump 450ms ease-out; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* wrong: a short shake on what was wrong */
.shake { animation: shake 380ms ease-in-out; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* question sheet: fit a phone screen without scrolling where possible */
.sheet .prose-lg { font-size: 17px; line-height: 1.5; }
.sheet .fig { margin-top: 10px; padding: 6px; }
.sheet .fig svg { max-height: 34vh; }
.sheet .btn { margin-top: 12px; }

/* diagrams: tap to enlarge */
.fig { cursor: zoom-in; position: relative; }
.fig::after {
  content: "⤢"; position: absolute; top: 6px; right: 8px; font-size: 15px; color: var(--ink-2); opacity: 0.7; pointer-events: none;
}
.zoom {
  width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; padding: 0; border: 0;
  background: var(--surface); color: var(--ink);
}
.zoom[open] { display: flex; flex-direction: column; }
.zoom::backdrop { background: rgba(10, 16, 28, 0.6); }
.zoom-bar {
  flex: none; display: flex; justify-content: flex-end; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; border-bottom: 1px solid var(--rule);
}
.zoom-bar .icon-btn { font-size: 24px; border: 1px solid var(--rule); }
.zoom-stage { flex: 1; overflow: auto; touch-action: pan-x pan-y; padding: 16px; }
.zoom-inner { width: 100%; margin: 0 auto; color: var(--ink); }
.zoom-inner svg { display: block; width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
  .ladder.won::after { animation: none; height: calc(100% - 28px); }
}

.done-progress { margin: 4px 0 10px; max-width: 640px; }
.done-progress .meter-bar { height: 10px; }
.lbl-short { display: none; }

.brand-sub { font-weight: 400; color: var(--ink-2); }

.again { margin: -6px 0 14px; }
.confirm { margin: auto; border-radius: 14px; max-width: min(92vw, 480px); }
.confirm h2 { margin-top: 0; }
.confirm .btn { width: auto; margin-top: 0; }
.src { color: var(--ink-2); font-size: 14px; margin-top: 6px; }

/* subject parts (Mirror 1, Mirror 2) */
.lec-part { margin: 0 0 14px; border-top: 1px solid var(--rule); }
.lec-part > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 0; list-style: none; }
.lec-part > summary::-webkit-details-marker { display: none; }
.lec-part > summary::before { content: "▸"; color: var(--ink-2); transition: transform 0.15s; }
.lec-part[open] > summary::before { transform: rotate(90deg); }
.part-name { font-size: 20px; font-weight: 600; }
.part-meta { color: var(--ink-2); font-size: 15px; }
button.lecture { font: inherit; text-align: left; width: 100%; cursor: pointer; }
.lecture.is-closed { background: transparent; border-style: dashed; color: var(--ink-2); }
.lecture.is-closed .lec-code { color: var(--ink-2); }
.lecture.is-closed .lec-name { color: var(--ink-2); }
.lock { color: var(--ink-2); opacity: 0.7; }
@media (max-width: 600px) { .lecture.is-closed { border: 0; border-bottom: 1px solid var(--rule); } }
.prev-link { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius-s); background: var(--accent-soft); font-size: 15px; }
.keys { gap: 6px; }
.key { min-width: 38px; padding: 0 6px; }

.sol-tabs { display: flex; gap: 6px; margin: 4px 0 10px; flex-wrap: wrap; }
.sol-tabs button { font: inherit; font-size: 14px; padding: 5px 12px; border-radius: 16px; border: 1px solid var(--rule); background: var(--field); color: var(--ink); cursor: pointer; }
.sol-tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.signin-slot { display: flex; flex-direction: column; align-items: stretch; gap: 10px; min-height: 44px; }
.fake-login { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); }
.fake-login input { font: inherit; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--field); color: var(--ink); }

/* ---------- three tiles: Daily Practice, Practice, Previous Year Qs ---------- */
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 18px; }
.tile { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.tile h2 { margin: 0; font-size: 1.15rem; }
.tile-daily { border-top: 4px solid var(--accent); }
.tile-practice { border-top: 4px solid var(--ink-2); }
.tile-pyq { border-top: 4px solid var(--paya); }
.tile.is-locked { opacity: 0.8; }
.tile-meta { margin: 0; color: var(--ink-2); }
.tile-meta b { color: var(--ink); }
.tile .bar { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.tile .bar i { display: block; height: 100%; background: var(--accent); }
.tile-link { align-self: center; font-size: 15px; }
.tile-choices { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile-choices .btn { padding-inline: 6px; text-align: center; }
.tile-choices .btn-wide { grid-column: 1 / -1; }   /* a lone full-width button spans the whole tile, like the Daily Practice button */
.lock-line { display: flex; gap: 8px; align-items: center; }
.lock-line svg { width: 16px; height: 16px; flex: none; }
@media (max-width: 600px) and (orientation: portrait) { .tile-choices { grid-template-columns: 1fr; } }
@media (orientation: landscape) and (max-height: 520px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } .tile { padding: 12px; } }

/* ---------- Daily Practice: context keys, tap-to-order, proof table ---------- */
.pad-ctx { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); margin-bottom: 6px; }   /* auto-fill: one or two keys stay key-sized */
.pad-ctx .pk { background: var(--accent-soft); }
.opt.is-picked { border-color: var(--accent); }
.tap-order, .proof-pool { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.tap { width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 10px 12px; display: flex; gap: 10px; align-items: center; cursor: pointer; min-height: 44px; }
.tap.is-on { border-color: var(--accent); }
.tap-n { width: 1.6em; height: 1.6em; flex: none; border-radius: 50%; border: 1px solid var(--rule); display: grid; place-items: center; font-weight: 600; font-size: 0.9em; }
.tap.is-on .tap-n { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.proof { width: 100%; border-collapse: collapse; margin-bottom: 10px; font-size: 0.95rem; }
.proof th { text-align: left; font-weight: 500; color: var(--ink-2); border-bottom: 1px solid var(--rule); padding: 6px; }
.proof td { border-bottom: 1px solid var(--rule); padding: 8px 6px; vertical-align: top; }
.proof .pf-n { width: 1.8em; color: var(--ink-2); }
.proof .pf-r { color: var(--ink-2); }
.proof .pf-x { width: 2em; text-align: right; }
.proof select { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 6px; max-width: 100%; }
@media (max-width: 600px) and (orientation: portrait) {
  .proof thead { display: none; }
  .proof tr { display: grid; grid-template-columns: 1.8em 1fr 2em; }
  .proof .pf-s { grid-column: 2; } .proof .pf-r { grid-column: 2; grid-row: 2; padding-top: 0; } .proof .pf-x { grid-column: 3; grid-row: 1; }
}

/* ---------- Previous Year Qs, waits and the daily limit ---------- */
.pyq-note { background: var(--paya-soft); border-left: 3px solid var(--paya); padding: 10px 12px; border-radius: var(--radius-s); margin: 0 0 12px; }
.pyq-lock { color: var(--ink-2); margin: 0; }
.wait .wait-n { font-size: 2rem; margin: 8px 0 16px; }
.limit .mistakes { padding-left: 1.2em; }

/* ---------- Daily Practice figures (drawn on the server; themed here) ---------- */
svg.dfig { width: 100%; max-width: 460px; height: auto; display: block; margin: 0 auto; color: var(--ink); }
svg.dfig .fl { stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; fill: none; }
svg.dfig .fd { stroke-dasharray: 5 4; }
svg.dfig .fc { fill: none; stroke: var(--ink); stroke-width: 1.4; }
svg.dfig .fm { fill: none; stroke: var(--mid); stroke-width: 1.5; }
svg.dfig .fa { stroke: var(--accent); fill: none; }
svg.dfig .fw { stroke-width: 2.4; }
svg.dfig .fp { fill: var(--ink); }
svg.dfig .ft { fill: var(--ink); font-size: 14px; font-weight: 600; text-anchor: middle; font-family: var(--font); }
svg.dfig .fq { fill: var(--accent); font-size: 15px; font-weight: 700; text-anchor: middle; font-family: var(--font); }

/* Figure watermark: present across the whole figure but quiet (light text on a dark background reads stronger) */
svg .wm { opacity: 0.055; }
:root[data-theme="dark"] svg .wm { opacity: 0.04; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) svg .wm { opacity: 0.04; } }

/* ---------- Daily Practice: shared player additions (both subjects) ---------- */
/* why this question is here: lecture, reason, level (never the skill name) */
.q-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip-quiet { background: var(--field); color: var(--ink-2); border: 1px solid var(--rule); font-weight: 500; }
.chip-retry { background: color-mix(in srgb, var(--mid) 14%, transparent); color: var(--mid); }
/* the expected answer format inside each box */
.part input::placeholder { color: var(--ink-2); opacity: 0.75; font-size: 15px; }
/* a labelled multiple-choice part (e.g. Position: Inside / Outside) */
.choice-part { display: grid; gap: 6px; }
.choice-label { font-weight: 500; }
/* hints not seen during the question, shown with the solution */
.sol-hints { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px dashed var(--rule); }
.sol-hints p { margin: 0 0 6px; color: var(--ink-2); }
.sol-hints b { color: var(--mid); margin-right: 6px; }
.so-far { color: var(--ink-2); font-size: 14px; }
.tile-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 22px; }
.tile-links .tile-link { align-self: auto; }

/* no figure (most Algebra questions): question above the answer, in one readable column */
@media (min-width: 601px) and (max-width: 999px) and (min-height: 521px) {   /* small tablets only; laptops and big tablets keep question left, answer right */
  .player.no-fig { max-width: 860px; margin-inline: auto; width: 100%; }
  body.on-player .no-fig .player-grid { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 16px; }
  body.on-player .no-fig .stmt { max-height: 40vh; border-bottom: 1px solid var(--rule); padding-bottom: 12px; }
}

/* Daily Practice: my progress */
.h-sub { font-size: 1.05rem; margin: 24px 0 10px; }
.strip { display: flex; flex-wrap: wrap; gap: 4px; }
.day { display: inline-block; width: 22px; height: 22px; border-radius: 4px; background: var(--field); border: 1px solid var(--rule); flex: none; }
.day.is-part { background: var(--accent-soft); border-color: var(--accent); }
.day.is-full { background: var(--accent); border-color: var(--accent); }
.strip-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.strip-key .day { width: 14px; height: 14px; margin-left: 10px; }
.strip-key .day:first-child { margin-left: 0; }
.tbl-wrap { overflow-x: auto; }
.skills-tbl { border-collapse: collapse; width: 100%; font-size: 15px; }
.skills-tbl th, .skills-tbl td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.skills-tbl td:first-child { white-space: normal; min-width: 180px; }
.skills-tbl thead th { color: var(--ink-2); font-weight: 500; }
.skills-tbl tr.grp th { color: var(--accent); font-weight: 600; padding-top: 18px; }
.acc-hi { color: var(--ok); font-weight: 600; }
.acc-lo { color: var(--bad); font-weight: 600; }

/* a two-way choice inside a typed Practice answer (Opens: Upward / Downward) */
.part-choice { align-items: start; }
.part-choice .opts-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.part-choice .opts-inline .opt { flex: 1 1 120px; min-height: 44px; padding: 8px 14px; text-align: center; }
.part-choice.is-wrong .opt.is-picked { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 15%, transparent); }
.part-choice.is-right .opt.is-picked { border-color: var(--ok); }

/* ---- Question language switch (EN ⇄ मराठी) ---- */
.lang-switch { margin-left: auto; display: inline-flex; align-items: stretch; padding: 0; border: 1px solid var(--rule); border-radius: 999px; background: var(--field); font: inherit; font-size: 13px; cursor: pointer; overflow: hidden; color: var(--ink-2); }
.lang-switch span { padding: 3px 10px; transition: background-color 200ms ease, color 200ms ease; }
.lang-switch[aria-pressed="false"] .ls-en, .lang-switch[aria-pressed="true"] .ls-mr { background: var(--accent); color: var(--accent-ink, #FFFFFF); font-weight: 600; }
.lang-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qtext { transition: opacity 180ms ease, filter 180ms ease; }
.qtext.q-fading { opacity: 0; filter: blur(2px); }
[lang="mr"] { font-family: 'Noto Sans Devanagari', var(--font); }
.qtext[lang="mr"] { line-height: 1.7; }

.gate.stop .stop-ico { color: var(--ok); }

/* ---- Entrance exam warm-up readiness check ---- */
.wu-question { margin: 1.5rem 0; }
.wu-stem { font-size: 1.05rem; line-height: 1.6; margin-bottom: 1rem; }
.wu-opts { display: flex; flex-direction: column; gap: 8px; }
.wu-opt { text-align: left; justify-content: flex-start; border: 1.5px solid var(--rule); background: var(--field); }
.wu-opt-sel { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.wu-topics { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: 10px; }
.wu-topic-row { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 6px; gap: 2px 8px; align-items: center; }
.wu-topic-name { font-size: 0.92rem; color: var(--ink); }
.wu-topic-score { font-size: 0.85rem; font-weight: 600; }
.wu-topic-score.ok { color: var(--ok); }
.wu-topic-score.mid { color: var(--mid); }
.wu-topic-score.bad { color: var(--bad); }
.wu-topic-bar { grid-column: 1 / -1; height: 6px; }

/* ---- Entrance Exam — Test Series OMR player ---- */
.ent-exam-page { display: flex; flex-direction: column; min-height: 100%; }
.ent-exam-header { display: flex; align-items: center; justify-content: space-between; padding: .65rem 1rem; background: var(--surface); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 10; gap: .5rem; }
.ent-paper-title { font-size: .85rem; font-weight: 600; color: var(--ink); flex: 1; }
.ent-timer { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.ent-timer.is-warn { color: var(--mid); }
.ent-timer.is-urgent { color: var(--bad); }
.ent-q-grid { display: flex; flex-wrap: wrap; gap: 4px; padding: .6rem 1rem; border-bottom: 1px solid var(--rule); }
.ent-q-btn { min-width: 2rem; height: 2rem; padding: 0; font-size: .78rem; font-weight: 600; background: var(--field); border: 1.5px solid var(--rule); border-radius: var(--radius-s); cursor: pointer; color: var(--ink); line-height: 1; }
.ent-q-btn.is-answered { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ent-q-btn.is-partial { border-color: var(--mid); color: var(--mid); }
.ent-q-btn.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }
.ent-exam-body { padding: 1rem; flex: 1; }
.ent-section-label { font-size: .78rem; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .6rem; }
.ent-q-text { font-size: 1rem; line-height: 1.65; margin-bottom: 1rem; }
.ent-fig { margin: .5rem 0 1rem; max-width: 100%; }
.ent-omr { margin: 1rem 0; padding: 1rem; background: var(--surface); border-radius: var(--radius-m); border: 1px solid var(--rule); }
.ent-omr-display { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.ent-omr-label-sm { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.ent-omr-show { font-size: 1.8rem; font-family: monospace; letter-spacing: .15em; color: var(--ink-2); line-height: 1; }
.ent-omr-show.is-set { color: var(--accent); }
.ent-omr-clear { font-size: .78rem; padding: .2rem .55rem; }
.ent-omr-row { display: flex; align-items: center; gap: 3px; margin-bottom: 5px; flex-wrap: wrap; }
.ent-omr-label { font-size: .78rem; font-weight: 600; color: var(--ink-2); min-width: 2.5rem; }
.ent-omr-digit { min-width: 2rem; height: 2rem; padding: 0; font-size: .9rem; font-weight: 600; border: 1.5px solid var(--rule); background: var(--field); border-radius: var(--radius-s); cursor: pointer; color: var(--ink); line-height: 1; }
.ent-omr-digit.is-sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.ent-exam-nav { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; background: var(--surface); border-top: 1px solid var(--rule); position: sticky; bottom: 0; gap: .5rem; }


/* ── Answer entry for 00–99: one control, the same in Daily Practice, Quick Practice and the test paper ──────
   Phone held upright, or a narrow phone on its side      → number box (the base style; no media query)
   Phone on its side, 800px or wider                      → two rows of ten small bubbles, on the right
   Landscape window 460–619px tall                        → two rows of ten bubbles, on the right
   Small tablet held upright (under 1000px tall)          → two rows of ten bubbles, under the question
   Tablet (upright ≥1000px tall, or landscape ≥620px tall), laptop, desktop
                                                          → two vertical columns (Tens | Units) with
        "Your answer", Clear and Check answer beside them; bubbles are sized from the screen height so the
        question, the hint, the pad and Check answer fit one screen without scrolling
   In every landscape layout the question (and diagram) is on the left and the answer on the right.
──────────────────────────────────────────────────────────────────────────────────────────────────────── */

/* shared bubble */
.ent-omr-digit { min-width: 2rem; height: 2rem; padding: 0; font-size: .9rem; font-weight: 600;
  border: 1.5px solid var(--rule); background: var(--field); border-radius: 50%;
  cursor: pointer; color: var(--ink); line-height: 1; touch-action: manipulation;
  display: flex; align-items: center; justify-content: center; }
.ent-omr-digit.is-sel { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.ent-omr-digit:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* "Your answer: 42  [Clear]" and the reminder */
.ent-omr-display { flex-wrap: wrap; min-height: 44px; }
.ent-omr-clear { min-height: 44px; }
.ent-omr-show { white-space: nowrap; }
.ent-omr-display .ent-omr-hint { flex: 1 0 100%; margin: 0; display: none; }

/* number box (base) */
.ent-omr-compact-input { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .5rem 0 .75rem; }
.ent-omr-compact-input .fine { margin: 0; }
.ent-omr-native-input {
  font-size: 2rem; font-family: monospace; font-weight: 700; letter-spacing: .15em;
  text-align: center; width: 8rem; padding: .4rem .6rem;
  background: var(--field); color: var(--ink); border: 2px solid var(--rule);
  border-radius: var(--radius-m); outline: none;
}
.ent-omr-native-input::placeholder { font-size: 1.15rem; font-weight: 500; letter-spacing: .02em; }
.ent-omr-native-input:focus { border-color: var(--accent); }
/* After Check answer: the whole 00–99 box (typed input, shown digits, chosen bubbles) turns red or green */
.ent-omr.is-wrong .ent-omr-native-input, .ent-omr.is-wrong .ent-omr-digit.is-sel { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 15%, transparent); }
.ent-omr.is-wrong .ent-omr-show.is-set, .ent-omr.is-wrong .ent-omr-native-input { color: var(--bad); }
.ent-omr.is-wrong .ent-omr-digit.is-sel { background: var(--bad); color: #fff; }
.ent-omr.is-right .ent-omr-native-input, .ent-omr.is-right .ent-omr-digit.is-sel { border-color: var(--ok); }
.ent-omr.is-right .ent-omr-show.is-set, .ent-omr.is-right .ent-omr-native-input { color: var(--ok); }
.ent-omr.is-right .ent-omr-digit.is-sel { background: var(--ok); color: #fff; }
@media (max-width: 600px) { .answer .ent-omr { padding: .75rem; width: 100%; box-sizing: border-box; } }

/* vertical columns: Tens on the left, Units on the right; --b is the bubble size */
.ent-omr-columns { display: none; grid-template-columns: repeat(2, auto); gap: 0 28px; justify-content: start; }
.ent-omr-column { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.ent-omr-column .ent-omr-label { font-size: .8rem; font-weight: 600; color: var(--ink-2); text-align: center; margin-bottom: 2px; }
.ent-omr-column .ent-omr-digit { width: var(--b, 44px); min-width: 0; height: var(--b, 44px); min-height: 0; font-size: clamp(.75rem, calc(var(--b, 44px) * .38), .95rem); }

/* horizontal rows of ten */
.ent-omr-hrows { display: none; flex-direction: column; gap: 8px; }
.ent-omr-hrow { display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
.ent-omr-hrow .ent-omr-label { font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.ent-omr-hrow-digits { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.ent-omr-hrow-digits .ent-omr-digit { width: min(44px, 100%); min-width: 0; height: auto; aspect-ratio: 1; justify-self: center; }

/* LANDSCAPE: question (and diagram) on the left, answer on the right */
@media (orientation: landscape) and (min-width: 600px) {
  .ent-exam-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(300px, 42vw, 520px);
    grid-template-rows: auto 1fr;
    gap: 0 1.5rem;
    align-items: start;
    padding: .75rem 1rem;
  }
  .ent-exam-body .ent-section-label { grid-column: 1; }
  .ent-exam-body .ent-q-text { grid-column: 1; margin-bottom: .5rem; }
  .ent-exam-body .ent-fig { grid-column: 1; }
  .ent-exam-body .ent-omr { grid-column: 2; grid-row: 1 / 5; align-self: start; margin: 0; }

  /* practice: two columns also when the question has no figure (figure-less questions are otherwise stacked
     in one column, which put the answer underneath the question) */
  body.on-player .player.has-omr { max-width: none; }
  body.on-player .player.has-omr .player-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: none; gap: clamp(16px, 2.5vw, 36px); }
  body.on-player .player.has-omr .stmt { max-height: none; border-bottom: 0; }
  /* the pad sits straight in the answer card: no box inside a box */
  .answer .ent-omr { border: 0; background: none; padding: 0; margin: 0; }
  .answer .ent-omr-display { margin-bottom: .5rem; }
}

/* ROWS OF TEN: a phone on its side from 800px wide, and a landscape window too short for ten stacked bubbles */
@media (orientation: landscape) and (min-width: 800px) and (max-height: 459px),
       (orientation: landscape) and (min-width: 600px) and (min-height: 460px) and (max-height: 619px),
       (orientation: portrait) and (min-width: 600px) and (max-height: 999px) {
  .ent-omr-compact-input { display: none; }
  .ent-omr > .ent-omr-hrows { display: flex; }
}
/* small tablet held upright (under 1000px tall): the question is above and the answer below, so ten stacked
   bubbles would be under 32px; two rows of ten fit the width instead. Taller tablets get the columns below. */
@media (orientation: portrait) and (min-width: 600px) and (max-height: 999px) {
  .ent-omr-display .ent-omr-hint { display: inline; flex: 1 1 11rem; }
  .ent-omr-hrow { flex-direction: row; align-items: center; gap: 8px; }
  .ent-omr-hrow .ent-omr-label { min-width: 2.8rem; }
  .ent-omr-hrow-digits { flex: 1; max-width: 520px; gap: 5px; }
}
/* the test paper has its title, question numbers and Submit bar on screen as well: below 760px of height it
   keeps the two rows of ten, because ten stacked bubbles would be too small to tap */
@media (orientation: landscape) and (min-width: 600px) and (min-height: 620px) and (max-height: 759px) {
  .ent-exam-body .ent-omr > .ent-omr-hrows { display: flex; }
  .ent-exam-body .ent-omr > .ent-omr-columns { display: none; }
  .ent-exam-body .ent-omr-display .ent-omr-hint { flex: 1 1 11rem; }
}
@media (orientation: landscape) and (min-width: 600px) and (min-height: 460px) and (max-height: 619px) {
  .ent-omr-display .ent-omr-hint { display: inline; flex: 1 1 11rem; }
  body.on-player .has-omr .rung-body { padding-top: 10px; padding-bottom: 10px; }
  body.on-player .has-omr .answer { gap: 8px; }
  body.on-player .has-omr .climb { padding-bottom: 4px; }
  .ent-omr .ent-omr-display { min-height: 36px; margin-bottom: .35rem; }
  .ent-omr .ent-omr-clear { min-height: 34px; padding-block: 2px; }
  .ent-omr .ent-omr-hrows { gap: 6px; }
  .ent-exam-body { padding-block: .4rem; }
}

/* PHONE ON ITS SIDE: the screen is about 390px tall, so the card title goes and the test paper's question
   numbers become one row that scrolls sideways */
@media (orientation: landscape) and (min-width: 600px) and (max-height: 459px) {
  body.on-player .has-omr #rung-ans h3 { display: none; }
  body.on-player .player.has-omr .player-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px; }
  .ent-omr-compact-input .fine { display: none; }
  .ent-omr .ent-omr-show { font-size: 1.4rem; }
  .ent-omr-compact-input { padding: 0 0 .25rem; align-items: flex-start; }
  .ent-omr-native-input { font-size: 1.5rem; width: 6.5rem; padding: .2rem .4rem; }
  .ent-omr-hrow-digits .ent-omr-digit { font-size: .82rem; }
  .ent-omr .ent-omr-display { min-height: 36px; margin-bottom: .35rem; }
  .ent-omr .ent-omr-clear { min-height: 34px; padding-block: 2px; }
  .ent-omr .ent-omr-hrows { gap: 6px; }
  .ent-exam-header { padding-block: .3rem; }
  .ent-q-grid { flex-wrap: nowrap; overflow-x: auto; }
  .ent-q-grid .ent-q-btn { flex: none; }
  .ent-exam-nav { padding-block: .35rem; }
  .ent-exam-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); padding-block: .4rem; }
}
/* …and where the bubbles show (800px and wider) Check answer sits on the "Your answer" line; the number box on a
   narrower phone keeps the button underneath, where it cannot cover Clear */
@media (orientation: landscape) and (min-width: 800px) and (max-height: 459px) {
  body.on-player .has-omr .answer { position: relative; }
  body.on-player .has-omr .answer > .answer-row { position: absolute; top: 0; right: 0; }
  body.on-player .has-omr .answer > .answer-row .btn { min-height: 36px; padding: 4px 12px; }
}

/* TABLET (landscape), LAPTOP, DESKTOP: two vertical columns, with "Your answer", Clear and Check answer beside them */
@media (orientation: landscape) and (min-width: 600px) and (min-height: 620px),
       (orientation: portrait) and (min-width: 600px) and (min-height: 1000px) {
  .ent-omr-compact-input { display: none; }
  .ent-omr > .ent-omr-columns { display: grid; }
  .ent-omr-display .ent-omr-hint { display: inline; }

  /* practice: the answer form is the grid; the pad's parts take their places in it */
  .has-omr .answer { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 28px; align-items: start; }
  .has-omr .answer .ent-omr { display: contents; }
  .has-omr .answer .ent-omr > .ent-omr-columns { grid-column: 1; grid-row: 1 / span 5; }
  .has-omr .answer .ent-omr-display { grid-column: 2; grid-row: 1; margin: 0; }
  .has-omr .answer > .answer-row { grid-column: 2; grid-row: 2; }
  .has-omr .answer .ent-omr.is-locked .ent-omr-display { grid-column: 1 / -1; }
}
/* test paper: the same columns from 760px of height (see the rows rule above for shorter screens) */
@media (orientation: landscape) and (min-width: 600px) and (min-height: 760px),
       (orientation: portrait) and (min-width: 600px) and (min-height: 1000px) {
  .ent-exam-body .ent-omr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 24px; align-items: start; }
  .ent-exam-body .ent-omr > .ent-omr-columns { grid-column: 1; grid-row: 1; }
  .ent-exam-body .ent-omr-display { grid-column: 2; grid-row: 1; margin: 0; }
}
/* bubble size: what is left of the screen height after everything else on the screen, shared by ten bubbles */
@media (orientation: landscape) and (min-width: 600px) and (min-height: 620px) {
  .has-omr .answer { --b: clamp(26px, calc((100dvh - 328px) / 10 - 5px), 44px); }
  .ent-exam-body .ent-omr { --b: clamp(26px, calc((100dvh - 404px) / 10 - 5px), 44px); }
}
@media (orientation: landscape) and (min-width: 600px) and (min-height: 460px) {
  /* test paper: the 30 question numbers stand in a strip on the left (1–10, 11–20, 21–30) instead of lying
     across the top, which gives that height back to the bubbles */
  .ent-exam-page { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr auto; min-height: 0; }
  .ent-exam-header, .ent-exam-nav { grid-column: 1 / -1; }
  .ent-q-grid { display: grid; grid-template-rows: repeat(10, auto); grid-auto-flow: column; grid-auto-columns: auto; align-content: start; justify-content: start;
    gap: 4px; padding: .75rem .6rem .75rem 1rem; border-bottom: 0; border-right: 1px solid var(--rule); }
  .ent-q-grid .ent-q-btn { height: clamp(1.5rem, calc((100dvh - 346px) / 10 - 4px), 2rem); }
  @media (max-height: 619px) { .ent-q-grid { grid-template-rows: repeat(6, auto); } .ent-q-grid .ent-q-btn { height: 1.75rem; min-width: 1.75rem; } }
}
/* tablet held upright, 1000px or taller: the same columns, under the question */
@media (orientation: portrait) and (min-width: 600px) and (min-height: 1000px) {
  .has-omr .answer { --b: clamp(32px, calc((100dvh - 606px) / 10 - 5px), 44px); }
  .ent-exam-body .ent-omr { --b: clamp(32px, calc((100dvh - 604px) / 10 - 5px), 44px); }
}

/* once the answer is checked the pad has done its job: keep only the "Your answer" line, so the hint,
   the solution and Next question fit without scrolling */
.ent-omr.is-locked > :not(.ent-omr-display) { display: none !important; }
.ent-omr.is-locked .ent-omr-clear, .ent-omr.is-locked .ent-omr-hint { display: none; }
.ent-omr.is-locked .ent-omr-display { margin-bottom: 0; }
.ent-topic-counts { grid-column: 1 / -1; color: var(--ink-2); font-size: .85rem; }
.ent-result-message { border-left: 3px solid var(--accent); padding: .5rem 1rem; margin: 1.5rem 0; }
.ent-result-message p { margin: .4rem 0; }
@media (max-width: 600px) {
  .ent-exam-nav { gap: 6px; flex-wrap: wrap; }
  .ent-exam-nav .btn { min-height: 44px; padding-inline: 10px; }
}
.gate.stop span.stop-ico { display: block; color: var(--accent); }

/* ---------- Maths (KaTeX) — match the text, keep sizes consistent ---------- */
/* KaTeX's default is 1.21× the text: too big and heavy beside Lexend. */
.katex { font-size: 1.05em; }
/* Display maths ($$…$$): one step per line, full-size fractions, scrolls sideways on narrow phones instead of overflowing. */
.katex-display { margin: 0.55em 0; padding: 2px 0; overflow-x: auto; overflow-y: hidden; }
.katex-display > .katex { font-size: 1.1em; }
/* A line holding an inline fraction gets room above and below so it doesn't touch the lines around it. */
.prose p:has(.katex .mfrac), .final:has(.katex .mfrac) { line-height: 2; }
.final .katex { font-size: 1.1em; }
/* MPI-style worked solutions (Daily Practice / Practice tile) */
.sx { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 14px; row-gap: 4px; align-items: baseline; margin: 6px 0; }
.sx-row { display: contents; }
.sx-m { font-variant-numeric: tabular-nums; }
.sx-why { color: #5b6b8c; font-style: italic; font-size: 0.92em; white-space: nowrap; }
.sx-why:not(:empty)::before { content: '('; } .sx-why:not(:empty)::after { content: ')'; }
.sx-tag { color: #8a5a00; font-weight: 600; min-width: 2.2em; text-align: right; }
.sx-op { color: #1f6feb; font-weight: 700; }
.sx-p, .sx-ans { grid-column: 1 / -1; margin: 6px 0 2px; }
.sx-ans { font-weight: 600; } .sx-ans::before { content: '∴ '; color: #1f6feb; }
.sx-g { grid-column: 1 / -1; border-left: 3px solid #d6e2f5; padding-left: 10px; margin: 2px 0; }
.sx-g > summary { cursor: pointer; color: #245; list-style: none; }
.sx-g > summary::-webkit-details-marker { display: none; }
.sx-g > summary::before { content: '+'; display: inline-block; width: 1.1em; font-weight: 700; color: #1f6feb; }
.sx-g[open] > summary::before { content: '−'; }
@media (max-width: 520px) { .sx { grid-template-columns: minmax(0, 1fr) auto; } .sx-why { grid-column: 1; white-space: normal; padding-left: 1.4em; } .sx-tag { grid-row: span 1; } }

/* Track A: last-10 circles, tiny level mark, question feedback */
.past-dots { display: inline-flex; gap: 3px; align-items: center; margin-left: 6px; vertical-align: middle; }   /* own name: .past is the 'Last time' box */
.pd { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.pd-g { background: #2e9d5b; } .pd-a { background: #e2b33b; } .pd-r { background: #d64545; } .pd-e { border: 1.5px solid #c5cbd6; width: 6px; height: 6px; }
.lvmark { margin-left: auto; font-size: 10px; color: #b7bcc6; letter-spacing: 1px; }
.qfb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 4px; font-size: 13px; }
.qchips { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.qchips-why { padding-top: 8px; border-top: 1px dashed var(--line, #ddd); }
.qchip { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 44px; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line, #ccc); border-radius: 999px; background: transparent; color: inherit; cursor: pointer; }
.qchip.is-on { background: var(--accent-soft, #e6f1fb); border-color: var(--accent, #185fa5); color: var(--accent, #185fa5); }
.qchips-why .qchip { border-radius: 12px; }
.qchip-w { font-size: 11px; line-height: 1.1; max-width: 72px; text-align: center; }
.qchip-say { width: 100%; min-height: 18px; }
/* teacher: student flags */
.redflag { color: #a32d2d; } .card-red { border-color: #e24b4a; }
.flag-item { border: 1px solid var(--line, #ddd); border-radius: 8px; padding: 8px 10px; margin: 8px 0; } .flag-item.is-red { border-color: #e24b4a; background: #fcebeb; }
.flag-ex { margin: 6px 0; padding-left: 8px; border-left: 3px solid var(--line, #ddd); } .flag-act { display: flex; gap: 8px; margin-top: 6px; }
.btn-mini { padding: 3px 10px; font-size: 13px; }
.btn-mini.is-on { background: #e6f1fb; border-color: #85b7eb; }
.table-wrap { overflow-x: auto; }

/* Saved questions */
.qsave.is-on { color: var(--accent); }
.saved-link { margin-top: 14px; } .saved-link svg { vertical-align: -4px; margin-right: 4px; }
.saved-list { list-style: none; padding: 0; margin: 12px 0; }
.saved-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line, #ddd); }
.saved-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.saved-title { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.saved-note { font-style: italic; }
.sv-answer { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; align-items: flex-start; }
.sv-part { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .sv-in { min-width: 160px; padding: 6px 8px; }
.sv-sol { margin: 14px 0; } .sv-note { display: flex; flex-direction: column; gap: 4px; margin: 14px 0 6px; } .sv-note input { padding: 6px 8px; }

/* "Not now": pause a topic */
.qchip-wide { flex-direction: row; gap: 6px; font-size: 13px; padding: 6px 12px; min-height: 34px; }
.qchip-days { flex-direction: row; font-size: 13px; padding: 6px 12px; min-height: 34px; }
.pause-sheet { width: 100%; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line, #ddd); }
.pause-h { font-weight: 600; margin: 0 0 2px; } .pause-act { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.paused-line { margin-top: 8px; }

/* Icon-only feedback chips: name on hover / keyboard focus (touch: the line under the chips says what was picked) */
.qchip[data-tip] { position: relative; }
.qchip[data-tip]:hover::after, .qchip[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #1b2433; color: #e8eef8; border: 1px solid #33415a; font-size: 12px; line-height: 1.3; padding: 3px 8px;
  border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 5; }

/* words written inside maths ($\text{…}$, $\textbf{…}$) use the app's font, not the maths serif */
.katex .text, .katex .textbf, .katex .textrm { font-family: var(--font); }

/* Laptop / desktop (mouse or trackpad): the keypad is clicked, not tapped, so smaller keys fit without scrolling */
@media (hover: hover) and (pointer: fine) {
  .pad { max-width: 400px; }
  .pad-grid, .pad-ctx { gap: 4px; }
  .pad-actions { gap: 4px; margin-top: 4px; }
  .pk { min-height: 34px; font-size: 16px; }
  .pk-check { font-size: 15px; }
  .pk-fn, .pk-more { font-size: 13px; }
  .pad-ctx { margin-bottom: 4px; }
}

/* appreciation line under "Correct" (js/cheers.js): small, calm, fades in once */
.cheer { margin: 4px 0 0; font-size: 14px; color: var(--accent); animation: cheer-in .6s ease-out; }
@keyframes cheer-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cheer { animation: none; } }
