/* ═══════════════════════════════════════════════
   BARE BONES — UI Redesign
   Orange · White · Warm Grey  ·  Font: Outfit
   ═══════════════════════════════════════════════ */

/* ── Variables ───────────────────────────────── */
:root {
  /* Surfaces */
  --bg:        #EDEBE6;
  --panel:     #FFFFFF;
  --panel-2:   #F5F3EE;
  --panel-3:   #ECEAE5;

  /* Ink */
  --ink:       #1A1916;
  --ink-2:     #38362F;
  --muted:     #7A7870;
  --line:      #DEDAD2;

  /* Orange — all original names kept for backward compat */
  --accent:              #fa4c06;
  --accent-2:            #fb6a2e;
  --accent-3:            #fc8a58;
  --accent-light:        #fdd0b0;
  --accent-soft:         #fdd0b0;
  --accent-xlight:       #fff0e6;
  --accent-softer:       #fff0e6;
  --accent-xxlight:      #fff8f4;
  --accent-bg:           #fff8f4;
  --accent-edge:         #fcb48a;
  --accent-strong:       #c23504;
  --accent-ink:          #7a2003;
  --accent-dark:         #7a2003;
  --highlight-orange:    #fdb48a;
  --highlight-orange-soft: #fde0cc;

  /* Semantic */
  --success:  #16A34A;
  --danger:   #DC2626;

  /* Typography */
  --font: 'Outfit', system-ui, sans-serif;

  /* Geometry */
  --r-xs:   8px;
  --r-sm:   12px;
  --r-md:   18px;
  --r-lg:   24px;
  --r-xl:   32px;
  --r-full: 999px;
  --radius: 24px; /* legacy alias */

  /* Shadows */
  --s0: 0 1px 3px rgba(0,0,0,0.04);
  --s1: 0 2px 10px rgba(0,0,0,0.06);
  --s2: 0 6px 24px rgba(0,0,0,0.09);
  --s3: 0 24px 72px rgba(0,0,0,0.15);
  --so: 0 4px 22px rgba(249,115,22,0.32);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t: 180ms;
}

/* ── Reset ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* Safari paints the area under its toolbars from the root; without this it shows white */
html { background: var(--bg); }

body {
  margin: 0;
  /* viewport-fit=cover reaches the landscape notch; keep content beside it */
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h2, h3, h4 {
  margin-top: 0;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

/* ── Brand mark ──────────────────────────────── */
.brand-mark {
  position: fixed;
  top: 1rem;
  left: 1.1rem;
  z-index: 20;
  line-height: 0;
  display: block;
}

.brand-mark img {
  height: 32px;
  width: auto;
  display: block;
}

/* ── ASCII header ────────────────────────────── */
.ascii-header {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(0.5rem, 0.68vw, 0.72rem);
  line-height: 1.3;
  color: var(--accent-strong);
  text-align: center;
  margin: 0 0 1.5rem;
  letter-spacing: 0;
  user-select: none;
  overflow-x: auto;
}

/* ── Login overlay ───────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

.login-overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}

.login-overlay.is-exiting {
  animation: overlay-exit 0.55s var(--ease) forwards;
}

@keyframes overlay-exit {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.login-ascii-wrap {
  position: relative;
}

.login-ascii {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(0.6rem, 1.15vw, 0.85rem);
  line-height: 1.32;
  color: var(--accent);
  white-space: pre;
  margin: 0;
  clip-path: inset(0 0 100% 0);
}

.login-overlay.is-visible .login-ascii {
  animation: ascii-reveal 1s linear forwards;
}

@keyframes ascii-reveal {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0% 0); }
}

.login-scan {
  position: absolute;
  top: 0;
  left: -1.5rem;
  right: -1.5rem;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    var(--accent-3) 20%,
    var(--accent) 50%,
    var(--accent-3) 80%,
    transparent);
  box-shadow:
    0 0 14px 4px var(--accent-light),
    0 0 4px 1px var(--accent);
  opacity: 0;
  pointer-events: none;
}

.login-overlay.is-visible .login-scan {
  animation: scan-sweep 1s linear forwards;
}

@keyframes scan-sweep {
  0%   { top: 0%;   opacity: 1; }
  88%  { top: 100%; opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.login-welcome {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.1em;
  text-transform: lowercase;
  margin-top: 2rem;
  opacity: 0;
  transform: translateY(8px);
}

.login-overlay.is-visible .login-welcome {
  animation: welcome-rise 0.45s var(--ease) forwards;
  animation-delay: 1.05s;
}

@keyframes welcome-rise {
  to { opacity: 1; transform: translateY(0); }
}

/* ── App shell ───────────────────────────────── */
.app-shell {
  max-width: none;
  margin: 3.5rem 0 2rem;
  padding: 0 1.25rem 0 0.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* ── Card ────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-xl);
  padding: 1.25rem;
  box-shadow: var(--s1);
}

/* ── Profile avatar ──────────────────────────── */
.profile-avatar-wrap {
  position: fixed;
  top: 0.85rem;
  right: 1.25rem;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

/* Points calculator shortcut, sits left of the avatar */
.calc-link {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel);
  color: var(--ink);
  border: 1.5px solid var(--line);
  box-shadow: var(--s1);
  text-decoration: none;
  transition: transform var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.calc-link:hover {
  transform: scale(1.08);
  color: var(--accent);
  border-color: var(--accent-light);
  box-shadow: var(--s2);
}

.calc-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.profile-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.75);
  background: var(--accent);
  box-shadow: var(--s1), 0 0 0 3px var(--accent-light);
  padding: 0;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  letter-spacing: 0;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.profile-avatar:hover {
  transform: scale(1.08);
  box-shadow: var(--s2), 0 0 0 4px var(--accent-light);
}

.profile-level {
  /* Rides on the avatar as a badge so the timer can sit beside the calculator */
  position: absolute;
  right: 23px; /* centre of the 46px avatar */
  bottom: -0.5rem;
  transform: translateX(50%);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  font-family: var(--font);
  letter-spacing: 0.02em;
  padding: 0.1rem 0.45rem;
  border-radius: var(--r-full);
  box-shadow: 0 0 0 2px var(--bg);
  white-space: nowrap;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 0.5rem;
  width: 244px;
  box-shadow: var(--s3);
  animation: menu-pop 0.18s var(--ease) both;
  transition: width var(--t) var(--ease);
}

.profile-menu.profile-menu-wide { width: 288px; }

@keyframes menu-pop {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-pane { display: grid; gap: 0.15rem; }

/* ── Account identity: the username is the headline ── */
.account-identity {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.7rem 0.75rem;
  margin-bottom: 0.35rem;
  border-bottom: 1.5px solid var(--line);
  overflow: hidden;
}

.account-username {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-email {
  color: var(--muted);
  font-size: 0.74rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Settings-style menu rows ── */
.profile-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: var(--r-xs);
  padding: 0.55rem 0.7rem;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}

.profile-row:hover { background: var(--accent-xlight); color: var(--accent-strong); }
.profile-row-label { flex: 1; }
.profile-row-value { font-size: 0.78rem; font-weight: 500; color: var(--muted); }
.profile-row:hover .profile-row-value { color: var(--accent-strong); }
.profile-row-chevron { font-size: 1.05rem; color: var(--muted); line-height: 1; }
.profile-row:hover .profile-row-chevron { color: var(--accent); }
.profile-row-quiet { color: var(--muted); font-weight: 500; }
.profile-row-link { text-decoration: none; }
.profile-row-link .profile-row-chevron { font-size: 0.8rem; }

.profile-pane-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.2rem 0.6rem;
  margin-bottom: 0.25rem;
  border-bottom: 1.5px solid var(--line);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.profile-pane-head span { flex: 1; white-space: nowrap; }

.profile-pane-back {
  flex-shrink: 0;
  width: auto;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0.1rem 0.35rem;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--r-xs);
  transition: color var(--t) var(--ease), background var(--t) var(--ease);
}

.profile-pane-back:hover { color: var(--accent); background: var(--accent-xlight); }

.profile-pane-hint {
  margin: 0 0.2rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ── Feedback (profile menu pane + admin inbox) ── */
.profile-menu.profile-menu-inbox { width: 360px; }

.feedback-form { display: grid; gap: 0.45rem; padding: 0 0.2rem 0.2rem; }
.feedback-form .profile-pane-hint { margin: 0 0 0.1rem; }

.feedback-textarea {
  resize: vertical;
  min-height: 7.5rem;
  max-height: 40vh;
  padding: 0.6rem 0.75rem;
  font-size: 0.86rem;
  line-height: 1.5;
  border-radius: var(--r-xs);
  background: var(--panel-2);
}
.feedback-textarea:focus { background: var(--panel); }
.feedback-textarea::placeholder { color: var(--muted); }

.feedback-status {
  min-height: 1em;
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--muted);
}
.feedback-status:empty { display: none; }
.feedback-status[data-tone="success"] { color: var(--success); font-weight: 600; }
.feedback-status[data-tone="error"] { color: var(--danger); }

.feedback-submit,
.inbox-action { padding: 0.55rem 0.9rem; font-size: 0.85rem; }
.feedback-submit:disabled,
.inbox-action:disabled { opacity: 0.6; cursor: progress; transform: none; }

.inbox-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem;
  padding: 0.2rem;
  margin: 0 0.2rem 0.35rem;
  background: var(--panel-2);
  border-radius: var(--r-sm);
}
.inbox-filter-btn {
  border: none;
  box-shadow: none;
  background: transparent;
  border-radius: var(--r-xs);
  padding: 0.38rem 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.inbox-filter-btn:hover { color: var(--ink); }
.inbox-filter-btn.active { background: var(--panel); color: var(--ink); box-shadow: var(--s0); }

.inbox-list {
  max-height: min(62vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0.2rem;
}
.inbox-empty {
  margin: 1.4rem 0.4rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.inbox-item {
  display: grid;
  gap: 0.45rem;
  padding: 0.8rem 0.3rem 0.9rem;
}
.inbox-item + .inbox-item { border-top: 1.5px solid var(--line); }

.inbox-item-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.74rem;
  color: var(--muted);
}
.inbox-item-meta strong { font-size: 0.86rem; font-weight: 700; color: var(--ink); }

.inbox-item-message {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.inbox-reply-label { font-size: 0.72rem; font-weight: 600; color: var(--muted); margin-top: 0.15rem; }
.inbox-reply-input { min-height: 4.5rem; }

.inbox-item-reply {
  margin: 0;
  padding: 0.55rem 0.7rem;
  background: var(--accent-xxlight);
  border: 1.5px solid var(--accent-xlight);
  border-radius: var(--r-xs);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.inbox-item-reply span {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.inbox-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
}
.inbox-link {
  width: auto;
  padding: 0.2rem 0.45rem;
  border: none;
  box-shadow: none;
  background: transparent;
  font-size: 0.74rem;
  color: var(--muted);
  border-radius: var(--r-xs);
}
.inbox-link:hover { color: var(--accent-strong); background: var(--accent-xlight); }

/* ── User stats (admin pane, same shell as the inbox) ── */
.profile-menu.profile-menu-usage { width: 400px; }
.usage-range { grid-template-columns: repeat(3, 1fr); }

.usage-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  margin: 0.15rem 0.5rem 0.35rem;
  font-size: 0.74rem;
  color: var(--muted);
}
.usage-summary:empty { display: none; }
.usage-summary strong { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.usage-user + .usage-user { border-top: 1.5px solid var(--line); }

.usage-user-head {
  display: grid;
  grid-template-columns: 1fr auto 0.9rem;
  align-items: baseline;
  column-gap: 0.6rem;
  row-gap: 0.1rem;
  padding: 0.7rem 0.4rem;
  border-radius: var(--r-xs);
  list-style: none;
  cursor: pointer;
  transition: background var(--t) var(--ease);
}
.usage-user-head::-webkit-details-marker { display: none; }
.usage-user-head::after {
  content: "›";
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  transition: transform var(--t) var(--ease);
}
.usage-user-head:hover { background: var(--panel-2); }
.usage-user-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
details[open] > .usage-user-head::after { transform: rotate(90deg); }
.usage-user.is-idle .usage-user-head { cursor: default; }
.usage-user.is-idle .usage-user-head:hover { background: none; }
.usage-user.is-idle .usage-user-head::after { content: ""; }

.usage-user-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}
.usage-user.is-idle .usage-user-name { font-weight: 600; color: var(--ink-2); }
.usage-user-total {
  font-size: 0.88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.usage-user.is-idle .usage-user-total { font-weight: 500; color: var(--muted); }
.usage-user-meta {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  color: var(--muted);
}

.usage-user-body {
  display: grid;
  gap: 0.85rem;
  padding: 0.2rem 0.4rem 0.95rem;
}
.usage-group { display: grid; gap: 0.35rem; }
.usage-group-title {
  margin: 0 0 0.05rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.usage-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 7.5rem) 1fr 3.6rem;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
}
.usage-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}
.usage-bar-track {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--panel-3);
  overflow: hidden;
}
.usage-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.usage-bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
}

/* Reply pop-up, shown once on the student's next visit */
.feedback-reply-screen { z-index: 130; }
.feedback-reply-screen .feedback-reply-card {
  width: min(460px, 100%);
  padding: 1.75rem 1.75rem 1.5rem;
  display: grid;
  gap: 0.9rem;
}
.feedback-reply-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
}
.feedback-reply-title {
  margin: -0.4rem 0 0.2rem;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}
.feedback-reply-list {
  display: grid;
  gap: 1.1rem;
  max-height: 52vh;
  overflow-y: auto;
}
.feedback-reply-item { display: grid; gap: 0.6rem; }
.feedback-reply-item + .feedback-reply-item { padding-top: 1.1rem; border-top: 1.5px solid var(--line); }
.feedback-reply-original {
  margin: 0;
  padding: 0.65rem 0.8rem;
  background: var(--panel-2);
  border-radius: var(--r-sm);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.feedback-reply-original span {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-2);
}
.feedback-reply-text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.feedback-reply-dismiss { margin-top: 0.3rem; }

@media (max-width: 640px) {
  .profile-menu.profile-menu-inbox,
  .profile-menu.profile-menu-usage { width: calc(100vw - 2rem); }
  .usage-bar-row { grid-template-columns: minmax(0, 6.5rem) 1fr 3.4rem; }
  .feedback-textarea { font-size: 16px; }
  .feedback-reply-screen .feedback-reply-card { padding: 1.4rem 1.25rem 1.25rem; }
}

/* ── Authentication ──────────────────────────── */
body.auth-open {
  overflow: hidden;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: clamp(1rem, 3vw, 2.5rem);
  background:
    radial-gradient(circle at 12% 12%, rgba(250, 76, 6, 0.13), transparent 28rem),
    linear-gradient(135deg, var(--bg), #f4f1eb 60%, #e8e4dc);
}

.auth-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image: radial-gradient(rgba(26, 25, 22, 0.22) 0.65px, transparent 0.65px);
  background-size: 7px 7px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

.auth-card {
  position: relative;
  width: min(100%, 510px);
  padding: clamp(1.45rem, 4vw, 2.4rem);
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--s3);
  animation: auth-arrive 0.4s var(--ease) both;
}

@keyframes auth-arrive {
  from { opacity: 0; transform: translateY(18px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
  display: inline-block;
  line-height: 0;
  margin-bottom: 1.8rem;
}

.auth-brand img {
  width: auto;
  height: 31px;
}

.auth-kicker {
  margin-bottom: 0.65rem;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.auth-card h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.45rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.auth-card h2 {
  margin-bottom: 0.45rem;
  font-size: 1.35rem;
}

.auth-intro {
  max-width: 43ch;
  margin: 0.9rem 0 1.4rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 0.3rem;
  margin: 0 0 1.3rem;
  padding: 0.28rem;
  border-radius: var(--r-sm);
  background: var(--panel-3);
}

.auth-tab {
  border: 0;
  border-radius: calc(var(--r-sm) - 3px);
  padding: 0.58rem 0.6rem;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-tab:hover {
  color: var(--ink);
}

.auth-tab.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--s0);
}

.auth-form {
  display: grid;
  gap: 0.55rem;
}

.auth-form label {
  margin-top: 0.25rem;
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 700;
}

.auth-form input,
.auth-form select {
  min-height: 48px;
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.65rem 0.9rem;
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
}

.auth-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-xlight);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 4.2rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  width: auto;
  transform: translateY(-50%);
  border: 0;
  padding: 0.4rem 0.48rem;
  background: transparent;
  box-shadow: none;
  color: var(--accent-strong);
  font-size: 0.75rem;
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.96) !important;
}

.auth-submit {
  min-height: 49px;
  margin-top: 0.65rem;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.auth-text-button,
.auth-back {
  width: auto;
  justify-self: start;
  border: 0;
  padding: 0.35rem 0;
  background: transparent;
  box-shadow: none;
  color: var(--accent-strong);
  font-size: 0.8rem;
}

.field-hint {
  margin: -0.25rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.legacy-badge {
  justify-self: start;
  border: 1px solid var(--accent-edge);
  border-radius: var(--r-full);
  padding: 0.28rem 0.65rem;
  background: var(--accent-xlight);
  color: var(--accent-strong);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.legacy-copy {
  margin: 0.25rem 0 0.5rem;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.auth-status {
  min-height: 1.4rem;
  margin: 0.85rem 0 0;
  border-radius: var(--r-xs);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.auth-status:not(:empty) {
  padding: 0.6rem 0.7rem;
  background: var(--panel-2);
}

.auth-status[data-type="error"]:not(:empty) {
  background: #fff0ee;
  color: #9d241b;
}

.auth-status[data-type="success"]:not(:empty) {
  background: #edf9f0;
  color: #17652b;
}

.auth-privacy {
  margin: 1rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.auth-privacy-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.6rem;
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  color: var(--ink-2);
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.auth-privacy-link span { font-size: 0.65rem; color: var(--muted); }
.auth-privacy-link:hover { background: var(--accent-xlight); border-color: var(--accent-light); color: var(--accent-strong); }
.auth-privacy-link:hover span { color: var(--accent); }
.auth-privacy-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.account-details-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.account-details-row span {
  color: var(--muted);
  font-size: 0.8rem;
}

.account-details-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Avatar / theme picker ───────────────────── */
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.avatar-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition:
    transform var(--t) var(--ease),
    border-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
}

.avatar-option:hover { transform: scale(1.14); }

.avatar-option.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--ink);
}

/* ── Utility ─────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

.muted  { color: var(--muted); }
.small  { font-size: 0.875rem; }
.hidden { display: none !important; }

.theme-label { margin: 0.45rem 0 0.3rem; font-size: 0.85rem; }

/* ── Inputs ──────────────────────────────────── */
input, textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.65rem 0.9rem;
  font: inherit;
  background: var(--panel);
  color: var(--ink);
  display: block;
  transition:
    border-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-xlight);
}

/* ── Buttons — base ──────────────────────────── */
button {
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.6rem 1rem;
  width: 100%;
  background: var(--panel);
  color: var(--ink);
  transition:
    background var(--t) var(--ease),
    color var(--t) var(--ease),
    border-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease),
    transform var(--t) var(--ease);
}

button:active { transform: scale(0.965) !important; }

/* Primary */
.button-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--so);
  letter-spacing: 0.01em;
}

.button-primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 6px 28px rgba(249,115,22,0.42);
  transform: translateY(-1px);
}

/* Secondary */
.button-secondary {
  background: var(--panel);
  color: var(--ink-2);
  border-color: var(--line);
}

.button-secondary:hover {
  background: var(--accent-xlight);
  color: var(--accent-strong);
  border-color: var(--accent-light);
  transform: translateY(-1px);
}

/* ── Main layout ─────────────────────────────── */
.main-content {
  display: grid;
  gap: 1rem;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.subject-area {
  --sidebar-w: 440px;
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
  gap: 1rem;
  align-items: stretch;
  height: calc(100vh - 5.5rem);
  transition: grid-template-columns var(--t) var(--ease);
}

.subject-area.sidebar-collapsed { --sidebar-w: 0px; gap: 0; }

.subject-area.sidebar-collapsed .subject-list-wrap {
  opacity: 0;
  transform: translateX(-1.5rem);
  pointer-events: none;
}

/* ── Sidebar edge: hover-revealed show/hide handle ── */
.sidebar-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--sidebar-w) - 0.875rem);
  width: 1.75rem;
  z-index: 30;
  display: flex;
  align-items: stretch;
  pointer-events: auto;
  transition: left var(--t) var(--ease);
}

.subject-area.sidebar-collapsed .sidebar-edge { left: 0; }

.sidebar-toggle {
  pointer-events: auto;
  width: 100%;
  height: 100%;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--s1);
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--t) var(--ease), color var(--t) var(--ease),
              background var(--t) var(--ease), border-color var(--t) var(--ease);
}

.sidebar-edge:hover .sidebar-toggle,
.sidebar-toggle:focus-visible {
  opacity: 1;
}

.sidebar-toggle:hover { color: var(--accent); border-color: var(--accent-light); }

.sidebar-toggle-arrow { display: block; transition: transform var(--t) var(--ease); }
.sidebar-collapsed .sidebar-toggle-arrow { transform: rotate(180deg); }

/* Left panel — subject/chapter picker */
.subject-list-wrap {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--s1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}

.subject-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.1rem 1.1rem 2.5rem;
}

/* Right panel — workbench */
#subjectWorkbench {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-xl);
  padding: 1.25rem 1.5rem 2.5rem;
  box-shadow: var(--s1);
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
}

/* ── Subject graph / list ────────────────────── */
.graph-wrap { overflow: visible; }

.subject-panel-btn {
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.subject-graph {
  display: grid;
  gap: 0.55rem;
}

.graph-subject {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.graph-subject:hover {
  border-color: var(--accent-light);
  box-shadow: var(--s1);
}

.graph-chapters {
  padding: 0.5rem 0.65rem 0.7rem;
  display: grid;
  gap: 0.3rem;
}

.graph-chapter {
  text-align: left;
  background: var(--panel-2);
  border-color: transparent;
  border-radius: var(--r-sm);
  padding: 0.45rem 0.85rem;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--muted);
  box-shadow: none;
}

.graph-chapter:hover {
  background: var(--accent-xlight);
  color: var(--accent-strong);
  border-color: var(--accent-light);
  transform: none;
}

.graph-chapter.active {
  background: var(--accent-xlight);
  color: var(--accent-strong);
  font-weight: 600;
  border-color: var(--accent-light);
}

/* ── Subject template button ─────────────────── */
.subject-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 0.5rem;
}

.subject-item { display: grid; }

.subject-open {
  text-align: left;
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  font-weight: 600;
}

.subject-open:hover {
  background: var(--accent-xlight);
  color: var(--accent-strong);
  border-color: var(--accent-light);
  transform: translateX(2px);
}

.subject-open.active {
  background: var(--accent-xlight);
  color: var(--accent-strong);
  border-color: var(--accent-light);
}

/* ── Workbench ───────────────────────────────── */
.workbench { display: grid; gap: 0.9rem; align-content: start; }

/* ── Tabs — pill group ───────────────────────── */
.tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--panel-2);
  border-radius: var(--r-full);
  padding: 0.28rem;
  border: 1.5px solid var(--line);
  width: fit-content;
}

.tab {
  flex: 0 0 auto;
  width: auto;
  min-width: 90px;
  max-width: none;
  height: auto;
  padding: 0.42rem 1.05rem;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  box-shadow: none;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.4;
}

.tab:hover {
  background: var(--panel);
  color: var(--ink);
  transform: none;
  box-shadow: var(--s0);
  border-color: transparent;
}

.tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--so);
  transform: none;
  border-color: transparent;
}

.tab:focus { outline: none; }
.tab:active { transform: scale(0.965) !important; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Toolbar ─────────────────────────────────── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
  gap: 0.75rem;
}

.toolbar h3 { margin: 0; font-size: 1rem; }

.toolbar > button,
.toolbar button {
  width: auto;
  padding: 0.4rem 0.9rem;
  font-size: 0.84rem;
  flex-shrink: 0;
}

.full-notes-wide {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 1rem;
}

/* ── Flashcard study ─────────────────────────── */
.flashcard-study {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.4rem 1.5rem;
  min-height: 160px;
  display: grid;
  gap: 1rem;
  margin-bottom: 0.9rem;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.flashcard-study:hover {
  border-color: var(--accent-light);
  box-shadow: var(--s1);
}

.study-face {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
}

.study-controls {
  display: flex;
  gap: 0.5rem;
}

.study-controls button {
  width: auto;
  flex: 1;
  font-size: 0.84rem;
  padding: 0.5rem 0.75rem;
}

/* ── Resource list (outcomes) ────────────────── */
.resource-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 0.5rem;
}

/* Notes list below flashcard — hidden; use Full Notes instead */
#flashcardList { display: none !important; }

.resource-item {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.resource-item:hover {
  border-color: var(--accent-light);
  box-shadow: var(--s0);
}

.resource-item-main p {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.resource-item-main strong { font-size: 0.94rem; }

/* ── LO item ─────────────────────────────────── */
.lo-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.1rem 0;
}

/* ── Hierarchy panel ─────────────────────────── */
.hierarchy-panel {
  margin-top: 0.9rem;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 1rem;
}

.hierarchy-panel h4 { margin: 0 0 0.65rem; font-size: 0.94rem; }

.hierarchy-panel details {
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.45rem;
  background: var(--panel-2);
}

.hierarchy-panel summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hierarchy-panel summary::marker { display: none; }
.hierarchy-panel summary::before {
  content: '▶';
  font-size: 0.65rem;
  color: var(--accent);
  transition: transform var(--t) var(--ease);
}

details[open] > summary::before { transform: rotate(90deg); }

.hierarchy-panel li { margin: 0.25rem 0; font-size: 0.87rem; }

/* ── Progress ring ───────────────────────────── */
.progress-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--accent-strong);
  background:
    radial-gradient(var(--panel) 58%, transparent 60%),
    conic-gradient(var(--accent) var(--pct, 0%), var(--line) 0%);
  border: 1px solid var(--accent-light);
  flex-shrink: 0;
}

/* ── Progress bar ────────────────────────────── */
.progress-bar {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--accent-xlight);
  overflow: hidden;
  border: none;
}

.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: var(--r-full);
  transition: width 0.5s var(--ease);
}

/* ── Test: see the Test section near the end of this file ── */

/* ── Keyword chips ───────────────────────────── */
.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1.5px solid var(--line);
}

.keyword-row .kw-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  align-self: center;
  margin-right: 0.25rem;
  font-weight: 600;
}

.keyword-chip {
  font-size: 0.79rem;
  padding: 0.18rem 0.58rem;
  background: var(--accent-xxlight);
  border: 1.5px solid var(--accent-light);
  color: var(--accent-strong);
  border-radius: var(--r-full);
  font-weight: 500;
}

.keyword-chip.hit {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.keyword-chip.miss {
  background: var(--panel-3);
  color: var(--muted);
  border-color: var(--line);
}

/* ── Theme / subject picker ──────────────────── */
.theme-picker {
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 0.6rem;
}

.theme-picker .avatar-option {
  width: 22px;
  height: 22px;
  border-width: 2px;
}

.subject-picker {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  max-height: 42vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.subject-setting {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: background var(--t) var(--ease);
}

.subject-setting:hover { background: var(--panel-2); }

.subject-setting-text { display: grid; gap: 0.05rem; flex: 1; min-width: 0; }

.subject-setting-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-setting-meta { font-size: 0.68rem; color: var(--muted); }

/* Real checkbox stays in the a11y tree, the switch is the visual */
.subject-setting-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  pointer-events: none;
}

.subject-setting-switch {
  flex-shrink: 0;
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: var(--r-full);
  background: var(--line);
  transition: background var(--t) var(--ease);
}

.subject-setting-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: var(--s0);
  transition: transform var(--t) var(--ease);
}

.subject-setting-input:checked ~ .subject-setting-switch { background: var(--accent); }
.subject-setting-input:checked ~ .subject-setting-switch::after { transform: translateX(14px); }
.subject-setting-input:checked ~ .subject-setting-text .subject-setting-name { color: var(--ink); }
.subject-setting-input:focus-visible ~ .subject-setting-switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Full-screen overlays ────────────────────── */
.full-notes-screen {
  position: fixed;
  inset: 0;
  background: rgba(26, 25, 22, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow-y: auto;
}

.full-notes-card {
  width: min(960px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: var(--panel);
  border-radius: var(--r-xl);
  border: 1.5px solid var(--line);
  padding: 1.5rem 2rem;
  box-shadow: var(--s3);
  animation: modal-in 0.24s var(--ease) both;
}

/* Full Notes fills entire screen */
#fullNotesScreen {
  padding: 0;
  overflow: hidden;
  display: block; /* override grid centering */
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#fullNotesScreen .full-notes-card {
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  max-width: 100%;
  border-radius: 0;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  box-shadow: none;
}

#fullNotesScreen .full-notes-card .toolbar {
  padding: 1.25rem 3rem 1rem;
  margin-bottom: 0;
  flex-shrink: 0;
  background: var(--bg);
  border-bottom-color: var(--line);
}

#fullNotesScreen .full-notes-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 3rem 3rem;
  width: 100%;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(14px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.full-notes-card .toolbar {
  position: sticky;
  top: 0;
  background: var(--panel);
  padding-bottom: 0.65rem;
  border-bottom: 1.5px solid var(--line);
  margin-bottom: 0.9rem;
  z-index: 1;
}

.full-notes-body h4 {
  margin: 1.4rem 0 0.55rem;
  color: var(--accent-strong);
  font-size: 1.25rem;
  border-bottom: 2px solid var(--accent-xlight);
  padding-bottom: 0.35rem;
}

.full-notes-body h5 {
  margin: 1rem 0 0.3rem;
  font-size: 1.05rem;
  color: var(--ink-2);
}

.full-notes-body p {
  margin: 0 0 0.85rem;
  line-height: 1.75;
  color: var(--ink-2);
  font-size: 1.05rem;
}

.full-notes-body .lo-block {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--accent-xxlight);
  border: 1.5px solid var(--accent-xlight);
  border-radius: var(--r-md);
}

.full-notes-body .note-block {
  padding: 0.75rem 1rem;
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: 0.65rem;
  font-size: 1rem;
  line-height: 1.7;
}

.full-notes-body .note-points {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
  color: var(--ink-2);
}

.full-notes-body .note-points li {
  margin-bottom: 0.3rem;
}

.full-notes-body .note-tip {
  margin: 0.85rem 0 0;
  padding: 0.6rem 0.85rem;
  background: var(--accent-xxlight);
  border: 1px solid var(--accent-light);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 0.92em;
  line-height: 1.55;
}

.full-notes-body .note-tip span {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Progress: a full page, not an overlay ───── */
.progress-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.progress-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 2.25rem 2.5rem 4rem;
}

.progress-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.1rem;
  margin-bottom: 1.75rem;
  border-bottom: 1.5px solid var(--line);
}

.progress-page-head .button-secondary,
.progress-detail-header .button-secondary {
  width: auto;
  flex-shrink: 0;
}

.progress-title {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--accent);
}

.progress-body { display: grid; gap: 2rem; }

.progress-summary {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 1.5rem 2rem;
  background: var(--accent-xxlight);
  border: 1.5px solid var(--accent-xlight);
  border-radius: var(--r-lg);
}

.progress-percent {
  font-size: 4.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.progress-percent span { font-size: 0.42em; font-weight: 700; margin-left: 0.06em; }

.progress-summary-meta { display: grid; gap: 0.3rem; }
.progress-summary-meta strong { font-size: 1.15rem; letter-spacing: -0.02em; }

/* Subject rows — one per subject, chapter detail in place */
.progress-subject-list { display: grid; gap: 1rem; }

.progress-subject-row {
  display: grid;
  gap: 0.9rem;
  padding: 1.4rem 1.6rem 1.25rem;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.progress-subject-row:hover { border-color: var(--accent-light); box-shadow: var(--s1); }

.progress-subject-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem;
}

.progress-subject-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.progress-subject-sub { margin: 0.2rem 0 0; font-size: 0.82rem; color: var(--muted); }

.progress-subject-pct {
  flex-shrink: 0;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
}

.progress-subject-pct span { font-size: 0.5em; font-weight: 700; }

.progress-subject-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--accent-xlight);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-subject-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: var(--r-full);
  transition: width 0.5s var(--ease);
}

/* Per-chapter mini columns, readable at a glance */
.progress-chapter-strip {
  display: flex;
  align-items: flex-end;
  gap: 0.3rem;
  height: 62px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: 0.1rem;
}

.progress-chapter-cell {
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  gap: 0.25rem;
  flex: 1 1 16px;
  min-width: 16px;
  max-width: 30px;
  height: 100%;
}

.progress-chapter-track {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--panel-3);
  border-radius: var(--r-xs) var(--r-xs) 2px 2px;
  overflow: hidden;
}

.progress-chapter-fill {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--accent);
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  transition: height 0.45s var(--ease);
}

.progress-chapter-cell.part .progress-chapter-fill { background: var(--accent-3); }
.progress-chapter-cell.done .progress-chapter-fill {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

.progress-chapter-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1;
}

.progress-chapter-cell.done .progress-chapter-label { color: var(--accent-strong); }

.progress-subject-btn {
  justify-self: start;
  width: auto;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0.15rem 0;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t) var(--ease);
}

.progress-subject-btn:hover { color: var(--accent); background: transparent; }

.progress-detail-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.progress-detail-header h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  flex: 1;
}

.progress-detail-list {
  display: grid;
  gap: 0.15rem;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 0.9rem 1.25rem;
}

.progress-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 34%) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0;
}

.progress-detail-row + .progress-detail-row { border-top: 1px solid var(--line); }

.progress-detail-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-detail-track {
  height: 6px;
  background: var(--accent-xlight);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-detail-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: var(--r-full);
  transition: width 0.45s var(--ease);
}

.progress-detail-score {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  align-items: end;
  gap: 0.45rem;
  height: 200px;
  padding: 0.75rem;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  overflow-x: auto;
}

.progress-bar-item {
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  justify-items: center;
  gap: 0.3rem;
  height: 100%;
  min-width: 28px;
}

.progress-bar-fill-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--accent-xlight);
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  overflow: hidden;
}

.progress-bar-fill {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  transition: height 0.4s var(--ease);
}

.progress-bar-label {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--accent-strong);
  white-space: nowrap;
}

.progress-bar-value { font-size: 0.61rem; color: var(--muted); }

/* ── Exam tab ────────────────────────────────── */
.exam-container { display: grid; gap: 1.25rem; padding: 0.25rem 0; }
.exam-empty { padding: 2rem 0; text-align: center; color: var(--muted); }

.exam-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.8rem 1rem;
  border-radius: var(--r-sm);
  border: 1.5px solid;
  font-size: 0.85rem;
  line-height: 1.55;
}

.exam-disclaimer--warning {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: var(--ink-2);
}

.exam-disclaimer--info {
  background: var(--accent-xxlight);
  border-color: var(--accent-xlight);
  color: var(--ink-2);
}

.exam-disclaimer-icon {
  flex-shrink: 0;
  font-style: normal;
  font-size: 0.9rem;
  margin-top: 0.05rem;
}

.exam-group {
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.exam-group-header {
  background: var(--accent-xxlight);
  border-bottom: 1.5px solid var(--accent-xlight);
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.exam-source-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-strong);
  letter-spacing: 0.01em;
}

.exam-group--case-study { border-color: var(--accent-light); }

.exam-case-study-context {
  background: var(--accent-xxlight);
  border-bottom: 1.5px solid var(--accent-xlight);
  padding: 0.9rem 1rem;
  font-size: 0.88rem;
  line-height: 1.65;
}

.exam-case-study-context-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: 0.55rem;
}

.exam-case-study-context-body { line-height: 1.7; }

.exam-part {
  padding: 1rem;
  border-bottom: 1.5px solid var(--line);
  display: grid;
  gap: 0.65rem;
}

.exam-part:last-child { border-bottom: none; }

.exam-part-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.exam-part-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: var(--accent-xlight);
  border: 1.5px solid var(--accent-light);
  border-radius: 6px;
  padding: 0.1rem 0.45rem;
}

.exam-marks { font-size: 0.78rem; color: var(--muted); }
.exam-question-timing { font-size: 0.78rem; }

.exam-question-text {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.55;
  font-weight: 500;
  color: var(--ink);
}

.exam-toggle-btn {
  justify-self: start;
  font-size: 0.82rem;
  padding: 0.35rem 0.88rem;
  width: auto;
}

.exam-diagram-btn {
  font-size: 0.78rem;
  padding: 0.2rem 0.65rem;
  margin-left: auto;
  color: var(--accent-strong);
  border-color: var(--accent-light);
  background: var(--accent-xxlight);
  width: auto;
}

/* ── Full-screen exam questions (breakdown flow) ─ */
.exam-container--fullscreen {
  max-width: 820px;
  margin: 0 auto;
  gap: 2.5rem;
}

.exam-container--fullscreen .exam-part {
  padding: 1.5rem 1.5rem;
  gap: 1.1rem;
}

.exam-container--fullscreen .exam-question-text {
  font-size: 1rem;
  line-height: 1.65;
}

/* Question as printed: crops of the original paper, read like the sheet itself */
.exam-paper {
  display: grid;
  gap: 0.5rem;
  padding: 0.6rem 0.6rem 0.9rem;
}

/* Page on the left, its size slider on the right; the slider stays in reach down a tall page */
.exam-paper-sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.5rem;
}

.exam-paper-sheet .exam-paper-page {
  width: var(--paper-scale, 100%);
  justify-self: center;
}

.exam-paper-size {
  position: sticky;
  top: 1rem;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 1.25rem;
  height: 9rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  accent-color: var(--accent);
  cursor: ns-resize;
}

.exam-paper-page {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--panel);
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: none;
}

.exam-paper-page:hover { border-color: var(--accent-light); transform: none; }
.exam-paper-page:active { transform: none !important; }
.exam-paper-page:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.exam-paper-page img {
  display: block;
  width: 100%;
  height: auto;
}

.exam-part-note { margin: 0; }

.exam-offspec-toggle {
  justify-self: start;
  width: auto;
  margin-top: 1rem;
  font-size: 0.82rem;
  padding: 0.35rem 0.88rem;
}

.exam-diagram-inline {
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--panel-2);
  text-align: center;
  padding: 0.75rem;
}

.exam-diagram-inline img {
  max-width: 100%;
  max-height: 520px;
  display: block;
  margin: 0 auto;
  border-radius: var(--r-sm);
}

.exam-diagram-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

/* ── Diagram modal ───────────────────────────── */
.diagram-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.diagram-modal.open { display: flex; }

.diagram-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 25, 22, 0.6);
  backdrop-filter: blur(4px);
}

.diagram-modal-box {
  position: relative;
  background: var(--panel);
  border-radius: var(--r-xl);
  padding: 1.25rem;
  max-width: min(92vw, 780px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--s3);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: modal-in 0.22s var(--ease) both;
}

.diagram-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 1rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0.25rem 0.55rem;
  width: auto;
  line-height: 1;
}

.diagram-modal-close:hover {
  background: var(--panel-3);
  color: var(--ink);
}

.diagram-modal-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-sm);
}

body.modal-open { overflow: hidden; }

/* ── Exam answer ─────────────────────────────── */
.exam-answer-wrap {
  background: var(--accent-xxlight);
  border: 1.5px solid var(--accent-xlight);
  border-radius: var(--r-sm);
  padding: 0.8rem 1rem;
}

.exam-answer-label {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.exam-answer-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--ink-2);
}

/* ── Maths worked-solution explorer ─────────── */
.exam-answer-wrap--maths {
  padding: 0;
  overflow: hidden;
  background: #fffdfa;
  border-color: #e6c6b0;
}

.exam-answer-wrap--maths > .exam-answer-label {
  margin: 0;
  padding: 0.7rem 1rem;
  background: #fff3ea;
  border-bottom: 1px solid #e6c6b0;
}

.maths-worked-solution {
  --maths-ink: #2d2925;
  --maths-copy: #433c36;
  --maths-muted: #746b64;
  --maths-grid: rgba(82, 64, 51, 0.045);
  --maths-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--maths-ink);
  background-color: #fffdfa;
  background-image:
    linear-gradient(var(--maths-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--maths-grid) 1px, transparent 1px);
  background-size: 24px 24px;
}

.maths-solution-toolbar {
  min-height: 62px;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(255, 253, 250, 0.95);
  border-bottom: 1px solid #e8ddd5;
}

.maths-solution-toolbar > div {
  display: grid;
  gap: 0.08rem;
}

.maths-solution-kicker,
.maths-panel-eyebrow,
.maths-panel-label {
  color: var(--accent-strong);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.3;
  text-transform: uppercase;
}

.maths-solution-toolbar strong {
  color: var(--maths-ink);
  font-size: 0.92rem;
  letter-spacing: -0.01em;
}

.maths-solution-count {
  flex: 0 0 auto;
  padding: 0.22rem 0.62rem;
  border: 1px solid #d7ccc4;
  border-radius: var(--r-full);
  background: #fff;
  color: var(--maths-muted);
  font-family: var(--maths-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.maths-solution-layout {
  display: block;
}

.maths-step-list {
  min-width: 0;
  padding: 0.5rem 0 0.8rem;
  background: rgba(255, 253, 250, 0.78);
}

.maths-step {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  min-width: 0;
  cursor: pointer;
  outline: none;
  transition: background-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.maths-step:hover {
  background: rgba(255, 239, 227, 0.72);
}

.maths-step:focus-visible {
  z-index: 1;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.maths-step.is-active {
  z-index: 1;
  background: #ffede0;
  box-shadow: inset 0 0 0 1px #efb58f;
}

.maths-step-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 1rem;
  color: var(--accent-strong);
  font-family: var(--maths-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.maths-step-rail i {
  width: 1px;
  min-height: 24px;
  flex: 1;
  margin-top: 0.45rem;
  background: #e8d3c5;
}

.maths-step:last-of-type .maths-step-rail i { display: none; }

.maths-step-content {
  min-width: 0;
  padding: 0.92rem 0.9rem 1rem 0;
  border-bottom: 1px solid #e9dfd8;
}

.maths-step-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.maths-step-heading h5,
.maths-explanation-panel h5 {
  margin: 0;
  color: var(--maths-ink);
  font-size: 0.95rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.maths-step-explain {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 140ms var(--ease), transform 140ms var(--ease);
}

.maths-step:hover .maths-step-explain,
.maths-step:focus-visible .maths-step-explain,
.maths-step.is-active .maths-step-explain {
  opacity: 1;
  transform: translateX(0);
}

.maths-step-work {
  color: var(--maths-copy);
  font-family: var(--maths-mono);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.maths-step-work p,
.maths-panel-work p,
.maths-final-answer p {
  margin: 0.18rem 0;
}

.maths-step ::selection {
  background: #ffc59e;
  color: #35170a;
}

.maths-final-answer {
  margin: 0.9rem 1rem 0.3rem 48px;
  padding: 0.9rem 1rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.8rem;
  align-items: baseline;
  background: var(--maths-ink);
  border-radius: 10px;
  color: #fffaf5;
  box-shadow: 0 7px 18px rgba(62, 43, 31, 0.16);
}

.maths-final-answer > span {
  color: #ffc9a6;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.maths-final-answer > div {
  color: #fffdfb;
  font-family: var(--maths-mono);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.maths-explanation-panel {
  position: relative;
  min-width: 0;
  margin: 0.15rem 1rem 0.8rem 48px;
  padding: 0.95rem 1rem 1rem;
  background: #fff6ef;
  border: 1px solid #e4b99d;
  border-radius: 10px;
  color: var(--maths-copy);
  box-shadow: 0 8px 22px rgba(94, 58, 34, 0.08);
  animation: maths-panel-in 200ms var(--ease) both;
}

.maths-explanation-panel[hidden] { display: none; }

@keyframes maths-panel-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.maths-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
}

.maths-panel-close {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #d9b49c;
  border-radius: var(--r-full);
  background: #fffdfa;
  color: #5d4536;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}

.maths-panel-close:hover {
  background: #ffe8d8;
  border-color: #ca8a62;
}

.maths-panel-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.maths-explanation-panel > .maths-panel-eyebrow {
  margin: 0 0 0.2rem;
}

.maths-panel-header .maths-panel-eyebrow {
  margin: 0 0 0.22rem;
}

.maths-explanation-panel blockquote {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  background: #fffdfa;
  border: 1px solid #e8c8b4;
  border-radius: 8px;
  color: #332c27;
  font-family: var(--maths-mono);
  font-size: 0.79rem;
  font-weight: 600;
  line-height: 1.55;
}

.maths-explanation-panel blockquote span {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--accent-strong);
  font-family: var(--font);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.maths-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.maths-panel-grid section {
  min-width: 0;
  padding: 0.78rem 0.9rem 0.78rem 0;
  border-top: 1px solid #ead5c7;
}

.maths-panel-grid section:nth-child(even) {
  padding-right: 0;
  padding-left: 0.9rem;
  border-left: 1px solid #ead5c7;
}

.maths-panel-grid section p {
  margin: 0.3rem 0 0;
  color: var(--maths-copy);
  font-size: 0.82rem;
  line-height: 1.6;
}

.maths-panel-label { color: var(--accent-strong); }

.maths-panel-work {
  margin-top: 0.35rem;
  color: #322b26;
  font-family: var(--maths-mono);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.maths-panel-rule strong {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.28rem 0.52rem;
  background: #fffdfa;
  border: 1px solid #e5c2ac;
  border-radius: 6px;
  color: #3e3027;
  font-size: 0.78rem;
  line-height: 1.45;
}

/* Static variant (rebuilt maths bank): every step shown, maths typeset by KaTeX. */
.maths-step--static {
  cursor: default;
}

.maths-step--static:hover {
  background: transparent;
}

.maths-step-work--katex {
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-wrap: normal;
}

.maths-static-block {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.1rem 0;
  -webkit-overflow-scrolling: touch;
}

.maths-static-block .katex-display {
  margin: 0.35rem 0;
  text-align: left;
}

.maths-static-block .katex-display > .katex {
  text-align: left;
}

.maths-static-note {
  max-width: 62ch;
  margin: 0.45rem 0 0.2rem;
  color: var(--maths-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.maths-static-figure {
  margin: 0.9rem 1rem 0.2rem 48px;
  padding: 0.75rem;
  max-width: 420px;
  background: #fffdfa;
  border: 1px solid #e8ddd5;
  border-radius: 10px;
  color: var(--maths-ink);
}

.maths-static-figure svg {
  display: block;
  width: 100%;
  height: auto;
}

.maths-final-answer--katex > div {
  font-family: inherit;
  font-size: 1rem;
  overflow-x: auto;
}

.maths-final-answer--katex .katex {
  color: #fffdfb;
}

@media (max-width: 700px) {
  .exam-answer-wrap--maths {
    margin-right: -0.35rem;
    margin-left: -0.35rem;
  }

  .maths-static-figure { margin-left: 42px; margin-right: 0.7rem; }
  .maths-step-work--katex { font-size: 0.9rem; }

  .maths-solution-toolbar { padding: 0.75rem 0.8rem; }
  .maths-solution-toolbar strong { font-size: 0.84rem; }
  .maths-step { grid-template-columns: 42px minmax(0, 1fr); }
  .maths-step-content { padding-right: 0.7rem; }
  .maths-step-explain { opacity: 1; transform: none; }
  .maths-step-work { font-size: 0.82rem; }

  .maths-final-answer {
    margin-left: 42px;
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .maths-explanation-panel {
    margin: 0.12rem 0.7rem 0.75rem;
    padding: 0.85rem;
  }

  .maths-panel-grid {
    grid-template-columns: 1fr;
  }

  .maths-panel-grid section,
  .maths-panel-grid section:nth-child(even) {
    padding: 0.7rem 0;
    border-left: 0;
    border-top: 1px solid #ead5c7;
  }
}

@media (prefers-reduced-motion: reduce) {
  .maths-step,
  .maths-step-explain,
  .maths-explanation-panel {
    animation: none;
    transition: none;
  }
}

/* ── Model answer formatting ─────────────────── */
.model-subheading {
  margin: 14px 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-strong);
  font-family: var(--font);
}

.model-subheading:first-child { margin-top: 2px; }

.model-srp {
  margin: 3px 0 3px 12px;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--ink-2);
}

.applies-to-block {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--accent-xxlight);
  border: 1.5px solid var(--accent-xlight);
  border-radius: var(--r-sm);
}

.applies-to-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.applies-to-chip {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--accent-light);
  color: var(--accent-dark);
  font-weight: 500;
}

/* ── Subject overview ────────────────────────── */
#subjectWorkbench.overview-mode .tabs,
#subjectWorkbench.overview-mode .tab-content { display: none !important; }

.overview-header {
  margin-bottom: 1rem;
}

.overview-header-text {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.overview-header-text h3 { margin: 0; font-size: 1rem; }

.overview-total-bar {
  height: 26px;
  background: var(--accent-xlight);
  border-radius: var(--r-full);
  overflow: hidden;
  border: 1.5px solid var(--accent-light);
}

.overview-total-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: var(--r-full);
  transition: width 0.5s var(--ease);
}

.overview-chapter-list { display: grid; gap: 0.4rem; }

.overview-chapter-row {
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.7rem 1rem;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 34%);
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  cursor: pointer;
  box-shadow: none;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease);
}

/* Thick orange border + shadow on hover come from tilt.css, same as the subject tiles */
.overview-chapter-row:hover { border-color: var(--accent-light); }

.overview-chapter-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.overview-chapter-title {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.overview-chapter-score { font-size: 0.75rem; color: var(--muted); }

.overview-progress-bar {
  width: 100%;
  max-width: 360px;
  height: 46px;
  justify-self: end;
  background: var(--panel-3);
  border-radius: var(--r-full);
  overflow: hidden;
}

.overview-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: var(--r-full);
  transition: width 0.4s var(--ease);
}

@media (max-width: 620px) {
  .overview-header-text {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.15rem;
  }

  .overview-chapter-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.85rem;
  }

  .overview-progress-bar {
    max-width: none;
    height: 42px;
    justify-self: stretch;
  }
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar h1 {
  margin: 0;
  letter-spacing: -0.04em;
  text-transform: lowercase;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 980px) {
  .app-shell { margin-top: 6rem; }

  .main-content,
  .subject-area,
  .subject-list-wrap,
  .subject-list-scroll,
  #subjectWorkbench,
  .workbench-bar,
  .workbench-nav,
  .tab-content { min-width: 0; }

  .app-shell {
    grid-template-columns: 1fr;
    margin-top: 5rem;
    padding: 0 1rem;
  }

  .subject-area {
    --sidebar-w: 100%;
    grid-template-columns: 1fr;
    height: calc(100vh - 7rem);
  }

  /* Gesture-collapse is a trackpad affordance; drop the handle on small screens */
  .sidebar-edge { display: none; }

  .progress-page { padding: 1.5rem 1.1rem 3rem; }

  .progress-summary { flex-direction: column; align-items: flex-start; gap: 0.75rem; padding: 1.25rem; }

  .progress-detail-row { grid-template-columns: minmax(0, 1fr) auto; }
  .progress-detail-track { grid-column: 1 / -1; order: 3; }

  .tabs {
    width: 100%;
    justify-content: stretch;
  }

  .tab {
    flex: 1;
    text-align: center;
    min-width: 0;
  }

  .full-notes-card {
    padding: 1.1rem 1.25rem;
  }
}

/* ── Paper guide (full screen) ────────────────────── */
#examBreakdownModal {
  padding: 0;
  place-items: stretch;
  background: var(--bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: hidden;
}

.breakdown-modal-card {
  position: relative;
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(120% 60% at 100% 0%, var(--accent-xxlight), transparent 60%),
    var(--bg);
  box-shadow: none;
}

.breakdown-modal-card > .full-notes-close {
  top: clamp(1.1rem, 2.5vw, 2rem);
  right: clamp(1rem, 3vw, 2.5rem);
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--r-full);
  background: var(--panel);
}

#examBreakdownContent { flex: 1; min-width: 0; display: flex; }

.full-notes-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.full-notes-close:hover { color: var(--ink); border-color: var(--ink-2); }

@media (max-width: 700px) {
  .auth-screen {
    align-items: start;
    padding: 0;
    background: var(--panel);
  }

  .auth-card {
    width: 100%;
    min-height: 100vh;
    padding: 1.35rem 1.2rem 2rem;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-brand {
    margin-bottom: 2.4rem;
  }

  .auth-card h1 {
    font-size: clamp(2.5rem, 14vw, 3.65rem);
  }

  .auth-tabs {
    grid-template-columns: 0.75fr 1.25fr;
  }
}

/* Paper guide layout */
.bd-screen {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2.2vh, 1.6rem);
  padding: clamp(1.1rem, 2.5vw, 2rem) clamp(1rem, 3vw, 2.5rem) clamp(1rem, 2.5vw, 2rem);
}

.bd-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem 3rem;
  flex-wrap: wrap;
  padding-right: 3.5rem;
}
.bd-eyebrow {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: 0.35rem;
}
.bd-title {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3.7rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.bd-stats { display: flex; gap: clamp(1.25rem, 3vw, 2.75rem); margin: 0; }
.bd-stats div { display: flex; flex-direction: column-reverse; }
.bd-stats dt {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.bd-stats dd {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.bd-timing-note { margin: 0 0 1rem; max-width: 70ch; font-size: 0.85rem; line-height: 1.5; color: var(--muted); }
.bd-note-link { display: inline; width: auto; min-height: 0; padding: 0; border: 0; box-shadow: none; background: none; font: inherit; font-weight: 600; color: var(--accent-strong); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; cursor: pointer; }
.bd-note-link:hover { text-decoration-color: currentColor; }

/* Marks strip: each section's share of the paper */
.bd-bar { display: flex; gap: 6px; }
.bd-bar-seg {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.bd-bar-label {
  font-size: 0.74rem; font-weight: 600; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--t) var(--ease);
}
.bd-bar-strip {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--sec);
  opacity: 0.35;
  transition: opacity var(--t) var(--ease);
}
.bd-bar-seg.is-open .bd-bar-label,
.bd-bar-seg:hover .bd-bar-label { color: var(--ink); }
.bd-bar-seg.is-open .bd-bar-strip { opacity: 1; }
.bd-bar-seg:not(.is-open):hover .bd-bar-strip { opacity: 0.6; }

/* Section panels: the open one takes most of the width, clicking another opens it */
.bd-panels {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 0.75rem;
}
.bd-panel {
  --tint: 6%;
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1.5px solid color-mix(in srgb, var(--sec) 20%, var(--line));
  background: color-mix(in srgb, var(--sec) var(--tint), var(--panel));
  transition:
    flex-grow 560ms var(--ease),
    background-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
  animation: bd-rise 520ms var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.bd-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: var(--sec);
}
.bd-panel.is-open {
  --tint: 10%;
  flex-grow: 3.2;
  box-shadow: var(--s2);
}
.bd-panel:not(.is-open):hover {
  --tint: 11%;
  border-color: color-mix(in srgb, var(--sec) 45%, var(--line));
}
.bd-panel:not(.is-open) { cursor: pointer; }
.bd-panel-head:focus-visible {
  outline: none;
}
.bd-panel:has(.bd-panel-head:focus-visible) {
  outline: 2px solid var(--sec);
  outline-offset: 2px;
}
.bd-panel.is-open .bd-panel-head { cursor: default; }

.bd-panel-head {
  display: grid;
  gap: 0.15rem;
  align-content: start;
  padding: 1.6rem 1.5rem 1.1rem;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}
.bd-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--sec) 70%, var(--ink));
}
.bd-panel-title {
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.bd-marks {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}
.bd-marks strong {
  font-size: clamp(2.3rem, 4vw, 3.3rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--sec) 82%, var(--ink));
  margin-right: 0.15rem;
}
.bd-marks--range strong { font-size: clamp(1.8rem, 2.6vw, 2.4rem); }
.bd-facts { font-size: 0.8rem; color: var(--muted); }

.bd-panel-cue {
  position: absolute;
  left: 1.5rem;
  bottom: 1.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  pointer-events: none;
  transition: opacity var(--t) var(--ease);
}
.bd-panel.is-open .bd-panel-cue { opacity: 0; }
.bd-panel:not(.is-open):hover .bd-panel-cue { color: var(--ink); }

.bd-panel-body {
  flex: 1;
  min-height: 0;
  min-width: 28rem;
  overflow-y: auto;
  padding: 0.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease), visibility 0s linear 200ms;
}
.bd-panel.is-open .bd-panel-body {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 320ms var(--ease) 180ms, transform 320ms var(--ease) 180ms, visibility 0s;
}

.bd-tips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.bd-tip {
  padding: 1rem 1.15rem;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--sec) 14%, var(--line));
}
.bd-tip--wide { grid-column: 1 / -1; }
.bd-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--sec) 70%, var(--ink));
}
.bd-tip p { margin: 0.4rem 0 0; font-size: 0.9rem; line-height: 1.6; color: var(--ink-2); }
.bd-reminders {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.45rem 1.5rem;
}
.bd-reminders li {
  position: relative;
  padding-left: 1rem;
  font-size: 0.87rem;
  line-height: 1.45;
  color: var(--ink-2);
}
.bd-reminders li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--sec);
}

.bd-questions-btn {
  display: inline-flex;
  width: auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.85rem 0.75rem 1.15rem;
  border: 0;
  border-radius: var(--r-full);
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 0 0 0 var(--sec);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.bd-questions-btn span {
  min-width: 1.8rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--r-full);
  background: var(--sec);
  color: #fff;
  font-size: 0.78rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.bd-questions-btn:hover { transform: translateY(-1px); box-shadow: var(--s2); }
.bd-empty { margin: 0; font-size: 0.86rem; color: var(--muted); }

/* Command words: chips, most common first */
.bd-words { list-style: none; margin: 0.45rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.bd-words li { display: inline-flex; align-items: baseline; gap: 0.45rem; padding: 0.35rem 0.75rem; border-radius: var(--r-full); background: var(--panel-2); font-size: 0.88rem; }
.bd-words strong { font-weight: 650; color: var(--ink); }
.bd-words span { font-size: 0.78rem; font-weight: 600; color: var(--sec); font-variant-numeric: tabular-nums; }

/* Chapters a section draws on: name · share-of-papers bar · count; each row opens its past questions */
.bd-chapters { margin-bottom: 1rem; }
.bd-chapters ul { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 2px; }
.bd-chapters button, .bd-ch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(4rem, 30%) 2.6rem;
  align-items: center;
  gap: 0.9rem;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  box-shadow: none;
  font-weight: 500;
  text-align: left;
}
.bd-chapters button:hover { background: var(--panel-2); }
.bd-chapters button:hover .bd-ch-name { color: var(--sec); }
.bd-ch-name { font-size: 0.88rem; color: var(--ink); min-width: 0; }
.bd-ch-bar { height: 6px; border-radius: var(--r-full); background: var(--panel-3); overflow: hidden; }
.bd-ch-bar span { display: block; height: 100%; border-radius: inherit; background: var(--sec); }
.bd-ch-count { font-size: 0.8rem; font-weight: 600; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
/* The same rows inside one question type: read-only, since these subjects have no question bank to open */
.bd-type-freq { margin: 1rem 0 0; }
.bd-type-freq-note { margin: 0.4rem 0.6rem 0; font-size: 0.8rem; color: var(--muted); }
/* Inside a question type a phone has no room for three columns: name and count on top, bar full width below */
@media (max-width: 640px) {
  .bd-type-freq .bd-ch-row { grid-template-columns: minmax(0, 1fr) 2.6rem; row-gap: 0.35rem; }
  .bd-type-freq .bd-ch-bar { grid-column: 1 / -1; grid-row: 2; }
}

.bd-notice {
  max-width: 42rem;
  padding: 1.5rem 1.75rem;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1.5px solid var(--line);
  --sec: var(--accent);
}
.bd-notice p { margin: 0.5rem 0 0; font-size: 1rem; line-height: 1.65; color: var(--ink-2); }

@keyframes bd-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* Sections are full-width rows stacked down the page at every width; tap one to open it */
.bd-panels { flex-direction: column; gap: 0.6rem; margin: 0 -0.25rem; padding: 0 0.25rem 1rem; }
.bd-panel, .bd-panel.is-open { flex: none; animation-name: bd-rise; }
.bd-panel-head { grid-template-columns: 1fr auto; column-gap: 1rem; padding: 1.25rem 1.5rem 1rem; }
.bd-kicker, .bd-panel-title, .bd-facts { grid-column: 1; }
.bd-marks { grid-column: 2; grid-row: 1 / span 3; margin: 0; align-self: center; text-align: right; }
.bd-marks strong { display: block; font-size: 2.1rem; }
.bd-panel-cue { display: none; }
.bd-panel-body { display: none; min-width: 0; overflow: visible; padding: 0 1.5rem 1.5rem; }
.bd-panel.is-open .bd-panel-body { display: flex; }

@media (max-width: 860px) {
  .bd-head { padding-right: 3rem; gap: 1rem; }
  .bd-panel-head { padding: 1.25rem 1.1rem 1rem; }
  .bd-panel-body { padding: 0 1.1rem 1.25rem; }
  .bd-tips { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .bd-panel, .bd-panel-body { animation: none; transition: none; }
}

/* AAC guide: the Paper guide's panels plus a tickable checklist and a collapsible full guide */
.aac-screen .bd-stats dd { white-space: nowrap; }
.aac-checks { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.15rem; }
.aac-checks label {
  display: grid;
  grid-template-columns: 1.15rem 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.5rem 0.4rem;
  border-radius: var(--r-md);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink);
  cursor: pointer;
  transition: background-color var(--t) var(--ease);
}
.aac-checks label:hover { background: color-mix(in srgb, var(--sec) 7%, transparent); }
.aac-checks input {
  appearance: none;
  box-sizing: border-box;
  width: 1.15rem;
  height: 1.15rem;
  min-height: 0;
  padding: 0;
  margin: 0.15rem 0 0;
  box-shadow: none;
  border: 2px solid color-mix(in srgb, var(--sec) 60%, var(--line));
  border-radius: 4px;
  background: var(--panel);
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.aac-checks input::after {
  content: "";
  width: 0.55rem;
  height: 0.3rem;
  border: solid #fff;
  border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform 180ms var(--ease);
}
.aac-checks input:checked { background: var(--sec); border-color: var(--sec); }
.aac-checks input:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.aac-checks input:focus-visible { outline: 2px solid var(--sec); outline-offset: 2px; }
.aac-checks input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--sec) 55%, transparent); }

.aac-depth summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  list-style: none;
  cursor: pointer;
}
.aac-depth summary::-webkit-details-marker { display: none; }
.aac-depth summary .bd-label::before { content: "+ "; }
.aac-depth[open] summary .bd-label::before { content: "– "; }
.aac-depth-count { font-size: 0.78rem; color: var(--muted); }

/* Paper guide: the exam morning as a proportional timeline */
/* .aac-brief is two columns on desktop; the timeline and rules need the full width */
.aac-brief.bd-day { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; container-type: inline-size; }
.bd-day .aac-brief-task { max-width: 75ch; font-size: 0.98rem; }
.bd-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bd-tl-block { min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.bd-tl-time { display: flex; justify-content: space-between; font-size: 0.95rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--ink); }
.bd-tl-bar { display: flex; gap: 3px; height: 3rem; border-radius: 8px; overflow: hidden; }
.bd-tl-bar span { display: grid; place-items: center; min-width: 0; background: var(--c); color: var(--panel); font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bd-tl-bar span:nth-child(2) { background: color-mix(in srgb, var(--c) 82%, var(--panel)); }
.bd-tl-bar span:nth-child(3) { background: color-mix(in srgb, var(--c) 68%, var(--panel)); }
.bd-tl-label { margin-top: 0.35rem; font-size: 1.08rem; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); }
.bd-tl-mins { font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--sec); }
.bd-tl-detail { margin: 0.15rem 0 0; font-size: 0.88rem; line-height: 1.5; color: var(--ink-2); }
.aac-brief.bd-rules { gap: 0.6rem; }
.bd-day .aac-brief-facts { gap: 0.9rem 1.5rem; }
.bd-day .aac-brief-facts div { border-bottom: 0; padding: 0.6rem 0 0; border-top: 1px solid var(--line); align-content: start; }
@container (min-width: 30rem) { .bd-day .aac-brief-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 56rem) { .bd-day .aac-brief-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Too narrow for six columns: run the timeline down the page, bar heights still scaled by minutes */
@container (max-width: 44rem) {
  .bd-timeline { grid-template-columns: 1fr !important; gap: 4px; }
  .bd-tl-block { display: grid; grid-template-columns: 3.4rem 0.8rem minmax(0, 1fr); column-gap: 0.9rem; align-content: start; }
  .bd-tl-time { grid-column: 1; grid-row: 1 / span 3; flex-direction: column; }
  .bd-tl-bar { grid-column: 2; grid-row: 1 / span 3; flex-direction: column; height: auto; min-height: calc(var(--m) * 0.2rem); border-radius: 5px; }
  .bd-tl-bar span { font-size: 0; }
  .bd-tl-label, .bd-tl-mins, .bd-tl-detail { grid-column: 3; margin: 0; }
  .bd-tl-detail { padding-bottom: 0.9rem; }
}

/* Wide: the to-scale bar sits above; each block's text keeps a stripe in its colour to match it up */
.bd-tl-scale { display: grid; gap: 3px; }
.bd-tl-scale > span { display: flex; min-width: 0; }
.bd-tl-scale .bd-tl-bar { flex: 1; min-width: 0; }
.bd-tl-bar span { overflow: hidden; white-space: nowrap; }
@container (min-width: 44.01rem) {
  .bd-timeline { gap: 1.25rem; }
  .bd-timeline .bd-tl-bar { display: none; }
  .bd-tl-block { border-top: 4px solid var(--c); padding-top: 0.6rem; }
}
@container (max-width: 44rem) { .bd-tl-scale { display: none; } }

/* Paper guide: one row per question type, split by hairlines rather than nested cards */
.bd-type { border-top: 1px solid var(--line); padding: 0.75rem 0 0.2rem; }
.bd-type:first-of-type { margin-top: 0.6rem; }
.bd-type summary { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; list-style: none; cursor: pointer; }
.bd-type summary::-webkit-details-marker { display: none; }
.bd-type-name { font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
.bd-type-name::before { content: "+ "; color: var(--sec); }
.bd-type[open] .bd-type-name::before { content: "– "; }
.bd-type summary:hover .bd-type-name { color: var(--sec); }
/* The four facts sit side by side: 4 across a wide panel, 2×2 in a medium one, stacked on a phone */
.bd-types { container-type: inline-size; }
.bd-type .aac-brief-facts { margin: 0.75rem 0 0.9rem; grid-template-columns: 1fr; gap: 0.9rem 1.25rem; }
.bd-type .aac-brief-facts div { border-bottom: 0; padding: 0.55rem 0 0; border-top: 1px solid var(--line); align-content: start; }
.bd-type .aac-brief-facts dd { color: var(--ink-2); }
@container (min-width: 26rem) { .bd-type .aac-brief-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 46rem) { .bd-type .aac-brief-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bd-type-traps { display: block; }
.bd-type .bd-reminders { margin-bottom: 0.6rem; }
.aac-h {
  margin: 1.1rem 0 0;
  font-size: 0.86rem;
  font-weight: 650;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.aac-points { grid-template-columns: 1fr; }

.aac-sources ul { margin: 0.5rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.25rem; font-size: 0.82rem; line-height: 1.45; }
.aac-sources a { color: var(--ink-2); text-decoration-color: color-mix(in srgb, var(--sec) 50%, transparent); text-underline-offset: 2px; }
.aac-sources a:hover { color: var(--ink); }

.overview-guides { display: inline-flex; gap: 0.5rem; }
.aac-brief {
  --sec: var(--accent);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1rem 2.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--r-lg);
  border: 1.5px solid color-mix(in srgb, var(--sec) 22%, var(--line));
  background: color-mix(in srgb, var(--sec) 4%, var(--panel));
}
.aac-brief-task { margin: 0.45rem 0 0; font-size: clamp(1rem, 1.5vw, 1.15rem); font-weight: 600; line-height: 1.45; letter-spacing: -0.01em; color: var(--ink); }
.aac-brief-list { margin: 0.75rem 0 0; padding-left: 1.3rem; display: grid; gap: 0.3rem; font-size: 0.88rem; line-height: 1.45; color: var(--ink-2); }
.aac-brief-list li::marker { font-weight: 700; color: var(--accent-strong); }
.aac-brief-source { display: inline-block; margin-top: 0.85rem; font-size: 0.8rem; font-weight: 600; color: var(--accent-strong); text-underline-offset: 3px; }
.aac-ai-guide { display: grid; gap: 0.25rem; margin: 0 0 1.25rem; padding: 0.85rem 1.1rem; border-radius: var(--r-md); border: 1px solid var(--accent-edge); border-left: 4px solid var(--accent); background: var(--accent-bg); color: var(--ink-2); font-size: 0.88rem; line-height: 1.45; text-decoration: none; }
.aac-ai-guide:hover { background: var(--accent-xlight); }
.aac-ai-guide .bd-label { color: var(--accent-strong); }
/* Text on the left, the ChatGPT and Claude marks on the right */
.aac-ai-guide { grid-template-columns: minmax(0, 1fr) auto; column-gap: 1.25rem; align-items: center; }
.aac-ai-guide > :not(.aac-ai-logos) { grid-column: 1; }
.aac-ai-logos { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 0.7rem; }
.aac-ai-logos img { width: 30px; height: 30px; }
.aac-brief-facts { margin: 0; display: grid; gap: 0.7rem; align-content: start; }
.aac-brief-facts div { display: grid; gap: 0.1rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line); }
.aac-brief-facts div:last-child { border-bottom: 0; padding-bottom: 0; }
.aac-brief-facts dt { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.aac-brief-facts dd { margin: 0; font-size: 0.88rem; line-height: 1.45; color: var(--ink); }
@media (max-width: 860px) {
  .aac-brief { grid-template-columns: 1fr; padding: 1.1rem; }
}

@media (max-width: 860px) {
  .aac-screen .bd-stats { gap: 1.1rem; }
}

/* Practice questions */
.breakdown-questions-header { font-size: 0.84rem; font-weight: 600; color: var(--ink); margin-bottom: 0.45rem; }
.breakdown-q-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: 240px; overflow-y: auto; }
.breakdown-q-item {
  padding: 0.55rem 0.75rem; border: 1.5px solid var(--line);
  border-radius: var(--r-md); cursor: pointer; background: var(--panel);
  transition: border-color 0.15s var(--ease);
}
.breakdown-q-item:hover { border-color: var(--accent); }
.breakdown-q-source { font-size: 0.72rem; color: var(--muted); margin-bottom: 0.2rem; }
.breakdown-q-text { font-size: 0.81rem; color: var(--ink-2); line-height: 1.4; }

/* Question detail view */
.breakdown-q-part { border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 0.85rem 1rem; background: var(--panel); }
.breakdown-q-part + .breakdown-q-part { margin-top: 0.6rem; }
.breakdown-q-part-header { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 0.4rem; }
.breakdown-q-text-body { font-size: 0.86rem; line-height: 1.55; color: var(--ink-2); margin: 0.3rem 0 0.6rem; }
.breakdown-q-answer { background: var(--accent-xlight); border-radius: var(--r-sm); padding: 0.75rem 0.85rem; margin-top: 0.5rem; font-size: 0.84rem; line-height: 1.55; color: var(--ink-2); }

/* Subject header: label + exam info side by side, chapters below */
.graph-subject-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.85rem 0.55rem 1rem;
}

.graph-subject-name {
  flex: 1;
  width: auto;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0.3rem 0.15rem;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  color: var(--ink);
}

.graph-subject-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--t) var(--ease);
}

.graph-subject-count {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
}

.graph-subject-name:hover .graph-subject-title { color: var(--accent-strong); }

.graph-subject-exam {
  flex-shrink: 0;
  width: auto;
  background: var(--accent);
  border: 1.5px solid transparent;
  border-radius: var(--r-full);
  box-shadow: var(--so);
  padding: 0.28rem 0.72rem;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.graph-subject-exam:hover {
  background: var(--accent-strong);
  box-shadow: 0 6px 28px rgba(249,115,22,0.42);
}

.graph-subject-chevron {
  flex-shrink: 0;
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1;
  transition: transform var(--t) var(--ease), color var(--t) var(--ease);
}

.graph-subject.expanded .graph-subject-chevron {
  transform: rotate(90deg);
  color: var(--accent);
}

/* ── Exam section badge ── */
.exam-section-badge {
  display: inline-flex; align-items: center;
  font-size: 0.75rem; font-weight: 600;
  padding: 0.2rem 0.55rem; border-radius: var(--r-xs);
  border: 1px solid; white-space: nowrap;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────
   Study Timer Widget
──────────────────────────────────────────── */

#confettiCanvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9999;
  display: none;
}

.timer-widget {
  position: fixed;
  top: 0.85rem;
  right: calc(1.25rem + 46px + 0.6rem + 46px + 0.6rem); /* top bar, left of avatar + calculator shortcut */
  z-index: 25; /* the same layer as the calculator and avatar (.profile-avatar-wrap), so overlays cover all three together */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  /* The closed menu still takes up room below the clock; only the controls catch clicks */
  pointer-events: none;
}

.timer-clock-btn,
.timer-active { pointer-events: auto; }

/* ── Idle: clock + menu that drops down ── */
.timer-idle {
  display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 0.5rem;
}

.timer-picker {
  display: flex; flex-direction: column; gap: 0.35rem;
  opacity: 0; pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
  /* padding bridges the gap to the clock button so hover stays live */
  padding-top: 0.6rem;
}

/* Picker open state — toggled by JS with delay so gap between button and menu doesn't dismiss it */
.timer-picker.picker-open {
  opacity: 1; pointer-events: all;
  transform: translateY(0) scale(1);
}

.timer-opt {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  padding: 0.45rem 1.1rem;
  font-family: var(--font);
  font-size: 0.82rem; font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  box-shadow: var(--s1);
  white-space: nowrap;
  text-align: left;
  display: flex; flex-direction: column; gap: 1px;
  transition: border-color 140ms, color 140ms, background 140ms, box-shadow 140ms;
}
.timer-opt:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-xxlight);
  box-shadow: var(--so);
}
/* Pomodoro sits level with the other presets — no orange highlight */
.timer-opt-sub {
  font-size: 0.66rem; font-weight: 400; color: var(--muted);
}

/* Desktop: the options sit together in one rounded panel that opens sideways, left of the clock.
   Phones (≤640px) keep the drop-down list above. */
@media (min-width: 641px) {
  .timer-idle { position: relative; }
  /* Out of flow, so the hidden panel doesn't push the clock along the top bar */
  .timer-picker {
    position: absolute; top: 50%; right: calc(100% + 0.5rem);
    width: max-content; /* anchored to the 46px clock, it would otherwise shrink to min-content */
    flex-direction: row; align-items: center; gap: 0.1rem;
    padding: 0.3rem;
    background: var(--panel);
    border: 1.5px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--s2);
    transform: translate(6px, -50%) scale(0.97);
    transform-origin: center right;
  }
  .timer-picker.picker-open { transform: translate(0, -50%) scale(1); }
  .timer-opt,
  .timer-opt:hover { border-color: transparent; box-shadow: none; }
  .timer-opt { width: auto; border-radius: var(--r-md); padding: 0.45rem 0.85rem; } /* undo global button width:100% */
  .timer-custom-row { width: 9.5rem; } /* its input shrinks to nothing in a row otherwise */
}

/* ── Custom toggle: revealed input row ── */
.timer-custom-row {
  display: flex; align-items: center; gap: 0;
  background: var(--panel);
  border: 1.5px solid var(--accent-edge);
  border-radius: var(--r-full);
  padding: 0.35rem 0.35rem 0.35rem 1.1rem;
  box-shadow: var(--s1);
  transition: border-color 140ms, box-shadow 140ms;
}
.timer-custom-row:focus-within {
  border-color: var(--accent); box-shadow: var(--so);
}
.timer-custom-input {
  flex: 1; min-width: 0; border: none; background: transparent;
  font-family: var(--font); font-size: 0.82rem; font-weight: 600;
  color: var(--ink-2); outline: none;
  -moz-appearance: textfield; appearance: textfield;
}
.timer-custom-input::placeholder { color: var(--muted); font-weight: 400; }
.timer-custom-input::-webkit-inner-spin-button,
.timer-custom-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.timer-custom-go {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); border: none;
  font-family: var(--font); font-size: 0.72rem; font-weight: 700;
  color: white; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 130ms, transform 130ms;
}
.timer-custom-go:hover { background: var(--accent-strong); transform: scale(1.1); }

/* ── Clock button — matches the calculator shortcut beside it ── */
.timer-clock-btn {
  width: 46px; height: 46px; border-radius: 50%;
  padding: 0;
  background: var(--panel);
  border: 1.5px solid var(--line);
  box-shadow: var(--s1);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
  transition: color 150ms, border-color 150ms, box-shadow 150ms, transform 150ms;
}
.timer-clock-btn svg { flex: none; width: 20px; height: 20px; }
.timer-clock-btn:hover {
  color: var(--accent); border-color: var(--accent);
  box-shadow: var(--so); transform: scale(1.08);
}

/* ── Active timer bar ── */
.timer-active {
  position: relative;
  height: 46px; min-width: 210px;
  border-radius: var(--r-full);
  background: var(--panel);
  border: 1.5px solid var(--accent-edge);
  box-shadow: var(--s2);
  overflow: hidden;
  display: flex; align-items: center;
  gap: 0.45rem;
  padding: 0 0.6rem 0 0.85rem;
}

.timer-active-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent-light);
  border-radius: var(--r-full);
  transition: width 1s linear;
  width: 100%;
}
.timer-active.break-mode .timer-active-fill { background: #BBF7D0; }

.timer-phase-icon {
  position: relative; z-index: 1;
  font-size: 0.9rem; flex-shrink: 0;
}
.timer-active-text {
  position: relative; z-index: 1;
  font-family: var(--font);
  font-size: 0.88rem; font-weight: 700;
  color: var(--ink); flex: 1;
  white-space: nowrap; letter-spacing: 0.01em;
}
.timer-stop-btn {
  position: relative; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.65);
  border: 1.5px solid rgba(0,0,0,0.13);
  font-size: 1rem; font-weight: 900;
  color: var(--ink-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 1;
  transition: background 130ms, color 130ms, border-color 130ms, transform 130ms;
}
.timer-stop-btn:hover {
  background: var(--danger); color: white;
  border-color: var(--danger); transform: scale(1.1);
}

/* ═══════════════════════════════════════════════
   DISTILLED STUDY SURFACE
   Keep one task visible; reveal navigation and detail at the point of need.
   ═══════════════════════════════════════════════ */

@media (min-width: 981px) {
  /* Fill the viewport: the shell's 2rem bottom margin left a dead strip under both panels */
  .app-shell { margin-bottom: 0; }
  .subject-area { --sidebar-w: 238px; gap: 0.35rem; height: calc(100vh - 3.5rem); height: calc(100dvh - 3.5rem); }

  .subject-list-wrap {
    overflow: hidden;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .subject-list-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.15rem 0.8rem 1rem 0;
  }

  .graph-subject { overflow: hidden; }

  .graph-chapters {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
    padding: 0.15rem 0.5rem 0.65rem 1.65rem;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transition: none;
  }

  .sidebar-edge {
    align-items: stretch;
    width: 1.75rem;
    padding-top: 0;
  }

  .sidebar-toggle {
    width: 100%;
    height: 100%;
    pointer-events: auto;
    opacity: 0;
  }

  .sidebar-edge:hover .sidebar-toggle,
  .sidebar-toggle:focus-visible {
    opacity: 1;
  }
}

.subject-panel-btn {
  width: calc(100% - 0.8rem);
  min-height: 44px;
  margin: 0 0.8rem 0.85rem 0;
  padding: 0.65rem 1rem;
  background: var(--accent);
  border-color: transparent;
  box-shadow: var(--so);
  color: oklch(0.985 0.006 55);
  font-size: 0.9rem;
  font-weight: 750;
}

.subject-panel-btn:hover {
  background: var(--accent-strong);
  border-color: transparent;
  box-shadow: 0 6px 28px rgba(249,115,22,0.42);
  color: oklch(0.985 0.006 55);
}

.subject-graph { gap: 0.16rem; }

.graph-subject {
  position: relative;
  background: transparent;
  border-color: transparent;
  border-radius: var(--r-sm);
  box-shadow: none;
}

.graph-subject:hover,
.graph-subject.selected {
  background: var(--panel);
  border-color: transparent;
  box-shadow: var(--s0);
}

.graph-subject-header { min-height: 42px; padding: 0.35rem 0.55rem 0.35rem 0.7rem; }

.graph-subject-name { padding: 0.25rem 0; gap: 0.45rem; }
.graph-subject-title { font-size: 0.88rem; font-weight: 650; }

.graph-subject-count {
  min-width: 1.35rem;
  color: var(--muted);
  font-size: 0.68rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.graph-subject-chevron { font-size: 0.9rem; }

.graph-menu-head {
  min-height: 30px;
  padding: 0 0.35rem 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.graph-subject-exam {
  padding: 0.25rem 0.6rem;
  background: transparent;
  border-color: var(--line);
  box-shadow: none;
  color: var(--accent-strong);
  font-size: 0.7rem;
  letter-spacing: 0;
  text-transform: none;
}

.graph-subject-exam:hover {
  background: var(--accent-xlight);
  border-color: var(--accent-light);
  box-shadow: none;
}

.graph-chapter {
  min-height: 38px;
  padding: 0.45rem 0.7rem;
  background: transparent;
  border-radius: var(--r-xs);
  color: var(--ink-2);
  font-size: 0.8rem;
}

.graph-chapter:hover { background: var(--accent-xlight); border-color: transparent; }

#subjectWorkbench {
  padding: 0.15rem 1.1rem 2.5rem;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.workbench { gap: 0.7rem; }

.workbench-bar {
  position: sticky;
  z-index: 18;
  top: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.2rem 0 0.85rem;
  background: var(--bg);
  border-bottom: 1px solid color-mix(in oklch, var(--line), transparent 35%);
}

#subjectWorkbench.overview-mode .workbench-bar { display: none; }

.study-context {
  min-width: 0;
  display: grid;
  gap: 0.05rem;
  overflow: hidden;
}

.study-context span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.study-context strong {
  overflow: hidden;
  color: var(--accent);
  font-size: clamp(1.45rem, 2.4vw, 2.25rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-nav { display: flex; align-items: center; gap: 0.35rem; }

.tabs {
  gap: 0.08rem;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
}

.tab {
  min-width: 58px;
  padding: 0.36rem 0.72rem;
  font-size: 0.78rem;
}

.tab:hover { background: var(--panel); box-shadow: none; }
.tab.active,
.tab.active:hover {
  background: var(--accent);
  color: oklch(0.985 0.006 55);
  box-shadow: none;
}

.tab:focus-visible,
.exam-group-header:focus-visible,
.workbench-notes:focus-visible,
.study-context-back:focus-visible,
.outcome-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.workbench-notes {
  width: auto;
  padding: 0.38rem 0.65rem;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 0.76rem;
}

.workbench-notes:hover {
  background: var(--panel);
  border-color: var(--line);
  color: var(--accent-strong);
  box-shadow: none;
  transform: none;
}

#subjectWorkbench.learn-mode {
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
  overflow: hidden;
}

#subjectWorkbench.learn-mode .workbench-bar { flex: 0 0 auto; }

#subjectWorkbench.learn-mode #flashcardsTab.active {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

#subjectWorkbench.learn-mode .flashcard-study {
  min-height: 0;
  flex: 1;
  height: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  box-shadow: var(--s1);
}

.workbench-menu { position: relative; }

.workbench-menu-trigger {
  width: 34px;
  height: 34px;
  padding: 0 0 0.25rem;
  display: grid;
  place-items: center;
  background: transparent;
  border-color: transparent;
  border-radius: var(--r-full);
  box-shadow: none;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.workbench-menu:hover .workbench-menu-trigger,
.workbench-menu:focus-within .workbench-menu-trigger {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

.workbench-menu-panel {
  position: absolute;
  z-index: 25;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.985);
  transform-origin: top right;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--s2);
  transition:
    opacity var(--t) var(--ease),
    transform var(--t) var(--ease),
    visibility 0s linear var(--t);
}

.workbench-menu-panel { top: calc(100% + 0.35rem); right: 0; width: 150px; padding: 0.35rem; }

.workbench-menu-panel button {
  padding: 0.5rem 0.65rem;
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: left;
  font-size: 0.8rem;
}

.workbench-menu-panel button:hover { background: var(--accent-xlight); color: var(--accent-strong); }

.workbench-menu:hover .workbench-menu-panel,
.workbench-menu:focus-within .workbench-menu-panel {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

.tab-content.active { animation: distilled-enter 220ms var(--ease); }

@keyframes distilled-enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.flashcard-study {
  min-height: min(430px, calc(100vh - 11rem));
  margin: 0;
  padding: 1.1rem 1.25rem 1rem;
  grid-template-rows: auto minmax(180px, 1fr) auto;
  gap: 0.8rem;
  background: var(--panel);
  border-width: 1.5px;
  border-radius: var(--r-lg);
  box-shadow: var(--s1);
}

.study-card-head,
.study-progress,
.study-card-footer {
  display: flex;
  align-items: center;
}

.study-card-head { justify-content: space-between; gap: 1rem; }
.study-progress { width: min(170px, 45%); gap: 0.55rem; }
.study-progress .progress-bar { flex: 1; height: 5px; }
.study-progress > span,
.study-card-count { color: var(--muted); font-size: 0.7rem; font-variant-numeric: tabular-nums; }

.study-face {
  width: min(700px, 92%);
  margin: auto;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  line-height: 1.65;
  text-align: center;
}

.study-face strong { font-size: clamp(1.35rem, 2.5vw, 2rem); letter-spacing: -0.025em; }

.study-card-footer { justify-content: space-between; gap: 0.75rem; }
.study-controls { flex: 0 1 auto; align-items: center; gap: 0.35rem; }

.study-controls button {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0.62rem 0.95rem;
  box-shadow: none;
  font-size: 0.86rem;
}

.study-controls .study-step { width: 46px; padding: 0; justify-content: center; text-align: center; }
.study-controls #flipCard { min-width: 104px; }
.study-controls .study-learned { min-width: 116px; }

/* Your own flashcards: quiet text actions in the card head, and the inline form that replaces the card */
.study-card-tools { display: flex; align-items: center; gap: 0.9rem; }
.own-card-action {
  min-height: 36px;
  padding: 0 0.15rem;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.own-card-action:hover { background: none; text-decoration: underline; text-underline-offset: 3px; }
.own-card-action.is-quiet { color: var(--muted); }
.own-card-form { display: grid; gap: 1rem; align-content: start; }
.own-card-heading { color: var(--ink); font-size: 0.95rem; }
.own-card-field { display: grid; gap: 0.35rem; color: var(--ink-2); font-size: 0.78rem; font-weight: 650; }
.own-card-field .feedback-textarea { min-height: 0; font-weight: 400; }
.own-card-form .study-card-footer { justify-content: flex-end; }

.study-keywords { position: relative; margin-left: auto; }

.study-keywords summary {
  padding: 0.35rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: var(--r-xs);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
  list-style: none;
}

.study-keywords summary::-webkit-details-marker { display: none; }
.study-keywords summary::before { content: "#"; color: var(--accent-strong); }
.study-keywords summary::after { content: none; }
.study-keywords summary span { color: var(--accent-strong); }
.study-keywords:hover summary,
.study-keywords:focus-within summary { background: var(--panel); color: var(--ink); }

.study-keywords-panel {
  position: absolute;
  z-index: 22;
  right: 0;
  bottom: calc(100% + 0.35rem);
  width: min(320px, 75vw);
  padding: 0.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--s2);
}

.study-keywords:not([open]) > .study-keywords-panel { display: none; }

@media (hover: hover) {
  .study-keywords:not([open]):hover > .study-keywords-panel,
  .study-keywords:not([open]):focus-within > .study-keywords-panel { display: block; }
}

.study-keywords-panel .keyword-row { margin: 0; padding: 0; border: 0; }
.study-keywords-panel .kw-label { display: none; }
.study-keywords-panel p { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.72rem; }

.exam-container { gap: 0; padding: 0.2rem 0; }

.exam-guidance {
  position: relative;
  z-index: 12;
  width: fit-content;
  margin: 0 0 0.7rem;
}

.exam-guidance summary {
  width: fit-content;
  padding: 0.35rem 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-radius: var(--r-xs);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 650;
  list-style: none;
}

.exam-guidance summary::-webkit-details-marker { display: none; }
.exam-guidance summary::before { content: "i"; color: var(--accent-strong); }
.exam-guidance summary::after { content: none; }
.exam-guidance summary small { color: var(--accent-strong); font-size: 0.68rem; font-weight: 650; }
.exam-guidance:hover summary,
.exam-guidance:focus-within summary { background: var(--panel); }

.exam-guidance-panel {
  position: absolute;
  z-index: 24;
  top: calc(100% + 0.3rem);
  left: 0;
  width: min(390px, 78vw);
  padding: 0.75rem 0.85rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--s2);
  color: var(--ink-2);
  font-size: 0.78rem;
  line-height: 1.55;
}

.exam-guidance:not([open]) > .exam-guidance-panel { display: none; }

@media (hover: hover) {
  .exam-guidance:not([open]):hover > .exam-guidance-panel,
  .exam-guidance:not([open]):focus-within > .exam-guidance-panel { display: block; }
}

.exam-group {
  overflow: visible;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.exam-group:last-child { border-bottom: 1px solid var(--line); }
.exam-group--case-study { border-color: var(--accent-light); }

.exam-group-header {
  width: 100%;
  min-height: 50px;
  padding: 0.65rem 0.45rem;
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  background: transparent;
  border: 0;
  border-radius: var(--r-xs);
  box-shadow: none;
  text-align: left;
}

.exam-group-header:hover,
.exam-group-header[aria-expanded="true"] {
  background: color-mix(in oklch, var(--panel), var(--bg) 12%);
  transform: none;
}

.exam-source-tag {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.exam-group-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-group-chevron {
  color: var(--muted);
  font-size: 0.82rem;
  transition: transform var(--t) var(--ease), color var(--t) var(--ease);
}

.exam-group-header[aria-expanded="true"] .exam-group-chevron {
  color: var(--accent);
  transform: rotate(180deg);
}

.exam-group-body { padding: 0.2rem 0.45rem 1rem; animation: distilled-enter 220ms var(--ease); }

.exam-group-body .exam-part {
  padding: 1rem 0.65rem;
  border-bottom-width: 1px;
}

.exam-group-body .exam-part:last-child { border-bottom: 0; }
.exam-case-study-context { border: 0; border-radius: var(--r-sm); }

@media (max-width: 980px) {
  .subject-area {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.55rem;
  }

  .subject-list-wrap {
    height: 44px;
    max-height: none;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .subject-list-scroll {
    padding: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.2rem;
    overflow: visible;
  }

  .subject-panel-btn {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    box-shadow: none;
  }

  .subject-graph {
    width: 0;
    min-width: 0;
    max-width: 100%;
    flex: 1;
    display: flex;
    gap: 0.2rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .subject-graph::-webkit-scrollbar { display: none; }

  .graph-subject {
    flex: 0 0 auto;
    overflow: visible;
    border-color: transparent;
  }

  .graph-subject.selected { order: -1; }
  .graph-subject-header { min-height: 38px; padding: 0.25rem 0.6rem; }
  .graph-subject-title { font-size: 0.78rem; }
  .graph-subject-count { display: none; }
  .graph-subject:not(.selected) .graph-subject-chevron,
  .graph-subject:not(.selected) .graph-subject-exam { display: none; }
  .graph-subject.selected .graph-subject-chevron { display: inline-block; }
  .graph-subject-exam { padding: 0.2rem 0.48rem; font-size: 0.65rem; }

  .graph-chapters {
    position: fixed;
    z-index: 80;
    top: 8.85rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    max-height: calc(100vh - 9rem);
    overflow-y: auto;
    display: none;
    padding: 0.7rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--s3);
  }

  .graph-subject.expanded .graph-chapters { display: grid; }

  #subjectWorkbench { padding: 0.4rem 0 2rem; }
  .workbench-bar { position: relative; flex-wrap: wrap; }
  .study-context { flex: 1 1 100%; }
  .workbench-nav { width: 100%; justify-content: space-between; }
  .tabs { width: auto; }

  .flashcard-study { min-height: 370px; }
  #subjectWorkbench.learn-mode .flashcard-study { min-height: 0; }
  .study-card-footer { align-items: flex-end; flex-wrap: wrap; }
  #subjectWorkbench.learn-mode .study-card-footer { padding-right: 4rem; }
  .study-controls { width: 100%; }
  .study-controls #flipCard { flex: 1; }
  .study-keywords { margin-left: auto; }

  .exam-group-header { grid-template-columns: auto 1fr auto; gap: 0.55rem; }
  .exam-group-meta { text-align: right; }
}

@media (max-width: 520px) {
  .study-controls .study-learned { min-width: 42px; font-size: 0; }
  .study-controls .study-learned::before { content: "✓"; font-size: 0.9rem; }
  .exam-group-meta { font-size: 0.66rem; }
}

/* ── First-run onboarding ────────────────────── */
body.onboarding-open {
  overflow: hidden;
}

body.onboarding-open .timer-widget {
  display: none;
}

.ob-screen {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: clamp(1rem, 3vw, 2.5rem);
  background: linear-gradient(140deg, var(--bg), #f4f1eb 55%, #e8e4dc);
  animation: ob-fade-in 0.5s var(--ease) both;
}

.ob-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image: radial-gradient(rgba(26, 25, 22, 0.22) 0.65px, transparent 0.65px);
  background-size: 7px 7px;
  mask-image: radial-gradient(ellipse at center, transparent 30%, black 85%);
}

.ob-screen.is-exiting {
  animation: ob-exit 0.5s var(--ease) forwards;
}

/* Drifting warm light behind the card */
.ob-aura {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ob-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  will-change: transform;
}

.ob-blob-a {
  width: 34rem; height: 34rem;
  top: -12rem; left: -10rem;
  background: radial-gradient(circle, rgba(250, 76, 6, 0.32), transparent 65%);
  animation: ob-drift-a 18s ease-in-out infinite alternate;
}

.ob-blob-b {
  width: 28rem; height: 28rem;
  bottom: -10rem; right: -8rem;
  background: radial-gradient(circle, rgba(252, 138, 88, 0.38), transparent 65%);
  animation: ob-drift-b 22s ease-in-out infinite alternate;
}

.ob-blob-c {
  width: 18rem; height: 18rem;
  top: 40%; left: 60%;
  background: radial-gradient(circle, rgba(253, 208, 176, 0.7), transparent 70%);
  animation: ob-drift-c 15s ease-in-out infinite alternate;
}

.ob-frame {
  position: relative;
  width: min(100%, 780px);
  display: grid;
  gap: 1.5rem;
  padding: clamp(1.4rem, 4vw, 2.6rem);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: var(--s3);
  animation: ob-rise 0.6s var(--ease) 0.05s both;
}

/* Header: logo + progress rail */
.ob-head {
  display: grid;
  gap: 1.1rem;
}

.ob-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ob-logo {
  height: 22px;
  width: auto;
}

.ob-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
}

.ob-close:hover {
  border-color: var(--accent-light);
  background: var(--accent-xlight);
  color: var(--accent-strong);
}

.ob-close .ob-icon {
  width: 16px;
  height: 16px;
}

.ob-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr; /* 5 steps when editing a plan, 6 for a new account */
  margin: 0;
  padding: 0;
  list-style: none;
}

.ob-rail-step {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.3s var(--ease);
}

.ob-rail-dot {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--panel);
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease),
    color 0.35s var(--ease), transform 0.45s var(--ease), box-shadow 0.35s var(--ease);
}

.ob-rail-dot .ob-icon {
  width: 17px;
  height: 17px;
}

.ob-rail-step.is-current {
  color: var(--accent-strong);
}

.ob-rail-step.is-current .ob-rail-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  transform: scale(1.12);
  box-shadow: var(--so);
}

.ob-rail-step.is-done {
  color: var(--ink-2);
}

.ob-rail-step.is-done .ob-rail-dot {
  border-color: var(--accent-light);
  background: var(--accent-xlight);
  color: var(--accent-strong);
}

.ob-rail-track {
  position: relative;
  height: 4px;
  margin: -0.4rem calc(50% / var(--steps, 5)) 0;
  border-radius: var(--r-full);
  background: var(--panel-3);
  overflow: hidden;
}

.ob-rail-fill {
  --p: 0;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-3), var(--accent));
  transform-origin: left;
  transform: scaleX(max(var(--p), 0.04));
  transition: transform 0.6s var(--ease);
}

/* Stage: panels slide past each other */
.ob-stage {
  min-width: 0;
  position: relative;
  display: grid;
  min-height: 330px;
}

.ob-panel {
  --dir: 1;
  grid-area: 1 / 1;
  display: grid;
  align-content: start;
  gap: 0.5rem;
  animation: ob-panel-in 0.5s var(--ease) both;
}

.ob-panel.is-leaving {
  pointer-events: none;
  animation: ob-panel-out 0.32s var(--ease) both;
}

.ob-title {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.ob-title em {
  font-style: normal;
  color: var(--accent);
}

.ob-sub {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.ob-body {
  display: grid;
  gap: 1rem;
}

/* Tiles (year, subject, priority) */
.ob-grid {
  display: grid;
  gap: 0.75rem;
}

.ob-grid-years {
  grid-template-columns: repeat(3, 1fr);
}

.ob-grid-subjects {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.ob-tile {
  position: relative;
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 0.25rem;
  padding: 1rem 1rem 1.05rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--s0);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease),
    transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
  animation: ob-pop-in 0.5s var(--ease) both;
  animation-delay: calc(0.12s + var(--i, 0) * 0.045s);
}

.ob-body.is-static .ob-tile,
.ob-body.is-static .ob-level-row,
.ob-body.is-static .ob-day {
  animation: none;
}

.ob-tile:hover {
  border-color: var(--accent-light);
  background: var(--accent-xxlight);
  transform: translateY(-3px);
  box-shadow: var(--s2);
}

.ob-tile:focus-visible,
.ob-day:focus-visible,
.ob-switch:focus-visible,
.ob-preset:focus-visible,
.ob-next:focus-visible,
.ob-back:focus-visible,
.ob-start:focus-visible {
  outline: 3px solid var(--accent-light);
  outline-offset: 2px;
}

.ob-tile-year {
  padding: 1.35rem 1.2rem;
  min-height: 150px;
}

.ob-tile-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 0.45rem;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--ink-2);
  transition: background 0.3s var(--ease), color 0.3s var(--ease), transform 0.45s var(--ease);
}

.ob-tile-year .ob-tile-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--r-md);
}

.ob-tile-icon .ob-icon {
  width: 22px;
  height: 22px;
}

.ob-tile-year .ob-tile-icon .ob-icon {
  width: 27px;
  height: 27px;
}

.ob-tile-label {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.ob-tile-year .ob-tile-label {
  font-size: 1.2rem;
}

.ob-tile-hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.ob-tick {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  transform: scale(0) rotate(-45deg);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ob-tick .ob-icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.ob-tile.is-on {
  border-color: var(--accent);
  background: var(--accent-xxlight);
  box-shadow: 0 0 0 4px var(--accent-xlight), var(--s1);
}

.ob-tile.is-on .ob-tile-icon {
  background: var(--accent);
  color: #fff;
  transform: rotate(-6deg) scale(1.05);
}

.ob-tile.is-on .ob-tick {
  transform: scale(1) rotate(0);
}

.ob-tile-priority.is-on {
  background: linear-gradient(150deg, var(--accent-xlight), var(--accent-xxlight));
}

.ob-tile-priority.is-on .ob-tile-icon {
  animation: ob-pulse 1.8s var(--ease) infinite;
}

.ob-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.ob-meta-num {
  display: inline-block;
  min-width: 1ch;
  color: var(--accent-strong);
  font-weight: 800;
  animation: ob-count-bump 0.35s var(--ease);
}

/* Levels */
.ob-levels {
  display: grid;
  gap: 0.55rem;
}

.ob-level-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.65rem 0.6rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  animation: ob-slide-row 0.5s var(--ease) both;
  animation-delay: calc(0.1s + var(--i, 0) * 0.05s);
}

.ob-level-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-xs);
  background: var(--accent-xlight);
  color: var(--accent-strong);
}

.ob-level-icon .ob-icon {
  width: 19px;
  height: 19px;
}

.ob-level-name {
  font-weight: 650;
}

.ob-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 196px;
  padding: 3px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  background: var(--panel-2);
  font: inherit;
  cursor: pointer;
}

.ob-switch-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: var(--r-full);
  background: var(--accent);
  box-shadow: var(--so);
  transition: transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1), background 0.3s var(--ease);
}

.ob-switch.is-ordinary .ob-switch-thumb {
  transform: translateX(100%);
  background: var(--ink-2);
  box-shadow: 0 4px 16px rgba(26, 25, 22, 0.22);
}

.ob-switch-opt {
  position: relative;
  z-index: 1;
  padding: 0.38rem 0;
  font-size: 0.82rem;
  font-weight: 650;
  text-align: center;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}

.ob-switch:not(.is-ordinary) .ob-switch-h,
.ob-switch.is-ordinary .ob-switch-o {
  color: #fff;
}

/* Days */
.ob-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.6rem;
}

.ob-day {
  min-width: 0;
  padding: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.1rem;
  aspect-ratio: 1;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink-2);
  font: inherit;
  cursor: pointer;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease),
    color 0.3s var(--ease), transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s var(--ease);
  animation: ob-pop-in 0.5s var(--ease) both;
  animation-delay: calc(0.1s + var(--i, 0) * 0.04s);
}

.ob-day:hover {
  border-color: var(--accent-light);
  transform: translateY(-3px);
}

.ob-day-letter {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}

.ob-day-name {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}

.ob-day.is-on {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  transform: scale(1.06);
  box-shadow: var(--so);
}

.ob-day.is-on .ob-day-name {
  color: rgba(255, 255, 255, 0.82);
}

.ob-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ob-preset {
  width: auto;
  padding: 0.42rem 0.95rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  background: var(--panel);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t) var(--ease);
}

.ob-preset:hover {
  border-color: var(--accent-light);
  background: var(--accent-xlight);
  color: var(--accent-strong);
}

.ob-preset.is-on {
  border-color: var(--accent);
  background: var(--accent-xlight);
  color: var(--accent-strong);
}

/* Footer */
.ob-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 1rem;
  padding-top: 1.1rem;
  border-top: 1.5px solid var(--panel-3);
}

.ob-back,
.ob-next,
.ob-start {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--r-full);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: all var(--t) var(--ease);
}

.ob-back {
  justify-self: start;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--ink-2);
}

.ob-back:hover {
  background: var(--panel-2);
}

.ob-back.is-hidden {
  visibility: hidden;
}

.ob-next,
.ob-start {
  justify-self: end;
  padding: 0.72rem 1.3rem;
  border: none;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--so);
}

.ob-next:hover:not(:disabled),
.ob-start:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.ob-next:hover:not(:disabled) .ob-icon,
.ob-start:hover .ob-icon {
  transform: translateX(3px);
}

.ob-next:disabled {
  background: var(--panel-3);
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
}

.ob-back .ob-icon,
.ob-next .ob-icon,
.ob-start .ob-icon {
  width: 18px;
  height: 18px;
  transition: transform var(--t) var(--ease);
}

/* Completion */
.ob-screen.is-done .ob-foot,
.ob-screen.is-done .ob-rail-track {
  display: none;
}

.ob-screen.is-done .ob-rail-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.ob-done {
  justify-items: center;
  text-align: center;
  padding-block: 0.5rem 0.25rem;
}

.ob-burst {
  position: relative;
  width: 96px;
  height: 96px;
  margin-bottom: 0.8rem;
}

.ob-burst span:not(.ob-burst-core) {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px;
  border-radius: 50%;
  background: var(--accent-3);
  transform: rotate(var(--a)) translateY(0) scale(0);
  animation: ob-spark 0.9s var(--ease) 0.2s both;
}

.ob-burst span:nth-child(even):not(.ob-burst-core) {
  background: var(--accent);
  width: 6px;
  height: 6px;
}

.ob-burst-core {
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--so);
  animation: ob-core-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ob-burst-core .ob-icon {
  width: 36px;
  height: 36px;
  stroke-width: 2.6;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: ob-draw 0.5s var(--ease) 0.35s forwards;
}

.ob-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.4rem 0 1.5rem;
}

.ob-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  background: var(--panel);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
  animation: ob-pop-in 0.5s var(--ease) both;
  animation-delay: calc(0.45s + var(--i, 0) * 0.08s);
}

.ob-chip .ob-icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.ob-chip-hot {
  border-color: var(--accent);
  background: var(--accent-xlight);
  color: var(--accent-strong);
}

.ob-start {
  justify-self: center;
  padding: 0.85rem 1.6rem;
  font-size: 1rem;
  animation: ob-pop-in 0.5s var(--ease) 0.8s both;
}

/* Keyframes */
@keyframes ob-fade-in { from { opacity: 0; } }
@keyframes ob-exit { to { opacity: 0; transform: scale(1.02); } }
@keyframes ob-rise {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
}
@keyframes ob-panel-in {
  from { opacity: 0; transform: translateX(calc(var(--dir) * 48px)); }
}
@keyframes ob-panel-out {
  to { opacity: 0; transform: translateX(calc(var(--dir) * -48px)); }
}
@keyframes ob-pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
}
@keyframes ob-slide-row {
  from { opacity: 0; transform: translateX(-18px); }
}
@keyframes ob-count-bump {
  50% { transform: scale(1.35); }
}
@keyframes ob-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(250, 76, 6, 0.35); }
  60% { box-shadow: 0 0 0 9px rgba(250, 76, 6, 0); }
}
@keyframes ob-spark {
  0% { transform: rotate(var(--a)) translateY(0) scale(0); opacity: 1; }
  60% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateY(-62px) scale(1); opacity: 0; }
}
@keyframes ob-core-pop {
  from { transform: scale(0); }
}
@keyframes ob-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes ob-drift-a {
  to { transform: translate(14rem, 8rem) scale(1.15); }
}
@keyframes ob-drift-b {
  to { transform: translate(-12rem, -9rem) scale(1.2); }
}
@keyframes ob-drift-c {
  to { transform: translate(-22rem, 6rem) scale(0.85); }
}

@media (max-width: 640px) {
  .ob-grid-years {
    grid-template-columns: 1fr;
  }
  .ob-tile-year {
    min-height: 0;
    grid-template-columns: auto 1fr;
    column-gap: 0.9rem;
    align-items: center;
  }
  .ob-tile-year .ob-tile-icon {
    margin: 0;
  }
  .ob-grid-subjects {
    grid-template-columns: repeat(2, 1fr);
  }
  .ob-rail-label {
    display: none;
  }
  .ob-days {
    gap: 0.3rem;
  }
  .ob-day-name {
    display: none;
  }
  .ob-day-letter {
    font-size: 1.05rem;
  }
  .ob-foot {
    gap: 0.5rem;
  }
  .ob-back span {
    display: none;
  }
  .ob-switch {
    width: 156px;
  }
  .ob-level-row {
    grid-template-columns: auto 1fr;
  }
  .ob-level-row .ob-switch {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ob-screen *,
  .ob-screen *::before,
  .ob-screen,
  .ob-blob {
    animation: none !important;
    transition: none !important;
  }
  .ob-burst-core .ob-icon {
    stroke-dashoffset: 0;
  }
}

/* ── Subsection picker — full workbench grid shown when a chapter opens ── */
/* The chapter heading lines up with the subject heading above it */
#subjectWorkbench.picker-mode { padding-inline: 0; }

#subjectWorkbench.picker-mode .workbench-nav,
#subjectWorkbench.picker-mode .tab-content { display: none !important; }

/* learn-mode (Learn tab active) sets overflow:hidden; overview and picker are long lists and must scroll */
#subjectWorkbench.picker-mode,
#subjectWorkbench.overview-mode { overflow-y: auto; padding-bottom: 2.5rem; }

.outcome-picker {
  display: grid;
  gap: 0.75rem;
  padding: 0 0 2.5rem;
  animation: distilled-enter 220ms var(--ease);
}

.outcome-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.outcome-card {
  min-height: 148px;
  padding: 1.1rem 1.15rem 1rem;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.6rem;
  align-content: start;
  text-align: left;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--s0);
}

.outcome-card:hover {
  border-color: var(--accent-light);
  box-shadow: var(--s1);
  transform: translateY(-2px);
}

.outcome-card-index {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.outcome-card-title {
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.outcome-card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.outcome-card-bar {
  flex: 1;
  height: 5px;
  overflow: hidden;
  background: var(--panel-3);
  border-radius: var(--r-full);
}

.outcome-card-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.outcome-card.is-done { border-color: var(--accent-light); background: var(--accent-xxlight); }
.outcome-card.is-done .outcome-card-meta { color: var(--accent-strong); }

/* Back-to-subsections crumb above the subsection title */
.study-context-back {
  width: auto;
  justify-self: start;
  max-width: 100%;
  padding: 0.1rem 0.4rem 0.1rem 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: var(--r-xs);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.study-context-back span:last-child { overflow: hidden; text-overflow: ellipsis; }
.study-context-back span:first-child { font-size: 1rem; line-height: 1; }
.study-context-back:hover { color: var(--accent-strong); }

/* ── Full notes — a readable column instead of boxes within boxes ── */
#fullNotesScreen .full-notes-card .toolbar {
  padding: 1rem clamp(1rem, 4vw, 3rem);
  align-items: center;
}

#fullNotesTitle {
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}

.full-notes-eyebrow {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.full-notes-heading {
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.full-notes-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.full-notes-actions button { width: auto; white-space: nowrap; }

/* Full notes covers the top bar but not the timer: the clock takes the toolbar's corner,
   right of Live reading and Close (phones hide the timer here instead) */
@media (min-width: 641px) {
  body:has(#fullNotesScreen:not(.hidden)) .timer-widget { right: clamp(1rem, 4vw, 3rem); } /* the toolbar's side padding */
  body:has(#fullNotesScreen:not(.hidden)) .full-notes-actions { margin-right: calc(46px + 0.5rem); }
}

.live-reading-btn.is-active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
}

#fullNotesScreen .full-notes-body {
  padding: 2.25rem clamp(1.1rem, 5vw, 3rem) 5rem;
}

#fullNotesScreen .full-notes-body > * {
  max-width: 68ch;
  margin-inline: auto;
}

#fullNotesScreen .full-notes-body .lo-block {
  margin-bottom: 3rem;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}

#fullNotesScreen .full-notes-body h4 {
  margin: 0 0 1.5rem;
  padding: 0 0 0.75rem;
  color: var(--ink);
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  border-bottom: 2px solid var(--accent);
}

#fullNotesScreen .full-notes-body .note-block {
  margin: 0;
  padding: 1.35rem 0 1.4rem;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  font-size: 1.1rem;
}

#fullNotesScreen .full-notes-body h4 + .note-block { border-top: 0; padding-top: 0; }

#fullNotesScreen .full-notes-body h5 {
  margin: 0 0 0.55rem;
  color: var(--accent-strong);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

#fullNotesScreen .full-notes-body p {
  margin: 0 0 0.75rem;
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.8;
}

#fullNotesScreen .full-notes-body .note-points {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.75;
}

#fullNotesScreen .full-notes-body .note-points li { margin-bottom: 0.55rem; padding-left: 0.2rem; }
#fullNotesScreen .full-notes-body .note-points li::marker { color: var(--accent); }

/* ── Full notes pager — a subsection's notes step to its neighbours ── */
.notes-pager { display: none; }

#fullNotesScreen.is-paged .notes-pager {
  position: fixed;
  top: calc(50% - 1.5rem);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border-radius: var(--r-full);
  background: var(--panel);
  color: var(--ink-2);
  box-shadow: var(--s1);
}

#fullNotesScreen.is-paged .notes-pager--prev { left: clamp(0.75rem, 2vw, 2rem); }
#fullNotesScreen.is-paged .notes-pager--next { right: clamp(0.75rem, 2vw, 2rem); }

.notes-pager svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#fullNotesScreen.is-paged .notes-pager:hover:not(:disabled) {
  background: var(--accent-xlight);
  border-color: var(--accent-light);
  color: var(--accent-strong);
}

#fullNotesScreen.is-paged .notes-pager:disabled {
  opacity: 0.3;
  cursor: default;
  box-shadow: none;
}

.notes-pager:focus-visible,
.notes-next-section:focus-visible,
.outcome-picker-notes:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Keep the reading column clear of the side arrows */
#fullNotesScreen.is-paged .full-notes-body {
  padding-inline: clamp(4.75rem, 8vw, 6rem);
}

.notes-next-section {
  display: grid;
  gap: 0.2rem;
  margin-top: 1rem;
  padding: 1.1rem 1.25rem;
  border-radius: var(--r-md);
  font-size: inherit; /* so its 68ch column matches the notes above */
  text-align: left;
}

.notes-next-section span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.notes-next-section strong {
  color: var(--ink);
  font-size: 1.1rem;
  letter-spacing: -0.015em;
}

.notes-next-section strong::after {
  content: " →";
  color: var(--accent);
}

.notes-next-section:hover {
  background: var(--accent-xxlight);
  border-color: var(--accent-light);
}

/* ── Crunch Mode: hides the note points a student doesn't need for their target grade ── */
/* The bar on the subject home, before Crunch Mode is set up. Type is the landing hero's: Archivo, caps, tight. */
.crunch-bar {
  --crunch-face: "Archivo", var(--font);
  margin-bottom: 1rem;
  padding: 6px;
  background: var(--ink);
  border-radius: var(--r-lg);
  color: #EDEBE6;
}

.crunch-bar-head {
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(10rem, 27%) minmax(0, 1fr);
  align-items: stretch;
  gap: 1rem;
}

.crunch-bar-text { display: grid; align-self: center; gap: 0.5rem; padding: 1.25rem 1.4rem 1.25rem 0; }
.crunch-only { display: flex; align-items: center; gap: 0.7rem; margin: 0.4rem 0 0; color: #F6F4EF; font-size: 1.2rem; font-weight: 600; }
.crunch-only img { display: block; height: 2.3rem; width: auto; } /* 70% up on 1.35rem */

.crunch-hero {
  margin: 0;
  color: #F6F4EF;
  font-family: var(--crunch-face);
  font-size: clamp(1.9rem, 4.6vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 0.98;
  text-transform: uppercase;
}

.crunch-hero span { display: block; }

/* The word fills the bar's left side, stretched to its full height (an SVG drawn into the button's box).
   Pressing it opens the setup below. */
.crunch-go {
  display: block;
  min-height: 11.5rem;
  width: 100%;
  position: relative;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--accent);
  transition: color var(--t) var(--ease), opacity var(--t) var(--ease);
}

/* Pinned inside the button so the bar sets the height and the word stretches to it (never the other way round) */
.crunch-go svg { position: absolute; inset: 0.6rem 0 0.6rem 1rem; width: calc(100% - 1rem); height: calc(100% - 1.2rem); overflow: visible; }

.crunch-go text {
  fill: currentColor;
  font-family: var(--crunch-face);
  font-size: 100px;
  font-weight: 900;
  font-variation-settings: "wdth" 125;
}

.crunch-go:hover,
.crunch-bar-head:hover .crunch-go { background: none; color: var(--accent-2); transform: none; }
.crunch-go:focus-visible { outline: 2px solid var(--accent-3); outline-offset: -2px; border-radius: var(--r-md); }

/* Open: the word steps back and the setup takes over (pressing it again closes) */


.crunch-setup { display: grid; gap: 1.1rem; }
.crunch-bar .crunch-setup {
  margin: 0.75rem 1.4rem 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(237, 235, 230, 0.12);
  animation: crunch-open 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes crunch-open {
  from { opacity: 0; transform: translateY(-10px); }
}

.crunch-field { display: grid; gap: 0.45rem; justify-items: start; }
.crunch-label { color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

.crunch-readout { display: flex; align-items: flex-end; gap: 0.75rem; margin: 0; }

.crunch-hours {
  color: var(--accent-strong);
  font-family: "Archivo", var(--font);
  font-size: clamp(3.4rem, 9vw, 4.75rem);
  font-weight: 900;
  font-variation-settings: "wdth" 75;
  font-variant-numeric: tabular-nums;
  line-height: 0.82;
}

.crunch-hours-unit { padding-bottom: 0.3rem; color: var(--ink); font-family: "Archivo", var(--font); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; text-transform: uppercase; }

/* See how: a link to the blog post that explains Crunch Mode */
.crunch-how {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  justify-self: start;
  width: fit-content;
  margin-top: 0.7rem;
  padding: 0.35rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  color: var(--ink-2);
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
  transition: border-color var(--t) var(--ease), color var(--t) var(--ease);
}
.crunch-how::after { content: ""; width: 0.4rem; height: 0.4rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); }
.crunch-how:hover { border-color: var(--accent-light); color: var(--accent-strong); }
.crunch-how:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.crunch-why { max-width: 62ch; margin: 0.6rem 0 0; color: var(--ink-2); font-size: 0.95rem; line-height: 1.55; }
.crunch-foot { margin: 0; color: var(--muted); font-size: 0.82rem; }

.crunch-setup-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.crunch-setup-actions button { width: auto; }

/* On the dark bar the same controls are drawn light-on-ink */
.crunch-bar .crunch-label,
.crunch-bar .crunch-foot,
.crunch-bar .crunch-how { border-color: rgba(237, 235, 230, 0.22); color: #D8D4CB; }
.crunch-bar .crunch-how:hover { border-color: var(--accent-3); color: var(--accent-3); }
.crunch-bar .crunch-hours { color: var(--accent-3); }
.crunch-bar .crunch-hours-unit { color: #F6F4EF; }
.crunch-bar .crunch-why { color: #C9C5BC; }
.crunch-bar .crunch-grades { background: rgba(237, 235, 230, 0.06); border-color: rgba(237, 235, 230, 0.14); }
.crunch-bar .crunch-grades button { color: #D8D4CB; }
.crunch-bar .crunch-grades button:hover { color: var(--accent-3); }
.crunch-bar .crunch-grades button[aria-checked="true"] { color: #fffaf5; }
.crunch-bar .crunch-aac { --track: #34312B; --notch: rgba(237, 235, 230, 0.3); }
.crunch-bar .crunch-aac output { color: var(--accent-3); }
.crunch-bar .crunch-ticks { color: #9C988E; }
.crunch-bar .button-secondary { background: transparent; border-color: rgba(237, 235, 230, 0.22); color: #EDEBE6; }

/* "Completely hide low-value points" */
.crunch-option { align-items: flex-start; max-width: 34rem; font-weight: 400; }
.crunch-option .crunch-switch-track { margin-top: 0.1rem; }
.crunch-option strong { display: block; font-weight: 700; }
.crunch-option small { display: block; margin-top: 0.15rem; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }
.crunch-bar .crunch-switch { color: #F6F4EF; }
.crunch-bar .crunch-option small { color: #9C988E; }
.crunch-bar .crunch-switch-track { background: #34312B; border-color: rgba(237, 235, 230, 0.18); }

/* Flashcards: the toggle, and crunched cards when shown */
.crunch-card-toggle { color: var(--accent-strong); }
.study-face.is-crunched { color: var(--muted); }
.crunch-card-tag { padding: 0.15rem 0.5rem; border-radius: var(--r-full); background: var(--panel-2); color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.study-face.crunch-empty { color: var(--muted); font-size: 1rem; }

/* The tile it becomes once set up */
.crunch-tile > span:last-child { font-family: "Archivo", var(--font); font-weight: 800; letter-spacing: -0.02em; }
.crunch-tile small { display: block; margin-top: 0.3rem; color: var(--muted); font-family: var(--font); font-size: 0.9rem; font-weight: 600; letter-spacing: 0; text-transform: none; font-variation-settings: normal; }
.crunch-tile.is-new { animation: crunch-tile-in 520ms cubic-bezier(0.16, 1, 0.3, 1) both; }

@keyframes crunch-tile-in {
  from { opacity: 0; transform: scale(0.94); }
}

/* The Crunch Mode section: its settings */
.crunch-settings { display: grid; } /* the space under the switch lives in .crunch-more, so it closes with it */
/* Off: only the switch shows. On: the options slide open beneath it (rows 0fr → 1fr animates the height). */
.crunch-more {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.5s var(--ease), opacity 0.35s var(--ease) 0.1s, visibility 0s;
}
.crunch-more > div {
  display: grid;
  gap: 1.4rem;
  min-height: 0;
  overflow: hidden;
  /* 1.4rem of space under the switch, plus 6px of room for focus rings and the slider thumb inside the clip */
  padding: calc(1.4rem + 6px) 6px 6px;
  margin: -6px;
  transition: padding 0.45s var(--ease), margin 0.45s var(--ease);
}
.crunch-more > div > * { transition: transform 0.5s var(--ease); }
.crunch-settings.is-off .crunch-more {
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden; /* out of the tab order and screen readers while closed */
  transition: grid-template-rows 0.45s var(--ease), opacity 0.2s var(--ease), visibility 0s 0.45s;
}
.crunch-settings.is-off .crunch-more > div { padding-block: 0; margin-block: 0; }
.crunch-settings.is-off .crunch-more > div > * { transform: translateY(-10px); }
@media (prefers-reduced-motion: reduce) {
  .crunch-more, .crunch-more > div > * { transition: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .crunch-bar .crunch-setup, .crunch-tile.is-new,

}

.crunch-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.crunch-switch input { position: absolute; opacity: 0; pointer-events: none; }

.crunch-switch-track {
  position: relative;
  width: 2.4rem;
  height: 1.4rem;
  flex: none;
  background: var(--panel-3, #ECEAE5);
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}

.crunch-switch-track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.15rem;
  width: 0.95rem;
  height: 0.95rem;
  background: var(--panel);
  border-radius: 50%;
  box-shadow: var(--s0);
  transform: translateY(-50%);
  transition: transform var(--t) var(--ease);
}

.crunch-switch input:checked + .crunch-switch-track { background: var(--accent); border-color: var(--accent); }
.crunch-switch input:checked + .crunch-switch-track::after { transform: translate(1rem, -50%); }
.crunch-switch input:focus-visible + .crunch-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.crunch-setup { --crunch-control-w: min(100%, 38rem); }
/* Options the student studies (Geography, History) */
.crunch-picks { display: flex; flex-wrap: wrap; gap: 0.4rem; width: var(--crunch-control-w); }
.crunch-picks button {
  width: auto;
  padding: 0.4rem 0.8rem;
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  box-shadow: none;
  color: var(--ink-2);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
}
.crunch-picks button:hover { border-color: var(--accent-light); background: var(--panel-2); color: var(--accent-strong); transform: none; }
.crunch-picks button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fffaf5; }
.crunch-label small { font-weight: 600; letter-spacing: 0; text-transform: none; }
.crunch-bar .crunch-picks button { background: rgba(237, 235, 230, 0.06); border-color: rgba(237, 235, 230, 0.14); color: #D8D4CB; }
.crunch-bar .crunch-picks button:hover { border-color: var(--accent-3); color: var(--accent-3); }
.crunch-bar .crunch-picks button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fffaf5; }
.crunch-grades {
  display: flex;
  width: var(--crunch-control-w);
  padding: 0.2rem;
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
}

.crunch-grades button {
  flex: 1;
  width: auto;
  min-width: 2.4rem;
  padding: 0.3rem 0.55rem;
  background: none;
  border: 0;
  border-radius: var(--r-full);
  box-shadow: none;
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 600;
}

.crunch-grades button:hover { color: var(--accent-strong); background: none; transform: none; }
.crunch-grades button[aria-checked="true"] { background: var(--accent); color: #fffaf5; box-shadow: var(--so); }

/* AAC slider: 5% steps with a notch at each one, drawn on the track and inset by half the thumb so notches meet its centre */
.crunch-aac { --thumb: 1.3rem; --track: var(--panel-3); --notch: rgba(26, 25, 22, 0.3); width: var(--crunch-control-w); justify-items: stretch; }
.crunch-aac output { margin-left: 0.35rem; color: var(--accent-strong); font-variant-numeric: tabular-nums; letter-spacing: 0; }

.crunch-aac input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--thumb);
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  cursor: pointer;
}

.crunch-aac input[type="range"]::-webkit-slider-runnable-track {
  height: 0.6rem;
  border-radius: var(--r-full);
  background:
    repeating-linear-gradient(to right, var(--notch) 0 2px, transparent 2px calc((100% - var(--thumb)) / 20)) calc(var(--thumb) / 2 - 1px) 0 / calc(100% - var(--thumb) + 2px) 100% no-repeat,
    linear-gradient(var(--accent), var(--accent)) 0 0 / calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--fill-n, 0)) 100% no-repeat,
    var(--track);
}

.crunch-aac input[type="range"]::-moz-range-track {
  height: 0.6rem;
  border-radius: var(--r-full);
  background:
    repeating-linear-gradient(to right, var(--notch) 0 2px, transparent 2px calc((100% - var(--thumb)) / 20)) calc(var(--thumb) / 2 - 1px) 0 / calc(100% - var(--thumb) + 2px) 100% no-repeat,
    var(--track);
}

.crunch-aac input[type="range"]::-moz-range-progress { height: 0.6rem; border-radius: var(--r-full); background: var(--accent); }

.crunch-aac input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((0.6rem - var(--thumb)) / 2);
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: #fffaf5;
  box-shadow: var(--s1);
}

.crunch-aac input[type="range"]::-moz-range-thumb {
  width: var(--thumb);
  height: var(--thumb);
  box-sizing: border-box;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: #fffaf5;
}

.crunch-aac input[type="range"]:focus-visible { outline: none; }
.crunch-aac input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent-3); outline-offset: 2px; }
.crunch-aac input[type="range"]:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent-3); outline-offset: 2px; }

.crunch-ticks { display: flex; justify-content: space-between; padding-inline: calc(var(--thumb) / 2 - 0.3rem); color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }

/* Points Crunch Mode hid, when the student asks to see them */
#fullNotesScreen .full-notes-body .is-crunched { opacity: 0.4; }
#fullNotesScreen .full-notes-body .note-block.is-crunched .is-crunched { opacity: 1; }
#fullNotesScreen .full-notes-body li.is-crunched::marker { color: var(--muted); }

/* Centred on the notes column and exactly as wide: the box keeps the notes' text size so its 68ch
   matches theirs, and only the words inside shrink */
#fullNotesScreen .full-notes-body > .crunch-note:first-child { margin: 0 auto 1.25rem; font-size: inherit; }
#fullNotesScreen .full-notes-body > .crunch-note:first-child > * { font-size: 0.92rem; }

.crunch-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-top: 0.5rem;
  padding: 0.85rem 1.1rem;
  background: var(--panel-2);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 0.92rem;
}

.crunch-reveal {
  width: auto;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--accent-strong);
  font-size: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.crunch-reveal:hover { background: none; color: var(--accent-dark); transform: none; }

@media (max-width: 640px) {
  .crunch-bar-head { grid-template-columns: 1fr; gap: 0.5rem; }
  .crunch-bar-text { padding: 1rem 1rem 0.5rem; }
  .crunch-go { min-height: 5.5rem; }
  .crunch-go { min-height: 10.5rem; }
  .crunch-bar-head { justify-items: start; }
  .crunch-go { width: 75%; }
  .crunch-go svg { inset: 0.75rem 1rem 0; width: calc(100% - 2rem); height: calc(100% - 0.75rem); }
  .crunch-bar .crunch-setup { margin-inline: 1rem; }
  .crunch-field { justify-items: stretch; }
  .crunch-grades { width: 100%; justify-content: space-between; }
  .crunch-grades button { min-width: 0; flex: 1; padding-inline: 0; }
}

.notes-enter-next { animation: notes-enter-next 260ms var(--ease) both; }
.notes-enter-prev { animation: notes-enter-prev 260ms var(--ease) both; }

@keyframes notes-enter-next {
  from { opacity: 0; transform: translateX(1.5rem); }
}

@keyframes notes-enter-prev {
  from { opacity: 0; transform: translateX(-1.5rem); }
}

/* Full notes: one full-width button under the subsection cards */
.outcome-picker-notes {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: var(--s0);
}

.outcome-picker-notes:hover { border-color: var(--accent-light); color: var(--accent-strong); }

/* ── Live reading — lyrics-style, three lines at a time ── */
.live-reader {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  animation: distilled-enter 220ms var(--ease);
}

.live-reader-progress {
  flex: 0 0 auto;
  height: 3px;
  background: var(--panel-3);
}

.live-reader-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

.live-reader-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding-inline: clamp(1.25rem, 6vw, 4rem);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}

.live-reader-track {
  max-width: 900px;
  margin-inline: auto;
  transition: transform 420ms cubic-bezier(0.25, 0.1, 0.25, 1);
  will-change: transform;
}

/* Every line shares one size and weight, so a line keeps its exact wrapping
   as it moves into and out of the lit position; only colour changes. */
.lr-line {
  margin: 0;
  padding: 0.7rem 0;
  color: var(--muted);
  font-size: clamp(1.4rem, 2.8vw, 2.1rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  opacity: 0;
  cursor: pointer;
  transition: opacity 420ms ease, color 420ms ease;
}

.lr-line.is-past,
.lr-line.is-next { opacity: 0.4; }
.lr-line.is-past:hover,
.lr-line.is-next:hover { opacity: 0.7; }

.lr-line.is-current {
  opacity: 1;
  color: var(--ink);
  cursor: default;
}

.lr-label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lr-line.is-current .lr-rest { color: color-mix(in oklch, currentColor 45%, transparent); }

.lr-still,
.lr-still .lr-line { transition: none !important; }

.live-reader-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem clamp(1rem, 4vw, 3rem) 1.4rem;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.live-reader-controls button { width: auto; }

.live-reader-step {
  width: 40px !important;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  font-size: 1.3rem;
  line-height: 1;
}

.live-reader-play {
  min-width: 96px;
  height: 40px;
  padding: 0 1.1rem;
  background: var(--accent);
  border-color: var(--accent);
  border-radius: var(--r-full);
  color: oklch(0.985 0.006 55);
}

.live-reader-play:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.live-reader-speed {
  margin-left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.live-reader-speed input[type="range"] {
  width: clamp(120px, 22vw, 240px);
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
}

.live-reader-speed output {
  min-width: 4.8rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .outcome-picker-grid { grid-template-columns: 1fr; }
  .outcome-card { min-height: 0; }
  #fullNotesScreen .full-notes-card .toolbar { flex-wrap: wrap; }
  .full-notes-actions { width: 100%; }
  .full-notes-actions button { flex: 1; }
  /* No room beside the text on a phone: the arrows flank the title instead */
  #fullNotesScreen.is-paged .notes-pager {
    position: static;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    box-shadow: none;
  }
  #fullNotesScreen.is-paged #fullNotesTitle { flex: 1; }
  #fullNotesScreen.is-paged .full-notes-body { padding-inline: 1rem; }
  .live-reader-controls { flex-wrap: wrap; }
  .live-reader-speed { width: 100%; margin-left: 0; justify-content: center; }
  .live-reader-speed input[type="range"] { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .live-reader-track,
  .lr-line,
  .outcome-card { transition: none; }
  .notes-enter-next,
  .notes-enter-prev { animation: none; }
}

/* ── Test ────────────────────────────────────── */
/* Setup lives in the Test tab. The run, marking and results take over the
   viewport on #testScreen so nothing competes with the question. Setup
   controls (chapter dropdown, time slider, mix) select in orange; marking
   choices stay ink. */

.test-container { padding: 0.35rem 0 1.25rem; }

.test-setup {
  display: grid;
  gap: 1rem;
  max-width: 760px;
}

.test-setup-row {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  align-items: start;
  gap: 0.75rem;
}

.test-setup-label,
.test-history h4,
.test-review-label,
.test-results-section h2 {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.test-setup-label { padding-top: 0.5rem; }

.test-choices { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.test-choice {
  width: auto;
  padding: 0.42rem 0.85rem;
  font-size: 0.82rem;
  color: var(--ink-2);
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
}

.test-choice:hover {
  color: var(--accent-strong);
  border-color: var(--accent-light);
}

.test-choice.is-active,
.test-choice.is-active:hover {
  color: var(--panel);
  background: var(--ink);
  border-color: var(--ink);
}

.test-link {
  width: auto;
  padding: 0.2rem 0.1rem;
  font-size: 0.8rem;
  color: var(--accent-strong);
  background: none;
  border: 0;
  text-decoration: underline;
  text-decoration-color: var(--accent-light);
  text-underline-offset: 3px;
}

.test-link:hover { color: var(--accent-ink); text-decoration-color: currentColor; }

.test-choice:focus-visible,
.test-link:focus-visible,
.test-dropdown-toggle:focus-visible,
.test-dropdown-option:focus-visible,
.test-mix-stop:focus-visible,
.test-option:focus-visible,
.test-map-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Chapter dropdown */
.test-dropdown { position: relative; }

.test-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem 0.6rem 0.95rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  list-style: none;
  cursor: pointer;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.test-dropdown-toggle::-webkit-details-marker { display: none; }
.test-dropdown-toggle:hover { border-color: var(--accent-light); }
.test-dropdown[open] .test-dropdown-toggle { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-xlight); }
.test-dropdown-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-dropdown-toggle svg { flex-shrink: 0; color: var(--accent); transition: transform 260ms var(--ease); }
.test-dropdown[open] .test-dropdown-toggle svg { transform: rotate(180deg); }

.test-dropdown-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 0.4rem;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--s2);
  transform-origin: top center;
  animation: test-dropdown-in 220ms var(--ease);
}

@keyframes test-dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
}

.test-dropdown-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  color: var(--ink-2);
  background: none;
  border: 0;
  border-radius: var(--r-xs);
  box-shadow: none;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}

.test-dropdown-option small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; font-weight: 500; color: var(--muted); }
.test-dropdown-option:hover { color: var(--accent-strong); background: var(--accent-xxlight); }
.test-dropdown-option[aria-checked="true"] { color: var(--panel); background: var(--accent); }
.test-dropdown-option[aria-checked="true"] small { color: var(--accent-xlight); }

.test-dropdown-head {
  margin: 0.45rem 0.7rem 0.2rem;
  padding-top: 0.55rem;
  border-top: 1.5px solid var(--line);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.test-chapter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.1rem 0.4rem;
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.test-chapter-option {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.42rem 0.7rem;
  border-radius: var(--r-xs);
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}

.test-chapter-option:hover { background: var(--accent-xxlight); }
.test-chapter-option:has(input:checked) { color: var(--accent-ink); background: var(--accent-xlight); }

.test-chapter-option input {
  flex-shrink: 0;
  appearance: none;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.05rem 0 0;
  padding: 0;
  background: var(--panel) center / 0.7rem no-repeat;
  border: 1.5px solid var(--accent-edge);
  border-radius: 5px;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), transform 160ms var(--ease);
}

.test-chapter-option input:checked {
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  border-color: var(--accent);
}

.test-chapter-option input:active { transform: scale(0.88); }
.test-chapter-option input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Time slider: snaps to 5 minutes. --p is the value's 0–1 position;
   positions are offset by half a thumb so marks sit under its centre. */
.test-time {
  --thumb: 24px;
  --at: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--p));
  display: grid;
  gap: 0.15rem;
}

.test-time-value { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.test-time-value strong {
  display: inline-block;
  min-width: 2ch;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.test-range {
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  appearance: none;
  background: none;
  border: 0;
  box-shadow: none;
  cursor: pointer;
  touch-action: pan-y;
}

.test-range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--accent-2), var(--accent)) 0 0 / var(--at) 100% no-repeat, var(--accent-xlight);
}

.test-range::-moz-range-track { height: 8px; border-radius: var(--r-full); background: var(--accent-xlight); }
.test-range::-moz-range-progress { height: 8px; border-radius: var(--r-full); background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

.test-range::-webkit-slider-thumb {
  appearance: none;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((8px - var(--thumb)) / 2);
  background: var(--panel);
  border: 4px solid var(--accent);
  border-radius: 50%;
  box-shadow: var(--so);
  transition: transform 200ms var(--ease);
}

.test-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--panel);
  border: 4px solid var(--accent);
  border-radius: 50%;
  box-shadow: var(--so);
  transition: transform 200ms var(--ease);
}

.test-range:hover::-webkit-slider-thumb { transform: scale(1.08); }
.test-range:active::-webkit-slider-thumb { transform: scale(1.2); }
.test-range:active::-moz-range-thumb { transform: scale(1.2); }
.test-range:focus-visible { outline: none; }
.test-range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 3px; }
.test-range:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent); outline-offset: 3px; }

.test-time-scale {
  position: relative;
  height: 1.1rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* --at resolves --p where it is declared, so each mark recomputes it with its own --p */
.test-time-scale span { position: absolute; top: 0; left: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--p)); transform: translateX(-50%); }

/* Mix: five stops from all flashcards to all exam, with a gliding thumb. */
.test-mix { display: grid; gap: 0.6rem; }

.test-mix-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 4px;
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  touch-action: pan-y;
  user-select: none;
}

.test-mix-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 5);
  background: var(--accent);
  border-radius: var(--r-full);
  box-shadow: var(--so);
  transform: translateX(calc(var(--mix-i) * 100%));
  transition: transform 460ms cubic-bezier(0.16, 1, 0.3, 1);
}

.test-mix-track.is-dragging .test-mix-thumb { transition-duration: 240ms; }

.test-mix-stop {
  position: relative;
  width: auto;
  min-height: 2.5rem;
  padding: 0.35rem 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  color: var(--ink-2);
  background: none;
  border: 0;
  border-radius: var(--r-full);
  box-shadow: none;
  transition: color 280ms var(--ease);
}

.test-mix-stop:hover { color: var(--accent-strong); }
.test-mix-stop[aria-checked="true"],
.test-mix-stop[aria-checked="true"]:hover { color: var(--panel); }

.test-mix-ratio {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.test-mix-ratio b { font-variant-numeric: tabular-nums; color: var(--ink-2); }

.test-mix-bar { position: relative; height: 8px; }

.test-mix-bar i {
  position: absolute;
  inset: 0;
  border-radius: var(--r-full);
  transition: clip-path 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Each half clips away the other's share, leaving a 3px seam between them. */
.test-mix-bar .is-cards { background: var(--accent); clip-path: inset(0 calc((1 - var(--mix-share)) * 100% + 1.5px) 0 0 round 999px); }
.test-mix-bar .is-exam { background: var(--ink); clip-path: inset(0 0 0 calc(var(--mix-share) * 100% + 1.5px) round 999px); }

@media (prefers-reduced-motion: reduce) {
  .test-mix-thumb,
  .test-mix-bar i,
  .test-dropdown-menu { transition: none; animation: none; }
}

.test-setup-start {
  display: grid;
  justify-items: start;
  gap: 0.75rem;
  margin-top: 0.35rem;
  padding-top: 1.1rem;
  border-top: 1.5px solid var(--line);
}

.test-preview {
  margin: 0;
  max-width: 62ch;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.test-preview strong { color: var(--ink); }

.test-preview-note {
  display: block;
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.test-start { width: auto; padding: 0.7rem 1.4rem; font-size: 0.95rem; }

.test-start:disabled,
.test-step:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.test-history { margin-top: 0.75rem; }
.test-history h4 { margin: 0 0 0.35rem; }

.test-history ol { list-style: none; margin: 0; padding: 0; }

.test-history li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--ink-2);
}

.test-history li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-history li strong { font-variant-numeric: tabular-nums; color: var(--muted); }
.test-history li strong.is-pass { color: var(--accent-strong); }
.test-history time { font-size: 0.78rem; color: var(--muted); }

/* Full-screen test page */

/* Above app chrome such as the phone chapter overlay (80), below the diagram viewer (1000). */
.test-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}

body.test-open .timer-widget { display: none; }

.test-run {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.test-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  background: var(--bg);
  border-bottom: 1.5px solid var(--line);
}

.test-bar-context { display: grid; gap: 0.1rem; min-width: 0; }

.test-bar-context span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.test-bar-context strong {
  overflow: hidden;
  font-size: 1rem;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-bar-actions { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }

.test-bar-actions .button-primary,
.test-bar-actions .button-secondary { width: auto; padding: 0.5rem 0.95rem; }

.test-clock {
  min-width: 3.2em;
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink);
  transition: color var(--t) var(--ease);
}

.test-clock.is-low { color: var(--accent-strong); }

.test-time-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1.5px;
  height: 3px;
  overflow: hidden;
}

.test-time-track span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 250ms linear;
}

.test-quit-ask { font-size: 0.88rem; font-weight: 600; color: var(--ink-2); }

.test-stage {
  align-self: start;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: clamp(1.5rem, 7vh, 4.5rem) clamp(1rem, 4vw, 1.5rem) 2.5rem;
}

.test-question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  margin: 0 0 1.75rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.test-kind { font-weight: 700; color: var(--accent-strong); }

.test-instruction {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.test-prompt {
  margin: 0 0 1.6rem;
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.test-prompt--exam {
  max-width: 65ch;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: -0.005em;
}

.test-description {
  margin: 0 0 1.6rem;
  max-width: 60ch;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
}

.test-options { display: grid; gap: 0.5rem; }

.test-option {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  color: var(--ink-2);
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
}

.test-option:hover { background: var(--accent-xxlight); border-color: var(--accent-light); }

.test-option kbd {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  font: 700 0.74rem var(--font);
  color: var(--muted);
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
}

.test-option.is-picked { color: var(--ink); background: var(--accent-xlight); border-color: var(--accent); }
.test-option:focus-visible { outline-color: var(--ink); }
.test-option.is-picked kbd { color: var(--panel); background: var(--accent); border-color: var(--accent); }

.test-cloze {
  margin: 0;
  max-width: 62ch;
  font-size: 1.15rem;
  line-height: 2.1;
  color: var(--ink-2);
}

.test-blank {
  display: inline-block;
  width: 8.5em;
  max-width: 100%;
  margin: 0 0.1rem;
  padding: 0.05rem 0.4rem;
  font-size: inherit;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
  background: var(--accent-xxlight);
  border: 0;
  border-bottom: 2px solid var(--accent-light);
  border-radius: 6px 6px 0 0;
  vertical-align: baseline;
}

.test-blank:focus { background: var(--accent-xlight); border-bottom-color: var(--accent); box-shadow: none; }

/* Fill-the-gap word bank. Gaps are drop slots in the sentence; chips sit in a
   tray below. A used chip leaves its outline so the tray never reflows. */
.test-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 5.5em;
  min-height: 1.9em;
  margin: 0 0.12rem;
  padding: 0 0.7rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
  vertical-align: baseline;
  background: var(--panel);
  border: 1.5px dashed var(--line);
  border-radius: var(--r-full);
  box-shadow: none;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.test-gap > span { font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.test-gap:hover { border-color: var(--accent-light); }
.test-gap.is-target { background: var(--accent-xxlight); border-color: var(--accent); }
.test-gap.is-target > span { color: var(--accent-strong); }

.test-gap.is-filled {
  color: var(--ink);
  background: var(--accent-xlight);
  border-style: solid;
  border-color: var(--accent-light);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.test-gap.is-filled.is-target { border-color: var(--accent-light); }
.test-gap.is-over { background: var(--accent-xlight); border-style: solid; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-xlight); }
.test-gap.is-lifted { color: var(--muted); }

.test-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 62ch;
  margin-top: 0.6rem;
  padding: 0.85rem;
  background: var(--panel-2);
  border-radius: var(--r-md);
}

.test-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: auto;
  padding: 0.5rem 0.95rem;
  font: 600 0.98rem/1.3 var(--font);
  color: var(--ink);
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  box-shadow: var(--s0);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), transform var(--t) var(--ease), opacity var(--t) var(--ease);
}

.test-chip:hover { border-color: var(--accent-light); box-shadow: var(--s1); transform: translateY(-1px); }
.test-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.test-chip kbd { font: 700 0.68rem var(--font); color: var(--muted); }

.test-chip.is-used {
  color: transparent;
  background: transparent;
  border-style: dashed;
  box-shadow: none;
  cursor: default;
}

.test-chip.is-lifted { opacity: 0.35; transform: none; }

.test-chip.is-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  pointer-events: none;
  border-color: var(--accent);
  box-shadow: var(--s2);
  cursor: grabbing;
}

.test-screen.is-dragging,
.test-screen.is-dragging * { cursor: grabbing; user-select: none; -webkit-user-select: none; }

@media (pointer: coarse) {
  .test-chip kbd { display: none; }
  .test-chip { padding: 0.6rem 1rem; }
}

.test-answer {
  min-height: 8rem;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  line-height: 1.55;
  border-radius: var(--r-md);
  resize: vertical;
}

.test-exam-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; }
.test-source { font-weight: 700; color: var(--ink-2); }

.test-context {
  max-height: 40vh;
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
}

.test-diagram { width: auto; margin: -0.6rem 0 1rem; padding: 0.45rem 0.85rem; font-size: 0.84rem; }

.test-foot {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 4vw, 2.5rem);
  background: var(--bg);
  border-top: 1.5px solid var(--line);
}

.test-step { width: auto; min-width: 6.5rem; }

.test-map {
  display: flex;
  justify-content: safe center;
  gap: 0.3rem;
  padding: 0.2rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.test-map-dot {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
}

.test-map-dot:hover { color: var(--accent-strong); border-color: var(--accent-light); }
.test-map-dot.is-answered { color: var(--accent-strong); background: var(--accent-xlight); border-color: var(--accent-light); }
.test-map-dot.is-current { color: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* Marking and results sheet */

.test-sheet {
  width: min(780px, 100%);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vh, 3rem) clamp(1rem, 4vw, 1.5rem) 4rem;
}

.test-sheet-head h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.test-sheet-head p { max-width: 62ch; margin: 0 0 2rem; line-height: 1.55; color: var(--ink-2); }

.test-live-score { font-size: 0.92rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }

.test-review-list { list-style: none; margin: 0; padding: 0; }

.test-review-item {
  display: grid;
  gap: 0.75rem;
  padding: 1.4rem 0;
  border-top: 1.5px solid var(--line);
}

.test-review-head { display: flex; align-items: center; gap: 0.6rem; font-size: 0.78rem; color: var(--muted); }
.test-review-num { min-width: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.test-review-chapter { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.test-verdict {
  flex-shrink: 0;
  margin-left: auto;
  padding: 0.2rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: var(--r-full);
}

.test-verdict.is-right { color: color-mix(in oklch, var(--success) 70%, var(--ink)); background: color-mix(in oklch, var(--success) 13%, var(--panel)); }
.test-verdict.is-wrong { color: color-mix(in oklch, var(--danger) 78%, var(--ink)); background: color-mix(in oklch, var(--danger) 10%, var(--panel)); }
.test-verdict.is-part { color: var(--accent-strong); background: var(--accent-xlight); }
.test-verdict.is-pending { color: var(--panel); background: var(--ink); }

.test-review-prompt { max-width: 65ch; margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.5; color: var(--ink); }
.test-review-prompt--quote { font-weight: 500; color: var(--ink-2); }

.test-review-answers {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.3rem 0.75rem;
  margin: 0;
  font-size: 0.92rem;
}

.test-review-answers dt { padding-top: 0.1rem; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.test-review-answers dd { margin: 0; line-height: 1.45; color: var(--ink-2); }
.test-review-answers dd.is-right { font-weight: 600; color: var(--ink); }
.test-review-answers dd.is-empty { font-style: italic; color: var(--muted); }
.test-review-answers dd.is-wrong {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in oklch, var(--danger) 60%, transparent);
}

.test-review-why { max-width: 65ch; margin: 0; font-size: 0.88rem; line-height: 1.5; color: var(--muted); }

.test-cloze--review { font-size: 1rem; line-height: 1.95; }

.test-fill { padding: 0.05rem 0.35rem; font-weight: 700; color: var(--accent-ink); background: var(--accent-xlight); border-radius: 6px; }
.test-fill.is-right { color: color-mix(in oklch, var(--success) 70%, var(--ink)); background: color-mix(in oklch, var(--success) 14%, var(--panel)); }
.test-fill-wrong s { color: var(--muted); text-decoration-color: color-mix(in oklch, var(--danger) 60%, transparent); }
.test-count-it { margin-left: 0.35rem; font-size: 0.74rem; }

/* Automatic marking: the scheme's points, each made, partly made or missed. */
.test-points { display: grid; gap: 0.5rem; margin: 0.1rem 0 0; padding: 0; list-style: none; }

.test-point {
  display: grid;
  grid-template-columns: 1.35rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  max-width: 68ch;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--ink-2);
}

.test-point-mark {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.1rem;
  font-size: 0.74rem;
  font-weight: 800;
  border-radius: 50%;
}

.test-point.is-made .test-point-mark { color: var(--panel); background: color-mix(in oklch, var(--success) 82%, var(--ink)); }
.test-point.is-part .test-point-mark { color: var(--accent-strong); background: var(--accent-xlight); border: 1.5px solid var(--accent-light); }
.test-point.is-missed .test-point-mark { border: 1.5px solid color-mix(in oklch, var(--danger) 45%, var(--line)); }
.test-point.is-missed .test-point-text { color: var(--muted); }
.test-point.is-missed .test-point-text strong { font-weight: 700; color: var(--ink-2); }

.test-hit {
  padding: 0 0.15em;
  color: inherit;
  background: color-mix(in oklch, var(--success) 15%, var(--panel));
  border-radius: 4px;
}

.test-verdict-check { margin-left: auto; font-size: 0.74rem; font-weight: 600; color: var(--accent-strong); }
.test-verdict-check + .test-verdict { margin-left: 0; }

.test-review-yours,
.test-review-model {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  border-radius: var(--r-md);
}

.test-review-yours { background: var(--panel); border: 1.5px solid var(--line); }
.test-review-model { background: var(--accent-xxlight); border: 1.5px solid var(--accent-xlight); }
.test-review-model .test-review-label { color: var(--accent-strong); }

.test-review-yours p,
.test-review-model p { margin: 0; font-size: 0.94rem; line-height: 1.55; color: var(--ink-2); }

.test-review-model .exam-answer-text { font-size: 0.94rem; }
.test-review-hint { font-size: 0.8rem; color: var(--muted); }

.test-selfmark-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.test-selfmark { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.test-selfmark--marks .test-choice { min-width: 2.4rem; padding-inline: 0.6rem; font-variant-numeric: tabular-nums; }

.test-selfmark--range { flex: 1; display: flex; align-items: center; gap: 0.75rem; min-width: 220px; }
.test-selfmark--range input { flex: 1; padding: 0; background: transparent; border: 0; box-shadow: none; accent-color: var(--accent); }
.test-selfmark--range output { min-width: 6.5rem; font-size: 0.9rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }

.test-sheet-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1.5px solid var(--line);
}

.test-sheet-foot .button-primary { width: auto; padding: 0.7rem 1.3rem; }

.test-results-head {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 4vw, 2.75rem);
  padding-bottom: 1.75rem;
}

.test-results-score {
  margin: 0;
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.test-results-score.is-pass { color: var(--accent); }

.test-results-head h1 { margin: 0 0 0.35rem; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; letter-spacing: -0.035em; }
.test-results-head p { margin: 0; line-height: 1.5; color: var(--ink-2); }
.test-results-head .test-results-note { margin-top: 0.35rem; font-size: 0.85rem; color: var(--muted); }

.test-results-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; padding-bottom: 2rem; }
.test-results-actions button { width: auto; padding: 0.65rem 1.2rem; }

.test-results-section { padding: 1.5rem 0; border-top: 1.5px solid var(--line); }
.test-results-section h2 { margin: 0 0 1rem; }

.test-chapter-scores { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.65rem; }

.test-chapter-scores li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(80px, 34%) 3rem;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.9rem;
}

.test-chapter-scores-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.test-chapter-scores-bar { height: 8px; overflow: hidden; background: var(--accent-xlight); border-radius: var(--r-full); }
.test-chapter-scores-bar span { display: block; height: 100%; background: var(--accent); transform-origin: left; }
.test-chapter-scores-value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

.test-missed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.test-missed li { display: grid; gap: 0.2rem; max-width: 68ch; }
.test-missed strong { font-size: 0.95rem; }
.test-missed span { font-size: 0.9rem; line-height: 1.5; color: var(--ink-2); }

@media (max-width: 640px) {
  .test-setup-row { grid-template-columns: 1fr; gap: 0.4rem; }
  .test-setup-label { padding-top: 0; }
  .test-mix-stop { font-size: 0.74rem; }
  .test-bar { flex-wrap: wrap; gap: 0.5rem 1rem; }
  .test-bar-context { flex: 1 1 60%; }
  .test-foot { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .test-map { grid-column: 1 / -1; grid-row: 1; justify-content: flex-start; }
  .test-step { min-width: 0; }
  .test-results-head { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .test-review-answers { grid-template-columns: 1fr; }
  .test-chapter-scores li { grid-template-columns: minmax(0, 1fr) 3rem; }
  .test-chapter-scores-bar { grid-column: 1 / -1; grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .test-time-track span { transition: none; }
}

/* Terms / privacy agreement and optional email consent on the sign-up forms */
.auth-form .auth-consent {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-top: 0.4rem;
  font-weight: 500;
  line-height: 1.45;
  cursor: pointer;
}
.auth-form .auth-consent input {
  flex: none;
  width: 1.05rem;
  min-height: 0;
  height: 1.05rem;
  margin: 0.1rem 0 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.auth-form .auth-consent a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ═══════════════════════════════════════════════
   VIEWPORT FIT
   The shell owns the viewport height; the panels fill what is left. No panel
   subtracts a guessed header height, so any window size or aspect ratio fits.
   Later than every breakpoint above on purpose; responsive.css (phone) still
   wins for its own padding because it loads after this file.
   ═══════════════════════════════════════════════ */
body { height: 100vh; height: 100dvh; }

.app-shell {
  --shell-top: 3.5rem;
  margin: 0;
  height: 100vh;
  height: 100dvh;
  padding-top: var(--shell-top);
}

.main-content { height: 100%; min-height: 0; grid-template-rows: minmax(0, 1fr); }
.subject-area { height: 100%; min-height: 0; }

@media (max-width: 980px) {
  .app-shell { --shell-top: 5rem; }
}

/* Sidebar tracks the window instead of a fixed 238px */
@media (min-width: 981px) {
  .subject-area { --sidebar-w: clamp(230px, 19vw, 300px); }
}

/* Paper guide: the whole screen scrolls, not the panel inside it */
.bd-screen { overflow-y: auto; overscroll-behavior: contain; }
.bd-panels { flex: none; overflow: visible; }
.bd-panel-body { overflow: visible; }
.bd-panel:not(.is-open) .bd-panel-body { height: 0; padding-block: 0; overflow: hidden; }

/* ── Skeleton loaders: placeholder shapes while a screen's data downloads ── */
.skeleton-block { display: grid; gap: 1.25rem; padding: 0.5rem 0; }
.skeleton-row { display: grid; gap: 0.6rem; }
.skeleton {
  display: block;
  max-width: 100%;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--line) 25%, color-mix(in srgb, var(--line), var(--panel) 55%) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.3s linear infinite;
}
@keyframes skeleton-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.study-card-footer[aria-hidden="true"] button { opacity: 0.5; pointer-events: none; }

/* ── First-run subject tour (tour.js) ── */
.tour {
  position: fixed;
  inset: 0;
  z-index: 200; /* above the test screen and full notes it spotlights */
  animation: ob-fade-in 0.35s var(--ease) both;
}
.tour.is-exiting { opacity: 0; transition: opacity 0.34s var(--ease); }
/* The wrapper lets clicks through; the blocker (with its hole cut out) and the card take them */
.tour { pointer-events: none; }
.tour-catch, .tour-card { pointer-events: auto; }
.tour-catch { position: absolute; inset: 0; }

/* The cut-out: a rounded box whose huge shadow is the dimmed page. tour.js moves it every frame,
   so it has no transitions, and its pulse is a separate ring that only fades (no repaint of the dim). */
.tour-hole {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: var(--r-md);
  box-shadow: 0 0 0 200vmax rgba(26, 25, 22, 0.62), 0 0 0 3px var(--accent);
  pointer-events: none;
  will-change: transform, width, height;
  transition: opacity 0.45s var(--ease);
}
/* Reading (the student scrolled the section) or a section shown bare: the spotlight fades away */
.tour.is-reading .tour-hole,
.tour.no-spot .tour-hole { opacity: 0; }
.tour-hole::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: calc(var(--r-md) + 9px);
  box-shadow: 0 0 0 6px rgba(250, 76, 6, 0.28);
  animation: tour-ring 2.4s ease-in-out infinite;
}
@keyframes tour-ring { 50% { opacity: 0.25; } }

.tour-card {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 24px));
  padding: 1.1rem 1.2rem 1.05rem;
  border-radius: var(--r-lg);
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(26, 25, 22, 0.28), 0 2px 6px rgba(26, 25, 22, 0.08);
  transition: width 0.45s var(--ease), padding 0.45s var(--ease);
}
/* The welcome and finish cards, and a card whose section is being read: bigger, then back */
.tour-card.is-big { width: min(540px, calc(100vw - 24px)); padding: 1.6rem 1.7rem 1.5rem; }
.tour-card.is-big .tour-title { font-size: clamp(1.6rem, 4vw, 2.15rem); }
.tour-card.is-big .tour-body { font-size: 1.08rem; }
.tour-card { will-change: transform; }
/* Words swap while faded out, then rise back in one after another */
.tour-card > * { transition: opacity 0.22s var(--ease), transform 0.32s var(--ease); }
.tour-card > :nth-child(2) { transition-delay: 30ms; }
.tour-card > :nth-child(3) { transition-delay: 60ms; }
.tour-card.is-swapping > * { opacity: 0; transform: translateY(5px); transition-duration: 0.14s; transition-delay: 0s; }
.tour-body { transition: opacity 0.14s var(--ease); }
.tour-body.is-changing { opacity: 0; }
.tour-next:disabled { opacity: 0.75; cursor: progress; }

.tour-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}
.tour-skip {
  width: auto;
  padding: 0.2rem 0.4rem;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.tour-skip:hover { color: var(--ink); }
.tour-title {
  margin: 0 0 0.3rem;
  transition: font-size 0.45s var(--ease);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.tour-title em { font-style: normal; color: var(--accent); }
.tour-body {
  margin: 0 0 1rem;
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.5;
}
.tour-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}
/* Next on a feature's tile: skip the demo and go to the next feature */
.tour-alt {
  width: auto;
  min-height: 48px;
  padding: 0 1.2rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 1.02rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.tour-alt:hover { border-color: var(--ink-2); background: var(--panel-2); }
.tour-alt:focus-visible { outline: 3px solid var(--accent-light); outline-offset: 2px; }
.tour-alt[hidden] { display: none; }
.tour-next {
  min-height: 48px; /* a comfortable tap target */
  padding: 0 1.45rem;
  font-size: 1.02rem;
  font-weight: 700;
  white-space: nowrap;
}
.tour-next .ob-icon { width: 20px; height: 20px; }
@media (max-width: 480px) {
  .tour-next, .tour-alt { flex: 1 1 0; justify-content: center; min-height: 52px; }
}

/* Finish card: words, then the row of features, then one wide Start studying button */
.tour.is-last .tour-skip { display: none; }
.tour.is-last .tour-title { order: 1; }
.tour.is-last .tour-body { order: 2; }
.tour.is-last .tour-card-top { order: 3; justify-content: center; margin: 0.25rem 0 1.1rem; }
.tour.is-last .tour-foot { order: 4; }
.tour.is-last .tour-next { flex: 1 1 100%; justify-content: center; min-height: 58px; font-size: 1.15rem; }
.tour.is-last .tour-rail li { width: 30px; height: 30px; }
.tour.is-last .tour-rail .tile-icon svg { width: 18px; height: 18px; }

/* One icon per section: lit while it's shown, faded once seen */
.tour-rail {
  display: flex;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tour-rail li {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-full);
  color: var(--muted);
  opacity: 0.45;
  transition: color var(--t) var(--ease), background var(--t) var(--ease);
}
/* Reset the section-tile icon chip (layout.css) to a bare glyph */
.tour-rail .tile-icon { display: block; width: auto; height: auto; padding: 0; border-radius: 0; background: none; color: inherit; }
.tour-rail .tile-icon svg { width: 15px; height: 15px; display: block; }
.tour-rail li.is-done { color: var(--accent-edge); opacity: 1; }
.tour-rail li.is-current { color: #fff; background: var(--accent); opacity: 1; }

/* Room at the bottom of a spotlit scroller while the card sits over it (tour.js sets the height) */
.tour-reserve {
  padding-bottom: var(--tour-reserve, 0px) !important;
  transition: padding-bottom 0.3s var(--ease);
}

/* Demo only (?preview=tour) */
.tour-restart {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem 0.5rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 650;
  box-shadow: 0 6px 18px rgba(26, 25, 22, 0.14);
  cursor: pointer;
}
.tour-restart:hover { border-color: var(--accent); color: var(--accent-strong); }
.tour-restart svg { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) {
  .tour, .tour *, .tour-hole { animation: none !important; transition: none !important; }
}
