/* AP Stats, Made Simple: same dark luxury system as World Right Now.
   Near-black ground, charcoal surfaces, one violet accent (plus a warm "miss" colour in the lab).
   Newsreader for headlines, Hanken Grotesk for everything else. Every colour is a token. */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/newsreader-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("fonts/hanken-grotesk-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #08090D;
  --surface: #12131B;
  --surface-2: #181923;
  --surface-3: #20212D;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --line-3: rgba(255, 255, 255, 0.22);
  --ink: #ECECF1;
  --ink-2: #A7A9B7;
  --ink-3: #8B8E9C;
  --violet: #8B5CF6;
  --violet-hi: #A78BFA;
  --violet-btn: #7C4DEB;
  --violet-wash: rgba(139, 92, 246, 0.12);
  --violet-glow: rgba(139, 92, 246, 0.22);
  --amber: #F5A25D;
  --amber-wash: rgba(245, 162, 93, 0.12);
  --good: #6EE7B7;
  --good-wash: rgba(110, 231, 183, 0.10);

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Hanken Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;

  --t-display: clamp(3rem, 2rem + 5.2vw, 7.25rem);
  --t-h2: clamp(2rem, 1.5rem + 2.2vw, 3.25rem);
  --t-h3: clamp(1.125rem, 1.05rem + 0.3vw, 1.3125rem);
  --t-lead: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --t-body: 1rem;
  --t-small: 0.875rem;
  --t-micro: 0.8125rem;

  --r-sm: 6px;
  --r: 12px;
  --r-lg: 18px;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --bar-h: 64px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--bar-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-color: var(--line-3); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color .2s, text-decoration-color .2s; }
a:hover { color: var(--violet-hi); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--violet-hi); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 400; }
p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; }
button, input, textarea { font: inherit; color: inherit; }
::selection { background: var(--violet); color: #fff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter-r);
}

/* ---------- Skip link ---------- */
.skip { position: absolute; left: 16px; top: 10px; z-index: 50; background: var(--violet-btn); color: #fff; padding: 10px 16px; border-radius: var(--r-sm); font-weight: 500; transform: translateY(-200%); text-decoration: none; }
.skip:focus { transform: none; }
main:focus { outline: none; }

/* ---------- Buttons, chips, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px;
  background: var(--violet-btn); color: #fff; font-weight: 500; font-size: var(--t-small); letter-spacing: .01em;
  cursor: pointer; transition: background-color .2s, transform .15s var(--ease), border-color .2s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #6A3BD8; color: #fff; }
.btn:active { transform: scale(.98); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-3); color: var(--ink); }
.btn-sm { min-height: 36px; padding: 0 14px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.link-btn { border: 0; background: none; padding: 0; color: var(--violet-hi); cursor: pointer; font-size: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(167, 139, 250, .4); }
.link-btn:hover { text-decoration-color: currentColor; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
  font-size: var(--t-small); white-space: nowrap; cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .15s var(--ease);
}
.chip:hover { color: var(--ink); border-color: var(--line-3); background: var(--surface-2); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] { background: var(--violet-wash); border-color: rgba(139, 92, 246, .55); color: var(--ink); }
.chip .count { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .count { color: var(--violet-hi); }

.search {
  position: relative; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 0 6px 0 16px; min-height: 48px;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.search:focus-within { border-color: rgba(139, 92, 246, .7); box-shadow: 0 0 0 4px var(--violet-wash); }
.search > .ico { color: var(--ink-3); }
.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font-size: var(--t-body); padding: 12px 0; outline: none;
}
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search-sm { min-height: 42px; width: min(320px, 100%); }

/* ---------- Top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(8, 9, 13, .78);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.bar-in { display: flex; align-items: center; gap: 24px; min-height: var(--bar-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 500; letter-spacing: -.01em; margin-right: auto; }
.brand:hover { color: var(--ink); }
.brand-ico { color: var(--violet-hi); width: 22px; height: 22px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-size: var(--t-small); transition: color .2s, background-color .2s; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.bar-actions { display: flex; gap: 4px; }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-top: clamp(32px, 5vw, 72px); }
.hero::before {
  /* Ambient light: one restrained violet bloom above the headline. */
  content: ""; position: absolute; inset: -30% -10% auto 30%; height: 80%;
  background: radial-gradient(closest-side, var(--violet-glow), transparent 70%);
  pointer-events: none; opacity: .7;
}
.hero-copy { position: relative; display: grid; gap: 22px; }
.edition { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: var(--t-small); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--violet-hi); flex: none; box-shadow: 0 0 0 0 rgba(167, 139, 250, .6); animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(167, 139, 250, .55); } 70% { box-shadow: 0 0 0 10px rgba(167, 139, 250, 0); } 100% { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0); } }
.hero h1 {
  font-family: var(--serif); font-size: var(--t-display); font-weight: 400;
  letter-spacing: -0.035em; line-height: .92; font-variation-settings: "opsz" 72;
  max-width: 11ch;
}
.deck { font-size: var(--t-lead); color: var(--ink-2); max-width: 54ch; line-height: 1.5; }
.search-hero { max-width: 560px; margin-top: 6px; }
.hero-find { display: grid; gap: 12px; }
@media (min-width: 1081px) {
  /* Wide screens: the headline runs on one line, with the deck and the search side by side under it,
     so the live Galton board arrives on the first screen. */
  .hero-copy { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 64px; align-items: end; }
  .hero-copy > .edition, .hero-copy > h1, .hero-copy > noscript { grid-column: 1 / -1; }
  .hero h1 { max-width: none; white-space: nowrap; font-size: clamp(4.5rem, 1rem + 6.4vw, 7.75rem); }
  .search-hero { max-width: none; margin-top: 0; }
}
.hint { color: var(--ink-3); font-size: var(--t-small); min-height: 1.4em; }
.hint button { border: 0; background: none; padding: 0; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; cursor: pointer; font-size: inherit; }
.hint button:hover { color: var(--violet-hi); }
.stale { border: 1px solid rgba(139, 92, 246, .45); background: var(--violet-wash); border-radius: var(--r); padding: 12px 16px; max-width: 60ch; }

/* Galton board: the live band under the headline, in place of World Right Now's Earth. */
.board { position: relative; margin: clamp(28px, 4vw, 48px) 0 0; }
.board-stage { position: relative; width: 100%; aspect-ratio: 2.7 / 1; overflow: hidden; }
.board-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.board-stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, var(--bg) 0%, transparent 14%, transparent 92%, var(--bg) 100%),
    linear-gradient(to right, rgba(8, 9, 13, .6), transparent 14%, transparent 86%, rgba(8, 9, 13, .6));
}
.board-pins { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.pin {
  position: absolute; display: flex; align-items: center; gap: 10px; color: var(--ink);
  transform: translate(-6px, -50%); transition: left .5s var(--ease), top .5s var(--ease);
}
.pin-dot { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--violet-hi); border: 2px solid #fff; flex: none; }
.pin-dot::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 1px solid rgba(167, 139, 250, .7); animation: ring 2.8s var(--ease) infinite; }
@keyframes ring { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }
.pin-label {
  display: grid; gap: 1px; padding: 7px 12px; border-radius: var(--r-sm);
  background: rgba(10, 11, 17, .82); border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: var(--t-micro); line-height: 1.3; white-space: nowrap;
}
.pin-label b { font-weight: 500; font-size: var(--t-small); }
.pin-label span { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pin.flip { flex-direction: row-reverse; transform: translate(calc(-100% + 6px), -50%); }
.board-cap { color: var(--ink-3); font-size: var(--t-micro); margin-top: -4px; position: relative; z-index: 2; }

.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-top: clamp(28px, 4vw, 44px);
}
.stats > div { padding: 20px 0 22px; display: grid; gap: 2px; }
.stats > div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.stats dt { color: var(--ink-3); font-size: var(--t-micro); order: 2; }
.stats dd { font-family: var(--serif); font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem); line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- Section heads ---------- */
.units, .lab, .tests, .exam, .ask, .practice, .formulas, .terms, .about { padding-top: clamp(80px, 10vw, 140px); }
.sec-head { display: grid; gap: 12px; margin-bottom: clamp(24px, 3vw, 36px); max-width: 760px; }
.sec-head-row { max-width: none; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 40px; }
.sec-head-row > div:not(.search) { display: grid; gap: 12px; max-width: 680px; }
.sec-head h2 { font-family: var(--serif); font-size: var(--t-h2); letter-spacing: -.025em; line-height: 1.02; font-variation-settings: "opsz" 60; }
.sec-sub { color: var(--ink-2); max-width: 60ch; }

/* ---------- Units ---------- */
.toolbar { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.search-bar { background: var(--bg); }
.clear-q { width: 34px; height: 34px; }
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 20px 0 8px; color: var(--ink-2); font-size: var(--t-small); min-height: 24px; }
.status strong { color: var(--ink); font-weight: 500; }

.unit-list { list-style: none; border-top: 1px solid var(--line); }
.row { border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--bar-h) + 16px); }
.row-head {
  width: 100%; display: grid; grid-template-columns: 170px minmax(0, 1fr) 150px 28px; gap: 24px; align-items: center;
  padding: 22px 4px; text-align: left; background: none; border: 0; cursor: pointer; color: inherit;
  transition: background-color .2s;
}
.row-head:hover { background: linear-gradient(to right, transparent, var(--surface) 20%, var(--surface) 80%, transparent); }
.u-num { display: grid; gap: 2px; }
.u-num b { font-family: var(--serif); font-weight: 400; font-size: 1.75rem; line-height: 1; letter-spacing: -.02em; }
.u-num b span { color: var(--violet-hi); }
.u-num small { color: var(--ink-3); font-size: var(--t-micro); }
.u-title { display: grid; gap: 4px; }
.u-title strong { font-family: var(--serif); font-weight: 400; font-size: clamp(1.25rem, 1.1rem + .6vw, 1.625rem); line-height: 1.15; letter-spacing: -.015em; font-variation-settings: "opsz" 36; }
.u-title span { color: var(--ink-2); font-size: var(--t-small); }
.u-group { color: var(--ink-3); font-size: var(--t-micro); }
.row-head > .ico { color: var(--ink-3); transition: transform .25s var(--ease), color .2s; }
.row-head[aria-expanded="true"] > .ico { transform: rotate(180deg); color: var(--violet-hi); }
.row-body { display: grid; gap: 18px; padding: 0 4px 32px; grid-template-columns: 170px minmax(0, 1fr); column-gap: 24px; }
.row-body > * { grid-column: 2; }
.u-sum { font-size: var(--t-lead); line-height: 1.5; max-width: 64ch; }
.callout { display: grid; gap: 6px; padding: 16px 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); max-width: 72ch; }
.callout-k { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t-micro); color: var(--violet-hi); font-weight: 500; letter-spacing: .02em; }
.callout-k .ico { width: 15px; height: 15px; }
.callout.warn { background: var(--amber-wash); border-color: rgba(245, 162, 93, .3); }
.callout.warn .callout-k { color: var(--amber); }
.ideas-h { font-size: var(--t-small); color: var(--ink-3); font-weight: 500; letter-spacing: .02em; }
.ideas { list-style: none; counter-reset: idea; display: grid; gap: 12px; max-width: 72ch; }
.ideas li { counter-increment: idea; position: relative; padding-left: 40px; }
.ideas li::before { content: counter(idea); position: absolute; left: 0; top: 0; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); font-size: var(--t-micro); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.topics { max-width: 72ch; border-top: 1px solid var(--line); padding-top: 12px; }
.topics > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: var(--t-small); transition: color .2s; }
.topics > summary::-webkit-details-marker { display: none; }
.topics > summary:hover { color: var(--ink); }
.topics > summary .ico { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.topics[open] > summary .ico { transform: rotate(180deg); }
.topic-list { list-style: none; display: grid; gap: 6px; padding: 12px 0 2px; }
.topic-list li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; font-size: var(--t-small); color: var(--ink-2); line-height: 1.45; }
.topic-list b { color: var(--violet-hi); font-weight: 500; font-variant-numeric: tabular-nums; }
.u-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.u-actions .btn { white-space: normal; text-align: left; padding-top: 10px; padding-bottom: 10px; line-height: 1.35; }
.u-actions .btn .ico { flex: none; }
.empty { color: var(--ink-2); padding: 28px; border: 1px dashed var(--line-2); border-radius: var(--r-lg); text-align: center; margin-top: 16px; }

/* Key terms inside text */
.term {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: help;
  text-decoration: underline dotted rgba(167, 139, 250, .75); text-decoration-thickness: 1.5px; text-underline-offset: 4px;
  transition: color .2s;
}
.term:hover, .term[aria-expanded="true"] { color: var(--violet-hi); }
.term-pop {
  position: absolute; z-index: 40; width: min(340px, calc(100vw - 32px));
  background: var(--surface-2); color: var(--ink); padding: 16px 18px; display: grid; gap: 8px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(139, 92, 246, .12);
}
.term-pop-k { display: inline-flex; align-items: center; gap: 6px; color: var(--violet-hi); font-size: var(--t-micro); }
.term-pop-k .ico { width: 14px; height: 14px; }
.term-pop strong { font-family: var(--serif); font-weight: 500; font-size: 1.25rem; line-height: 1.2; }
.term-pop p { font-size: var(--t-small); color: var(--ink-2); }
.term-pop-links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--t-small); }
.term-pop a { color: var(--violet-hi); }
mark { background: var(--violet-wash); color: var(--ink); border-radius: 3px; padding: 0 2px; }

/* ---------- Tabs (lab and tests) ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tab {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--ink-2); font-size: var(--t-small); cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.tab:hover { color: var(--ink); border-color: var(--line-3); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Lab ---------- */
.exp {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.exp-text { padding: clamp(24px, 3vw, 40px); display: grid; gap: 18px; align-content: start; min-width: 0; }
.exp-k { font-size: var(--t-micro); color: var(--violet-hi); font-weight: 500; letter-spacing: .02em; }
.exp h3 { font-family: var(--serif); font-size: clamp(1.6rem, 1.3rem + 1vw, 2.25rem); letter-spacing: -.02em; line-height: 1.1; }
.exp-intro { color: var(--ink-2); max-width: 54ch; }
.exp-fig { position: relative; background: radial-gradient(120% 90% at 50% 40%, #11121B, #0B0C12); border-left: 1px solid var(--line); display: grid; align-items: center; min-height: 320px; }
.exp-fig svg { display: block; width: 100%; height: auto; }
.exp-fig svg.clickable { cursor: crosshair; touch-action: manipulation; }
.range { display: grid; gap: 10px; }
.range-top { display: flex; justify-content: space-between; color: var(--ink-2); font-size: var(--t-small); }
.range output { color: var(--ink); font-weight: 500; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: linear-gradient(to right, var(--violet) var(--fill, 50%), var(--surface-3) var(--fill, 50%)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--violet); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px var(--violet-glow); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px var(--violet-glow); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--violet-hi); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--violet-hi); }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; width: fit-content; cursor: pointer; color: var(--ink-2); font-size: var(--t-small); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background-color .2s, border-color .2s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: transform .25s var(--ease), background-color .2s; }
.switch input:checked + .switch-track { background: var(--violet-btn); border-color: transparent; }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--violet-hi); outline-offset: 3px; }
.readout { color: var(--ink); padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); min-height: 52px; font-size: var(--t-small); line-height: 1.5; }
.readout b { color: var(--violet-hi); font-weight: 500; font-variant-numeric: tabular-nums; }
.readout .miss { color: var(--amber); }

/* SVG chart parts */
.ax { stroke: var(--line-3); stroke-width: 1; fill: none; }
.grid { stroke: rgba(255, 255, 255, .05); stroke-width: 1; }
.tick { fill: var(--ink-3); font-family: var(--sans); font-size: 13px; }
.tick-hi { fill: var(--ink); font-family: var(--sans); font-size: 13px; font-weight: 500; }
.curve { fill: none; stroke: var(--ink-2); stroke-width: 2; }
.shade { fill: rgba(139, 92, 246, .45); stroke: none; }
.zline { stroke: var(--violet-hi); stroke-width: 2; stroke-dasharray: 4 4; }
.bar-pop { fill: var(--surface-3); }
.bar-mean { fill: var(--violet); }
.bar-new { fill: var(--violet-hi); }
.lab-label { fill: var(--ink-2); font-family: var(--sans); font-size: 13px; }
.lab-label-hi { fill: var(--violet-hi); font-family: var(--sans); font-size: 13px; font-weight: 500; }
.truth { stroke: #fff; stroke-width: 1.5; stroke-dasharray: 5 5; }
.ci-hit { stroke: var(--violet-hi); stroke-width: 3; stroke-linecap: round; }
.ci-miss { stroke: var(--amber); stroke-width: 3; stroke-linecap: round; }
.ci-dot { fill: #fff; }
.pt { fill: var(--violet-hi); stroke: #fff; stroke-width: 1.5; }
.fit { stroke: #fff; stroke-width: 2.5; stroke-linecap: round; }
.res { stroke: var(--amber); stroke-width: 1.5; stroke-dasharray: 3 3; }

/* ---------- Tests ---------- */
.pick { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.pick li { display: grid; gap: 4px; padding: 18px 20px 20px 0; }
.pick li + li { padding-left: 20px; border-left: 1px solid var(--line); }
.pick b { font-family: var(--serif); font-weight: 400; font-size: 1.1875rem; line-height: 1.25; }
.pick span { color: var(--ink-2); font-size: var(--t-small); }
.test {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.test-intro { padding: clamp(24px, 3vw, 40px); display: grid; gap: 16px; align-content: start; background: linear-gradient(160deg, var(--surface-2), var(--surface)); border-right: 1px solid var(--line); }
.test-intro h3 { font-family: var(--serif); font-size: clamp(1.6rem, 1.3rem + 1vw, 2.25rem); letter-spacing: -.02em; line-height: 1.1; }
.test-when { color: var(--ink-2); font-size: var(--t-lead); line-height: 1.5; }
.test-q { display: grid; gap: 6px; padding: 16px 18px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line); }
.test-q p { font-size: var(--t-small); line-height: 1.6; }
.test-body { padding: clamp(24px, 3vw, 40px); display: grid; gap: 18px; align-content: start; min-width: 0; }
.tl { list-style: none; position: relative; display: grid; gap: 24px; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 1px; background: linear-gradient(var(--line-3), var(--line)); }
.tl li { position: relative; display: grid; gap: 4px; }
.tl li::before { content: ""; position: absolute; left: -26px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--ink-3); }
.tl li:last-child::before { background: var(--violet-hi); border-color: #fff; box-shadow: 0 0 0 5px rgba(139, 92, 246, .2); }
.tl b { font-size: var(--t-micro); color: var(--violet-hi); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.tl p { max-width: 64ch; }

/* ---------- The AP exam ---------- */
.exam-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.exam-card { display: grid; gap: 14px; align-content: start; padding: clamp(22px, 3vw, 32px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.exam-card h3 { font-family: var(--serif); font-size: clamp(1.5rem, 1.25rem + .9vw, 2rem); letter-spacing: -.02em; line-height: 1.1; }
.exam-note { color: var(--ink-2); font-size: var(--t-small); }
.weights { list-style: none; display: grid; gap: 12px; }
.weights li { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 4px 12px; align-items: center; }
.weights .w-name { font-size: var(--t-small); line-height: 1.35; }
.weights .w-name b { color: var(--violet-hi); font-weight: 500; margin-right: 6px; }
.weights .w-pct { text-align: right; font-size: var(--t-small); font-variant-numeric: tabular-nums; color: var(--ink); }
.weights .w-bar { grid-column: 1 / -1; position: relative; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.weights .w-bar span { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(to right, var(--violet-btn), var(--violet-hi)); }
.frq { list-style: none; display: grid; gap: 14px; counter-reset: frq; }
.frq li { display: grid; gap: 2px; padding-left: 40px; position: relative; counter-increment: frq; }
.frq li::before { content: counter(frq); position: absolute; left: 0; top: 0; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--violet-wash); border: 1px solid rgba(139, 92, 246, .45); color: var(--violet-hi); font-size: var(--t-micro); font-weight: 500; }
.frq b { font-weight: 500; }
.frq span { color: var(--ink-2); font-size: var(--t-small); }
.exam-h { font-family: var(--serif); font-size: clamp(1.5rem, 1.3rem + .8vw, 2rem); letter-spacing: -.02em; margin: clamp(40px, 5vw, 56px) 0 8px; }
.practices { margin: 20px 0 0; }
.practices em { font-style: normal; color: var(--violet-hi); font-size: var(--t-micro); font-weight: 500; font-variant-numeric: tabular-nums; margin-top: 4px; }
.exam-src { margin-top: 18px; color: var(--ink-3); font-size: var(--t-micro); max-width: 72ch; }
.exam-src a { color: var(--ink-2); }

/* ---------- Ask (chat) ---------- */
.ask-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.ask-side { position: sticky; top: calc(var(--bar-h) + 32px); }
.ask-points { list-style: none; display: grid; gap: 16px; margin-top: 8px; }
.ask-points li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; color: var(--ink-2); font-size: var(--t-small); line-height: 1.6; }
.ask-points .ico { color: var(--violet-hi); margin-top: 2px; }
.ask-points b { color: var(--ink); font-weight: 500; }
.chat {
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
  height: min(760px, calc(100vh - var(--bar-h) - 48px)); min-height: 560px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 40px 80px rgba(0, 0, 0, .35), 0 0 0 1px rgba(139, 92, 246, .06);
}
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.chat-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--violet-wash); border: 1px solid rgba(139, 92, 246, .45); color: var(--violet-hi); flex: none; }
.chat-name { font-weight: 500; }
.chat-mode { color: var(--ink-3); font-size: var(--t-micro); }
.chat-mode.on { color: var(--good); }
.chat-level { padding: 12px 18px 0; }
.chat-log { overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; overscroll-behavior: contain; }
.msg { max-width: 88%; padding: 12px 16px; border-radius: 16px; line-height: 1.55; overflow-wrap: anywhere; }
.msg p + p, .msg p + ul, .msg ul + p, .msg p + ol, .msg ol + p { margin-top: 10px; }
.msg ul, .msg ol { padding-left: 1.25em; display: grid; gap: 4px; }
.msg code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em; background: rgba(255, 255, 255, .06); padding: 1px 5px; border-radius: 4px; }
.msg strong { font-weight: 500; color: #fff; }
.msg-user { align-self: flex-end; background: var(--violet-btn); color: #fff; border-bottom-right-radius: 6px; }
.msg-bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg-tag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-micro); color: var(--ink-3); margin-bottom: 6px; }
.msg-tag .ico { width: 13px; height: 13px; }
.msg-err { border-color: rgba(245, 162, 93, .4); background: var(--amber-wash); }
.msg-note { margin-top: 10px; font-size: var(--t-micro); color: var(--ink-3); }
.typing { display: inline-flex; gap: 5px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-suggest { padding: 0 18px 12px; }
.chat-suggest .chip { white-space: normal; text-align: left; min-height: 34px; padding: 6px 14px; line-height: 1.3; }
.chat-form { display: flex; align-items: flex-end; gap: 10px; padding: 12px 12px 12px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-form textarea {
  flex: 1; min-width: 0; resize: none; border: 0; background: transparent; outline: none;
  padding: 10px 0; max-height: 160px; line-height: 1.5; font-size: var(--t-body);
}
.chat-form textarea::placeholder { color: var(--ink-3); }
.chat-form:focus-within { background: var(--surface-2); }
.send { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--violet-btn); color: #fff; cursor: pointer; transition: background-color .2s, transform .15s var(--ease); }
.send:hover { background: #6A3BD8; }
.send:active { transform: scale(.95); }
.send.stop { background: var(--surface-3); }
.keybox { border-top: 1px solid var(--line); }
.keybox > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 18px; cursor: pointer; color: var(--ink-2); font-size: var(--t-small); }
.keybox > summary::-webkit-details-marker { display: none; }
.keybox > summary:hover { color: var(--ink); }
.keybox > summary > span { flex: 1; }
.keybox > summary .ico { width: 16px; height: 16px; }
.keybox > summary .chev { transition: transform .25s var(--ease); }
.keybox[open] > summary .chev { transform: rotate(180deg); }
.keybox.on > summary > .ico:first-child { color: var(--good); }
.keybox-body { display: grid; gap: 12px; padding: 0 18px 18px; color: var(--ink-2); font-size: var(--t-small); }
.keybox-body a { color: var(--ink); }
.key-form { display: flex; gap: 8px; }
.key-form input { flex: 1; min-width: 0; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); outline: none; }
.key-form input:focus { border-color: rgba(139, 92, 246, .7); box-shadow: 0 0 0 4px var(--violet-wash); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--violet); width: 16px; height: 16px; }
.key-status:empty { display: none; }
.key-status.ok { color: var(--good); }
.key-status.bad { color: var(--amber); }

/* ---------- Practice ---------- */
.score { font-size: var(--t-small); color: var(--ink-2); }
.score b { font-family: var(--serif); font-weight: 400; font-size: 1.75rem; color: var(--ink); margin-right: 6px; font-variant-numeric: tabular-nums; }
.quiz-units { margin-bottom: 20px; }
.quiz { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.qcard { display: grid; gap: 14px; align-content: start; padding: 22px 24px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); transition: border-color .25s; }
.qcard.is-right { border-color: rgba(110, 231, 183, .35); }
.qcard.is-wrong { border-color: rgba(245, 162, 93, .35); }
.q-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-3); font-size: var(--t-micro); }
.q-text { font-family: var(--serif); font-size: var(--t-h3); line-height: 1.3; letter-spacing: -.005em; font-variation-settings: "opsz" 24; }
.choices { list-style: none; display: grid; gap: 8px; }
.choice {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; min-height: 46px; padding: 10px 14px;
  border-radius: var(--r); border: 1px solid var(--line-2); background: transparent; color: var(--ink); cursor: pointer;
  font-size: var(--t-small); line-height: 1.4; transition: background-color .2s, border-color .2s;
}
.choice:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-3); }
.choice:disabled { cursor: default; }
.choice .letter { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; border: 1px solid var(--line-2); font-size: var(--t-micro); color: var(--ink-2); }
.choice.right { border-color: rgba(110, 231, 183, .55); background: var(--good-wash); }
.choice.right .letter { background: var(--good); border-color: var(--good); color: var(--bg); }
.choice.wrong { border-color: rgba(245, 162, 93, .55); background: var(--amber-wash); }
.choice.wrong .letter { background: var(--amber); border-color: var(--amber); color: var(--bg); }
.why { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.why-k { font-weight: 500; }
.why-k.right { color: var(--good); }
.why-k.wrong { color: var(--amber); }
.why p { color: var(--ink-2); font-size: var(--t-small); }
.why .link-btn { font-size: var(--t-small); justify-self: start; }

/* ---------- Cheat sheet ---------- */
.formula-list { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; border-top: 1px solid var(--line); }
.formula { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 6px 20px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.formula b { font-weight: 500; font-size: var(--t-small); color: var(--ink-2); grid-row: span 2; padding-top: 3px; }
.formula code { font-family: var(--serif); font-size: 1.1875rem; line-height: 1.35; color: var(--ink); letter-spacing: -.005em; }
.formula span { color: var(--ink-3); font-size: var(--t-small); }

/* ---------- Key terms ---------- */
.term-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.term-grid > div { padding: 22px 22px 24px; display: grid; gap: 8px; align-content: start; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--bar-h) + 24px); transition: background-color .3s; }
.term-grid > div[hidden] { display: none; }
.term-grid dt { font-family: var(--serif); font-size: 1.25rem; line-height: 1.2; letter-spacing: -.01em; }
.term-grid dd { color: var(--ink-2); font-size: var(--t-small); line-height: 1.55; }
.term-grid .t-unit { color: var(--ink-3); font-size: var(--t-micro); }
.term-grid > div.flash { background: var(--violet-wash); }
.term-grid > div.flash dt { color: var(--violet-hi); }

/* ---------- About ---------- */
.about { padding-bottom: clamp(80px, 10vw, 140px); }
.about-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.block { display: grid; gap: 12px; align-content: start; padding: 24px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); scroll-margin-top: calc(var(--bar-h) + 24px); }
.block-wide { grid-column: span 2; }
.block h3 { font-family: var(--serif); font-size: 1.375rem; letter-spacing: -.01em; }
.block p, .block li { color: var(--ink-2); font-size: var(--t-small); line-height: 1.6; }
.block ul { padding-left: 1.1em; display: grid; gap: 8px; }
.block a { color: var(--ink); }
.cleared { color: var(--ink-3); }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--line); background: linear-gradient(to bottom, var(--bg), #050608); padding-bottom: env(safe-area-inset-bottom, 0px); }
.foot-in { padding-top: 56px; padding-bottom: 48px; display: grid; gap: 24px; }
.foot-name { font-family: var(--serif); font-size: clamp(2.5rem, 1.2rem + 6vw, 7.5rem); line-height: .92; letter-spacing: -.04em; color: var(--ink); font-variation-settings: "opsz" 72; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: var(--t-small); }
.foot-nav a { color: var(--ink-2); text-decoration: none; }
.foot-nav a:hover { color: var(--ink); }
.foot-stamp { color: var(--ink-3); font-size: var(--t-micro); }

/* ---------- Floating "Ask" button ---------- */
.fab {
  position: fixed; right: max(20px, env(safe-area-inset-right, 0px)); bottom: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 35;
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 20px 0 16px; border-radius: 999px;
  background: var(--violet-btn); color: #fff; text-decoration: none; font-weight: 500; font-size: var(--t-small);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08) inset;
  transition: background-color .2s, transform .3s var(--ease), opacity .3s;
}
.fab:hover { background: #6A3BD8; color: #fff; }
.fab .ico { width: 20px; height: 20px; }

/* ---------- Reveal on scroll (only when JS runs; content is visible without it) ---------- */
.js .rv { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .rv.is-in { opacity: 1; transform: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1080px) {
  .nav a { padding: 8px 9px; }
  .term-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-head { grid-template-columns: 130px minmax(0, 1fr) 28px; }
  .u-group { display: none; }
  .row-body { grid-template-columns: 130px minmax(0, 1fr); }
  .pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pick li:nth-child(3) { padding-left: 0; border-left: 0; }
  .pick li:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .ask-grid { grid-template-columns: 1fr; }
  .ask-side { position: static; }
  .formula-list { grid-template-columns: 1fr; }
  .exam-grid { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .exp, .test { grid-template-columns: 1fr; }
  .exp-fig { border-left: 0; border-top: 1px solid var(--line); min-height: 0; }
  .test-intro { border-right: 0; border-bottom: 1px solid var(--line); }
  .quiz { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .menu-btn { display: inline-grid; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%; display: none; flex-direction: column; gap: 0;
    padding: 8px var(--gutter-r) 16px var(--gutter); background: var(--bg); border-bottom: 1px solid var(--line-2);
    box-shadow: 0 24px 48px rgba(0, 0, 0, .6);
  }
  .nav.open { display: flex; }
  .nav a { padding: 14px 4px; border-radius: 0; font-size: 1.0625rem; color: var(--ink); border-bottom: 1px solid var(--line); }
  .nav a:last-child { border-bottom: 0; }
}

/* ---------- Phone: its own composition ---------- */
@media (max-width: 720px) {
  :root { --bar-h: 58px; --gutter: max(18px, env(safe-area-inset-left, 0px)); --gutter-r: max(18px, env(safe-area-inset-right, 0px)); }
  .hero { padding-top: 32px; }
  .hero-copy { gap: 18px; }
  .hero h1 { line-height: .95; }
  .search-hero .btn { padding: 0 16px; }
  .board-stage { aspect-ratio: 1.25 / 1; }
  .pin-label { padding: 6px 10px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div { padding: 16px 0; }
  .stats > div + div { padding-left: 18px; }
  .stats > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .stats > div:nth-child(n + 3) { border-top: 1px solid var(--line); }

  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter-r)) 20px calc(-1 * var(--gutter)); padding: 0 var(--gutter-r) 4px var(--gutter); }
  .tabs::-webkit-scrollbar { display: none; }
  .toolbar { padding: 0; border: 0; background: none; gap: 12px; }
  .search-bar { background: var(--surface); }
  .toolbar .chips, .quiz-units { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter-r)); padding: 0 var(--gutter-r) 2px var(--gutter); }
  .toolbar .chips::-webkit-scrollbar, .quiz-units::-webkit-scrollbar { display: none; }

  .row-head { grid-template-columns: minmax(0, 1fr) 24px; gap: 8px 14px; padding: 18px 0; }
  .u-num { grid-column: 1; display: flex; align-items: baseline; gap: 10px; }
  .u-num b { font-size: 1.25rem; }
  .u-title { grid-column: 1; grid-row: 2; }
  .row-head > .ico { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .row-head:hover { background: none; }
  .row-body { grid-template-columns: minmax(0, 1fr); padding: 0 0 26px; }
  .row-body > * { grid-column: 1; }

  .exp-text, .test-intro, .test-body { padding: 22px 18px 24px; }
  .pick { grid-template-columns: 1fr; }
  .pick li, .pick li + li { padding: 14px 0; border-left: 0; }
  .pick li + li { border-top: 1px solid var(--line); }

  .chat { height: calc(100svh - var(--bar-h) - 24px); min-height: 480px; margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter)); border-radius: 0; border-left: 0; border-right: 0; }
  .chat-suggest { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chat-suggest::-webkit-scrollbar { display: none; }
  .chat-suggest .chip { white-space: nowrap; }
  .msg { max-width: 94%; }
  .chat-head .btn { padding: 0 12px; }

  .qcard { padding: 18px 18px 20px; }
  .formula { grid-template-columns: 1fr; }
  .formula b { grid-row: auto; }
  .term-grid { grid-template-columns: 1fr; border-left: 0; }
  .term-grid > div { border-right: 0; padding: 18px 0; }
  .search-sm { width: 100%; }
  .about-grid { grid-template-columns: 1fr; }
  .block-wide { grid-column: auto; }
  .block { padding: 20px; }
  .fab span { display: none; }
  .fab { padding: 0; width: 52px; height: 52px; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js .rv { opacity: 1; transform: none; }
}
