/* ==========================================================================
   PediaRounds — design system
   Warm paper, ink navy, burgundy & gold. Lora for display, Poppins for UI.
   ========================================================================== */

@font-face { font-family: "Lora"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/lora-var.woff") format("woff"); }
@font-face { font-family: "Lora"; font-style: italic; font-weight: 400 700; font-display: swap; src: url("fonts/lora-italic-var.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/poppins-400.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/poppins-500.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/poppins-700.woff") format("woff"); }

:root {
  --paper: #FAF5EA;
  --paper-2: #F3EBDB;
  --card: #FFFDF7;
  --ink: #1B2E55;
  --ink-2: #4A5878;
  --ink-3: #7D8AA6;
  --line: rgba(27, 46, 85, 0.10);
  --line-2: rgba(27, 46, 85, 0.16);
  --burgundy: #7A1F2B;
  --burgundy-2: #9A2F3D;
  --gold: #C99A3B;
  --gold-2: #E0C870;
  --gold-3: #F6E7B8;
  --sticky: #FCEFB7;
  --green: #2F7A44;
  --green-bg: #E4F3E7;
  --red: #B9323E;
  --red-bg: #F9E3E4;
  --blue: #2E6BB8;
  --blue-bg: #E4EDF9;
  --amber: #D07C1B;
  --amber-bg: #FBEBD3;
  --purple: #6B3FA0;
  --purple-bg: #ECE4F6;
  --shadow-1: 0 1px 2px rgba(27,46,85,.06), 0 6px 18px -8px rgba(27,46,85,.18);
  --shadow-2: 0 2px 4px rgba(27,46,85,.06), 0 18px 40px -16px rgba(27,46,85,.28);
  --white: #fff;                       /* inputs, tiles, options */
  --white-hover: #FFFCF2;
  --tint: rgba(27,46,85,.07);          /* soft hover / chip backgrounds */
  --tint-2: rgba(27,46,85,.12);
  --solid: #1B2E55;                    /* solid navy surfaces with white text: buttons, tabs, toasts */
  --solid-2: #24396a;
  --solid-3: #2B4478;
  --highlight: #FFFBEC;                /* "you" rows, first place */
  --sticky-2: #FCE9A6;
  --banner-a: #FFF7DD; --banner-b: #FBEFC6; --banner-line: #EBD79B; --banner-ic: #8A6410;
  --ranked-fg: #6B4E10;
  --overlay: rgba(27,46,85,.35);
  --hot-a: #FDECC8; --hot-b: #FBD9A0;
  --radius: 18px;
  --radius-s: 12px;
  --font-ui: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Lora", Georgia, "Times New Roman", serif;
  --max: 1080px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper);
  font-family: var(--font-ui); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1200px 520px at 50% -180px, var(--glow-a, rgba(224,200,112,.35)), transparent 70%),
    radial-gradient(700px 400px at 100% 10%, var(--glow-b, rgba(122,31,43,.07)), transparent 70%);
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.11 0 0 0 0 0.18 0 0 0 0 0.33 0 0 0 .06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.18; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(30px, 5.2vw, 48px); }
h2 { font-size: clamp(22px, 3.2vw, 30px); }
h3 { font-size: 19px; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
.muted { color: var(--ink-2); }
.tiny { font-size: 12.5px; color: var(--ink-3); }
.serif { font-family: var(--font-display); }
.em { font-family: var(--font-display); font-style: italic; }

/* ---------- layout ---------- */
#app { position: relative; z-index: 1; }
.wrap { max-width: var(--max); margin: 0 auto; padding-inline: clamp(16px, 4vw, 32px); }
.page { padding-block: 22px 72px; animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.stack > * + * { margin-top: 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--topbar, rgba(250,245,234,.82)); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 14px; height: 62px; max-width: 1320px; }   /* v4.9: a wider lane for the eight items */
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.brand-name { display: grid; gap: 2px; line-height: 1; }
.brand .word { font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 22px; color: var(--burgundy); }
.brand .site { font-size: 10px; letter-spacing: .045em; color: var(--ranked-fg); font-weight: 500; }
/* v4.9: eight items — the nav takes what is left of the row and scrolls sideways (no scrollbar) rather than
   pushing the search, the gear and the account pill off the right edge on a 1280-wide laptop */
.nav { display: flex; gap: 4px; margin-left: 8px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.nav::-webkit-scrollbar { display: none; }
.topbar .wrap > .brand, .topbar .wrap > .iconbtn, .topbar .wrap > div { flex-shrink: 0; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; font-size: 14px; color: var(--ink-2); white-space: nowrap; transition: background .2s, color .2s; }
@media (max-width: 1300px) { .nav a { padding: 8px 9px; font-size: 13px; } }
@media (max-width: 1100px) { .nav { gap: 2px; } .nav a { padding: 8px 8px; } }
.nav a:hover, .nav a.active { background: var(--tint); color: var(--ink); }
.userpill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow-1); cursor: pointer; font-size: 14px; font-weight: 500;
}
.userpill .avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--burgundy), var(--gold)); color: #fff; font-weight: 700; font-size: 13px; font-family: var(--font-display); }
.userpill .caret { color: var(--ink-3); font-size: 11px; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-2); padding: 6px; z-index: 30; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.menu button:hover { background: var(--tint); }
.menu .head { padding: 10px 12px 6px; font-size: 12px; color: var(--ink-3); }
@media (max-width: 640px) { .nav { display: none; } }

/* ---------- v5.3: the bottom menu bar on phones (TAWNav in app.js and lib.js) ----------
   Home · Chapters · Booklets · Search · More, under 640px only. html.has-bnav is set while the bar is showing;
   --bnav-h is its height (with the iPhone home bar), and everything fixed to the bottom moves up by it. */
.bnav { display: none; }
@media (max-width: 640px) {
  html.has-bnav { --bnav-h: calc(58px + env(safe-area-inset-bottom, 0px)); }
  .bnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--bnav-h, 58px);
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: var(--topbar, rgba(250,245,234,.82)); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 18px -12px rgba(27,46,85,.25); transition: transform .25s var(--ease); }
  .bnav[hidden] { display: none; }
  html.bnav-typing .bnav { transform: translateY(110%); }          /* the keyboard is up */
  html.has-bnav body { padding-bottom: var(--bnav-h); }
  /* the offline bar is one to three lines: offline.js measures it into --offline-h */
  html.has-bnav.is-offline body, html.has-bnav.sync-wait body { padding-bottom: calc(var(--bnav-h) + var(--offline-h, 46px)); }
  html.has-bnav #offline-bar { bottom: var(--bnav-h); padding-bottom: 9px; }
  html.has-bnav .toast-wrap { bottom: calc(var(--bnav-h) + 12px); }
  html.has-bnav.is-offline .toast-wrap, html.has-bnav.sync-wait .toast-wrap { bottom: calc(var(--bnav-h) + var(--offline-h, 46px) + 10px); }
  html.has-bnav .pagepill { bottom: calc(var(--bnav-h) + 12px); }
  html.has-bnav #rail { bottom: calc(var(--bnav-h) + 12px); }
  html.has-bnav .hero-stage { min-height: calc(100svh - 62px - var(--bnav-h)); }
  /* the notes reader: the page counter, and "Back on page N" above it — both clear of the bar (and of the offline bar) */
  html.has-bnav .resumebub { bottom: calc(var(--bnav-h) + 64px); }
  html.has-bnav.is-offline .pagepill, html.has-bnav.sync-wait .pagepill { bottom: calc(var(--bnav-h) + var(--offline-h, 46px) + 10px); }
  html.has-bnav.is-offline .resumebub, html.has-bnav.sync-wait .resumebub { bottom: calc(var(--bnav-h) + var(--offline-h, 46px) + 60px); }
  /* the bar has Search, so the header doesn't need it — the signed-in header then fits a 375 px phone (bell + streak) */
  .topbar .wrap > a.iconbtn[href="#/search"] { display: none; }
  /* the account menu: the rows More already has are left out */
  html.has-bnav .menu .in-more { display: none; }
}
.bnav-i { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; padding: 6px 2px 4px;
  border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 11px; font-weight: 500; letter-spacing: .01em; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
.bnav-i .ic { width: 23px; height: 23px; transition: transform .15s var(--ease); }
.bnav-i span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bnav-i.on { color: var(--burgundy); font-weight: 600; }
.bnav-i.on::before { content: ""; position: absolute; top: 0; left: 32%; right: 32%; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
.bnav-i:active .ic { transform: scale(.88); }
.bnav-i:focus-visible { outline: 2px solid var(--gold); outline-offset: -5px; border-radius: 12px; }
/* More: a sheet that rises above the bar */
.bnav-bg { position: fixed; inset: 0; z-index: 28; background: var(--overlay); animation: fade .2s both; }
.bnav-sheet { position: fixed; left: 8px; right: 8px; bottom: calc(var(--bnav-h, 0px) + 8px); z-index: 29; max-height: calc(100svh - var(--bnav-h, 0px) - 90px); overflow-y: auto;
  padding: 10px 12px 14px; background: var(--card); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow-2); animation: bnav-up .3s var(--ease) both; }
.bnav-sheet:focus { outline: none; }
@keyframes bnav-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.bnav-top { display: flex; align-items: center; justify-content: space-between; padding: 0 0 8px 6px; }
.bnav-top b { font-family: var(--font-display); font-size: 18px; }
.bnav-top .iconbtn { margin-right: 0; border: 0; background: none; cursor: pointer; }
.bnav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bnav-it { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 82px; padding: 12px 6px; border-radius: 14px;
  background: var(--white); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 500; line-height: 1.25; text-align: center; -webkit-tap-highlight-color: transparent; }
.bnav-it .ic { width: 24px; height: 24px; color: var(--burgundy); }
.bnav-it:active { background: var(--tint); }
.bnav-it:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .bnav, .bnav-i .ic { transition: none; } .bnav-bg, .bnav-sheet { animation: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 999px; border: 1px solid transparent; background: var(--solid); color: #fff; font-weight: 500; font-size: 15px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .15s var(--ease), box-shadow .2s, background .2s, opacity .2s;
  box-shadow: 0 6px 16px -8px rgba(27,46,85,.5);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(27,46,85,.55); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { background: linear-gradient(135deg, var(--burgundy) 0%, #9B2A39 60%, #B8412F 100%); box-shadow: 0 10px 24px -10px rgba(122,31,43,.65); }
.btn.gold { background: linear-gradient(135deg, #B8882C, var(--gold) 55%, #E3BE63); color: #2B1E05; box-shadow: 0 10px 24px -10px rgba(201,154,59,.7); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); box-shadow: none; }
.btn.ghost:hover { background: var(--tint); }
.btn.soft { background: var(--tint); color: var(--ink); box-shadow: none; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 13.5px; }
.btn.block { width: 100%; white-space: normal; line-height: 1.35; padding-top: 12px; padding-bottom: 12px; }
.modal .btn.block { border-radius: 20px; }
.btn .ic { width: 18px; height: 18px; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 22px; }
.card.pad-s { padding: 16px; }
.card.lift { transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.card.lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.eyebrow { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; color: var(--gold); }
.chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .02em; border: 1px solid transparent; }
.chip.easy { background: var(--green-bg); color: var(--green); }
.chip.medium { background: var(--blue-bg); color: var(--blue); }
.chip.hard { background: var(--amber-bg); color: var(--amber); }
.chip.super { background: var(--purple-bg); color: var(--purple); }
.chip.ranked { background: var(--gold-3); color: var(--ranked-fg); }
.chip.practice { background: var(--tint); color: var(--ink-2); }
.chip.ok { background: var(--green-bg); color: var(--green); }
.chip.bad { background: var(--red-bg); color: var(--red); }
.seal { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 999px; background: linear-gradient(135deg, #F6E7B8, #E0C870); color: #5A4208; font-weight: 700; font-size: 12px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 4px 10px -6px rgba(201,154,59,.8); }
.seal .ic { width: 16px; height: 16px; }
.divider { height: 1px; background: var(--line); margin-block: 18px; }

/* ---------- hero ---------- */
.hero { padding-top: 20px; }
.hero h1 .accent { font-style: italic; color: var(--burgundy); }
.lede { max-width: 58ch; font-size: 17px; color: var(--ink-2); margin-top: 12px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
@media (max-width: 640px) { .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .stat { min-width: 0; padding: 9px 12px; } .stat b { font-size: 21px; } .stat:nth-child(odd):last-child { grid-column: span 2; } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow-1); min-width: 120px; }
.stat b { display: block; font-family: var(--font-display); font-size: 24px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--ink-3); }

/* ---------- sign-in ---------- */
.signin { position: relative; overflow: hidden; }
.signin::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(224,200,112,.55), transparent 65%); pointer-events: none; z-index: 0; }
.signin > * { position: relative; z-index: 1; }
.signin .copy p { margin-top: 8px; font-size: 14.5px; color: var(--ink-2); max-width: 46ch; }
@media (min-width: 760px) { .signin { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: start; } .signin form { margin-top: 0; } }
.field { display: block; margin-top: 14px; }
.field label, .field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--white); font: inherit; font-size: 16px; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201,154,59,.18); }
.input.error { border-color: var(--red); box-shadow: 0 0 0 4px rgba(185,50,62,.14); }
input[type="date"].input { -webkit-appearance: none; appearance: none; height: 46px; }
textarea.input { min-height: 140px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; }
.pin { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 260px; }
.pin input { text-align: center; font-size: 24px; font-weight: 600; letter-spacing: 0; padding: 8px 0; min-height: 56px; font-family: var(--font-display); }
.help { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }
.error-text { color: var(--red); font-size: 13px; font-weight: 500; margin-top: 8px; }

/* ---------- chapter cards ---------- */
.chapter { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "head ring" "body ring"; gap: 0 18px; align-items: start; position: relative; overflow: hidden; }
.chapter .chead { grid-area: head; }
.chapter .cbody { grid-area: body; }
.chapter .ringwrap { grid-area: ring; align-self: center; }
.chapter .num { font-family: var(--font-display); font-style: italic; font-size: 13px; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; }
.chapter h3 { margin-top: 4px; font-size: 21px; }
.chapter .desc { color: var(--ink-2); font-size: 14px; margin-top: 8px; }
.chapter .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.tile { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--white); text-decoration: none; font-size: 13.5px; font-weight: 500; transition: transform .15s var(--ease), background .2s, border-color .2s; }
.tile:hover { transform: translateY(-1px); border-color: var(--gold); background: var(--white-hover); }
.tile.disabled { opacity: .5; pointer-events: none; }
.tile .ic { width: 16px; height: 16px; color: var(--burgundy); }
.tile.quiz { background: var(--solid); color: #fff; border-color: var(--solid); }
.tile.quiz .ic { color: var(--gold-2); }
.tile.quiz:hover { background: var(--solid-2); }
.ring { position: relative; width: 84px; height: 84px; }
.ring svg { width: 84px; height: 84px; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--tint-2); stroke-width: 8; }
.ring .bar { fill: none; stroke: url(#ringGrad); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.ring .label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1; }
.ring .label small { display: block; font-family: var(--font-ui); font-size: 10px; color: var(--ink-3); font-weight: 500; margin-top: 3px; letter-spacing: .05em; }
.ring.idle .label { color: var(--ink-3); font-size: 12px; font-family: var(--font-ui); font-weight: 500; }
@media (max-width: 520px) { .chapter { grid-template-areas: "head ring" "body body"; gap: 0 12px; } .chapter .ringwrap { align-self: start; } .chapter h3 { font-size: 19px; } }

/* ---------- v5.3: one card per chapter, opening to its parts; a row of chips jumps to one ---------- */
.chchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chchip { position: relative; min-height: 38px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: border-color .2s, background .2s; }
.chchip:hover { border-color: var(--gold); }
.chchip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.chchip .dot { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.chgroups { display: grid; gap: 12px; }
.chgroup { padding: 0; scroll-margin-top: 78px; }
.chgroup > summary { list-style: none; cursor: pointer; padding: 16px 18px; border-radius: var(--radius); -webkit-tap-highlight-color: transparent; }
.chgroup > summary::-webkit-details-marker { display: none; }
.chgroup > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.chg-sum { display: flex; align-items: center; gap: 12px; }
.chg-txt { flex: 1; min-width: 0; }
.chg-txt .num { font-family: var(--font-display); font-style: italic; font-size: 13px; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; }
.chg-txt h3 { margin-top: 3px; font-size: 20px; }
.chg-meta { margin-top: 4px; font-size: 13px; color: var(--ink-3); }
.chg-meta .hot { color: var(--amber); font-weight: 600; }
.chg-bar { margin-top: 10px; height: 6px; max-width: 420px; }
.chg-side { display: flex; align-items: center; gap: 10px; flex: none; }
.chg-chev { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--tint); color: var(--ink-2); transition: transform .25s var(--ease), background .2s; }
.chg-chev .ic { width: 18px; height: 18px; }
.chgroup > summary:hover .chg-chev { background: var(--tint-2); }
.chgroup[open] .chg-chev { transform: rotate(180deg); }
.chg-parts { display: grid; padding: 4px 18px 14px; border-top: 1px solid var(--line); }
.chgroup[open] .chg-parts { animation: rise .35s var(--ease) both; }
.chpart { display: grid; gap: 10px; margin: 0 -10px; padding: 14px 10px; border-radius: 14px; border-bottom: 1px dashed var(--line-2); }
.chpart:last-of-type { border-bottom: 0; }
.chpart.flash { animation: chflash 1.7s var(--ease); }
@keyframes chflash { 0%, 45% { background: var(--gold-3); } 100% { background: transparent; } }
.chp-head { display: flex; align-items: flex-start; gap: 14px; }
.chp-ring { flex: none; color: inherit; text-decoration: none; }
.chp-ring .ring, .chp-ring .ring svg { width: 66px; height: 66px; }
.chp-ring .ring .label { font-size: 15px; }
.chp-ring .ring.idle .label { font-size: 11px; }
.chp-txt { flex: 1; min-width: 0; }
.chp-txt .num { font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.chp-txt h4 { margin: 2px 0 0; font-family: var(--font-display); font-size: 17px; font-weight: 600; line-height: 1.25; }
.chp-txt h4 a { text-decoration: none; }
.chp-txt h4 a:hover { color: var(--burgundy); }
.chp-txt .desc { margin-top: 4px; font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chpart .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chg-shared { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.chg-shared + .chg-shared { border-top: 0; padding-top: 4px; }
/* v5.3.5: the chapter summary tile — gold-edged so it reads as the chapter's one-stop revision sheet */
.tile.sum { border-color: var(--gold); }
.tile.sum .ic { color: var(--gold); }   /* v5.3.3: the self-assessment row right under the booklet row — one rule, not two */
@media (min-width: 900px) { .chg-parts { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); column-gap: 28px; } .chpart { border-bottom: 0; } .chg-shared { grid-column: 1 / -1; } }
@media (max-width: 520px) { .chgroup > summary { padding: 14px 14px; } .chg-parts { padding: 2px 14px 12px; } .chg-txt h3 { font-size: 18.5px; } .chp-head { gap: 12px; } }
@media (prefers-reduced-motion: reduce) { .chgroup[open] .chg-parts, .chpart.flash { animation: none; } .chg-chev { transition: none; } }

/* ---------- v5.3: the signed-in home — a short greeting instead of the cover, and the four banners as small tiles ---------- */
.home-hi { padding-top: 4px; }
.home-hi h1 { margin-top: 6px; font-size: clamp(28px, 4.6vw, 42px); }
.home-hi h1 .accent { font-style: italic; color: var(--burgundy); }
.hi-line { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.hi-line b { font-family: var(--font-display); font-size: 16px; color: var(--ink); }
.home-hi + .resume { margin-top: 16px; }
.qtiles { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; }
/* v5.3.6: six or more shortcuts (ELOOPs and Summaries joined the booklets) — two rows of three on a wide screen, not six squeezed tiles */
@media (min-width: 861px) { .qtiles:has(> .qtile:nth-child(6)) { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.qtile { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  color: var(--ink); text-decoration: none; transition: transform .15s var(--ease), box-shadow .2s; }
.qtile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.qtile .ic-wrap { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--tint); }
.qtile .ic-wrap .ic { width: 19px; height: 19px; color: var(--burgundy); }
.qtile .qt { display: flex; flex-direction: column; min-width: 0; }
.qtile b, .qtile .qt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qtile b { font-size: 14px; font-weight: 600; line-height: 1.25; }
.qtile .qt span { font-size: 12px; color: var(--ink-3); }
.qtile .qt span.hot { color: var(--amber); font-weight: 600; }
@media (max-width: 860px) { .qtiles { grid-auto-flow: row; grid-template-columns: 1fr 1fr; } .qtile:nth-child(odd):last-child { grid-column: span 2; } }
@media (max-width: 400px) { .qtile { gap: 8px; padding: 10px; } .qtile .ic-wrap { width: 30px; height: 30px; } .qtile b { font-size: 13px; } .qtile .qt span { font-size: 11px; } }

/* ---------- resource tiles (chapter page) ---------- */
.resources { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.res { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1); text-decoration: none; transition: transform .2s var(--ease), box-shadow .2s; min-height: 118px; }
.res:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.res .icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-3); color: var(--burgundy); }
.res .icon .ic { width: 22px; height: 22px; }
.res b { font-size: 15px; }
.res span { font-size: 12.5px; color: var(--ink-3); }
.res.off { opacity: .55; }
.res.off:hover { transform: none; box-shadow: var(--shadow-1); }
.res .txt { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 560px) { .resources { grid-template-columns: 1fr; gap: 10px; } .res { flex-direction: row; align-items: center; gap: 14px; padding: 12px 14px; min-height: 0; } .res .icon { width: 44px; height: 44px; flex: none; } }

/* ---------- v5.3.3: the chapter's self-assessment — one full-width band at the very bottom of the chapter page ---------- */
.sa-band { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 20px; border-radius: var(--radius); background: linear-gradient(135deg, var(--banner-a), var(--banner-b)); border: 1px solid var(--banner-line); box-shadow: var(--shadow-1); }
.sa-band .sa-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--card); color: var(--burgundy); box-shadow: var(--shadow-1); }
.sa-band .sa-ic .ic { width: 24px; height: 24px; }
.sa-band .eyebrow { color: var(--banner-ic); }
.sa-band h3 { margin-top: 4px; }
.sa-band p { margin-top: 4px; font-size: 13.5px; color: var(--ink-2); }
.sa-band p b { color: var(--ink); }
.sa-band .sa-bar { margin-top: 10px; height: 6px; max-width: 360px; }
.sa-band .sa-go { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 760px) { .sa-band { grid-template-columns: auto minmax(0, 1fr); } .sa-band .sa-go { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; } .sa-band .sa-go .btn { flex: 1 1 200px; } }
@media (max-width: 560px) { .sa-band { gap: 12px; padding: 14px; align-items: start; } .sa-band .sa-ic { width: 40px; height: 40px; border-radius: 12px; } .sa-band .sa-ic .ic { width: 21px; height: 21px; } .sa-band h3 { font-size: 17.5px; } .sa-band .sa-go .btn { flex-basis: 100%; white-space: normal; } }

/* ---------- quiz ---------- */
.quiz-wrap, .narrow { max-width: 800px; margin-inline: auto; }
.quiz-top { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 14px; }
.quiz-top .crumb { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.segments { display: grid; grid-auto-flow: column; gap: 5px; margin-bottom: 20px; }
.segments i { height: 6px; border-radius: 999px; background: var(--tint-2); transition: background .3s; }
.segments i.done { background: var(--ink); }
.segments i.ok { background: var(--green); }
.segments i.bad { background: var(--red); }
.segments i.cur { background: var(--gold); box-shadow: 0 0 0 3px rgba(201,154,59,.25); }
.qcard { padding: clamp(18px, 3vw, 30px); }
.qnum { font-family: var(--font-display); font-style: italic; color: var(--ink-3); font-size: 14px; }
.stem { font-family: var(--font-display); font-size: clamp(19px, 2.6vw, 25px); font-weight: 600; line-height: 1.35; margin-top: 8px; }
.options { display: grid; gap: 10px; margin-top: 22px; }
.opt { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 12px; text-align: left; width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--white); cursor: pointer; font-size: 15.5px; line-height: 1.4; transition: transform .15s var(--ease), border-color .2s, background .2s, box-shadow .2s; }
.opt:hover:not(:disabled) { border-color: var(--gold); background: var(--white-hover); transform: translateX(3px); }
.opt:disabled { cursor: default; }
.opt .letter { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--tint); font-weight: 700; font-size: 13px; color: var(--ink-2); transition: background .2s, color .2s; }
.opt.correct { border-color: var(--green); background: var(--green-bg); }
.opt.correct .letter { background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--red); background: var(--red-bg); animation: shake .4s var(--ease); }
.opt.wrong .letter { background: var(--red); color: #fff; }
.opt.dim { opacity: .5; }
.opt .mark { font-size: 12px; font-weight: 700; }
.opt.correct .mark { color: var(--green); }
.opt.wrong .mark { color: var(--red); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.feedback { margin-top: 18px; border-radius: 16px; padding: 16px 18px; border: 1px solid var(--line); background: var(--sticky); animation: pop .35s var(--ease) both; position: relative; }
.feedback.bad { background: var(--red-bg); }
.feedback .title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.feedback .body { margin-top: 6px; font-size: 14.5px; color: var(--ink); }
.feedback .meta { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.feedback .src { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: var(--tint); font-weight: 600; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.quiz-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.ranked-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: linear-gradient(135deg, var(--banner-a), var(--banner-b)); border: 1px solid var(--banner-line); font-size: 14px; }
.ranked-banner .ic { width: 22px; height: 22px; color: var(--banner-ic); flex: none; margin-top: 2px; }

/* ---------- results ---------- */
.score-hero { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; }
@media (max-width: 560px) { .score-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; } .score-hero .row, .results-actions { justify-content: center; } }
.bigring { position: relative; width: 168px; height: 168px; }
.bigring svg { width: 168px; height: 168px; transform: rotate(-90deg); }
.bigring .track { fill: none; stroke: var(--tint-2); stroke-width: 12; }
.bigring .bar { fill: none; stroke: url(#ringGrad); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1.4s var(--ease); }
.bigring .label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.bigring .label b { font-family: var(--font-display); font-size: 44px; font-weight: 600; line-height: 1; display: block; }
.bigring .label small { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.verdict { font-family: var(--font-display); font-size: clamp(24px, 3.4vw, 34px); font-weight: 600; }
.verdict .accent { font-style: italic; color: var(--burgundy); }
.review { display: grid; gap: 12px; }
.ritem { padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); border-left: 5px solid var(--green); }
.ritem.bad { border-left-color: var(--red); }
.ritem .q { font-family: var(--font-display); font-weight: 600; font-size: 16px; margin-top: 6px; }
.ritem .ans { font-size: 14px; margin-top: 8px; display: grid; gap: 4px; }
.ritem .ans .you { color: var(--red); }
.ritem .ans .right { color: var(--green); }
.ritem .exp { font-size: 14px; color: var(--ink-2); margin-top: 8px; }

/* ---------- leaderboard ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { text-decoration: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-size: 14px; font-weight: 500; transition: background .2s, color .2s, border-color .2s; }
.tab.active { background: var(--solid); color: #fff; border-color: var(--solid); }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: end; margin-top: 18px; }
.pod { text-align: center; padding: 14px 8px 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1); position: relative; }
.pod .medal { width: 46px; height: 46px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: #fff; box-shadow: inset 0 0 0 3px rgba(255,255,255,.55), 0 6px 14px -6px rgba(0,0,0,.35); }
.pod.p1 { order: 2; padding-top: 22px; background: linear-gradient(180deg, var(--highlight), var(--card)); border-color: var(--banner-line); }
.pod.p2 { order: 1; }
.pod.p3 { order: 3; }
.pod.p1 .medal { background: linear-gradient(135deg, #E8C25A, #B8882C); width: 56px; height: 56px; font-size: 22px; }
.pod.p2 .medal { background: linear-gradient(135deg, #C9CDD6, #8F97A6); }
.pod.p3 .medal { background: linear-gradient(135deg, #D9A574, #A9683C); }
.pod .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .score { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin-top: 2px; }
.pod .sub { font-size: 11.5px; color: var(--ink-3); }
.pod.me { outline: 2px solid var(--gold); outline-offset: 2px; }
.board { margin-top: 14px; display: grid; gap: 6px; }
.brow { display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 14.5px; }
.brow.me { border-color: var(--gold); background: var(--highlight); box-shadow: 0 0 0 3px rgba(201,154,59,.15); }
.brow .rk { font-family: var(--font-display); font-weight: 600; color: var(--ink-3); }
.brow .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brow .sc { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.brow .tm { font-size: 12px; color: var(--ink-3); min-width: 54px; text-align: right; }
.youtag { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.empty { text-align: center; padding: 34px 18px; color: var(--ink-3); border: 1px dashed var(--line-2); border-radius: 16px; }
.empty b { display: block; color: var(--ink); font-family: var(--font-display); font-size: 18px; margin-bottom: 4px; }

/* ---------- stat bars ---------- */
.qstats { display: grid; gap: 10px; }
.qs { display: grid; grid-template-columns: 28px 1fr 46px; gap: 10px; align-items: center; font-size: 13.5px; }
.qs .bar { height: 8px; border-radius: 999px; background: var(--tint-2); overflow: hidden; }
.qs .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--burgundy), var(--gold)); }
.qs .n { font-family: var(--font-display); font-weight: 600; color: var(--ink-3); }
.qs .pct { text-align: right; font-weight: 600; }

/* ---------- misc ---------- */
.skeleton { border-radius: 12px; background: linear-gradient(90deg, var(--tint) 25%, var(--tint-2) 37%, var(--tint) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; min-height: 18px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.toast-wrap { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--solid); color: #fff; font-size: 14px; box-shadow: var(--shadow-2); animation: pop .3s var(--ease) both; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
.modal-bg { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(4px); z-index: 40; display: grid; place-items: center; padding: 16px; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(100%, 460px); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto; background: var(--card); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-2); animation: pop .3s var(--ease) both; }
.modal h3 { font-size: 22px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 45; }
.footer { text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 30px 16px 40px; }
.footer .em { color: var(--burgundy); }
.ic { width: 20px; height: 20px; flex: none; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.hide { display: none !important; }
@media (max-width: 640px) { .hide-sm { display: none !important; } }
.nowrap { white-space: nowrap; }
kbd { font-family: ui-monospace, monospace; font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--tint); }

/* ---------- live presence ---------- */
.dot-live { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(47,122,68,.45); animation: pulse 1.8s ease-out infinite; vertical-align: middle; margin-right: 6px; position: relative; top: -2px; }
.dot-live.off { background: var(--ink-3); animation: none; box-shadow: none; }
.dot-live.away { background: var(--amber); animation: none; box-shadow: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47,122,68,.45); } 70% { box-shadow: 0 0 0 9px rgba(47,122,68,0); } 100% { box-shadow: 0 0 0 0 rgba(47,122,68,0); } }
.live-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
.live-row + .live-row { margin-top: 8px; }
.live-row.recent, .live-row.away { opacity: .75; }
.live-row .av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--burgundy), var(--gold)); color: #fff; font-weight: 700; font-family: var(--font-display); font-size: 15px; }
.live-row.recent .av, .live-row.away .av { background: linear-gradient(135deg, #8F97A6, #C9CDD6); }
.live-row .nm { font-weight: 600; font-size: 15px; }
.live-row .where { font-size: 13px; color: var(--ink-2); margin-top: 1px; }
.live-row .when { font-size: 12px; color: var(--ink-3); text-align: right; white-space: nowrap; }
.feed { display: grid; gap: 6px; }
.feed-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--tint); font-size: 13.5px; }
.feed-row .tiny { white-space: nowrap; }

/* ---------- resource pages (notes / video / flashcards) ---------- */
.subbar .wrap { height: auto; min-height: 58px; padding-block: 8px; gap: 10px; }
.subbar .title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.subbar .title b { font-family: var(--font-display); font-size: 16px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subbar .title span { font-size: 11.5px; color: var(--ink-3); letter-spacing: .12em; text-transform: uppercase; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* on a phone the buttons win: the chapter name stays, the small kind label goes (every page says what it is) */
@media (max-width: 560px) { .subbar .title span { display: none; } .subbar .title b { font-size: 15px; } }
.upnext { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.upnext .tiny { width: 100%; }
.frame-embed { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-2); background: var(--white); }
.frame-embed iframe { display: block; width: 100%; height: min(80vh, 900px); border: 0; }
.frame-video { position: relative; border-radius: 16px; overflow: hidden; background: #000; box-shadow: var(--shadow-2); aspect-ratio: 16 / 9; }
.frame-video iframe, .frame-video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.speeds .chip { cursor: pointer; border: 1px solid transparent; }
.speeds .chip.on { background: var(--solid); color: #fff; }
/* PDF reader */
.notes .reader { padding-block: 12px 72px; }
.pages { display: grid; gap: 14px; max-width: 1200px; margin: 0 auto; }
.pg { position: relative; background: #fff; border-radius: 10px; box-shadow: var(--shadow-1); overflow: hidden; }
.pg img { display: block; width: 100%; height: auto; }
.pg .pgnum { position: absolute; left: 10px; top: 8px; font-size: 11px; color: var(--ink-3); font-family: var(--font-display); }
.pg.ready .pgnum { display: none; }
.pagepill { position: fixed; bottom: calc(14px + env(safe-area-inset-bottom, 0px) + var(--dock-h, 0px)); left: 50%; transform: translateX(-50%); padding: 6px 12px 6px 16px; border-radius: 999px; background: var(--solid); color: #fff; font-size: 12.5px; font-weight: 600; z-index: 30; backdrop-filter: blur(6px); }
/* flashcards */
.progress { height: 8px; border-radius: 999px; background: var(--tint-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--burgundy), var(--gold)); transition: width .4s var(--ease); }
.fc { perspective: 1400px; cursor: pointer; outline: none; min-height: 300px; }
.fc-inner { position: relative; display: grid; width: 100%; min-height: 300px; transition: transform .5s var(--ease); transform-style: preserve-3d; }
.fc.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face { position: relative; grid-area: 1 / 1; min-width: 0; min-height: 300px; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; padding: 26px 26px 22px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 12px; border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.fc-front { background: var(--card); }
.fc-back { background: var(--sticky); transform: rotateY(180deg); }
.fc-tag { font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--gold); }
.fc-tag .ok { color: var(--green); }
.fc-text { max-width: 100%; overflow-wrap: anywhere; font-family: var(--font-display); font-weight: 600; font-size: clamp(19px, 2.8vw, 27px); line-height: 1.32; }
.fc-back .fc-text { font-size: clamp(17px, 2.4vw, 23px); font-weight: 500; }
.fc-hint { font-size: 12px; color: var(--ink-3); }
.fc-src { display: inline-flex; max-width: 100%; overflow-wrap: anywhere; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); padding: 3px 9px; border-radius: 999px; background: var(--tint); font-weight: 600; }
.fc-src .ic { width: 14px; height: 14px; }
.fc:focus-visible .fc-inner { outline: 3px solid rgba(201,154,59,.5); border-radius: 22px; }
.fc-actions { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; margin-top: 16px; }
.fc-mark { display: flex; gap: 10px; justify-content: center; transition: opacity .25s; }
.fc-mark.dim { opacity: .35; pointer-events: none; }
.btn.again { background: var(--red); }
.btn.gotit { background: var(--green); }
@media (max-width: 560px) { .fc-actions { grid-template-columns: 1fr 1fr; } .fc-mark { grid-column: 1 / -1; order: -1; } .fc-mark .btn { flex: 1; } .fc-face { padding: 22px 18px; } }
/* v5.3: the quiet line under the rating buttons ("Back in 7 days · Undo"), a link-looking button, your place in the deck */
.linkbtn { display: inline; background: none; border: 0; padding: 6px 4px; margin: -6px -2px; font: inherit; font-weight: 600; color: var(--burgundy); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: pointer; border-radius: 6px; -webkit-tap-highlight-color: transparent; }
.linkbtn:hover { background: var(--tint); }
.linkbtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.fc-status { margin: 10px 0 0; min-height: 1.5em; text-align: center; font-size: 13px; color: var(--ink-2); }
.fc-status:empty { min-height: 0; margin: 0; }
.fc-status .linkbtn { font-size: 13px; }
.placebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 12px; min-height: 36px; }
.placebar .linkbtn { font-size: 12.5px; }
.goto { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.goto label { white-space: nowrap; }
.goto .input { width: 76px; min-height: 36px; padding: 4px 10px; border-radius: 10px; font-size: 16px; text-align: center; -moz-appearance: textfield; }
.goto .input::-webkit-outer-spin-button, .goto .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sweepcap { margin: 0 0 12px; font-size: 14px; color: var(--ink-2); }

.uprog { position: relative; height: 10px; border-radius: 999px; background: var(--tint-2); margin-top: 10px; overflow: visible; }
.uprog i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--burgundy), var(--gold)); transition: width .2s; }
.uprog span { display: block; font-size: 12px; color: var(--ink-3); margin-top: 6px; }

/* ---------- admin ---------- */
.student { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
.student + .student { margin-top: 10px; }
.student.hidden-p { opacity: .7; background: var(--paper-2); }
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.table tr:hover td { background: var(--tint); }
.tablewrap { overflow-x: auto; }
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--tint); }
.badge.on { background: var(--green-bg); color: var(--green); }
.badge.off { background: var(--red-bg); color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; animation-delay: 0s !important; transition-delay: 0s !important; }
}

/* ==========================================================================
   v3 — spaced repetition, duels, challenges, announcements, search, streaks
   ========================================================================== */
.iconbtn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--ink-2); text-decoration: none; margin-right: 6px; transition: background .2s; }
.iconbtn:hover { background: var(--tint); color: var(--ink); }
.iconbtn .ic { width: 18px; height: 18px; }
.userpill .flame { display: inline-flex; align-items: center; gap: 2px; color: var(--amber); font-weight: 700; font-size: 12.5px; margin-left: 2px; }
.userpill .flame .ic { width: 14px; height: 14px; }
.menu button .ic { width: 15px; height: 15px; margin-right: 6px; vertical-align: -3px; color: var(--burgundy); }

/* announcements */
.announce-list { display: grid; gap: 10px; margin-bottom: 18px; }
.announce { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--sticky); border: 1px solid rgba(201,154,59,.45); box-shadow: var(--shadow-1); transition: opacity .3s; }
.announce.pinned { background: linear-gradient(135deg, var(--sticky), var(--sticky-2)); }
.announce .ic-wrap { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.7); display: grid; place-items: center; flex: none; color: var(--amber); }
.announce .ic-wrap .ic { width: 18px; height: 18px; }
.announce .body { flex: 1; font-size: 14.5px; line-height: 1.5; }
.announce .body b { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--amber); margin-bottom: 3px; }
.announce .btn { flex: none; }
@media (max-width: 560px) { .announce { flex-wrap: wrap; } .announce .btn { margin-left: 48px; } }

/* the study day strip */
.today { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tcell { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1); text-decoration: none; color: var(--ink); transition: transform .15s var(--ease), box-shadow .2s; }
.tcell:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.tcell .big { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-display); font-size: 28px; line-height: 1.1; color: var(--ink); }
.tcell .big small { font-size: 15px; color: var(--ink-3); font-family: var(--font-ui); }
.tcell .big .ic { width: 24px; height: 24px; color: var(--ink-3); }
.tcell .big.hot, .tcell .big.hot .ic { color: var(--amber); }
.tcell .lbl { font-size: 12.5px; color: var(--ink-3); }
.tcell.action { background: linear-gradient(135deg, var(--solid), var(--solid-3)); color: #fff; border-color: transparent; }
.tcell.action .big, .tcell.action .big .ic { color: var(--gold-2); }
.tcell.action .lbl { color: rgba(255,255,255,.8); }
@media (max-width: 760px) { .today { grid-template-columns: repeat(2, 1fr); } }
.today-grid { align-items: start; }
@media (max-width: 860px) { .today-grid { grid-template-columns: 1fr; } }

/* question of the day */
.qotd .options.compact { margin-top: 12px; gap: 8px; }
.qotd .options.compact .opt { padding: 10px 12px; font-size: 14px; }
.qotd .feedback { margin-top: 12px; }
/* A student's own, optional feedback after their daily answer has been saved. */
.qotd-rating { margin-top: 22px; padding: 20px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--tint); }
.qotd-rating-heading h3 { font-size: 21px; }
.qotd-rating-heading p { margin-top: 6px; color: var(--ink-2); font-size: 12px; line-height: 1.6; }
.qotd-rating-fieldset { border: 0; padding: 0; margin: 17px 0 16px; min-width: 0; }
.qotd-rating-fieldset legend { padding: 0; color: var(--ink-2); font-size: 12px; font-weight: 500; }
.qotd-rating-stars { display: flex; gap: 5px; margin-top: 6px; max-width: 244px; }
.qotd-rating-choice { position: relative; flex: 1; min-width: 0; cursor: pointer; }
.qotd-rating-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; z-index: 1; cursor: pointer; }
.qotd-rating-star { display: grid; place-items: center; width: 100%; height: 44px; border: 1px solid var(--line-2); border-radius: 10px; color: var(--ink-3); background: var(--card); transition: color .15s, border-color .15s, background .15s; }
.qotd-rating-star svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.qotd-rating-choice.selected .qotd-rating-star { color: var(--gold); border-color: var(--gold); background: rgba(201,154,59,.08); }
.qotd-rating-choice.selected svg { fill: currentColor; }
.qotd-rating-choice input:focus-visible + .qotd-rating-star { outline: 3px solid var(--burgundy); outline-offset: 3px; }
.qotd-rating-choice:hover .qotd-rating-star { border-color: var(--gold); }
.qotd-rating-fieldset:disabled .qotd-rating-choice { cursor: wait; }
.qotd-rating-selection { display: block; margin-top: 7px; min-height: 18px; color: var(--ink-2); font-size: 11px; }
.qotd-rating-comment-label { display: block; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 500; }
.qotd-rating-comment-label span { color: var(--ink-3); font-weight: 400; }
textarea.qotd-rating-comment { display: block; width: 100%; min-height: 84px; resize: vertical; font: inherit; font-size: 13px; line-height: 1.6; }
.qotd-rating-limit { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: var(--ink-3); font-size: 10px; }
.qotd-rating-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.qotd-rating-actions .btn { min-height: 44px; }
.qotd-rating-status { color: var(--ink-2); font-size: 12px; line-height: 1.6; }
.qotd-rating > .qotd-rating-status { margin-top: 14px; }
.qotd-rating-status.error { color: var(--red); }
.qotd-rating [data-rating-retry] { margin-top: 10px; }
@media (max-width: 540px) { .qotd-rating { padding: 16px 13px; } .qotd-rating-stars { gap: 3px; } }
@media (prefers-reduced-motion: reduce) { .qotd-rating-star { transition: none; } }
/* A dated, question-specific invitation. Other daily questions keep their layout. */
.qotd-invitation { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; padding: 18px 22px; border: 1px solid rgba(201,154,59,.42); border-left: 4px solid var(--burgundy); border-radius: var(--radius); background: var(--card); }
.qotd-invitation-copy { min-width: 0; }
.qotd-invitation .eyebrow { color: var(--burgundy); font-size: 10px; letter-spacing: .16em; }
.qotd-invitation p { margin-top: 5px; font-size: 14px; color: var(--ink-2); }
.qotd-invitation .btn { flex-shrink: 0; min-height: 44px; }
.today-grid .qotd.is-featured, .today-grid.has-featured-qotd .duelcard { grid-column: 1 / -1; }
.qotd.is-featured { padding: clamp(20px, 3.4vw, 36px); border: 1px solid rgba(201,154,59,.52); background: radial-gradient(ellipse at 100% 0, rgba(201,154,59,.075), transparent 58%), var(--card); scroll-margin-top: 86px; }
.qotd-feature-head { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 20px; align-items: center; padding-bottom: 25px; border-bottom: 1px solid var(--line-2); }
.qotd-feature-icon { width: 62px; height: 62px; display: grid; place-items: center; border: 1px solid rgba(201,154,59,.4); border-radius: 50%; background: rgba(201,154,59,.07); color: var(--gold); }
.qotd-feature-icon svg { width: 40px; height: 40px; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.qotd-feature-copy .eyebrow { font-size: 10px; letter-spacing: .15em; }
.qotd-feature-copy h2 { margin-top: 8px; font-size: clamp(27px, 3.4vw, 36px); text-wrap: balance; line-height: 1.17; }
.qotd-feature-copy h2 em { color: var(--burgundy); font-weight: 500; }
.qotd-feature-copy p { margin-top: 10px; color: var(--ink-2); font-size: 13px; }
.qotd-feature-count { align-self: start; text-align: right; padding-left: 14px; }
.qotd-feature-count b { display: block; font: 500 34px/1.1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--gold); }
.qotd-feature-count span { display: block; margin-top: 5px; font-size: 10px; line-height: 1.45; color: var(--ink-3); }
.qotd-feature-question { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: clamp(22px, 4vw, 44px); padding-top: 25px; }
.qotd.is-featured .stem { margin: 0; font-size: clamp(20px, 2.5vw, 24px); line-height: 1.5; white-space: pre-line; }
.qotd.is-featured .stem:focus-visible { outline: 2px solid var(--gold); outline-offset: 7px; border-radius: 2px; }
.qotd.is-featured .options.compact { margin: 0; gap: 10px; }
.qotd.is-featured .options.compact .opt { grid-template-columns: 32px minmax(0, 1fr) auto; padding: 13px 14px; min-height: 60px; font-size: 14px; }
.qotd.is-featured .opt .mark { max-width: 5em; font-size: 11px; }
.qotd.is-featured .opt:focus-visible, .qotd-invitation .btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.qotd.is-featured .feedback { margin-top: 24px; }
@media (max-width: 760px) {
  .qotd-feature-question { grid-template-columns: 1fr; gap: 20px; }
  .qotd-invitation { align-items: flex-start; gap: 14px; padding: 16px 18px; }
}
@media (max-width: 540px) {
  .qotd-invitation { flex-direction: column; }
  .qotd-invitation .btn { width: 100%; }
  .qotd-feature-head { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding-bottom: 20px; }
  .qotd-feature-icon { display: none; }
  .qotd-feature-copy .eyebrow { font-size: 9px; letter-spacing: .1em; }
  .qotd-feature-copy h2 { font-size: 28px; }
  .qotd-feature-copy p { font-size: 12px; }
  .qotd-feature-count { padding-left: 0; }
  .qotd-feature-count b { font-size: 29px; }
  .qotd-feature-question { padding-top: 20px; }
  .qotd.is-featured .options.compact .opt { padding: 12px 10px; gap: 9px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  html:has(.qotd.is-featured) { scroll-behavior: auto; }
  .qotd.is-featured .opt, .qotd-invitation .btn { transition: none; }
}
/* a ranked question of the day answered before that chapter's ranked quiz: the pick is saved, the key waits */
.opt.held { border-color: var(--burgundy); }
.opt.held .letter { background: var(--burgundy); color: #fff; }
.opt.held .mark { color: var(--burgundy); }
.tile .due { color: var(--amber); }
.feedback a.src, .ritem a.src { text-decoration: none; }
.feedback a.src:hover, .ritem a.src:hover { text-decoration: underline; }
.verdict-note { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--green-bg); color: var(--green); font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; }
.verdict-note .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* search */
.searchbar { display: flex; gap: 8px; align-items: center; }
.searchbar .ic-wrap { display: none; }
.searchbar .input { flex: 1; font-size: 16px; }
.results { display: grid; gap: 10px; }
.sres { display: block; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-1); transition: transform .15s var(--ease), box-shadow .2s; }
.sres:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.sres.off { opacity: .7; cursor: default; }
.sres .meta { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--burgundy); }
.sres .meta .ic { width: 14px; height: 14px; }
.sres .snip { margin-top: 6px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.sres .snip b { color: var(--ink); background: var(--gold-3); border-radius: 4px; padding: 0 3px; }

/* duels */
.duelcard h3 { font-size: 20px; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.vs .side { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.vs .side b { font-family: var(--font-display); font-size: 17px; }
.vs .side .tiny { grid-column: 1; }
.vs .side .bar { grid-column: 1; height: 8px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.vs .side .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--solid), var(--solid-3)); border-radius: 999px; transition: width .4s var(--ease); }
.vs .side.me .bar i { background: linear-gradient(90deg, var(--burgundy), var(--gold)); }
.vs .side .pts { grid-column: 2; grid-row: 1 / 4; font-family: var(--font-display); font-size: 30px; }
.vs .side .pts small { font-size: 13px; color: var(--ink-3); font-family: var(--font-ui); }
.vs .mid { font-family: var(--font-display); font-style: italic; color: var(--ink-3); }
.code { font-family: var(--font-display); font-size: 64px; letter-spacing: .3em; padding-left: .3em; color: var(--burgundy); margin-top: 18px; }
.center-col { text-align: center; }
.center-col .lede { margin-left: auto; margin-right: auto; }

/* profile */
.streakring { display: grid; place-items: center; align-content: center; width: 150px; height: 150px; border-radius: 50%; background: var(--paper-2); border: 4px solid var(--line-2); color: var(--ink-3); flex: none; }
.streakring .ic { width: 28px; height: 28px; }
.streakring b { font-family: var(--font-display); font-size: 44px; line-height: 1; color: var(--ink); }
.streakring span { font-size: 12px; }
.streakring.hot { background: linear-gradient(160deg, var(--hot-a), var(--hot-b)); border-color: var(--amber); color: var(--amber); }
.dots { display: flex; gap: 5px; flex-wrap: wrap; }
.dots i { width: 14px; height: 14px; border-radius: 4px; background: var(--paper-2); border: 1px solid var(--line); }
.dots i.on { background: var(--amber); border-color: var(--amber); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.badge-card { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; gap: 2px 12px; padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); opacity: .55; filter: grayscale(1); }
.badge-card.on { opacity: 1; filter: none; box-shadow: var(--shadow-1); }
.badge-card .bicon { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--burgundy), var(--gold)); color: #fff; display: grid; place-items: center; }
.badge-card .bicon .ic { width: 20px; height: 20px; }
.badge-card b { font-size: 14px; }
.badge-card span { font-size: 12px; color: var(--ink-3); }

/* challenges */
.challenge .q { font-weight: 600; font-size: 14.5px; }
.challenge.accepted { border-left: 4px solid var(--green); }
.challenge.rejected { border-left: 4px solid var(--red); }
.challenge.open { border-left: 4px solid var(--gold); }

/* flashcards v3 */
.tab .cnt { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--amber-bg); color: var(--amber); font-size: 11.5px; margin-left: 4px; }
.fc-src.link { text-decoration: none; cursor: pointer; }
.fc-src.link:hover { text-decoration: underline; }
.pg.target { outline: 3px solid var(--gold); outline-offset: 2px; }

/* admin v3 */
.tab .cnt { }
.qrow { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.qrow:first-child { border-top: 0; }
.qrow .qstem { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field .lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 10px 0 6px; }
.heat { display: flex; flex-wrap: wrap; gap: 6px; }
.hcell { position: relative; min-width: 44px; height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--paper-2); font: 600 12px var(--font-ui); color: var(--ink); cursor: pointer; }
.hcell.pool { border-style: dashed; }
.hcell:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.hcell i { position: absolute; top: -4px; right: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--amber); border: 2px solid var(--card); }
.argument { padding: 10px 12px; border-radius: 10px; background: var(--paper-2); font-size: 14px; line-height: 1.5; }
.muted-card { opacity: .6; }

/* ==========================================================================
   v4 — dark mode (follows the phone; Auto / Light / Dark in the menu), text size, offline, tour, exam plan
   ========================================================================== */
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
:root[data-theme="dark"] { color-scheme: dark; }

/* the dark palette, applied by the media query (auto) or by the manual choice */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12172A; --paper-2: #1A2138; --card: #1C2338; --white: #232B45; --white-hover: #2A3350;
    --ink: #E8ECF5; --ink-2: #B7C0D6; --ink-3: #8592B0;
    --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.14);
    --tint: rgba(255,255,255,.07); --tint-2: rgba(255,255,255,.13);
    --solid: #3A4F8A; --solid-2: #45609F; --solid-3: #2B4478;
    --burgundy: #D46A78; --burgundy-2: #E28291; --gold: #E0B45A; --gold-2: #EBC97A; --gold-3: #3B321C;
    --sticky: #33301F; --sticky-2: #3E3A22; --highlight: #2A2A1E;
    --green: #6FCB86; --green-bg: rgba(47,122,68,.28); --red: #F07A85; --red-bg: rgba(185,50,62,.28);
    --blue: #8AB4F0; --blue-bg: rgba(46,107,184,.28); --amber: #F0A64C; --amber-bg: rgba(208,124,27,.26);
    --purple: #C3A2F2; --purple-bg: rgba(107,63,160,.3);
    --banner-a: #2E2A1A; --banner-b: #3A331E; --banner-line: #5A4B24; --banner-ic: #E0B45A; --ranked-fg: #EBC97A;
    --overlay: rgba(0,0,0,.6); --hot-a: #3F2E16; --hot-b: #5A3F1A;
    --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px -8px rgba(0,0,0,.6); --shadow-2: 0 2px 4px rgba(0,0,0,.35), 0 18px 40px -16px rgba(0,0,0,.7);
    --topbar: rgba(18,23,42,.85); --glow-a: rgba(224,200,112,.10); --glow-b: rgba(212,106,120,.06);
  }
}
:root[data-theme="dark"] {
  --paper: #12172A; --paper-2: #1A2138; --card: #1C2338; --white: #232B45; --white-hover: #2A3350;
  --ink: #E8ECF5; --ink-2: #B7C0D6; --ink-3: #8592B0;
  --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.14);
  --tint: rgba(255,255,255,.07); --tint-2: rgba(255,255,255,.13);
  --solid: #3A4F8A; --solid-2: #45609F; --solid-3: #2B4478;
  --burgundy: #D46A78; --burgundy-2: #E28291; --gold: #E0B45A; --gold-2: #EBC97A; --gold-3: #3B321C;
  --sticky: #33301F; --sticky-2: #3E3A22; --highlight: #2A2A1E;
  --green: #6FCB86; --green-bg: rgba(47,122,68,.28); --red: #F07A85; --red-bg: rgba(185,50,62,.28);
  --blue: #8AB4F0; --blue-bg: rgba(46,107,184,.28); --amber: #F0A64C; --amber-bg: rgba(208,124,27,.26);
  --purple: #C3A2F2; --purple-bg: rgba(107,63,160,.3);
  --banner-a: #2E2A1A; --banner-b: #3A331E; --banner-line: #5A4B24; --banner-ic: #E0B45A; --ranked-fg: #EBC97A;
  --overlay: rgba(0,0,0,.6); --hot-a: #3F2E16; --hot-b: #5A3F1A;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px -8px rgba(0,0,0,.6); --shadow-2: 0 2px 4px rgba(0,0,0,.35), 0 18px 40px -16px rgba(0,0,0,.7);
  --topbar: rgba(18,23,42,.85); --glow-a: rgba(224,200,112,.10); --glow-b: rgba(212,106,120,.06);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { opacity: .25; } :root:not([data-theme="light"]) .pg img { filter: brightness(.92); } }
:root[data-theme="dark"] body::before { opacity: .25; }
:root[data-theme="dark"] .pg img { filter: brightness(.92); }
.seal, .btn.gold { color: #2B1E05; }

/* Study sizing below changes study content, leaving app navigation and dialogs unscaled. */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--solid); color: #fff; }
.menu .pref { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; font-size: 13px; color: var(--ink-2); }
.menu .divider { border-top: 1px solid var(--line); margin: 6px 0; }
.menu { max-width: calc(100vw - 24px); }
@media (max-width: 560px) {
  /* a long menu scrolls inside itself and stops above the bottom bar (sign out is its last row) */
  .menu { position: fixed; left: 12px; right: 12px; top: 70px; min-width: 0 !important; overflow-y: auto; overscroll-behavior: contain;
    max-height: calc(100vh - 82px - var(--bnav-h, 0px)); max-height: calc(100dvh - 82px - var(--bnav-h, 0px)); }
}
.keys { display: none; font-size: 12px; color: var(--ink-3); margin-top: 10px; }
@media (hover: hover) and (min-width: 760px) { .keys { display: block; } }
.keys kbd { margin: 0 2px; }

/* offline bar */
#offline-bar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 26; align-items: center; gap: 10px; padding: 9px 16px; padding-bottom: calc(9px + env(safe-area-inset-bottom, 0px)); background: #3D3117; color: #FBEBD3; font-size: 13.5px; box-shadow: 0 -4px 16px rgba(0,0,0,.18); }
html.is-offline body, html.sync-wait body { padding-bottom: 46px; }   /* sync-wait: online, but taps still waiting for the server */
#offline-bar.show { display: flex; }
#offline-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex: none; }
.offline-chip { margin-left: 8px; }
html.is-offline .needs-net { opacity: .55; pointer-events: none; }

/* continue where you left off */
.resume { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: linear-gradient(135deg, var(--solid), var(--solid-3)); color: #fff; text-decoration: none; box-shadow: var(--shadow-1); transition: transform .15s var(--ease); }
.resume:hover { transform: translateY(-2px); }
.resume .ic-wrap { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.14); display: grid; place-items: center; flex: none; }
.resume .ic-wrap .ic { width: 20px; height: 20px; color: var(--gold-2); }
.resume b { display: block; font-family: var(--font-display); font-size: 17px; }
.resume span { font-size: 13px; color: rgba(255,255,255,.8); }
.resume .go { margin-left: auto; font-size: 13px; font-weight: 600; white-space: nowrap; }

/* exam countdown + plan */
.countdown { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 16px 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.countdown .days { text-align: center; min-width: 84px; padding: 8px 12px; border-radius: 14px; background: linear-gradient(135deg, var(--burgundy), var(--burgundy-2)); color: #fff; }
.countdown .days b { display: block; font-family: var(--font-display); font-size: 36px; line-height: 1; }
.countdown .days span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.countdown h3 { font-size: 18px; }
.countdown .plan { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.countdown .plan b { color: var(--ink); }
.countdown.soon .days { background: linear-gradient(135deg, #B8412F, var(--amber)); }
.countdown.past .days { background: var(--solid); }
@media (max-width: 560px) { .countdown { grid-template-columns: 1fr; } .countdown .days { justify-self: start; } }
.countdown .sweep { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.countdown .sweep .tiny { flex: 1 1 200px; color: var(--ink-2); }
.countdown.countdown-timed { grid-template-columns: minmax(0, 1fr); }
.countdown .exam-schedule, #exam-card .exam-schedule { display: block; margin-top: 4px; font-size: 14px; color: var(--ink-2); }
taw-exam-clock { display: flex; gap: clamp(10px, 2.2vw, 24px); margin-block: 12px; font-weight: 700; color: var(--ink); }
.exam-clock-unit { display: grid; min-width: 2.5ch; }
.exam-clock-unit b { font: 600 clamp(24px, 4vw, 34px)/1.12 var(--font-display); font-variant-numeric: tabular-nums lining-nums; }
.exam-clock-unit > span { color: var(--ink-2); font-size: 11px; font-weight: 500; }

/* first-visit tour */
.tour .step { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.tour .art { display: grid; place-items: center; height: 96px; margin: 14px 0; border-radius: 14px; background: linear-gradient(135deg, var(--gold-3), var(--sticky)); }
.tour .art .ic { width: 42px; height: 42px; color: var(--burgundy); }
.tour .dots { display: flex; gap: 6px; }
.tour .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--tint-2); }
.tour .dots i.on { background: var(--burgundy); }

/* notes zoom (laptops) */
.notes .reader { overflow-x: auto; }
.notes .reader .pages { width: var(--pgw, 100%); max-width: none; margin: 0 auto; }

/* ---------------------------------------------------------------- v4.1: the paediatric history guide (history.html) */
.hist-hero { padding: 26px 26px 20px; border-radius: 22px; background: linear-gradient(135deg, var(--banner-a), var(--banner-b)); border: 1px solid var(--banner-line); box-shadow: var(--shadow-1); }
.hist-hero h1 { margin-top: 8px; font-size: clamp(28px, 4.6vw, 42px); }
.hist-hero .lede { font-size: 15.5px; }
.orderline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 16px; }
.orderline .tiny { width: 100%; }
.ochip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 999px; background: var(--card); border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 500; color: var(--ink-2); text-decoration: none; transition: background .2s, transform .15s; }
.ochip b { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--solid); color: #fff; font-size: 11px; font-family: var(--font-display); }
.ochip:hover { background: var(--white-hover); transform: translateY(-1px); }
.legend { margin-top: 16px; }
.legend summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-2); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.legend summary::before { content: "▸"; color: var(--gold); transition: transform .2s; }
.legend[open] summary::before { transform: rotate(90deg); }
.legend-body { display: grid; gap: 8px; margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }
.lg { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: start; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--tint); color: var(--ink-2); white-space: nowrap; }
.tag.think { background: var(--amber-bg); color: var(--amber); }
.tag.red-flags { background: var(--red-bg); color: var(--red); }
.tag.bold { background: var(--solid); color: #fff; }
.tag.part-1, .tag.part-2 { background: var(--gold-3); color: var(--ranked-fg); }
.hist-tabs .tab { display: inline-flex; align-items: center; gap: 6px; }
.hist-tabs .tab .ic { width: 15px; height: 15px; }
.hist-tools { gap: 10px; }
.searchbar.small { flex: 1; min-width: 240px; }
.searchbar.small .input { min-height: 42px; }
/* part 2 */
.hgrid { display: flex; flex-wrap: wrap; gap: 6px; }
.hchip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 5px; border-radius: 999px; background: var(--card); border: 1px solid var(--line-2); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 500; transition: background .2s, transform .15s; }
.hchip b { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 50%; background: var(--burgundy); color: #fff; font-size: 11.5px; font-family: var(--font-display); }
.hchip:hover { background: var(--white-hover); transform: translateY(-1px); }
.hcards { display: grid; gap: 10px; }
.hcard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-1); overflow: hidden; }
.hcard .hd { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; background: none; border: 0; text-align: left; cursor: pointer; color: var(--ink); font-family: var(--font-ui); }
.hcard .hd:hover { background: var(--tint); }
.hcard .num { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 10px; background: var(--solid); color: #fff; font-family: var(--font-display); font-size: 15px; flex: none; }
.hcard .ttl { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.25; flex: 1; }
.hcard .prog { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.hcard .prog.on { color: var(--green); font-weight: 700; }
.hcard .chev .ic { width: 16px; height: 16px; color: var(--ink-3); transition: transform .2s; transform: rotate(90deg); }
.hcard.open .chev .ic { transform: rotate(-90deg); }
.hcard .bd { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.think { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: var(--amber-bg); color: var(--ink); font-size: 13.5px; line-height: 1.5; }
.think .tag { margin-top: 2px; }
.hgroup { margin-top: 14px; }
.glbl { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--gold); padding-bottom: 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.hitem { display: flex; gap: 10px; align-items: flex-start; padding: 7px 6px; border-radius: 10px; cursor: pointer; font-size: 14px; line-height: 1.5; transition: background .15s; }
.hitem:hover { background: var(--tint); }
.hitem input { position: absolute; opacity: 0; width: 0; height: 0; }
.hitem .box { flex: none; width: 18px; height: 18px; margin-top: 3px; border-radius: 5px; border: 1.5px solid var(--line-2); background: var(--white); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.hitem .box::after { content: ""; width: 10px; height: 6px; border-left: 2.2px solid #fff; border-bottom: 2.2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.hitem.on .box { background: var(--green); border-color: var(--green); }
.hitem.on .box::after { opacity: 1; }
.hitem.on .txt { color: var(--ink-3); }
.hitem b { color: var(--burgundy); }
.hitem.on b { color: inherit; }
.hitem mark, .hchip mark, .think mark, .ttl mark { background: var(--sticky); color: inherit; border-radius: 3px; padding: 0 2px; }
.redflags { margin-top: 16px; padding: 10px 12px 6px; border-radius: 12px; background: var(--red-bg); border: 1px solid rgba(185,50,62,.25); }
.redflags .glbl { color: var(--red); border-color: rgba(185,50,62,.25); }
.redflags .glbl .ic { width: 14px; height: 14px; color: var(--red); }
.redflags .hitem:hover { background: rgba(185,50,62,.08); }
.redflags .hitem .box { border-color: rgba(185,50,62,.5); }
.redflags .hitem.on .box { background: var(--red); border-color: var(--red); }
/* part 1 */
.secnav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.secnav a { flex: none; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-size: 12.5px; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.secnav a b { color: var(--burgundy); margin-right: 2px; }
.secnav a.on { background: var(--solid); color: #fff; border-color: var(--solid); }
.secnav a.on b { color: var(--gold-2); }
.hsec { margin-top: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-1); overflow: hidden; scroll-margin-top: 80px; }
.hbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: linear-gradient(135deg, var(--solid), var(--solid-3)); color: #fff; }
.hbar .num { font-family: var(--font-display); font-size: 18px; color: var(--gold-2); }
.hbar h2 { font-size: 19px; color: #fff; flex: 1; }
.hbar .tag2 { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; opacity: .85; white-space: nowrap; }
.hsec-body { padding: 12px 16px 16px; }
.jog { font-style: italic; color: var(--ink-3); font-size: 13.5px; line-height: 1.55; }
.hint-link { display: inline-flex; gap: 6px; align-items: flex-start; margin-top: 8px; font-size: 13.5px; color: var(--burgundy); text-decoration: none; font-weight: 500; }
.hint-link .ic { width: 15px; height: 15px; flex: none; margin-top: 3px; }
.blanks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.blank { display: inline-block; padding: 6px 12px; border-radius: 10px; background: var(--white); border: 1px dashed var(--line-2); font-size: 13.5px; color: var(--ink); }
.sub { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--gold); }
.writebox { margin-top: 8px; height: 64px; border-radius: 10px; background: repeating-linear-gradient(to bottom, transparent 0 21px, var(--line-2) 21px 22px); }
.sysgrid { display: grid; gap: 4px; margin-top: 8px; }
.sysrow { display: grid; grid-template-columns: 92px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.syslbl { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); padding-top: 8px; }
.sysitems { display: flex; flex-wrap: wrap; gap: 2px 4px; }
.sysitems .hitem { padding: 4px 8px 4px 4px; font-size: 13px; border-radius: 999px; }
.sysitems .hitem .box { width: 15px; height: 15px; margin-top: 3px; }
.sysitems .hitem .box::after { width: 8px; height: 4px; }
.checks { display: grid; gap: 2px; margin-top: 6px; }
.hist-table td.k { font-weight: 600; color: var(--ink); white-space: nowrap; }
.hist-table td.write { height: 34px; }
.hist-table th { position: sticky; top: 0; background: var(--card); }
.qrcard.span2 { grid-column: 1 / -1; }
.hist-foot { margin-top: 40px; }
@media (max-width: 560px) { .hist-hero { padding: 20px 16px 16px; } .sysrow { grid-template-columns: 1fr; gap: 2px; } .syslbl { padding-top: 0; } .lg { grid-template-columns: 74px 1fr; } .hcard .prog { display: none; } }
/* the home-page banner */
.hist-banner { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; border-radius: 16px; background: linear-gradient(135deg, var(--solid), var(--solid-3)); color: #fff; text-decoration: none; box-shadow: var(--shadow-1); transition: transform .15s var(--ease); }
.hist-banner:hover { transform: translateY(-2px); }
.hist-banner .ic-wrap { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.14); display: grid; place-items: center; }
.hist-banner .ic-wrap .ic { width: 20px; height: 20px; color: var(--gold-2); }
.hist-banner .eyebrow { color: var(--gold-2); }
.hist-banner b { display: block; font-family: var(--font-display); font-size: 16.5px; line-height: 1.25; }
.hist-banner p { margin: 3px 0 0; font-size: 12.5px; line-height: 1.45; color: rgba(255,255,255,.78); }
.hist-banner .go { white-space: nowrap; font-weight: 600; font-size: 13px; }
@media (max-width: 560px) { .hist-banner { gap: 12px; padding: 12px 14px; } .hist-banner .ic-wrap { width: 34px; height: 34px; } .hist-banner b { font-size: 15.5px; } .hist-banner p { font-size: 12px; } .hist-banner .go .ic { width: 18px; height: 18px; } }

/* ==========================================================================
   v4.2 — the ELOOPs space (picture questions) and the question booklet
   ========================================================================== */
.eloopsview .progress { margin-top: 14px; }
.eloop { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-2); padding: 18px 18px 20px; }
.etop { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.etop .fc-tag { line-height: 1.5; }
.etop .fc-tag .ok { color: var(--green); }
.etop .tiny { color: var(--ink-3); text-align: right; }
/* the picture plate — scans are on white paper, so the plate stays white in both palettes */
.epic { position: relative; border-radius: 14px; overflow: hidden; background: #fff; border: 1px solid var(--line); box-shadow: inset 0 0 0 1px rgba(255,255,255,.6); }
.epic img { display: block; width: 100%; height: auto; max-height: 56vh; object-fit: contain; cursor: zoom-in; background: #fff; }
/* the plate is white in both palettes, so this button keeps ink colours whatever the theme */
.epic .zoombtn { position: absolute; right: 10px; bottom: 10px; background: rgba(255,255,255,.92); border: 1px solid rgba(27,46,85,.18); color: #1B2E55; box-shadow: var(--shadow-1); padding: 6px 9px; border-radius: 10px; }
.epic .zoombtn .ic { width: 16px; height: 16px; }
.epic .zoombtn:hover { background: #fff; color: #1B2E55; }
.eq { font-family: var(--font-display); font-weight: 600; font-size: clamp(16.5px, 2.1vw, 20px); line-height: 1.5; color: var(--ink); margin-top: 16px; white-space: normal; }
.ea { margin-top: 16px; border-radius: 16px; padding: 16px 18px; background: var(--sticky); border: 1px solid var(--gold-2); animation: eareveal .28s var(--ease); }
.ea .lbl { font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--ranked-fg); margin-bottom: 6px; }
.ea .txt { font-family: var(--font-display); font-weight: 600; font-size: clamp(17px, 2.3vw, 22px); line-height: 1.42; color: var(--ink); }
.ea .why { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(122,31,43,.18); font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
@keyframes eareveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.eloop .btn.block { width: 100%; }
/* full-size picture */
.picfull { position: fixed; inset: 0; z-index: 90; background: rgba(15,22,40,.86); display: grid; place-items: center; padding: 24px; cursor: zoom-out; backdrop-filter: blur(3px); animation: eareveal .2s var(--ease); }
.picfull img { max-width: 100%; max-height: calc(100vh - 96px); border-radius: 12px; background: #fff; box-shadow: var(--shadow-2); cursor: zoom-in; }
.picfull .btn { position: absolute; top: 18px; right: 18px; background: rgba(255,255,255,.92); color: #1B2E55; border: 1px solid rgba(255,255,255,.4); z-index: 2; }
.picfull .hintbar { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.88); background: rgba(15,22,40,.55); padding: 5px 13px; border-radius: 999px; pointer-events: none; }
/* tap the picture once more for actual size, then drag to look around */
.picfull.zoomed { overflow: auto; place-items: start; padding: 0; -webkit-overflow-scrolling: touch; }
.picfull.zoomed img { max-width: none; max-height: none; border-radius: 0; cursor: zoom-out; }
@media (max-width: 560px) { .eloop { padding: 14px 13px 16px; border-radius: 18px; } .epic img { max-height: 46vh; } .etop .tiny { text-align: left; } .picfull { padding: 12px; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .epic img { filter: brightness(.94); } }
:root[data-theme="dark"] .epic img { filter: brightness(.94); }
.bookcap { max-width: 1200px; margin: 0 auto 12px; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: clamp(16px, 2.2vw, 20px); color: var(--ink); }

/* ==========================================================================
   v4.3 — tappable options, "Your notes" and Challenge on every card
   ========================================================================== */
.eopts { display: grid; gap: 8px; margin-top: 16px; }
.eopt { display: grid; grid-template-columns: 30px 1fr auto; align-items: start; gap: 10px; width: 100%; text-align: left;
        padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--white);
        font: inherit; font-size: 15px; line-height: 1.45; color: var(--ink); cursor: pointer;
        transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease); }
.eopt:hover:not(:disabled) { background: var(--white-hover); border-color: var(--ink-3); transform: translateY(-1px); }
.eopt:disabled { cursor: default; }
.eopt .k { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--tint);
           font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink-2); }
.eopt .ic { width: 18px; height: 18px; margin-top: 3px; }
.eopt.right { background: var(--green-bg); border-color: var(--green); color: var(--ink); }
.eopt.right .k { background: var(--green); color: #fff; }
.eopt.right .ic { color: var(--green); }
.eopt.wrong { background: var(--red-bg); border-color: var(--red); }
.eopt.wrong .k { background: var(--red); color: #fff; }
.eopt.wrong .ic { color: var(--red); }
.eopts.done .eopt:not(.right):not(.wrong) { opacity: .55; }
/* where the question came from — only ever on the back */
.esrc { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 4px 10px; border-radius: 999px;
        background: rgba(122,31,43,.08); font-size: 12px; font-weight: 600; color: var(--ranked-fg); }
.esrc .ic { width: 14px; height: 14px; }
/* Your notes · Challenge */
.itools { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.itrow { display: flex; gap: 8px; flex-wrap: wrap; }
.itbtn { color: var(--ink-2); }
.itbtn .ic { width: 15px; height: 15px; }
.itbtn.on { background: var(--sticky); border-color: var(--gold-2); color: var(--ranked-fg); }
.itnote { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--sticky); border: 1px solid var(--gold-2);
          font-size: 14px; line-height: 1.6; color: var(--ink); white-space: normal; }
.itedit { margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--line-2); }
.itedit label { display: block; color: var(--ink-3); margin-bottom: 6px; }
.itedit textarea { width: 100%; border-radius: 10px; border: 1px solid var(--line-2); background: var(--white); color: var(--ink);
                   font: inherit; font-size: 14.5px; line-height: 1.5; padding: 10px 12px; resize: vertical; }
.itedit textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.qnote { margin-top: 10px; }
.qnote .itnote { margin-top: 8px; }
@media (max-width: 560px) { .eopt { grid-template-columns: 26px 1fr auto; padding: 11px 12px; font-size: 14.5px; } }
/* v5.3 — ELOOPs & booklet cards: the tapped answer picks the rating ("I actually knew it" for a slip of the finger),
   a quiet line with Undo instead of a pop-up, "Go to #" and "Start from the beginning" */
.fc-mark.pre .btn:not(.on) { opacity: .5; box-shadow: none; }
.fc-mark .btn.on { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--gold); }
.fc-mark .btn:disabled { opacity: .3; cursor: not-allowed; }
.knewit { display: flex; align-items: center; justify-content: center; gap: 8px; width: fit-content; margin: 10px auto 0; padding: 6px 12px; border-radius: 999px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.knewit:hover { background: var(--tint); }
.knewit input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.knewit.nudge { animation: knewit-nudge .42s var(--ease); background: var(--gold-3); color: var(--ink); }
@keyframes knewit-nudge { 20% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 80% { transform: translateX(-2px); } }
.fc-status { display: flex; align-items: center; justify-content: center; gap: 4px 10px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--ink-2); text-align: center; }
.elink { background: none; border: 0; padding: 6px 4px; min-height: 32px; font: inherit; font-weight: 600; color: var(--burgundy); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.elink:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.eplace { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; min-height: 40px; }
.eplace > .tiny { color: var(--ink-2); }
.egoto { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.egoto label { white-space: nowrap; color: var(--ink-2); }
.egoto .input { width: 92px; min-height: 36px; padding: 6px 10px; border-radius: 10px; font-size: 16px; }
.mix-preset { margin-bottom: 4px; }
@media (max-width: 560px) { .mix-tabs { display: grid; grid-template-columns: 1fr 1fr; } .mix-tabs .tab { justify-content: center; } }

/* ==========================================================================
   v4.5 — the study checklist, bookmarks, tools on every page
   ========================================================================== */
.itbtn.saved { background: var(--gold-3); border-color: var(--gold); color: var(--ranked-fg); }
.itbtn.saved .ic { fill: var(--gold); }
.itwrap { max-width: 1200px; margin: 18px auto 0; }
.itwrap .tiny { color: var(--ink-3); margin-bottom: 4px; }
/* the checklist */
.cklist { display: grid; gap: 14px; }
.ckrow { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-1); padding: 18px 20px; transition: border-color .2s var(--ease); }
.ckrow.part { border-color: var(--gold-2); }
.ckrow.full { border-color: var(--green); background: linear-gradient(180deg, var(--green-bg), var(--card) 60%); }
.ckhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ckhead h3 { margin-top: 4px; font-size: 18px; line-height: 1.3; }
.cktally { text-align: right; flex: none; }
.cktally b { display: block; font-family: var(--font-display); font-size: 30px; line-height: 1; color: var(--burgundy); }
.ckrow.full .cktally b { color: var(--green); }
.cktally span { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.ckboxes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.ckbox { display: grid; gap: 6px; place-items: center; padding: 12px 8px; border-radius: 14px; border: 1px dashed var(--line-2);
         background: var(--white); font: inherit; color: var(--ink-3); cursor: pointer; transition: all .15s var(--ease); }
.ckbox:hover:not(:disabled) { border-color: var(--gold); background: var(--white-hover); transform: translateY(-1px); }
.ckbox .tick { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2);
               font-family: var(--font-display); font-size: 15px; font-weight: 700; background: var(--paper-2); }
.ckbox .when { font-size: 11px; text-align: center; line-height: 1.3; }
.ckbox.on { border-style: solid; border-color: var(--green); background: var(--green-bg); color: var(--green); }
.ckbox.on .tick { background: var(--green); border-color: var(--green); color: #fff; }
.ckbox.on .tick .ic { width: 17px; height: 17px; }
.ckbox:disabled { opacity: .6; cursor: wait; }
.cklast { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center;
          margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.cklast a { color: var(--burgundy); text-decoration: none; font-weight: 600; }
.cklast .ic { width: 13px; height: 13px; vertical-align: -2px; }
/* the same four boxes, on the chapter page itself */
.ckhere.part { border-color: var(--gold-2); }
.ckhere.full { border-color: var(--green); background: linear-gradient(180deg, var(--green-bg), var(--card) 60%); }
.ckhere.full .cktally b { color: var(--green); }
@media (max-width: 560px) { .ckboxes { grid-template-columns: repeat(2, 1fr); } .ckrow { padding: 15px 14px; } .ckhead h3 { font-size: 16px; } }
/* the checklist grid in the admin */
.ckgrid td.pass { text-align: center; font-variant-numeric: tabular-nums; }
.ckgrid td.pass b { color: var(--green); }
.ckgrid td.pass.none { color: var(--ink-3); }

/* ==========================================================================
   "Common is common" — the field guide section (common.html)
   Eight topics, each with an accent taken from the printed guide's own tiles.
   ========================================================================== */
:root {
  --t-red: #C2334F; --t-red-bg: #FBE7EB;
  --t-gold: #B8862B; --t-gold-bg: #FBF0D8;
  --t-teal: #0E7F7B; --t-teal-bg: #DDF2F1;
  --t-violet: #6B46C1; --t-violet-bg: #EDE7FA;
  --t-blue: #2463AF; --t-blue-bg: #E3EDFA;
  --t-green: #157F52; --t-green-bg: #DDF2E7;
  --t-orange: #C2591A; --t-orange-bg: #FCEADC;
  --t-pink: #B32A6B; --t-pink-bg: #FBE4EF;
  /* the flood behind a highlighted block: a whisper of the accent, not the accent */
  --t-red-wash: #FEF7F8; --t-gold-wash: #FEFBF3; --t-teal-wash: #F4FBFA; --t-violet-wash: #F9F7FD;
  --t-blue-wash: #F6FAFD; --t-green-wash: #F5FBF8; --t-orange-wash: #FEF9F4; --t-pink-wash: #FEF7FB;
}
:root[data-theme="dark"] {
  --t-red: #F0808F; --t-red-bg: rgba(194,51,79,.24);
  --t-gold: #E8BE63; --t-gold-bg: rgba(184,134,43,.24);
  --t-teal: #5CCFC9; --t-teal-bg: rgba(14,127,123,.26);
  --t-violet: #B9A0F2; --t-violet-bg: rgba(107,70,193,.28);
  --t-blue: #8FB8F0; --t-blue-bg: rgba(36,99,175,.26);
  --t-green: #64CB96; --t-green-bg: rgba(21,127,82,.26);
  --t-orange: #F0A469; --t-orange-bg: rgba(194,89,26,.26);
  --t-pink: #EE8AB6; --t-pink-bg: rgba(179,42,107,.26);
  --t-red-wash: rgba(194,51,79,.10); --t-gold-wash: rgba(184,134,43,.10); --t-teal-wash: rgba(14,127,123,.11);
  --t-violet-wash: rgba(107,70,193,.12); --t-blue-wash: rgba(36,99,175,.11); --t-green-wash: rgba(21,127,82,.11);
  --t-orange-wash: rgba(194,89,26,.11); --t-pink-wash: rgba(179,42,107,.11);
}
.t-red { --acc: var(--t-red); --acc-bg: var(--t-red-bg); --acc-wash: var(--t-red-wash); }
.t-gold { --acc: var(--t-gold); --acc-bg: var(--t-gold-bg); --acc-wash: var(--t-gold-wash); }
.t-teal { --acc: var(--t-teal); --acc-bg: var(--t-teal-bg); --acc-wash: var(--t-teal-wash); }
.t-violet { --acc: var(--t-violet); --acc-bg: var(--t-violet-bg); --acc-wash: var(--t-violet-wash); }
.t-blue { --acc: var(--t-blue); --acc-bg: var(--t-blue-bg); --acc-wash: var(--t-blue-wash); }
.t-green { --acc: var(--t-green); --acc-bg: var(--t-green-bg); --acc-wash: var(--t-green-wash); }
.t-orange { --acc: var(--t-orange); --acc-bg: var(--t-orange-bg); --acc-wash: var(--t-orange-wash); }
.t-pink { --acc: var(--t-pink); --acc-bg: var(--t-pink-bg); --acc-wash: var(--t-pink-wash); }

.cic-hero h1 { font-size: clamp(34px, 7vw, 58px); line-height: 1; letter-spacing: -.02em; margin: 8px 0 0; }
.cic-hero h1 span { color: var(--burgundy); }
.cic-hero .lede { max-width: 62ch; }

.cic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.cic-tile { display: flex; flex-direction: column; gap: 6px; min-height: 132px; padding: 16px 16px 14px;
  border-radius: 18px; text-decoration: none; background: var(--acc-bg); border: 1px solid transparent;
  box-shadow: var(--shadow-1); transition: transform .15s var(--ease), box-shadow .2s, border-color .2s; }
.cic-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--acc); }
.cic-tile .n { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1; color: var(--acc); }
.cic-tile .nm { font-family: var(--font-display); font-size: 17px; line-height: 1.25; color: var(--ink); font-weight: 600; }
.cic-tile .go { margin-top: auto; font-size: 12.5px; font-weight: 600; color: var(--acc); display: inline-flex; align-items: center; gap: 5px; }
.cic-tile .go .ic { width: 14px; height: 14px; }

.cic-files { display: grid; gap: 10px; }
.cic-file { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1); text-decoration: none; color: var(--ink);
  transition: transform .15s var(--ease), border-color .2s; }
.cic-file:hover { transform: translateY(-1px); border-color: var(--gold); }
.cic-file .ic { width: 22px; height: 22px; color: var(--burgundy); flex: none; }
.cic-file > .ic:last-child { margin-left: auto; width: 16px; height: 16px; color: var(--ink-3); }
.cic-file .tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cic-file .tx b { font-family: var(--font-display); font-size: 16.5px; }
.cic-file .tx small { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }

/* ---- one cheat card ---- */
.cheat { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--acc);
  border-radius: 20px; box-shadow: var(--shadow-1); padding: 24px; }
.cheat-top { display: flex; gap: 20px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.cheat-top h1 { font-size: clamp(24px, 4.4vw, 34px); line-height: 1.1; margin: 6px 0 0; display: flex; gap: 12px; align-items: baseline; }
.cheat-top h1 .no { color: var(--acc); font-size: .85em; }
.cheat-top .lede { margin-top: 10px; max-width: 70ch; font-size: 15.5px; }
.cheat-top .stamp { flex: none; font-size: 11.5px; line-height: 1.5; color: var(--ink-3); text-align: right;
  background: var(--acc-wash); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; max-width: 200px; }
.cheat-top .stamp b { display: block; color: var(--acc); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }

.cic-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-top: 20px; }
.cic-nums .tile { background: var(--acc-wash); border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px; }
.cic-nums .v { font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1.1; color: var(--acc); }
.cic-nums .v small, .cic-nums .v sup { font-size: .62em; }
.cic-nums .l { font-size: 11.5px; line-height: 1.35; color: var(--ink-2); margin-top: 3px; }

.cic-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin-top: 20px; }
.cic-cell { border: 1px solid var(--line); border-radius: 14px; padding: 14px 15px; background: var(--paper); }
.cic-cell.tint { background: var(--acc-wash); border-left: 3px solid var(--acc); padding-left: 13px; }
.cic-cell.wide { grid-column: 1 / -1; }
.cic-cell h3 { font-size: 16px; line-height: 1.3; margin: 0 0 8px; display: flex; gap: 9px; align-items: baseline; }
.cic-cell h3 .i { flex: none; width: 21px; height: 21px; border-radius: 50%; background: var(--acc); color: #fff;
  font-family: var(--font-ui); font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; align-self: flex-start; }
:root[data-theme="dark"] .cic-cell h3 .i { color: #161B2C; }
.cic-cell .bd { font-size: 13.8px; line-height: 1.55; color: var(--ink-2); }
.cic-cell .bd p { margin: 0 0 7px; }
.cic-cell .bd p:last-child { margin-bottom: 0; }
.cic-cell .bd b { color: var(--ink); }
.cic-cell .bd ul { margin: 6px 0; padding-left: 18px; }
.cic-cell .bd li { margin-bottom: 4px; }
.cic-cell .bd .two { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.cic-cell .bd table.mini { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.cic-cell .bd table.mini td { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.cic-cell .bd table.mini tr:last-child td { border-bottom: 0; }
.cic-cell .bd table.mini td.k { font-weight: 600; color: var(--ink); white-space: nowrap; padding-right: 12px; }

.cic-after { display: flex; gap: 10px; flex-wrap: wrap; }
.cic-nav { display: flex; justify-content: space-between; gap: 10px; }
.cic-foot { text-align: center; }
@media (max-width: 560px) {
  .cheat { padding: 16px 14px; border-radius: 16px; }
  .cheat-top .stamp { max-width: none; text-align: left; }
  .cic-cell .bd table.mini td.k { white-space: normal; }
}
/* the three tools inside a live quiz card, and on a results item */
.qtools { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.qtools .qnote { display: contents; }
.qtools .itnote, .qtools .itedit { flex-basis: 100%; }
.qnote.itools { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.qnote.itools .itnote, .qnote.itools .itedit { flex-basis: 100%; }

/* ==========================================================================
   v4.8 — the discussion under everything, votes, the highlighter, the Discussions page
   ========================================================================== */
:root { --hl: #FFE98A; --hl-2: #EED45A; --disc-a: #7A1F2B; --disc-b: #4A1220; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hl: #6B5A16; --hl-2: #8A7420; } }
:root[data-theme="dark"] { --hl: #6B5A16; --hl-2: #8A7420; }

/* the thread */
.thost { flex-basis: 100%; width: 100%; }
.thread { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--paper-2); border: 1px solid var(--line-2); text-align: left; cursor: auto; }
.thread.hide { display: none; }
.thread .skeleton { margin: 0; }
.post { padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); margin-top: 10px; }
.thread .post:first-child, .thread .tempty + .post { margin-top: 0; }
.post.challenge { border-left: 4px solid var(--gold); }
.post.challenge.accepted { border-left-color: var(--green); }
.post.challenge.rejected { border-left-color: var(--red); }
.phead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.phead b { font-weight: 600; }
.phead .tiny { color: var(--ink-3); }
.phead .vote { margin-left: auto; }
.phead .chip .ic { width: 12px; height: 12px; vertical-align: -2px; }
.pbody { margin-top: 6px; font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.pfix { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--sticky); border: 1px solid var(--gold-2); font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.pfix .tiny { display: block; color: var(--ranked-fg); font-weight: 600; margin-bottom: 2px; }
.pverdict { margin-top: 8px; padding: 8px 10px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; background: var(--green-bg); color: var(--green); }
.pverdict.rejected { background: var(--red-bg); color: var(--red); }
.pverdict .ic { width: 14px; height: 14px; vertical-align: -2px; }
.pwait { margin-top: 8px; color: var(--ranked-fg); }
.pwait .ic { width: 13px; height: 13px; vertical-align: -2px; }
.replies:empty { display: none; }
.reply { margin-top: 8px; margin-left: 12px; padding: 6px 10px 6px 12px; border-left: 2px solid var(--line-2); }
.reply .phead { font-size: 13px; }
.reply .pbody { font-size: 13.5px; margin-top: 3px; }
.vote { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--white); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
.vote .ic { width: 13px; height: 13px; }
.vote:hover { background: var(--tint); }
.vote.on { background: var(--gold-3); border-color: var(--gold); color: var(--ranked-fg); }
.vote:disabled { opacity: .6; cursor: default; }
.tiny-link { background: none; border: 0; padding: 4px 6px; margin-top: 4px; color: var(--ink-3); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; border-radius: 8px; }
.tiny-link:hover { background: var(--tint); color: var(--ink); }
.tiny-link .ic { width: 14px; height: 14px; vertical-align: -3px; }
.composer, .rcomposer { margin-top: 10px; }
.composer textarea, .rcomposer textarea { width: 100%; border-radius: 10px; border: 1px solid var(--line-2); background: var(--white); color: var(--ink); font: inherit; font-size: 14px; line-height: 1.5; padding: 10px 12px; resize: vertical; }
.composer textarea:focus, .rcomposer textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.ccomposer { padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--gold-2); }
.ccomposer .eyebrow .ic { width: 13px; height: 13px; vertical-align: -2px; }
.ccomposer p.tiny { margin: 4px 0 8px; line-height: 1.5; }
.tlock { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px dashed var(--line-2); font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.tlock .ic { width: 18px; height: 18px; flex: none; color: var(--gold); margin-top: 2px; }
.tempty { margin: 2px 0 8px; line-height: 1.5; }
.itbtn.locked { opacity: .72; }
.itbtn .ic { flex: none; }

/* the highlighter: tap a word, drag across a phrase */
.w { border-radius: 3px; padding: 1px 0; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.w.hl { background: var(--hl); box-shadow: 0 0 0 2px var(--hl); }
.marking { cursor: crosshair; user-select: none; -webkit-user-select: none; touch-action: none; }
.marking .w { cursor: pointer; }
.marking .w:hover { outline: 1.5px dashed var(--gold); outline-offset: 1px; }
.mkbtn.on { background: var(--hl); border-color: var(--gold); color: var(--ranked-fg); }
.mkbtn.on .ic { color: var(--ranked-fg); }
.fc-front .fc-text .w.hl { box-shadow: 0 0 0 1px var(--hl); }

/* the way in: the header dot, the menu count, the home banner */
.navdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-left: 6px; vertical-align: 2px; box-shadow: 0 0 0 2px var(--card); }
.menu .cnt { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--amber-bg); color: var(--amber); font-size: 11.5px; margin-left: 4px; }
.disc-banner { background: linear-gradient(135deg, var(--disc-a), var(--disc-b)); }
.disc-banner p b { display: inline; font-family: var(--font-ui); font-size: 12.5px; margin: 0; color: #fff; font-weight: 600; }
.disc-banner p b.hot { color: #FFE28A; }

/* the Discussions page */
.disc-hero .eyebrow .ic { width: 13px; height: 13px; vertical-align: -2px; }
.disc-hero .stats { margin-top: 16px; }
.disc-bar { gap: 12px; flex-wrap: wrap; }
.disc-bar select.input { width: auto; min-height: 40px; padding: 6px 12px; font-size: 14px; }
.dthread { padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); border-left: 5px solid var(--line-2); }
.dthread.needs { border-left-color: var(--gold); }
.dhead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.dlabel { font-family: var(--font-display); font-weight: 600; font-size: 16px; line-height: 1.45; margin-top: 8px; overflow-wrap: anywhere; }
.dmeta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.dmeta .chip .ic { width: 12px; height: 12px; vertical-align: -2px; }
.dmeta .btn .ic { width: 14px; height: 14px; }
.dthread .thread { margin-top: 12px; }
@media (max-width: 560px) { .dmeta .spacer { display: none; } .dmeta .btn { flex: 1; justify-content: center; } }

/* ==========================================================================
   v4.9 — the Booklets shelf, mixed duels, the suggestion box
   ========================================================================== */
.bk-hero h1 { margin-top: 6px; font-size: clamp(26px, 4vw, 40px); }
.bk-hero .eyebrow .ic { width: 14px; height: 14px; vertical-align: -2px; }
.bk-hero .stats { margin-top: 16px; }
.stat.hot b { color: var(--burgundy); }
.bk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.bk { position: relative; display: grid; grid-template-columns: 10px 1fr; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1); overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s; }
.bk:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.bk-spine { background: var(--acc); }
@supports (background: color-mix(in srgb, red 50%, white)) { .bk-spine { background: linear-gradient(180deg, var(--acc), color-mix(in srgb, var(--acc) 55%, #fff)); } }
.bk-body { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.bk-head { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; }
.bk .eyebrow { color: var(--acc); }
.bk-title { font-size: 25px; margin-top: 4px; line-height: 1.15; }
.bk-meta { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); }
.bk-meta b { color: var(--ink); }
.bk-meta .due { color: var(--amber); font-weight: 600; }
.bk-count { text-align: center; min-width: 76px; padding: 8px 10px; border-radius: 12px; background: var(--paper-2); flex: none; }
.bk-count b { display: block; font-family: var(--font-display); font-size: 24px; }
.bk-count span { font-size: 10.5px; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.bk .ring { flex: none; }
.bk-desc { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.bk-chapters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.bk-chapters a.chip { text-decoration: none; }
.bk-chapters .chip .ic { width: 12px; height: 12px; vertical-align: -2px; }
.bk-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.bk-foot .chip .ic { width: 12px; height: 12px; vertical-align: -2px; }
.bk-foot .btn .ic { width: 15px; height: 15px; }
.bk-last { margin: -4px 0 0; }
.bk-continue { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; border-radius: 16px; background: var(--acc); color: #fff; text-decoration: none; box-shadow: var(--shadow-1); transition: transform .15s var(--ease); }
@supports (background: color-mix(in srgb, red 50%, white)) { .bk-continue { background: linear-gradient(135deg, var(--acc), color-mix(in srgb, var(--acc) 72%, #000)); } }
.bk-continue:hover { transform: translateY(-2px); }
.bk-continue .ic-wrap { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.16); display: grid; place-items: center; }
.bk-continue .ic-wrap .ic { width: 20px; height: 20px; }
.bk-continue .eyebrow { color: rgba(255,255,255,.78); }
.bk-continue b { display: block; font-family: var(--font-display); font-size: 17px; line-height: 1.25; }
.bk-continue p { margin: 3px 0 0; font-size: 12.5px; color: rgba(255,255,255,.82); }
.bk-continue .go { white-space: nowrap; font-weight: 600; font-size: 13px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bk .eyebrow { filter: brightness(1.6) saturate(.8); } }
:root[data-theme="dark"] .bk .eyebrow { filter: brightness(1.6) saturate(.8); }
@media (max-width: 560px) { .bk-grid { grid-template-columns: 1fr; } .bk-title { font-size: 22px; } .bk-body { padding: 16px 14px 12px; } .bk-continue { grid-template-columns: auto 1fr; } .bk-continue .go { grid-column: 2; } }

/* the duel dialog: any mix of chapters */
.duelpick { display: grid; gap: 6px; max-height: 46vh; overflow: auto; padding: 2px; margin-top: 12px; }
.duelpick .grp { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 8px 0 0; }
.duelpick label { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--white); cursor: pointer; font-size: 14px; }
.duelpick label:hover { background: var(--white-hover); }
.duelpick label.on { background: var(--gold-3); border-color: var(--gold); }
.duelpick input { width: 18px; height: 18px; accent-color: var(--burgundy); }
.duelpick label .tiny { margin-left: auto; white-space: nowrap; }
.duelcount { display: flex; gap: 8px; margin-top: 12px; }
.duelcount button { flex: 1; }
.duelmix { font-size: 13.5px; color: var(--ink-2); margin-top: 10px; min-height: 20px; }

/* the suggestion box */
.sbox textarea.input { min-height: 120px; font-family: inherit; font-size: 15px; line-height: 1.5; }
.sbox .tiny .ic { width: 13px; height: 13px; vertical-align: -2px; }
.menu button .cnt { margin-left: 6px; }
.bk-banner { background: linear-gradient(135deg, #1B6F73, #12484B); }
.bk-banner p b.hot { color: #FFE28A; }
.bk-banner p b { display: inline; font-family: var(--font-ui); font-size: 12.5px; margin: 0; color: #fff; font-weight: 600; }

/* ==========================================================================
   v5.1 — the logo and the moving layer (motion.js).
   Nothing here changes how a page looks once it has settled: it only changes how
   things arrive, answer a touch and leave. Everything sits under .m-on (set by
   motion.js), so if that script ever fails to load, the site is simply still.
   ========================================================================== */
:root {
  --m-out: cubic-bezier(.16, 1, .3, 1); --m-in: cubic-bezier(.5, 0, .75, 0); --m-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* The two approved bear illustrations share a frame. Honor both the site setting and the system theme. */
.tmark { display: block; }
.tmark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.tmark .teddy-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tmark .teddy-light { display: none; }
  :root:not([data-theme="light"]) .tmark .teddy-dark { display: block; }
}
:root[data-theme="dark"] .tmark .teddy-light { display: none; }
:root[data-theme="dark"] .tmark .teddy-dark { display: block; }
.brand .tmark { width: 33px; height: 33px; flex: none; align-self: center; margin-right: 1px; }
.m-on .brand.intro .tmark img { animation: m-track .6s var(--m-out) both; animation-delay: calc(var(--tm-o, 0ms) + 60ms); }
.m-on .brand.intro .word { animation: m-word .8s var(--m-out) both; animation-delay: calc(var(--tm-o, 0ms) + 220ms); }
.m-on .brand.intro .site { animation: m-track 1s var(--m-out) both; animation-delay: calc(var(--tm-o, 0ms) + 520ms); }
@keyframes m-word { from { opacity: 0; transform: translateX(-10px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes m-track { from { opacity: 0; } to { opacity: 1; } }

/* ---------- the warm light: the gold glow at the top of the page now drifts, very slowly ---------- */
.m-on body { background-image: radial-gradient(700px 400px at 100% 10%, var(--glow-b, rgba(122,31,43,.07)), transparent 70%); }
.m-ambient { position: absolute; top: 0; left: 0; width: 100%; height: 1100px; overflow: hidden; pointer-events: none; z-index: 0; }
.m-ambient i { position: absolute; inset: -10%; background: radial-gradient(1200px 520px at 50% -70px, var(--glow-a, rgba(224,200,112,.35)), transparent 70%); will-change: transform; }
.m-on .m-ambient i { animation: m-drift 38s ease-in-out infinite alternate; }
@keyframes m-drift { 0% { transform: translate3d(-4%, 0, 0) scale(1); } 50% { transform: translate3d(3%, 3%, 0) scale(1.06); } 100% { transform: translate3d(5%, -1%, 0) scale(1.02); } }
:root:not(.m-on) .m-ambient { display: none; }

/* ---------- page transitions ---------- */
.m-on .page.m-leave { animation: m-leave .15s var(--m-in) both; pointer-events: none; }
@keyframes m-leave { to { opacity: 0; transform: translateY(-8px); } }
.m-on .page.m-still, .m-on .page.m-dir-next, .m-on .page.m-dir-prev { animation: none; }
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }        /* moving between the site's pages: a soft cross-fade instead of a blink */
  ::view-transition-old(root) { animation: m-vt-out .2s var(--m-in) both; }
  ::view-transition-new(root) { animation: m-vt-in .4s var(--m-out) both; }
  .topbar { view-transition-name: topbar; }
}
@keyframes m-vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes m-vt-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- arrivals: cards and rows rise in one after another; the ones further down rise as they scroll in ---------- */
.m-on .m-rise { animation: m-rise .72s var(--m-out) backwards; animation-delay: var(--m-d, 0ms); }
@keyframes m-rise { from { opacity: 0; transform: translateY(20px) scale(.985); } }
.m-on .options > .opt.m-rise { animation-name: m-opt; }
@keyframes m-opt { from { opacity: 0; transform: translateX(-14px); } }
.m-num { font-variant-numeric: tabular-nums; }
.m-on .m-bump { animation: m-bump .45s var(--m-spring); }
@keyframes m-bump { 40% { transform: scale(1.18); } }
.m-on .hero h1 .accent { display: inline-block; animation: m-write 1s .5s var(--m-out) backwards; }
@keyframes m-write { from { clip-path: inset(-10% 100% -20% 0); transform: translateY(6px); } to { clip-path: inset(-10% 0 -20% 0); transform: none; } }

/* ---------- the header ---------- */
.topbar { transition: box-shadow .35s ease; }
.m-on .topbar.m-scrolled { box-shadow: 0 12px 32px -22px rgba(27, 46, 85, .45); }

/* ---------- touch: springs, ripples, a sheen ---------- */
.m-on .btn { transition: transform .4s var(--m-spring), box-shadow .2s, background .2s, opacity .2s; }
.m-on .btn:active:not(:disabled) { transform: scale(.95); transition-duration: .08s; }
.m-on .opt:active:not(:disabled), .m-on .eopt:active:not(:disabled) { transform: scale(.985); }
.m-on .tile:active, .m-on .tcell:active, .m-on .res:active, .m-on .hist-banner:active, .m-on .resume:active { transform: scale(.975); transition-duration: .08s; }
.m-ripple-w { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 0; }
.m-ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .18; transform: scale(0); animation: m-ripple .65s var(--m-out) forwards; pointer-events: none; }
@keyframes m-ripple { to { transform: scale(1); opacity: 0; } }
.m-on .btn.primary, .m-on .btn.gold, .m-on .resume, .m-on .hist-banner { position: relative; overflow: hidden; isolation: isolate; }
.m-on .btn.primary::after, .m-on .btn.gold::after, .m-on .resume::after, .m-on .hist-banner::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 32%, rgba(255,255,255,.3) 50%, transparent 68%); transform: translateX(-130%);
}
@media (hover: hover) {
  .m-on .btn.primary::after, .m-on .btn.gold::after, .m-on .hist-banner::after { transition: transform .9s var(--m-out); }
  .m-on .btn.primary:hover::after, .m-on .btn.gold:hover::after, .m-on .hist-banner:hover::after { transform: translateX(130%); }
}
.m-on .resume::after { animation: m-sheen 1.5s 1.1s var(--m-out) both; }   /* "continue where you left off" catches the light once */
@keyframes m-sheen { from { transform: translateX(-130%); } to { transform: translateX(130%); } }
.m-on .resume .go .ic, .m-on .hist-banner .go .ic { transition: transform .35s var(--m-spring); }
.m-on .resume:hover .go .ic, .m-on .hist-banner:hover .go .ic { transform: translateX(4px); }

/* ---------- laptops: cards lean toward the mouse, a soft light follows it ---------- */
.m-on .m-tilt { transform: perspective(900px) rotateX(var(--rx, 0)) rotateY(var(--ry, 0)) translateY(-3px) !important; transition: transform .14s linear, box-shadow .25s ease !important;
  background-image: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(224, 200, 112, .13), transparent 46%); box-shadow: var(--shadow-2); }

/* ---------- menus and dialogs ---------- */
.m-on .menu { transform-origin: 100% 0; animation: m-menu .34s var(--m-spring) both; }
.m-on .menu > * { animation: m-item .36s var(--m-out) backwards; animation-delay: calc(var(--i, 0) * 22ms + 50ms); }
@keyframes m-menu { from { opacity: 0; transform: translateY(-8px) scale(.94); } }
@keyframes m-item { from { opacity: 0; transform: translateY(-5px); } }
.m-on .modal { animation: m-modal .5s var(--m-spring) both; }
@keyframes m-modal { from { opacity: 0; transform: translateY(22px) scale(.93); } }
.m-ghost-bg { position: fixed; inset: 0; z-index: 39; background: var(--overlay); pointer-events: none; animation: m-fade-out .24s ease both; }
@keyframes m-fade-out { to { opacity: 0; } }
.m-on .toast { animation: m-toast .55s var(--m-spring) both; }
.m-on .toast.m-out { transform: translateY(12px) scale(.95); }
@keyframes m-toast { from { opacity: 0; transform: translateY(18px) scale(.9); } }
.m-on .modal.tour .art { animation: m-pop .6s var(--m-spring) backwards; }
.m-on .modal.tour .art .ic { animation: m-art .9s .08s var(--m-spring) backwards; }
.m-on .modal.tour h3, .m-on .modal.tour p { animation: m-rise .55s var(--m-out) backwards; }
.m-on .modal.tour p { animation-delay: .07s; }
.m-on .modal.tour .dots i { transition: all .4s var(--m-spring); }
@keyframes m-pop { from { opacity: 0; transform: scale(.85); } }
@keyframes m-art { from { transform: scale(.4) rotate(-25deg); opacity: 0; } }
/* the appearance and text-size switches: one pill slides between the choices */
.seg.m-has-pill { position: relative; isolation: isolate; }
.seg .m-pill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; z-index: -1; border-radius: 999px; background: var(--solid); transition: transform .45s var(--m-spring), width .45s var(--m-spring); }
.seg.m-has-pill button.on { background: transparent; }
.seg.m-has-pill button { transition: color .25s; }

/* ---------- the quiz ---------- */
.opt.picked { border-color: var(--burgundy); box-shadow: 0 0 0 4px rgba(122, 31, 43, .1); }
.opt.picked .letter { background: var(--burgundy); color: #fff; }
.m-on .opt.picked .letter { animation: m-pick .5s var(--m-spring); }
.m-on .opt.picked::before { content: ""; position: absolute; inset: -2px; border-radius: inherit; border: 2px solid var(--burgundy); animation: m-ping 1s var(--m-out) infinite; pointer-events: none; }
.m-on .opt.picked { position: relative; }
@keyframes m-pick { 0% { transform: scale(.8); } 55% { transform: scale(1.2); } 100% { transform: none; } }
@keyframes m-ping { from { opacity: .55; transform: scale(1); } to { opacity: 0; transform: scale(1.04, 1.18); } }
.m-on .m-still .opt.correct { animation: m-correct .8s var(--m-out); }
.m-on .m-still .opt.correct .letter, .m-on .m-still .opt.wrong .letter { animation: m-pick .55s var(--m-spring); }
@keyframes m-correct { 0% { box-shadow: 0 0 0 0 rgba(47, 122, 68, .45); } 35% { transform: scale(1.012); } 100% { box-shadow: 0 0 0 16px rgba(47, 122, 68, 0); transform: none; } }
.m-on .m-still .feedback { animation: m-feedback .6s var(--m-out) both; }
@keyframes m-feedback { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.m-on .m-still .qtools { animation: m-rise .55s .22s var(--m-out) backwards; }
.m-on .m-still #next:not(:disabled), .m-on .m-still #finish:not(:disabled) { animation: m-nudge 1.2s .55s var(--m-out) both; }
@keyframes m-nudge { 0%, 60%, 100% { transform: none; } 22% { transform: translateX(6px); } 42% { transform: translateX(-2px); } }
.m-on .segments i { transition: background .4s; }
.m-on .page:not(.m-still) .segments i.cur { animation: m-seg .6s var(--m-spring); }
.m-on .m-dir-next .segments i:has(+ i.cur) { animation: m-seg .6s var(--m-spring); }
@keyframes m-seg { 45% { transform: scaleY(2.3); } }
.m-on .m-dir-next .qcard { animation: m-in-next .45s var(--m-out) backwards; }
.m-on .m-dir-prev .qcard { animation: m-in-prev .45s var(--m-out) backwards; }
.m-on .qcard.m-out-next { animation: m-out-next .15s var(--m-in) both; pointer-events: none; }
.m-on .qcard.m-out-prev { animation: m-out-prev .15s var(--m-in) both; pointer-events: none; }
@keyframes m-in-next { from { opacity: 0; transform: translateX(42px); } }
@keyframes m-in-prev { from { opacity: 0; transform: translateX(-42px); } }
@keyframes m-out-next { to { opacity: 0; transform: translateX(-38px); } }
@keyframes m-out-prev { to { opacity: 0; transform: translateX(38px); } }

/* ---------- results ---------- */
.m-on .score-hero .verdict .accent { display: inline-block; animation: m-write 1s .5s var(--m-out) backwards; }
.m-on .score-hero .seal { animation: m-stamp .7s 1.2s var(--m-spring) backwards; }
@keyframes m-stamp { from { opacity: 0; transform: scale(2.1) rotate(-16deg); } 55% { opacity: 1; } }

/* ---------- the leaderboard: the podium rises, third first, the gold medal last ---------- */
.m-on .podium .pod { transform-origin: 50% 100%; animation: m-pod .85s var(--m-spring) backwards; }
.m-on .podium .pod.p3 { animation-delay: .08s; } .m-on .podium .pod.p2 { animation-delay: .22s; } .m-on .podium .pod.p1 { animation-delay: .36s; }
.m-on .podium .pod .medal { animation: m-medal .75s var(--m-spring) backwards; }
.m-on .podium .pod.p3 .medal { animation-delay: .42s; } .m-on .podium .pod.p2 .medal { animation-delay: .56s; }
.m-on .podium .pod.p1 .medal { animation: m-medal .75s .7s var(--m-spring) backwards, m-shine 4s 2.2s ease-in-out infinite; }
@keyframes m-pod { from { opacity: 0; transform: translateY(40px) scaleY(.7); } }
@keyframes m-medal { from { transform: scale(0) rotate(-200deg); } }
@keyframes m-shine { 0%, 82%, 100% { filter: none; transform: none; } 90% { filter: brightness(1.25) saturate(1.2); transform: scale(1.08); } }

/* ---------- flashcards ---------- */
.m-on .fc-inner { transition: transform .62s cubic-bezier(.3, 1.3, .45, 1); }
.m-on .fc { touch-action: pan-y; }
.m-on #stage > .fc:not(.m-still), .m-on #stage > .eloop:not(.m-still) { animation: m-card-in .5s var(--m-out) backwards; }
@keyframes m-card-in { from { opacity: 0; transform: translateY(16px) scale(.965); } }
.m-on .fc.m-dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.m-on .fc-mark .btn { transition: transform .3s var(--m-spring), box-shadow .2s, background .2s, opacity .25s; }
.m-on .fc-mark .btn.m-armed { transform: scale(1.1); box-shadow: 0 12px 26px -10px currentColor; }
.m-on #tally.m-bump, .m-on #cnt-due.m-bump { display: inline-block; }

/* ---------- small moments ---------- */
.m-on .userpill .flame svg, .m-on .tcell .big.hot svg[fill="currentColor"] { transform-origin: 50% 90%; animation: m-flicker 2.6s ease-in-out infinite; }
@keyframes m-flicker { 0%, 100% { transform: rotate(-3deg) scale(1); } 25% { transform: rotate(2deg) scale(1.06, .96); } 50% { transform: rotate(-1deg) scale(.97, 1.05); } 75% { transform: rotate(3deg) scale(1.04); } }
.m-on .itbtn.on .ic, .m-on .itbtn.saved .ic, .m-on .vote.on .ic { animation: m-pop2 .5s var(--m-spring); }
@keyframes m-pop2 { 0% { transform: scale(.6); } 60% { transform: scale(1.3); } 100% { transform: none; } }
.m-on .tab.active { animation: m-tab .45s var(--m-spring); }
@keyframes m-tab { 0% { transform: scale(.92); } 60% { transform: scale(1.04); } 100% { transform: none; } }
.m-on .ckbox.on .tick, .m-on .hitem.on .box { animation: m-pop2 .45s var(--m-spring); }
.m-on .countdown.soon .days b { animation: m-beat 2.6s ease-in-out 2s infinite; }
@keyframes m-beat { 0%, 70%, 100% { transform: none; } 78% { transform: scale(1.1); } 86% { transform: scale(.98); } }
.m-on .ea { animation: m-feedback .55s var(--m-out) both; }
.m-on .eopt.right { animation: m-correct .8s var(--m-out); }

@media (prefers-reduced-motion: reduce) {
  .m-ambient i, .m-on .brand.intro .tmark img, .m-on .userpill .flame svg, .m-on .podium .pod.p1 .medal { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- v5.1 fixes (no visual change once settled) ---------- */
/* sub-page headers: the chapter's long title now shrinks with an ellipsis instead of pushing the gear off the screen */
.topbar .wrap > .title { flex: 1 1 auto; flex-shrink: 1; min-width: 0; }
/* long names (Arabic or English) never push the header or the podium off the screen */
.userpill .nm { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) { .userpill .nm { max-width: 74px; } .topbar .wrap { gap: 8px; } }
.pod { min-width: 0; }
.pod .name { unicode-bidi: plaintext; }
.brow .nm { min-width: 0; }
.brow .nm .nmt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; unicode-bidi: plaintext; }
/* iPhone zooms into any text box under 16 px and stays zoomed */
@media (max-width: 760px) { textarea, select, textarea.input, select.input, .composer textarea, .itedit textarea { font-size: 16px; } }
/* search: a flashcard's front in plain bold — only the matched words get the highlight */
.sres .snip .sfront { font-weight: 600; }
/* phones: the account button is the avatar (and the streak flame) — the name lives in its menu — so the header always fits */
@media (max-width: 480px) {
  .userpill .nm, .userpill .caret { display: none; }
  .userpill { gap: 6px; padding: 5px 10px 5px 5px; }
  .topbar .wrap { gap: 6px; }
  .topbar .iconbtn { margin-right: 2px; }
}
@media (max-width: 360px) { .brand .word { font-size: 20px; } .brand .tmark { width: 29px; height: 29px; } }
@media (max-width: 340px) { .topbar .wrap { padding-inline: 10px; gap: 3px; } }

/* ==========================================================================
   v5.0 — sit a past paper, my mistakes, this week's board
   ========================================================================== */
/* the board: Overall · This week · one menu for the 18 chapter boards */
.board-tabs { flex-wrap: wrap; align-items: center; }
.board-tabs .tab { flex: none; }
/* v5.3.4: six tabs — when the row runs out of room the chapter menu moves to a line of its own instead of shrinking to nothing */
.board-tabs .bsel { min-width: 190px; }
:is(.board-tabs, .ppick) .bsel { position: relative; flex: 1 1 auto; min-width: 0; max-width: 300px; }
:is(.board-tabs, .ppick) .bsel select { width: 100%; -webkit-appearance: none; appearance: none; padding: 8px 34px 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .2s, color .2s, border-color .2s; }
:is(.board-tabs, .ppick) .bsel::after { content: ""; position: absolute; right: 15px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
:is(.board-tabs, .ppick) .bsel.on select { background: var(--solid); color: #fff; border-color: var(--solid); }
:is(.board-tabs, .ppick) .bsel.on::after { border-color: #fff; }
:is(.board-tabs, .ppick) .bsel select:hover { border-color: var(--gold); }
:is(.board-tabs, .ppick) .bsel select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 760px) { :is(.board-tabs, .ppick) .bsel select { font-size: 16px; padding-block: 6px; } }
/* on a phone the menu gets its own row, so "Chapter 29 · Part 3" fits */
@media (max-width: 560px) { .board-tabs { flex-wrap: wrap; } :is(.board-tabs, .ppick) .bsel { flex: 1 1 100%; max-width: none; } }

/* sit a past paper: the papers on the shelf */
.papers h2 { font-size: clamp(22px, 3vw, 28px); }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pp { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 14px 14px 13px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1); text-decoration: none; color: var(--ink); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.pp::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--burgundy), var(--gold)); opacity: .85; }
.pp:hover { border-color: var(--gold); box-shadow: var(--shadow-2); }
.pp-k { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.pp-name { font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.15; }
.pp-n { font-size: 12.5px; color: var(--ink-3); }
.pp-st { font-size: 13px; font-weight: 500; margin-top: 6px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 0 5px; align-items: center; }
.pp-st.on { color: var(--burgundy); font-weight: 600; }
.pp-st.done { color: var(--green); }
.pp-st .ic { width: 14px; height: 14px; flex: none; }
.pp-bar { display: block; height: 5px; border-radius: 999px; background: var(--tint-2); overflow: hidden; margin-top: 3px; }
.pp-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--burgundy), var(--gold)); }
.pp-sat { font-size: 11.5px; color: var(--ink-3); }

/* sit a past paper: before, during, after */
.pp-intro h1 { font-size: clamp(34px, 6vw, 52px); line-height: 1.05; }
.pp-last { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 14px; background: var(--tint); font-size: 14px; }
.pp-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pp-mode { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 18px 18px 16px; border-radius: 18px; border: 1.5px solid var(--line-2); background: var(--card); cursor: pointer; font: inherit; color: var(--ink); box-shadow: var(--shadow-1); transition: border-color .2s, box-shadow .2s, transform .2s; }
.pp-mode b { font-family: var(--font-display); font-size: 19px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.pp-mode b .ic { width: 18px; height: 18px; color: var(--burgundy); }
.pp-mode span { font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.pp-mode:hover { border-color: var(--gold); box-shadow: var(--shadow-2); }
.pp-mode[data-mode="exam"] { border-color: var(--burgundy); background: linear-gradient(180deg, var(--highlight, var(--sticky)), var(--card)); }
@media (max-width: 560px) { .pp-modes { grid-template-columns: 1fr; } }
.pp-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-top .spacer { flex: 1; }
.pp-top .btn .ic { width: 15px; height: 15px; }
@media (max-width: 420px) { .pp-top .pp-ans { display: none; } }
.pp-card .stem { white-space: normal; }
.pp-jumpgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; max-height: 46vh; overflow: auto; padding: 2px; }
.pp-jumpgrid button { height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.pp-jumpgrid button.done { background: var(--solid); border-color: var(--solid); color: #fff; }
.pp-jumpgrid button.ok { background: var(--green); border-color: var(--green); color: #fff; }
.pp-jumpgrid button.bad { background: var(--red); border-color: var(--red); color: #fff; }
.pp-jumpgrid button.cur { outline: 2px solid var(--gold); outline-offset: 2px; }
.pp-subjects .qs { grid-template-columns: minmax(96px, 150px) 1fr 52px; }
.pp-subjects .qs .n { color: var(--ink-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* my mistakes: one fold per chapter */
.mgroup { border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow-1); padding: 4px 14px; }
.mgroup > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 2px; cursor: pointer; font-size: 15px; }
.mgroup > summary::-webkit-details-marker { display: none; }
.mgroup > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); transition: transform .25s; margin-left: 4px; flex: none; }
.mgroup[open] > summary::after { transform: rotate(-135deg); }
.mgroup > summary > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgroup > summary .cnt { margin-left: auto; display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--red-bg); color: var(--red); font-size: 12px; font-weight: 700; }
.mgroup .review { padding-bottom: 12px; }
.mgroup .ritem { box-shadow: none; }
/* long words in a booklet question (lab values, run-together words) wrap instead of widening the page */
.paperview .review, .mistakes .review { grid-template-columns: minmax(0, 1fr); }
.paperview .ritem, .mistakes .ritem, .pp-card .stem, .pp-card .opt { overflow-wrap: anywhere; }
.pp-card .opt > span:nth-child(2) { min-width: 0; }

/* ==========================================================================
   v5.3 — Due today (due.html), My mistakes "fixed once", My progress (progress.html), My notebook (notebook.html)
   ========================================================================== */
/* my mistakes: fixed once, waiting for (or due for) its check */
.ritem.check { border-left-color: var(--amber); }
.chip.check { background: var(--amber-bg); color: var(--amber); white-space: normal; }
.chip.check.soft { background: var(--tint); color: var(--ink-2); }
.mgroup.calm > summary .cnt { background: var(--amber-bg); color: var(--amber); }

/* due today: the piles as tabs, the quiet line under the buttons, the decks one by one */
.due-tabs .tab { display: inline-flex; align-items: center; gap: 2px; }
.due-tabs .tab .cnt:empty { display: none; }
.due-status { min-height: 1.6em; margin-top: 4px; color: var(--ink-2); }
.due-links { display: grid; padding-bottom: 8px; }
.due-links a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 2px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 14px; min-height: 44px; }
.due-links a .ic { width: 16px; height: 16px; vertical-align: -3px; color: var(--ink-3); }
.due-links a .n { flex: none; font-size: 12.5px; font-weight: 600; color: var(--amber); white-space: nowrap; }
.due-links a:hover { color: var(--burgundy); }

/* my progress: one row per chapter part, coloured by the questions answered right */
.pm-stat.red b { color: var(--red); } .pm-stat.amber b { color: var(--amber); } .pm-stat.green b { color: var(--green); }
.pm-weak { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-left: 5px solid var(--gold); }
.pm-weak > div { flex: 1 1 260px; min-width: 0; }
.pm-list { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.pm-row { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-1); padding: 14px 16px; }
.pm-row.lvl-red { border-left-color: var(--red); } .pm-row.lvl-amber { border-left-color: var(--amber); } .pm-row.lvl-green { border-left-color: var(--green); }
.pm-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; }
.pm-badge { display: grid; place-items: center; align-content: center; width: 58px; height: 58px; border-radius: 14px; background: var(--tint); color: var(--ink-3); font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1; }
.pm-badge small { font-family: var(--font-ui); font-size: 11px; font-weight: 600; margin-top: 2px; }
.lvl-red .pm-badge { background: var(--red-bg); color: var(--red); } .lvl-amber .pm-badge { background: var(--amber-bg); color: var(--amber); } .lvl-green .pm-badge { background: var(--green-bg); color: var(--green); }
.pm-name b { display: block; font-size: 15.5px; }
.pm-name > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.pm-lvl { margin-left: 6px; font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.lvl-red .pm-lvl { color: var(--red); } .lvl-amber .pm-lvl { color: var(--amber); } .lvl-green .pm-lvl { color: var(--green); }
.pm-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 16px; margin-top: 12px; font-size: 13.5px; }
.pm-fact .k, .pm-deck .k { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); }
.pm-fact .v { color: var(--ink); }
.pm-fact .v a { color: var(--burgundy); text-decoration: none; font-weight: 600; } .pm-fact .v a .ic { width: 13px; height: 13px; vertical-align: -2px; }
.pm-vs { color: var(--ink-3); white-space: nowrap; } .pm-vs.up { color: var(--green); } .pm-vs.down { color: var(--red); }
.pm-dots { display: inline-flex; gap: 3px; vertical-align: -1px; }
.pm-dots i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-2); }
.pm-dots i.on { background: var(--gold); border-color: var(--gold); }
.pm-decks { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 16px; margin-top: 12px; }
.pm-deck { display: block; text-decoration: none; color: var(--ink); font-size: 13.5px; }
.pm-deck .v small { color: var(--ink-3); }
.pm-bar { display: block; height: 6px; border-radius: 99px; background: var(--tint-2); overflow: hidden; margin-top: 4px; }
.pm-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--burgundy), var(--gold)); }
.pm-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* my notebook */
.nb-filters .mix-chip { min-height: 36px; }
.nb-list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); padding-bottom: 12px; }
.nb-note { padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); overflow-wrap: anywhere; }
.nb-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--burgundy); }
.nb-meta .ic { width: 14px; height: 14px; flex: none; }
.nb-item { margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.nb-note .itnote { margin-top: 8px; }
.nb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.nb-actions:empty { display: none; }
.nb-detail { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--tint); font-size: 14px; line-height: 1.55; }
.nb-d-q { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; }
.nb-d-a { margin-top: 10px; } .nb-d-a .lbl { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--ranked-fg); margin-bottom: 2px; }
.nb-opts { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.nb-opts li { padding: 4px 8px; border-radius: 8px; }
.nb-opts li b { display: inline-block; min-width: 1.4em; }
.nb-opts li.right { background: var(--green-bg); color: var(--green); font-weight: 600; }
.nb-pic { display: block; max-width: 100%; max-height: 220px; margin-bottom: 8px; border-radius: 10px; background: #fff; }
.nb-hit { background: var(--gold-3); color: var(--ink); border-radius: 4px; padding: 0 2px; }
.nbquiz .itnote { margin-top: 12px; }
.nbquiz .itnote .ic { width: 14px; height: 14px; vertical-align: -2px; }
@media (max-width: 560px) {
  .pm-badge { width: 50px; height: 50px; font-size: 18px; }
  .pm-weak .btn { width: 100%; }
  .due-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .due-tabs .tab { justify-content: center; }
}

/* v5.1 — the booklet, one paper at a time: "Solve one paper" + the same pill select as the board's chapter menu */
.ppick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ppick > .tiny { font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.ppick .bsel { flex: 1 1 200px; }
/* v5.1 — Admin → Progress */
.pg-table td { vertical-align: middle; }
.pg-row { cursor: pointer; }
.pg-row:hover td, .pg-row.open td { background: var(--gold-bg, rgba(201,154,59,.08)); }
.pg-bar { display: inline-block; width: 56px; height: 6px; border-radius: 99px; background: var(--line-2); vertical-align: middle; margin-left: 6px; overflow: hidden; }
.pg-bar i { display: block; height: 100%; background: var(--gold); border-radius: inherit; }
.pg-detail td { background: var(--card); }
.pg-grid { display: grid; gap: 14px; padding: 6px 2px 10px; }
.pg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pg-chips .chip { font-size: 12.5px; padding: 3px 10px; }
/* v5.1 — the board tabs on a phone: a tidy grid of two columns, the chapter menu under them
   (v5.3.4: six tabs — ELOOPs and Self-assessment share the third row) */
@media (max-width: 560px) {
  .board-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .board-tabs .tab { text-align: center; }
  .board-tabs .bsel { grid-column: 1 / -1; }
}
/* v5.1 — Build your own mix */
.mix-tabs .tab { display: inline-flex; align-items: center; gap: 6px; }
.mix-tabs .tab .ic { width: 15px; height: 15px; }
.mix-groups { display: grid; gap: 12px; }
.mix-g { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.mix-g:last-child { border-bottom: 0; padding-bottom: 0; }
.mix-gh { font-size: 14.5px; margin-bottom: 6px; }
.mix-gh .tiny { color: var(--ink-2); }
.mix-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mix-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.mix-chip:hover { border-color: var(--gold); }
.mix-chip.on { background: var(--solid); color: #fff; border-color: var(--solid); }
.mix-chip .n { font-size: 11.5px; font-weight: 700; opacity: .7; }
.mix-chip.small { padding: 5px 11px; font-size: 13px; }
.mix-years { margin-top: 10px; padding-left: 10px; border-left: 2px solid var(--gold); }
.mix-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ============================================================ v5.1 — the wheel drives the page (scroll.js) */
.hero-pin { position: relative; z-index: 1; }
.hero-stage { position: sticky; top: 62px; min-height: calc(100svh - 62px); display: grid; overflow: hidden; }
.galaxy { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-in { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 24px; padding-block: 10px 56px; }
.hero-copy { will-change: transform, opacity; }
.hero-obj { perspective: 1400px; perspective-origin: 50% 40%; display: grid; place-items: center; }
.obj3d { position: relative; width: clamp(150px, 20vw, 290px); aspect-ratio: 1; transform-style: preserve-3d; will-change: transform; }
.obj3d .tmark { width: 100%; height: 100%; }
.home-rest { position: relative; z-index: 2; margin-top: -50vh; background: var(--bg); border-radius: 28px 28px 0 0; box-shadow: 0 -24px 60px rgba(27,46,85,.12); padding-top: 6px; }
.bk-band { display: block; position: relative; overflow: hidden; border-radius: 16px; text-decoration: none; color: #fff; background: linear-gradient(135deg, #1B6F73, #12484B); box-shadow: var(--shadow-1); min-height: 112px; }
.bk-band .bk-track { position: absolute; left: -6%; top: 10px; width: 160%; display: flex; white-space: nowrap; rotate: -2.2deg; transform-origin: 0 50%; padding: 8px 0; background: rgba(255,255,255,.1); border-block: 1px solid rgba(255,255,255,.18);
  font-family: var(--font-display); font-weight: 700; font-size: clamp(17px, 2.2vw, 26px); line-height: 1.2; will-change: transform; }
.bk-band .bk-track span { padding-right: 1.1em; } .bk-band .bk-track span::after { content: "✦"; color: #FFE28A; margin-left: 1.1em; font-size: .65em; vertical-align: .15em; }
.bk-band .bk-go { position: relative; display: block; padding: 66px 16px 14px; font-size: 12.5px; line-height: 1.45; color: rgba(255,255,255,.92); }
.bk-band .bk-go b { color: #fff; } .bk-band .bk-go .ic { width: 15px; height: 15px; vertical-align: -3px; } .bk-band .bk-go .go { white-space: nowrap; font-weight: 600; color: #FFE28A; }
.bk-band:hover .bk-track { background: rgba(255,255,255,.16); }
#rail { position: fixed; left: max(6px, calc(50vw - var(--max) / 2 - 36px)); top: 84px; bottom: 22px; width: 16px; z-index: 15; pointer-events: none; }
#rail .rl { position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--line); }
#rail .rl.lit { bottom: auto; height: 0; background: var(--gold); }
#rail .rs { position: absolute; left: 4px; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line-2); box-sizing: border-box; transition: background .3s, border-color .3s; }
#rail .rs.on { background: var(--gold); border-color: var(--gold); }
#rail .orb { position: absolute; left: 0; top: 0; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6d6, var(--gold) 55%, var(--burgundy) 120%);
  box-shadow: 0 0 0 4px rgba(201,154,59,.16), 0 0 18px 6px rgba(201,154,59,.38); will-change: transform; }
#rail .rlbl { position: absolute; left: 26px; top: 0; margin-top: -8px; font-style: normal; font-weight: 700; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); white-space: nowrap; }
@media (max-width: 1180px) { #rail .rlbl { display: none; } }
@media (max-width: 760px) {
  .hero-stage { top: 62px; min-height: calc(100svh - 62px); }
  .hero-in { grid-template-columns: 1fr; grid-template-rows: auto auto; align-content: start; gap: 6px; padding-block: 6px 40px; }
  .hero-obj { order: -1; padding-top: 4px; perspective: 900px; }
  .obj3d { width: min(40vw, 22svh); }
  .home-rest { border-radius: 22px 22px 0 0; }
  .bk-band .bk-track { font-size: 16px; rotate: -3deg; }
  #rail { left: 2px; width: 12px; top: 76px; bottom: 16px; }
  #rail .rl { left: 5px; } #rail .rs { left: 2px; } #rail .orb { width: 12px; height: 12px; margin-top: -6px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-pin { height: auto !important; } .hero-stage { position: static; min-height: 0; overflow: visible; }
  .galaxy, .hero-obj, #rail { display: none; } .home-rest { margin-top: 0; box-shadow: none; border-radius: 0; }
  .hero-in { grid-template-columns: 1fr; padding-block: 0; }
}

/* ---------------------------------------------------------------- v5.3: the notes reader — the page counter is a button that
   opens a sheet (Go to page, Save, Note, Discussion, Challenge) for the page on screen; a loading bar; "back where you left off".
   --dock-h: the height of a bottom dock when one is showing (0 otherwise) — the counter sits above it. The phones' bottom menu
   bar positions the counter and the bubble itself (html.has-bnav rules with the bar, near the top of this file). */
.pagepill { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; border: 0; font-family: var(--font-ui); cursor: pointer; box-shadow: var(--shadow-2);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: background .2s, box-shadow .2s; }
.pagepill .ic { width: 16px; height: 16px; opacity: .75; }
.pagepill:hover { background: var(--solid-2); }
.pagepill:active { background: var(--solid-3); }
.pagepill:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
html.is-offline .pagepill, html.sync-wait .pagepill { bottom: calc(10px + var(--offline-h, 64px) + var(--dock-h, 0px)); }   /* above the offline bar (its height includes the home-bar gap) */
.notes .pg { scroll-margin-top: 70px; }   /* "Go to page" lands below the sticky header */
.pdfload { max-width: 360px; margin: 18px auto 0; }
.pdfload .progress i { transition: width .25s linear; }
.pgsheet .pgs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pgsheet .pgs-head .iconbtn { margin: -6px -8px 0 0; border: 0; background: none; cursor: pointer; flex: none; }
.pgsheet .pgs-head .iconbtn:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.pgsheet h3 { margin-top: 4px; font-size: 22px; }
.pgsheet h3 .of { font-family: var(--font-ui); font-size: 14px; font-weight: 500; color: var(--ink-3); }
.pggo { margin-top: 14px; }
.pggo-row { display: flex; gap: 8px; margin-top: 6px; }
.pggo-row .input { flex: 1; min-width: 0; min-height: 44px; }
.pggo-row .btn { min-height: 44px; min-width: 68px; }
.pgs-tools { margin-top: 18px; }
.pgs-tools > .tiny { margin: 0; }
.pgs-tools .itools { margin-top: 8px; }
@media (max-width: 640px) {   /* a sheet from the bottom of the phone, within thumb reach */
  .modal-bg.sheetbg { place-items: end center; padding: 0; }
  .modal-bg.sheetbg .modal { width: 100%; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); max-height: 88vh; max-height: 88dvh; animation: sheet-up .32s var(--ease) both; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.resumebub { position: fixed; left: 0; right: 0; margin-inline: auto; width: max-content; max-width: calc(100vw - 32px); bottom: calc(64px + env(safe-area-inset-bottom, 0px) + var(--dock-h, 0px)); z-index: 31;
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow-2);
  font-size: 13.5px; color: var(--ink-2); animation: pop .3s var(--ease) both; }
.resumebub .btn { min-height: 34px; padding: 4px 12px; font-size: 13px; white-space: nowrap; }
.resumebub.out { animation: bub-out .3s var(--ease) both; }
@keyframes bub-out { to { opacity: 0; transform: translateY(8px); } }
html.is-offline .resumebub, html.sync-wait .resumebub { bottom: calc(60px + var(--offline-h, 64px) + var(--dock-h, 0px)); }
@media (max-width: 420px) { .resumebub { font-size: 12.5px; padding-left: 12px; } }
.offline-chip .ic { width: 13px; height: 13px; }
.offline-chip .btn { min-height: 32px; padding: 4px 10px; font-size: 12.5px; }
#offline-bar .q { opacity: .85; }
.pgsheet .pgs-head { align-items: center; }
.pgs-thumb { flex: none; border-radius: 8px; overflow: hidden; background: var(--tint); box-shadow: var(--shadow-1); }
.pgs-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pgs-title { flex: 1; min-width: 0; }
.pgs-step { display: flex; gap: 6px; margin-top: 6px; }
.pgs-step .btn { min-height: 36px; padding: 4px 14px; }
.pgs-step .btn:disabled { opacity: .35; cursor: default; }

/* ==========================================================================
   v5.3 — My activity (the bell), beat-my-score duels, share buttons, Recall the exam
   ========================================================================== */
.bellwrap { position: relative; display: inline-flex; }
.bellbtn { position: relative; border: 0; background: none; cursor: pointer; }
.bellbtn.has { color: var(--burgundy); }
.bellcnt { position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--burgundy); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--card); pointer-events: none; }
.bellcnt[hidden] { display: none; }
.bellpanel { position: absolute; right: 0; top: calc(100% + 8px); width: min(410px, calc(100vw - 24px)); max-height: min(72vh, 640px); overflow: auto; overscroll-behavior: contain;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-2); z-index: 31; text-align: left; animation: pop .25s var(--ease) both; }
@media (max-width: 560px) { .bellpanel { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px - env(safe-area-inset-bottom)); }
  html.has-bnav .bellpanel { max-height: calc(100vh - 82px - var(--bnav-h)); max-height: calc(100dvh - 82px - var(--bnav-h)); } }   /* above the bottom bar */
.bp-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.bp-head b { font-family: var(--font-display); font-size: 17px; white-space: nowrap; }
.bp-head .tiny { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-head .bp-close { margin-right: 0; width: 36px; height: 36px; border: 0; background: none; cursor: pointer; }
.bp-list { padding: 8px; }
.bp-ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bp-item { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 10px; border-radius: 12px; }
.bp-item.new { background: var(--highlight); }
.bp-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--burgundy); }
.bp-ic .ic { width: 15px; height: 15px; }
.bp-text { font-size: 14px; line-height: 1.42; overflow-wrap: anywhere; }
.bp-quote { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--gold-2); background: var(--paper-2); border-radius: 0 8px 8px 0; font-size: 13.5px; color: var(--ink-2); max-height: 8em; overflow: auto; overflow-wrap: anywhere; }
.bp-meta { margin-top: 4px; overflow-wrap: anywhere; }
.bp-newtag { color: var(--burgundy); }
.bp-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: flex-start; }
.bp-thread { flex-basis: 100%; }
.bp-thread .thread { margin-top: 6px; }
.bp-empty { padding: 22px 14px; text-align: center; color: var(--ink-3); font-size: 14px; }
.bp-empty b { display: block; font-family: var(--font-display); color: var(--ink); font-size: 17px; margin-bottom: 4px; }
@media (max-width: 400px) { .topbar .iconbtn { margin-right: 0; } }
/* the new-duel dialog: live or beat my score, and who to dare */
.duelmode { display: flex; width: 100%; }
.duelmode button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 10px; font-weight: 500; }
.duelmode .ic { width: 15px; height: 15px; }
.duelinvite { margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--paper-2); border: 1px solid var(--line); }
.invlist { display: flex; flex-wrap: wrap; gap: 6px; }
.brow.dare .nm { display: block; white-space: normal; line-height: 1.4; overflow-wrap: anywhere; }
.brow.dare .rk .ic { width: 18px; height: 18px; color: var(--gold); }
/* the name chips of the dare dialog and the chips of Recall the exam are buttons (other pages' chip buttons keep their own look) */
.invlist button.chip, .rc-chips button.chip { font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; min-height: 34px; border: 1px solid var(--line-2); }
.invlist button.chip:hover, .rc-chips button.chip:hover { border-color: var(--gold); }
/* Recall the exam */
.rc-page textarea.input, textarea.input.share-copy { min-height: 0; font-family: inherit; font-size: 15px; line-height: 1.5; }
@media (max-width: 760px) { .rc-page textarea.input, textarea.input.share-copy { font-size: 16px; } }
.rc-hero .stats { margin-top: 16px; }
.rc-item .q { font-family: var(--font-display); font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.rc-opts { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; color: var(--ink-2); }
.rc-opts li { padding: 2px 0; overflow-wrap: anywhere; }
.rc-optrow { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.rc-let { flex: 0 0 22px; text-align: center; font-weight: 700; color: var(--burgundy); }
.rc-like { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--sticky); border: 1px solid var(--gold-2); font-size: 13.5px; }
.rc-likeitem { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 8px; }
.rc-likeitem span { min-width: 0; overflow-wrap: anywhere; }
.rc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-vote { white-space: normal; text-align: left; }
@media (prefers-reduced-motion: reduce) { .bellpanel { animation: none; } }

/* ==========================================================================
   v5.3 — accounts & operations: the sign-in typo check, "Forgot your PIN?", the "Corrected" note on cards,
   Discussions → Corrections, Admin → Errors / Backup / PIN requests
   ========================================================================== */
.linkbtn { background: none; border: 0; padding: 6px 2px; min-height: 36px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--ink); }
.linkbtn.hot { color: var(--burgundy); font-weight: 700; }
.error-text .linkbtn { padding: 0; min-height: 0; font-size: inherit; color: inherit; }
.signin-ask { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--sticky); border: 1px solid var(--gold-2); font-size: 14px; }
.signin-ask p { margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.fixnote { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; padding: 10px 12px; border-radius: 12px; background: var(--green-bg); color: var(--ink); font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.fixnote .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--green); }
.fixnote b { color: var(--green); }
.fixnote .was { display: block; margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }
.dthread.fixed { border-left-color: var(--green); }
.fixwhat { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.backup-nag { margin-bottom: 16px; }
.backup-nag .ic { color: var(--amber); }
b.warn { color: var(--amber); }
.pinreq { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.pinreq > div:first-child { flex: 1 1 220px; min-width: 0; }
.errcard.new { border-left: 4px solid var(--amber); }
.errmsg { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.errstack { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow: auto; margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--tint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; }

/* v5.3.1 — Discussions in red, everywhere: the Discussion button under every question, card and ELOOP, and every
   door to the Discussions page (header, account menu, More sheet, home tile, footer). Turki: "it is important". */
.itbtn[data-it="thread"], [data-thread-toggle], [data-qthread] { color: var(--red); background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 45%, transparent); font-weight: 600; }
.itbtn[data-it="thread"] .ic, [data-thread-toggle] .ic, [data-qthread] .ic { color: var(--red); }
.itbtn[data-it="thread"]:hover, [data-thread-toggle]:hover, [data-qthread]:hover { background: color-mix(in srgb, var(--red) 22%, transparent); }
[data-thread-toggle].on, [data-qthread].on { background: var(--red); border-color: var(--red); color: #fff; }
[data-thread-toggle].on .ic, [data-qthread].on .ic { color: #fff; }
#nav-disc, .menu button[data-a="discussions"], .bnav-it[href$="#/discussions"], .footer a[href$="#/discussions"] { color: var(--red); font-weight: 600; }
.menu button[data-a="discussions"] .ic, .bnav-it[href$="#/discussions"] .ic { color: var(--red); }
.bnav-it[href$="#/discussions"] { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.qtile[href$="#/discussions"] { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.qtile[href$="#/discussions"] .ic-wrap { background: var(--red); color: #fff; }
.qtile[href$="#/discussions"] b { color: var(--red); }
.qtile[href$="#/discussions"] .ic-wrap .ic { color: #fff; }
/* v5.3.2 — the same red, winning over .btn.ghost: the Discussion buttons under quiz results, the question of the day,
   duel reviews, the Discussions page ("Read") and the bell panel */
.btn.itbtn[data-qthread], .btn.itbtn[data-thread-toggle], .btn.itbtn[data-it="thread"], .btn.disc-btn { color: var(--red); background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 45%, transparent); font-weight: 600; }
.btn.itbtn[data-qthread] .ic, .btn.itbtn[data-thread-toggle] .ic, .btn.itbtn[data-it="thread"] .ic, .btn.disc-btn .ic { color: var(--red); }
.btn.itbtn[data-qthread]:hover, .btn.itbtn[data-thread-toggle]:hover, .btn.itbtn[data-it="thread"]:hover, .btn.disc-btn:hover { background: color-mix(in srgb, var(--red) 22%, transparent); }
.btn.itbtn[data-qthread].on, .btn.itbtn[data-thread-toggle].on { background: var(--red); border-color: var(--red); color: #fff; }
.btn.itbtn[data-qthread].on .ic, .btn.itbtn[data-thread-toggle].on .ic { color: #fff; }

/* Saved Study size. Only study content changes; headers, navigation, native
   dialogs and source-PDF viewers keep their normal dimensions. At 100% all
   existing reader styles are left untouched. */
.menu .study-size-control { padding:10px 12px; min-width:0; color:var(--ink-2); }
.study-size-heading { display:flex; align-items:center; gap:10px; font-size:13px; }
.study-size-heading output { margin-left:auto; font-weight:700; min-width:3.5em; text-align:right; font-variant-numeric:tabular-nums; }
.menu .study-size-control button { display:inline-flex; align-items:center; justify-content:center; width:auto; min-width:44px; min-height:44px; margin:0; padding:8px 10px; border:1px solid var(--line-2); border-radius:10px; color:var(--ink); background:var(--tint); font:inherit; font-size:16px; cursor:pointer; }
.menu .study-size-control [data-study-size-reset] { font-size:12px; }
.study-size-adjust { display:flex; align-items:center; gap:10px; margin-top:4px; }
.study-size-adjust input { flex:1; width:0; min-width:90px; min-height:44px; margin:0; accent-color:var(--burgundy); font-size:16px; cursor:pointer; }
.study-size-control p { font-size:11px; line-height:1.45; margin:6px 0 0; }
.study-size-control button:disabled { opacity:.4; cursor:default; }
.study-size-control :focus-visible { outline:3px solid var(--gold); outline-offset:2px; }
:root { --study-scale:1; }
:root[data-study-size]:not([data-study-size="100"]) #app .stem { font-size:max(16px,calc(clamp(19px,2.6vw,25px) * var(--study-scale))); }
:root[data-study-size]:not([data-study-size="100"]) #app .qcard { padding:calc(clamp(18px,3vw,30px) * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .options { gap:calc(10px * var(--study-scale)); margin-top:calc(22px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .opt { font-size:max(14px,calc(15.5px * var(--study-scale))); padding:calc(12px * var(--study-scale)) calc(14px * var(--study-scale)); gap:calc(12px * var(--study-scale)); min-height:44px; }
:root[data-study-size]:not([data-study-size="100"]) #app .feedback { margin-top:calc(18px * var(--study-scale)); padding:calc(16px * var(--study-scale)) calc(18px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .feedback .body { font-size:max(14px,calc(14.5px * var(--study-scale))); }
:root[data-study-size]:not([data-study-size="100"]) #app .eloop { padding:calc(18px * var(--study-scale)) calc(18px * var(--study-scale)) calc(20px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .eq { font-size:max(16px,calc(clamp(16.5px,2.1vw,20px) * var(--study-scale))); margin-top:calc(16px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .epic img { max-height:calc(56svh * var(--study-scale)); max-width:min(100%,calc(100% * var(--study-scale))); margin-inline:auto; object-fit:contain; }
:root[data-study-size]:not([data-study-size="100"]) #app .ea { margin-top:calc(16px * var(--study-scale)); padding:calc(16px * var(--study-scale)) calc(18px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .ea .txt { font-size:max(16px,calc(clamp(17px,2.3vw,22px) * var(--study-scale))); }
:root[data-study-size]:not([data-study-size="100"]) #app .ea .why { font-size:max(13px,calc(13.5px * var(--study-scale))); }
:root[data-study-size]:not([data-study-size="100"]) #app :is(.fc,.fc-inner,.fc-face) { min-height:calc(300px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .fc-face { padding:calc(26px * var(--study-scale)) calc(26px * var(--study-scale)) calc(22px * var(--study-scale)); gap:calc(12px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .fc-text { font-size:max(16px,calc(clamp(19px,2.8vw,27px) * var(--study-scale))); }
:root[data-study-size]:not([data-study-size="100"]) #app .fc-back .fc-text { font-size:max(16px,calc(clamp(17px,2.4vw,23px) * var(--study-scale))); }
:root[data-study-size]:not([data-study-size="100"]) #app .study-card { margin:calc(18px * var(--study-scale)) 0; padding:calc(clamp(16px,3vw,30px) * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .study-prompt { font-size:max(16px,calc(clamp(1.2rem,3.5vw,1.6rem) * var(--study-scale))); }
:root[data-study-size]:not([data-study-size="100"]) #app .study-choice { font-size:max(14px,calc(15px * var(--study-scale))); padding:calc(12px * var(--study-scale)) calc(14px * var(--study-scale)); gap:calc(12px * var(--study-scale)); min-height:44px; }
:root[data-study-size]:not([data-study-size="100"]) #app .study-choices { gap:calc(8px * var(--study-scale)); margin:calc(16px * var(--study-scale)) 0; }
:root[data-study-size]:not([data-study-size="100"]) #app .study-answer { margin:calc(16px * var(--study-scale)) 0; padding:calc(clamp(14px,3vw,23px) * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app :is(.study-explanation,.study-answer-text,.study-key,.study-shared) { font-size:max(14px,calc(15px * var(--study-scale))); }
:root[data-study-size]:not([data-study-size="100"]) #app :is(.study-images,.study-answer-images) img { max-height:calc(65svh * var(--study-scale)); max-width:min(100%,calc(100% * var(--study-scale))); height:auto; object-fit:contain; }
:root[data-study-size]:not([data-study-size="100"]) #app .study-pages canvas { max-width:min(100%,calc(100% * var(--study-scale))); max-height:calc(65svh * var(--study-scale)); height:auto; object-fit:contain; }
:root[data-study-size]:not([data-study-size="100"]) #app .fw-review { padding:calc(clamp(18px,4vw,34px) * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .fw-question { font-size:max(16px,calc(clamp(22px,3vw,28px) * var(--study-scale))); }
:root[data-study-size]:not([data-study-size="100"]) #app .fw-answer-body { font-size:max(16px,calc(clamp(22px,3vw,27px) * var(--study-scale))); margin-bottom:calc(16px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .fw-review-top { gap:calc(16px * var(--study-scale)); margin-bottom:calc(23px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .fw-review :is(.fw-media,figure) { margin:calc(18px * var(--study-scale)) 0; }
:root[data-study-size]:not([data-study-size="100"]) #app .fw-review img { max-height:calc(560px * var(--study-scale)); max-width:min(100%,calc(100% * var(--study-scale))); object-fit:contain; }
:root[data-study-size]:not([data-study-size="100"]) #app .fw-options { gap:calc(10px * var(--study-scale)); margin-top:calc(24px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .fw-option { font-size:max(14px,calc(15px * var(--study-scale))); padding:calc(14px * var(--study-scale)) calc(16px * var(--study-scale)); gap:calc(13px * var(--study-scale)); min-height:44px; }
:root[data-study-size]:not([data-study-size="100"]) #app .fw-answer { padding:calc(22px * var(--study-scale)); margin-top:calc(24px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app .fw-actions { margin-top:calc(24px * var(--study-scale)); gap:calc(10px * var(--study-scale)); }
:root[data-study-size]:not([data-study-size="100"]) #app :is(.fw-page,.study-page,.eloopsview,.quiz-wrap,.cardsview) :is(button,input,select) { min-height:44px; }
:root[data-study-size]:not([data-study-size="100"]) #app :is(.fw-page,.study-page,.eloopsview,.quiz-wrap,.cardsview) :is(input,select,textarea) { font-size:max(16px,1em); }
@media(max-width:640px) {
  :root[data-study-size]:not([data-study-size="100"]) #app .fw-review { padding:calc(14px * var(--study-scale)); }
  :root[data-study-size]:not([data-study-size="100"]) #app :is(.fw-question,.fw-answer-body) { font-size:max(16px,calc(18px * var(--study-scale))); }
  :root[data-study-size]:not([data-study-size="100"]) #app .fw-review-top { gap:calc(10px * var(--study-scale)); margin-bottom:calc(12px * var(--study-scale)); }
  :root[data-study-size]:not([data-study-size="100"]) #app .fw-review :is(.fw-media,figure) { margin:calc(10px * var(--study-scale)) 0; }
  :root[data-study-size]:not([data-study-size="100"]) #app .fw-review img { max-height:calc(min(180px,25svh) * var(--study-scale)); }
  :root[data-study-size]:not([data-study-size="100"]) #app .fw-options { gap:calc(8px * var(--study-scale)); margin-top:calc(14px * var(--study-scale)); }
  :root[data-study-size]:not([data-study-size="100"]) #app .fw-option { padding:calc(10px * var(--study-scale)); gap:calc(10px * var(--study-scale)); }
  :root[data-study-size]:not([data-study-size="100"]) #app .fw-answer { padding:calc(14px * var(--study-scale)); margin-top:calc(14px * var(--study-scale)); }
  :root[data-study-size]:not([data-study-size="100"]) #app .fw-actions { margin-top:calc(14px * var(--study-scale)); gap:calc(8px * var(--study-scale)); }
}
@media(max-width:560px) {
  :root[data-study-size]:not([data-study-size="100"]) #app .eloop { padding:calc(14px * var(--study-scale)) calc(13px * var(--study-scale)) calc(16px * var(--study-scale)); }
  :root[data-study-size]:not([data-study-size="100"]) #app .epic img { max-height:calc(46svh * var(--study-scale)); }
  :root[data-study-size]:not([data-study-size="100"]) #app .fc-face { padding:calc(22px * var(--study-scale)) calc(18px * var(--study-scale)); }
}

.prayer-space {
  margin-block-start: 12px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-inline-start: 3px solid var(--gold);
  border-radius: 15px;
  font-family: system-ui, sans-serif;
}
.prayer-space summary {
  cursor: pointer;
  padding: 10px 16px;
  min-height: 44px;
  font-weight: 650;
  font-size: 1.08rem;
  line-height: 1.6;
}
.prayer-space summary::marker { color: var(--burgundy); font-size: .75em; }
.prayer-space summary:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 2px; border-radius: 12px; }
.prayer-space dl { margin: 0 16px 12px; }
.prayer-space dl > div { padding-block: 12px; border-block-start: 1px solid var(--line); }
.prayer-space dt, .prayer-space .prayer-source { font-size: .85rem; color: var(--ink-2); }
.prayer-space dd { margin: 3px 0 0; font-size: 1.25rem; line-height: 1.9; }
.prayer-source a { color: inherit; text-decoration: underline; text-underline-offset: .16em; }

.menu .board-visibility-pref { border-top: 1px solid var(--line); padding: 7px 12px 10px; }
.board-visibility-pref label { display: flex; align-items: center; gap: 9px; min-height: 44px; color: var(--ink); font-size: 13px; cursor: pointer; }
.board-visibility-pref input { margin: 0; width: 18px; height: 18px; accent-color: var(--burgundy); }
.board-visibility-pref p { margin: 0; font-size: 12px; line-height: 1.45; color: var(--ink-2); }
.menu .board-visibility-pref button[hidden] { display: none; }

.prayer-space > .prayer-group { margin-inline: 14px; border-block-start: 1px solid var(--line); }
.prayer-group > summary { padding-inline: 4px; font-size: 1rem; }
.prayer-group > summary small { margin-inline-start: .4em; color: var(--ink-2); font-size: .85em; font-weight: 400; }
.prayer-group > dl { margin-inline: 4px; }

[data-private-rank] .youtag { flex: none; white-space: nowrap; color: var(--ink-2); }
.weekly-my-rank [data-private-rank], .weekly-home-rank [data-private-rank] { overflow-wrap: anywhere; }
.brow.private-unranked { grid-template-columns: minmax(0, 1fr) auto; }
