/* Solvecam. Hand-written, no framework. Mobile first. */
:root {
  --paper: #f5f0e6;
  --paper-2: #ece5d6;
  --card: #fffdf9;
  --ink: #1c2130;
  --ink-2: #4a5062;
  --ink-3: #7b8192;
  --line: #d8cfbd;
  --line-2: #e9e2d3;
  --accent: #e4572e;
  --accent-deep: #c0401b;
  --accent-soft: #fbe3d9;
  --green: #1f7a4d;
  --green-soft: #dcefe3;
  --blue: #2c5fd1;
  --blue-soft: #e0e8fb;
  --board: #1f3a34;
  --board-2: #24453e;
  --chalk: #f3efe4;
  --radius: 18px;
  --radius-s: 12px;
  --shadow: 0 1px 2px rgba(28,33,48,.06), 0 10px 30px -12px rgba(28,33,48,.18);
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --max: 1080px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.12; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 7vw, 3.4rem); font-variation-settings: "opsz" 144, "SOFT" 60; }
h2 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.wrap { width: min(100% - 32px, var(--max)); margin-inline: auto; }
.narrow { max-width: 720px; }
.muted { color: var(--ink-2); }
.small { font-size: .9rem; }
.eyebrow { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-deep); font-weight: 700; margin-bottom: .6rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.site-head { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 86%, white); backdrop-filter: saturate(1.3) blur(10px); border-bottom: 1px solid var(--line-2); }
.site-head .wrap { display: flex; align-items: center; gap: 14px; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav a { color: var(--ink-2); padding: 8px 10px; border-radius: 999px; font-size: .95rem; }
.nav a:hover { background: var(--paper-2); text-decoration: none; }
.nav .hide-m { display: none; }
.quota { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 11px; font-size: .82rem; color: var(--ink-2); white-space: nowrap; }
.quota b { color: var(--ink); font-weight: 700; }
.quota.plus { border-color: var(--green); color: var(--green); }
@media (min-width: 720px) { .nav .hide-m { display: inline-block; } }

/* hero + tool */
.hero { padding: 26px 0 8px; }
.hero h1 { margin-bottom: .35em; }
.hero .lede { font-size: 1.08rem; color: var(--ink-2); max-width: 640px; margin-bottom: 18px; }
.tool { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.tool-grid { display: grid; gap: 14px; }
.cam-row { display: grid; gap: 10px; grid-template-columns: 1fr; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 999px; border: 1px solid transparent; padding: 12px 20px; font-weight: 650; line-height: 1; transition: transform .08s ease, background .15s ease, box-shadow .15s; text-decoration: none !important; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--accent); color: white; box-shadow: 0 6px 18px -8px rgba(228,87,46,.7); }
.btn-primary:hover { background: var(--accent-deep); }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-ink { background: var(--ink); color: var(--chalk); }
.btn-ink:hover { background: #2a3144; }
.btn-cam { min-height: 72px; font-size: 1.15rem; border-radius: 22px; width: 100%; }
.btn-cam svg { width: 30px; height: 30px; }
.btn-upload { min-height: 56px; width: 100%; border-radius: 22px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.typebox { border: 1.5px solid var(--line); border-radius: 16px; background: white; transition: border-color .15s, box-shadow .15s; }
.typebox:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(28,33,48,.08); }
.typebox textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; padding: 14px 16px 6px; font: inherit; font-size: 1.05rem; min-height: 86px; color: var(--ink); }
.keys { display: flex; gap: 6px; padding: 6px 10px 10px; overflow-x: auto; scrollbar-width: none; }
.keys::-webkit-scrollbar { display: none; }
.keys button { flex: 0 0 auto; min-width: 40px; height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); font-family: var(--font-mono); font-size: .95rem; }
.keys button:hover { background: var(--paper-2); }
.solve-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.solve-row .btn-primary { min-height: 56px; flex: 1 1 200px; font-size: 1.05rem; }
.solve-row .hint { color: var(--ink-3); font-size: .85rem; flex: 1 1 100%; }
.preview { display: none; align-items: center; gap: 12px; background: var(--paper); border: 1px dashed var(--line); border-radius: 14px; padding: 10px; }
.preview.on { display: flex; }
.preview img { width: 92px; height: 68px; object-fit: cover; border-radius: 8px; background: white; }
.preview .x { margin-left: auto; border: 0; background: transparent; color: var(--ink-2); font-size: 1.3rem; padding: 6px 10px; }
.samples { margin-top: 6px; }
.samples h3 { font-family: var(--font-body); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; font-weight: 700; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: .92rem; color: var(--ink); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip:hover { border-color: var(--ink); }
.chip.photo { padding: 4px 12px 4px 4px; display: inline-flex; align-items: center; gap: 8px; }
.chip.photo img { width: 54px; height: 38px; object-fit: cover; border-radius: 999px 8px 8px 999px; }
@media (min-width: 720px) {
  .tool { padding: 22px; }
  .cam-row { grid-template-columns: 1.4fr 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
}

/* board (solution) */
.board { display: none; margin-top: 18px; background: var(--board); color: var(--chalk); border-radius: var(--radius); padding: 18px 16px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.board.on { display: block; animation: rise .35s ease both; }
.board::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 31px, rgba(255,255,255,.045) 31px 32px); pointer-events: none; }
.board > * { position: relative; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.board-head .tag { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; background: rgba(255,255,255,.1); border-radius: 999px; padding: 5px 10px; }
.board-head .acts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.board-head .acts button { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: var(--chalk); border-radius: 999px; padding: 7px 12px; font-size: .85rem; }
.board-head .acts button:hover { background: rgba(255,255,255,.18); }
.board-problem { font-family: var(--font-display); font-size: 1.15rem; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px dashed rgba(255,255,255,.25); }
.board-problem .katex { font-size: 1.25em; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.step { opacity: 0; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 10px 0; }
.step.in { opacity: 1; transform: none; }
.step .n { width: 30px; height: 30px; border-radius: 999px; background: var(--chalk); color: var(--board); font-weight: 800; display: grid; place-items: center; font-size: .9rem; margin-top: 2px; }
.step .t { font-weight: 650; font-size: 1rem; margin: 0 0 4px; color: rgba(243,239,228,.92); }
.step .m { font-size: 1.1rem; overflow-x: auto; padding: 4px 0; }
.step .m .katex { font-size: 1.2em; color: #fff; }
.step .m.plain { font-family: var(--font-mono); white-space: pre-wrap; }
.step .why { background: transparent; border: 0; color: #ffd9a8; font-size: .85rem; padding: 2px 0; text-decoration: underline dotted; text-underline-offset: 3px; }
.step .w { display: none; margin: 6px 0 0; color: rgba(243,239,228,.8); font-size: .93rem; border-left: 2px solid rgba(255,217,168,.6); padding-left: 10px; }
.step.open .w { display: block; }
.answer { opacity: 0; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; margin-top: 12px; border: 2px solid #ffd9a8; outline: 2px solid rgba(255,217,168,.35); outline-offset: 3px; border-radius: 12px; padding: 12px 14px; background: rgba(0,0,0,.18); }
.answer.in { opacity: 1; transform: none; }
.answer .lbl { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: #ffd9a8; margin-bottom: 4px; font-weight: 700; }
.answer .m { font-size: 1.35rem; overflow-x: auto; }
.answer .m .katex { font-size: 1.15em; color: #fff; }
.check { opacity: 0; transition: opacity .4s ease .2s; margin: 12px 0 0; font-size: .93rem; color: rgba(243,239,228,.85); display: flex; gap: 8px; }
.check.in { opacity: 1; }
.check svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 3px; }
.board-foot { margin-top: 12px; font-size: .78rem; color: rgba(243,239,228,.6); }
.notice { display: none; margin-top: 14px; border-radius: 14px; padding: 14px 16px; background: var(--blue-soft); color: var(--ink); border: 1px solid #c7d4f6; }
.notice.on { display: block; animation: rise .3s ease both; }
.notice.warn { background: var(--accent-soft); border-color: #f2c2b0; }
.notice p { margin: 0 0 6px; }
.notice .chips { margin-top: 8px; }
.paywall { display: none; margin-top: 14px; border-radius: var(--radius); padding: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.paywall.on { display: block; animation: rise .3s ease both; }
.paywall h3 { margin-bottom: .3em; }
.paywall .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .step, .answer, .check, .board, .notice { transition: none; animation: none; } }

/* sections */
section.block { padding: 44px 0 10px; }
.grid3 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid3 { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 20px; }
.card h3 { margin-top: .2em; }
.card .num { font-family: var(--font-display); font-size: 2rem; color: var(--accent); line-height: 1; margin-bottom: 6px; }
.topics { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .topics { grid-template-columns: repeat(3, 1fr); } }
.topic { display: block; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 16px; color: var(--ink); transition: border-color .15s, transform .15s; }
.topic:hover { border-color: var(--ink); text-decoration: none; transform: translateY(-1px); }
.topic b { display: block; font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 4px; }
.topic span { color: var(--ink-2); font-size: .9rem; }
.topic .ex { display: block; margin-top: 10px; font-family: var(--font-mono); font-size: .85rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diff { display: grid; gap: 12px; }
.diff .item { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; }
.diff .item svg { width: 44px; height: 44px; }
.diff .item b { display: block; font-size: 1.05rem; }
.diff .item p { margin: 2px 0 0; color: var(--ink-2); }
@media (min-width: 720px) { .diff { grid-template-columns: repeat(3, 1fr); } }

/* pricing */
.plans { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .plans { grid-template-columns: 1fr 1fr; max-width: 760px; } }
.plan { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; position: relative; }
.plan.hot { border-color: var(--accent); box-shadow: var(--shadow); }
.plan .pill { position: absolute; top: -12px; left: 20px; background: var(--accent); color: #fff; border-radius: 999px; padding: 4px 10px; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.plan .price { font-family: var(--font-display); font-size: 2.6rem; line-height: 1; margin: 6px 0 2px; }
.plan .price small { font-family: var(--font-body); font-size: 1rem; color: var(--ink-2); }
.plan ul { list-style: none; padding: 0; margin: 14px 0 18px; display: grid; gap: 8px; }
.plan li { display: flex; gap: 8px; align-items: flex-start; }
.plan li svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 4px; color: var(--green); }
.plan li.no svg { color: var(--ink-3); }
.plan li.no { color: var(--ink-3); }
.plan .btn { width: 100%; }

/* faq */
.faq details { border-bottom: 1px solid var(--line-2); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 650; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq p { margin: 10px 0 0; color: var(--ink-2); }

/* prose */
.prose { max-width: 720px; }
.prose h2 { margin-top: 1.6em; }
.prose ol, .prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose .katex-display { overflow-x: auto; }
.worked { display: grid; gap: 10px; }
.worked a { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 12px 14px; color: var(--ink); }
.worked a:hover { border-color: var(--ink); text-decoration: none; }
.worked a .k { font-family: var(--font-mono); font-size: .8rem; color: var(--ink-3); flex: 0 0 auto; }
.worked a .p { flex: 1; }
.worked a .go { color: var(--accent); font-weight: 700; }
.callout { background: var(--accent-soft); border-radius: var(--radius-s); padding: 14px 16px; margin: 16px 0; }

/* footer */
.site-foot { margin-top: 56px; border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--ink-2); font-size: .92rem; }
.site-foot .cols { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
@media (min-width: 720px) { .site-foot .cols { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.site-foot h4 { margin: 0 0 8px; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-foot a { color: var(--ink-2); }
.site-foot .legal { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-2); font-size: .82rem; color: var(--ink-3); }

/* demo checkout */
.checkout { max-width: 520px; margin: 30px auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.checkout .demo { background: #fff3cd; border: 1px solid #f1d78a; color: #6b5300; border-radius: 10px; padding: 10px 12px; font-size: .9rem; margin-bottom: 16px; }
.checkout .line { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.checkout .line.total { font-weight: 700; border-bottom: 0; font-size: 1.1rem; }
.checkout .field { display: grid; gap: 6px; margin: 12px 0; }
.checkout .field span { font-size: .85rem; color: var(--ink-2); }
.checkout .field div { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; color: var(--ink-3); background: var(--paper); font-family: var(--font-mono); font-size: .9rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--chalk); padding: 10px 16px; border-radius: 999px; font-size: .9rem; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; }
.toast.on { opacity: 1; transform: translateX(-50%); }
.katex { font-size: 1.05em; }

/* fixes after first QA pass */
.tool-grid > *, .cam-row > *, .samples, .chips { min-width: 0; }
.tool, .board, .notice, .paywall { max-width: 100%; }
.btn svg { width: 22px; height: 22px; flex: 0 0 auto; }
.btn-cam svg { width: 30px; height: 30px; }
.chip.photo svg { width: 16px; height: 16px; }
@media (max-width: 719px) { .worked a .k { display: none; } }
.board { scroll-margin-top: 72px; }
.step .m, .answer .m { -webkit-overflow-scrolling: touch; }

/* v0.2: recognised text, account page, legal tables */
.read { display: none; margin-top: 12px; background: var(--green-soft); border: 1px solid #bfdcc9; border-radius: 12px; padding: 10px 14px; font-size: .95rem; }
.read.on { display: block; animation: rise .3s ease both; }
.read b { color: var(--green); }
.quota { text-decoration: none !important; }
.account h1 { margin-bottom: .4em; }
.magic { display: grid; gap: 10px; }
.magic input { font: inherit; font-size: 1.05rem; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); width: 100%; }
.magic input:focus { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(28,33,48,.08); }
@media (min-width: 560px) { .magic { grid-template-columns: 1fr auto; } }
.mail { font-family: var(--font-mono); font-size: .92em; background: var(--paper-2); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.prose table { border-collapse: collapse; width: 100%; margin: 10px 0 18px; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.prose th { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.prose code { font-family: var(--font-mono); font-size: .9em; background: var(--paper-2); padding: 1px 5px; border-radius: 5px; }
#board-export { max-width: none; }

.board-problem .muted { color: rgba(243,239,228,.62); }
.step .m, .answer .m { overflow-y: hidden; scrollbar-width: thin; }
.step .m::-webkit-scrollbar, .answer .m::-webkit-scrollbar { height: 4px; }

/* practice mode */
.practice-toggle { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: var(--chalk); border-radius: 999px; padding: 6px 12px; font-size: .85rem; cursor: pointer; }
.practice-toggle input { accent-color: #ffd9a8; margin: 0; width: 15px; height: 15px; }
.practice-toggle:has(input:checked) { background: rgba(255,217,168,.22); border-color: #ffd9a8; }
.step.pending { display: none; }
.try { list-style: none; margin: 6px 0 12px; padding: 14px; border: 1.5px dashed rgba(255,217,168,.6); border-radius: 14px; background: rgba(0,0,0,.16); }
.try-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.try-head b { color: #ffd9a8; font-size: .95rem; }
.try-head .hint { background: transparent; border: 1px solid rgba(255,255,255,.25); color: var(--chalk); border-radius: 999px; padding: 4px 10px; font-size: .8rem; }
.try-hint { display: none; margin: 0 0 8px; color: rgba(243,239,228,.8); font-size: .9rem; }
.try.hinted .try-hint { display: block; }
.try-row input { width: 100%; font: inherit; font-size: 1.05rem; font-family: var(--font-mono); padding: 11px 12px; border-radius: 10px; border: 1.5px solid rgba(255,255,255,.3); background: rgba(255,255,255,.08); color: #fff; }
.try-row input:focus { outline: 0; border-color: #ffd9a8; box-shadow: 0 0 0 3px rgba(255,217,168,.25); }
.try-row input::placeholder { color: rgba(243,239,228,.45); }
.try-keys { padding: 8px 0 6px; }
.try-keys button { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: var(--chalk); }
.try-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.try-acts .btn { padding: 10px 16px; min-height: 42px; }
.try-acts .btn-ghost { background: transparent; color: var(--chalk); border-color: rgba(255,255,255,.3); }
.try-fb { margin: 8px 0 0; font-size: .92rem; color: rgba(243,239,228,.9); }
.try.done { border-style: solid; padding: 10px 14px; }
.try.done.right { border-color: #7fd3a1; } .try.done.right .try-fb { color: #a9eac3; }
.try.done.wrong { border-color: #f0a08a; } .try.done.wrong .try-fb { color: #ffc9b9; }
.try.done.close { border-color: #ffd9a8; }
.try.done .try-head .hint, .try.done .try-hint { display: none; }
.try.done:empty { display: none; }
#board-export, #board-export * { transition: none !important; animation: none !important; }
#board-export .step, #board-export .answer, #board-export .check { opacity: 1 !important; transform: none !important; }
#board-export .step.pending { display: grid !important; }
#board-export .step .m, #board-export .answer .m, #board-export .board-problem { overflow: visible !important; }
#board-export .answer .m { padding: 4px 0 8px; line-height: 1.5; }
#board-export .step .n { display: block; line-height: 30px; text-align: center; }
/* 360px pass */
.topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .topics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.topic { min-width: 0; }
.nav { min-width: 0; }
@media (max-width: 399px) { .quota { font-size: .78rem; padding: 5px 9px; } .site-head .wrap { gap: 8px; } .nav a:not(.quota) { padding: 8px 6px; } .brand { font-size: 1.15rem; } }

/* ---------- scenes (live figures) ---------- */
.scene { --sc-ink: #f3efe4; --sc-ink-2: rgba(243,239,228,.72); --sc-bg: rgba(255,255,255,.06); --sc-grid: rgba(255,255,255,.08); --sc-axis: rgba(243,239,228,.55); --sc-accent: #ffd9a8; --sc-accent-2: #ff9f6e; --sc-main: #8fd3ff; --sc-alt: #ffb46a; --sc-fill: rgba(255,217,168,.22); --sc-fill-focus: rgba(255,217,168,.42); --sc-wood: rgba(243,239,228,.35); --sc-tone-a: #8fd3ff; --sc-tone-b: #a9eac3; --sc-tone-c: #ffb46a; --sc-tone-d: #e9b8ff; --sc-tone-muted: rgba(243,239,228,.28); margin: 2px 0 14px; }
.scene-fig svg { width: 100%; height: auto; display: block; font-family: var(--font-body); }
.sc-bg { fill: var(--sc-bg); }
.sc-el { transition: opacity .3s; }
.sc-label { fill: var(--sc-ink); font-size: 13px; font-weight: 600; paint-order: stroke; stroke: var(--board); stroke-width: 4px; stroke-linejoin: round; }
.scene-graph .sc-label, .scene-graph .sc-pt-label, .scene-graph .sc-fn-label { paint-order: stroke; stroke: var(--board); stroke-width: 4px; stroke-linejoin: round; }
.sc-vertex { font-size: 14px; font-family: var(--font-display); font-style: italic; }
.sc-side { font-size: 13px; }
.sc-angle-label { font-size: 12.5px; fill: var(--sc-accent); }
.sc-shape { fill: rgba(255,255,255,.04); stroke: var(--sc-ink); stroke-width: 2; stroke-linejoin: round; }
.sc-line { stroke: var(--sc-ink); stroke-width: 2; fill: none; stroke-linecap: round; }
.sc-line.dashed, .sc-guide, .sc-drop { stroke-dasharray: 5 5; }
.sc-arc { fill: none; stroke: var(--sc-accent); stroke-width: 2; }
.sc-wedge { fill: var(--sc-accent); opacity: .18; }
.sc-area { fill: var(--sc-fill); stroke: var(--sc-accent); stroke-width: 1.5; }
.sc-area-label { fill: var(--sc-ink); font-size: 13px; }
.sc-dot { fill: var(--sc-ink); }
.focus .sc-shape, .focus .sc-line { stroke: var(--sc-accent); stroke-width: 3; filter: drop-shadow(0 0 6px rgba(255,217,168,.55)); }
.focus .sc-arc { stroke: var(--sc-accent-2); stroke-width: 3; filter: drop-shadow(0 0 6px rgba(255,159,110,.6)); }
.focus .sc-wedge { opacity: .38; }
.focus .sc-area { fill: var(--sc-fill-focus); stroke-width: 2.5; stroke: var(--sc-accent-2); }
.focus .sc-side, .focus .sc-area-label { fill: var(--sc-accent); }
/* graph */
.sc-gridline { stroke: var(--sc-grid); stroke-width: 1; }
.sc-axis { stroke: var(--sc-axis); stroke-width: 1.5; }
.sc-tick { fill: var(--sc-ink-2); font-size: 10.5px; }
.sc-curve { fill: none; stroke: var(--sc-main); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.c-alt .sc-curve { stroke: var(--sc-alt); } .c-accent .sc-curve { stroke: var(--sc-accent); }
.sc-fn-label { fill: var(--sc-main); font-size: 12.5px; font-weight: 600; } .c-alt .sc-fn-label { fill: var(--sc-alt); }
.sc-hole { fill: var(--board); stroke: var(--sc-main); stroke-width: 2.5; } .c-alt .sc-hole { stroke: var(--sc-alt); }
.sc-tan { stroke: var(--sc-accent); stroke-width: 2; fill: none; }
.sc-pt { fill: var(--sc-accent); stroke: var(--board); stroke-width: 2; }
.sc-pt-label { fill: var(--sc-accent); font-size: 12.5px; font-weight: 600; }
.sc-rect { fill: var(--sc-fill); stroke: var(--sc-accent); stroke-width: 1; }
.focus .sc-rect { fill: var(--sc-fill-focus); }
.sc-guide { stroke: var(--sc-ink-2); stroke-width: 1.5; } .sc-drop { stroke: var(--sc-accent); stroke-width: 1.5; }
.focus .sc-curve { stroke-width: 3.5; filter: drop-shadow(0 0 6px rgba(143,211,255,.5)); }
.focus .sc-tan { stroke-width: 3; filter: drop-shadow(0 0 6px rgba(255,217,168,.6)); }
.focus .sc-pt { r: 6.5; }
/* bars */
.sc-bar-name { fill: var(--sc-ink); font-size: 13px; font-weight: 600; }
.sc-part { fill: var(--sc-tone-a); opacity: .85; stroke: var(--board); stroke-width: 1.5; }
.tone-b .sc-part { fill: var(--sc-tone-b); } .tone-c .sc-part { fill: var(--sc-tone-c); } .tone-d .sc-part { fill: var(--sc-tone-d); } .tone-muted .sc-part { fill: var(--sc-tone-muted); } .tone-accent .sc-part { fill: var(--sc-accent); }
.sc-part-label { fill: var(--board); font-size: 13px; font-weight: 700; stroke: none; }
.tone-muted .sc-part-label { fill: var(--sc-ink); }
.focus .sc-part { opacity: 1; stroke: var(--sc-accent); stroke-width: 2.5; filter: drop-shadow(0 0 6px rgba(255,217,168,.55)); }
.sc-brace { fill: none; stroke: var(--sc-ink-2); stroke-width: 1.5; }
.sc-brace-text { fill: var(--sc-ink); font-size: 12.5px; stroke: none; }
.focus .sc-brace { stroke: var(--sc-accent); stroke-width: 2; } .focus .sc-brace-text { fill: var(--sc-accent); }
/* balance */
.sc-wood { fill: var(--sc-wood); } .sc-pivot { fill: var(--sc-accent); } .sc-string { stroke: var(--sc-ink-2); stroke-width: 1.2; fill: none; } .sc-pan { fill: rgba(255,255,255,.08); stroke: var(--sc-ink); stroke-width: 2; }
.sc-eq { fill: var(--sc-ink); font-size: 18px; font-family: var(--font-display); font-weight: 600; }
.sc-item-u circle { fill: var(--sc-tone-b); stroke: var(--board); stroke-width: 1.5; }
.sc-item-x rect, .sc-item-xblock rect { fill: var(--sc-accent); } .sc-item-x text, .sc-item-xblock text { fill: var(--board); font-size: 14px; font-weight: 700; font-style: italic; }
.sc-item-ublock rect { fill: var(--sc-tone-b); } .sc-item-ublock text { fill: var(--board); font-size: 12px; font-weight: 700; }
.sc-item.ghost { opacity: .22; animation: sc-lift .9s ease both; }
.sc-item.dim { opacity: .3; transition: opacity .6s; }
.sc-tray { fill: rgba(255,217,168,.08); stroke: var(--sc-accent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.sc-tray.ghost { fill: none; stroke: var(--sc-ink-2); opacity: .45; }
.sc-sep { stroke: var(--sc-accent); stroke-dasharray: 3 3; stroke-width: 1.5; }
.sc-op { fill: var(--sc-accent); font-size: 14px; font-weight: 700; }
/* enter animations */
.enter .sc-line, .enter .sc-arc, .enter .sc-curve, .enter .sc-tan, .enter .sc-drop, .enter .sc-guide, .enter .sc-brace, .enter .sc-shape, .enter .sc-area { stroke-dasharray: 1; stroke-dashoffset: 1; animation: sc-draw .7s ease forwards; }
.enter .sc-area, .enter .sc-wedge { animation: sc-draw .7s ease forwards, sc-fade .5s ease .25s both; }
.enter .sc-rect { animation: sc-growy .45s ease both; }
.enter .sc-part { animation: sc-growx .5s ease both; }
.enter .sc-label, .enter .sc-pt, .enter .sc-pt-label, .enter .sc-hole, .enter .sc-fn-label, .enter .sc-brace-text { animation: sc-fade .4s ease .35s both; }
.enter .sc-area.grow { stroke-dasharray: none; animation: sc-pop .5s ease both; transform-box: fill-box; transform-origin: center; }
@keyframes sc-draw { to { stroke-dashoffset: 0; } }
@keyframes sc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sc-growy { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes sc-growx { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes sc-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes sc-lift { from { transform: translateY(0); opacity: .9; } to { transform: translateY(-26px); opacity: .22; } }
@media (prefers-reduced-motion: reduce) { .enter *, .sc-item.ghost { animation: none !important; stroke-dashoffset: 0 !important; } }
.scene-note { margin: 8px 2px 0; min-height: 1.3em; font-size: .95rem; color: var(--sc-accent); }
.scene-play { margin-top: 10px; display: grid; gap: 8px; }
.scene-params { display: grid; gap: 6px; }
.scene-param { display: grid; grid-template-columns: 7.5em 1fr 3.4em; align-items: center; gap: 10px; font-size: .88rem; color: var(--sc-ink-2); }
.scene-param output { text-align: right; font-family: var(--font-mono); color: var(--sc-ink); font-weight: 600; }
.scene-param input[type=range] { width: 100%; accent-color: var(--sc-accent); height: 28px; margin: 0; cursor: pointer; touch-action: pan-y; }
.scene-answer { font-family: var(--font-mono); font-size: 1rem; color: var(--sc-ink); background: rgba(0,0,0,.18); border: 1px solid rgba(255,217,168,.5); border-radius: 10px; padding: 8px 12px; }
.scene-answer::before { content: "What if → "; color: var(--sc-accent); font-family: var(--font-body); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
/* board integration */
.board .scene { background: rgba(0,0,0,.14); border-radius: 14px; padding: 10px 10px 12px; margin: 0 0 14px; }
.board .step { cursor: pointer; border-radius: 10px; transition: background .25s, opacity .4s ease, transform .4s ease; padding-left: 6px; padding-right: 6px; margin-left: -6px; margin-right: -6px; }
.board.has-scene .step.active { background: rgba(255,217,168,.1); }
.board.has-scene .step.active .n { background: #ffd9a8; }
.diagram-toggle { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: var(--chalk); border-radius: 999px; padding: 6px 12px; font-size: .85rem; cursor: pointer; }
.diagram-toggle input { accent-color: #ffd9a8; margin: 0; width: 15px; height: 15px; }
.diagram-toggle:has(input:checked) { background: rgba(143,211,255,.18); border-color: #8fd3ff; }
/* lab page (light) */
.lab-grid { display: grid; gap: 22px; }
.lab-card { background: var(--board); color: var(--chalk); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.lab-card h3 { font-family: var(--font-display); font-size: 1.25rem; margin: 0 0 2px; color: #fff; }
.lab-card .kind { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: #ffd9a8; font-weight: 700; }
.lab-card .lab-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.lab-card .lab-steps li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: .92rem; color: rgba(243,239,228,.85); }
.lab-card .lab-steps li .n { width: 22px; height: 22px; border-radius: 999px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: .78rem; font-weight: 800; }
.lab-card .lab-steps li.active { background: rgba(255,217,168,.12); color: #fff; } .lab-card .lab-steps li.active .n { background: #ffd9a8; color: var(--board); }
.lab-card .lab-steps li .m { display: block; font-family: var(--font-mono); font-size: .85rem; color: #fff; margin-top: 2px; }
.lab-card .lab-acts { display: flex; gap: 8px; margin: 10px 0 0; flex-wrap: wrap; align-items: center; }
.lab-card .lab-acts button { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: var(--chalk); border-radius: 999px; padding: 7px 14px; font-size: .85rem; }
.lab-card .lab-acts button.on { background: rgba(255,217,168,.22); border-color: #ffd9a8; }
.lab-card .lab-src { margin-left: auto; font-size: .78rem; color: rgba(243,239,228,.6); }
.lab-card .scene { background: rgba(0,0,0,.14); border-radius: 14px; padding: 10px; }
@media (min-width: 900px) { .lab-card { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; } .lab-card .lab-head { grid-column: 1 / -1; } }
