:root {
  --paper: #f6f3ec; --sheet: rgba(255, 253, 248, .55); --ink: #16171a; --ink-2: #45484d; --dim: #8a8d91;
  --line: rgba(22, 23, 26, .12); --line-2: rgba(22, 23, 26, .2); --grid: rgba(22, 23, 26, .055); --grid-2: rgba(22, 23, 26, .09);
  --tone: rgba(22, 23, 26, .075); --chrome: rgba(252, 250, 245, .92); --hover: rgba(22, 23, 26, .06);
  --shadow: 0 14px 34px -16px rgba(40, 32, 20, .3); --on-ink: #f6f3ec;
  --ui: 'Manrope', system-ui, sans-serif; --serif: 'PT Serif', Georgia, serif; --hand: 'Caveat', cursive;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17191b; --sheet: rgba(30, 33, 36, .5); --ink: #ebe9e3; --ink-2: #bdbbb5; --dim: #7d7f80;
    --line: rgba(235, 233, 227, .12); --line-2: rgba(235, 233, 227, .2); --grid: rgba(235, 233, 227, .04); --grid-2: rgba(235, 233, 227, .07);
    --tone: rgba(235, 233, 227, .08); --chrome: rgba(32, 35, 38, .92); --hover: rgba(235, 233, 227, .08);
    --shadow: 0 16px 36px -16px rgba(0, 0, 0, .6); --on-ink: #17191b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #17191b; --sheet: rgba(30, 33, 36, .5); --ink: #ebe9e3; --ink-2: #bdbbb5; --dim: #7d7f80;
  --line: rgba(235, 233, 227, .12); --line-2: rgba(235, 233, 227, .2); --grid: rgba(235, 233, 227, .04); --grid-2: rgba(235, 233, 227, .07);
  --tone: rgba(235, 233, 227, .08); --chrome: rgba(32, 35, 38, .92); --hover: rgba(235, 233, 227, .08);
  --shadow: 0 16px 36px -16px rgba(0, 0, 0, .6); --on-ink: #17191b; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background: var(--paper); color: var(--ink); font-family: var(--ui); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
.ms { font-family: 'Material Symbols Outlined'; font-weight: 400; font-size: 20px; line-height: 1; display: inline-block; font-variation-settings: 'wght' 400, 'opsz' 24; user-select: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- stage ---------- */
#stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); }
#stage.panning { cursor: grabbing; }
body.tool-pen #stage, body.tool-erase #stage { cursor: crosshair; }
body.tool-text #stage { cursor: text; }
#world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; will-change: transform; }
#ink { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
#ink path { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; pointer-events: stroke; }
body.tool-erase #ink path:hover { opacity: .35; }

/* ---------- task ---------- */
.task { position: absolute; padding: 26px 34px 30px; min-width: 520px; border-radius: 6px; background: var(--sheet);
  box-shadow: 0 0 0 1px var(--line); user-select: none; cursor: default; }
.task::before, .task::after { content: ''; position: absolute; width: 14px; height: 14px; border: 0 solid var(--ink); pointer-events: none; }
.task::before { left: -1px; top: -1px; border-left-width: 1.5px; border-top-width: 1.5px; }
.task::after { right: -1px; bottom: -1px; border-right-width: 1.5px; border-bottom-width: 1.5px; }
.task.sel { box-shadow: 0 0 0 1.5px var(--ink-2); }
.t-head { display: flex; align-items: baseline; gap: 12px; margin: -6px -10px 8px; padding: 6px 10px; border-radius: 6px; cursor: grab; min-height: 34px; }
.t-head:active { cursor: grabbing; }
.t-num { font-weight: 800; font-size: 12px; letter-spacing: .06em; color: var(--dim); white-space: nowrap; }
.t-title { font-family: var(--serif); font-weight: 700; font-size: 21px; letter-spacing: -.01em; }
.t-topic { font-size: 12px; font-weight: 600; color: var(--dim); white-space: nowrap; }
.t-tools { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .2s; align-self: center; }
.task:hover .t-tools, .task.sel .t-tools, .t-tools:focus-within { opacity: 1; }
@media (hover: none) { .t-tools { opacity: 1; } }
.t-tools button { width: 32px; height: 32px; border-radius: 99px; display: grid; place-items: center; color: var(--ink-2); }
.t-tools button:hover { background: var(--hover); color: var(--ink); }
.t-tools .ms { font-size: 18px; }
.t-cond { font-family: var(--serif); font-style: italic; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); max-width: 780px;
  padding-left: 14px; border-left: 1.5px solid var(--line-2); margin-bottom: 22px; user-select: text; white-space: pre-wrap; }
.t-body { display: flex; gap: 44px; align-items: flex-start; }
.t-fig { position: relative; flex: none; }
.fig { display: block; overflow: visible; }
.t-notes { width: 410px; font-family: var(--serif); font-size: 16px; line-height: 1.45; user-select: text; cursor: text; }

/* figure ink */
.fig .ink { fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.fig .bold { stroke-width: 2.6; }
.fig .thin { stroke-width: 1.1; }
.fig .rope { stroke-width: 1.35; }
.fig .vec { stroke-width: 2; }
.fig .motion { stroke-width: 1.4; }
.fig .dash { stroke-width: 1; stroke-dasharray: 5 4; }
.fig .trace { stroke-width: 1.3; stroke-dasharray: 2 4; }
.fig .fill-ink { fill: var(--ink); }
.fig .fill-paper { fill: var(--paper); }
.fig .fill-tone { fill: var(--tone); }
.fig .hatchline { stroke: var(--ink); stroke-width: .8; opacity: .6; }
.fig .L-axis .ink { stroke: var(--ink-2); }
.fig .lbl { overflow: visible; pointer-events: none; }
.fig .lbl > div { width: 160px; height: 60px; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 15px; color: var(--ink); white-space: nowrap; }
.fig .L-axis .lbl > div { font-style: italic; color: var(--ink-2); }
.fig .sh { transition: opacity .35s ease; }
.fig .sh.pre, .fig .sh.unrev { opacity: 0; }
#world.hide-force .L-force, #world.hide-motion .L-motion, #world.hide-axis .L-axis, #world.hide-guide .L-guide { display: none; }
.burst path { stroke-width: 2.2; }
.burst { animation: burst .9s cubic-bezier(.2, .8, .2, 1) both; transform-box: fill-box; }
@keyframes burst { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 1; } }
.t-callouts { position: absolute; left: 0; top: 0; pointer-events: none; }
.t-fig > .t-callouts { width: var(--fw, 100%); }
.callout { position: absolute; transform: translate(18px, -50%); background: var(--ink); color: var(--on-ink); font-family: var(--serif); font-weight: 700; font-size: 14.5px;
  padding: 5px 11px; border-radius: 4px; white-space: nowrap; animation: callout 2.6s ease forwards; box-shadow: var(--shadow); }
.callout.left { transform: translate(calc(-100% - 18px), -50%); }
@keyframes callout { 0% { opacity: 0; scale: .8; } 8% { opacity: 1; scale: 1.06; } 14% { scale: 1; } 80% { opacity: 1; } 100% { opacity: .0; } }

/* notes */
.nl { transition: opacity .2s; }
.nl.pre { opacity: 0; }
.dano { display: inline-block; min-width: 46%; padding: 0 22px 8px 0; margin-bottom: 14px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }
.nh { font-weight: 700; font-size: 15.5px; margin: 0 0 4px; }
.nh.sol { margin-top: 2px; }
.nv { font-size: 16px; padding: 1px 0; }
.nv.assumed small { font-family: var(--ui); font-size: 11.5px; color: var(--dim); font-style: normal; }
.nf { margin-top: 6px; }
.step { margin: 6px 0 10px; }
.nt { color: var(--ink-2); font-size: 15.5px; }
.nt .im .katex { font-size: 1.04em; }
.nm .katex-display { margin: .25em 0 .1em; text-align: left; }
.nm .katex-display > .katex { text-align: left; }
.nm { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.katex { font-size: 1.12em; }
.step.answer { margin-top: 14px; }
.step.answer .nm { display: inline-block; padding: 2px 12px; box-shadow: inset 0 0 0 0 var(--ink); transition: box-shadow .5s ease; border-radius: 2px; }
.step.answer.boxed .nm { box-shadow: inset 0 0 0 1.5px var(--ink); }

/* sim controls */
.t-ctl { margin-top: 16px; display: grid; gap: 6px; max-width: 420px; opacity: 0; transform: translateY(6px); transition: opacity .45s ease, transform .45s ease; pointer-events: none; }
.task.done .t-ctl { opacity: 1; transform: none; pointer-events: auto; }
.c-row { display: flex; gap: 6px; margin-bottom: 4px; }
.c-btn { height: 32px; min-width: 32px; border-radius: 99px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); padding: 0 8px; }
.c-btn:hover { background: var(--hover); }
.c-btn .ms { font-size: 19px; }
.c-speed { font-weight: 700; font-size: 12.5px; min-width: 44px; }
.c-sl { display: grid; grid-template-columns: 64px 1fr 82px; align-items: center; gap: 10px; font-size: 13px; }
.c-tx { font-family: var(--serif); }
.c-val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; font-size: 12.5px; }
.c-reset { justify-self: start; font-size: 12px; font-weight: 600; color: var(--dim); padding: 4px 0; }
.c-reset:hover { color: var(--ink); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 1.5px; background: var(--ink); }
input[type=range]::-moz-range-track { height: 1.5px; background: var(--ink); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); margin-top: -6.5px; }
input[type=range]::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); }

/* pending / error */
.t-pen { width: 360px; height: 240px; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--dim); font-size: 13px; font-weight: 600; }
.t-pen svg { width: 140px; overflow: visible; }
.t-pen path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 200; animation: pen 1.8s cubic-bezier(.5, 0, .3, 1) infinite; }
@keyframes pen { 0% { stroke-dashoffset: 200; } 55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -200; } }
.task.pending .t-notes, .task.pending .t-ctl { display: none; }
.task.pending .t-title::before { content: attr(data-wait); color: var(--dim); }
.t-err { width: 360px; padding: 24px 0; }
.t-err p { margin: 0 0 12px; font-family: var(--serif); font-size: 16px; }
.task.failed .t-notes { display: none; }

/* notes on board */
.note { position: absolute; font-family: var(--hand); font-size: 26px; line-height: 1.15; color: var(--ink); min-width: 30px; min-height: 30px;
  padding: 4px 8px; white-space: pre-wrap; outline: none; border-radius: 4px; cursor: move; max-width: 520px; }
.note.editing { cursor: text; box-shadow: 0 0 0 1px var(--line-2); user-select: text; -webkit-user-select: text; }
.note.sel { box-shadow: 0 0 0 1.5px var(--ink-2); }
.note:empty::before { content: attr(data-ph); color: var(--dim); }

/* ---------- chrome ---------- */
.float { position: fixed; z-index: 20; display: flex; align-items: center; gap: 8px; }
.pill, .top-left, .zoom { background: var(--chrome); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.top-left { top: calc(12px + env(safe-area-inset-top)); left: 12px; padding: 5px 8px 5px 5px; gap: 6px; max-width: calc(100vw - 210px); }
.brand { width: 34px; height: 34px; border-radius: 99px; display: grid; place-items: center; background: var(--ink); flex: none; }
.brand svg { width: 22px; height: 22px; }
.brand path { fill: none; stroke: var(--on-ink); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.brand path.blk { fill: var(--on-ink); stroke: none; }
.divider { width: 1px; height: 18px; background: var(--line-2); }
#title { width: 170px; min-width: 60px; border: 0; outline: 0; background: transparent; font: 700 14.5px var(--ui); color: var(--ink); padding: 6px; border-radius: 8px; text-overflow: ellipsis; }
#title:hover, #title:focus { background: var(--hover); }
.status { font-size: 12px; color: var(--dim); white-space: nowrap; padding-right: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 99px; display: grid; place-items: center; color: var(--ink); flex: none; }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn:hover { background: var(--hover); }
.pill-btn { background: var(--chrome); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.pill-btn.on { background: var(--ink); color: var(--on-ink); }
.top-right { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.layers { display: flex; padding: 3px; gap: 2px; }
.layers button { height: 34px; min-width: 38px; padding: 0 8px; border-radius: 99px; font-family: var(--serif); font-size: 15px; color: var(--dim); position: relative; }
.layers button.on { color: var(--ink); }
.layers button:not(.on)::after { content: ''; position: absolute; left: 9px; right: 9px; top: 50%; height: 1.5px; background: var(--dim); transform: rotate(-24deg); }
.layers button:hover { background: var(--hover); }
.avatar { width: 26px; height: 26px; border-radius: 99px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; font-weight: 800; font-size: 12px; }

.bottom { position: fixed; z-index: 20; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 10px; align-items: flex-end; width: min(820px, calc(100vw - 24px)); }
.tools { display: flex; padding: 4px; gap: 2px; flex: none; }
.tools button { width: 40px; height: 40px; border-radius: 99px; display: grid; place-items: center; color: var(--ink-2); }
.tools button:hover { background: var(--hover); color: var(--ink); }
.tools button.on { background: var(--ink); color: var(--on-ink); }
.ask { flex: 1; display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 18px; background: var(--chrome); border: 1px solid var(--line-2); border-radius: 26px;
  box-shadow: var(--shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); transition: border-color .2s, box-shadow .2s; }
.ask:focus-within { border-color: var(--ink); }
.ask textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; font: 500 16px/1.4 var(--ui); color: var(--ink); padding: 9px 0; max-height: 160px; min-height: 40px; }
.ask textarea::placeholder { color: var(--dim); }
.send { width: 40px; height: 40px; border-radius: 99px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; flex: none; transition: transform .15s, opacity .2s; }
.send:active { transform: scale(.94); }
.send:disabled { opacity: .3; cursor: default; }
.zoom { right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); padding: 4px; gap: 0; }
.z-val { font-size: 12px; font-weight: 700; min-width: 48px; height: 32px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.z-val:hover { background: var(--hover); }

.popover { position: fixed; z-index: 40; min-width: 240px; max-width: calc(100vw - 24px); max-height: 60vh; overflow: auto; padding: 6px; border-radius: 16px; background: var(--chrome);
  border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top left; pointer-events: none; transition: opacity .16s ease-out, transform .16s ease-out; }
#acct-pop { transform-origin: top right; }
.popover.open { opacity: 1; transform: none; pointer-events: auto; }
.popover button, .popover a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; text-align: left; color: var(--ink); text-decoration: none; }
.popover button:hover, .popover a:hover { background: var(--hover); }
.popover button.cur { background: var(--hover); }
.popover .meta { margin-left: auto; color: var(--dim); font-size: 12px; font-weight: 600; }
.popover .sep { height: 1px; background: var(--line); margin: 5px 6px; }
.popover .ms { font-size: 19px; color: var(--ink-2); }
.pop-note { font-size: 12.5px; color: var(--dim); padding: 6px 12px 8px; line-height: 1.4; }

/* empty state */
.empty { position: fixed; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; text-align: center; padding: 0 20px 140px; pointer-events: none; transition: opacity .4s ease; }
.empty.gone { opacity: 0; visibility: hidden; transition: opacity .4s ease, visibility 0s .4s; }
.e-mark { width: 120px; margin-bottom: 22px; overflow: visible; }
.e-mark path, .e-mark rect { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 300; stroke-dashoffset: 300; animation: draw 1.6s .2s cubic-bezier(.45, .05, .35, 1) forwards; }
.e-mark rect { fill: var(--paper); animation-delay: 1s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.empty h1 { font-family: var(--serif); font-size: clamp(30px, 5vw, 46px); line-height: 1.1; letter-spacing: -.02em; margin: 0 0 12px; max-width: 16ch; text-wrap: balance; }
.empty p { margin: 0 0 26px; color: var(--ink-2); font-size: 16px; max-width: 46ch; line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 760px; pointer-events: auto; }
.chips button { padding: 9px 15px; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 13.5px; font-weight: 600; color: var(--ink-2); background: var(--chrome); max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips button:hover { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }

/* drawer */
.drawer { position: fixed; z-index: 30; top: 12px; right: 12px; bottom: 12px; width: min(380px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 12px; padding: 16px;
  background: var(--chrome); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  transform: translateX(calc(100% + 24px)); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.drawer.open { transform: none; }
.d-head { display: flex; align-items: center; justify-content: space-between; }
.d-head h2 { margin: 0; font-family: var(--serif); font-size: 22px; }
.field { width: 100%; height: 44px; border: 1px solid var(--line-2); border-radius: 12px; background: transparent; padding: 0 14px; font: 500 16px var(--ui); color: var(--ink); outline: 0; }
.field:focus { border-color: var(--ink); }
.lib-list { overflow: auto; flex: 1; margin: 0 -6px; }
.lib-item { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; }
.lib-item:hover { background: var(--hover); }
.lib-item b { display: block; font-family: var(--serif); font-size: 16px; }
.lib-item span { display: block; font-size: 12.5px; color: var(--dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-empty { color: var(--dim); font-size: 14px; padding: 12px; line-height: 1.5; }

.modal { border: 0; padding: 0; border-radius: 22px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); width: min(400px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(10, 10, 12, .35); backdrop-filter: blur(3px); }
.modal form { padding: 28px; display: grid; gap: 12px; position: relative; }
.modal h2 { margin: 0; font-family: var(--serif); font-size: 26px; }
.muted { color: var(--ink-2); margin: 0 0 6px; font-size: 14px; line-height: 1.45; }
.err { color: #b3261e; font-size: 13.5px; margin: 0; min-height: 1em; }
:root[data-theme="dark"] .err { color: #f2b8b5; }
.modal .x { position: absolute; top: 14px; right: 14px; }
.btn { height: 44px; border-radius: 99px; padding: 0 20px; font-weight: 700; font-size: 14.5px; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.primary { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.btn:disabled { opacity: .5; }
.link { font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; justify-self: center; padding: 6px; }

.toast { position: fixed; z-index: 50; left: 50%; top: calc(68px + env(safe-area-inset-top)); transform: translate(-50%, -8px); background: var(--ink); color: var(--on-ink);
  padding: 10px 18px; border-radius: 99px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .zoom { display: none; }
  .bottom { flex-direction: column-reverse; align-items: stretch; }
  .tools { align-self: flex-start; }
  .status { display: none; }
  #title { width: 110px; }
  .layers button { min-width: 32px; padding: 0 5px; font-size: 14px; }
  .top-left { max-width: calc(100vw - 252px); }
}
@media (max-width: 520px) { .layers { position: fixed; right: 12px; bottom: calc(18px + env(safe-area-inset-bottom)); } .top-left { max-width: calc(100vw - 120px); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 760px) {
  .task { min-width: 0; padding: 22px 22px 26px; }
  .t-body { flex-direction: column; gap: 22px; }
  .t-notes { width: min(410px, 100%); }
  .t-cond { max-width: 460px; }
}

/* ================= notebook site mode ================= */
html[data-mode="page"] #stage, html[data-mode="page"] .float, html[data-mode="page"] .bottom, html[data-mode="page"] #empty { display: none !important; }
html[data-mode="board"] #page { display: none; }
.page { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 24px 24px; background-attachment: local; }
.nav { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(14px + env(safe-area-inset-top)) clamp(16px, 4vw, 48px) 14px; transition: background-color .25s, box-shadow .25s; }
.nav.stuck { background: var(--chrome); box-shadow: 0 1px 0 var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.wordmark { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.wordmark svg { width: 28px; height: 28px; }
.wordmark path { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.wordmark path.blk { fill: var(--ink); stroke: none; }
.wordmark span { font-family: var(--serif); font-weight: 700; font-size: 22px; letter-spacing: -.01em; }
.nav-links { display: flex; align-items: center; gap: clamp(12px, 3vw, 30px); }
.nav-links button { font-size: 14.5px; font-weight: 600; color: var(--ink-2); padding: 8px 0; position: relative; }
.nav-links button:hover { color: var(--ink); }
.nav-links button:not(.n-acct)::after { content: ''; position: absolute; left: 0; right: 0; bottom: 3px; height: 1.5px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform .25s ease-out; }
.nav-links button:not(.n-acct):hover::after { transform: scaleX(1); }
.n-acct { padding: 8px 16px !important; border-radius: 99px; box-shadow: inset 0 0 0 1.5px var(--ink); color: var(--ink) !important; min-height: 38px; display: flex; align-items: center; }
.n-acct:has(.avatar) { padding: 0 !important; box-shadow: none; }
.n-acct .avatar { width: 36px; height: 36px; font-size: 14px; }

.hero, .composer, .demo, .list, .foot { max-width: 1120px; margin: 0 auto; padding-left: clamp(16px, 4vw, 48px); padding-right: clamp(16px, 4vw, 48px); }
.hero { padding-top: clamp(48px, 13vh, 150px); padding-bottom: clamp(28px, 5vh, 56px); transition: padding .4s; }
.over { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); margin-bottom: 22px; }
.over .dot { opacity: .6; }
#ptitle { border: 0; outline: 0; background: transparent; font: inherit; letter-spacing: inherit; text-transform: none; color: var(--ink-2); width: 16ch; padding: 4px 6px; margin-left: -6px; border-radius: 6px; }
#ptitle:hover, #ptitle:focus { background: var(--hover); color: var(--ink); }
#pboards { width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; color: var(--dim); margin-left: -6px; }
#pboards:hover { background: var(--hover); color: var(--ink); }
.hero h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(46px, 8.4vw, 112px); line-height: .96; letter-spacing: -.035em; margin: 0 0 26px; max-width: 11ch; text-wrap: balance;
  animation: write 1.5s .15s cubic-bezier(.3, .1, .3, 1) both; transition: font-size .4s; }
@keyframes write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.lede { font-size: clamp(17px, 1.6vw, 20px); line-height: 1.55; color: var(--ink-2); max-width: 52ch; margin: 0; animation: rise .8s .9s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
html.has-tasks .hero { padding-top: clamp(32px, 7vh, 80px); }
html.has-tasks .hero h1 { font-size: clamp(38px, 5vw, 64px); }
html.has-tasks .lede { display: none; }

.composer { padding-bottom: clamp(48px, 9vh, 110px); animation: rise .8s 1.1s ease-out both; }
.c-label { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--ink-2); margin-bottom: 6px; }
#pask { display: flex; align-items: flex-end; gap: 18px; padding-bottom: 12px; position: relative; }
#pask::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: var(--ink); transform-origin: left; animation: rule 1s 1.2s cubic-bezier(.45, .05, .35, 1) both; }
#pask:focus-within::after { height: 2.5px; }
@keyframes rule { from { transform: scaleX(0); } }
#pq { flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: 400 clamp(20px, 2.2vw, 27px)/1.4 var(--serif); padding: 6px 0; min-height: 48px; max-height: 40vh; }
#pq::placeholder { color: var(--dim); font-style: italic; }
.solve { height: 48px; padding: 0 20px 0 24px; border-radius: 99px; background: var(--ink); color: var(--on-ink); display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; flex: none; transition: transform .15s, opacity .2s; }
.solve:hover:not(:disabled) .ms { transform: translateX(3px); }
.solve .ms { transition: transform .2s; font-size: 20px; }
.solve:active { transform: scale(.97); }
.solve:disabled { opacity: .25; cursor: default; }
.try { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-top: 18px; font-size: 14px; }
.try > span:first-child { color: var(--dim); font-weight: 600; }
#pchips { display: contents; }
#pchips button { color: var(--ink-2); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
#pchips button:hover { color: var(--ink); text-decoration-color: var(--ink); }

.demo { padding-bottom: 10vh; }
html.has-tasks .demo { display: none; }
.demo-cap { display: flex; align-items: center; gap: 12px; font-size: 12.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.demo-cap::before { content: ''; width: 28px; height: 1.5px; background: var(--dim); }

html[data-mode="page"] .task { position: relative; left: auto; top: auto; min-width: 0; padding: clamp(44px, 7vh, 72px) 0 clamp(52px, 9vh, 90px); background: none; box-shadow: none; border-radius: 0;
  border-top: 1px solid var(--line-2); scroll-margin-top: 70px; }
html[data-mode="page"] .demo .task { border-top: 0; padding-top: 18px; }
html[data-mode="page"] .task::before, html[data-mode="page"] .task::after { display: none; }
html[data-mode="page"] .t-head { cursor: default; margin: 0 0 14px; padding: 0; align-items: baseline; flex-wrap: wrap; row-gap: 4px; }
html[data-mode="page"] .t-num { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 17px; letter-spacing: 0; color: var(--dim); }
html[data-mode="page"] .t-title { font-size: clamp(26px, 3vw, 36px); letter-spacing: -.02em; }
html[data-mode="page"] .t-topic { font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
html[data-mode="page"] .t-cond { font-size: 17px; max-width: 70ch; margin-bottom: 34px; }
html[data-mode="page"] .t-body { gap: clamp(32px, 5vw, 72px); }
html[data-mode="page"] .t-notes { width: 450px; font-size: 16.5px; }
.list { min-height: 10vh; }
.foot { display: flex; justify-content: space-between; gap: 16px; padding-top: 32px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); margin-top: 6vh;
  font-family: var(--serif); color: var(--dim); font-size: 15px; }
.foot span:first-child { font-weight: 700; color: var(--ink); }

/* per-task layer toggles */
.c-layers { display: flex; gap: 2px; margin-left: auto; }
.c-lay { height: 32px; min-width: 32px; padding: 0 6px; border-radius: 99px; color: var(--dim); position: relative; font-size: 13px; }
.c-lay.on { color: var(--ink); }
.c-lay:hover { background: var(--hover); }
.c-lay:not(.on)::after { content: ''; position: absolute; left: 7px; right: 7px; top: 50%; height: 1.5px; background: var(--dim); transform: rotate(-24deg); }
.task.hide-force .L-force, .task.hide-motion .L-motion, .task.hide-axis .L-axis, .task.hide-guide .L-guide { display: none; }

@media (max-width: 760px) {
  html[data-mode="page"] .t-notes { width: 100%; }
  html[data-mode="page"] .t-fig { max-width: 100%; }
  html[data-mode="page"] .fig { max-width: 100%; height: auto; }
  .t-callouts { width: 100% !important; max-width: 100%; }
  #pask { flex-direction: column; align-items: stretch; gap: 10px; }
  .solve { align-self: flex-end; }
  .nav-links #n-view { display: none; }
  .foot { flex-direction: column; }
}
.hero { position: relative; }
.hero-fig { position: absolute; right: clamp(16px, 4vw, 48px); top: clamp(110px, 20vh, 220px); width: min(40%, 470px); overflow: visible; }
.hero-fig path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: hf-draw .9s var(--d, 0s) cubic-bezier(.45, .05, .35, 1) forwards; }
.hero-fig path.thin { stroke-width: 1.3; }
.hero-fig path.tone { fill: var(--tone); fill-opacity: 0; animation: hf-draw 1s var(--d) cubic-bezier(.45, .05, .35, 1) forwards, hf-fill .6s calc(var(--d) + .8s) forwards; }
.hero-fig path.paper { fill: var(--paper); }
.hero-fig .hf-vec path { stroke-width: 2.2; }
.hero-fig path.hd { fill: var(--ink); stroke: none; opacity: 0; animation: hf-fade .3s var(--d) forwards; }
.hero-fig text { font-family: var(--serif); font-style: italic; font-size: 17px; fill: var(--ink); opacity: 0; animation: hf-fade .4s var(--d) forwards; }
@keyframes hf-draw { to { stroke-dashoffset: 0; } }
@keyframes hf-fill { to { fill-opacity: 1; } }
@keyframes hf-fade { to { opacity: 1; } }
.hero-fig .hf-ink path:nth-child(6), .hero-fig .hf-ink path:nth-child(9) { animation: hf-draw .9s var(--d) cubic-bezier(.45, .05, .35, 1) forwards, hf-bob 4s calc(var(--d) + 2s) ease-in-out infinite; }
@keyframes hf-bob { 50% { transform: translateY(0); } }
html.has-tasks .hero-fig { display: none; }
@media (max-width: 1100px) { .hero-fig { display: none; } }
.or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 12.5px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: transparent; color: var(--ink); }
.gbtn:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.gbtn svg { width: 18px; height: 18px; }
.gbtn[hidden] { display: none; }
