:root {
  --bg: #F6F5FB; --surface: #FFFFFF; --surface-2: #F1EFF9; --text: #1E1C2E; --muted: #6B6880; --line: #E2DFEE;
  --brand: #3D2F99; --brand-2: #5A4BD1; --brand-soft: #EEEBFB; --ok: #1E7A55; --ok-soft: #E3F4EC;
  --warn: #9A5A12; --warn-soft: #FBEFE3; --bad: #A33A2B; --bad-soft: #FBE9E6; --feasible: rgba(90, 75, 209, 0.16);
  --radius: 14px; --shadow: 0 1px 2px rgba(30, 28, 46, .06), 0 6px 24px rgba(30, 28, 46, .06);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14131C; --surface: #1D1B29; --surface-2: #252336; --text: #ECEAF6; --muted: #A09DB6; --line: #34314A;
    --brand: #B4A9FF; --brand-2: #8F80FF; --brand-soft: #2A2547; --ok: #6FD3A4; --ok-soft: #173327;
    --warn: #F0B572; --warn-soft: #3A2A17; --bad: #F29A8C; --bad-soft: #3B1F1B; --feasible: rgba(143, 128, 255, 0.22);
    --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; }
code, pre, textarea { font-family: var(--mono); }
a { color: var(--brand-2); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h3 { font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: .25rem; }
.muted { color: var(--muted); }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.25rem;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: .45rem; }
.mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 1rem; }

main { max-width: 1180px; margin: 0 auto 0 var(--sbw); padding: 1.5rem 1rem 4rem; margin-right: auto; }
body { --sbw: 220px; } body.collapsed { --sbw: 60px; }
@media (min-width: 1500px) { main { margin-left: max(var(--sbw), calc((100vw + var(--sbw) - 1180px) / 2 - 1rem)); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; }

.hero { text-align: center; margin: 1.5rem 0 1.25rem; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
.sub { color: var(--muted); max-width: 640px; margin: .3rem auto 0; }
.input-card { max-width: 820px; margin: 0 auto; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: .45rem 1rem; border-radius: 999px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg.small button { padding: .3rem .7rem; font-size: .85rem; }
textarea { width: 100%; min-height: 170px; margin-top: .9rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: .95rem; line-height: 1.55; resize: vertical; }
textarea:focus, input[type=search]:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.hint { color: var(--muted); font-size: .85rem; margin: .4rem 0 0; }
.drop { margin-top: .9rem; display: grid; place-items: center; gap: .6rem; min-height: 190px; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; color: var(--muted); text-align: center; padding: 1rem; }
.drop.over { border-color: var(--brand-2); background: var(--brand-soft); }
.drop img { max-width: 100%; max-height: 260px; border-radius: 8px; }
.mic { margin-top: .9rem; width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; font-size: 1.4rem; cursor: pointer; }
.mic.live { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(163, 58, 43, .18); } }
.controls { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.depth { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; }
.depth input { accent-color: var(--brand-2); }
.primary { margin-left: auto; border: 0; background: var(--brand); color: #fff; font: inherit; font-weight: 700; padding: .65rem 1.6rem; border-radius: 999px; cursor: pointer; }
.primary:hover { background: var(--brand-2); }
.primary.small { margin-left: 0; padding: .35rem 1rem; font-size: .9rem; }
.examples { max-width: 820px; margin: 1rem auto 0; display: flex; gap: .6rem; align-items: baseline; color: var(--muted); }
#example-chips, .chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: .25rem .7rem; font-size: .85rem; cursor: pointer; }
.chip.on, .chip:hover { border-color: var(--brand-2); color: var(--brand); }

.back { display: inline-block; margin-bottom: 1rem; text-decoration: none; font-weight: 600; }
.back-from { margin-left: 1.25rem; }
.sol-head { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.badge { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .2rem .7rem; font-size: .82rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
button.badge.link { border: 0; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
button.badge.link:hover { color: var(--brand); }
.sol-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 1rem; align-items: start; }
.sol-grid > * { min-width: 0; }   /* a wide formula or code block scrolls inside its step instead of pushing under the side panel */
.answer { border-left: 5px solid var(--brand-2); }
.answer .big { font-size: 1.5rem; font-weight: 800; }
.steps { display: grid; gap: .75rem; margin-top: 1rem; }
.step { scroll-margin-top: 90px; }   /* a step scrolled to stays below the sticky top bar */
.step summary { cursor: pointer; font-weight: 700; display: flex; gap: .6rem; align-items: center; list-style: none; }
.step summary::-webkit-details-marker { display: none; }
.step .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: .85rem; flex: none; }
.step .content { margin-top: .6rem; overflow-x: auto; }
.math-block { overflow-x: auto; padding: .4rem 0; }
.derive { margin-top: .9rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.derive > summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.derive h4 { margin: .9rem 0 .3rem; font-size: .95rem; }
.derive table { margin: .2rem 0 .4rem; }
.derive ul { margin: .2rem 0; padding-left: 1.2rem; }
.derive-steps { padding-left: 1.3rem; }
.derive-steps li { margin: .35rem 0; }
.steps > * { min-width: 0; }   /* a step never grows wider than its column */
.model-rows { display: grid; grid-template-columns: minmax(0, max-content) minmax(12rem, 1fr); gap: .45rem 1.5rem; align-items: baseline; padding: .4rem 0; }
.mr-math { overflow-x: auto; overflow-y: hidden; }
.mr-note { color: var(--muted); font-size: .92rem; }
.tex-src summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
@media (max-width: 700px) { .model-rows { grid-template-columns: minmax(0, 1fr); gap: .1rem; } .mr-note { margin-bottom: .45rem; } }
pre.code { background: var(--surface-2); padding: .8rem 1rem; border-radius: 10px; overflow-x: auto; font-size: .84rem; margin: .5rem 0 0; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.side { display: grid; gap: 1rem; position: sticky; top: 72px; }
.side pre { white-space: pre-wrap; font-size: .82rem; margin: 0; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; }
button.ghost { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: .35rem .9rem; font: inherit; font-size: .88rem; cursor: pointer; }
button.ghost:hover { border-color: var(--brand-2); color: var(--brand); }
canvas { width: 100%; height: auto; background: var(--surface); border-radius: 10px; }

.ws { display: grid; grid-template-columns: 240px minmax(0, 1fr) 360px; gap: 1rem; }
.ws-center { display: grid; gap: 1rem; grid-template-rows: auto 1fr; }
.ws-right { display: grid; gap: 1rem; align-content: start; }
.editor { padding: 0; overflow: hidden; }
.editor-bar { display: flex; gap: .75rem; align-items: center; padding: .5rem .75rem; border-bottom: 1px solid var(--line); background: var(--surface-2); font-family: var(--mono); font-size: .85rem; }
.editor-bar span { margin-right: auto; }
.editor textarea { margin: 0; border: 0; border-radius: 0; min-height: 260px; background: var(--surface); }
.console { padding: 0; overflow: hidden; }
.console-title { padding: .4rem .75rem; font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.console pre { margin: 0; padding: .7rem .9rem; min-height: 160px; max-height: 260px; overflow: auto; font-size: .82rem; }
.vars td { font-family: var(--mono); font-size: .82rem; }
.ws-history { padding-left: 1.2rem; margin: 0; font-size: .85rem; }
.ws-history li { cursor: pointer; margin-bottom: .2rem; }

.lib-head { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: .75rem; }
input[type=search] { padding: .55rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; min-width: 260px; }
.lib-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .9rem; margin-top: 1rem; }
.lib-item h4 { margin: .3rem 0 .4rem; font-size: 1rem; }
.lib-item p { margin: 0 0 .6rem; font-size: .88rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.hist-row { display: grid; grid-template-columns: 150px 90px 1fr 120px 110px; gap: .75rem; align-items: center; padding: .6rem .8rem; border-bottom: 1px solid var(--line); cursor: pointer; font-size: .9rem; }
.hist-row:hover { background: var(--surface-2); }

#busy { position: fixed; inset: 0; background: rgba(20, 19, 28, .35); display: grid; place-items: center; z-index: 20; color: #fff; text-align: center; }
#busy[hidden] { display: none; }
#prove-integer-wrap[hidden] { display: none; }
.spinner { width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .sol-grid, .ws { grid-template-columns: 1fr; }
  .side { position: static; }
  .hist-row { grid-template-columns: 1fr 1fr; }
  .topbar { gap: .75rem; }
}
.names { width: 100%; margin-top: .6rem; padding: .55rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: .9rem; }
.examples-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .7rem; color: var(--muted); font-size: .88rem; }
.thumb { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: .3rem; cursor: pointer; display: grid; gap: .2rem; color: var(--text); }
.thumb img { width: 150px; height: 70px; object-fit: cover; border-radius: 6px; }
.thumb:hover { border-color: var(--brand-2); }
#voice-player { display: block; width: 100%; max-width: 420px; margin-top: .8rem; }
#voice-player[hidden] { display: none; }

/* Developer mode: token cost of each answer and of the session */
#devbar { position: fixed; right: 16px; bottom: 44px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow); padding: .35rem .9rem; font-size: .8rem; color: var(--muted); z-index: 20; }
.devcost td { font-size: .85rem; }
.sim-item { border-top: 1px solid var(--line); padding: .6rem 0; display: grid; gap: .3rem; }
.practice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .7rem; }
.practice-grid label { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
.practice-grid select { font: inherit; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.pr-progress { display: flex; gap: .3rem; margin: .8rem 0; flex-wrap: wrap; }
.pr-dot { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; border: 1px solid var(--line); background: var(--surface); }
.pr-dot.now { border-color: var(--brand); color: var(--brand); font-weight: 700; }
.pr-dot.ok { background: #DDF3E4; border-color: #3B9B5C; color: #1F6B39; }
.pr-dot.shown { background: #FBEBD3; border-color: #C98A2B; color: #7A5212; }
.practice-grid input { font: inherit; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.fb-classes { display: flex; flex-wrap: wrap; gap: .4rem; }
.fb-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .6rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; background: var(--surface); cursor: pointer; }
.fb-comment { display: grid; gap: .25rem; margin-top: 1rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
.fb-comment textarea { font: inherit; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.chip.pro { border-color: var(--brand); color: var(--brand); font-weight: 600; }

/* App layout (item 38): sidebar, top bar search, status bar. Pattern only; icons are Lucide (see app.js). */
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.topbar { gap: 1rem; }
.gsearch { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.gsearch input { width: 100%; min-width: 0; padding-right: 4.2rem; }
.gsearch kbd { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); font: .72rem var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: .05rem .35rem; pointer-events: none; }
.top-actions { display: flex; gap: .25rem; align-items: center; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--brand); }
.dot { position: absolute; top: 6px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }
.bell-wrap { position: relative; }
.dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow), 0 8px 30px rgba(0,0,0,.15); padding: .35rem; max-height: 60vh; overflow: auto; }
.dropdown.right { left: auto; right: 0; width: 280px; padding: .8rem; font-size: .9rem; }
.dropdown[hidden] { display: none; }
.dropdown a.res { display: block; padding: .45rem .6rem; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; }
.dropdown a.res small { display: block; color: var(--muted); font-weight: 400; }
.dropdown a.res:hover, .dropdown a.res:focus { background: var(--brand-soft); color: var(--brand); }
.dropdown .empty { padding: .5rem .6rem; color: var(--muted); }
.sidebar { position: fixed; top: 56px; bottom: 30px; left: 0; width: var(--sbw); z-index: 4; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between; overflow-y: auto; overflow-x: hidden; }
.sidebar nav { padding: .5rem; }
.nav-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: .8rem .6rem .25rem; white-space: nowrap; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand); }
.sidebar nav a .lock { margin-left: auto; display: inline-flex; opacity: .55; }
.sidebar nav a .lock[hidden] { display: none; }
.sidebar nav a .lock .ico { width: 14px; height: 14px; }
.sidebar nav a.nav-signup { margin: .5rem .2rem .2rem; justify-content: center; background: var(--brand); color: #fff; font-size: .85rem; white-space: normal; text-align: center; }
.sidebar nav a.nav-signup[hidden] { display: none; }
.sidebar nav a.nav-signup:hover { color: #fff; filter: brightness(1.1); }
body.collapsed .sidebar nav a .lock, body.collapsed .sidebar nav a.nav-signup { display: none; }
.side-toggle { margin: .5rem; display: flex; align-items: center; justify-content: center; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.side-toggle:hover { color: var(--brand); border-color: var(--brand-2); }
body.collapsed .nav-group, body.collapsed .sidebar nav a span { display: none; }
body.collapsed .sidebar nav a { justify-content: center; }
body.collapsed .side-toggle .ico { transform: rotate(180deg); }
.statusbar { position: fixed; left: 0; right: 0; bottom: 0; height: 30px; z-index: 6; display: flex; align-items: center; gap: 1rem; padding: 0 1rem;
  background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; }
.statusbar .sb-right { margin-left: auto; } .statusbar .sb-right ~ .sb-right { margin-left: 0; }
.sb-meter { width: 70px; height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; flex: none; }
.sb-meter i { display: block; height: 100%; background: var(--brand-2); width: 0; }
.sb-meter.hot i { background: var(--warn); } .sb-meter.full i { background: var(--bad); }
.sb-ok { color: var(--ok); } .sb-bad { color: var(--bad); font-weight: 700; }
@media (max-width: 720px) {
  body, body.collapsed { --sbw: 0px; }
  main { margin: 0 auto; padding-bottom: 7rem; }
  .brand-text, .gsearch kbd, .side-toggle, .nav-group { display: none; }
  .topbar { padding: .5rem .75rem; gap: .5rem; }
  .gsearch { margin-left: 0; }
  .sidebar { top: auto; bottom: 30px; left: 0; right: 0; width: auto; height: 56px; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
  .sidebar nav { display: flex; padding: .25rem; gap: .1rem; width: 100%; justify-content: space-between; }
  .sidebar nav a, body.collapsed .sidebar nav a { flex-direction: column; gap: .1rem; justify-content: center; padding: .25rem .4rem; font-size: .62rem; flex: 1 0 auto; min-width: 48px; }
  .sidebar nav a span, body.collapsed .sidebar nav a span { display: block; }
  .dropdown.right { position: fixed; top: 52px; right: 8px; width: calc(100vw - 16px); }
  .statusbar { gap: .6rem; padding: 0 .6rem; } #sb-tier, #sb-ver { display: none; }
  #devbar { bottom: 94px; }
  /* No sideways scrolling on phones: content fits the screen, rows wrap, the search box can shrink. */
  html, body { overflow-x: hidden; }
  main { width: 100%; max-width: 100vw; box-sizing: border-box; padding-left: .75rem; padding-right: .75rem; }
  main .card, main textarea, main input, main select, main table { max-width: 100%; box-sizing: border-box; }
  .controls, .row, .seg, .examples, #example-chips { flex-wrap: wrap; }
  .seg { overflow-x: auto; }
  .gsearch { min-width: 0; }
  .gsearch input, input[type=search] { width: 100%; min-width: 0; }
  .topbar > * { min-width: 0; }
  .sidebar nav { justify-content: flex-start; }
  .sidebar nav a, body.collapsed .sidebar nav a { min-width: 44px; padding: .25rem .3rem; font-size: .58rem; }
  h1 { font-size: 1.5rem; }
}

/* Sign-in control (Cognito; shown only when [auth] is on) and the Help screen (content/help/*.md). */
.auth-btn { height: 34px; padding: 0 .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.auth-btn:hover { border-color: var(--brand-2); color: var(--brand); }
.auth-btn[hidden], .auth-msg[hidden] { display: none; }
.auth-msg { position: fixed; top: 60px; right: 1rem; z-index: 31; max-width: min(420px, calc(100vw - 2rem)); margin: 0; padding: .6rem .8rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--bad); color: var(--text); box-shadow: var(--shadow); font-size: .9rem; }
.help-grid { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; align-items: start; }
.help-list ul { list-style: none; margin: 0; padding: 0; }
.help-list a { display: block; padding: .5rem .6rem; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; }
.help-list a small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; margin-top: .15rem; }
.help-list a:hover, .help-list a[aria-current] { background: var(--brand-soft); color: var(--brand); }
.help-view { min-width: 0; overflow-wrap: anywhere; }
.help-view h3:focus { outline: none; }
.help-view table { display: block; overflow-x: auto; }
@media (max-width: 720px) {
  .help-grid { grid-template-columns: minmax(0, 1fr); }
  .help-list a small { display: none; }
  .auth-btn { padding: 0 .55rem; font-size: .8rem; }
}

/* Plans (payments) */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.plan-card { display: flex; flex-direction: column; gap: .5rem; }
.plan-card .price { font-size: 1.6rem; font-weight: 800; }
.plan-card .price small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.plan-card ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .92rem; }
.plan-card .primary { margin: .4rem 0 0; align-self: flex-start; }
.plan-card.current { border-color: var(--brand); }

/* Beta welcome banner and the legal links in the status bar */
.beta-banner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0 0 1rem; padding: .8rem 1rem;
  background: var(--brand-soft); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); }
.beta-banner[hidden] { display: none; }
.beta-banner span { flex: 1 1 18rem; }
.beta-banner a, .statusbar .sb-legal a { color: var(--brand-2); }
.statusbar .sb-legal a { text-decoration: none; } .statusbar .sb-legal a:hover { text-decoration: underline; }

/* Public pages: the server's readable copy of an article (removed when the app shows the screen) */
.seo-article { max-width: 760px; margin: 1rem auto 2rem; line-height: 1.6; }
.seo-article:has(.duality-table) { max-width: 1100px; }
.duality-table { width: 100%; border-collapse: collapse; margin: .6rem 0 1.2rem; font-size: .92rem; }
.duality-table th, .duality-table td { text-align: left; vertical-align: top; padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
.duality-table td .katex { white-space: nowrap; }
.duality-table tr.pair td { border-bottom: 0; padding-bottom: .15rem; }
.duality-table tr.says td { color: var(--muted); padding-top: 0; }
.duality-table tr.pair td:last-child { white-space: nowrap; }
@media (max-width: 900px) { .duality-table { display: block; overflow-x: auto; } }

/* Front page (proven-decisions.ai/, 8 Nov 2026) */
body.front { background: var(--bg); color: var(--text); }
.front-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 1080px; margin: 0 auto; padding: 1rem; flex-wrap: wrap; }
.front-top nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.front-top nav a:not(.primary) { color: var(--text); text-decoration: none; }
.front-top .primary { margin-left: 0; text-decoration: none; }
.front-main { max-width: 1080px; margin: 0 auto; padding: 0 1rem 3rem; }
.front-demo video { width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); background: #000; margin: .5rem 0 1rem; }
.front-top nav a[aria-current="page"] { font-weight: 700; }
.front-main section { margin: 2.5rem 0; }
.front-hero { text-align: center; margin-top: 3rem; }
.front-hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 1rem; }
.front-hero p { font-size: 1.15rem; color: var(--muted); max-width: 720px; margin: 0 auto 1.5rem; }
.front-hero .primary { margin: 0; text-decoration: none; display: inline-block; }
.front-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.front-grid img, .front-grid audio { width: 100%; border-radius: 8px; }
.front-grid pre { background: var(--surface-2); padding: .6rem; border-radius: 8px; overflow-x: auto; font-family: var(--mono); }
.front-latest { padding-left: 1.2rem; line-height: 1.8; }
.front-foot { text-align: center; padding: 1.5rem; color: var(--muted); }

.hero .hero-title { font-size: clamp(1.6rem, 4vw, 2.3rem); }
.front-explore { columns: 2 260px; padding-left: 1.2rem; line-height: 1.8; }

.front-proof .proof-table { border-collapse: collapse; margin: 0.6rem 0 0.8rem; font-size: 1.02rem; }
.front-proof .proof-table td { padding: 0.25rem 1.2rem 0.25rem 0; vertical-align: top; }
.front-proof .proof-table td:last-child { color: var(--muted, #667); }
.front-proof .proof-table tr:nth-child(3) td { border-top: 1px solid var(--line); padding-top: 0.45rem; }

/* Group plans: buy, manage seats and members, join (Derek, 9 Nov 2026) */
#group .notice, #join .notice { margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .8rem 1rem; }
.form-grid label, #group label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
.form-grid .wide { grid-column: 1 / -1; }
#group input:not([type=radio]), #group select, #join input { padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
#group input.n { width: 4.5rem; }
#group input.link { width: 100%; font-family: var(--mono); font-size: .8rem; }
.plan-card.choose { cursor: pointer; position: relative; }
.plan-card.choose input { position: absolute; top: 1rem; right: 1rem; }
.plan-card.choose:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.price-line { margin: .9rem 0 .4rem; }
#group .actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-top: .6rem; }
#group .actions .primary, #join .primary { margin-left: 0; }
#group details summary { cursor: pointer; }
table.simple { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.simple th, table.simple td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
a.primary { display: inline-block; text-decoration: none; }

/* Front page "Try it now" box (9 Nov 2026) */
.front-try textarea { width: 100%; box-sizing: border-box; font: .95rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; padding: .8rem 1rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.front-try .try-result h3 { margin: .9rem 0 .3rem; font-size: 1rem; }
.front-try .try-result h3:first-child { margin-top: 0; }
.front-try .try-result table { border-collapse: collapse; margin: .3rem 0; }
.front-try .try-result th, .front-try .try-result td { text-align: left; padding: .25rem .8rem .25rem 0; border-bottom: 1px solid var(--line); }
.front-try .try-cta { margin-top: 1rem; }
/* the sign-up card after a guest's answer (Derek, 17 Nov 2026) */
.try-milestone { margin-top: 1.1rem; padding: .9rem 1rem; border-radius: 10px; background: var(--ok-soft); border: 1px solid var(--line); }
.try-milestone p { margin: 0 0 .4rem; }
.try-milestone .try-cta { margin: .6rem 0 0; }
.try-locked { margin: .2rem 0 0; padding-left: 0; list-style: none; columns: 2 14rem; }
.try-locked li { margin: .15rem 0; color: var(--muted); }

/* Solved-example pages (/examples/<slug>; Derek, 10 Nov 2026) */
.seo-article .ex-lede { font-size: 1.05rem; }
.seo-article .ex-answer { background: var(--surface-2); border-left: 4px solid var(--brand, #6b4fbb); padding: .7rem .9rem; border-radius: 8px; margin: 1rem 0; }
.seo-article .ex-statement { background: var(--surface-2); padding: .7rem .9rem; border-radius: 8px; }
.seo-article .ex-media { border: 2px solid var(--brand, #6b4fbb); border-radius: 12px; padding: .4rem 1rem 1rem; margin: 1.2rem 0; }
.seo-article .ex-media h2 { margin-top: .6rem; }
.seo-article .ex-media-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.seo-article .ex-media-row figure { flex: 1 1 260px; margin: 0; }
.seo-article .ex-media-row figcaption { font-weight: 600; margin-bottom: .4rem; }
.seo-article .ex-media-row audio { width: 100%; }
.seo-article .ex-media-row img { max-width: 100%; height: auto; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.seo-article .tex-block { overflow-x: auto; margin: .6rem 0; }
.seo-article .table-wrap { overflow-x: auto; }
.seo-article .model-rows td { padding: .2rem .6rem; vertical-align: middle; }
.seo-article .model-rows td.note { color: var(--muted, #5d6475); font-size: .92rem; }
.seo-article pre { overflow-x: auto; }
.seo-article .api-table { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; font-size: .92rem; }
.seo-article .api-table th, .seo-article .api-table td { text-align: left; vertical-align: top; padding: .45rem .55rem; border-bottom: 1px solid var(--line); }
.seo-article h3:has(code) { text-transform: none; letter-spacing: normal; }
.seo-article h3 code { font-size: 1rem; text-transform: none; }
.seo-article .ex-fig { width: 100%; max-width: 560px; height: auto; display: block; margin: .6rem 0; font: 11px sans-serif; }
.ex-fig .feas rect { fill: var(--feasible, rgba(107, 79, 187, .18)); }
.ex-fig .frame { fill: none; stroke: var(--line, #c4c8d0); }
.ex-fig .cons line { stroke: var(--brand-2, #3b82c4); stroke-width: 1.4; }
.ex-fig .obj { stroke: var(--warn, #d08a1e); stroke-width: 2; stroke-dasharray: 6 5; }
.ex-fig .lvl { stroke: var(--muted, #9aa0ac); stroke-width: 1; }
.ex-fig .opt { fill: var(--bad, #c2410c); }
.ex-fig .optl { font-weight: 700; fill: var(--text, #1f2430); font-size: 12px; }
.ex-fig text { fill: var(--muted, #5d6475); }
.ex-fig .bar { fill: var(--brand, #6b4fbb); }
.seo-article .ex-list li { margin: .3rem 0; }
.seo-article .ex-list small { color: var(--muted, #5d6475); margin-left: .4rem; }

/* Hodos, the in-app agent (Derek, 10 Nov 2026): a panel over the page, never resizing it */
.hodos-btn { position: fixed; right: 18px; bottom: 54px; z-index: 60; border: 0; border-radius: 999px; padding: .65rem 1.1rem;
  background: var(--brand, #5a4bd1); color: #fff; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.2); cursor: pointer; }
.hodos { position: fixed; top: 0; right: 0; bottom: 0; width: min(390px, 100vw); z-index: 70; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -6px 0 18px rgba(0,0,0,.12); }
.hodos[hidden] { display: none; }
.hodos header { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.hodos header button { margin-left: auto; border: 0; background: none; font-size: 1.4rem; cursor: pointer; color: var(--text); }
.hodos-tools { display: flex; gap: .4rem; padding: .45rem 1rem; border-bottom: 1px solid var(--line); }
.hodos-tools[hidden] { display: none; }
.hodos-saved { margin: 0; align-self: center; font-size: .8rem; color: var(--muted); }
.hodos-log { flex: 1; overflow-y: auto; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .6rem; }
.hodos-msg { padding: .55rem .75rem; border-radius: 12px; max-width: 92%; line-height: 1.45; }
.hodos-msg.me { align-self: flex-end; background: var(--brand, #5a4bd1); color: #fff; }
.hodos-msg.bot { align-self: flex-start; background: var(--surface-2); }
.hodos-src { margin-top: .4rem; font-size: .85rem; }
.hodos-book { margin-top: .4rem; font-size: .85rem; font-style: italic; }
.hodos-acts { display: flex; gap: .4rem; margin-top: .5rem; }
.hodos-err { color: var(--bad); }
.hodos-ask { border-top: 1px solid var(--line); padding: .6rem 1rem; }
.hodos-ask textarea { width: 100%; resize: vertical; }
.hodos-row { display: flex; align-items: center; gap: .5rem; margin-top: .4rem; }
.hodos-row button { margin-left: auto; }
.hodos-form { display: flex; flex-direction: column; gap: .4rem; }
.hodos-form label { display: flex; flex-direction: column; font-size: .88rem; gap: .2rem; }
.hodos-caption { margin: 0; padding: .5rem 1rem .8rem; font-size: .8rem; color: var(--muted); font-style: italic; }
@media (max-width: 600px) { .hodos { width: 100vw; } .hodos-btn { bottom: 64px; } }

/* Front page: Ask Hodos (Derek, 10 Nov 2026) */
.front-hodos { border: 2px solid var(--brand, #6b4fbb); border-radius: 14px; padding: .4rem 1.2rem 1rem; background: var(--surface-2); }
.front-hodos h2 { margin-top: .6rem; }

/* Growth plan, 11 Nov 2026: solved examples on the front page, a button under each answer, related examples */
.front-grid a.ex-card { color: inherit; text-decoration: none; display: block; transition: border-color .15s; }
.front-grid a.ex-card:hover { border-color: var(--brand, #6b4fbb); }
.front-grid a.ex-card h3 { margin: 0 0 .3rem; }
.front-grid a.ex-card p { margin: .2rem 0; color: var(--muted); }
.front-grid a.ex-card .more { color: var(--brand, #6b4fbb); font-weight: 600; margin-top: .5rem; }
.seo-article .ex-cta { margin: .2rem 0 1.4rem; }
.seo-article .ex-cta .hint { margin-left: .5rem; }
.seo-article .ex-related li { margin: .3rem 0; }
.seo-article .ex-related small { color: var(--muted, #5d6475); margin-left: .4rem; }

/* Phones (Derek, 12 Nov 2026): a bottom bar of four tabs and More, larger tap targets, nothing wider than the screen. */
.nav-more { display: none; }
.more-sheet[hidden] { display: none; }
@media (max-width: 720px) {
  .sidebar nav { justify-content: space-around; }
  .sidebar nav > a:not(.tab), .sidebar nav > .nav-group { display: none; }
  .sidebar nav a.tab, body.collapsed .sidebar nav a.tab { flex: 1 1 0; min-width: 0; font-size: .66rem; }
  .nav-more { display: flex; flex: 1 1 0; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
    border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: .66rem; padding: .25rem .3rem; border-radius: 10px; cursor: pointer; }
  .nav-more.active { background: var(--brand-soft); color: var(--brand); }
  .more-sheet { position: fixed; left: 0; right: 0; top: 0; bottom: 86px; z-index: 5; background: rgba(20, 19, 28, .35); display: flex; align-items: flex-end; }
  .more-sheet nav { width: 100%; max-height: 100%; overflow-y: auto; box-sizing: border-box; background: var(--surface); border-radius: 16px 16px 0 0; padding: .5rem 1rem 1rem; box-shadow: var(--shadow); }
  .more-sheet h4 { margin: .7rem 0 .35rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
  .more-grid a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-height: 64px; padding: .5rem .25rem;
    border-radius: 12px; background: var(--surface-2); color: var(--text); text-decoration: none; font-size: .78rem; font-weight: 600; text-align: center; }
  .more-legal { margin: .8rem 0 0; text-align: center; font-size: .9rem; }
  .more-legal a { display: inline-block; padding: .55rem .4rem; }
  body.more-open .hodos-btn { display: none; }
  .statusbar .sb-legal, #sb-solver { display: none; }
  .hodos-btn { bottom: 96px; }
  #mode-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; box-sizing: border-box; overflow: visible; }
  #mode-seg button { min-height: 44px; padding: .4rem .2rem; font-size: .85rem; line-height: 1.15; }
  .seg button { min-height: 40px; }
  input[type=checkbox] { width: 20px; height: 20px; }
  .editor-bar { flex-wrap: wrap; }
  .editor-bar .seg { flex-wrap: nowrap; }
  .editor-bar .primary { white-space: nowrap; }
  .back { padding: .6rem 0; }
  .duality-table { display: block; max-width: 100%; overflow-x: auto; position: relative; }   /* relative: KaTeX's hidden screen-reader copy stays inside the scroll box */
}

/* "Add to your home screen" hint on phones (static/pwa.js). */
.install-tip { position: fixed; left: 8px; right: 8px; top: 60px; z-index: 40; display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem;
  background: var(--surface, #fff); color: var(--text, #1E1C2E); border: 1px solid var(--line, #E2DFEE); border-radius: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); font-size: .9rem; }
.install-tip img { width: 36px; height: 36px; flex: none; }
.install-tip p { margin: 0; flex: 1; }
.install-tip button { border: 0; border-radius: 999px; padding: .55rem .9rem; font: inherit; font-weight: 600; cursor: pointer; }
.install-tip .go { background: var(--brand, #3D2F99); color: #fff; }
.install-tip .x { background: none; color: var(--muted, #6B6880); font-size: 1.1rem; padding: .4rem .5rem; }

/* Connecting an app such as Claude (/oauth/authorize, static/oauth.js; 14 Nov 2026) */
.oauth-page { max-width: 560px; padding-top: 3rem; }
.oauth-brand { font-weight: 700; color: var(--brand); letter-spacing: .02em; margin: 0 0 .4rem; }
.oauth-page h1 { font-size: 1.6rem; margin: 0 0 1rem; }
.oauth-ask { font-size: 1.1rem; margin-top: 0; }
.oauth-buttons { display: flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.oauth-buttons button { min-width: 7rem; }
.oauth-buttons .primary { margin-left: 0; }
.oauth-buttons button:not(.primary) { font: inherit; padding: .65rem 1.6rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: inherit; cursor: pointer; }
.oauth-msg { margin: .8rem 0 0; }
/* Glossary (Derek, 15 Nov 2026) */
.gl-topics { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.gl-topics button { font: inherit; font-size: .82rem; padding: .25rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.gl-topics button:hover { color: var(--text); border-color: var(--brand-2); }
.gl-group { margin: 1.1rem 0 0; font-size: 1rem; scroll-margin-top: 5rem; }
.gl-list { margin: .3rem 0 0; }
.gl-list dt { font-weight: 700; margin-top: .75rem; scroll-margin-top: 5rem; }
.gl-list dd { margin: .15rem 0 0; line-height: 1.5; }
.gl-list dd code { background: var(--surface-2); padding: 0 .25rem; border-radius: 4px; font-size: .9em; }
.gl-list .gl-hit { background: var(--brand-soft); border-radius: 6px; padding: .1rem .35rem; margin-left: -.35rem; }
/* FAQ (Derek, 15 Nov 2026) */
.faq-section { margin: 1.4rem 0 .4rem; font-size: 1rem; scroll-margin-top: 5rem; }
.faq-q { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin: .5rem 0; padding: 0 1rem; scroll-margin-top: 5rem; }
.faq-q summary { cursor: pointer; font-weight: 700; padding: .8rem 0; list-style-position: outside; }
.faq-q[open] summary { border-bottom: 1px solid var(--line); margin-bottom: .6rem; }
.faq-q .faq-a { padding-bottom: .8rem; line-height: 1.55; overflow-x: auto; }
.faq-q table { border-collapse: collapse; font-size: .88rem; }
.faq-q th, .faq-q td { border-bottom: 1px solid var(--line); padding: .35rem .5rem; text-align: left; vertical-align: top; }
.plan-tagline { margin: .2rem 0 .5rem; font-size: .88rem; color: var(--muted); line-height: 1.45; }

/* Session files under History (15 Nov 2026) */
#sess-h { margin-top: 24px; }
.sess-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border, rgba(127,127,127,.2)); }
.sess-row:last-child { border-bottom: 0; }
.sess-row > span:last-of-type { margin-left: auto; }
.sess-body { flex-basis: 100%; }
.sess-ev { padding: 8px 0; border-top: 1px dashed var(--border, rgba(127,127,127,.2)); overflow-wrap: anywhere; }
.sess-in { white-space: pre-wrap; margin: 6px 0 0; font-size: .9em; max-height: 12em; overflow: auto; }

/* Books (/books, /books/<slug>, My books; Derek, 16 Nov 2026) */
.book { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 1.5rem; align-items: start; margin: 1rem 0 1.5rem; }
.book-cover { width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0,0,0,.15); }
.book-info p { margin: .35rem 0; }
.book-sub { font-size: 1.1rem; font-style: italic; color: var(--muted); }
.book-price b { font-size: 1.8rem; font-weight: 800; }
.book-price small { color: var(--muted); }
.book-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: .8rem !important; }
.book-actions .primary { margin-left: 0; }
.book-actions .primary:disabled { opacity: .55; cursor: default; }
.book-toc { columns: 2; column-gap: 2rem; }
.book-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.book-card { display: flex; gap: .9rem; align-items: flex-start; text-decoration: none; color: var(--text); }
.book-card img { width: 90px; height: auto; border-radius: 4px; border: 1px solid var(--line); flex: none; }
.hist-row.book-row { grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) auto; }
@media (max-width: 720px) {
  .book { grid-template-columns: minmax(0, 1fr); }
  .book-cover { max-width: 220px; justify-self: center; }
  .book-toc { columns: 1; }
  .hist-row.book-row { grid-template-columns: minmax(0, 1fr); }
}

.book-ack { display: flex; gap: .5rem; align-items: flex-start; margin: .6rem 0 .2rem; font-size: .95rem; cursor: pointer; }
.book-ack input { margin-top: .25rem; }

/* New requests (17 Nov 2026): the "Which subject?" box matches the text areas */
#rq-other { padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }

/* Opt for ML page (/ml, 17 Nov 2026): one block per ML problem; the math scrolls inside its block on a narrow phone. */
.ml-row { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.ml-row h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.ml-row h3 small { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: .85rem; }
.ml-math { overflow-x: auto; padding: 4px 0; max-width: 100%; }
.ml-row p { margin: 6px 0; }

/* Front page on phones (Derek, 17 Nov 2026: a first-time visitor in Safari never saw the app's bottom bar): its own
   bottom bar of public sections; More opens the rest, plus Sign in and Start free. No script needed (<details>). */
.front-tabs { display: none; }
@media (max-width: 720px) {
  body.front { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .front-tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface);
    border-top: 1px solid var(--line); padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom)); justify-content: space-around; }
  .front-tabs > a, .ft-more > summary { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: .1rem;
    padding: .3rem .2rem; color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 600; text-align: center; cursor: pointer; }
  .front-tabs span { font-size: 1.15rem; line-height: 1.2; }
  .ft-more { flex: 1 1 0; min-width: 0; display: flex; }
  .ft-more > summary { list-style: none; }
  .ft-more > summary::-webkit-details-marker { display: none; }
  .ft-more[open] > summary { color: var(--brand); }
  .ft-sheet { position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); background: var(--surface);
    border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: var(--shadow); padding: .8rem 1rem 1rem;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
  .ft-sheet a { padding: .65rem .5rem; border-radius: 10px; background: var(--surface-2); color: var(--text); text-decoration: none;
    font-weight: 600; font-size: .9rem; text-align: center; }
  .ft-sheet a.primary { background: var(--brand); color: #fff; grid-column: 1 / -1; }
  body.front .install-tip { top: auto; bottom: calc(80px + env(safe-area-inset-bottom)); }
}

/* plan quizzes (Derek, 17 Nov 2026) */
.quiz-rules { margin: .2rem 0 0; padding-left: 1.2rem; }
.quiz-rules li { margin: .3rem 0; }
.quiz-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 1rem; }
.quiz-bar { position: sticky; top: 4.2rem; z-index: 5; display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin-bottom: 1rem; }
.quiz-clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand); }
.quiz-clock.low { color: #B3261E; }
.quiz-q { margin-bottom: 1rem; overflow-x: auto; }
.quiz-q pre { white-space: pre-wrap; }
.quiz-choices { display: grid; gap: .4rem; }
.quiz-choices label { display: flex; gap: .5rem; align-items: flex-start; }
.quiz-table td, .quiz-table th { text-align: left; padding: .3rem .8rem .3rem 0; border-bottom: 1px solid var(--line); }
.quiz-hint { margin-top: .5rem; padding: .5rem .7rem; border-radius: 8px; background: var(--brand-soft); }

/* Sophia: quick answers for signed-out visitors (Derek, 17 Nov 2026); Hodos is for members */
body.sophia-on .hodos-btn { display: none; }
.sophia-btn { position: fixed; right: 18px; bottom: 54px; z-index: 60; border: 0; border-radius: 999px; padding: .65rem 1.1rem;
  background: var(--brand); color: #fff; font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px rgba(30, 28, 46, .25); }
.sophia-btn:hover { background: var(--brand-2); }
.sophia { position: fixed; right: 18px; bottom: 108px; z-index: 61; width: min(380px, calc(100vw - 32px)); max-height: min(560px, 70vh);
  display: flex; flex-direction: column; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 12px 32px rgba(30, 28, 46, .28); }
.sophia[hidden] { display: none; }
.sophia header { display: flex; align-items: baseline; gap: .5rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.sophia header button { margin-left: auto; border: 0; background: none; font-size: 1.4rem; line-height: 1; color: var(--muted); cursor: pointer; }
.sophia-sub { color: var(--muted); font-size: .85rem; }
.sophia-log { overflow-y: auto; padding: .7rem .9rem; display: grid; gap: .55rem; }
.sophia-msg { font-size: .92rem; line-height: 1.45; }
.sophia-msg p { margin: 0 0 .4rem; }
.sophia-msg.bot { background: var(--surface-2); border-radius: 12px 12px 12px 4px; padding: .55rem .7rem; }
.sophia-msg.me { justify-self: end; background: var(--brand-soft); border-radius: 12px 12px 4px 12px; padding: .45rem .7rem; max-width: 85%; }
.sophia-hint { margin: 0 0 .3rem; color: var(--muted); font-size: .82rem; }
.sophia-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.sophia-chips button, .sophia-all { border: 1px solid var(--brand-2); background: var(--surface); color: var(--brand); border-radius: 999px;
  padding: .3rem .7rem; font: inherit; font-size: .85rem; cursor: pointer; text-align: left; }
.sophia-all { border-style: dashed; }
.sophia-next { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem; }
.sophia-next a { background: var(--brand); color: #fff; border-radius: 999px; padding: .3rem .8rem; font-size: .85rem; font-weight: 600; text-decoration: none; }
.sophia-find { padding: .55rem .7rem; border-top: 1px solid var(--line); }
.sophia-find input { width: 100%; box-sizing: border-box; font: inherit; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text); }
@media (max-width: 720px) {
  .sophia-btn { bottom: 84px; right: 12px; padding: .55rem .9rem; font-size: .9rem; }
  .sophia { right: 8px; left: 8px; width: auto; bottom: 136px; max-height: calc(100vh - 190px); }
  body.more-open .sophia-btn { display: none; }
}

/* Solved examples strip on the front page (Derek, 17 Nov 2026) */
.showcase { margin: 0 0 2rem; }
.showcase:empty { display: none; }
.sc-head h2 { margin-bottom: .2rem; }
.sc-head .hint { margin-top: 0; }
.sc-frame { display: flex; align-items: stretch; gap: .5rem; }
.sc-track { flex: 1; min-width: 0; }
.sc-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.2rem; box-shadow: var(--shadow);
  animation: sc-in .35s ease; }
@keyframes sc-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sc-card { animation: none; } }
.sc-badge { margin: 0 0 .6rem; font-weight: 700; color: var(--brand); }
.sc-badge span { color: var(--text); font-weight: 600; }
.sc-body img { display: block; max-width: 100%; max-height: 260px; margin: 0 auto; border-radius: 8px; border: 1px solid var(--line); }
.sc-body audio { width: 100%; }
.sc-body pre { margin: 0; white-space: pre-wrap; background: var(--surface-2); padding: .6rem .8rem; border-radius: 8px; }
.sc-text, .sc-said { margin: .3rem 0 0; }
.sc-answer { margin: .8rem 0 .2rem; font-size: 1.05rem; }
.sc-checked { margin: 0 0 .7rem; color: var(--ok); font-size: .88rem; }
.sc-actions { margin: 0; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.sc-nav { flex: none; width: 2.2rem; border: 1px solid var(--line); background: var(--surface); color: var(--brand); border-radius: 10px;
  font-size: 1.5rem; cursor: pointer; }
.sc-nav:hover { border-color: var(--brand-2); }
.sc-dots { display: flex; justify-content: center; gap: .4rem; margin-top: .6rem; }
.sc-dots button { width: .6rem; height: .6rem; padding: 0; border-radius: 50%; border: 0; background: var(--line); cursor: pointer; }
.sc-dots button.on { background: var(--brand); }
@media (max-width: 720px) { .sc-nav { display: none; } .sc-card { padding: .9rem; } }
.sophia-greet { position: fixed; right: 18px; bottom: 108px; z-index: 61; max-width: 300px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px 14px 4px 14px; padding: .7rem .9rem; box-shadow: 0 10px 28px rgba(30, 28, 46, .25); }
.sophia-greet p { margin: 0 0 .5rem; }
.sophia-greet p:last-child { margin: 0; }
.sophia-greet button { border: 1px solid var(--brand-2); background: var(--surface); color: var(--brand); border-radius: 999px; padding: .3rem .8rem;
  font: inherit; font-size: .88rem; cursor: pointer; }
.sophia-greet .sg-yes { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (max-width: 720px) { .sophia-greet { right: 12px; left: 12px; max-width: none; bottom: 136px; } }

/* The ticker under the front page menu (Derek, 17 Nov 2026: a market-screen band) */
.ticker { display: flex; align-items: stretch; margin: 0 0 1.4rem; background: #14131C; color: #ECEAF6; border-radius: 10px;
  overflow: hidden; font-size: .9rem; }
.tk-label { flex: none; display: grid; place-items: center; padding: 0 .8rem; background: #3D2F99; color: #fff; font-weight: 800;
  letter-spacing: .08em; font-size: .78rem; }
.tk-window { flex: 1; overflow: hidden; white-space: nowrap; }
.tk-run { display: inline-flex; align-items: center; gap: .9rem; padding: .5rem .9rem; animation: tk-scroll 60s linear infinite; }
.ticker:hover .tk-run, .tk-run.held { animation-play-state: paused; }
@keyframes tk-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tk-copy { display: inline-flex; align-items: center; gap: .9rem; }
.tk-item { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: .1rem .2rem; white-space: nowrap; }
.tk-item b { color: #fff; }
.tk-item:hover b, .tk-item:focus-visible b { text-decoration: underline; }
.tk-ok { color: #6FD3A4; font-size: .8rem; }
.tk-sep { color: #6FD3A4; font-size: .7rem; }
@media (prefers-reduced-motion: reduce) {
  .tk-run { animation: none; }
  .tk-window { overflow-x: auto; }
  .tk-copy, .tk-copy + .tk-sep { display: none; }
}
