/* /wizard: the owner's space. The look is the site's (base.css): cream, ink, indigo and gold, Pixelify titles,
   Atkinson reading, pixel edges. This file holds only what /wizard has of its own: cards and rows, reading pages,
   the spell, code and the widgets. Reading pages stay calm; the fun is one spell and the code. */
:root { --night: #1e1b3a; --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; --quote: #4a4140; --on-accent: #d8d6f4; --on-ink: #d8d6f4;
  --spell-0: #3b3a8c; --spell-1: #b0731a; --spell-2: #1f7a6e; --spell-3: #b03a5b; --spell-4: #4c7a2a; --spell-5: #7a3fa0; }
:root[data-theme="dark"] { --night: #0c0b16; --quote: #c9c1b4; --on-accent: #2a2862; --on-ink: #4a4566;
  --spell-0: #a5a3f2; --spell-1: #e8a94a; --spell-2: #5cc7b4; --spell-3: #f08aa6; --spell-4: #9fd27a; --spell-5: #c99af0; }

/* home */
.hero { display: flex; align-items: center; gap: 1.4rem; padding: max(5vh, 32px) 0 2.2rem; }
.wizard-big { width: 96px; height: 128px; image-rendering: pixelated; flex: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1 { font: 700 clamp(2rem, 7.5vw, 2.9rem)/1.08 var(--pixel); margin: 0 0 .6rem; letter-spacing: .01em; }
.hero h1 { font-size: clamp(2.6rem, 11vw, 3.6rem); }
.lede { color: var(--muted); margin: 0 0 1rem; }
.card { background: var(--card); border: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--line); padding: 1.1rem 1.2rem; }
.badge { font: 500 .78rem/1.3 Atkinson, system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .3rem !important; }
.shelf { margin: 0 0 2.4rem; scroll-margin-top: 1rem; }
.shelf-head { display: flex; align-items: center; gap: .6rem; margin: 0 0 .25rem; }
.shelf h2 { font: 600 1.45rem/1.2 var(--pixel); margin: 0 auto 0 0; letter-spacing: .02em; }
.shelf .all { font: 600 .9rem/1.4 Atkinson, system-ui, sans-serif; text-decoration: none; border-bottom: 2px solid var(--gold); white-space: nowrap; }
.shelf .count { font: 500 .85rem/1.4 Atkinson, system-ui, sans-serif; color: var(--muted); margin: 0; }
.note { color: var(--muted); margin: 0 0 .9rem; font-size: .98rem; }

/* a row of cards is a carousel: it scrolls sideways and snaps to each card. It reaches the screen's edges on a phone,
   and the next card peeks in, which says "there's more" without an arrow. Mouse users get arrows (wizard-page.js). */
.cards { list-style: none; display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  margin: 0 -16px; padding: 2px 16px 14px; scroll-padding: 0 16px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.cards:focus-visible { outline-offset: -3px; }
.cards > .card { flex: 0 0 min(84%, 18.5rem); scroll-snap-align: start; display: flex; flex-direction: column; }
.card h3 { font: 700 1.2rem/1.3 Atkinson, system-ui, sans-serif; margin: 0 0 .35rem; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; }
.card p { margin: 0 0 .4rem; }
/* rows read better at one height: a card's description stops at four lines (the whole text stays in the page) */
.card h3 + p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
.card .links { font: 500 .85rem/1.4 Atkinson, system-ui, sans-serif; margin: auto 0 0; padding-top: .5rem; }
/* a list page (Work, Writing): every card at once, in a grid; one column on a phone */
.cards.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.1rem; overflow: visible; margin: 0; padding: 0 5px 5px 0; scroll-snap-type: none; }
.cards.grid > .card { flex: none; }
.list-head { padding-bottom: .4rem; }
.list-head .lede { margin-bottom: 1.1rem; }
/* the jump links under a list page's title, one per section, with its count */
.jump { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.jump a { font: 600 .9rem/1 Atkinson, system-ui, sans-serif; color: var(--ink); text-decoration: none; padding: .5rem .7rem; border: 2px solid var(--ink); background: var(--card); box-shadow: 3px 3px 0 var(--line); }
.jump a:hover { background: var(--tint); }
.jump span { color: var(--muted); font-weight: 500; margin-left: .2rem; }
/* a series is a small stack of cards */
.card.stack { box-shadow: 5px 5px 0 -2px var(--card), 5px 5px 0 0 var(--ink), 10px 10px 0 var(--line); }
.nudge { font: 600 1rem/1 Atkinson, system-ui, sans-serif; color: var(--ink); background: var(--card); border: 2px solid var(--ink); width: 2.1rem; height: 2.1rem;
  cursor: pointer; box-shadow: 2px 2px 0 var(--line); }
.nudge:hover:not(:disabled) { background: var(--tint); }
.nudge:disabled { opacity: .35; cursor: default; }

/* a post in a series: the folded series box under the date, the next and previous parts at the end */
.in-series { border: 2px solid var(--ink); background: var(--tint); margin: -1rem 0 2rem; }
.in-series summary { font: 600 .9rem/1.4 Atkinson, system-ui, sans-serif; padding: .6rem .9rem; cursor: pointer; }
.in-series ol { margin: 0; padding: 0 .9rem 0 2.2rem; }
.in-series li { margin: 0 0 .35rem; font-size: .95rem; }
.in-series li[aria-current] { font-weight: 700; }
.in-series p { font: 500 .85rem/1.4 Atkinson, system-ui, sans-serif; margin: .5rem .9rem .8rem; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 2.6rem 0 0; }
.pager a { display: block; padding: .75rem .9rem; border: 2px solid var(--ink); background: var(--card); box-shadow: 4px 4px 0 var(--line); color: var(--ink); text-decoration: none; }
.pager a:hover strong { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; }
.pager .next { grid-column: 2; text-align: right; }
.pager small, .parts small { display: block; font: 500 .78rem/1.4 Atkinson, system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 .2rem; }
.pager strong { font: 700 1rem/1.3 Atkinson, system-ui, sans-serif; }
/* a series' page: its parts in order */
.prose .parts { list-style: none; padding: 0; margin: 1.6rem 0; display: grid; gap: .9rem; }
.parts a { display: block; padding: .85rem 1rem; border: 2px solid var(--ink); background: var(--card); box-shadow: 5px 5px 0 var(--line); color: var(--ink); text-decoration: none; }
.parts strong { display: block; font: 700 1.15rem/1.3 Atkinson, system-ui, sans-serif; margin: 0 0 .25rem; }
.parts a:hover strong { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; }
.parts span { color: var(--muted); font-size: .95rem; }

/* reading */
.prose { padding-top: 2.6rem; }
.prose > h1 { margin-bottom: .5rem; }
.prose > h1.title { font: 700 clamp(1.9rem, 6.5vw, 2.5rem)/1.15 Atkinson, system-ui, sans-serif; letter-spacing: 0; }
.meta { font: 500 .85rem/1.4 Atkinson, system-ui, sans-serif; color: var(--muted); margin: 0 0 2rem; }
.prose h2 { font: 700 1.5rem/1.25 Atkinson, system-ui, sans-serif; margin: 2.4rem 0 .7rem; }
.prose h3 { font: 700 1.2rem/1.3 Atkinson, system-ui, sans-serif; margin: 1.9rem 0 .5rem; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose figure, .prose video { margin: 0 0 1.1rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: 0 0 .45rem; }
.prose img, .prose video { display: block; max-width: 100%; height: auto; border: 2px solid var(--ink); background: var(--card); }
.prose p > img { margin: .4rem 0; }
/* a grid of photos with a short caption each (two across on a phone, three when there is room) */
.prose .photo-grid { list-style: none; padding: 0; margin: 0 0 1.4rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .9rem; }
.prose .photo-grid li { margin: 0; }
.prose .photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; margin: 0 0 .4rem; }
.prose .photo-grid p { margin: 0; font-size: .92rem; line-height: 1.4; }
.prose .photo-grid b { display: block; }
.prose blockquote { margin-left: 0; padding: .2rem 0 .2rem 1rem; border-left: 4px solid var(--gold); color: var(--quote); }
.prose hr { border: 0; border-top: 2px dashed var(--line); margin: 2.2rem 0; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font-size: .92rem; max-width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.prose th { font: 700 .92rem/1.3 Atkinson, system-ui, sans-serif; background: var(--tint); }
.prose :not(pre) > code { font: .86em/1 var(--mono); background: var(--tint); padding: .12em .32em; border-radius: 2px; overflow-wrap: anywhere; }
/* a page's video: at the top, before the writing */
.prose figure.watch { margin: 0 0 2rem; }
.prose figure.watch video { width: 100%; margin: 0; }
.watch figcaption { font: 500 .88rem/1.4 Atkinson, system-ui, sans-serif; color: var(--muted); margin: .5rem 0 0; }
.back { font: 500 .9rem/1.4 Atkinson, system-ui, sans-serif; margin-top: 2.6rem !important; }
.about { padding-top: max(9vh, 56px); }

/* a paragraph that is only "→ [label](url)" */
.cast .button { font: 600 .92rem/1 Atkinson, system-ui, sans-serif; color: var(--bg); background: var(--ink); padding: .75rem 1rem; }
.cast .button:hover { background: var(--accent); }

/* the spell: one phrase per page. wizard-page.js recolours it on hover or tap, with one pixel sparkle */
.spell { color: var(--spell, var(--accent)); transition: color .3s; position: relative; }
.spell.casting::after { content: ""; position: absolute; right: -7px; top: -5px; width: 2px; height: 2px; background: var(--gold); pointer-events: none;
  box-shadow: 0 -2px var(--gold), 0 2px var(--gold), -2px 0 var(--gold), 2px 0 var(--gold); animation: twinkle .6s steps(3) forwards; }
@keyframes twinkle { 0% { opacity: 0; transform: scale(.5); } 40% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .spell { transition: none; } .spell.casting::after { animation: none; opacity: 0; } }

/* code: the spellbook. A pixel tab names the language; the copy button arrives with JS */
figure.code { position: relative; margin: 0 0 1.3rem; border: 2px solid var(--ink); background: var(--night); box-shadow: 5px 5px 0 var(--line); }
figure.code figcaption { position: absolute; top: 0; left: 0; font: 500 .76rem/1 Atkinson, system-ui, sans-serif; letter-spacing: .06em; color: var(--night);
  background: var(--gold); padding: .3rem .5rem .28rem; }
figure.code pre { margin: 0; padding: 2rem 1rem 1rem; overflow-x: auto; }
figure.code code { font: 14px/1.6 var(--mono); color: #e9e4f5; white-space: pre; }
.copy { position: absolute; top: 0; right: 0; font: 500 .76rem/1 Atkinson, system-ui, sans-serif; letter-spacing: .04em; color: #e9e4f5; background: transparent;
  border: 0; border-left: 2px solid #3a3566; border-bottom: 2px solid #3a3566; padding: .3rem .55rem; cursor: pointer; }
.copy:hover { color: var(--gold); }
.hljs-keyword, .hljs-selector-tag, .hljs-doctag { color: #f2c14e; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-template-string { color: #9fd49a; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: #f29bb6; }
.hljs-comment, .hljs-quote, .hljs-deletion { color: #8c88b8; font-style: italic; }
.hljs-title, .hljs-title.function_, .hljs-section, .hljs-name { color: #8fc3f0; }
.hljs-built_in, .hljs-type, .hljs-title.class_ { color: #c3a6f0; }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-variable, .hljs-params, .hljs-selector-class { color: #f5d9a8; }
.hljs-meta, .hljs-meta .hljs-keyword { color: #d9a441; }
.hljs-punctuation, .hljs-operator { color: #b9b4d8; }

/* widgets: measured data you can play with. The tables are the data; the script swaps them for this */
figure.widget { margin: 1.6rem 0 1.8rem; padding: 1rem 1.1rem 1.1rem; border: 2px solid var(--ink); background: var(--card); box-shadow: 5px 5px 0 var(--gold); }
figure.widget > figcaption { font: 500 1rem/1.45 Atkinson, system-ui, sans-serif; color: var(--ink); margin: 0 0 .8rem; }
.widget table { font-size: .88rem; margin: 0 0 1rem; }
.widget caption { text-align: left; font-weight: 700; padding: 0 0 .3rem; }
.temp-prompts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .9rem; }
.temp-prompt { font: 500 .95rem/1.3 Atkinson, system-ui, sans-serif; color: var(--ink); background: var(--bg); border: 2px solid var(--line); padding: .35rem .65rem; cursor: pointer; text-align: left; }
.temp-prompt[aria-pressed="true"] { border-color: var(--ink); background: var(--tint); }
.temp-control { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: .5rem; font: 600 .9rem/1 Atkinson, system-ui, sans-serif; margin: 0 0 .9rem; }
.temp-value { min-width: 2.2em; color: var(--accent); }
.temp-control input { width: 100%; accent-color: var(--accent); min-height: 28px; }
.prose .temp-bars { list-style: none; margin: 0 0 .9rem; padding: 0; display: grid; gap: .3rem; }
.temp-bars li { display: grid; grid-template-columns: minmax(5.5rem, 34%) 1fr 3.4rem; align-items: center; gap: .55rem; margin: 0; }
.temp-token { font: .9rem/1.2 var(--mono); overflow-wrap: anywhere; }
.temp-bars li.other .temp-token { font: italic .88rem/1.2 Atkinson, system-ui, sans-serif; color: var(--muted); }
.temp-bar { height: .9rem; background: var(--tint); }
.temp-bar span { display: block; height: 100%; background: var(--accent); transition: width .18s; }
.temp-bars li.other .temp-bar span { background: var(--muted); }
.temp-p { font: 500 .82rem/1 Atkinson, system-ui, sans-serif; text-align: right; }
.temp-pick { font: 600 .9rem/1 Atkinson, system-ui, sans-serif; color: var(--bg); background: var(--ink); border: 2px solid var(--ink); padding: .6rem .85rem; box-shadow: 3px 3px 0 var(--gold); cursor: pointer; }
.temp-pick:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--gold); }
.temp-picked { font-size: .95rem; color: var(--muted); margin: .7rem 0 0; min-height: 1.6em; }
@media (prefers-reduced-motion: reduce) { .temp-bar span { transition: none; } }

.attn-heads { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .7rem; }
.attn-head { font: 500 .82rem/1.2 Atkinson, system-ui, sans-serif; color: var(--ink); background: var(--bg); border: 2px solid var(--line); padding: .4rem .55rem; cursor: pointer; }
.attn-head[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.attn-hint { font-size: .9rem; color: var(--muted); margin: 0 0 .4rem; }
.prose .attn-tokens { list-style: none; margin: 0 0 .7rem; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.prose .attn-tokens li { margin: 0; }
.attn-token { display: grid; justify-items: center; gap: .15rem; min-width: 2.6rem; padding: .3rem .4rem; cursor: pointer; color: var(--ink);
  border: 2px solid var(--line); background: color-mix(in srgb, var(--accent) calc(var(--w, 0) * 100%), var(--card)); }
.attn-token .attn-word { font: .92rem/1.2 var(--mono); }
.attn-token .attn-p { font: 500 .7rem/1 Atkinson, system-ui, sans-serif; }
.attn-token.strong { color: var(--bg); }
.attn-token.focus { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.attn-token.later { opacity: .4; background: var(--card); }
.attn-note { font-size: .95rem; color: var(--muted); margin: 0; min-height: 3em; }

/* the tinytowns playground: pick a model, type, tap a letter, end the name */
.tt { display: grid; grid-template-columns: minmax(0, 1fr); gap: .85rem; }
.tt-models { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; }
.tt-model { display: grid; gap: .2rem; justify-items: center; padding: .55rem .3rem; cursor: pointer; color: var(--ink); background: var(--bg); border: 2px solid var(--line); }
.tt-model strong { font: 600 .95rem/1.1 Atkinson, system-ui, sans-serif; }
.tt-model small { font: 500 .8rem/1 Atkinson, system-ui, sans-serif; color: var(--muted); }
.tt-model[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.tt-model[aria-pressed="true"] small { color: var(--on-ink); }
.tt-temp { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "k k v" "a s b"; align-items: center; gap: .3rem .6rem; font: 600 .9rem/1 Atkinson, system-ui, sans-serif; }
.tt-temp-k { grid-area: k; }
.tt-temp-v { grid-area: v; color: var(--accent); text-align: right; }
.tt-temp-end { font: 500 .82rem/1 Atkinson, system-ui, sans-serif; color: var(--muted); }
.tt-temp-end.safe { grid-area: a; }
.tt-temp-end.wild { grid-area: b; }
.tt-temp input { grid-area: s; width: 100%; accent-color: var(--accent); min-height: 32px; margin: 0; }
.tt-bar { display: flex; border: 2px solid var(--ink); background: var(--bg); box-shadow: 4px 4px 0 var(--gold); }
.tt-bar input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); padding: .6rem .75rem; font: 600 1.55rem/1.2 var(--pixel); letter-spacing: .04em; }
.tt-bar input::placeholder { color: var(--muted); opacity: .6; font-weight: 400; }
.tt-bar input:focus { outline: none; }
.tt-bar:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.tt-clear { border: 0; background: transparent; color: var(--muted); font: 600 1.5rem/1 var(--pixel); padding: 0 .8rem; cursor: pointer; }
.tt-hint { font-size: .95rem; color: var(--muted); margin: 0; min-height: 1.5em; }
.prose .tt-next { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.prose .tt-next li { margin: 0; }
.tt-opt { width: 100%; display: grid; grid-template-columns: 5.6rem minmax(0, 1fr) 3rem; align-items: center; gap: .6rem; padding: .35rem .5rem; cursor: pointer;
  color: var(--ink); background: var(--bg); border: 2px solid var(--line); text-align: left; -webkit-tap-highlight-color: transparent; }
.tt-opt:hover { border-color: var(--ink); }
.tt-opt:active { transform: translate(1px, 1px); }
.tt-sym { font: 700 1.3rem/1 var(--mono); }
.tt-sym.word { font: 700 .95rem/1.15 Atkinson, system-ui, sans-serif; color: var(--accent); }
.tt-track { height: .9rem; background: var(--tint); }
.tt-track span { display: block; height: 100%; background: var(--accent); transition: width .15s; }
.tt-p { font: 500 .85rem/1 Atkinson, system-ui, sans-serif; text-align: right; }
.tt-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.tt-finish, .tt-again { font: 600 .95rem/1 Atkinson, system-ui, sans-serif; color: var(--bg); background: var(--ink); border: 2px solid var(--ink); padding: .7rem 1rem; box-shadow: 3px 3px 0 var(--gold); cursor: pointer; }
.tt-finish:active, .tt-again:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--gold); }
.tt-finish:disabled { opacity: .45; cursor: default; }
.tt-verdict:empty { display: none; }
.tt-verdict { display: grid; justify-items: start; gap: .35rem; padding: .9rem 1rem; border: 2px solid var(--ink); background: var(--bg); }
.tt-verdict p { margin: 0; }
.tt-badge { font: 700 .85rem/1 Atkinson, system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; padding: .4rem .6rem; }
.tt-badge.real { background: var(--gold); color: var(--ink); }
.tt-badge.invented { background: var(--accent); color: var(--bg); }
.tt-name { font: 700 clamp(1.5rem, 7vw, 2rem)/1.15 var(--pixel); overflow-wrap: anywhere; text-transform: capitalize; }
.tt-line, .tt-checking { font-size: .98rem; color: var(--muted); }
.tt-again { margin-top: .35rem; }
.tt-status { font-size: .9rem; color: var(--muted); margin: 0; }
.tt-legend { display: grid; grid-template-columns: auto 1fr; gap: .25rem .7rem; margin: 0; padding: .6rem .75rem; background: var(--tint); font-size: .92rem; line-height: 1.4; }
.tt-legend[hidden], .prose .tt-next[hidden] { display: none; }
.tt-legend dt { font-weight: 700; color: var(--accent); white-space: nowrap; }
.tt-legend dd { margin: 0; }
/* a folded technical section at the end of a page */
.prose details.tech { margin: 2rem 0 1.4rem; border: 2px solid var(--ink); background: var(--card); }
.prose details.tech > summary { font: 700 1rem/1.3 Atkinson, system-ui, sans-serif; padding: .75rem 1rem; cursor: pointer; }
.prose details.tech[open] > summary { border-bottom: 2px solid var(--line); }
.prose details.tech > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
.prose details.tech ul { padding-left: 1.1rem; }
.prose details.tech li { font-size: .95rem; }
.tt-status:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .tt-track span { transition: none; } }

.kv .temp-control { grid-template-columns: auto minmax(7.5em, auto) 1fr; }
.kv-total { font: 700 1.5rem/1.2 Atkinson, system-ui, sans-serif; margin: .2rem 0 .6rem; }
.kv-bars { display: grid; gap: .35rem; margin: 0 0 .7rem; }
.kv-row { display: grid; grid-template-columns: 6.5rem 1fr 4.8rem; align-items: center; gap: .55rem; font-size: .92rem; }
.kv-bar { height: .9rem; background: var(--tint); }
.kv-bar span { display: block; height: 100%; background: var(--accent); transition: width .18s; }
.kv-row + .kv-row .kv-bar span { background: var(--muted); }
[data-widget="chatcost"] .kv-row:first-child .kv-bar span { background: var(--muted); }
[data-widget="chatcost"] .kv-row + .kv-row .kv-bar span { background: var(--accent); }
[data-widget="bars"] .kv-row .kv-bar span { background: var(--accent); }
[data-widget="bars"] .kv-row { grid-template-columns: minmax(6.5rem, 30%) 1fr 4.8rem; }
.kv-num { font: 500 .82rem/1 Atkinson, system-ui, sans-serif; text-align: right; }
.kv-how { font-size: .92rem; color: var(--muted); margin: 0; }
@media (prefers-reduced-motion: reduce) { .kv-bar span { transition: none; } }

@media (max-width: 480px) {
  .hero { gap: 1rem; }
  .wizard-big { width: 72px; height: 96px; }
  figure.code code { font-size: 13px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}

/* widget-chart (widgets/chart.js): one colour per kind of tool, the same in every chart. Validated with the dataviz
   checks (lightness band, chroma, colour-blind and normal-vision separation, 3:1 on the card) in light and dark, 2026-10-14 */
:root { --k-small: #b0731a; --k-general: #4d4bb0; --k-none: #0e8a78; }
:root[data-theme="dark"] { --k-small: #bd8428; --k-general: #8482e2; --k-none: #2ea590; }
.k-small { --kc: var(--k-small); } .k-general { --kc: var(--k-general); } .k-none { --kc: var(--k-none); }
.ch { container-type: inline-size; --name: 9rem; --val: 5.4rem; --gap: .7rem; }
.prose .ch-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; list-style: none; padding: 0; margin: 0 0 .8rem; font-size: .9rem; color: var(--ink); }
.prose .ch-legend li { display: flex; align-items: center; gap: .4rem; margin: 0; }
.ch-legend i { width: .8rem; height: .8rem; border-radius: 2px; background: var(--kc); }
.ch-body { position: relative; }
.ch-body.has-ref { padding-top: 1.5rem; }
.ch-grid { position: absolute; inset: 0; pointer-events: none; }
.ch-grid span { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.ch-body.has-ref .ch-grid span:not(.ch-ref) { top: 1.5rem; }
.ch-grid .ch-ref { width: 2px; margin-left: -1px; background: var(--muted); }
.ch-ref b { position: absolute; top: 0; left: 6px; white-space: nowrap; font: 600 .82rem/1.3 Atkinson, system-ui, sans-serif; color: var(--muted); }
.ch-ref.end b { left: auto; right: 6px; }
.prose .ch-rows { position: relative; list-style: none; padding: 0; margin: 0; }
.prose .ch-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name val" "track track"; column-gap: var(--gap);
  align-items: center; padding: .3rem 0; margin: 0; cursor: default; outline-offset: 2px; }
/* the labels wear the card so a gridline never runs through them (on a phone the lines cross the label line) */
.ch-name, .ch-val { background: var(--card); justify-self: start; padding-right: .3rem; }
.ch-val { justify-self: end; padding: 0 0 0 .3rem; }
.ch-row.on, .ch-row.on .ch-name, .ch-row.on .ch-val { background: var(--tint); }
.ch-name { grid-area: name; font-size: .95rem; color: var(--ink); }
.ch-row.on .ch-name { font-weight: 700; }
.ch-val { grid-area: val; font: 600 .9rem/1.3 Atkinson, system-ui, sans-serif; font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); }
.ch-row.none .ch-val { font-weight: 500; color: var(--muted); }
.ch-track { grid-area: track; position: relative; height: 1.15rem; }
.ch-bar { position: absolute; left: 0; top: 50%; height: .85rem; transform: translateY(-50%); border-radius: 0 4px 4px 0; background: var(--kc); min-width: 2px; }
.ch-dots .ch-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.ch-dot { position: absolute; top: 50%; width: .8rem; height: .8rem; border-radius: 50%; transform: translate(-50%, -50%); background: var(--kc); box-shadow: 0 0 0 2px var(--card); }
.ch-axis { position: relative; height: 1.4rem; margin-top: .2rem; }
.ch-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; font: 500 .8rem/1.4 Atkinson, system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--muted); }
.ch-ticks span.start { transform: none; } .ch-ticks span.end { transform: translateX(-100%); }
.ch-unit { font-size: .85rem; color: var(--muted); text-align: center; margin: .1rem 0 0 !important; }
.ch-note { font-size: .92rem; color: var(--muted); margin: .6rem 0 0 !important; min-height: 2.8em; }
@container (min-width: 34rem) {
  .prose .ch-row { grid-template-columns: var(--name) 1fr var(--val); grid-template-areas: "name track val"; }
  .ch-grid { left: calc(var(--name) + var(--gap)); right: calc(var(--val) + var(--gap)); }
  .ch-axis, .ch-unit { margin-left: calc(var(--name) + var(--gap)); margin-right: calc(var(--val) + var(--gap)); }
}
.prose .ch-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: .7rem; list-style: none; padding: 0; margin: 0; }
.prose .ch-tiles li { margin: 0; padding: .7rem .85rem; border: 2px solid var(--line); background: var(--bg); }
.prose .ch-tiles li[class] { border-left: 5px solid var(--kc); }
.ch-tiles strong { display: block; font: 700 1.7rem/1.15 Atkinson, system-ui, sans-serif; color: var(--ink); }
.ch-tiles span { display: block; font-size: .92rem; line-height: 1.4; color: var(--muted); margin-top: .25rem; }
.ch-table { margin-top: .8rem; }
.ch-table summary { font: 600 .9rem/1.4 Atkinson, system-ui, sans-serif; color: var(--ink); cursor: pointer; }
.ch-table .widget-tables { margin-top: .6rem; overflow-x: auto; }
/* scatter: two measures, one point per tool; a point's name sits beside it (pos: right, left, above, below, below-left) */
.ch-sc { --yl: 2.2rem; }
.ch-yunit { font-size: .85rem; color: var(--muted); margin: 0 0 .5rem !important; }
.ch-sc-plot { position: relative; height: 20rem; margin: 0 .4rem 0 var(--yl); }
.ch-sc-grid { position: absolute; inset: 0; pointer-events: none; }
.ch-sc-grid .v { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.ch-sc-grid .h { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }
.ch-sc-grid .h b { position: absolute; right: calc(100% + .45rem); top: -.7em; font: 500 .8rem/1.4 Atkinson, system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--muted); }
.ch-sc-grid .h.ref { height: 2px; background: var(--muted); }
.ch-sc-grid .h.ref i { position: absolute; right: 0; bottom: 5px; font: 600 .82rem/1.3 Atkinson, system-ui, sans-serif; font-style: normal; color: var(--muted); }
.ch-sc-grid .corner { position: absolute; left: .45rem; bottom: .35rem; font: 600 .88rem/1.3 Atkinson, system-ui, sans-serif; color: var(--ink); background: var(--card); padding: 0 .2rem; }
.ch-pt { position: absolute; width: 1.75rem; height: 1.75rem; transform: translate(-50%, 50%); display: grid; place-items: center; border-radius: 50%; cursor: default; outline-offset: 0; }
.ch-pt i { width: .85rem; height: .85rem; border-radius: 50%; background: var(--kc); box-shadow: 0 0 0 2px var(--card); }
.ch-pt.on i { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--kc); }
.ch-pt span { position: absolute; white-space: nowrap; font: 600 .85rem/1.25 Atkinson, system-ui, sans-serif; color: var(--ink); background: var(--card); padding: 0 .2rem; }
.ch-pt.on span { background: var(--tint); }
.ch-pt.at-right span { left: calc(100% - .2rem); top: 50%; transform: translateY(-50%); }
.ch-pt.at-left span { right: calc(100% - .2rem); top: 50%; transform: translateY(-50%); }
.ch-pt.at-above span { bottom: calc(100% - .2rem); left: 50%; transform: translateX(-50%); }
.ch-pt.at-below span { top: calc(100% - .2rem); left: 50%; transform: translateX(-50%); }
.ch-pt.at-below-left span { top: calc(100% - .35rem); right: 50%; }
.ch-sc .ch-axis, .ch-sc .ch-unit { margin-left: var(--yl); margin-right: .4rem; }
@container (min-width: 30rem) { .prose .ch-tiles.n4 { grid-template-columns: repeat(2, 1fr); } }   /* four tiles: 2 × 2, not 3 + 1 */

/* widget-indiafacts (widgets/indiafacts.js): the question box, the answer with citation numbers, the numbered sources (folded), Share and
   Ask another fact. A sentence with no source is greyed and labelled in words, never by colour alone. Once answered, the question is locked. */
.if-form { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: end; }
.if-form.asked { grid-template-columns: 1fr; }
.if-label { grid-column: 1 / -1; font: 600 .85rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.if-input { width: 100%; box-sizing: border-box; resize: vertical; min-height: 3.2rem; padding: .6rem .7rem; font: 1rem/1.4 var(--sans);
  color: var(--ink); background: var(--bg); border: 2px solid var(--ink); }
.if-input[readonly] { resize: none; font-weight: 700; background: var(--tint); border-color: var(--line); }
.if-go { font: 700 1.2rem/1 var(--pixel); padding: .75rem 1.1rem; color: var(--ink); background: var(--gold); border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink); cursor: pointer; }
.if-go:active, .if-act:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.if-tries { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0 0; align-items: center; }
.if-tries[hidden], .if-go[hidden] { display: none; }
.if-tries-h { font: 600 .9rem/1 var(--sans); color: var(--muted); }
.if-try { font: .9rem/1.3 var(--sans); text-align: left; padding: .35rem .55rem; color: var(--ink); background: var(--tint);
  border: 1px solid var(--line); cursor: pointer; }
.if-try:hover { border-color: var(--ink); }
.if-status { min-height: 1.4em; margin: .8rem 0 0; color: var(--muted); font-size: .95rem; }
.if-status:empty { min-height: 0; margin: 0; }
.if-answer { margin-top: .8rem; padding: .9rem 1rem; background: var(--bg); border-left: 4px solid var(--gold); scroll-margin-top: 5rem; }
.if-text { margin: 0 0 .6rem; }
.if-cite { display: inline-block; min-width: 1.25em; margin-left: .15em; padding: 0 .2em; font: 700 .8rem/1.3 var(--sans);
  text-align: center; vertical-align: super; text-decoration: none; color: var(--card); background: var(--accent); border-radius: 2px; }
.if-unsourced { color: var(--muted); }
.if-nosource { white-space: nowrap; margin-left: .3em; font-size: .8rem; color: var(--muted); border: 1px solid var(--muted); padding: 0 .3em; }
.if-note { margin: .4rem 0 0; font-size: .9rem; color: var(--muted); }
.if-notice { margin: 0 0 .6rem; padding: .5rem .7rem; font-size: .95rem; background: var(--tint); border: 1px solid var(--line); }
.if-h { margin: 1.2rem 0 .4rem; font: 700 1.2rem/1 var(--pixel); }
.if-sources { margin: 0; padding-left: 1.6rem; }
.if-sources li { margin: 0 0 .5rem; scroll-margin-top: 5rem; }
.if-sources summary { cursor: pointer; }
.if-sources details[open] { padding-bottom: .4rem; }
.if-kind { display: inline-block; margin-right: .4rem; font: 600 .8rem/1.2 var(--sans); letter-spacing: .03em; padding: .1rem .35rem;
  border: 1px solid var(--ink); background: var(--tint); }
.if-src-title { font-weight: 700; font-size: .95rem; }
.if-quote { margin: .4rem 0 .3rem; padding: .3rem .7rem; font-size: .92rem; border-left: 3px solid var(--line); color: var(--ink); }
.if-check { font-size: .9rem; }
.if-quote.clip { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden; }
.if-more { display: block; margin: 0 0 .3rem; padding: .2rem 0; font: 600 .9rem/1.3 var(--sans); color: var(--accent); background: none; border: 0;
  text-decoration: underline; cursor: pointer; }
.if-count { font-size: .9rem; color: var(--muted); }
.if-passage { margin: .7rem 0 0; }
.if-loc { margin: 0; font: 600 .85rem/1.3 var(--sans); color: var(--muted); }
.if-meta { margin: .6rem 0 0; font-size: .85rem; color: var(--muted); }
.if-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1rem; }
.if-act { font: 600 1rem/1 var(--sans); padding: .7rem 1rem; color: var(--ink); background: var(--card); border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink); cursor: pointer; }
.if-act.if-again { background: var(--gold); }
.if-said { font-size: .9rem; color: var(--muted); }
/* the page's explanations: folds stacked close together */
.prose details.tech.fold { margin: 0 0 .7rem; }
