/* ==========================================================================
   Page-specific styles. Grouped by page; shared bits live in components.css.
   ========================================================================== */

.inline-icon { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }
.inline-icon.ok { color: var(--good); }
.mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }
.link-u { color: var(--scrub); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.icon-btn.on-scrub { color: var(--scrub); background: var(--scrub-soft); }
.page-wide { max-width: 1440px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
@media (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.lede { font-size: var(--fs-md); color: var(--ink-2); line-height: 1.5; max-width: 60ch; }
.up { color: var(--good); } .down { color: var(--rose); }

/* ---------- Home ---------- */
.hello { display: flex; align-items: flex-end; gap: var(--s-6); flex-wrap: wrap; margin: var(--s-2) 0 var(--s-6); }
.hello-text { flex: 1; min-width: 280px; }
.hello-date { font-size: var(--fs-sm); color: var(--ink-3); margin-bottom: 6px; }
.hello h1 { font-size: var(--fs-3xl); letter-spacing: -0.035em; }
.hello .lede { margin-top: 10px; }
.hello-cta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
@media (max-width: 720px) {
  .hello h1 { font-size: var(--fs-2xl); }
  .hello-cta { align-items: stretch; width: 100%; }
}

/* Signature: study vitals monitor */
.vitals {
  position: relative;
  background: var(--monitor);
  color: var(--monitor-ink);
  border-radius: var(--r-xl);
  padding: var(--s-5) var(--s-6) var(--s-4);
  overflow: hidden;
  isolation: isolate;
}
.vitals::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: linear-gradient(var(--monitor-grid) 1px, transparent 1px), linear-gradient(90deg, var(--monitor-grid) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, black 0%, black 60%, transparent 100%);
}
.vitals-head { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.vitals-title { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; }
.vitals-title svg { width: 18px; height: 18px; color: var(--trace); }
.vitals-sub { font-size: var(--fs-xs); color: var(--monitor-ink-2); }
.vitals-range { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--trace); border: 1px solid var(--trace-dim); padding: 2px 8px; border-radius: var(--r-pill); }
.vitals-screen { height: 120px; margin: var(--s-3) calc(var(--s-6) * -1) var(--s-2); }
.vitals-trace { width: 100%; height: 100%; overflow: visible; }
.vitals-screen { position: relative; }
.vitals-plot { position: absolute; inset: 0; }
.vitals-beats { position: absolute; inset: 0; }
.vitals-beat { position: absolute; top: 0; bottom: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer; transition: background-color var(--t-fast) ease; }
@media (hover: hover) and (pointer: fine) { .vitals-beat:hover { background: rgba(124, 240, 197, .07); } }
.vitals-beat:focus-visible { outline: 2px solid var(--trace); outline-offset: -2px; background: rgba(124, 240, 197, .07); }
.vitals-tip { position: absolute; top: 6px; z-index: 2; transform: translate(-50%, 4px); padding: 8px 10px; border-radius: 10px; background: var(--monitor-ink); color: var(--monitor); font: 600 var(--fs-xs)/1.35 var(--font-mono); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 150ms ease, transform 150ms var(--ease-out); }
.vitals-tip.on { opacity: 1; transform: translate(-50%, 0); }
.vitals-days { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); margin: 0 calc(var(--s-6) * -1) var(--s-3); padding: 0 var(--pad); }
.vitals-days span { text-align: center; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; color: var(--monitor-ink-2); transition: color var(--t-fast) ease; }
.vitals-days b { font-weight: 600; }
.vitals-days .short { display: none; }
.vitals-days span.today { color: var(--trace); }
.vitals-days span.future { opacity: .45; }
.vitals-days span.on { color: var(--monitor-ink); }
@media (max-width: 720px) { .vitals-days .long { display: none; } .vitals-days .short { display: inline; } }
@media (prefers-reduced-motion: reduce) { .vitals-tip { transition: none; } }
.vitals-trace .trace-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw-trace 2.2s var(--ease-in-out) .15s forwards; }
.vitals-trace .trace-glow { opacity: 0; animation: fade-in-glow .6s 1.8s forwards; }
/* A bright segment sweeps along the trace like a monitor (glow comes from an SVG filter, so Safari shows it too). */
.vitals-trace .trace-sweep { stroke-linecap: butt; stroke-dasharray: 0.07 2; stroke-dashoffset: 0.07; opacity: 0; animation: trace-sweep 6.4s linear 2.35s infinite; }
.vitals-trace.settled .trace-sweep { animation-delay: .4s; }
@keyframes trace-sweep {
  0% { stroke-dashoffset: 0.07; opacity: 1; }
  50% { stroke-dashoffset: -1.005; opacity: 1; }
  50.1%, 100% { stroke-dashoffset: -1.1; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .vitals-trace .trace-sweep { display: none; } }
.reduce-motion .vitals-trace .trace-sweep { display: none; }
@keyframes draw-trace { to { stroke-dashoffset: 0; } }
/* A bright dot leads the sweep, riding the same path in step with it. */
.trace-dot { position: absolute; left: 0; top: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--trace); offset-rotate: 0deg; opacity: 0; pointer-events: none;
  box-shadow: 0 0 4px 1px var(--trace), 0 0 12px 4px color-mix(in srgb, var(--trace) 55%, transparent);
  animation: trace-dot 6.4s linear 2.35s infinite; }
.vitals-trace.settled + .trace-dot { animation-delay: .4s; }
/* The sweep's leading edge covers the whole path in the first 46.5% of the cycle. */
@keyframes trace-dot {
  0% { offset-distance: 0%; opacity: 0; }
  4% { opacity: 1; }
  42% { opacity: 1; }
  46.5% { offset-distance: 100%; opacity: 0; }
  100% { offset-distance: 100%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .trace-dot { display: none; } }
.reduce-motion .trace-dot { display: none; }
@keyframes fade-in-glow { to { opacity: 1; } }
.readouts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-top: 1px solid rgba(124, 240, 197, .14); }
.readout { padding: var(--s-4) var(--s-4) var(--s-1); border-left: 1px solid rgba(124, 240, 197, .14); min-width: 0; }
.readout:first-child { border-left: 0; padding-left: 0; }
.readout dt { font-size: var(--fs-xs); color: var(--monitor-ink-2); }
.readout dd { margin: 2px 0 0; display: flex; align-items: baseline; gap: 4px; }
.readout dd b { font-family: var(--font-mono); font-weight: 600; font-size: 2rem; letter-spacing: -0.02em; color: var(--monitor-ink); line-height: 1.1; }
.readout dd small { font-family: var(--font-mono); color: var(--monitor-ink-2); font-size: var(--fs-sm); }
.readout .delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--monitor-ink-2); }
.readout .delta.up { color: var(--trace); }
.readout .delta.down { color: var(--rose); }
.readout .delta svg { width: 13px; height: 13px; }
@media (max-width: 860px) {
  .readouts { grid-template-columns: repeat(2, 1fr); }
  .readout:nth-child(3) { border-left: 0; padding-left: 0; }
  .readout:nth-child(n+3) { border-top: 1px solid rgba(124, 240, 197, .14); }
}
@media (max-width: 720px) {
  .vitals { padding: var(--s-4); border-radius: var(--r-lg); }
  .vitals-screen { height: 90px; margin: var(--s-2) calc(var(--s-4) * -1); }
  .vitals-days { margin: 0 calc(var(--s-4) * -1) var(--s-2); }
  .vitals-sub { display: none; }
  .readout dd b { font-size: 1.6rem; }
}

/* Quick actions: a tool rail, not a card grid */
/* Quick actions: one row that scrolls sideways with no visible scrollbar.
   Edges fade only on the side where more buttons are hidden. */
.quick {
  display: flex; gap: var(--s-2); margin: var(--s-4) 0 var(--s-6); padding: 2px 0;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-behavior: smooth;
  scrollbar-width: none; -ms-overflow-style: none;
  --fs: 0px; --fe: 0px;
  mask-image: linear-gradient(90deg, transparent, #000 var(--fs), #000 calc(100% - var(--fe)), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fs), #000 calc(100% - var(--fe)), transparent);
}
.quick::-webkit-scrollbar { display: none; }
.quick.fade-start { --fs: 40px; }
.quick.fade-end { --fe: 40px; }
.quick-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 16px 0 12px;
  border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  font-weight: 600; font-size: .9rem; white-space: nowrap;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.quick-btn svg { flex: none; width: 18px; height: 18px; color: var(--scrub); padding: 6px; box-sizing: content-box; border-radius: 8px; background: var(--scrub-soft); }
.quick-btn:hover { border-color: var(--scrub); }
.quick-btn:active { transform: scale(.97); }
.quick-accent { background: var(--monitor); color: var(--monitor-ink); border-color: var(--monitor); margin-left: auto; }
:root[data-theme="dark"] .quick-accent, :root[data-theme="dark"] .preset-accent { border: 1px solid var(--trace-dim); }
.quick-accent svg { background: rgba(255,255,255,.12); color: var(--trace); }
.quick-accent:hover { border-color: var(--trace-dim); background: var(--monitor-2); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-4); align-items: stretch; }
/* Both columns end on the same line: the last panel in each grows to fill. */
.dash-main > :last-child, .dash-side > :last-child { flex: 1 1 auto; }
.dash-main, .dash-side { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
/* Right column sits beside the main column and scrolls with the page. Stacks on phones. */
@media (max-width: 1180px) { .dash-grid { grid-template-columns: minmax(0, 1fr) 280px; } }
@media (max-width: 860px) { .dash-grid { grid-template-columns: minmax(0, 1fr) 240px; } .dash-side .panel { padding: var(--s-4); } }
@media (max-width: 720px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Recommended next */
.next-up { border: 1px solid color-mix(in srgb, var(--rose) 20%, var(--line)); }
.next-head { display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-4); }
.next-head h2 { margin: 2px 0 4px; font-size: var(--fs-xl); }
.next-head .ring > span { color: var(--rose); }
.path { display: flex; flex-direction: column; gap: 2px; counter-reset: p; }
.path-step { display: flex; align-items: center; gap: var(--s-3); padding: 10px 12px; border-radius: var(--r-md); transition: background var(--t-fast); }
.path-step:hover { background: var(--surface-2); }
.path-step .sub { display: block; font-size: var(--fs-sm); color: var(--ink-3); }
.path-n { width: 22px; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); text-align: center; }
.path li.done .path-step b { color: var(--ink-3); }
.path-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.path-icon svg { width: 17px; height: 17px; }
.path li:first-child .path-icon { background: var(--scrub); color: var(--scrub-ink); }

/* Performance */
.perf { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s-6); }
.perf-chart .line-chart { width: 100%; height: auto; margin-top: var(--s-2); }
.line-chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.line-chart .axis { fill: var(--ink-3); font-size: 11px; font-family: var(--font-body); }
@media (max-width: 760px) { .perf { grid-template-columns: minmax(0, 1fr); } }
.scores { display: flex; flex-direction: column; gap: 4px; margin-top: var(--s-2); }
.scores li { display: flex; align-items: center; gap: var(--s-3); padding: 8px 0; min-width: 0; }
.scores li + li { border-top: 1px solid var(--line); }
.scores .title { display: block; font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scores .sub { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); }
.score-pill { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: .95rem; }
.score-pill.hi { background: var(--good-soft); color: var(--good); }
.score-pill.mid { background: var(--amber-soft); color: var(--amber); }
.score-pill.lo { background: var(--rose-soft); color: var(--rose); }

/* Subjects */
.subjects { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6); }
@media (max-width: 640px) { .subjects { grid-template-columns: minmax(0, 1fr); } }
.subj-h { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--rose); margin-bottom: var(--s-2); }
.subj-h.good { color: var(--good); }
.subj-h svg { width: 16px; height: 16px; }
.subj-list { display: flex; flex-direction: column; gap: 4px; }
.subj { display: flex; padding: 8px 10px; margin: 0 -10px; border-radius: var(--r-md); }
a.subj:hover { background: var(--surface-2); }
.subj .grow { display: flex; flex-direction: column; gap: 6px; }

/* Due */
.due-panel { background: var(--amber-soft); box-shadow: none; }
.due-top { display: flex; align-items: flex-start; justify-content: space-between; }
.due-n { display: block; font-family: var(--font-display); font-size: 3rem; font-weight: 800; line-height: 1; letter-spacing: -0.04em; color: var(--ink); }
.due-icon { width: 44px; height: 44px; border-radius: 14px; background: var(--surface); color: var(--amber); display: grid; place-items: center; }
.due-icon svg { width: 22px; height: 22px; }
.due-decks { margin: var(--s-4) 0; display: flex; flex-direction: column; }
.due-decks a { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: var(--fs-sm); font-weight: 500; }
.due-decks li + li a { border-top: 1px solid color-mix(in srgb, var(--amber) 22%, transparent); }
.due-decks a:hover .grow { text-decoration: underline; text-underline-offset: 3px; }
.due-panel .btn-soft { --btn-bg: var(--surface); --btn-fg: var(--ink); }

/* Timeline */
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; align-items: center; gap: var(--s-3); padding: 9px 0; min-width: 0; }
.tl + .tl { border-top: 1px solid var(--line); }
.tl .title { display: block; font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl .sub { display: block; font-size: var(--fs-xs); color: var(--ink-3); }
.tl-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--ink-2); }
.tl-icon svg { width: 16px; height: 16px; }
.tl-exam .tl-icon { background: var(--rose-soft); color: var(--rose); }
.tl-clinical .tl-icon { background: var(--sky-soft); color: var(--sky); }
.tl-quiz .tl-icon { background: var(--amber-soft); color: var(--amber); }
.tl-assignment .tl-icon { background: var(--due-soft); color: var(--due); }

.feed { display: flex; flex-direction: column; gap: var(--s-3); }
.feed li { display: flex; gap: 10px; font-size: var(--fs-sm); }
.feed li > svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; margin-top: 3px; }
.feed .grow span { display: block; }

/* ---------- Library ---------- */
.lib { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.lib-tree { position: sticky; top: calc(var(--topbar-h) + 12px); display: flex; flex-direction: column; gap: 2px; }
.tree-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); text-align: left; width: 100%; font-size: var(--fs-sm); transition: background var(--t-fast); }
.tree-item svg { width: 17px; height: 17px; color: var(--ink-3); }
.tree-item:hover { background: var(--surface-2); }
.tree-item.on { background: var(--surface); box-shadow: var(--shadow-1); }
.tree-unit { padding-left: 29px; color: var(--ink-2); font-size: var(--fs-sm); }
.tree-unit.on { color: var(--ink); font-weight: 600; }
.lib-tools { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }
.lib-search { max-width: 340px; background: var(--surface); border-color: var(--line); }
@media (max-width: 900px) {
  .lib { grid-template-columns: minmax(0, 1fr); }
  .lib-tree { position: static; flex-direction: row; overflow-x: auto; gap: var(--s-2); scrollbar-width: none; }
  .tree-item { width: auto; white-space: nowrap; flex: none; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 6px 12px; }
  .tree-item .muted { display: none; }
  .tree-unit { padding-left: 12px; }
}
.unit-block { margin-bottom: var(--s-6); }
.unit-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-2); padding: 0 var(--s-2); }
.unit-name { font-family: var(--font-display); font-weight: 650; }
.lec-list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.lec { display: flex; align-items: center; transition: background var(--t-fast); }
.lec + .lec { border-top: 1px solid var(--line); }
.lec:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.lec.sel { background: color-mix(in srgb, var(--scrub-soft) 60%, transparent); }
.lec-check { padding: 0 4px 0 16px; align-self: stretch; display: flex; align-items: center; cursor: pointer; }
.lec-check input { width: 18px; height: 18px; accent-color: var(--scrub); }
.lec-more { margin-right: 10px; flex: none; color: var(--ink-3); }
.lec-more:hover, .lec-more[aria-expanded="true"] { color: var(--ink); background: var(--surface-2); }
.lec-name-input { height: 32px; padding: 0 8px; margin-left: -8px; font-size: var(--fs-sm); font-weight: 600; width: 100%; }
.lec-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-3); padding: 12px 16px 12px 8px; }
.lec-body .title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lec-body .sub { display: block; font-size: var(--fs-sm); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lec-made { display: flex; gap: 4px; }
.made-dot { width: 26px; height: 26px; border-radius: 8px; background: var(--scrub-soft); color: var(--scrub); display: grid; place-items: center; }
.made-dot svg { width: 13px; height: 13px; }
@media (max-width: 560px) { .lec-made { display: none; } }

/* Selection bar (library + guide) */
.selbar {
  position: fixed; left: 50%; bottom: 24px; z-index: 40;
  transform: translate(-50%, calc(100% + 48px));
  visibility: hidden;
  display: flex; align-items: center; gap: var(--s-3);
  max-width: calc(100vw - 32px);
  padding: 8px 8px 8px 18px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  transition: transform 320ms var(--ease-out), visibility 0s 320ms;
}
.selbar.show { transform: translate(-50%, 0); visibility: visible; transition: transform 320ms var(--ease-out); }
.selbar [data-make] { position: relative; }
.selbar .pro-badge { position: absolute; top: -9px; right: -6px; pointer-events: none; }
/* Room above the buttons for the corner badge (the row scrolls sideways when narrow). */
.selbar-actions { padding: 10px 8px 0 0; margin: -10px -8px 0 0; }
/* Make room so every button (and the Pro badge) fits without scrolling. */
@media (max-width: 1200px) { .selbar-label { display: none; } }
/* Center over the content column, clear of the sidebar. */
@media (min-width: 721px) { .selbar { left: calc(50% + var(--sidebar-w) / 2); max-width: calc(100vw - var(--sidebar-w) - 32px); } }
.selbar-count { white-space: nowrap; font-size: var(--fs-sm); }
.selbar-label { color: color-mix(in srgb, var(--paper) 60%, transparent); }
.selbar-actions { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.selbar .btn { --btn-bg: color-mix(in srgb, var(--paper) 10%, transparent); --btn-fg: var(--paper); --btn-bd: transparent; }
.selbar .btn:hover { background: color-mix(in srgb, var(--paper) 18%, transparent); }
.selbar .icon-btn { color: var(--paper); }
.selbar .icon-btn:hover { background: color-mix(in srgb, var(--paper) 12%, transparent); }
@media (max-width: 720px) { .selbar { bottom: calc(84px + env(safe-area-inset-bottom)); } .selbar-label { display: none; } }

/* Upload */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: var(--s-8) var(--s-4); border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.dropzone:hover, .dropzone.over { border-color: var(--scrub); background: color-mix(in srgb, var(--scrub-soft) 40%, transparent); }
.dz-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--scrub-soft); color: var(--scrub); display: grid; place-items: center; margin-bottom: 6px; }
.dz-icon svg { width: 24px; height: 24px; }

/* Generator */
.kind-picker { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-2); margin-bottom: var(--s-5); }
.kind { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px 12px; border-radius: var(--r-md); border: 1px solid var(--line); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); transition: all var(--t-fast); }
.kind svg { width: 22px; height: 22px; }
.kind:hover { border-color: var(--line-strong); color: var(--ink); }
.kind[aria-selected="true"] { border-color: var(--scrub); background: var(--scrub-soft); color: var(--scrub); }
.kind .pro-badge { position: absolute; top: -8px; right: 6px; }
@media (max-width: 600px) { .kind-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kind { font-size: var(--fs-xs); padding: 12px 4px 10px; } }
.gen-section > .hstack { flex-wrap: wrap; gap: var(--s-2); }
.modal-body .seg { max-width: 100%; overflow-x: auto; }
.gen-section { padding: var(--s-4) 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--s-3); }
.source-list { height: 240px; overflow-y: auto; scrollbar-gutter: stable; border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px; }
.source-course { padding: 10px 10px 4px; }
.source-optional { font-family: var(--font-body); font-weight: 400; margin-left: 4px; }
.source-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.source-row:hover { background: var(--surface-2); }
.source-row input { accent-color: var(--scrub); width: 16px; height: 16px; flex: none; }
.source-row .ftype { width: 30px; height: 30px; font-size: 9px; border-radius: 8px; }
.source-row .ftype svg { width: 15px; height: 15px; }
.source-row .title { display: block; font-size: var(--fs-sm); font-weight: 600; }
.source-row .sub { display: block; font-size: var(--fs-xs); color: var(--ink-3); }
.modal-foot .xs { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 600px) { .modal-foot > .xs { display: none; } }

.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-2); }
.menu-tile { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); font-weight: 600; font-size: var(--fs-sm); }
.menu-tile svg { width: 19px; height: 19px; color: var(--scrub); }
.menu-tile .pro-badge { margin-left: auto; }

/* ---------- Lecture detail ---------- */
.made-from { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-3); margin-bottom: var(--s-4); }
.slot { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: var(--s-4); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); text-align: left; transition: box-shadow var(--t-fast), transform var(--t-fast) var(--ease-out); }
.slot:hover { box-shadow: var(--shadow-2); }
.slot:active { transform: scale(.98); }
.slot-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--scrub-soft); color: var(--scrub); margin-bottom: 8px; }
.slot-icon svg { width: 17px; height: 17px; }
@media (max-width: 760px) { .made-from { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 460px) { .made-from { grid-template-columns: repeat(2, 1fr); } }
.lecture-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-4); margin-top: var(--s-4); }
@media (max-width: 900px) { .lecture-cols { grid-template-columns: minmax(0, 1fr); } }
.reading { line-height: 1.7; max-width: 68ch; }
.player { padding: var(--s-4) var(--s-5); }
.player-top { display: flex; align-items: center; gap: var(--s-4); }
.play-btn { width: 52px; height: 52px; border-radius: 50%; background: var(--scrub); color: var(--scrub-ink); display: grid; place-items: center; flex: none; transition: transform var(--t-fast); }
.play-btn:active { transform: scale(.94); }
.play-btn svg { width: 22px; height: 22px; fill: currentColor; }
.wave { position: relative; height: 54px; display: flex; align-items: center; gap: 2px; }
.wave i { flex: 1; height: var(--h); background: var(--surface-3); border-radius: 2px; transition: background var(--t-fast); }
.wave i.played { background: var(--scrub); }
.wave-mark { position: absolute; top: -4px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--amber); border: 2px solid var(--surface); cursor: pointer; z-index: 2; }
.wave-head { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); border-radius: 1px; transition: left 250ms linear; }
.moments { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s-2); }
.moments button { display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: 8px; border-radius: 10px; text-align: left; font-size: var(--fs-sm); }
.moments button:hover { background: var(--surface-2); }
.transcript { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s-3); max-height: 420px; overflow-y: auto; }
.transcript li { display: flex; gap: var(--s-3); padding: 8px; border-radius: 10px; transition: background var(--t-fast); }
.transcript li.now { background: var(--scrub-soft); }
.transcript li button { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--scrub); flex: none; padding-top: 3px; }
.transcript p { font-size: var(--fs-sm); line-height: 1.6; }
.slides-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.slide-thumb { aspect-ratio: 16/10; border-radius: 10px; background: var(--surface-2); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.slide-thumb i { display: block; height: 6px; border-radius: 3px; background: var(--surface-3); width: 85%; }
.transcribing { display: flex; flex-direction: column; gap: var(--s-3); margin-top: var(--s-4); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--scrub-soft); border-top-color: var(--scrub); border-radius: 50%; animation: spin .9s linear infinite; flex: none; }
.tr-step { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); color: var(--ink-3); padding-left: 38px; }
.tr-step .course-dot { --c: var(--line-strong); }
.tr-step.done { color: var(--ink-2); } .tr-step.done .course-dot { --c: var(--good); }
.tr-step.active { color: var(--ink); font-weight: 600; } .tr-step.active .course-dot { --c: var(--scrub); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.5); opacity: .6; } }

/* ---------- Quizzes ---------- */
.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); margin-bottom: var(--s-4); }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: var(--s-5); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); text-align: left; transition: box-shadow var(--t-fast), transform var(--t-fast); }
.preset:hover { box-shadow: var(--shadow-2); }
.preset:active { transform: scale(.98); }
.preset-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--scrub-soft); color: var(--scrub); margin-bottom: var(--s-2); }
.preset-icon svg { width: 20px; height: 20px; }
.preset { position: relative; }
.preset > .pro-badge { position: absolute; top: 10px; right: 10px; }
/* A button with a Pro badge pinned to its top-right corner. */
.btn-has-badge { position: relative; overflow: visible; }
.btn-has-badge > .pro-badge { position: absolute; top: -9px; right: -8px; pointer-events: none; }
/* Weak areas: a soft green card on the light theme, the monitor look on dark. */
.preset-accent { background: var(--scrub-soft); border: 1px solid color-mix(in srgb, var(--scrub) 22%, transparent); box-shadow: none; }
:root[data-theme="dark"] .preset-accent { background: var(--monitor); color: var(--monitor-ink); }
:root[data-theme="dark"] .preset-accent .muted { color: var(--monitor-ink-2); }
.preset-new { box-shadow: none; border: 1.5px dashed var(--line-strong); background: transparent; }
.preset-new:hover { border-color: var(--scrub); background: var(--scrub-soft); box-shadow: none; }
.preset-accent .preset-icon { background: var(--surface); color: var(--scrub); }
:root[data-theme="dark"] .preset-accent .preset-icon { background: rgba(255,255,255,.1); color: var(--trace); }
@media (max-width: 960px) { .presets { grid-template-columns: repeat(2, 1fr); } }
.nclex-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4) var(--s-6); }
.nclex-cat { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 760px) { .nclex-grid { grid-template-columns: minmax(0, 1fr); } }

/* Quiz player */
.qp { display: flex; flex-direction: column; gap: var(--s-4); }
.qp-top { display: flex; align-items: center; gap: var(--s-4); }
.qp-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: 6px; font-size: var(--fs-sm); }
.qp-timer { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-2); padding: 6px 10px; background: var(--surface-2); border-radius: 8px; }
.qp-body { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: var(--s-4); align-items: start; }
.qp-card { background: var(--surface); border-radius: var(--r-xl); padding: var(--s-8); box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
.stem { font-family: var(--font-body); font-weight: 700; font-size: 1.3rem; line-height: 1.45; letter-spacing: -0.005em; max-width: 64ch; }
.case-text { display: flex; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-md); background: var(--sky-soft); }
.case-text svg { width: 18px; height: 18px; color: var(--sky); flex: none; margin-top: 3px; }
.case-text p { font-size: var(--fs-sm); line-height: 1.6; }
.options { display: flex; flex-direction: column; gap: var(--s-2); }
.option { display: flex; align-items: center; gap: var(--s-3); width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface); line-height: 1.45; transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast); }
.option:hover:not([disabled]) { border-color: var(--line-strong); background: var(--surface-2); }
.option:active:not([disabled]) { transform: scale(.995); }
.option[disabled] { cursor: default; }
.opt-key { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); font-weight: 700; font-size: var(--fs-sm); color: var(--ink-2); transition: all var(--t-fast); }
.opt-key.square { border-radius: 8px; }
.opt-key svg { width: 16px; height: 16px; stroke-width: 3; }
.option.picked { border-color: var(--scrub); background: color-mix(in srgb, var(--scrub-soft) 60%, transparent); }
.option.picked .opt-key { background: var(--scrub); border-color: var(--scrub); color: var(--scrub-ink); }
.option.right { border-color: var(--good); background: var(--good-soft); }
.option.right .opt-key { background: var(--good); border-color: var(--good); color: white; }
.option.wrong { border-color: var(--rose); background: var(--rose-soft); }
.option.wrong .opt-key { background: var(--rose); border-color: var(--rose); color: white; }
/* A right select-all answer that wasn't picked: red, with a note saying so. */
.option.missed { border-color: var(--rose); background: var(--rose-soft); }
.option.missed .opt-key { border-color: var(--rose); color: var(--rose); }
.opt-missed { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--rose) 16%, transparent); color: var(--rose); font-size: var(--fs-xs); font-weight: 600; vertical-align: 1px; }
.rationale { padding: var(--s-4) var(--s-5); border-radius: var(--r-md); border-left: 4px solid var(--good); background: var(--good-soft); display: flex; flex-direction: column; gap: 6px; animation: pop-in 260ms var(--ease-out); }
.rationale.no { border-left-color: var(--rose); background: var(--rose-soft); }
.rationale.part { border-left-color: var(--amber); background: var(--amber-soft); }
.rationale.part b { color: color-mix(in srgb, var(--amber) 70%, var(--ink)); }
.rationale b { display: inline-flex; align-items: center; gap: 6px; }
.rationale b svg { width: 18px; height: 18px; }
.rationale.ok b { color: var(--good); } .rationale.no b { color: var(--rose); }
.rationale p { line-height: 1.6; font-size: .95rem; color: var(--ink); }
.rationale .btn { align-self: flex-start; margin-top: 4px; }
.qp-nav { position: sticky; top: calc(var(--topbar-h) + 12px); background: var(--surface); border-radius: var(--r-lg); padding: var(--s-4); box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: var(--s-3); }
.qnav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qn { aspect-ratio: 1; border-radius: 10px; border: 1.5px solid var(--line); font-weight: 700; font-size: var(--fs-sm); position: relative; transition: all var(--t-fast); }
.qn:hover { border-color: var(--line-strong); }
.qn.ans { background: var(--scrub-soft); border-color: transparent; color: var(--scrub); }
.qn.ok { background: var(--good-soft); border-color: transparent; color: var(--good); }
.qn.no { background: var(--rose-soft); border-color: transparent; color: var(--rose); }
.qn.part { background: var(--amber-soft); border-color: transparent; color: color-mix(in srgb, var(--amber) 70%, var(--ink)); }
.qn.cur { border-color: var(--ink); }
.qn.flag::after, .lg.flag { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.qnav-legend { display: flex; gap: var(--s-3); }
.qnav-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; position: relative; }
.lg.ans { background: var(--scrub-soft); }
.lg.flag { position: static; border-radius: 50%; width: 8px; height: 8px; }
.qp-foot { display: flex; align-items: center; gap: var(--s-2); max-width: calc(100% - 256px); }
@media (max-width: 900px) {
  .qp-body { grid-template-columns: minmax(0, 1fr); }
  .qp-nav { position: static; order: 2; }
  .qnav { grid-template-columns: repeat(10, 1fr); }
  .qp-foot { max-width: none; position: sticky; bottom: 0; background: var(--paper); padding: var(--s-3) 0; }
  .qp-card { padding: var(--s-5); border-radius: var(--r-lg); }
  .stem { font-size: 1.12rem; }
}
@media (max-width: 720px) { .qp-top .seg { display: none; } .qp-foot { bottom: calc(68px + env(safe-area-inset-bottom)); } }

.results-hero { display: flex; align-items: center; gap: var(--s-8); padding: var(--s-8); background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-1); margin-bottom: var(--s-4); flex-wrap: wrap; }
.results-hero .ring > span { font-size: 1.6rem; }
.results-hero h1 { font-size: var(--fs-xl); }
.results-hero .lede { margin-top: 6px; }
.review { display: flex; flex-direction: column; gap: var(--s-2); }
.review details { border-radius: var(--r-md); border: 1px solid var(--line); }
.review summary { display: flex; align-items: center; gap: var(--s-3); padding: 12px 14px; cursor: pointer; list-style: none; }
.review summary::-webkit-details-marker { display: none; }
.rv-mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.rv-mark svg { width: 14px; height: 14px; stroke-width: 3; }
.review .ok .rv-mark { background: var(--good-soft); color: var(--good); }
.review .no .rv-mark { background: var(--rose-soft); color: var(--rose); }
.review .part .rv-mark { background: var(--amber-soft); color: color-mix(in srgb, var(--amber) 70%, var(--ink)); }
.rv-stem { display: block; font-weight: 600; font-size: var(--fs-sm); }
.rv-chev { width: 18px; height: 18px; color: var(--ink-3); transition: transform var(--t-med); flex: none; }
details[open] .rv-chev { transform: rotate(180deg); }
.rv-body { padding: 0 14px 14px 52px; font-size: var(--fs-sm); display: flex; flex-direction: column; gap: var(--s-3); }
.rv-body li { padding: 3px 0; color: var(--ink-2); }
.rv-body li.right { color: var(--good); font-weight: 600; }
.rv-body li.wrong { color: var(--rose); }
.rv-body li.wrong .rv-opt { text-decoration: line-through; }
/* A right select-all answer that wasn't picked: red, not struck through. */
.rv-body li.missed { color: var(--rose); font-weight: 600; }
.you-sel { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; text-decoration: none; vertical-align: 1px; }
/* Why each option is right or wrong (inline-block so a struck-through answer doesn't strike its reason). */
.opt-why { display: inline-block; width: 100%; margin-top: 4px; font-size: var(--fs-sm); font-weight: 400; line-height: 1.45; color: var(--ink-2); text-decoration: none; }
.rv-body .opt-why { margin: 2px 0 6px; font-size: var(--fs-xs); }
.rv-rat { line-height: 1.6; }

/* ---------- Flashcards ---------- */
.review-banner { display: flex; align-items: center; gap: var(--s-6); padding: var(--s-6); border-radius: var(--r-xl); background: var(--scrub); color: var(--scrub-ink); flex-wrap: wrap; }
.review-banner h2 { font-size: var(--fs-xl); }
.review-banner p { opacity: .85; margin-top: 4px; }
.rb-stack { position: relative; width: 72px; height: 60px; flex: none; }
.rb-stack span { position: absolute; inset: 0; border-radius: 12px; background: rgba(255,255,255,.18); }
.rb-stack span:nth-child(1) { transform: rotate(-10deg) translate(-6px, 2px); }
.rb-stack span:nth-child(2) { transform: rotate(6deg) translate(5px, 0); }
.rb-stack span:nth-child(3) { background: var(--surface); color: var(--scrub); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.rb-btn { --btn-bg: var(--surface); --btn-fg: var(--scrub); --btn-bd: transparent; margin-left: auto; }
.rb-btn:hover { background: var(--surface-2); }
.suggest { margin-top: var(--s-6); }
.suggest-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); margin-top: var(--s-3); }
.suggest-card { display: flex; align-items: center; gap: var(--s-3); padding: 14px 16px; border-radius: var(--r-md); border: 1.5px dashed var(--line-strong); text-align: left; transition: border-color var(--t-fast), background var(--t-fast); }
.suggest-card:hover { border-color: var(--scrub); background: var(--surface); }
.suggest-card .grow span { display: block; }
.suggest-card > svg { width: 18px; height: 18px; color: var(--scrub); }
@media (max-width: 760px) { .suggest-row { grid-template-columns: minmax(0, 1fr); } }

.decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); grid-auto-rows: 1fr; gap: var(--s-5) var(--s-4); }
.deck { position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 4px; padding: var(--s-5); border-radius: var(--r-lg); box-shadow: var(--shadow-1); transition: transform var(--t-med) var(--ease-out), box-shadow var(--t-med); margin-top: 8px; }
/* The card's face is its own layer, so the colored strip always sits behind it (hovered or not). */
.deck::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--surface); }
.deck-stack { position: absolute; left: 14px; right: 14px; top: -8px; height: 20px; border-radius: var(--r-lg) var(--r-lg) 0 0; background: color-mix(in srgb, var(--c) 25%, var(--surface)); z-index: -1; }
/* The strip lifts a little on hover and drops straight back when the pointer leaves. */
.deck:hover .deck-stack { transform: translateY(-4px); transition: transform var(--t-med) var(--ease-out); }
.deck:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.deck-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; min-height: 28px; }
.deck-ai { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--scrub-soft); color: var(--scrub); flex: none; }
.deck-ai svg { width: 15px; height: 15px; }
.deck-ai { position: relative; }
.deck-ai::after { content: attr(data-tip); position: absolute; right: 0; bottom: calc(100% + 8px); padding: 6px 10px; border-radius: var(--r-sm); background: var(--ink); color: var(--paper); font: 600 var(--fs-xs)/1.2 var(--font-body); white-space: nowrap; pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity 150ms ease, transform 150ms var(--ease-out); z-index: 5; }
.deck-ai:hover::after { opacity: 1; transform: none; }
.deck h3 { font-size: 1.1rem; }
.deck-foot { display: flex; align-items: center; gap: var(--s-3); margin-top: auto; padding-top: var(--s-4); border-top: 1px solid var(--line); }
/* Keeps the score row at the bottom of every card, lined up across the row. */
.deck > .xs.faint { margin-bottom: var(--s-4); }
.deck-foot .ring > span { font-size: 10px; }

.deck-stats { display: flex; align-items: center; gap: var(--s-8); flex-wrap: wrap; padding: var(--s-5) var(--s-6); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); margin-bottom: var(--s-4); }
.deck-stats > div:not(.deck-meter) { display: flex; flex-direction: column; }
.deck-stats b { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; }
.deck-stats span { font-size: var(--fs-xs); color: var(--ink-3); }
.deck-meter { flex: 1; min-width: 160px; display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; }
.add-card { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: var(--s-2); margin-bottom: var(--s-4); }
@media (max-width: 640px) { .add-card { grid-template-columns: minmax(0, 1fr); } }
.card-list { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.card-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) auto; gap: var(--s-5); padding: var(--s-4) var(--s-5); align-items: center; }
.card-row + .card-row { border-top: 1px solid var(--line); }
.cr-front { font-weight: 700; }
.due-now { margin-bottom: var(--s-6); }
.due-now .panel-head { margin-bottom: var(--s-3); }
.all-cards-h { font-size: var(--fs-lg, 1.15rem); margin: 0 0 var(--s-3); }
.cr-back { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.55; }
.cr-meta { display: flex; align-items: center; gap: var(--s-2); justify-content: flex-end; }
@media (max-width: 720px) { .card-row { grid-template-columns: minmax(0, 1fr); gap: 6px; } .cr-meta { justify-content: flex-start; } }

/* Study session */
.fs { display: flex; flex-direction: column; gap: var(--s-6); max-width: 760px; margin: 0 auto; }
.fs-top { display: flex; align-items: center; gap: var(--s-3); }
.flip-wrap { position: relative; perspective: 1600px; }
.flip { position: relative; display: block; width: 100%; min-height: 340px; transform-style: preserve-3d; transition: transform 560ms var(--ease-out); cursor: pointer; }
.flip.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-4); padding: var(--s-10) var(--s-8); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-2); backface-visibility: hidden; -webkit-backface-visibility: hidden; text-align: center; }
.face.back { transform: rotateY(180deg); background: var(--surface); border-top: 5px solid var(--scrub); }
.face-label { position: absolute; top: var(--s-5); left: var(--s-6); }
.face-hint { position: absolute; bottom: var(--s-5); }
.face-text { font-size: 1.45rem; line-height: 1.45; font-weight: 700; max-width: 34ch; }
.back .face-text { font-size: 1.15rem; font-weight: 400; line-height: 1.65; max-width: 48ch; }
.star-btn { position: absolute; top: 12px; right: 12px; z-index: 2; }
.rate { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); opacity: 0; transform: translateY(8px); transition: opacity var(--t-med), transform var(--t-med) var(--ease-out); pointer-events: none; }
.rate.show { opacity: 1; transform: none; pointer-events: auto; }
.rate-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); width: 100%; }
.rate-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface); transition: all var(--t-fast); }
.rate-btn span { font-size: var(--fs-xs); color: var(--ink-3); }
.rate-btn kbd { position: absolute; top: 6px; right: 8px; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
.rate-btn:active { transform: scale(.96); }
.rate-again b { color: var(--rose); } .rate-again:hover { border-color: var(--rose); background: var(--rose-soft); }
.rate-hard b { color: var(--amber); } .rate-hard:hover { border-color: var(--amber); background: var(--amber-soft); }
.rate-good b { color: var(--scrub); } .rate-good:hover { border-color: var(--scrub); background: var(--scrub-soft); }
.rate-easy b { color: var(--sky); } .rate-easy:hover { border-color: var(--sky); background: var(--sky-soft); }
.browse-nav { display: flex; justify-content: space-between; }
/* Review: back / ahead arrows on either side of Correct and Incorrect */
.rate-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: var(--s-3); }
.rate-nav { width: 48px; height: 48px; border: 1.5px solid var(--line); background: var(--surface); }
.rate-nav:disabled { opacity: .4; cursor: default; }
.rate-nav-gap { border: 0; background: none; pointer-events: none; } /* keeps the layout when skipping is off (guided plan) */
.rate-btns.rate-2 { grid-template-columns: repeat(2, 1fr); }
.rate-2 .rate-btn { padding: 14px 8px; }
.rate-2 .rate-btn b { font-size: var(--fs-md); }
.tally.tally-2 { grid-template-columns: repeat(2, 1fr); }
.tally.tally-3 { grid-template-columns: repeat(3, 1fr); }
.tally-skip b { color: var(--ink-3); }
@media (max-width: 720px) { .flip { min-height: 300px; } .face { padding: var(--s-8) var(--s-5); } .face-text { font-size: 1.2rem; } .rate-btn kbd { display: none; } }
.fs-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-4); padding: var(--s-12) 0; max-width: 560px; margin: 0 auto; }
.done-badge { width: 72px; height: 72px; border-radius: 24px; background: var(--good-soft); color: var(--good); display: grid; place-items: center; animation: pop-in 400ms var(--ease-out); }
.done-badge svg { width: 34px; height: 34px; stroke-width: 2.6; }
/* Flashcard session grade */
.fs-grade { animation: pop-in 500ms var(--ease-out); }
.fs-grade .ring > span b { font: 700 1.9rem/1 var(--font-display); color: var(--ink); }
.eyebrow-grade { font: 600 var(--fs-xs)/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; margin-top: calc(-1 * var(--s-2)); }
.tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); width: 100%; }
.tally div { padding: var(--s-3); border-radius: var(--r-md); background: var(--surface); display: flex; flex-direction: column; }
.tally b { font-family: var(--font-display); font-size: 1.6rem; }
.tally span { font-size: var(--fs-xs); color: var(--ink-3); }
.tally-again b { color: var(--rose); } .tally-hard b { color: var(--amber); } .tally-good b { color: var(--scrub); } .tally-easy b { color: var(--sky); }

/* ---------- Study guides ---------- */
.guide-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s-4); }
.guide-book { position: relative; display: flex; border-radius: 6px var(--r-lg) var(--r-lg) 6px; background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; min-height: 200px; text-align: left; transition: box-shadow var(--t-med), transform var(--t-med) var(--ease-out); }
.guide-book:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.book-spine { width: 12px; flex: none; background: var(--c); }
.book-body { display: flex; flex-direction: column; gap: 6px; padding: var(--s-5); flex: 1; }
.book-body h3 { font-size: 1.15rem; }
.book-foot { margin-top: auto; padding-top: var(--s-3); }
.guide-book.feature { grid-column: span 2; }
.book-toc { display: grid; grid-template-columns: 1fr 1fr; gap: 6px var(--s-4); margin: var(--s-3) 0; font-size: var(--fs-sm); color: var(--ink-2); }
.book-toc li { display: flex; align-items: center; gap: 8px; }
.book-toc svg { width: 15px; height: 15px; color: var(--c); }
/* Dashed "create new" tile at the end of a list (guides, decks, mind maps, cases) */
.new-tile { display: flex; min-height: 160px; padding: var(--s-5); text-align: center; transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease; }
.new-tile:hover { border-color: var(--scrub); background: var(--scrub-soft); }
.deck-new { margin-top: 8px; }
.new-tile:disabled { opacity: .55; cursor: not-allowed; }
.new-tile:disabled:hover { border-color: var(--line-strong); background: transparent; }
.guide-new, .new-tile { flex-direction: column; align-items: center; justify-content: center; gap: 6px; box-shadow: none; border: 1.5px dashed var(--line-strong); background: transparent; border-radius: var(--r-lg); }
.guide-new > span:first-child, .new-tile > span:first-child { width: 44px; height: 44px; border-radius: 14px; background: var(--scrub-soft); color: var(--scrub); display: grid; place-items: center; }
.guide-new svg, .new-tile svg { width: 20px; height: 20px; }
@media (max-width: 560px) { .guide-book.feature { grid-column: auto; } .book-toc { grid-template-columns: minmax(0, 1fr); } }

.reader { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: var(--s-10); align-items: start; }
.toc { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: var(--s-2); padding-top: var(--s-12); }
.toc ol { display: flex; flex-direction: column; gap: 1px; border-left: 2px solid var(--line); }
.toc a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-left: -2px; border-left: 2px solid transparent; font-size: var(--fs-sm); color: var(--ink-3); transition: color var(--t-fast), border-color var(--t-fast); }
.toc a svg { width: 15px; height: 15px; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--scrub); border-left-color: var(--scrub); font-weight: 600; }
.guide { max-width: 760px; }
.guide-actions { padding-bottom: var(--s-4); border-bottom: 1px solid var(--line); margin-bottom: var(--s-2); }
.g-section { padding: var(--s-6) 0; border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--topbar-h) + 16px); transition: background var(--t-med); border-radius: var(--r-md); }
.g-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.g-head h2 { flex: 1; font-size: 1.3rem; }
.g-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--scrub-soft); color: var(--scrub); display: grid; place-items: center; flex: none; }
.g-icon svg { width: 17px; height: 17px; }
.g-tools { display: flex; gap: 2px; opacity: 0; transition: opacity var(--t-fast); }
.g-section:hover .g-tools, .g-section:focus-within .g-tools { opacity: 1; }
@media (hover: none) { .g-tools { opacity: 1; } }
.g-pick { display: none; }
.g-pick input { width: 18px; height: 18px; accent-color: var(--scrub); }
.selecting .g-pick { display: flex; }
.selecting .g-section { cursor: default; padding-left: var(--s-3); padding-right: var(--s-3); }
.selecting .g-section.picked { background: color-mix(in srgb, var(--scrub-soft) 55%, transparent); }
.g-content { display: flex; flex-direction: column; gap: var(--s-3); padding-left: 46px; font-size: 1.04rem; line-height: 1.7; }
.g-list { display: flex; flex-direction: column; gap: 6px; }
.g-list li { position: relative; padding-left: 20px; }
.g-list li::before { content: ""; position: absolute; left: 3px; top: .7em; width: 7px; height: 7px; border-radius: 2px; background: var(--scrub); opacity: .6; }
.g-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.g-flow li { padding: 8px 12px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-1); font-size: var(--fs-sm); font-weight: 600; }
.g-flow li + li::before { content: "→"; margin-right: 8px; color: var(--ink-3); font-weight: 400; }
.g-table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.g-table { font-size: var(--fs-sm); }
.g-table th, .g-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); line-height: 1.5; }
.g-table thead th { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; background: var(--surface-2); }
.g-table tbody tr:last-child > * { border-bottom: 0; }
.g-table tbody th { font-weight: 700; white-space: nowrap; }
.g-callout { display: flex; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-md); }
.g-callout svg { width: 20px; height: 20px; flex: none; margin-top: 3px; }
.g-callout p { font-size: .98rem; }
.g-bad { background: var(--rose-soft); } .g-bad svg { color: var(--rose); }
.g-scrub { background: var(--scrub-soft); } .g-scrub svg { color: var(--scrub); }
.sel-pop { position: absolute; z-index: 50; display: flex; gap: 2px; padding: 4px; background: var(--ink); border-radius: 12px; box-shadow: var(--shadow-pop); }
.sel-pop[hidden] { display: none; }
.sel-pop button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; color: var(--paper); font-size: var(--fs-sm); font-weight: 600; }
.sel-pop button:hover { background: rgba(255,255,255,.12); }
.sel-pop svg { width: 15px; height: 15px; }
@media (max-width: 960px) { .reader { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } .g-content { padding-left: 0; } }

/* ---------- Mind maps ---------- */
.maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); grid-auto-rows: 1fr; gap: var(--s-4); }
.map-card { border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; transition: box-shadow var(--t-med), transform var(--t-med) var(--ease-out); }
.map-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.map-thumb { height: 150px; background: var(--surface-2); background-image: radial-gradient(var(--line-strong) 1px, transparent 1px); background-size: 16px 16px; display: grid; place-items: center; }
.map-thumb svg { width: 80%; height: 80%; }
.map-info { padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: 4px; }
.mm { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s-4); height: calc(100dvh - 230px); min-height: 520px; }
.mm-canvas { position: relative; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; background-image: radial-gradient(var(--line) 1.2px, transparent 1.2px); background-size: 22px 22px; }
.mm-canvas svg { width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; }
.mm-canvas svg:active { cursor: grabbing; }
.mm-edge { fill: none; stroke-opacity: .55; }
.mm-cross { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 5 5; }
.mm-cross-label rect { fill: var(--surface); stroke: var(--line-strong); }
.mm-cross-label text { font-size: 11px; fill: var(--ink-2); font-family: var(--font-body); }
.mm-node { cursor: pointer; }
.mm-node rect { fill: var(--surface); stroke: var(--nc); stroke-width: 2; transition: fill var(--t-fast); }
.mm-node text { font-family: var(--font-body); font-size: 13px; fill: var(--ink); font-weight: 500; pointer-events: none; }
.mm-node.d0 rect { fill: var(--ink); stroke: var(--ink); }
.mm-node.d0 text { fill: var(--paper); font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.mm-node.d1 rect { fill: color-mix(in srgb, var(--nc) 14%, var(--surface)); }
.mm-node.d1 text { font-weight: 700; font-size: 14px; }
.mm-node:hover rect { fill: color-mix(in srgb, var(--nc) 22%, var(--surface)); }
.mm-node.d0:hover rect { fill: var(--ink); }
.mm-node.sel rect { stroke-width: 3.5; filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--nc) 40%, transparent)); }
.mm-node:focus-visible rect { stroke: var(--scrub); stroke-width: 4; }
.mm-node:focus { outline: none; }
.mm-toggle circle { fill: var(--nc); }
.mm-toggle text { fill: white; font-size: 11px; font-weight: 700; }
.mm-tools { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 2px; padding: 4px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-2); }
.mm-sep { width: 1px; background: var(--line); margin: 6px 4px; }
.mm-side { overflow-y: auto; }
.mm-side h2 { margin-top: 4px; }
.mm-rels { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-2); }
.mm-rels li { display: flex; gap: 8px; font-size: var(--fs-sm); color: var(--ink-2); }
.mm-rels svg { width: 15px; height: 15px; color: var(--ink-3); flex: none; margin-top: 3px; }
@media (max-width: 900px) { .mm { grid-template-columns: minmax(0, 1fr); height: auto; } .mm-canvas { height: 62dvh; min-height: 420px; } }

/* ---------- Case studies ---------- */
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); grid-auto-rows: 1fr; gap: var(--s-4); }
.case-card { border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; transition: box-shadow var(--t-med), transform var(--t-med) var(--ease-out); }
.case-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.case-card.locked .case-chart { filter: grayscale(.6); opacity: .7; }
.case-chart { padding: var(--s-5); background: var(--sky-soft); display: flex; flex-direction: column; gap: 8px; }
.cc-name { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); }
.cc-line { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--sky) 25%, transparent); width: 85%; }
.cc-line.short { width: 55%; }
.cc-vitals { display: flex; align-items: center; gap: 8px; color: var(--rose); margin-top: 4px; }
.cc-vitals svg { width: 16px; height: 16px; }
.cc-vitals i { flex: 1; height: 16px; background: linear-gradient(90deg, transparent 0 20%, var(--rose) 20% 22%, transparent 22% 48%, var(--rose) 48% 50%, transparent 50% 76%, var(--rose) 76% 78%, transparent 78%); opacity: .4; }
.case-info { padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: 4px; }

.cp { display: flex; flex-direction: column; gap: var(--s-4); }
.cp > .back-btn { align-self: flex-start; margin: 0 0 calc(var(--s-2) * -1); }
.patient-band { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); flex-wrap: wrap; }
.patient-band .grow b { display: block; font-family: var(--font-display); font-size: 1.1rem; }
.pb-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--sky-soft); color: var(--sky); display: grid; place-items: center; }
.pb-avatar svg { width: 20px; height: 20px; }
.pb-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.phases { display: flex; gap: var(--s-2); overflow-x: auto; }
.phases li { flex: 1; min-width: 150px; }
.phases button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink-3); font-weight: 600; font-size: var(--fs-sm); text-align: left; }
.phases button span { font-family: var(--font-mono); font-size: var(--fs-xs); }
.phases .past button { background: var(--surface); color: var(--ink-2); }
.phases .now button { background: var(--ink); color: var(--paper); }
.phases button[disabled] { cursor: not-allowed; }
.cp-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.cp-chart { position: sticky; top: calc(var(--topbar-h) + 12px); padding-top: var(--s-3); }
.cp-tab { padding-top: var(--s-4); }
.notes { display: flex; flex-direction: column; gap: var(--s-4); }
.notes li { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.notes p { line-height: 1.65; }
.orders { display: flex; flex-direction: column; gap: var(--s-2); }
.orders li { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-sm); }
.flag-high, .flag-low { color: var(--rose); font-weight: 700; }
.flag-high svg, .flag-low svg { width: 13px; height: 13px; display: inline; vertical-align: -2px; }
.vitals-table td { white-space: nowrap; }
.ngn-item { display: flex; flex-direction: column; gap: var(--s-3); align-items: flex-start; }
.ngn-item + .ngn-item { border-top: 1px solid var(--line); padding-top: var(--s-6); margin-top: var(--s-6); }
.ngn-item h3 { font-family: var(--font-body); font-weight: 700; line-height: 1.45; }
.ngn-item .options, .ngn-item .rationale, .ngn-item .g-table-wrap { width: 100%; }
/* ATI-style rationale: correct answer, why, why the others are wrong, and a tip */
.rationale .rat-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rat-list li { display: flex; gap: 10px; align-items: flex-start; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); font-size: .92rem; line-height: 1.5; }
.rat-list .rat-mark { flex: none; margin-top: 1px; color: var(--ink-3); }
.rat-list .rat-mark svg { width: 17px; height: 17px; }
.rat-list li.right .rat-mark { color: var(--good); } .rat-list li.wrong .rat-mark { color: var(--rose); } .rat-list li.missed .rat-mark { color: var(--rose); }
.rationale .rat-list li b { display: block; font-weight: 600; color: var(--ink); }
.rat-list .rat-why { display: block; margin-top: 2px; color: var(--ink-2); }
.cue-text { line-height: 2; font-size: 1.02rem; }
.cue { display: inline; padding: 2px 4px; margin: 0 -2px; border-radius: 5px; background: var(--surface-2); box-decoration-break: clone; -webkit-box-decoration-break: clone; text-align: left; transition: background var(--t-fast); border-bottom: 2px dotted var(--line-strong); }
.cue:hover:not([disabled]):not(.on):not(.right):not(.wrong):not(.missed) { background: var(--surface-3); }
.cue.on { background: #FCE8A6; border-bottom-color: var(--amber); color: #3b2e00; }
.cue.right { background: var(--good-soft); border-bottom: 2px solid var(--good); }
.cue.wrong { background: var(--rose-soft); border-bottom: 2px solid var(--rose); text-decoration: line-through; }
.cue.missed { background: var(--rose-soft); border-bottom: 2px solid var(--rose); text-decoration: none; }
.cloze { line-height: 2.6; font-size: 1.02rem; }
.cloze-sel { display: inline-block; width: auto; max-width: 100%; height: 36px; margin: 0 4px; font-weight: 600; }
.cloze-sel.right { border-color: var(--good); background-color: var(--good-soft); }
.cloze-sel.wrong { border-color: var(--rose); background-color: var(--rose-soft); }
.matrix { font-size: var(--fs-sm); }
.matrix th, .matrix td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.matrix td { text-align: center; width: 100px; }
.matrix thead th { font-size: var(--fs-xs); color: var(--ink-3); background: var(--surface-2); }
.matrix thead th:not(:first-child) { text-align: center; }
.matrix tbody th { font-weight: 500; }
.matrix input { accent-color: var(--scrub); width: 18px; height: 18px; }
.matrix tr.right { background: var(--good-soft); } .matrix tr.wrong { background: var(--rose-soft); }
.case-end { margin-top: var(--s-6); padding: var(--s-5); border-radius: var(--r-md); background: var(--scrub-soft); }
@media (max-width: 960px) { .cp-body { grid-template-columns: minmax(0, 1fr); } .cp-chart { position: static; } }

/* ---------- Adaptive ---------- */
.adapt-hero { display: flex; align-items: center; gap: var(--s-8); padding: var(--s-8); border-radius: var(--r-xl); background: var(--monitor); color: var(--monitor-ink); margin-bottom: var(--s-4); flex-wrap: wrap; position: relative; overflow: hidden; isolation: isolate; }
.adapt-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(var(--monitor-grid) 1px, transparent 1px), linear-gradient(90deg, var(--monitor-grid) 1px, transparent 1px); background-size: 22px 22px; }
.ah-left { flex: 1; min-width: 260px; }
.ah-kicker { color: var(--trace); display: inline-flex; align-items: center; gap: 6px; }
.adapt-hero h2 { font-size: var(--fs-2xl); margin: 6px 0 10px; letter-spacing: -0.03em; }
.adapt-hero p { color: var(--monitor-ink-2); max-width: 58ch; line-height: 1.6; }
.ah-signals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-4); }
.ah-signals span { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); padding: 4px 10px; border-radius: var(--r-pill); border: 1px solid rgba(124,240,197,.2); color: var(--monitor-ink-2); }
.ah-signals svg { width: 13px; height: 13px; color: var(--trace); }
.ah-ring { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--monitor-ink-2); }
.ah-ring .ring-track { stroke: rgba(124,240,197,.12); }
.ah-ring .ring > span { color: var(--monitor-ink); font-family: var(--font-mono); font-size: 2rem; font-weight: 600; }
.ah-ring .ring > span small { font-size: .9rem; color: var(--monitor-ink-2); }
.session { display: flex; flex-direction: column; }
.session li { position: relative; display: flex; align-items: center; gap: var(--s-3); padding: 12px 0; }
.sess-line { position: absolute; left: 19px; top: 0; bottom: 0; width: 2px; background: var(--line); z-index: 0; }
.session li:first-child .sess-line { top: 50%; } .session li:last-child .sess-line { bottom: 50%; }
.sess-icon { position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); color: var(--ink-2); flex: none; }
.sess-icon svg { width: 17px; height: 17px; }
.session li.now .sess-icon { background: var(--scrub); border-color: var(--scrub); color: var(--scrub-ink); box-shadow: 0 0 0 5px var(--scrub-soft); }
.session .grow b, .session .grow span { display: block; }
.variants { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-4); }
.variants li { display: flex; align-items: center; gap: var(--s-3); padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); }
.variants .grow b, .variants .grow span { display: block; }
.v-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); flex: none; }
.v-missed .v-dot { background: var(--rose); } .v-next .v-dot { background: var(--scrub); box-shadow: 0 0 0 4px var(--scrub-soft); }
.mastery-table { display: flex; flex-direction: column; }
.mt-row { display: grid; grid-template-columns: minmax(150px, 1.3fr) minmax(140px, 2fr) 60px 80px 90px; gap: var(--s-4); align-items: center; padding: 10px 0; }
.mt-row + .mt-row { border-top: 1px solid var(--line); }
.mt-headrow { padding-top: 0; }
.mt-name { display: flex; align-items: center; gap: 8px; }
.mt-bar { display: flex; align-items: center; gap: var(--s-3); }
.mt-bar .bar { flex: 1; }
.mt-bar span { width: 36px; text-align: right; }
@media (max-width: 720px) { .mt-row { grid-template-columns: 1fr 1fr auto; } .mt-row > :nth-child(3), .mt-row > :nth-child(4) { display: none; } }

/* ---------- Planner ---------- */
.canvas-connect { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); background: var(--surface); border: 1.5px dashed var(--line-strong); margin-bottom: var(--s-4); flex-wrap: wrap; }
.cv-logo { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--rose-soft); color: var(--rose); flex: none; }
.cv-logo svg { width: 28px; height: 28px; }
.canvas-connect .grow { min-width: 220px; }
.planner { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s-4); align-items: start; }
.planner-side { display: flex; flex-direction: column; gap: var(--s-4); }
.planner-bar { margin-bottom: var(--s-3); }
@media (max-width: 1100px) { .planner { grid-template-columns: minmax(0, 1fr); } .planner-side { display: grid; grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .planner-side { grid-template-columns: minmax(0, 1fr); } }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-bottom: var(--s-4); color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.lg-exam i { background: var(--rose); } .lg-quiz i { background: var(--amber); } .lg-assignment i { background: var(--due); } .lg-clinical i { background: var(--sky); }
.lg-lecture i { background: var(--ink-3); } .lg-study i { background: var(--scrub); } .lg-review i { background: var(--c-psych); }
.week { overflow-x: auto; }
.week > * { min-width: 680px; }
.week-head, .week-due { display: grid; grid-template-columns: 44px repeat(7, 1fr); gap: 4px; }
.week-head span { display: flex; flex-direction: column; align-items: center; padding-bottom: 6px; color: var(--ink-3); }
.week-head b { font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; }
.week-head .today b { background: var(--scrub); color: var(--scrub-ink); }
.week-due { padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); align-items: start; }
.week-due > span { padding-top: 5px; }
.week-due > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.week-grid { position: relative; display: grid; grid-template-columns: 44px repeat(7, 1fr); gap: 4px; height: calc(var(--rows) * 44px); margin-top: 4px; }
.hours { display: flex; flex-direction: column; }
.hours span { height: 44px; font-size: 11px; color: var(--ink-3); text-align: right; padding-right: 6px; transform: translateY(-7px); }
.day-col { position: relative; background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 44px; border-radius: 8px; }
.day-col.today { background-color: color-mix(in srgb, var(--scrub-soft) 35%, transparent); }
.ev { position: absolute; left: 2px; right: 2px; padding: 4px 7px; border-radius: 7px; font-size: 11.5px; line-height: 1.3; overflow: hidden; border-left: 3px solid var(--evc); background: color-mix(in srgb, var(--evc) 14%, var(--surface)); color: var(--ink); z-index: 1; }
.week-due .ev { position: relative; left: 0; right: 0; }
.ev b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { color: var(--ink-2); font-size: 11px; }
.ev-ai { position: absolute; top: 4px; right: 4px; color: var(--evc); }
.ev-ai svg { width: 11px; height: 11px; }
.ev-exam { --evc: var(--rose); } .ev-quiz { --evc: var(--amber); } .ev-assignment { --evc: var(--due); } .ev-clinical { --evc: var(--sky); }
.ev-lecture { --evc: var(--ink-3); } .ev-study { --evc: var(--scrub); } .ev-review { --evc: var(--c-psych); }
.ev-study { border-left-style: dashed; }
.agenda { display: flex; flex-direction: column; gap: var(--s-5); }
.ag-day h3 { font-size: var(--fs-md); margin-bottom: var(--s-2); }
.ag-day ul { display: flex; flex-direction: column; gap: 4px; }
.ag-item { display: flex; align-items: center; gap: var(--s-3); padding: 10px 12px; border-radius: var(--r-md); background: color-mix(in srgb, var(--evc) 8%, var(--surface)); border-left: 3px solid var(--evc); }
.ag-item .grow b, .ag-item .grow span { display: block; }
.ag-time { width: 86px; flex: none; font-size: var(--fs-xs); color: var(--ink-2); font-weight: 600; }
.ag-icon { color: var(--evc); } .ag-icon svg { width: 17px; height: 17px; }
@media (max-width: 560px) { .ag-time { width: 64px; } }
.suggest-blocks { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-3); }
.suggest-blocks li { display: flex; flex-direction: column; padding: 10px 12px; border-radius: var(--r-md); border: 1.5px dashed color-mix(in srgb, var(--scrub) 40%, var(--line)); }
.suggest-blocks b { font-size: var(--fs-sm); }
.week-sum { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.week-sum div { display: flex; flex-direction: column; padding: var(--s-3); border-radius: var(--r-md); background: var(--surface-2); }
.week-sum b { font-family: var(--font-display); font-size: 1.5rem; }
.week-sum span { font-size: var(--fs-xs); color: var(--ink-3); }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.set-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 12px); }
.set-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; }
.set-nav a svg { width: 18px; height: 18px; }
.set-nav a:hover { background: var(--surface-2); color: var(--ink); }
.set-nav a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.set-nav a.on svg { color: var(--scrub); }
.set-pane { min-height: 420px; }
@media (max-width: 800px) { .settings { grid-template-columns: minmax(0, 1fr); } .set-nav { position: static; flex-direction: row; overflow-x: auto; } .set-nav a { white-space: nowrap; } }
.profile-card { display: flex; align-items: center; gap: var(--s-4); }
.avatar-lg { width: 72px; height: 72px; font-size: 1.5rem; }
.usage { display: flex; flex-direction: column; gap: 8px; padding: var(--s-4); border-radius: var(--r-md); background: var(--surface-2); margin-bottom: var(--s-5); }
.tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
@media (max-width: 960px) { .tiers { grid-template-columns: minmax(0, 1fr); } }
.tier { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5); border-radius: var(--r-lg); border: 1.5px solid var(--line); }
.tier.current { border-color: var(--scrub); }
.tier-pro { background: color-mix(in srgb, var(--pro-soft) 50%, var(--surface)); }
.tier-price b { font-family: var(--font-display); font-size: 1.6rem; }
.tier-list { display: flex; flex-direction: column; gap: 8px; margin: var(--s-2) 0 var(--s-4); font-size: var(--fs-sm); flex: 1; }
.tier-list li { display: flex; align-items: center; gap: 8px; }
.tier-list svg { width: 15px; height: 15px; color: var(--scrub); flex: none; }
.tier-pro .tier-list svg { color: var(--pro); }
.set-rows { display: flex; flex-direction: column; }
.set-row { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) 0; cursor: pointer; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row .grow b, .set-row .grow span { display: block; }
.int-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.int-icon svg { width: 19px; height: 19px; }
.theme-pick { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.theme-opt { display: flex; flex-direction: column; gap: var(--s-2); padding: 8px 8px 12px; border-radius: var(--r-lg); border: 2px solid var(--line); font-weight: 600; font-size: var(--fs-sm); }
.theme-opt .hstack svg { width: 16px; height: 16px; }
.theme-opt.on { border-color: var(--scrub); }
.theme-prev { width: 180px; height: 110px; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.theme-prev i { height: 12px; border-radius: 4px; display: block; }
.theme-prev-light { background: #F2F4F1; } .theme-prev-light i { background: #fff; } .theme-prev-light i:first-child { background: #1E6B61; width: 40%; }
.theme-prev-system { background: linear-gradient(135deg, #F2F4F1 50%, #0D1918 50%); } .theme-prev-system i { background: #8a9a96; opacity: .5; } .theme-prev-system i:first-child { background: #1E6B61; width: 40%; opacity: 1; }
.theme-prev-dark { background: #0D1918; } .theme-prev-dark i { background: #1A2D2A; } .theme-prev-dark i:first-child { background: #5CBFAA; width: 40%; }

/* ---------- Podcasts ---------- */
.pod-cover { position: relative; display: grid; place-items: center; flex: none; overflow: hidden; background: color-mix(in srgb, var(--c) 18%, var(--monitor)); color: var(--monitor-ink); }
.pod-cover-sm { width: 44px; height: 44px; border-radius: 12px; }
.pod-cover-md { width: 76px; height: 76px; border-radius: 18px; }
.pod-cover-lg { width: 200px; height: 200px; border-radius: var(--r-xl); }
.pc-wave { position: absolute; inset: 22% 14%; display: flex; align-items: center; gap: 6%; }
.pc-wave i { flex: 1; border-radius: 99px; background: color-mix(in srgb, var(--c) 70%, white); opacity: .55; }
.pc-format { position: absolute; right: 8%; bottom: 8%; height: 30%; max-height: 56px; min-height: 18px; aspect-ratio: 1; border-radius: 30%; display: grid; place-items: center; background: var(--surface); color: var(--c); }
.pc-format svg { width: 60%; height: 60%; }
.pod-cover-sm .pc-format { display: none; }

.pod-list { display: flex; flex-direction: column; gap: var(--s-3); }
.pod-row { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-3) var(--s-5) var(--s-3) var(--s-3); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); transition: box-shadow var(--t-med), transform var(--t-med) var(--ease-out); }
.pod-new { flex-direction: row; justify-content: flex-start; min-height: 0; padding: var(--s-3) var(--s-5) var(--s-3) var(--s-3); gap: var(--s-4); text-align: left; }
.pod-new > span:first-child { width: 76px; height: 76px; border-radius: 18px; }
@media (max-width: 760px) { .pod-new > span:first-child { width: 60px; height: 60px; } }
.pod-new-text { display: flex; flex-direction: column; gap: 2px; }
.pod-row:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.pod-row.current { box-shadow: 0 0 0 2px var(--scrub), var(--shadow-1); }
.pod-row-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-4); }
.pod-row-link .grow { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pod-title { font-family: var(--font-display); font-size: 1.15rem; }
.mp-play, .pp-play { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--scrub); color: var(--scrub-ink); transition: transform var(--t-fast), background var(--t-fast); }
.mp-play:hover, .pp-play:hover { background: var(--scrub-strong); }
.mp-play:active, .pp-play:active { transform: scale(.93); }
.mp-play svg, .pp-play svg { width: 20px; height: 20px; fill: currentColor; }
.pod-formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); margin-top: var(--s-3); }
.pod-format { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: var(--s-5); border-radius: var(--r-lg); border: 1.5px dashed var(--line-strong); text-align: left; transition: border-color var(--t-fast), background var(--t-fast); }
.pod-format:hover { border-color: var(--scrub); background: var(--surface); }
.pod-format > svg { width: 22px; height: 22px; color: var(--scrub); margin-bottom: 6px; }
@media (max-width: 760px) { .pod-formats { grid-template-columns: minmax(0, 1fr); } .pod-cover-md { width: 60px; height: 60px; } .pod-row .xs.faint { display: none; } }

/* Episode player */
.pod-player { display: flex; align-items: center; gap: var(--s-8); padding: var(--s-6); background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-1); margin-bottom: var(--s-4); }
.pp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.pp-now { display: flex; flex-direction: column; gap: 2px; }
.pp-now b { font-family: var(--font-display); font-size: 1.25rem; }
.pp-scrub { display: flex; gap: 2px; height: 34px; align-items: center; cursor: pointer; border-radius: 6px; }
.pp-seg { height: 100%; display: flex; align-items: center; min-width: 3px; }
.pp-seg i { display: block; width: 100%; height: 8px; border-radius: 2px; background: var(--surface-3); position: relative; overflow: hidden; transition: height var(--t-fast); }
.pp-seg.pp-s1 i { background: color-mix(in srgb, var(--surface-3) 70%, var(--sky) 15%); }
.pp-seg.chapter-start { margin-left: 5px; }
.pp-seg:hover i { height: 14px; }
.pp-seg.done i { background: var(--scrub); }
.pp-seg.now i { height: 14px; background: var(--surface-3); }
.pp-seg.now i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--scrub); transition: width 200ms linear; }
.pp-controls { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.pp-play { width: 56px; height: 56px; }
.pp-play svg { width: 24px; height: 24px; }
.pp-rate { margin-left: auto; }
.pp-rate button { padding: 0 10px; font-family: var(--font-mono); font-size: var(--fs-xs); }
.pod-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s-4); align-items: start; }
.pod-transcript { max-height: 560px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.pt-chapter { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); color: var(--ink-3); padding: var(--s-4) 10px 4px; }
.pt-line button { display: grid; grid-template-columns: 52px 1fr; gap: var(--s-3); width: 100%; text-align: left; padding: 10px; border-radius: var(--r-md); line-height: 1.6; transition: background var(--t-fast); }
.pt-line button:hover { background: var(--surface-2); }
.pt-line b { font-size: var(--fs-sm); color: var(--scrub); }
.pt-s1 b { color: var(--sky); }
.pt-line.now button { background: var(--scrub-soft); }
.pod-chapters { display: flex; flex-direction: column; gap: 2px; }
.pod-chapters button { display: flex; gap: var(--s-3); width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; font-size: var(--fs-sm); font-weight: 500; }
.pod-chapters button:hover { background: var(--surface-2); }
.pod-chapters button.on { background: var(--scrub-soft); color: var(--scrub); font-weight: 700; }
.pod-chapters .num { width: 36px; padding-top: 2px; }
@media (max-width: 960px) { .pod-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .pod-player { flex-direction: column; align-items: stretch; gap: var(--s-4); padding: var(--s-4); }
  .pod-cover-lg { width: 100%; height: 140px; border-radius: var(--r-lg); }
  .pp-controls { justify-content: center; }
  .pp-rate { margin: var(--s-2) auto 0; }
  .pt-line button { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* Mini-player (persists across pages) */
.mini-player {
  position: fixed; z-index: 45;
  left: calc(var(--sidebar-w) + 24px); right: 24px; bottom: 16px;
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: var(--s-3);
  padding: 8px 10px 8px 8px;
  background: var(--monitor); color: var(--monitor-ink);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: toast-in 300ms var(--ease-out);
}
.mini-player.settled { animation: none; }
.mp-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-3); }
.mp-info .grow b { display: block; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-info .grow span { display: block; color: var(--monitor-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-controls { display: flex; align-items: center; gap: 2px; }
.mini-player .icon-btn { color: var(--monitor-ink-2); }
.mini-player .icon-btn:hover { background: rgba(255,255,255,.08); color: var(--monitor-ink); }
.mini-player .mp-play { width: 38px; height: 38px; background: var(--trace); color: var(--monitor); }
.mini-player .mp-play svg { width: 17px; height: 17px; }
.mp-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(124,240,197,.15); }
.mp-progress i { display: block; height: 100%; width: 0; background: var(--trace); transition: width 200ms linear; }
:root[data-theme="dark"] .mini-player { border: 1px solid var(--trace-dim); }
body.has-player .app-footer { padding-bottom: calc(var(--s-6) + 80px); }
body.has-player .selbar { bottom: 96px; }
@media (max-width: 720px) {
  .mini-player { left: 8px; right: 8px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .mp-controls [data-mp="back"], .mp-controls [data-mp="fwd"] { display: none; }
  body.has-player .app-footer { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  body.has-player .selbar { bottom: calc(150px + env(safe-area-inset-bottom)); }
  body.focus-page .mini-player { bottom: calc(8px + env(safe-area-inset-bottom)); }
  body.focus-page.has-player .qp-foot { bottom: 72px; }
}

/* ---------- Ask Recall (study guides) ---------- */
.ask-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 38;
  display: inline-flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 18px 0 14px; border-radius: var(--r-pill);
  background: var(--scrub); color: var(--scrub-ink); font-weight: 700;
  box-shadow: 0 10px 28px -8px color-mix(in srgb, var(--scrub) 70%, transparent);
  transition: transform var(--t-med) var(--ease-out), opacity var(--t-med);
}
.ask-fab svg { width: 20px; height: 20px; }
.ask-fab:active { transform: scale(.96); }
body.ask-open .ask-fab { opacity: 0; pointer-events: none; transform: translateY(8px); }
body.has-player .ask-fab { bottom: 96px; }
.ask {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: 420px; max-width: 100%;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 360ms var(--ease-out), visibility 0s 360ms;
}
.ask.open { transform: none; visibility: visible; transition: transform 360ms var(--ease-out); }
.ask-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-4) var(--s-3) var(--s-5); border-bottom: 1px solid var(--line); }
.ask-head .grow b, .ask-head .grow span { display: block; }
.ask-head .grow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ask-mark { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--scrub-soft); color: var(--scrub); flex: none; }
.ask-mark svg { width: 18px; height: 18px; }
.ask-body { flex: 1; overflow-y: auto; padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.ask-empty { display: flex; flex-direction: column; gap: var(--s-4); }
.ask-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.ask-suggest .chip { height: auto; min-height: 32px; padding: 6px 12px; white-space: normal; text-align: left; border-radius: 16px; }
.msg { display: flex; flex-direction: column; gap: var(--s-2); animation: pop-in 220ms var(--ease-out); }
.msg-user { align-self: flex-end; align-items: flex-end; max-width: 88%; }
.msg-user p { background: var(--scrub); color: var(--scrub-ink); padding: 10px 14px; border-radius: 16px 16px 4px 16px; font-size: .95rem; }
.msg-ctx { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--ink-3); max-width: 100%; }
.msg-ctx svg { width: 12px; height: 12px; flex: none; }
.msg-ai { align-self: stretch; }
.msg-text { font-size: .95rem; line-height: 1.65; display: flex; flex-direction: column; gap: var(--s-2); }
.msg-text ul { display: flex; flex-direction: column; gap: 4px; }
.msg-text li { position: relative; padding-left: 18px; }
.msg-text li::before { content: ""; position: absolute; left: 3px; top: .68em; width: 6px; height: 6px; border-radius: 2px; background: var(--scrub); opacity: .6; }
.msg-text b { font-weight: 700; }
.not-found .msg-text { color: var(--ink-2); }
.caret { display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--scrub); border-radius: 1px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.msg-cites { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cite { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; background: var(--scrub-soft); color: var(--scrub); }
.cite svg { width: 11px; height: 11px; }
.cite:hover { background: color-mix(in srgb, var(--scrub-soft) 70%, var(--scrub) 15%); }
.msg-actions { display: flex; align-items: center; gap: 2px; margin-left: -10px; flex-wrap: wrap; }
.ask-form { padding: var(--s-3) var(--s-4) var(--s-4); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--s-2); }
.ask-ctx { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 6px 4px 10px; border-radius: var(--r-pill); background: var(--surface-2); font-size: var(--fs-xs); color: var(--ink-2); }
.ask-ctx > svg { width: 13px; height: 13px; flex: none; color: var(--scrub); }
.ask-ctx span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-ctx button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ask-ctx button:hover { background: var(--surface-3); }
.ask-ctx button svg { width: 12px; height: 12px; }
.ask-input { display: flex; align-items: flex-end; gap: var(--s-2); padding: 6px 6px 6px 14px; border: 1.5px solid var(--line-strong); border-radius: 22px; background: var(--surface); transition: border-color var(--t-fast); }
.ask-input:focus-within { border-color: var(--scrub); }
.ask-input textarea { flex: 1; border: 0; outline: none; resize: none; background: none; padding: 7px 0; line-height: 1.45; max-height: 140px; font-size: .95rem; }
.ask-send { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--scrub); color: var(--scrub-ink); flex: none; }
.ask-send[disabled] { opacity: .5; }
.ask-send svg { width: 18px; height: 18px; stroke-width: 2.4; }
@keyframes section-flash { 0%, 40% { background: color-mix(in srgb, var(--amber-soft) 90%, transparent); } 100% { background: transparent; } }
.g-section.flash { animation: section-flash 1.6s ease-out; }
@media (min-width: 1200px) { body.ask-open .page { padding-right: calc(420px + var(--s-6)); } body.ask-open .toc { display: none; } body.ask-open .reader { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .ask { top: auto; height: 88dvh; width: 100%; border-left: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; transform: translateY(105%); }
  .ask.open { transform: none; }
  .ask-form { padding-bottom: calc(var(--s-4) + env(safe-area-inset-bottom)); }
  .ask-fab { right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.has-player .ask-fab { bottom: calc(150px + env(safe-area-inset-bottom)); }
  .ask-input textarea { font-size: 16px; }
}
.modal-body > .gen-section:first-child { border-top: 0; padding-top: var(--s-2); }
.modal-head .grow > .ai-mark { display: flex; }

/* ---------- Flashcard authoring ---------- */
.ce-tabs { margin-top: -4px; }
.ce-write { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--s-5); align-items: start; }
.ce-fields { display: flex; flex-direction: column; gap: var(--s-3); }
.ce-preview { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); position: sticky; top: 0; }
.ce-card { position: relative; width: 100%; aspect-ratio: 4 / 3; perspective: 1200px; transform-style: preserve-3d; transition: transform 480ms var(--ease-out); }
.ce-card.flipped { transform: rotateY(180deg); }
.ce-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: var(--s-5); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); backface-visibility: hidden; -webkit-backface-visibility: hidden; text-align: center; overflow: hidden; }
.ce-face > .xs { position: absolute; top: 10px; left: 14px; }
.ce-face.back { transform: rotateY(180deg); border-top: 4px solid var(--scrub); }
.ce-text { font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.ce-face.back .ce-text { font-weight: 400; font-size: var(--fs-sm); line-height: 1.55; -webkit-line-clamp: 8; }
.textarea.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.ce-parsed { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); }
.ce-parsed ol { max-height: 200px; overflow-y: auto; margin-top: var(--s-2); display: flex; flex-direction: column; }
.ce-parsed li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s-4); padding: 7px 0; font-size: var(--fs-sm); border-top: 1px solid var(--line); }
.ce-parsed li span:first-child { font-weight: 600; }
.ce-parsed li.bad span:last-child { color: var(--amber); font-style: italic; }
.ce-delete { color: var(--rose); }
.ce-delete:hover { background: var(--rose-soft); }
.cr-mine { display: inline-grid; place-items: center; margin-left: 6px; color: var(--ink-3); vertical-align: -1px; }
.cr-mine svg { width: 13px; height: 13px; }
.deck-empty { margin-top: var(--s-4); background: var(--surface); }
.write-own { margin-bottom: var(--s-4); }
.danger-zone { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4); border-radius: var(--r-md); border: 1px solid color-mix(in srgb, var(--rose) 30%, var(--line)); margin-top: var(--s-2); }
.danger-zone .grow b, .danger-zone .grow span { display: block; }
.btn.danger { --btn-fg: var(--rose); --btn-bd: color-mix(in srgb, var(--rose) 40%, var(--line)); }
.btn.danger:hover { background: var(--rose-soft); }
@media (max-width: 720px) {
  .ce-write { grid-template-columns: minmax(0, 1fr); }
  .ce-preview { position: static; order: -1; }
  .ce-card { aspect-ratio: auto; height: 150px; }
  .cr-meta { flex-wrap: wrap; }
}

/* ---------- Footer ---------- */
.app-footer {
  width: 100%; max-width: var(--content-max); margin: 0 auto;
  padding: var(--s-6) var(--s-8) var(--s-6);
  display: flex; flex-direction: column; gap: var(--s-4);
  color: var(--ink-3); font-size: var(--fs-sm);
}
.page-wide + .app-footer { max-width: 1440px; }
.af-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; padding-top: var(--s-5); border-top: 1px solid var(--line); }
.af-brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 800; color: var(--ink-2); letter-spacing: -0.02em; }
.af-brand .brand-mark { width: 24px; height: 24px; border-radius: 7px; }
.af-brand .brand-mark svg { width: 15px; height: 15px; }
.af-links { display: flex; flex-wrap: wrap; gap: 4px var(--s-5); }
.af-links a { color: var(--ink-2); font-weight: 500; padding: 4px 0; }
.af-links a:hover { color: var(--scrub); text-decoration: underline; text-underline-offset: 3px; }
.af-bottom { display: flex; justify-content: space-between; gap: var(--s-6); flex-wrap: wrap; font-size: var(--fs-xs); line-height: 1.6; }
.af-bottom p:first-child { max-width: 72ch; }
.af-copy { white-space: nowrap; }
body.focus-page .app-footer { display: none; }
@media (max-width: 1080px) { .app-footer { padding-left: var(--s-6); padding-right: var(--s-6); } }
@media (max-width: 720px) {
  .app-footer { padding: var(--s-2) var(--s-4) calc(96px + env(safe-area-inset-bottom)); }
  .af-top { flex-direction: column; align-items: flex-start; }
  .af-links { gap: 2px var(--s-4); }
  .af-copy { white-space: normal; }
}

/* ---------- Support ---------- */
.sup-search { max-width: 520px; height: 46px; background: var(--surface); border-color: var(--line); }
.sup-topics { margin: var(--s-4) 0 var(--s-6); }
.sup-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.faq { display: flex; flex-direction: column; }
.faq details + details { border-top: 1px solid var(--line); }
.faq summary { display: flex; align-items: center; gap: var(--s-3); padding: 14px 4px; cursor: pointer; list-style: none; font-weight: 600; }
.faq summary::-webkit-details-marker { display: none; }
.faq p { padding: 0 4px 16px; color: var(--ink-2); line-height: 1.65; max-width: 68ch; }
.sup-contact { position: sticky; top: calc(var(--topbar-h) + 12px); scroll-margin-top: calc(var(--topbar-h) + 12px); }
.file-input { padding: 8px 10px; height: auto; font-size: var(--fs-sm); }
.sent { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); padding: var(--s-6) 0; }
@media (max-width: 900px) { .sup-grid { grid-template-columns: minmax(0, 1fr); } .sup-contact { position: static; } }

/* ---------- Legal ---------- */
.legal-tabs { margin-bottom: var(--s-4); }
.tabs a { position: relative; padding: 10px 12px 12px; font-weight: 600; font-size: var(--fs-sm); color: var(--ink-3); white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-selected="true"] { color: var(--ink); }
.tabs a[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px; border-radius: 2px 2px 0 0; background: var(--scrub); }
.legal .toc { padding-top: var(--s-10); }
.legal-doc { max-width: 720px; }
.legal-draft { display: flex; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-md); background: var(--amber-soft); margin-bottom: var(--s-5); font-size: var(--fs-sm); line-height: 1.55; }
.legal-draft svg { width: 18px; height: 18px; color: var(--amber); flex: none; margin-top: 2px; }
.legal-sec { padding: var(--s-5) 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: var(--s-3); line-height: 1.7; }
.legal-sec h2 { font-size: 1.2rem; }
.legal-doc > .lede { margin-bottom: var(--s-5); }

/* ---------- Courses ---------- */
.tree-row { position: relative; display: flex; align-items: center; }
.tree-row .tree-item { padding-right: 36px; }
.tree-edit { position: absolute; right: 4px; opacity: 0; transition: opacity var(--t-fast); }
.tree-row:hover .tree-edit, .tree-edit:focus-visible, .tree-row:has(.on) .tree-edit { opacity: 1; }
@media (hover: none) { .tree-edit { opacity: 1; } }
.tree-new { color: var(--scrub); font-weight: 600; margin-top: var(--s-2); }
.tree-new svg { color: var(--scrub); }
.course-preview { display: flex; align-items: center; gap: 10px; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); min-width: 0; }
.course-preview .course-dot { width: 12px; height: 12px; transition: background var(--t-fast); }
.course-preview span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-colors { border: 0; padding: 0; margin: 0; min-width: 0; }
.co-colors legend { margin-bottom: 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; width: 34px; height: 34px; cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch span { position: absolute; inset: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px color-mix(in srgb, black 8%, transparent); transition: transform var(--t-fast) var(--ease-out); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); transform: scale(.9); }
.swatch input:focus-visible + span { outline: 2.5px solid var(--scrub); outline-offset: 4px; }
.unit-new { display: flex; align-items: center; gap: 4px; }
.chip svg:last-child:not(:first-child) { width: 13px; height: 13px; opacity: .6; }
@media (max-width: 900px) {
  .tree-row { flex: none; }
  .tree-edit { position: static; opacity: 1; }
  .tree-row .tree-item { padding-right: 12px; }
}
.selbar .icon-btn.selbar-del { color: #F7B4BB; }
.selbar .icon-btn.selbar-del:hover { background: rgba(235, 110, 120, .18); color: #FFD0D4; }
.tree-unit-new { color: var(--scrub); font-weight: 600; gap: 6px; }
.tree-unit-new svg { width: 14px; height: 14px; color: var(--scrub); }
.unit-form { display: flex; align-items: center; gap: 2px; padding: 4px 0 4px 24px; }
.unit-form .input { height: 34px; font-size: var(--fs-sm); padding: 0 10px; }
@media (max-width: 900px) { .unit-form { padding-left: 0; flex: none; } .unit-form .input { width: 180px; } }
/* "All courses": one section per course */
.course-section { margin-bottom: var(--s-8); }
.course-section + .course-section { padding-top: var(--s-6); border-top: 1px solid var(--line); }
.course-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.course-bar { width: 6px; align-self: stretch; min-height: 40px; border-radius: 3px; background: var(--c); flex: none; }
.course-head h2 { font-size: 1.25rem; line-height: 1.25; }
.ch-code { color: var(--c); }
.course-head .xs { display: block; margin-top: 2px; }
.course-section .unit-block { margin-bottom: var(--s-4); }
.course-section .unit-head { padding-left: 0; }
.unit-head .xs { margin-left: auto; }
.unit-name { font-size: var(--fs-sm); color: var(--ink-2); }

/* Lecture page: made from this lecture */
.made-list { margin-top: var(--s-4); }
.made-filter { margin-bottom: var(--s-3); }
.made-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2) var(--s-4); }
.made-row { display: flex; align-items: center; gap: var(--s-3); padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line); transition: border-color var(--t-fast), background var(--t-fast); min-width: 0; }
.made-row:hover { border-color: var(--scrub); background: color-mix(in srgb, var(--scrub-soft) 35%, transparent); }
.made-row[hidden] { display: none; }
.made-row .title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.made-row .sub { display: block; font-size: var(--fs-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.made-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--scrub-soft); color: var(--scrub); }
.made-icon svg { width: 18px; height: 18px; }
.made-chev { width: 16px; height: 16px; color: var(--ink-3); flex: none; transition: transform var(--t-fast); }
.made-row:hover .made-chev { transform: translateX(2px); color: var(--scrub); }
@media (max-width: 760px) { .made-rows { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Home: This week (Pro) ---------- */
.home-week .panel-head h2 { display: flex; align-items: center; gap: 8px; }
.home-week .panel-head h2 .inline-icon { width: 18px; height: 18px; color: var(--scrub); }
.wk-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wk-day { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; min-height: 112px; padding: 8px 6px; border-radius: var(--r-md); border: 1px solid var(--line); text-align: left; transition: border-color var(--t-fast), background var(--t-fast); }
button.wk-day:hover { border-color: var(--line-strong); }
.wk-day[aria-selected="true"] { border-color: var(--scrub); box-shadow: 0 0 0 1px var(--scrub); }
.wk-day.today { background: color-mix(in srgb, var(--scrub-soft) 55%, transparent); }
.wk-dow { font-size: var(--fs-xs); color: var(--ink-3); }
.wk-day > b { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.1; margin-bottom: 2px; }
.wk-day.today > b { color: var(--scrub); }
.wk-chip { display: block; font-size: 11px; font-weight: 600; line-height: 1.3; padding: 2px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--wkc) 15%, var(--surface)); color: color-mix(in srgb, var(--wkc) 75%, var(--ink)); border-left: 2.5px solid var(--wkc); }
.wk-exam { --wkc: var(--rose); } .wk-quiz { --wkc: var(--amber); } .wk-assignment { --wkc: var(--due); } .wk-clinical { --wkc: var(--sky); }
.wk-lecture { --wkc: var(--ink-3); } .wk-study { --wkc: var(--scrub); } .wk-review { --wkc: var(--c-psych); }
.wk-detail { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.wk-detail-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: var(--s-2); }
.wk-list { display: flex; flex-direction: column; gap: 4px; }
.wk-item { display: flex; align-items: center; gap: var(--s-3); padding: 9px 12px; border-radius: var(--r-md); background: color-mix(in srgb, var(--wkc) 7%, var(--surface)); border-left: 3px solid var(--wkc); transition: background var(--t-fast); }
.wk-item:hover { background: color-mix(in srgb, var(--wkc) 13%, var(--surface)); }
.wk-item .grow b, .wk-item .grow span { display: block; }
.wk-item .grow b { font-size: var(--fs-sm); }
.wk-time { width: 92px; flex: none; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.wk-icon { color: var(--wkc); display: grid; } .wk-icon svg { width: 16px; height: 16px; }
.wk-free { padding: 4px 0; }
.week-locked .wk-day i { display: block; height: 14px; border-radius: 4px; background: var(--surface-2); margin-top: 3px; }
.week-locked .wk-day i + i { width: 70%; }
.wk-lock { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; margin-top: var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--pro-soft); }
.wk-lock p { flex: 1; min-width: 200px; color: var(--ink-2); }
@media (max-width: 860px) { .wk-grid { gap: 4px; } .wk-day { min-height: 96px; padding: 6px 4px; } .wk-chip { font-size: 10.5px; padding: 1px 4px; } }
@media (max-width: 560px) {
  .wk-grid { grid-template-columns: repeat(7, 64px); overflow-x: auto; scrollbar-width: none; }
  .wk-time { width: 64px; }
}
/* Narrow week: labels become colored bars (tap a day for details) */
.home-week { container-type: inline-size; }
@container (max-width: 560px) {
  .wk-chip { font-size: 0; height: 6px; padding: 0; border-left: 0; border-radius: 3px; background: var(--wkc); margin-top: 2px; }
  .wk-day { min-height: 84px; align-items: center; text-align: center; }
  .wk-day .wk-chip { width: 100%; }
}

/* ---------- Import ---------- */
.dropzone.compact { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: var(--s-4); gap: 4px 10px; }
.dropzone.compact .dz-icon { width: 34px; height: 34px; margin: 0; border-radius: 10px; }
.dropzone.compact .dz-icon svg { width: 18px; height: 18px; }
.dropzone.compact .small { flex-basis: 100%; }
.import-list { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.import-item { display: flex; align-items: center; gap: var(--s-3); padding: 8px 8px 8px 10px; border-radius: var(--r-md); border: 1px solid var(--line); }
.import-item.error { border-color: color-mix(in srgb, var(--rose) 40%, var(--line)); }
.import-item .grow { display: flex; flex-direction: column; gap: 2px; }
.import-title { height: 32px; border-color: transparent; padding: 0 8px; margin-left: -8px; font-weight: 600; background: transparent; }
.import-title:hover { border-color: var(--line); }
.import-item .err { color: var(--rose); }
.lec-view { margin-top: var(--s-4); }
.pdf-view { width: 100%; height: min(78vh, 900px); border: 0; border-radius: var(--r-md); background: var(--surface-2); }
.media-view { width: 100%; border-radius: var(--r-md); }
video.media-view { max-height: 70vh; background: #000; }
.notes-text { white-space: pre-wrap; line-height: 1.7; max-width: 75ch; font-size: 1rem; }
.file-card { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4); border-radius: var(--r-md); background: var(--surface-2); flex-wrap: wrap; }
.file-card .grow b, .file-card .grow span { display: block; }
.lec-note { display: flex; align-items: center; gap: var(--s-4); }
.lec-note .pg-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--sky-soft); color: var(--sky); display: grid; place-items: center; flex: none; }
.lec-note .pg-icon svg { width: 20px; height: 20px; }
.count-row { display: flex; align-items: center; gap: var(--s-3); }
.count-row .range { flex: 1; }
.count-input { width: 84px; flex: none; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.focus-tag { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 6px 4px 10px; border-radius: var(--r-pill); background: var(--scrub-soft); color: var(--scrub); font-size: var(--fs-sm); }
.focus-tag > svg { width: 14px; height: 14px; }
.focus-tag button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--scrub); }
.focus-tag button:hover { background: color-mix(in srgb, var(--scrub) 15%, transparent); }
.focus-tag button svg { width: 12px; height: 12px; }
.source-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: var(--s-8) var(--s-6); border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); }
.source-empty .se-icon { width: 48px; height: 48px; border-radius: 15px; background: var(--scrub-soft); color: var(--scrub); display: grid; place-items: center; margin-bottom: 4px; }
.source-empty .se-icon svg { width: 22px; height: 22px; }
.source-empty p { max-width: 44ch; margin-bottom: 6px; }
.source-head { display: flex; align-items: center; gap: var(--s-3); }
.source-head h3 { flex: none; }
.source-search { flex: 1; max-width: 280px; height: 34px; margin-left: auto; }
.source-search input { font-size: var(--fs-sm); }
.source-count { flex: none; min-width: 64px; text-align: right; }
.source-row[hidden], .source-course[hidden], .source-list[hidden], .source-none[hidden] { display: none; }
.source-none { padding: var(--s-6) var(--s-4); text-align: center; }
@media (max-width: 560px) { .source-head { flex-wrap: wrap; } .source-search { order: 3; flex-basis: 100%; max-width: none; } .source-count { margin-left: auto; } }

/* Home: Subjects lives in the right column; stack its two lists there */
.subj-panel .subjects { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
.subj-panel .panel-head { flex-wrap: wrap; }
@media (max-width: 720px) { .subj-panel .subjects { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .subj-panel .subjects { grid-template-columns: minmax(0, 1fr); } }

/* Week widget keeps one size: each day shows at most 3 rows, and the
   schedule below always reserves room for 3 items (+ a "more" link). */
.wk-day { height: 124px; min-height: 0; overflow: hidden; }
.wk-more { display: block; font-size: 11px; font-weight: 600; color: var(--ink-3); padding: 2px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-detail { min-height: 236px; }
.wk-more-link { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; font-size: var(--fs-sm); font-weight: 600; color: var(--scrub); }
.wk-more-link svg { width: 14px; height: 14px; }
.wk-more-link:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 860px) { .wk-day { height: 108px; } }
@container (max-width: 560px) {
  .wk-day { height: 92px; }
  .wk-more { font-size: 0; height: 6px; padding: 0; border-radius: 3px; background: var(--line-strong); margin-top: 2px; width: 100%; }
}
@media (max-width: 720px) { .dash-main > :last-child, .dash-side > :last-child { flex: none; } }
.wk-detail { height: 274px; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
/* Every event for the day; the list scrolls inside the fixed-height pane. */
.wk-detail .wk-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding-right: 4px; } /* no scroll trap: at the end of the list, the wheel scrolls the page */
.wk-item { min-height: 0; }
.wk-item .grow { min-width: 0; }
.wk-item .grow b, .wk-item .grow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .wk-detail { height: auto; } }

.quick-btn .pro-badge { margin-left: 2px; }

/* ---------- Pro lock: blurred preview with Pro in the middle ---------- */
.pro-lock { position: relative; }
.pro-blur { filter: blur(4px); opacity: .9; pointer-events: none; user-select: none; }
.pro-over {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s-2); text-align: center; padding: var(--s-4);
}
.pro-over p { max-width: 34ch; color: var(--ink-2); }
.pro-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--r-pill);
  background: var(--pro-soft); color: var(--pro); font-family: var(--font-display); font-weight: 800; font-size: 1rem;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--surface) 70%, transparent);
}
.pro-chip svg { width: 15px; height: 15px; stroke-width: 2.4; }
.coming-up.is-locked .pro-over p { font-size: var(--fs-xs); }
.coming-up.is-locked .pro-lock { min-height: 220px; }

.quick-btn .pro-badge svg { width: 11px; height: 11px; padding: 0; background: none; color: inherit; border-radius: 0; }

/* Course colors: "+" opens a simple gradient picker (hue + shade) */
.swatch[hidden] { display: none; }
.swatch-add { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1.5px dashed var(--line-strong); color: var(--ink-2); transition: border-color var(--t-fast), color var(--t-fast); }
.swatch-add:hover, .swatch-add[aria-expanded="true"] { border-color: var(--scrub); color: var(--scrub); }
.swatch-add svg { width: 16px; height: 16px; }
.color-picker { display: flex; flex-direction: column; gap: var(--s-3); margin-top: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--surface-2); }
.color-picker[hidden] { display: none; }
.color-picker .cp-ok { align-self: flex-end; }
.cp-bar { position: relative; height: 18px; border-radius: 99px; cursor: pointer; touch-action: none; }
.cp-hue { background: linear-gradient(90deg, hsl(0 62% 52%), hsl(60 62% 52%), hsl(120 62% 52%), hsl(180 62% 52%), hsl(240 62% 52%), hsl(300 62% 52%), hsl(360 62% 52%)); }
.cp-shade { --h: 168; background: linear-gradient(90deg, hsl(var(--h) 62% 82%), hsl(var(--h) 62% 55%), hsl(var(--h) 62% 28%)); }
.cp-thumb { position: absolute; top: 50%; left: var(--x, 50%); width: 22px; height: 22px; border-radius: 50%; transform: translate(-50%, -50%); background: transparent; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); pointer-events: none; }
.cp-bar:focus-visible { outline: 2.5px solid var(--scrub); outline-offset: 3px; }
.course-preview #co-pv-code { margin-left: auto; font-size: var(--fs-xs); }

/* Course code shown next to a course name: lighter and quieter */
.course-code { color: var(--ink-3); font-weight: 400; font-family: var(--font-body); font-size: .85em; letter-spacing: 0; white-space: nowrap; }
.course-head h2 .course-code { font-size: .7em; margin-left: 4px; }

/* Lecture page: back button, icon-only download, previews */
.back-btn { display: inline-flex; align-items: center; gap: 6px; margin: var(--s-2) 0 calc(var(--s-2) * -1); padding: 6px 10px 6px 6px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); transition: background var(--t-fast), color var(--t-fast); }
.back-btn:hover { background: var(--surface-2); color: var(--ink); }
.back-btn svg { width: 17px; height: 17px; transition: transform var(--t-fast) var(--ease-out); }
.back-btn:hover svg { transform: translateX(-2px); }
.btn.btn-icon { width: 40px; padding: 0; }
.pdf-thumb { position: relative; padding: 0; overflow: hidden; display: block; aspect-ratio: auto; min-height: 90px; cursor: zoom-in; border: 1px solid var(--line); background: var(--surface-2); }
.pdf-thumb .num { position: absolute; top: 6px; left: 8px; z-index: 1; background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 0 6px; border-radius: 6px; }
.pdf-thumb canvas { display: block; width: 100%; height: auto; opacity: 0; transition: opacity var(--t-med); }
.pdf-thumb.ready canvas { opacity: 1; }
.pdf-thumb:not(.ready) { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 40%, var(--surface-2) 80%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; aspect-ratio: 4 / 3; }
.pdf-thumb:hover { border-color: var(--scrub); }
.notes-clamp { max-height: 260px; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 75%, transparent); mask-image: linear-gradient(180deg, #000 75%, transparent); font-size: var(--fs-sm); }
.notes-clamp.notes-open { max-height: none; -webkit-mask-image: none; mask-image: none; }
.doc-viewer { padding-top: 0; }
.doc-viewer .pdf-view { height: min(76vh, 900px); }

/* Lecture preview: scroll through every page */
.preview-scroll { max-height: 340px; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; scrollbar-width: thin; }
.preview-scroll .slides-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .preview-scroll .slides-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Quizzes: compact lists that scroll without a visible scrollbar */
.scroll-quiet { max-height: 560px; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
.scroll-quiet::-webkit-scrollbar { display: none; }
.quiz-list .row { padding: 8px var(--s-2); }
.quiz-list .title { font-size: var(--fs-sm); }
.quiz-name { display: block; max-width: 100%; padding: 0; text-align: left; font-weight: 600; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; border-radius: 4px; }
.quiz-name:hover { text-decoration: underline dotted var(--ink-3); text-underline-offset: 3px; }
.quiz-name-input { height: 30px; padding: 0 8px; font-size: var(--fs-sm); font-weight: 600; margin: -3px 0 2px -8px; width: calc(100% + 8px); }
.quiz-list .sub { font-size: var(--fs-xs); display: flex; align-items: center; gap: 6px; }
.quiz-list .row-icon { width: 34px; height: 34px; border-radius: 10px; }
.quiz-list .row-icon svg { width: 16px; height: 16px; }
.source-course-select { width: auto; max-width: 200px; height: 34px; font-size: var(--fs-sm); margin-left: auto; padding-right: 32px; }
.source-head .source-search { margin-left: 0; }
.quiz-course-select { width: auto; max-width: 190px; height: 34px; font-size: var(--fs-sm); padding-right: 32px; flex: none; }
.quiz-list [hidden], .scores [hidden] { display: none; }
.scores .filter-none { border: 0; padding: var(--s-4) 0; }
.quiz-list .filter-none { padding: var(--s-4) var(--s-2); }
.quiz-list .row { gap: var(--s-2); }
.quiz-more { color: var(--ink-3); }
.quiz-more:hover, .quiz-more[aria-expanded="true"] { color: var(--ink); background: var(--surface-2); }
/* Prompt & Sources window */
.prompt-quote { padding: 10px 12px; border-left: 3px solid var(--scrub); border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--surface-2); font-size: var(--fs-sm); line-height: 1.5; white-space: pre-wrap; }
.prompt-settings { display: grid; gap: 6px; font-size: var(--fs-sm); }
.prompt-settings div { display: flex; gap: var(--s-3); }
.prompt-settings dt { width: 120px; flex: none; color: var(--ink-3); }
.prompt-settings dd { margin: 0; }
.prompt-sources { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px; }
/* Saved results open their results page. */
.score-link { display: flex; align-items: center; gap: inherit; flex: 1; min-width: 0; margin: -6px -8px; padding: 6px 8px; border-radius: var(--r-md); color: inherit; transition: background-color var(--t-fast) ease; }
.score-link:hover { background: var(--surface-2); }
.score-chev { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
/* Both lists keep their full height, so the panels match even when empty. */
.quiz-list.scroll-quiet, .scores.scroll-quiet { height: 560px; }
@media (max-width: 760px) { .quiz-list.scroll-quiet, .scores.scroll-quiet { height: 380px; } }
@media (max-width: 560px) { .source-course-select { order: 3; flex: 1; max-width: none; } }

/* Redrawn after a resize: skip the draw-in, keep the glow going */
.vitals-trace.settled .trace-line { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
.vitals-trace.settled .trace-glow { animation: none; opacity: 1; }

/* ---- Sign in / create account ---- */
body.auth-screen { background: var(--paper); }
.page.auth-page { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--s-8) var(--s-4); max-width: none; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: var(--s-8); }
.auth-card h1 { font-size: var(--fs-2xl); margin-bottom: var(--s-1); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; color: var(--ink); margin-bottom: var(--s-6); }
.auth-google { gap: 10px; }
.google-mark { width: 18px; height: 18px; }
.auth-or { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-5) 0; color: var(--ink-3); font-size: var(--fs-xs); }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-error { margin-bottom: var(--s-4); padding: 10px 12px; border-radius: var(--r-sm); background: var(--rose-soft); color: var(--rose); font-size: var(--fs-sm); }
.auth-error[hidden] { display: none; }
.pw-wrap { position: relative; }
.pw-wrap .input { width: 100%; padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.auth-forgot { align-self: flex-end; margin-top: calc(-1 * var(--s-2)); color: var(--scrub); font-weight: 600; }
.auth-switch { margin-top: var(--s-6); text-align: center; }
.auth-switch a, .auth-legal a, .auth-sent a { color: var(--scrub); font-weight: 600; }
.auth-legal { margin-top: var(--s-4); text-align: center; }
.auth-sent { text-align: center; }
.auth-sent-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--scrub-soft); color: var(--scrub); margin-bottom: var(--s-4); }
.auth-sent-icon svg { width: 24px; height: 24px; }
@media (max-width: 480px) { .auth-card { padding: var(--s-6) var(--s-5); } }

/* Study settings window */
.study-setup .seg { display: flex; width: 100%; }
.study-setup .limit-row { display: flex; align-items: center; gap: var(--s-3); }
.study-setup .limit-row .seg { width: auto; }
.study-setup .limit-row .seg button { flex: none; padding-left: 22px; padding-right: 22px; }
.study-setup .limit-input { width: 110px; text-align: center; font-variant-numeric: tabular-nums; }
.study-setup .seg button { flex: 1; }
.study-setup .field .xs { margin-top: 6px; display: block; }
.study-setup .set-row { padding: var(--s-3) 0; }
.set-row.is-off { opacity: .55; cursor: default; }
.set-row.is-off .switch input { cursor: default; }
@media (max-width: 560px) { .study-setup .seg { flex-wrap: wrap; } .study-setup .seg button { flex: 1 1 45%; } }

/* Add Cards: step back and forward through the cards added in this window */
.ce-nav { display: flex; align-items: center; justify-content: center; gap: var(--s-3); }
.ce-nav .icon-btn { border: 1px solid var(--line); }
.ce-nav .icon-btn:disabled { opacity: .4; cursor: default; }

/* Empty states inside dashboard panels */
.empty-note { padding: var(--s-3) 0; }
.getting-started .path-step { width: 100%; text-align: left; }

/* Course chips on Study Guides, Mind Maps, Podcasts, Case Studies */
.course-chips { margin-bottom: var(--s-5); }
.guide-book[hidden], .map-card[hidden], .pod-row[hidden], .case-card[hidden] { display: none; }

/* ---------- Study guide highlights & notes ---------- */
.g-hl { --hl: var(--amber); background: color-mix(in srgb, var(--hl) 32%, transparent); color: inherit; border-radius: 3px; padding: 1px 0; cursor: pointer; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background-color var(--t-fast) ease; }
.g-hl:hover { background: color-mix(in srgb, var(--hl) 48%, transparent); }
.hl-yellow { --hl: var(--amber); } .hl-green { --hl: var(--good); } .hl-blue { --hl: var(--sky); } .hl-pink { --hl: var(--rose); }
/* A note shows as a small dot after the highlight. */
.g-hl.has-note.note-end::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 3px; border-radius: 50%; background: color-mix(in srgb, var(--hl) 80%, var(--ink)); vertical-align: super; }
.g-hl.flash { animation: hl-flash 1.6s ease; }
@keyframes hl-flash { 0%, 60% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--hl) 60%, transparent); } 100% { box-shadow: none; } }
.hl-swatches { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; }
.hl-swatch { width: 20px; height: 20px; padding: 0 !important; border-radius: 50% !important; background: var(--hl) !important; border: 2px solid transparent; }
.hl-swatch:hover { transform: scale(1.1); }
.hl-swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }
.sel-pop .hl-swatch[aria-pressed="true"] { border-color: var(--paper); }
.sel-pop.no-mark .hl-swatches, .sel-pop.no-mark [data-hl="note"] { display: none; }
.mark-pop { position: absolute; z-index: 50; width: min(320px, calc(100vw - 16px)); display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-3); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); }
.mark-pop[hidden] { display: none; }
.mark-pop .hl-swatches { padding: 0; }
.notes-list { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow-y: auto; }
.notes-item { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 10px 12px; border-radius: var(--r-md); text-align: left; }
.notes-item:hover { background: var(--surface-2); }
.notes-quote { align-self: flex-start; padding: 1px 4px; border-radius: 3px; background: color-mix(in srgb, var(--hl) 32%, transparent); font-size: var(--fs-sm); line-height: 1.5; }
.notes-note { display: flex; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }
.notes-note svg { width: 14px; height: 14px; flex: none; margin-top: 3px; color: var(--ink-3); }
@media (prefers-reduced-motion: reduce) { .g-hl.flash { animation: none; } }

/* The "New" box keeps a card's height even when it's alone (e.g. a course with none yet). */
.maps > .new-tile { min-height: 248px; }
.cases > .new-tile { min-height: 220px; }

/* Generate cards: preset counts, or type a number */
.card-count-row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.card-count-row .seg { width: auto; }
.card-count-row .count-input { width: 90px; text-align: center; }

/* ---------- Study guide: editing a section ---------- */
.g-edit-bar { display: flex; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-3); padding: 8px 8px 8px 12px; border-radius: var(--r-md); background: var(--scrub-soft); }
.g-edit-bar[hidden] { display: none; }
.g-section.editing .g-content { outline: 2px solid color-mix(in srgb, var(--scrub) 45%, transparent); outline-offset: 6px; border-radius: 6px; cursor: text; }
.g-section.editing .g-content:focus { outline-color: var(--scrub); }
.g-section.editing .g-tools { opacity: 1; }
.g-edit-bar .g-fmt { color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); }
.g-edit-bar .g-fmt:hover { color: var(--scrub); border-color: var(--scrub); }

/* Flashcards: All decks / Due / Not due */
.lib-tools .due-toggle { width: auto; flex: none; }
/* Flashcards → Due, when nothing is due */
.caught-up { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: var(--s-6) var(--s-4) var(--s-8); }
.caught-up .nurse-art { width: 168px; height: 168px; color: var(--scrub); margin-bottom: var(--s-2); }
.caught-up p { max-width: 40ch; }
/* Compact version for dashboard panels (This Week, Coming Up) */
.caught-up-sm { flex: 1; justify-content: center; padding: var(--s-3) var(--s-4); gap: 4px; }
.caught-up-sm .nurse-art { width: 96px; height: 96px; margin-bottom: 0; }
.caught-up-sm h3 { font-size: 1rem; }

/* Your Quizzes / Results with nothing in them: centered, like "You're all caught up" */
.list-empty { flex: 1; min-height: 100%; justify-content: center; padding: var(--s-6) var(--s-4); border: 0 !important; }

/* Deck titles: at most 2 lines (text shrinks first, then trims); unit line: 1 line. */
.deck h3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.deck-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Flashcards: Sort by */
.sort-by { display: inline-flex; align-items: center; gap: var(--s-2); flex: none; }
.sort-by .select { width: auto; height: 38px; padding-right: 32px; font-size: var(--fs-sm); }

/* Generator footer: usage, and why Generate is off */
.gen-usage.warn { color: color-mix(in srgb, var(--amber) 75%, var(--ink)); font-weight: 600; }
.gen-why { max-width: 32ch; text-align: right; color: var(--rose); }
.gen-why[hidden] { display: none; }

/* Settings → Plan */
.plan-periods { margin: var(--s-2) 0 var(--s-3); gap: var(--s-3); }
.plan-periods .seg { width: auto; }
.tier-price { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.tag-pro { background: var(--pro-soft); color: color-mix(in srgb, var(--pro, var(--amber)) 80%, var(--ink)); }
.usage-warn { color: color-mix(in srgb, var(--amber) 75%, var(--ink)); font-weight: 600; }
.plan-note { display: flex; align-items: center; gap: 6px; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--amber-soft); margin-bottom: var(--s-4); }

/* Sort by + course chips row (Study Guides, Mind Maps, Podcasts) */
.list-tools { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-5); }
.list-tools .course-chips { margin-bottom: 0; }

/* Mind map side panel: rename / delete / add a concept */
.mm-title-row { display: flex; align-items: flex-start; gap: var(--s-2); }
.mm-title-row h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mm-node-tools { display: flex; gap: 2px; flex: none; }
.mm-node-tools .icon-btn { color: var(--ink-3); }
.mm-node-tools .icon-btn:hover { color: var(--ink); }
.mm-node-tools [data-remove-node]:hover { color: var(--rose); }
.mm-rename .input { font-weight: 600; }
.mm-add { display: flex; flex-direction: column; gap: 6px; }
.mm-add .input { height: 34px; }

/* Library: a source being renamed isn't a link until the rename is done */
.lec-body.renaming { cursor: default; }

/* Planner: editable events, the Recall switch */
.ev[data-ev], .ag-item[data-ev] { cursor: pointer; }
.ev[data-ev]:hover { filter: brightness(.97); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c, var(--scrub)) 45%, transparent); }
.ag-item[data-ev]:hover { background: var(--surface-2); }
.day-col { cursor: copy; }
.planner-switch { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.ev-end[hidden] { display: none; }
.danger-text { color: var(--rose); }

/* Mind map: dragging concepts shouldn't select their text */
.mm-canvas, .mm-canvas * { -webkit-user-select: none; user-select: none; }

/* Podcasts: Episode Formats sit above Sort by */
.pod-formats-row { margin-bottom: var(--s-6); }

/* Guided plan: the Next button on the study guide stays dim until the end is reached, then lights up */
.plan-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: var(--s-4); padding: 8px 8px 8px 20px; max-width: calc(100vw - 24px); border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); transition: border-color var(--t-med); }
.plan-bar-text { font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; }
.plan-bar .btn { white-space: nowrap; transition: opacity var(--t-med); }
.plan-bar .btn[disabled] { opacity: .4; }
.plan-bar.ready { border-color: var(--scrub); }
.plan-bar.ready .btn { animation: plan-glow 1.6s ease-out 3; }
@keyframes plan-glow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--scrub) 55%, transparent); } 100% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--scrub) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { .plan-bar.ready .btn { animation: none; } }
@media (max-width: 560px) { .plan-bar-text { display: none; } .plan-bar { padding-left: 8px; } }
.next-up h2 .mastery-delta { font-size: var(--fs-xs); vertical-align: middle; margin-left: 6px; font-family: var(--font-body); }

/* ---------- Podcast volume and speed ---------- */
.pp-vol { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.pp-vol-range { width: 110px; }
.pp-vol + .pp-rate { margin-left: var(--s-3); }
.mp-extra { display: flex; align-items: center; gap: var(--s-2); }
.mp-speed { min-width: 44px; height: 28px; padding: 0 8px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--monitor-ink-2) 45%, transparent); color: var(--monitor-ink-2); font: 600 var(--fs-xs)/1 var(--font-mono); }
.mp-speed:hover { color: var(--monitor-ink); border-color: var(--monitor-ink-2); }
.mp-vol { display: inline-flex; align-items: center; gap: 2px; }
.mp-vol-range { width: 76px; }
@media (max-width: 760px) { .mp-vol-range { display: none; } }
@media (max-width: 960px) { .pp-vol { margin-left: 0; } .pp-vol + .pp-rate { margin-left: 0; } }

/* ---------- Text size (Settings → Appearance) ---------- */
html.ts-lg { font-size: 112.5%; }
html.ts-xl { font-size: 125%; }

/* ---------- Blank states that keep the demo's layout (Performance, Subjects) ---------- */
.sk { display: block; height: 12px; border-radius: 6px; background: var(--surface-3); opacity: .7; }
.sk-w40 { width: 40%; } .sk-w50 { width: 50%; } .sk-w60 { width: 60%; } .sk-w70 { width: 70%; }
.scores li.blank { min-height: 80px; }  /* same height as a real quiz row */
.subj-list li.na { min-height: 77px; } /* same height as a real subject row */
.scores li.blank .title.muted { color: var(--ink-3); font-weight: 500; }
.scores li.blank .title.sk { height: 14px; }
.score-pill.blank { background: var(--surface-2); color: var(--ink-3); font-weight: 600; }
.subj-list .subj .sk { height: 14px; }
.chart-blank { position: relative; }
.chart-blank .line-chart { width: 100%; height: auto; margin-top: var(--s-2); opacity: .75; }
.chart-blank-note { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 0 var(--s-6); }

/* This Week: browse later weeks */
.wk-nav { display: inline-flex; gap: 2px; margin-right: var(--s-2); }
.wk-nav .icon-btn[disabled] { opacity: .35; cursor: default; }
/* Adaptive Study: finished steps */
.session li.done .sess-icon { background: var(--good-soft); color: var(--good); }
.session li.done .grow b { color: var(--ink-3); }

/* Home: Adaptive Study card's Pro symbol (top right) and days already past in This Week */
.next-head { position: relative; }
.next-head .next-pro { align-self: flex-start; margin-left: auto; }

/* Planner: one fixed panel size for Day, Week, and Upcoming (set from the Week view's height); long lists scroll inside */
.planner-view.day, .planner-view.upcoming { height: var(--planner-view-h, 880px); overflow-y: auto; scrollbar-width: thin; padding-right: 4px; }
.planner-view .caught-up { min-height: 100%; justify-content: center; padding-top: var(--s-4); padding-bottom: var(--s-4); }

/* A finished step shows a check where its icon was (same look as "Your Session" in Adaptive Study) */
.path li.done .path-icon { background: var(--good-soft); color: var(--good); }

/* Planner event form: Event/Deadline toggle and time choices */
.ev-mode { align-self: flex-start; }
.ev-when[hidden], .ev-times[hidden] { display: none; }
.ev-when { display: flex; flex-direction: column; gap: var(--s-3); }

/* Planner: drag the top or bottom edge of an event that has a start and an end to change its length */
.ev-resize { position: absolute; left: 0; right: 0; height: 9px; cursor: ns-resize; touch-action: none; z-index: 2; }
.ev-resize-top { top: 0; } .ev-resize-bottom { bottom: 0; }
.ev-resize::after { content: ""; position: absolute; left: 50%; width: 22px; height: 3px; margin-left: -11px; border-radius: 3px; background: var(--evc); opacity: 0; transition: opacity var(--t-fast); }
.ev-resize-top::after { top: 2px; } .ev-resize-bottom::after { bottom: 2px; }
.ev:hover .ev-resize::after, .ev.resizing .ev-resize::after { opacity: .7; }
.ev.resizing { z-index: 4; box-shadow: 0 6px 18px rgba(0, 0, 0, .22); }
.ev-resize-tip { position: absolute; left: 50%; transform: translateX(-50%); z-index: 6; padding: 3px 8px; border-radius: 6px; background: var(--ink); color: var(--paper); font: 600 11px/1.3 var(--font-body); white-space: nowrap; pointer-events: none; }

/* Planner: a deadline is a short block in the grid at its due time */
.ev.ev-due { padding-top: 3px; padding-bottom: 3px; }
.ev.ev-due b { font-weight: 650; }
.planner-view.week { height: var(--planner-view-h, auto); overflow-y: auto; scrollbar-width: thin; }

/* Planner: a line across the week at the current time, with the time in the hours column */
.now-marker { position: absolute; left: 0; right: 0; height: 0; z-index: 5; pointer-events: none; }
.now-time { position: absolute; left: 0; width: 44px; transform: translateY(-50%); text-align: right; padding-right: 4px; font: 700 9.5px/1 var(--font-body); white-space: nowrap; color: var(--rose); background: var(--surface); }
.now-rule { position: absolute; left: 46px; right: 0; top: -1px; height: 2px; border-radius: 2px; background: var(--rose); }
.now-rule::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); }

/* Time field: type a time, or click and hold the arrows (hours, or minutes in 15-minute steps) */
.ts-row { display: flex; align-items: center; gap: var(--s-2); }
.ts-text { min-width: 0; width: 7.5em; font-variant-numeric: tabular-nums; }
.ts-row.ts-bad .ts-text { border-color: var(--rose); animation: ts-shake 300ms; }
@keyframes ts-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.ts-unit { display: inline-flex; align-items: center; gap: 4px; }
.ts-cap { font-size: 10px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.ts-pair { display: inline-flex; flex-direction: column; gap: 2px; }
.ts-btn { width: 26px; height: 17px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink-2); cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none; }
.ts-btn:hover { background: var(--surface-2); color: var(--ink); }
.ts-btn:active { background: var(--surface-3); }
.ts-btn svg { width: 14px; height: 14px; }
.ev-due-time[hidden] { display: none; }

/* Events that overlap in time share the day's width; their titles wrap so they stay readable */
.ev-shared { padding: 3px 5px; }
.ev-shared b { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; line-height: 1.25; }
.ev-crowded { padding: 2px 3px; font-size: 10.5px; }
.ev-crowded b { -webkit-line-clamp: 3; }
.ev-crowded span, .ev-crowded .ev-ai { display: none; }

/* Planner: drag an event by its body to move it */
.week .ev[data-ev] { cursor: grab; }
.ev.moving { cursor: grabbing; z-index: 8; opacity: .92; box-shadow: 0 8px 22px rgba(0, 0, 0, .28); transition: none; }
.ev-move-tip { position: fixed; z-index: 60; padding: 4px 9px; border-radius: 7px; background: var(--ink); color: var(--paper); font: 600 11.5px/1.3 var(--font-body); white-space: nowrap; pointer-events: none; }

/* Dragging an event: the calendar keeps its place; a floating, full-size copy follows the pointer. */
.ev-ghost { position: fixed; z-index: 59; margin: 0; right: auto; pointer-events: none; opacity: .94; box-shadow: 0 8px 22px rgba(0, 0, 0, .28); cursor: grabbing; }
.ev.moving-from { opacity: .3; }
body.is-dragging-ev, body.is-dragging-ev * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.week .ev[data-ev] { user-select: none; -webkit-user-select: none; touch-action: none; }
.ev.ev-due { z-index: 3; }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }

.week-grid { margin-bottom: 26px; } /* room for a deadline due at 11:59 PM, which hangs below the last hour */

.tl-link { cursor: pointer; border-radius: 10px; transition: background .15s; }
.tl-link:hover { background: var(--surface-2); }
.planner-side .coming-up .timeline { max-height: 264px; overflow-y: auto; scrollbar-width: thin; padding-right: 4px; }

/* Google */
.ev-google { --evc: #4285f4; }
.ev-google b, .ag-item.ev-google b { color: var(--ink); }
.cv-google { background: color-mix(in srgb, #4285f4 14%, var(--surface)); color: #4285f4; }
.btn-gdrive { align-self: flex-start; gap: 8px; }
.btn-gdrive svg { width: 16px; height: 16px; }

.canvas-connect { position: relative; padding-left: calc(var(--s-5) + 26px); }
.cv-close { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.cv-close:hover { color: var(--ink); }
.cv-drive { background: var(--surface-2); }
.slot { position: relative; }
.slot-pro { position: absolute; top: 8px; right: 8px; }

/* Google's file picker: centre it in the window (it otherwise sits at the bottom of a tall page, out of sight) and keep it above our dialogs. */
.picker-dialog-bg { position: fixed !important; inset: 0 !important; width: auto !important; height: auto !important; z-index: 1000 !important; }
.picker-dialog { position: fixed !important; top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); z-index: 1001 !important; max-width: 96vw; }
.picker-dialog, .picker-dialog-content { overscroll-behavior: contain; }

.cv-steps { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; color: var(--ink-2); }

.ev-due-t { font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; padding: 0 4px; margin-right: 3px; border-radius: 4px; background: color-mix(in srgb, var(--evc) 22%, transparent); }

.ev.ev-done { opacity: .55; }
.ev.ev-done b, .ag-item.is-done b { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.ag-item.is-done { opacity: .6; }
.ev-check { display: inline-flex; vertical-align: -2px; margin-right: 3px; color: var(--ok, var(--scrub)); }
.ev-check svg { width: 12px; height: 12px; stroke-width: 3; }

.linked-status { display: grid; gap: var(--s-2); margin-top: var(--s-5); }
.linked-status p { margin: 0; }

.ev-linked-note { display: flex; gap: 6px; align-items: flex-start; margin: 0; }
.ev-linked-note svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }

/* Planner → Import */
.imp-src { display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: 12px 14px; border-radius: var(--r-md); border: 1.5px solid var(--line-strong); background: var(--surface); text-align: left; cursor: pointer; }
.imp-src:hover:not(:disabled) { border-color: var(--scrub); background: var(--surface-2); }
.imp-src:disabled { opacity: .55; cursor: not-allowed; }
.imp-src .grow { display: grid; gap: 1px; }
.imp-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.imp-ic svg { width: 20px; height: 20px; }
.imp-busy { display: grid; justify-items: center; gap: 6px; padding: var(--s-6) 0; text-align: center; }
.imp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 340px; overflow-y: auto; }
.imp-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); }
.imp-item.off { opacity: .55; }
.imp-item input[type=checkbox] { margin-top: 10px; }
.imp-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.imp-title { padding: 5px 8px; font-weight: 600; }

.imp-ok, .imp-warn { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 8px 10px; border-radius: var(--r-md); }
.imp-ok { background: var(--scrub-soft); color: var(--scrub-strong); }
.imp-warn { background: var(--amber-soft); }
.imp-ok svg, .imp-warn svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.imp-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* The footer always sits at the bottom of the window: a short page grows to fill it. */
.main > .page { flex: 1 0 auto; }

.grad-pick { gap: var(--s-2); }
