/* Viriens web app. Palette K1 (24 Nov 2026): Klein blue, crimson pink, frost white, night.
   White-led look (25 Nov 2026, owner): always light (no dark mode); white first, Klein second, crimson as small accents.
   --brand: text, links, buttons. --panel: filled blocks that always carry white text. --side: the sidebar and sign-in page (night in both modes).
   Rules from the UI & UX notes: bento grid (24px radius, 12px gap), one motion system
   (enter 250ms ease-out, exit 150ms ease-in, move 300ms ease-in-out, linear only for loading). */
:root {
  --brand: #002FA7; --on-brand: #FFFFFF; --brand-tint: #E6EBF8; --panel: #002FA7; --panel-2: #1E46B8; --side: #050B24;
  --accent: #E0245E; --accent-ink: #B5174A; --accent-tint: #FCE4EC;
  --surface: #F4F7FA; --surface-2: #EAEFF6; --ground: #FFFFFF; --ink: #141A2E; --muted: #545E78; --line: #C9D2E3; --line-2: #E1E7F0;
  --green: #2E8B57; --green-tint: #E3F4EA; --red: #B3261E; --red-tint: #FBE4E2;
  --r: 24px; --gap: 12px;
  --enter: cubic-bezier(.2, .8, .2, 1); --exit: cubic-bezier(.4, 0, 1, 1); --move: cubic-bezier(.4, 0, .2, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.noscript, .boot { padding: 40px 20px; text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid var(--brand-tint); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.02em; font-weight: 800; }
.muted { color: var(--muted); } .small { font-size: 13px; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0; }
strong { font-weight: 700; color: var(--brand); }

/* ---------- Shell: sidebar on wide screens, bottom tabs on phones ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100%; }
.side { position: sticky; top: 0; height: 100vh; background: var(--ground); color: var(--brand); border-right: 1px solid var(--line-2); display: flex; flex-direction: column; padding: 20px 14px; gap: 6px; }
/* Sidebar: logo and Settings stay put, only the middle scrolls; groups have a heading, a wider gap and a thin line. */
.side-mid { flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 14px; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.grp { display: grid; gap: 2px; }
.grp + .grp { border-top: 1px solid var(--line-2); padding-top: 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 800; font-size: 17px; }
.brand img { height: 42px; width: auto; display: block; }
.side h4 { margin: 0 12px 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
/* Other links in grey ink, so the current page (Klein on a soft tint, crimson bar) stands out. */
.side a { position: relative; display: flex; align-items: center; gap: 12px; color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 12px; font-weight: 500; }
.side a svg { width: 20px; height: 20px; flex: none; }
.side a:hover { background: var(--surface); color: var(--brand); }
.side a[aria-current="page"] { background: var(--brand-tint); color: var(--brand); font-weight: 700; }
.side a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--accent); }
/* Inside a subject only the subject is white; Subjects gets a soft highlight as the section you are in. */
.side a.up { background: var(--surface); color: var(--brand); }
.side .bottom { border-top: 1px solid var(--line-2); padding-top: 12px; display: grid; gap: 2px; }
.who { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 13px; color: var(--ink); }
.who img, .who span.av { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); color: #fff; display: grid; place-items: center; }
main { min-width: 0; padding: 28px clamp(16px, 4vw, 40px) 60px; max-width: 1080px; width: 100%; }
.tabs { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  main { padding: 18px 16px 110px; }
  .tabs { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface);
    border-top: 1px solid var(--line-2); padding: 8px 4px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .tabs a { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); text-decoration: none; }
  .tabs a .ind { width: 60px; height: 32px; display: grid; place-items: center; border-radius: 16px; }
  .tabs a svg { width: 22px; height: 22px; }
  .tabs a[aria-current="page"] { color: var(--brand); font-weight: 700; }
  .tabs .liquid { position: absolute; top: 8px; height: 32px; width: 60px; border-radius: 16px; background: var(--accent-tint); }
}
.topline { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.topline h1 { font-size: clamp(22px, 3vw, 28px); flex: 1; }
/* F2 hero band (25 Nov): the page heading sits in a Klein band with the frost logo; the next block overlaps its bottom edge by 30px.
   The band runs to the right edge of the window (shadow + clip) while the content stays 1080px wide. */
.band { --px: clamp(16px, 4vw, 40px); background: var(--ground); color: var(--ink); margin: -28px calc(-1 * var(--px)) 0; padding: 22px var(--px) 54px;
  box-shadow: 0 0 0 100vmax var(--ground); clip-path: inset(0 -100vmax 0 0); }
.band-logo img { display: block; height: 34px; width: auto; margin-bottom: 18px; }
.band .topline { margin-bottom: 14px; }
.band h1 { color: var(--brand); }
.band h1::after { content: ""; display: block; width: 44px; height: 4px; border-radius: 2px; background: var(--accent); margin-top: 10px; }
.band p.muted { color: var(--muted); margin-bottom: 0; }
.band .subjhead a, .band .subjhead span { color: var(--muted); } .band .subjhead a:hover, .band .subjhead b { color: var(--brand); }
.band + *, .band + .ltabs.subj { position: relative; margin-top: -30px; }
@media (max-width: 860px) { .band { --px: 16px; margin-top: -18px; } .band-logo img { height: 28px; margin-bottom: 14px; } }
.crumb { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 6px; }

/* ---------- Press bounce + ripple (script adds them to .press) ---------- */
.press { position: relative; overflow: hidden; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .18; transform: scale(0); pointer-events: none; }
.btn { border: 0; border-radius: 16px; min-height: 48px; padding: 0 20px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.navy { background: var(--brand); color: var(--on-brand); }
.btn.ghost { background: var(--surface); color: var(--brand); border: 1.5px solid var(--line); }
.btn.white { background: #fff; color: #002FA7; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: default; }
.chip { border: 1.5px solid var(--line); background: var(--surface); border-radius: 99px; padding: 8px 14px; font-weight: 600; font-size: 14px; color: var(--ink); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ---------- Bento ---------- */
.bento { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.cell { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 18px; min-width: 0; display: flex; flex-direction: column; gap: 6px; min-height: 136px; text-decoration: none; color: inherit; }
.cell .cap { font-size: 13px; color: var(--muted); font-weight: 600; }
.cell .big { font-size: 60px; line-height: .95; color: var(--brand); }
.span2 { grid-column: span 2; } .span4 { grid-column: 1 / -1; } .tall { grid-row: span 2; }
@media (max-width: 860px) { .bento { grid-template-columns: repeat(2, 1fr); } .span4, .span2-m { grid-column: 1 / -1; } }
.hero { position: relative; color: #fff; border: 0; background: linear-gradient(150deg, var(--panel) 0%, var(--panel-2) 100%);
  box-shadow: 0 20px 44px -18px rgba(224, 36, 94, .45); justify-content: space-between; padding: 24px; }
.hero::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(135deg, var(--accent), transparent 55%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.hero .cap { color: #C9D3E8; }
.hero .due { font-size: clamp(64px, 9vw, 88px); line-height: .9; color: #fff; }
.hero .due + span { font-size: 18px; font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.14); }
.dots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-top: auto; }
.dots i { aspect-ratio: 1; border-radius: 50%; background: var(--brand-tint); transition: background .25s var(--enter); }
.dots i.on { background: var(--accent); }
.strip { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 8px; }
.strip::before { content: ""; position: absolute; left: 7%; right: 7%; top: 9px; height: 2px; background: var(--line); }
.stop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.stop i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.stop.done i { background: var(--brand); border-color: var(--brand); }
.stop.today i { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.stop.today { color: var(--ink); font-weight: 800; }
.ring { position: relative; width: 64px; height: 64px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; }
.unitcell { flex-direction: row; align-items: center; gap: 14px; min-height: 104px; }
.unitcell h3 { font-size: 16px; }
.stagger > *, .stagger > .stats > * { animation: rise .42s var(--enter) both; animation-delay: calc(var(--i, 0) * 50ms); }
/* Spring: cards rise, overshoot by 3px, then settle. */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } 60% { opacity: 1; transform: translateY(-3px); } }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-head h2 { font-size: 18px; }

/* ---------- Skeleton ---------- */
.skel { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 18px; display: grid; gap: 12px; }
.skel i { display: block; height: 14px; border-radius: 7px; animation: shimmer 1.4s linear infinite;
  background: linear-gradient(90deg, var(--brand-tint) 30%, var(--surface-2) 50%, var(--brand-tint) 70%) 0 0 / 300% 100%; }
/* Shimmer: a light sweep across loading placeholders. */
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- Lists ---------- */
.list { display: grid; gap: 10px; }
.row { background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.row .code { font-weight: 800; color: var(--accent-ink); min-width: 32px; }
.row .t { flex: 1; min-width: 0; } .row .t b { display: block; color: var(--brand); }
.bar { height: 6px; border-radius: 3px; background: var(--brand-tint); overflow: hidden; width: 90px; flex: none; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s var(--move); }

/* ---------- Lesson page ---------- */
.lesson-head { background: var(--panel); color: #fff; border-radius: var(--r); padding: 24px; display: grid; gap: 8px; }
.lesson-head .kick { color: var(--accent); font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.lesson-head h1 { font-size: clamp(24px, 3.4vw, 34px); color: #fff; }
.lesson-head p { margin: 0; color: #D5DDEC; max-width: 62ch; }
.lesson-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; }
.block { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); margin-top: 12px; overflow: hidden; }
.block > summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--brand); }
.block > summary::-webkit-details-marker { display: none; }
.block > summary .tag { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-tint); padding: 3px 8px; border-radius: 6px; }
.block > summary .chev { margin-left: auto; transition: transform .3s var(--move); color: var(--muted); }
.block[open] > summary .chev { transform: rotate(90deg); }
.block .body { padding: 0 18px 18px; display: grid; gap: 12px; animation: rise .25s var(--enter); }
.block .body p { margin: 0; max-width: 70ch; }
.bigidea { background: var(--accent-tint); border-left: 0; border-radius: 18px; padding: 18px; font-size: 18px; font-weight: 600; color: var(--brand); }
.bigidea small { display: block; font-size: 14px; font-weight: 500; color: var(--ink); margin-top: 6px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.cards > div { background: var(--brand-tint); border-radius: 16px; padding: 14px; }
.cards > div b { display: block; color: var(--brand); margin-bottom: 4px; }
ul.b { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line-2); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 14px; }
th { background: var(--panel); color: #fff; text-align: left; padding: 10px 12px; font-weight: 700; }
td { padding: 10px 12px; border-top: 1px solid var(--line-2); vertical-align: top; }
tr:nth-child(even) td { background: var(--surface-2); }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.compare > div { border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; }
.compare > div:first-child { border-color: var(--brand); } .compare > div:nth-child(2) { border-color: var(--accent); }
.compare h4 { margin: 0 0 8px; color: var(--brand); }
ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 8px; }
ol.steps li { counter-increment: s; display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: start; }
ol.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--panel); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.dodont { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.dodont > div { border-radius: 16px; padding: 14px; }
.dodont .do { background: var(--green-tint); } .dodont .dont { background: var(--red-tint); }
.dodont h4 { margin: 0 0 6px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.scenario { background: var(--brand-tint); border-radius: 16px; padding: 14px; }
.diagram { background: #fff; border: 1px solid var(--line-2); border-radius: 16px; padding: 10px; overflow-x: auto; }
.diagram svg { display: block; width: 100%; height: auto; min-width: 480px; }
.chart svg { width: 100%; height: auto; display: block; }
.reveal { border: 1.5px dashed var(--line); border-radius: 14px; padding: 12px 14px; }
.reveal button { background: none; border: 0; color: var(--accent-ink); font-weight: 700; padding: 0; cursor: pointer; }
.reveal .ans { margin-top: 8px; animation: rise .25s var(--enter); }
textarea { width: 100%; min-height: 110px; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; resize: vertical; background: var(--surface); }
textarea:focus { border-color: var(--brand); outline: none; }

/* ---------- Questions ---------- */
.q { display: grid; gap: 10px; }
.q .stem { font-size: 18px; font-weight: 600; color: var(--brand); }
.choice { width: 100%; text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; min-height: 58px; font-weight: 500; }
.choice .dot { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 800; color: var(--muted); position: relative; transition: background .2s, border-color .2s; }
.choice .dot svg { position: absolute; width: 18px; height: 18px; }
.choice.correct { border: 2px solid var(--green); background: var(--green-tint); }
.choice.correct .dot { background: var(--green); border-color: var(--green); color: transparent; }
.choice.wrong { border: 2px solid var(--red); background: var(--red-tint); }
.choice[aria-disabled="true"] { cursor: default; }
.draw path { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .2s var(--enter); }
.draw.drawn path { stroke-dashoffset: 0; }
.why { background: var(--brand-tint); border-radius: 14px; padding: 12px 14px; animation: rise .25s var(--enter); }
.verdict { font-weight: 800; }
.verdict.ok { color: var(--green); } .verdict.no { color: var(--red); }
.progress { height: 8px; border-radius: 4px; background: var(--brand-tint); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s var(--move); }

/* ---------- Review deck ---------- */
.deck { position: relative; height: 320px; max-width: 560px; margin: 8px auto 0; }
.deck > .ghost, .deck > .top { position: absolute; inset: 0; transform-origin: 50% 100%; }
.deck > .ghost { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); }
.deck > .top { touch-action: pan-y; }
.flip { position: absolute; inset: 0; perspective: 1200px; cursor: pointer; }
.flip-inner { position: absolute; inset: 0; transition: transform .46s var(--move); transform-style: preserve-3d; }
.flip.on .flip-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 24px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 4px 14px rgba(20, 33, 61, .07); overflow: auto; }
.face.back { transform: rotateY(180deg); }
.face .term { font-size: clamp(26px, 4vw, 34px); font-weight: 800; color: var(--brand); }
.face .tagline { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.face .def { font-size: 19px; line-height: 1.45; }
.rate { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 560px; margin: 16px auto 0; }
.rate .btn { min-height: 56px; border-radius: 18px; }
.btn.practice { background: var(--surface); color: var(--accent-ink); border: 2px solid var(--accent); }
.center { text-align: center; }
.star { background: none; border: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.star svg { width: 24px; height: 24px; }
.star[aria-pressed="true"] { color: var(--accent); }
.star[aria-pressed="true"] svg { fill: currentColor; }
.burst { position: relative; display: inline-grid; place-items: center; }
.particle { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); pointer-events: none; }

/* ---------- Bottom sheet (quiz setup) ---------- */
.scrim { position: fixed; inset: 0; background: #0B1428; opacity: 0; pointer-events: none; z-index: 50; transition: opacity .3s var(--move); }
.scrim.on { opacity: .45; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; top: 0; bottom: 0; z-index: 51; background: var(--surface); border-radius: 28px 28px 0 0; padding: 0 20px 24px; transform: translateY(110%); display: flex; flex-direction: column; gap: 16px; max-width: 720px; margin: 0 auto; touch-action: none; box-shadow: 0 -10px 30px rgba(11,20,40,.2); }
.sheet.anim { transition: transform .3s var(--move); }
.handle { padding: 12px 0 2px; display: grid; place-items: center; cursor: grab; }
.handle i { width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .help { font-size: 13px; color: var(--muted); margin-top: 6px; }
select { width: 100%; min-height: 48px; border: 1.5px solid var(--line); border-radius: 14px; padding: 0 12px; background: var(--surface); }
.radios { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Card expand overlay ---------- */
.expander { position: fixed; z-index: 60; border-radius: var(--r); pointer-events: none; }
.dim { position: fixed; inset: 0; background: #0B1428; opacity: 0; z-index: 59; pointer-events: none; }

/* ---------- Sign-in ---------- */
#app { min-height: 100%; }
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, var(--brand-tint) 0, var(--ground) 60%); color: var(--ink); }
.gate .panel { width: min(520px, 100%); display: grid; gap: 18px; }
.gate .brand img { height: 54px; }
.gate h1 { font-size: clamp(30px, 6vw, 44px); color: var(--brand); }
.gate h1 span { color: var(--accent); }
.gate p { margin: 0; color: var(--muted); font-size: 16px; }
.gate ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.gate li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); font-weight: 600; }
.gate li b { color: var(--accent); }
.gbtn { background: #fff; color: #1F1F1F; border: 1.5px solid var(--line); border-radius: 16px; min-height: 54px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 12px; }
.gbtn svg { width: 20px; height: 20px; }
.gate .fine { font-size: 13px; color: var(--muted); }
.gate .fine a { color: var(--brand); }
.err { background: var(--red-tint); color: var(--red); padding: 10px 12px; border-radius: 12px; font-weight: 600; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 16px); background: var(--panel); color: #fff; padding: 12px 16px; border-radius: 14px; font-weight: 600; opacity: 0; z-index: 70; pointer-events: none; max-width: calc(100% - 32px); }
@media (min-width: 861px) { .toast { bottom: 28px; } }
.prose { max-width: 70ch; display: grid; gap: 12px; }
.prose h2 { font-size: 18px; margin-top: 10px; }
.prose p, .prose ul { margin: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Search (every page), Course table of contents, lesson tabs */
.search { margin-bottom: 18px; }
.search input { width: 100%; min-height: 48px; border: 1.5px solid var(--line); border-radius: 16px; padding: 0 16px 0 44px; font: inherit; color: var(--ink); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='%235B6478' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#results:not(:empty) { background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 8px; margin-top: 8px; display: grid; gap: 2px; max-height: 60vh; overflow: auto; box-shadow: 0 8px 24px rgba(20,33,61,.08); }
#results h4 { margin: 8px 10px 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
#results p { margin: 8px 10px; }
.hit { display: flex; gap: 12px; padding: 10px; border-radius: 12px; text-decoration: none; color: inherit; }
.hit:hover, .hit:focus-visible { background: var(--brand-tint); }
.hit .code { font-weight: 800; color: var(--accent-ink); min-width: 32px; }
.hit b { display: block; color: var(--brand); }
.unit .section-head { flex-wrap: wrap; }
.unit-link { color: inherit; text-decoration: none; }
.unit-link:hover { color: var(--accent-ink); text-decoration: underline; }
.ltabs { display: flex; gap: 4px; background: var(--brand-tint); padding: 4px; border-radius: 16px; margin: 14px 0 6px; position: sticky; top: 8px; z-index: 5; }
.ltabs a { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; font-weight: 700; color: var(--brand); text-decoration: none; text-align: center; }
.ltabs a[aria-current="page"] { background: var(--surface); box-shadow: 0 1px 3px rgba(20,33,61,.15); }
.lesson-video { margin: 14px 0 0; border-radius: var(--r); overflow: hidden; background: #F3EEE3; box-shadow: 0 1px 3px rgba(20,33,61,.15); }
.lesson-video video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #F3EEE3; }
.terms { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.terms li { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 12px 16px; display: grid; gap: 2px; scroll-margin: 80px; }
.terms li strong { color: var(--brand); }
.terms li.hl { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
@media (max-width: 600px) { /* Course reads like a compact table of contents on phones */
  .toc { gap: 6px; }
  .toc .row { padding: 11px 14px; border-radius: 14px; }
  .toc .row .t .small, .toc .row .bar { display: none; }
}

/* ---------- Viriens: subject header above each subject's tabs ---------- */
.subjhead { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.subjhead a { color: var(--muted); text-decoration: none; } .subjhead a:hover { color: var(--brand); }
.subjhead b { color: var(--brand); }
.subjcard .ic { width: 44px; height: 44px; border-radius: 14px; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; }
.subjcard .ic svg { width: 24px; height: 24px; }
.ltabs.subj { position: static; margin: 0 0 16px; } /* lesson pages keep their own sticky Notes · Terms · Practice bar */

/* ---------- Access and Admin (Phase 3) ---------- */
.pill.soft { background: var(--accent-tint); color: var(--accent-ink); }
.btn.danger { color: var(--red); }
.cell.empty { min-height: 0; align-items: flex-start; }
.cell.empty b { color: var(--brand); }
.adm-in { width: 100%; min-height: 44px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--surface); }
.adm-in:focus { border-color: var(--brand); outline: none; }
input[type="date"].adm-in { width: auto; }
.adm-form { gap: 10px; }
.adm-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.adm-row { flex-wrap: wrap; }
.adm-row .t { min-width: 200px; }
.adm-student { gap: 10px; }
.adm-acc { display: grid; gap: 4px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.adm-acc b, .adm-prog b { color: var(--brand); }
.adm-prog { display: grid; gap: 10px; background: var(--ground); border-radius: 14px; padding: 12px; }
.adm-prog > div { display: grid; gap: 2px; }
.adm-toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--panel); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 50; max-width: calc(100vw - 32px); }
/* My notes: a lesson's mind map (sizes match the phone app). */
.mmtools { display: flex; gap: 8px; margin: 12px 0; }
.mmtools .chip { min-width: 48px; min-height: 40px; }
.mmwrap { overflow: auto; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: var(--r); max-height: 72vh; }
.mmsize { position: relative; }
.mmmap { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.mmmap svg { position: absolute; inset: 0; max-width: none; fill: none; stroke: var(--line); stroke-width: 1.5; }
.mm { position: absolute; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 10px; border-radius: 14px; font-size: 13px; line-height: 1.25; text-decoration: none; }
.mm span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mm.root { background: var(--panel); color: #fff; font-weight: 800; }
.mm.card { background: var(--surface); color: var(--brand); border: 1.5px solid var(--brand); font-weight: 700; }
.mm.card:hover { background: var(--brand-tint); }
.mm.point { background: var(--ground); color: var(--ink); border: 1px solid var(--line-2); }

/* ---------- Lesson notes, slide look (23 Nov): bigger reading text, key terms marked, navy section bars ---------- */
.lesson-head { position: relative; overflow: hidden; }
.lesson-head::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; border: 28px solid var(--accent); opacity: .9; pointer-events: none; }
.lesson-head .kick { justify-self: start; background: var(--accent); color: #fff; padding: 4px 12px; border-radius: 99px; }
.lesson-head h1, .lesson-head p { position: relative; z-index: 1; max-width: calc(100% - 120px); }
.notes { font-size: 19px; line-height: 1.7; }
.notes .block > summary { padding: 18px 20px; font-size: 20px; }
.notes .block[open] > summary { background: var(--panel); color: #fff; }
.notes .block[open] > summary .chev { color: #fff; }
.notes .block > summary .tag { background: var(--accent); color: #fff; }
.notes .block .body { padding: 20px 22px 24px; gap: 18px; max-width: 74ch; }
.notes .block .body h3 { font-size: 23px; color: var(--brand); margin: 10px 0 0; }
.notes ul.b { gap: 10px; } .notes ul.b li::marker { color: var(--accent); }
.notes .bigidea { background: var(--panel); color: #fff; font-size: 23px; line-height: 1.45; padding: 24px; }
.notes .bigidea strong { color: #FFB3C9; }
.notes .bigidea small { color: #D5DDEC; font-size: 17px; }
.notes .cards > div { padding: 16px; }
.notes ol.steps li::before { background: var(--accent); color: #fff; }
.notes table { font-size: 17px; }
.keyterms { margin-top: 12px; }
.keyterms > summary { cursor: pointer; font-weight: 700; color: var(--brand); width: max-content; }
.keyterms > div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.keyterms a { background: var(--surface); border: 1.5px solid var(--brand); color: var(--brand); font-weight: 700; font-size: 14px; padding: 5px 12px; border-radius: 99px; text-decoration: none; }
.keyterms a:hover { background: var(--brand); color: var(--on-brand); }
@media (max-width: 600px) { .notes { font-size: 17px; } .lesson-head::after { width: 130px; height: 130px; border-width: 18px; right: -50px; top: -50px; } .lesson-head h1, .lesson-head p { max-width: calc(100% - 60px); } }

/* ---------- Printable unit book (admins only) ---------- */
.booktools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 16px; max-width: 900px; margin: 0 auto; }
.book { max-width: 900px; margin: 0 auto; padding: 0 16px 60px; font-size: 16px; line-height: 1.6; }
.book .cover { background: var(--panel); color: #fff; border-radius: var(--r); padding: 60px 40px; position: relative; overflow: hidden; }
.book .cover::after { content: ""; position: absolute; right: -80px; bottom: -80px; width: 300px; height: 300px; border-radius: 50%; border: 40px solid var(--accent); }
.book .cover .kick { background: var(--accent); color: #fff; font-weight: 800; padding: 4px 12px; border-radius: 99px; letter-spacing: .08em; text-transform: uppercase; font-size: 13px; }
.book .cover h1 { color: #fff; font-size: 40px; margin: 18px 0 8px; position: relative; z-index: 1; }
.book .cover p { color: #D5DDEC; font-size: 18px; margin: 0; }
.book .lesson { margin-top: 28px; }
.book .notes { font-size: 16px; display: grid; gap: 12px; }
.book .notes section { display: grid; gap: 10px; }
.book h2.sec { display: flex; align-items: center; gap: 10px; background: var(--panel); color: #fff; font-size: 18px; padding: 10px 14px; border-radius: 12px; margin: 16px 0 4px; }
.book h2.sec .tag { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--accent); color: #fff; padding: 3px 8px; border-radius: 6px; }
.book h3 { color: var(--brand); font-size: 18px; margin: 8px 0 0; }
.book p { margin: 0; }
.book .notes .bigidea { font-size: 18px; padding: 18px; }
.book .diagram svg { min-width: 0; }
.book table { min-width: 0; font-size: 14px; }
.pq { break-inside: avoid; display: grid; gap: 6px; }
.pq .opts { margin: 0; padding-left: 28px; display: grid; gap: 2px; }
.lines { height: 90px; background: repeating-linear-gradient(transparent 0 29px, var(--line) 29px 30px); }
.lines.tall { height: 210px; }
.key h2 { color: var(--brand); font-size: 20px; margin: 24px 0 6px; border-bottom: 2px solid var(--accent); padding-bottom: 4px; }
.key .keylist { padding-left: 32px; display: grid; gap: 6px; }
.key p { margin: 4px 0; }
@media print {
  @page { size: A4; margin: 14mm; }
  html, body { background: #fff; height: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .noprint, .skip { display: none !important; }
  .book { max-width: none; padding: 0; font-size: 11.5pt; }
  .book .cover { break-after: page; padding: 120px 40px; }
  .book .lesson { break-before: page; margin-top: 0; }
  .book h2.sec, .book h3 { break-after: avoid; }
  .book .keep, .book .pq, .key .keylist li, .book figure, .book .tablewrap { break-inside: avoid; } /* owner: never split a note or a question across pages */
  .book .lesson-head::after { display: none; }
}

/* ---------- Frosted glass (home page): soft Klein and crimson light behind see-through, blurred cards ---------- */
@media screen {
  .glass { position: relative; isolation: isolate; }
  .glass::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(40% 55% at 18% 30%, rgba(0, 47, 167, .70), transparent 75%),
      radial-gradient(35% 50% at 85% 70%, rgba(224, 36, 94, .65), transparent 75%),
      radial-gradient(30% 45% at 60% 10%, rgba(125, 150, 255, .70), transparent 75%); }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass .cell:not(.hero) { background: rgba(255, 255, 255, .32); border-color: rgba(255, 255, 255, .8);
      -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
      box-shadow: 0 8px 28px -14px rgba(5, 11, 36, .25); }
  }
}
/* Some people turn off see-through effects for readability: give them plain cards. */
@media (prefers-reduced-transparency: reduce) { .glass::before { display: none; } .glass .cell:not(.hero) { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; } }
/* Paper Shaders mesh gradient behind the home page (shader-bg.js); it replaces the still glows once it runs. */
.shader-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.has-shader .glass::before { display: none; }
.has-shader .section-head a { color: var(--ink); }
/* Small grey captions on the glass need to be a little darker over the vivid colours. */
.has-shader .glass .cell:not(.hero) :is(.cap, .muted) { color: #3A4360; }
@media print { .shader-bg { display: none; } }

/* ---------- Hover Lift + Spotlight (computers with a mouse only; phones keep the tap bounce) ---------- */
@media (hover: hover) and (pointer: fine) {
  .cell { position: relative; transition: translate .2s var(--enter), box-shadow .2s var(--enter); }
  .cell::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .2s var(--enter);
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(0, 47, 167, .09), transparent 70%); }
  .cell.hero::after { background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .14), transparent 70%); }
  .cell:hover::after { opacity: 1; }
  a.cell:hover, .cell.press:hover { translate: 0 -3px; box-shadow: 0 16px 32px -16px rgba(5, 11, 36, .35); }
  .cell.hero:hover { translate: 0 -3px; box-shadow: 0 24px 48px -18px rgba(224, 36, 94, .55); }
}

/* ---------- Scrolling (motion.js adds .rv / .readbar / .totop) ---------- */
/* Scroll reveal: things below the fold rise in with a small spring when scrolled to. */
.rv { opacity: 0; translate: 0 16px; transition: opacity .5s var(--enter), translate .6s cubic-bezier(.34, 1.4, .64, 1); }
.rv.in { opacity: 1; translate: 0 0; }
/* Reading progress bar: a crimson bar down the right edge that grows as you scroll and gets thicker towards the end
   (2px at the start, 8px at the bottom), tapering like a wedge. motion.js sets --p from 0 to 1. */
.readbar { --p: 0; position: fixed; top: 0; right: 0; z-index: 60; pointer-events: none; height: calc(100vh * var(--p)); width: calc(2px + 6px * var(--p));
  background: linear-gradient(to bottom, #F28AAA, var(--accent)); clip-path: polygon(calc(100% - 2px) 0, 100% 0, 100% 100%, 0 100%);
  border-bottom-left-radius: 4px; opacity: 0; transition: opacity .2s; }
.readbar.on { opacity: 1; }
/* Back to top: a small glass button after you scroll down. */
.totop { position: fixed; right: 20px; bottom: 24px; z-index: 40; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: var(--brand); border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 75%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 10px 24px -12px rgba(5, 11, 36, .4);
  opacity: 0; translate: 0 12px; pointer-events: none; transition: opacity .25s var(--enter), translate .3s var(--enter); }
.totop.on { opacity: 1; translate: 0 0; pointer-events: auto; }
@media (max-width: 860px) { .totop { right: 16px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); } }
/* Sticky frosted tabs: subject tabs stay at the top (except on lessons, which have their own sticky bar). */
.ltabs { background: color-mix(in srgb, var(--brand-tint) 78%, transparent); -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%); }
main:not(:has(.ltabs:not(.subj))) .ltabs.subj { position: sticky; top: 8px; z-index: 20; }
/* Stacking cards: on the AP Psychology Progress page the unit rows pile up under the tabs as you scroll. */
.list.stack > .row { position: sticky; top: calc(76px + var(--i, 0) * 6px); box-shadow: 0 -8px 20px -14px rgba(5, 11, 36, .45); }
/* Swipe rows with a peek: on phones the four number cards scroll sideways and show the edge of the next one. */
.stats { display: contents; }
@media (max-width: 600px) {
  .stats { display: flex; grid-column: 1 / -1; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px;
    margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none; }
  .stats::-webkit-scrollbar { display: none; }
  .stats > .cell { flex: 0 0 64%; scroll-snap-align: start; }
}
/* Smooth page changes between sections of the site (browsers that support it). */
@view-transition { navigation: auto; }
/* Parallax: the crimson circle on lesson headers drifts slower than the text. */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .lesson-head::after { animation: drift linear both; animation-timeline: scroll(root); animation-range: 0 600px; }
  }
}
@keyframes drift { to { translate: 0 160px; } }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
@media print { .rv { opacity: 1 !important; translate: none !important; } .readbar, .totop { display: none !important; } .list.stack > .row { position: static; } }
/* SAT test mode: picked answer and the numbered question list */
.choice.picked { border: 2px solid var(--accent); background: var(--brand-tint); }
.choice.picked .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.qnav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.qnav button { width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.qnav button.done { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.qnav button[aria-current="true"] { border: 2px solid var(--accent); color: var(--brand); }
