/* The Fool's Atlas
   Layout: a quiet left rail (the path) and one chapter at a time on a wide paper page;
   cards are printed objects and keep their own stock colour in both themes. */
:root {
  --bg: #F1EEE6;
  --bg-2: #E8E3D6;
  --bg-3: #DED7C6;
  --fg: #1E1C18;
  --fg-2: #5D584D;
  --fg-3: #8B8576;
  --rule: #CBC3AF;
  --accent: #B9502F;      /* vermilion clay */
  --lapis: #2C4A7C;       /* the 1422 Ferrara deck: gold and lapis lazuli */
  --gold: #A9802C;
  --sage: #6E7F50;
  --focus: #2C4A7C;
  --stock: #EFE7D6;       /* card stock: constant in both themes */
  --stock-ink: #23201B;
  --shadow: 0 1px 0 rgba(35, 32, 27, .08), 0 10px 24px -14px rgba(35, 32, 27, .45);
  --veil: rgba(241, 238, 230, .86);

  --display: "IM Fell English", "LXGW WenKai", "Iowan Old Style", Georgia, serif;
  --sc: "IM Fell English SC", "IM Fell English", "LXGW WenKai", Georgia, serif;
  --body: "EB Garamond", "LXGW WenKai", "Iowan Old Style", Georgia, serif;
  --body-k: "EB Garamond", "LXGW WenKai Bold", "LXGW WenKai", "Iowan Old Style", Georgia, serif;
  --zh: "LXGW WenKai", "Songti SC", "STSong", serif;
  --hebrew: "Frank Ruhl Libre", "Times New Roman", serif;
  --phoen: "Noto Sans Phoenician", sans-serif;

  --ease: cubic-bezier(.2, .75, .15, 1);
  --rail: 232px;
  --measure: 64ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15140F; --bg-2: #1D1B15; --bg-3: #27241C; --fg: #ECE5D5; --fg-2: #ABA492; --fg-3: #7D7766;
    --rule: #3A362B; --accent: #E07F5E; --lapis: #8EA8D8; --gold: #D6B062; --sage: #A3B381; --focus: #8EA8D8;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 30px -14px rgba(0, 0, 0, .8); --veil: rgba(21, 20, 15, .86);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15140F; --bg-2: #1D1B15; --bg-3: #27241C; --fg: #ECE5D5; --fg-2: #ABA492; --fg-3: #7D7766;
  --rule: #3A362B; --accent: #E07F5E; --lapis: #8EA8D8; --gold: #D6B062; --sage: #A3B381; --focus: #8EA8D8;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 30px -14px rgba(0, 0, 0, .8); --veil: rgba(21, 20, 15, .86);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--body); font-size: 19px; line-height: 1.55;
  font-feature-settings: "onum", "kern", "liga";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
:lang(zh) body, html[lang="zh-CN"] body { font-size: 18px; line-height: 1.8; }
::selection { background: var(--accent); color: var(--bg); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: .2em; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 3px; }
img { max-width: 100%; }

/* paper grain over everything, very faint */
.grain { position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .3  0 0 0 0 .27  0 0 0 0 .2  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
:root[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: .25; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .grain { mix-blend-mode: screen; opacity: .25; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; align-self: start;
  padding: 28px 18px 24px 26px; display: flex; flex-direction: column; gap: 22px;
  border-right: 1px solid var(--rule);
}
.brand { display: grid; gap: 2px; text-decoration: none; }
.brand b { font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1; letter-spacing: -.01em; }
.brand span { font-family: var(--zh); font-size: 13px; color: var(--fg-2); letter-spacing: .3em; }
.path { position: relative; display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.path::before { content: ""; position: absolute; left: 11px; top: 14px; bottom: 14px; width: 1px; background: var(--rule); }
.path .fill { position: absolute; left: 11px; top: 14px; width: 1px; background: var(--accent); transition: height .9s var(--ease); }
.path button { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: baseline; width: 100%; text-align: left; padding: 7px 0; color: var(--fg-2); }
.path button .dot { width: 9px; height: 9px; margin: 0 0 0 7px; border-radius: 50%; border: 1px solid var(--fg-3); background: var(--bg); transform: translateY(1px); transition: all .4s var(--ease); }
.path button .lbl { display: grid; line-height: 1.2; }
.path button .lbl small { font-family: var(--sc); font-size: 11.5px; letter-spacing: .14em; color: var(--fg-3); }
.path button .lbl span { font-size: 16.5px; }
.path button.seen .dot { background: var(--fg-3); }
.path button[aria-current="page"] { color: var(--fg); }
.path button[aria-current="page"] .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.path button:hover { color: var(--fg); }
.rail .tools { margin-top: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 2px; }
.seg button { padding: 3px 11px; border-radius: 999px; font-size: 14px; color: var(--fg-2); font-family: var(--sc); letter-spacing: .06em; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: 50%; color: var(--fg-2); }
.icon-btn:hover { color: var(--fg); border-color: var(--fg-3); }
.rail .colophon { font-size: 12.5px; color: var(--fg-3); line-height: 1.45; }

main { min-width: 0; padding-inline: clamp(16px, 4.5vw, 72px); padding-block: 40px 120px; }
.chapter { max-width: 1180px; margin: 0 auto; animation: rise .9s var(--ease) both; }
@keyframes rise { from { opacity: .001; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- chapter typography ---------- */
.head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 40px; align-items: end; padding-block: 12px 34px; border-bottom: 1px solid var(--rule); margin-bottom: 40px; }
.eyebrow { font-family: var(--sc); font-size: 14px; letter-spacing: .18em; color: var(--accent); margin: 0 0 14px; }
h1 { font-family: var(--display); font-weight: 400; font-size: clamp(46px, 7.4vw, 104px); line-height: .94; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
h1 em, h2 em { font-style: italic; color: var(--accent); }
html[lang="zh-CN"] h1 { font-family: var(--zh); letter-spacing: .02em; line-height: 1.1; font-size: clamp(40px, 6vw, 84px); }
.lede { font-size: clamp(19px, 1.7vw, 23px); line-height: 1.5; color: var(--fg-2); max-width: 46ch; margin: 22px 0 0; text-wrap: pretty; }
html[lang="zh-CN"] .lede { max-width: 30em; }
.vignette { width: clamp(110px, 15vw, 190px); aspect-ratio: 5/7; border-radius: 4px; box-shadow: var(--shadow); transform: rotate(2.5deg); }
.vignette img { width: 100%; height: 100%; display: block; border-radius: 4px; }

.step { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 0 18px; margin: 56px 0 18px; }
.step .no { font-family: var(--sc); font-size: 15px; color: var(--fg-3); letter-spacing: .12em; padding-top: 10px; border-top: 1px solid var(--fg); }
.step h2 { font-family: var(--display); font-weight: 400; font-size: clamp(28px, 3.2vw, 40px); line-height: 1.08; margin: 0 0 10px; padding-top: 4px; text-wrap: balance; }
html[lang="zh-CN"] .step h2 { font-family: var(--zh); }
.step p { margin: 0 0 12px; max-width: var(--measure); color: var(--fg-2); }
.step p strong { color: var(--fg); font-weight: 500; }
.note { font-size: 15.5px; color: var(--fg-3); max-width: var(--measure); }
.cite { font-family: var(--sc); font-size: 12.5px; letter-spacing: .08em; color: var(--fg-3); }
.label { font-family: var(--sc); font-size: 13px; letter-spacing: .14em; color: var(--fg-3); }

/* ---------- controls ---------- */
.modes { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 18px; }
.chip { border: 1px solid var(--rule); border-radius: 999px; padding: 5px 14px 6px; font-size: 16px; color: var(--fg-2); transition: all .3s var(--ease); background: transparent; }
.chip:hover { color: var(--fg); border-color: var(--fg-3); }
.chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.chip .k { font-family: var(--sc); font-size: 12px; letter-spacing: .1em; opacity: .7; margin-right: 6px; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 11px 20px 12px; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: 17px; transition: transform .3s var(--ease), background .3s; }
.btn:hover { transform: translateY(-1px); background: var(--accent); }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--rule); }
.btn.ghost:hover { border-color: var(--fg); background: transparent; }
.btn:disabled { opacity: .4; pointer-events: none; }
.toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; color: var(--fg-2); cursor: pointer; }
.toggle input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--bg-3); position: relative; transition: background .3s; cursor: pointer; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .35s var(--ease); }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(14px); }

/* ---------- the printed card ---------- */
.card {
  position: absolute; left: 0; top: 0; width: 120px; aspect-ratio: 7/12; transform-origin: 0 0;
  background: var(--stock); border-radius: 6px; box-shadow: var(--shadow); padding: 0; overflow: hidden;
  cursor: pointer; will-change: transform;
  transition: transform 1s var(--ease), opacity .6s var(--ease), box-shadow .3s, filter .4s;
}
.card img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.card.dim { opacity: .18; filter: saturate(.3); }
.card.hot { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.card.back .art { background: var(--stock); }
.card:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.stage { position: relative; width: 100%; transition: height .8s var(--ease); }
.stage svg.threads { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.stage svg.threads path, .stage svg.threads circle, .stage svg.threads line { fill: none; stroke: var(--fg-3); stroke-width: 1; }
.stage svg.threads .road { stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 2 5; stroke-linecap: round; }
.stage svg.threads .ring { stroke: var(--rule); fill: none; }
.stage svg.threads text { fill: var(--fg-3); stroke: none; font-family: var(--sc); font-size: 13px; letter-spacing: .1em; }
.stage svg.threads .glyph { font-family: var(--hebrew); font-size: 20px; fill: var(--fg-2); letter-spacing: 0; }
.stage svg.threads .astro { font-family: var(--body); font-size: 16px; fill: var(--fg-2); letter-spacing: 0; }
.stage svg.threads .hl { stroke: var(--accent); stroke-width: 1.6; }
.draw { stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000); animation: draw 1.6s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.tip { position: fixed; z-index: 40; pointer-events: none; background: var(--fg); color: var(--bg); font-size: 14.5px; padding: 6px 10px 7px; border-radius: 6px; transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; opacity: 0; transition: opacity .2s; }
.tip.on { opacity: 1; }
.tip small { font-family: var(--sc); letter-spacing: .1em; opacity: .7; margin-left: 6px; }

/* caption that changes with a mode */
.caption { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--rule); }
.caption h3 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0; line-height: 1.15; }
html[lang="zh-CN"] .caption h3 { font-family: var(--zh); }
.caption p { margin: 0; color: var(--fg-2); }
.swap { animation: swap .6s var(--ease); }
@keyframes swap { from { opacity: .001; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- prologue ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; align-items: center; padding-block: 8px 30px; }
.hero h1 { font-size: clamp(56px, 9vw, 132px); }
html[lang="zh-CN"] .hero h1 { font-family: var(--display); letter-spacing: -.02em; line-height: .94; font-size: clamp(56px, 9vw, 132px); }
.hero .zh-title { font-family: var(--zh); font-size: clamp(20px, 2vw, 26px); letter-spacing: .5em; color: var(--fg-2); margin: 14px 0 0; }
.hero .facts { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 28px; color: var(--fg-2); font-size: 15.5px; }
.hero .facts b { display: block; font-family: var(--display); font-weight: 400; font-size: 34px; color: var(--fg); line-height: 1; font-feature-settings: "lnum"; }
.fool-stage { position: relative; aspect-ratio: 1/1; max-width: 520px; width: 100%; justify-self: center; }
.fool-stage .orbit { position: absolute; inset: 0; animation: spin 140s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fool-stage .big { position: absolute; left: 50%; top: 50%; width: 42%; transform: translate(-50%, -50%) rotate(-3deg); box-shadow: var(--shadow); border-radius: 10px; overflow: hidden; padding: 0; cursor: pointer; transition: transform 1.2s var(--ease); }
.fool-stage .big:hover { transform: translate(-50%, -52%) rotate(-1deg); }
.fool-stage .big img { display: block; width: 100%; height: auto; }
.chapters-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0; margin: 10px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.chapters-list li { border-bottom: 1px solid var(--rule); }
.chapters-list button { display: grid; grid-template-columns: 44px 1fr; gap: 6px 10px; width: 100%; text-align: left; padding: 18px 16px 20px 0; align-items: baseline; transition: background .3s; }
.chapters-list button:hover { background: var(--bg-2); }
.chapters-list .rn { font-family: var(--sc); color: var(--accent); font-size: 16px; letter-spacing: .1em; padding-left: 4px; }
.chapters-list .t { font-family: var(--display); font-size: 25px; line-height: 1.1; }
html[lang="zh-CN"] .chapters-list .t { font-family: var(--zh); }
.chapters-list .d { grid-column: 2; color: var(--fg-2); font-size: 15.5px; line-height: 1.45; }

/* ---------- origins: the river ---------- */
.river-wrap { position: relative; overflow-x: auto; overflow-y: hidden; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); -webkit-overflow-scrolling: touch; scrollbar-width: thin; cursor: grab; }
.river-wrap.drag { cursor: grabbing; }
.river { display: block; height: 380px; }
.river .era rect { opacity: .5; }
.river .era text { font-family: var(--sc); font-size: 12px; letter-spacing: .14em; fill: var(--fg-3); }
.river .axis line { stroke: var(--rule); }
.river .axis text { font-family: var(--body); font-size: 13px; fill: var(--fg-3); font-feature-settings: "lnum"; }
.river .ev { cursor: pointer; }
.river .ev .stem { stroke: var(--rule); }
.river .ev text { font-family: var(--body); font-size: 13.5px; fill: var(--fg-2); }
.river .ev:hover text, .river .ev.on text { fill: var(--fg); }
.river .ev.on .mk { stroke: var(--accent); stroke-width: 2; }
.river .ev.off { opacity: .14; }
.river .break { stroke: var(--fg-3); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.legend .chip svg { width: 13px; height: 13px; vertical-align: -1px; margin-right: 7px; }
.legend .chip[aria-pressed="true"] { background: var(--bg-2); color: var(--fg); border-color: var(--fg-3); }
.legend .chip[aria-pressed="false"] { opacity: .5; text-decoration: line-through; text-decoration-color: var(--fg-3); }
.event-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px 34px; padding: 24px 0 8px; min-height: 180px; }
.event-card .when { font-family: var(--sc); color: var(--accent); letter-spacing: .12em; font-size: 15px; }
.event-card h3 { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1.08; margin: 6px 0 10px; text-wrap: balance; }
html[lang="zh-CN"] .event-card h3 { font-family: var(--zh); }
.event-card p { margin: 0 0 10px; color: var(--fg-2); max-width: 60ch; }
.mini-cards { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.mini { width: 74px; transition: transform .4s var(--ease); text-align: center; color: var(--fg-2); }
.mini:hover { transform: translateY(-3px) rotate(-1deg); }
.mini img { display: block; width: 100%; aspect-ratio: 7/12; object-fit: cover; border-radius: 4px; box-shadow: var(--shadow); }
.mini span { display: block; font-family: var(--sc); font-size: 10.5px; padding: 4px 0 5px; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[lang="zh-CN"] .mini span { font-family: var(--zh); }
.ev-badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--sc); font-size: 12.5px; letter-spacing: .1em; color: var(--fg-2); border: 1px solid var(--rule); border-radius: 999px; padding: 2px 10px 3px; }
.myths { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.myth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 28px; padding: 20px 0; border-bottom: 1px solid var(--rule); }
.myth .claim { font-family: var(--display); font-size: 23px; line-height: 1.25; color: var(--fg-2); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent); text-decoration-thickness: 1.5px; }
html[lang="zh-CN"] .myth .claim { font-family: var(--zh); }
.myth .fact { color: var(--fg); }
.myth .fact .cite { display: block; margin-top: 6px; }

/* ---------- journey ---------- */
.letter-panel { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; }
.letter-big { font-family: var(--hebrew); font-size: 92px; line-height: 1; color: var(--fg); min-width: 1.1em; text-align: center; }
.letter-big svg text { font-family: var(--hebrew); }
.evo { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; font-size: 15px; color: var(--fg-2); }
.evo b { font-weight: 400; font-size: 30px; color: var(--fg); display: block; line-height: 1.1; }
.evo .ph { font-family: var(--phoen); }
.evo .hb { font-family: var(--hebrew); }
.evo > span { display: grid; justify-items: center; gap: 2px; }
.evo small { font-family: var(--sc); font-size: 11px; letter-spacing: .1em; color: var(--fg-3); }
.evo .arrow { color: var(--fg-3); font-size: 18px; }

/* ---------- suits & loom ---------- */
.suits { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--fg); }
.suit { padding: 18px 18px 22px 0; border-right: 1px solid var(--rule); display: grid; gap: 8px; align-content: start; }
.suit:last-child { border-right: 0; }
.suit + .suit { padding-left: 18px; }
.suit .sym { width: 56px; height: 78px; }
.suit h3 { font-family: var(--display); font-weight: 400; font-size: 30px; margin: 0; line-height: 1; }
html[lang="zh-CN"] .suit h3 { font-family: var(--zh); }
.suit .el { font-family: var(--sc); letter-spacing: .12em; font-size: 13px; color: var(--accent); }
.suit p { margin: 0; font-size: 16.5px; color: var(--fg-2); line-height: 1.5; }
.suit .it { font-size: 14.5px; color: var(--fg-3); }

.loom { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 34px; align-items: start; }
.loom-grid { display: grid; grid-template-columns: 104px repeat(10, minmax(0, 1fr)); gap: 4px; }
.loom-grid .h { font-family: var(--sc); font-size: 12.5px; letter-spacing: .05em; color: var(--fg-3); display: grid; place-items: center; text-align: center; padding: 4px 0; }
.loom-grid .rh { justify-items: start; place-items: center start; gap: 6px; display: flex; color: var(--fg-2); }
.loom-grid .rh img { width: 18px; height: 25px; }
.loom-grid button { aspect-ratio: 7/12; border-radius: 3px; overflow: hidden; background: var(--stock); border: 1px solid transparent; transition: transform .35s var(--ease), box-shadow .3s, opacity .3s; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.loom-grid button img { width: 100%; height: 100%; display: block; object-fit: cover; }
.loom-grid button:hover, .loom-grid button.on { transform: scale(1.12); box-shadow: 0 0 0 2px var(--accent), var(--shadow); z-index: 2; position: relative; }
.loom-grid.focus-row button:not(.row-on), .loom-grid.focus-col button:not(.col-on) { opacity: .32; }
.formula { position: sticky; top: 24px; display: grid; gap: 14px; }
.formula .eq { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: stretch; }
.formula .eq .op { align-self: center; }
.formula .term { border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; min-height: 110px; }
.formula .term small { display: block; font-family: var(--sc); letter-spacing: .12em; color: var(--accent); font-size: 12.5px; }
.formula .term b { display: block; font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.1; margin: 2px 0 4px; }
html[lang="zh-CN"] .formula .term b { font-family: var(--zh); }
.formula .term span { font-size: 15px; color: var(--fg-2); line-height: 1.4; display: block; }
.formula .op { font-family: var(--display); font-size: 30px; color: var(--fg-3); }
.formula .result { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; align-items: start; padding-top: 14px; border-top: 1px solid var(--rule); }
.formula .result img { width: 96px; border-radius: 4px; box-shadow: var(--shadow); }
.formula .result h4 { margin: 0 0 4px; font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.1; }
html[lang="zh-CN"] .formula .result h4 { font-family: var(--zh); }
.formula .result p { margin: 0 0 6px; color: var(--fg-2); font-size: 16.5px; }
.kw { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.kw span { font-family: var(--sc); font-size: 12.5px; letter-spacing: .08em; border: 1px solid var(--rule); border-radius: 999px; padding: 1px 9px 2px; color: var(--fg-2); }
html[lang="zh-CN"] .kw span { font-family: var(--zh); letter-spacing: .05em; }

.wheel-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); gap: 34px; align-items: center; }
.wheel { width: 100%; max-width: 620px; aspect-ratio: 1; justify-self: center; overflow: visible; }
.wheel text { font-family: var(--body); fill: var(--fg-2); }
.wheel .sign { font-size: 20px; fill: var(--fg); }
.wheel .pl { font-size: 12.5px; fill: var(--fg-3); }
.wheel .seg { cursor: pointer; }
.wheel .seg path { stroke: var(--rule); transition: fill .3s; }
.wheel .seg:hover path, .wheel .seg.on path { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
.wheel circle.r { fill: none; stroke: var(--rule); }
.wheel .hand { stroke: var(--accent); stroke-width: 1.4; transition: transform 1.2s var(--ease); transform-origin: 50% 50%; }

/* ---------- court ---------- */
.court-grid { display: grid; grid-template-columns: 180px repeat(4, minmax(0, 1fr)); gap: 12px 18px; align-items: center; }
.court-grid .rk { font-family: var(--display); font-size: 22px; line-height: 1.1; transition: opacity .3s; }
html[lang="zh-CN"] .court-grid .rk { font-family: var(--zh); }
.court-grid .rk small { display: block; font-family: var(--body); font-style: italic; font-size: 15px; line-height: 1.35; color: var(--fg-3); margin-top: 6px; max-width: 22ch; }
html[lang="zh-CN"] .court-grid .rk small { font-family: var(--zh); font-style: normal; font-size: 13.5px; }
.court-grid .sh { font-family: var(--sc); letter-spacing: .12em; font-size: 13px; color: var(--fg-3); text-align: center; }
.court-grid .cell { position: relative; }
.court-grid .cell button { display: block; width: 100%; max-width: 112px; margin: 0 auto; transition: transform .5s var(--ease); color: var(--fg-2); }
.court-grid .cell button:hover { transform: translateY(-4px) rotate(-1.2deg); }
.court-grid .cell img { display: block; width: 100%; aspect-ratio: 7/12; object-fit: cover; border-radius: 6px; box-shadow: var(--shadow); }
.court-grid .cell span { display: block; font-family: var(--sc); font-size: 12px; letter-spacing: .05em; padding: 5px 0 6px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[lang="zh-CN"] .court-grid .cell span { font-family: var(--zh); }
.flip-name { display: inline-block; animation: swap .5s var(--ease); }
.ranks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; margin-top: 30px; }
.ranks div h4 { font-family: var(--display); font-weight: 400; font-size: 24px; margin: 0 0 4px; }
html[lang="zh-CN"] .ranks div h4 { font-family: var(--zh); }
.ranks div p { margin: 0; color: var(--fg-2); font-size: 16.5px; }
.ranks div .stage-l { display: block; font-family: var(--body); font-style: italic; color: var(--accent); font-size: 16.5px; line-height: 1.4; margin: 0 0 10px; }
html[lang="zh-CN"] .ranks div .stage-l { font-family: var(--zh); font-style: normal; font-size: 15px; }

/* ---------- web ---------- */
.web { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 34px; align-items: start; }
.web > :first-child { position: sticky; top: 24px; }
.constellation { width: 100%; aspect-ratio: 1; max-width: 640px; overflow: visible; }
.constellation .th { fill: none; stroke: var(--rule); stroke-width: .9; transition: stroke .3s, stroke-width .3s, opacity .3s; }
.constellation .th.on { stroke: var(--accent); stroke-width: 1.8; }
.constellation .th.off { opacity: .25; }
.constellation .node circle { fill: var(--bg); stroke: var(--fg-2); stroke-width: 1.2; transition: all .3s; }
.constellation .node.on circle { fill: var(--accent); stroke: var(--accent); }
.constellation .node text { font-family: var(--sc); font-size: 11px; letter-spacing: .08em; fill: var(--fg-3); }
.constellation .cimg { transition: opacity .3s; cursor: pointer; }
.constellation .cimg.off { opacity: .25; }
.constellation .hub { font-family: var(--display); font-size: 30px; fill: var(--fg); text-anchor: middle; }
html[lang="zh-CN"] .constellation .hub { font-family: var(--zh); }
.constellation .hubs { font-family: var(--sc); font-size: 12px; letter-spacing: .14em; fill: var(--fg-3); text-anchor: middle; }
.nodes { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.node-item { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: start; gap: 4px 14px; padding: 16px 0 18px; border-bottom: 1px solid var(--rule); text-align: left; transition: background .3s; width: 100%; }
.node-item:hover, .node-item.on { background: linear-gradient(90deg, var(--bg-2), transparent); }
.node-item .yr { grid-row: 1 / span 4; font-family: var(--display); font-size: 17px; line-height: 1.3; color: var(--accent); font-feature-settings: "lnum"; padding-left: 4px; }
.node-item h4 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.15; }
html[lang="zh-CN"] .node-item h4 { font-family: var(--zh); }
.node-item p { grid-column: 2; margin: 4px 0 0; color: var(--fg-2); font-size: 16.5px; line-height: 1.5; }
.node-item .cite { grid-column: 2; }
.node-item .mini-cards { grid-column: 2; }
.node-item .mini-cards { grid-column: 2; margin-top: 8px; }
.node-item .mini { width: 46px; }
.node-item .mini span { display: none; }
.widget { margin-top: 26px; border: 1px solid var(--rule); border-radius: 14px; padding: 22px; background: var(--bg-2); }
.widget h3 { font-family: var(--display); font-weight: 400; font-size: 27px; margin: 0 0 6px; line-height: 1.1; }
html[lang="zh-CN"] .widget h3 { font-family: var(--zh); }
.widget p { margin: 0 0 12px; color: var(--fg-2); font-size: 16.5px; max-width: 62ch; }
.orrery { width: 100%; max-width: 420px; aspect-ratio: 1; display: block; margin: 0 auto; }
.orrery circle.o { fill: none; stroke: var(--rule); }
.orrery .pl circle { stroke: var(--fg); stroke-width: 1; }
.orrery text { font-family: var(--sc); font-size: 10px; letter-spacing: .08em; fill: var(--fg-2); }
.orrery .ctr { font-size: 7px; letter-spacing: .16em; fill: var(--fg-3); }
.tones { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 14px 0; }
.tone { display: grid; grid-template-columns: 36px 1fr; gap: 2px 10px; align-items: center; text-align: left; border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; background: var(--bg); transition: border-color .3s, transform .3s var(--ease); }
.tone:hover { border-color: var(--fg-3); }
.tone.on { border-color: var(--accent); transform: translateY(-2px); }
.tone img { grid-row: span 2; width: 36px; border-radius: 3px; }
.tone b { font-weight: 500; font-size: 15px; }
.tone span { font-size: 13px; color: var(--fg-3); font-feature-settings: "lnum", "tnum"; }
.heptagram { width: 100%; max-width: 380px; display: block; margin: 0 auto; overflow: visible; }
.heptagram text { font-family: var(--body); fill: var(--fg); font-size: 15px; text-anchor: middle; }
.heptagram .wd { font-family: var(--sc); font-size: 11px; fill: var(--accent); letter-spacing: .1em; }
html[lang="zh-CN"] .heptagram .wd { font-family: var(--zh); font-size: 13px; letter-spacing: 0; }
.heptagram path { fill: none; stroke: var(--accent); stroke-width: 1.4; }
.heptagram circle { fill: none; stroke: var(--rule); }
.alpha-table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.alpha-table th { font-family: var(--sc); font-weight: 400; font-size: 12px; letter-spacing: .1em; color: var(--fg-3); text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--fg); }
.alpha-table td { padding: 5px 8px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.alpha-table tr { cursor: pointer; transition: background .2s; }
.alpha-table tbody tr:hover, .alpha-table tr.on { background: var(--bg-3); }
.alpha-table .ph { font-family: var(--phoen); font-size: 21px; }
.alpha-table .hb { font-family: var(--hebrew); font-size: 22px; }
.alpha-table .gk, .alpha-table .lt { font-family: var(--body); font-size: 19px; }
.table-scroll { overflow-x: auto; }
.barnum ol { margin: 0 0 14px; padding-left: 1.2em; display: grid; gap: 6px; }
.barnum li { color: var(--fg); }
.scale { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.scale button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--rule); font-family: var(--display); font-size: 19px; font-feature-settings: "lnum"; background: var(--bg); }
.scale button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.reveal { border-left: 2px solid var(--accent); padding: 4px 0 4px 14px; animation: swap .6s var(--ease); }
.herbarium { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.herb { display: grid; gap: 4px; text-align: center; border-radius: 10px; padding: 10px 8px; background: var(--bg); border: 1px solid var(--rule); transition: transform .4s var(--ease); }
.herb:hover { transform: translateY(-3px); }
.herb img { width: 74px; height: 74px; margin: 0 auto; }
.herb b { font-weight: 400; font-family: var(--display); font-size: 18px; }
html[lang="zh-CN"] .herb b { font-family: var(--zh); }
.herb span { font-size: 13px; color: var(--fg-3); }
.aquarian { height: 10px; border-radius: 999px; margin: 8px 0 18px; background: linear-gradient(90deg, var(--accent), var(--gold), var(--sage), var(--lapis), var(--accent)); background-size: 200% 100%; animation: drift 14s linear infinite; opacity: .85; }
@keyframes drift { to { background-position: 200% 0; } }

/* ---------- table (practice) ---------- */
.practice-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 22px; }
.reading { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 34px; align-items: start; }
.cloth { position: relative; border-radius: 18px; background:
  radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--lapis) 14%, var(--bg-2)), var(--bg-2)); border: 1px solid var(--rule); min-height: 260px; overflow: hidden; }
.cloth .slot { position: absolute; border: 1px dashed var(--fg-3); border-radius: 7px; display: grid; place-items: center; color: var(--fg-3); font-family: var(--sc); font-size: 12px; letter-spacing: .08em; opacity: .7; }
.cloth .slot span { padding: 0 4px; text-align: center; }
.cloth .card { cursor: pointer; }
.cloth .card .face, .cloth .card .backface { position: absolute; inset: 0; border-radius: 7px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flipper { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; transition: transform 1s var(--ease); will-change: transform; }
.flipper .inner { position: relative; width: 100%; height: 100%; transition: transform .9s var(--ease); transform-style: preserve-3d; }
.flipper.up .inner { transform: rotateY(180deg); }
.flipper .side { position: absolute; inset: 0; border-radius: 7px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--shadow); background: var(--stock); padding: 6px; }
.flipper .front { transform: rotateY(180deg); padding: 0; overflow: hidden; }
.flipper .front img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.flipper .front .art { border: 1.2px solid var(--stock-ink); border-radius: 2px; overflow: hidden; aspect-ratio: 5/7; }
.flipper .front .art img { display: block; width: 100%; height: 100%; }
.flipper .front .cap { flex: 1; display: grid; place-items: center; font-family: var(--sc); font-size: 11px; letter-spacing: .05em; white-space: nowrap; overflow: hidden; }
html[lang="zh-CN"] .flipper .front .cap { font-family: var(--zh); }
.flipper.rev .front img { transform: rotate(180deg); }
.flipper .back { background: var(--stock); }
.flipper .back .pat { position: absolute; inset: 6px; border: 1.2px solid var(--stock-ink); border-radius: 3px; background:
  radial-gradient(circle at 50% 50%, #C4583A 0 9%, transparent 10%),
  repeating-conic-gradient(from 0deg at 50% 50%, #2E4B7E 0 7.5deg, #EFE7D6 7.5deg 15deg); opacity: .92; }
.flipper .back .pat::after { content: ""; position: absolute; inset: 18%; border-radius: 50%; background: #EFE7D6; box-shadow: 0 0 0 1.2px #23201B; }
.flipper.hot .side { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.deal-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; }
.deal-bar input[type="text"] { flex: 1 1 240px; min-width: 0; font: inherit; font-size: 17px; color: var(--fg); background: transparent; border: 0; border-bottom: 1px solid var(--rule); padding: 8px 2px; }
.deal-bar input[type="text"]:focus { outline: none; border-bottom-color: var(--accent); }
.odds { font-size: 15px; color: var(--fg-3); margin: 10px 2px 0; }
.odds b { color: var(--fg-2); font-weight: 500; font-feature-settings: "lnum", "tnum"; }
.interp { display: grid; gap: 14px; }
.interp .pos { font-family: var(--sc); letter-spacing: .12em; color: var(--accent); font-size: 13px; }
.interp h3 { font-family: var(--display); font-weight: 400; font-size: 32px; line-height: 1.05; margin: 2px 0 4px; }
html[lang="zh-CN"] .interp h3 { font-family: var(--zh); }
.interp p { margin: 0; color: var(--fg-2); }
.interp .q { font-style: italic; color: var(--fg); border-left: 2px solid var(--accent); padding-left: 12px; }
.interp .empty { color: var(--fg-3); }
.journal { margin-top: 26px; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.journal .entry { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); align-items: baseline; font-size: 16px; }
.journal .entry .d { font-family: var(--sc); letter-spacing: .08em; color: var(--fg-3); font-size: 13px; }
.journal .entry .c { color: var(--fg-2); }
.journal .entry button { color: var(--fg-3); font-size: 13px; font-family: var(--sc); letter-spacing: .08em; }
.drill { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 32px; align-items: start; }
.drill .q-card { background: var(--stock); border-radius: 8px; padding: 8px; box-shadow: var(--shadow); }
.drill .q-card img { display: block; width: 100%; border: 1.2px solid var(--stock-ink); border-radius: 2px; }
.drill .opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.drill .opts button { border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; text-align: left; font-size: 18px; transition: all .25s; }
.drill .opts button:hover { border-color: var(--fg-3); }
.drill .opts button.right { border-color: var(--sage); background: color-mix(in srgb, var(--sage) 18%, transparent); }
.drill .opts button.wrong { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.drill .score { font-family: var(--sc); letter-spacing: .12em; color: var(--fg-3); font-size: 13px; }
.daily { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 18px; align-items: center; padding: 16px; border: 1px solid var(--rule); border-radius: 14px; margin-bottom: 26px; }
.daily .mini { width: 92px; }

/* ---------- library ---------- */
.lib { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 40px; }
.lib h3 { grid-column: 1 / -1; font-family: var(--sc); font-weight: 400; font-size: 14px; letter-spacing: .16em; color: var(--accent); margin: 26px 0 0; padding-top: 12px; border-top: 1px solid var(--fg); }
.book { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 2px 12px; padding: 10px 0; align-content: start; border-bottom: 1px solid var(--rule); }
.book .yr { grid-row: 1 / span 3; font-family: var(--display); font-size: 16px; line-height: 1.5; color: var(--fg-3); font-feature-settings: "lnum"; }
.book .ti { font-style: italic; }
.book .au { color: var(--fg-2); font-size: 16px; }
.book .nt { grid-column: 2; font-size: 15px; color: var(--fg-3); line-height: 1.45; }
.book .pd { font-family: var(--sc); font-size: 11px; letter-spacing: .1em; color: var(--sage); border: 1px solid currentColor; border-radius: 999px; padding: 0 6px; margin-left: 6px; vertical-align: 2px; font-style: normal; white-space: nowrap; }
.credits { columns: 2 320px; column-gap: 40px; font-size: 15.5px; color: var(--fg-2); }
.credits p { margin: 0 0 12px; break-inside: avoid; }

/* ---------- next chapter ---------- */
.next { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: end; margin-top: 80px; padding-top: 22px; border-top: 1px solid var(--fg); }
.next .held { font-size: 16px; color: var(--fg-2); }
.next .held b { font-family: var(--sc); font-weight: 400; letter-spacing: .14em; color: var(--fg-3); font-size: 12.5px; display: block; margin-bottom: 6px; }
.next .held ul { margin: 0; padding-left: 1.1em; display: grid; gap: 3px; }
.next button.go { text-align: right; display: grid; gap: 2px; justify-items: end; padding: 6px 0; }
.next button.go small { font-family: var(--sc); letter-spacing: .14em; color: var(--accent); font-size: 13px; }
.next button.go span { font-family: var(--display); font-size: clamp(28px, 3.4vw, 44px); line-height: 1; transition: transform .4s var(--ease); }
html[lang="zh-CN"] .next button.go span { font-family: var(--zh); }
.next button.go:hover span { transform: translateX(6px); }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: color-mix(in srgb, var(--fg) 24%, transparent); opacity: 0; pointer-events: none; transition: opacity .5s var(--ease); z-index: 50; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer:focus { outline: none; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(760px, 100%); background: var(--bg); z-index: 55; transform: translateX(104%); transition: transform .7s var(--ease); overflow-y: auto; overscroll-behavior: contain; box-shadow: -30px 0 60px -40px rgba(0,0,0,.6); padding: calc(env(safe-area-inset-top, 0px) + 26px) clamp(18px, 4vw, 44px) calc(env(safe-area-inset-bottom, 0px) + 60px); }
.drawer.on { transform: none; }
.drawer .close { position: sticky; top: 0; float: right; z-index: 2; background: var(--bg); }
.dw-top { display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr); gap: 26px; align-items: start; clear: both; }
.plate { position: relative; }
.plate .face { border-radius: 9px; box-shadow: var(--shadow); overflow: hidden; background: var(--stock); }
.plate .face.emb { padding: 9px 9px 0; color: var(--stock-ink); }
.plate .face img { display: block; width: 100%; }
.plate .face.rws img { aspect-ratio: 7/12; object-fit: cover; }
.plate .face.emb img { border: 1.4px solid var(--stock-ink); border-radius: 2px; }
.plate .credit { font-size: 12.5px; color: var(--fg-3); margin-top: 8px; line-height: 1.4; }
.plate .face .cap { text-align: center; font-family: var(--sc); padding: 7px 0 9px; letter-spacing: .08em; font-size: 14px; }
.plate .seg { margin-top: 10px; }
.dw-num { font-family: var(--sc); color: var(--accent); letter-spacing: .14em; font-size: 14px; }
.dw-title { font-family: var(--display); font-weight: 400; font-size: clamp(38px, 5vw, 58px); line-height: .98; margin: 6px 0 4px; letter-spacing: -.01em; }
html[lang="zh-CN"] .dw-title { font-family: var(--zh); }
.dw-zh { font-family: var(--zh); font-size: 22px; color: var(--fg-2); letter-spacing: .3em; }
.dw-zh svg { height: 1.4em; overflow: visible; vertical-align: -.3em; }
.dw-zh svg text { font-family: var(--zh); fill: transparent; stroke: var(--fg); stroke-width: .6; stroke-dasharray: 160; stroke-dashoffset: 160; animation: ink 2.4s var(--ease) .2s forwards; }
html[lang="zh-CN"] .dw-zh svg text { font-family: var(--display); }
@keyframes ink { 60% { stroke-dashoffset: 0; fill: transparent; } to { stroke-dashoffset: 0; fill: var(--fg-2); stroke-width: 0; } }
.dw-epi { font-style: italic; font-size: 21px; color: var(--fg-2); margin: 8px 0 12px; }
.dw-sec .ask { font-style: italic; }
html[lang="zh-CN"] :is(.dw-epi, .dw-sec .ask, .interp .q, .court-grid .rk small, .ranks div .stage-l, .book .ti) { font-style: normal; }
.facts-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.fact { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 10px; font-size: 14px; color: var(--fg-2); line-height: 1.3; }
.fact small { display: block; font-family: var(--sc); font-size: 10.5px; letter-spacing: .12em; color: var(--fg-3); }
.fact .hb { font-family: var(--hebrew); font-size: 20px; color: var(--fg); }
.dw-sec { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--rule); }
.dw-sec > h4 { margin: 0 0 8px; font-family: var(--sc); font-weight: 400; font-size: 13px; letter-spacing: .16em; color: var(--fg-3); }
.dw-sec p { margin: 0 0 10px; max-width: var(--measure); }
.dw-sec .ess { font-family: var(--display); font-size: 25px; line-height: 1.3; color: var(--fg); }
html[lang="zh-CN"] .dw-sec .ess { font-family: var(--zh); font-size: 22px; }
.threads-list { display: grid; gap: 10px; }
.thread { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.thread .dom { font-family: var(--sc); font-size: 12px; letter-spacing: .12em; color: var(--accent); }
.thread p { margin: 0; color: var(--fg-2); font-size: 16.5px; }
.thread .cite { display: block; margin-top: 2px; }
.ls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ls ul { margin: 0; padding-left: 1.05em; color: var(--fg-2); font-size: 16px; }
.ls h5 { margin: 0 0 4px; font-family: var(--sc); font-weight: 400; letter-spacing: .12em; font-size: 12px; }
.ls .l h5 { color: var(--sage); }
.ls .s h5 { color: var(--accent); }
details.waite summary { cursor: pointer; font-family: var(--sc); letter-spacing: .12em; font-size: 13px; color: var(--fg-3); }
details.waite p { font-size: 16.5px; color: var(--fg-2); margin-top: 8px; }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.links button { border: 1px solid var(--rule); border-radius: 999px; padding: 4px 12px 5px; font-size: 15px; color: var(--fg-2); }
.links button:hover { color: var(--fg); border-color: var(--fg-3); }
.links button b { font-family: var(--sc); font-weight: 400; color: var(--accent); font-size: 11.5px; letter-spacing: .1em; margin-right: 6px; }
.kin { display: flex; gap: 8px; flex-wrap: wrap; }
.kin .mini { width: 64px; }

/* ---------- mobile ---------- */
.topbar { display: none; }
@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--veil); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); padding: 10px 16px 8px; gap: 8px 12px; align-items: center; flex-wrap: wrap; }
  .topbar .brand b { font-size: 21px; }
  .topbar .brand span { display: none; }
  .topbar .brand { margin-right: auto; }
  .topbar .strip { order: 3; flex: 1 0 100%; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; margin: 0 -16px; padding: 0 16px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent); }
  .topbar .strip::-webkit-scrollbar { display: none; }
  .topbar .strip button { flex: 0 0 auto; padding: 3px 11px 4px; border-radius: 999px; font-family: var(--body); font-size: 15px; color: var(--fg-2); white-space: nowrap; }
  html[lang="zh-CN"] .topbar .strip button { font-family: var(--zh); font-size: 14px; }
  .topbar .strip button[aria-current="page"] { background: var(--fg); color: var(--bg); }
  .topbar .tools { display: flex; gap: 6px; }
  main { padding-block: 26px 90px; }
  .hero, .loom, .web, .reading, .wheel-wrap { grid-template-columns: minmax(0, 1fr); }
  .formula, .constellation, .web > :first-child { position: static; }
}
@media (max-width: 720px) {
  body { font-size: 18px; }
  .head { grid-template-columns: minmax(0, 1fr); }
  .vignette { display: none; }
  .step { grid-template-columns: minmax(0, 1fr); }
  .step .no { border-top: 0; padding-top: 0; }
  .caption, .myth, .event-card, .ls { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .suits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .suit:nth-child(2) { border-right: 0; }
  .suit:nth-child(3) { padding-left: 0; }
  .suit:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .loom-grid { grid-template-columns: 30px repeat(10, minmax(0, 1fr)); gap: 2px; }
  .loom-grid .rh span { display: none; }
  .court-grid { grid-template-columns: 64px repeat(4, minmax(0, 1fr)); gap: 10px 8px; }
  .court-grid .rk small { display: none; }
  .court-grid .rk { font-size: 16px; }
  .court-grid .cell span { display: none; }
  .ranks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lib { grid-template-columns: minmax(0, 1fr); }
  .dw-top { grid-template-columns: minmax(0, 130px) minmax(0, 1fr); gap: 16px; }
  .thread { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .drill { grid-template-columns: minmax(0, 1fr); }
  .drill .q-card { max-width: 200px; }
  .journal .entry { grid-template-columns: minmax(0, 1fr) auto; }
  .journal .entry .d { grid-column: 1 / -1; }
  .next { grid-template-columns: minmax(0, 1fr); }
  .next button.go { justify-items: start; text-align: left; }
  .daily { grid-template-columns: 70px minmax(0, 1fr); }
  .daily .mini { width: 70px; }
}
/* ---------- Pollack: drawer voice, journey panels, gate cards ---------- */
[hidden] { display: none !important; }
.dw-sec.pol .threads-list { margin-top: 14px; }
.dw-sec.pol > .cite { margin: 12px 0 0; }
button.thread.pl { width: 100%; text-align: left; padding: 0; background: none; border: 0; color: inherit; cursor: pointer; }
button.thread.pl .dom { text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: .28em; }
button.thread.pl:hover p, button.thread.pl:focus-visible p { color: var(--fg); }
.axes, .rows3 { display: grid; gap: 28px; }
.axes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rows3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.axes > div, .rows3 > div { transition: opacity .45s var(--ease); min-width: 0; }
.axes .dim, .rows3 .dim { opacity: .4; }
.axes p, .rows3 p { margin: 0 0 6px; }
.axes p:not(.label), .rows3 p:not(.label) { color: var(--fg-2); font-size: 16.5px; }
.rows3 h4 { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.1; margin: 4px 0 8px; }
html[lang="zh-CN"] .rows3 h4 { font-family: var(--zh); font-size: 21px; }
.colnote { margin: 20px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); color: var(--fg-2); max-width: var(--measure); }
.colnote .label { display: block; margin-bottom: 4px; color: var(--accent); }
.loom-tools { display: grid; justify-items: start; gap: 12px; margin: -6px 0 22px; }
.loom-tools .note { margin: 0; }
.loom-grid button.gate { position: relative; }
.loom-grid button.gate::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.loom-grid.gates button:not(.gate) { opacity: .22; }
.loom-grid.gates button.gate { box-shadow: 0 0 0 1.5px var(--accent); }
.formula .gate-note { margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed var(--rule); }
.formula .gate-note .label { color: var(--accent); margin-right: 8px; }
.pol-suits { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--rule); }
.pol-suits > div > p { margin: 0 0 8px; max-width: var(--measure); }
.pol-suits dl { margin: 22px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 26px; }
.pol-suits dt { font-family: var(--sc); font-size: 12.5px; letter-spacing: .12em; color: var(--accent); }
.pol-suits dd { margin: 2px 0 0; color: var(--fg-2); font-size: 16px; }
.method { list-style: none; counter-reset: m; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 34px; }
.method li { counter-increment: m; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px; min-width: 0; }
.method li::before { content: counter(m, upper-roman) "."; font-family: var(--display); font-size: 19px; color: var(--accent); line-height: 1.3; }
.method b { display: block; font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1.2; margin-bottom: 2px; }
html[lang="zh-CN"] .method b { font-family: var(--zh); font-size: 19px; }
.method span { color: var(--fg-2); font-size: 16px; }
@media (max-width: 1100px) { .pol-suits dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .axes, .rows3, .pol-suits dl, .method { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

/* key phrases in long paragraphs: bold only, since italics crowd letters for dyslexic readers */
strong.kp { font-family: var(--body-k); font-weight: 600; color: color-mix(in srgb, var(--fg) 55%, currentColor); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.plate.rev .face.rws img { transform: rotate(180deg); }
.drill .q-card { background: none; padding: 0; box-shadow: none; }
.drill .q-card img { border: 0; border-radius: 8px; box-shadow: var(--shadow); aspect-ratio: 7/12; object-fit: cover; }
.drill .q-card { position: relative; }
/* sits on the scan's own title band (about the bottom 9%, inside the black frame), so it uses the card's constant stock colors */
.drill .q-card .veil { position: absolute; left: 1.4%; right: 3.4%; bottom: 1.1%; height: 9%; display: grid; place-items: center; background: var(--stock); border: 1.2px solid var(--stock-ink); color: var(--stock-ink); font-family: var(--display); font-size: 17px; line-height: 1; transition: opacity .5s var(--ease); pointer-events: none; }
.drill .q-card.shown .veil { opacity: 0; }
.formula .result img { aspect-ratio: 7/12; object-fit: cover; }
.tone img { aspect-ratio: 7/12; object-fit: cover; }
