@font-face {
  font-family: "Newsreader Local";
  src: url("/desk/assets/newsreader.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "DM Sans Local";
  src: url("/desk/assets/dm-sans.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans SC Reading";
  src: url("/desk/assets/noto-sans-sc-reading.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #f2e8d7;
  --ink-soft: #dfd0ba;
  --muted: #bcad9a;
  --metal: #d6ae73;
  --metal-light: #f0d7a8;
  --metal-deep: #855f35;
  --cinnabar: #b94b3a;
  --cinnabar-bright: #d96b59;
  --cinnabar-soft: #a13d2e33;
  --patina: #7b9282;
  --graphite: #13110e;
  --graphite-warm: #1e1913;
  --paper-dark: #251e16;
  --paper-elev: #2c231a;
  --line: #a7855644;
  --line-strong: #c9a16866;
  --serif: "Songti SC", "Noto Serif SC", STSong, SimSun, Georgia, serif;
  --sans: "DM Sans Local", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --gutter: clamp(18px, 5vw, 76px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: #886844 #13110e; }
body {
  margin: 0;
  background: var(--graphite);
  color: var(--ink);
  font: 15px/1.7 var(--sans);
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
button, textarea, select, input { color: inherit; font: inherit; }
button { cursor: pointer; }
::selection { background: #b58e5f; color: #17120d; }
:focus-visible { outline: 2px solid var(--metal-light); outline-offset: 4px; }
:where(section[id], main[id]) { scroll-margin-top: 24px; }
[hidden] { display: none !important; }

.shell { width: min(100%, 1320px); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip:focus { position: absolute; z-index: 20; top: 8px; left: 12px; background: #30261c; padding: 10px 14px; border: 1px solid var(--metal); }
.muted { color: var(--muted); font-size: .88rem; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--metal);
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}
:lang(zh-CN) .eyebrow { letter-spacing: .22em; }

.seal-chip {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border: 1px solid #c95a4899;
  background: radial-gradient(circle at 35% 30%, #c754423b, #69211740);
  color: #f09585;
  font: 600 15px/1 var(--serif);
  box-shadow: inset 0 0 0 2px #1a120d99;
}
.seal-small { width: 24px; height: 24px; font-size: 13px; }

/* Masthead */
.masthead {
  position: relative;
  z-index: 4;
  border-bottom: 1px solid #c69d682b;
  background: linear-gradient(180deg, #171410, #13110e);
}
.masthead-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; gap: 11px; align-items: center; font: 500 24px/1 "Newsreader Local", Georgia, serif; white-space: nowrap; }
.brand-seal {
  display: grid; place-items: center; width: 29px; height: 29px;
  border: 1px solid #c7a47188; color: var(--metal-light);
  background: radial-gradient(circle at 35% 30%, #7d593138, transparent);
  font: 17px/1 var(--serif);
}
nav { display: flex; gap: clamp(13px, 3vw, 36px); font-size: .9rem; }
nav a { padding-block: 10px; color: var(--muted); white-space: nowrap; transition: color 180ms ease; }
nav a:hover { color: var(--metal-light); }
.language { color: var(--metal-light); }

/* Opening & Antique Bronze Bagua Instrument */
.opening {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: clamp(24px, 3.8vh, 48px) 36px;
  background:
    radial-gradient(ellipse 68% 58% at 50% 56%, #34271b 0%, #1d1812 48%, #13110e 84%);
  text-align: center;
  overflow: clip;
}
.opening::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c9a16845 25% 75%, transparent);
}
.opening-copy { position: relative; z-index: 1; }
.opening h1 {
  margin: 0;
  font: 600 clamp(38px, 5.1vw, 70px)/1.13 var(--serif);
  letter-spacing: -.025em;
  text-wrap: balance;
  text-shadow: 0 5px 35px #0e0c08;
}
.opening h1 span { display: block; color: var(--metal-light); }
:lang(en) .opening h1 { font-family: "Newsreader Local", Georgia, serif; font-weight: 500; }
.opening-copy p {
  max-width: 42em; margin: 18px auto 0; color: #e5d1b2;
  font: 400 clamp(1rem, 1.65vw, 1.25rem)/1.55 var(--serif);
  text-wrap: balance; text-shadow: 0 1px 16px #090705;
}
:lang(en) .opening-copy p { font-family: "Newsreader Local", Georgia, serif; }

.instrument {
  --dial-size: clamp(300px, 48vw, 495px);
  --bronze-plate: url("/desk/assets/desk.png");
  --panel-width: min(calc(100vw - 28px), 492px);
  --spread: 0px;
  position: relative;
  isolation: isolate;
  width: min(100% - 28px, 560px);
  min-height: var(--dial-size);
  margin-top: 14px;
  scroll-margin-top: min(30vh, 250px);
  display: grid;
  place-items: center;
}
.instrument[data-state="open"] { --spread: calc(var(--panel-width) / 2 + 4px); }
.dial-seat {
  position: absolute; z-index: 2; top: calc(var(--dial-size) / 2); left: 50%;
  width: var(--dial-size); aspect-ratio: 1; pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(2px 17px 22px #080604b5);
  transition: transform 680ms cubic-bezier(.19,1,.22,1), opacity 430ms ease;
}
.dial-half { position: absolute; inset: 0; }
.dial-half:first-child:has(+ .dial-half) {
  clip-path: inset(-12px 50% -18px -12px);
  transform: translateX(calc(-1 * var(--spread)));
}
.dial-half + .dial-half {
  clip-path: inset(-12px -12px -18px 50%);
  transform: translateX(var(--spread));
}
.dial-base, .dial-ring, .dial-face, .dial-light { position: absolute; inset: 0; border-radius: 50%; }
.dial-base {
  background: radial-gradient(circle,#292017 31%,#1a130d 59%,#120d08 87%,#755132 96%,#2b1c11 99%);
  box-shadow: 0 6px 2px #21170f,0 11px 3px -3px #5c4127;
}
.dial-face {
  background: var(--bronze-plate) 49.18% 82.35% / 224.56% 149.71% no-repeat;
  animation: bronze-turn var(--cycle) linear infinite var(--direction, normal);
}
.dial-outer { --cycle: 154s; mask-image: radial-gradient(circle closest-side,transparent 75%,#000 76%); }
.dial-trigrams {
  --cycle: 104s; --direction: reverse;
  mask-image: radial-gradient(circle closest-side,transparent 47%,#000 48% 74.5%,transparent 75%);
}
.dial-hours { --cycle: 124s; mask-image: radial-gradient(circle closest-side,transparent 37%,#000 38% 46%,transparent 47%); }
.dial-hours .dial-face {
  background-image: radial-gradient(circle,transparent 35%,#8d694270 41%,transparent 47%),var(--bronze-plate);
  background-size: 100% 100%,224.56% 149.71%;
  background-position: center,49.18% 82.35%;
}
.dial-hours span {
  position: absolute; left: 50%; top: 50%;
  color: #f4d7a5; text-shadow: 0 1px 3px #110a05,0 0 4px #22140b;
  font: 600 clamp(.56rem, 1.15vw, .88rem)/1 var(--serif);
  transform: translate(-50%,-50%) rotate(var(--angle)) translateY(calc(var(--dial-size) * -.214));
}
.instrument[data-dormant] .dial-face, .instrument[data-state] .dial-face { animation-play-state: paused; }
.dial-light {
  opacity: .1;
  background: conic-gradient(from 220deg, transparent 6%, #f5bd77 21%, transparent 34%, transparent 100%);
  mask-image: radial-gradient(circle closest-side,transparent 30%,#000 48% 99%,transparent);
  mix-blend-mode: screen;
  transition: opacity 240ms ease;
}
.dial-index {
  position: absolute; width: 4.3%; height: 6%; left: 50%; top: -.5%;
  transform: translateX(-50%);
  background: linear-gradient(90deg,#7a532e,#e5bc7e 46%,#805938 92%);
  clip-path: polygon(5% 0,95% 0,86% 58%,50% 100%,14% 58%);
}
.dial-lock {
  position: absolute; inset: 31.5%;
  background:
    linear-gradient(90deg,transparent 49%,#c0955e88 49.7%,#160f0b 50%,#160f0b 50.4%,transparent 50.8%),
    radial-gradient(circle,transparent 32%,#2a1d12a6 37% 65%,#201710 68%,#957044a8 69%,transparent 72%),
    var(--bronze-plate) 49.4% 66.5% / 530% 355% no-repeat;
  clip-path: polygon(29% 0,71% 0,100% 29%,100% 71%,71% 100%,29% 100%,0 71%,0 29%);
  box-shadow: inset 0 0 0 3px #9770479c,inset 0 5px 9px #180f0a;
}
.dial-lock span {
  position: absolute; left: 50%; top: 50%;
  font: 600 clamp(.69rem, 2vw, 1.18rem)/1 var(--serif);
  color: #cfaa74; text-shadow: 1px 1px #140d08,0 0 6px #322216;
  transform: translate(-50%,-50%) rotate(var(--angle)) translateY(calc(var(--dial-size) * -.113));
}
.instrument:has(.open-chart:is(:hover,:focus-visible)) .dial-light { opacity: .38; }
.instrument[data-state="opening"] .dial-light { opacity: .48; }
.instrument:is([data-state="unlatching"],[data-state="open"]) .dial-light { opacity: .06; }
@keyframes bronze-turn { to { transform: rotate(360deg); } }

.open-chart {
  align-self: center; position: relative; z-index: 3;
  display: grid; align-content: center;
  width: 128px; aspect-ratio: 1; padding: 10px;
  background: transparent; color: var(--ink); border: 0; border-radius: 50%;
  transition: color 180ms ease, transform 200ms ease;
}
.open-chart strong {
  position: absolute; top: 89%; left: 50%; transform: translateX(-50%);
  padding: 7px 14px; white-space: nowrap;
  background: linear-gradient(#42311f,#271d14);
  border-block: 1px solid #b68e59c4;
  box-shadow: 0 6px 16px #0d0805c7;
  font: 600 1.04rem/1.25 var(--serif);
}
:lang(en) .open-chart strong { font: 500 1.07rem/1.25 "Newsreader Local", Georgia, serif; }
.open-chart:hover, .open-chart:focus-visible { color: var(--metal-light); }
.instrument:is([data-state="opening"],[data-state="unlatching"]) .open-chart { opacity: 0; }
.instrument > .open-chart, .instrument > .chart-panel { grid-area: 1 / 1; }

.opening-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; padding-inline: 12px; margin-top: 6px; }
.opening-actions .text-link { padding: 11px 12px; font-size: .96rem; }

/* Shared Buttons & Links */
.button {
  display: inline-flex;
  min-height: 46px;
  justify-content: center;
  align-items: center;
  padding: 8px 22px;
  border: 1px solid var(--metal);
  font-weight: 600;
  letter-spacing: .02em;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 160ms ease;
}
.primary { background: linear-gradient(180deg, #dfb87c, #c49757); color: #1d1409; border-color: #ebc98e; box-shadow: 0 4px 14px #0a070466; }
.primary:hover { background: linear-gradient(180deg, #f0d39d, #d6aa68); border-color: #f6e1b8; }
.secondary { color: var(--ink); background: #231c14d9; border-color: #b48e5a9e; }
.secondary:hover { background: #36291b; border-color: var(--metal-light); }
.secondary[aria-pressed="true"] { background: #3e2e1d; border-color: var(--metal-light); color: var(--metal-light); }
.text-link {
  background: transparent;
  padding: 5px 0;
  border: 0;
  text-decoration: underline;
  text-underline-offset: .32em;
  text-decoration-color: #b18b56b3;
  color: var(--metal-light);
  text-align: left;
  font-size: .9rem;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}
.text-link:hover { color: #fff3d9; text-decoration-color: #fff3d9; }

/* Open Bronze Chamber: Birth Shells -> Continuous Crack Tree -> Four Pillars */
.chart-panel {
  position: relative; z-index: 1; isolation: isolate;
  --shell-image: url("/desk/assets/tortoise-scute.webp");
  width: var(--panel-width); margin-block: 16px; padding: clamp(16px, 3vw, 26px);
  clip-path: inset(0 max(0px, calc(50% - var(--spread))));
  text-align: left;
}
.chart-panel::before {
  content: ""; position: absolute; z-index: -1; inset: -14% -4%;
  background: radial-gradient(ellipse at 50% 44%, #52361f70 2%, #31231750 38%, transparent 74%);
  pointer-events: none;
}
.chart-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.chart-heading-row h2 { font-size: clamp(1.44rem, 3.8vw, 1.85rem); color: var(--metal-light); }
.chart-heading-row h2:focus { outline: none; }
:lang(en) .chart-heading-row h2 { font-family: "Newsreader Local", Georgia, serif; font-weight: 500; }
.chart-heading-row button { min-height: 44px; padding-inline: 8px; }

.chamber-stage { position: relative; }

.chart-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .62fr); gap: 12px; }
.chart-fields fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.chart-fields :is(legend,.birth-place > span) { color: #ddcab0; padding: 0; margin-bottom: 4px; font-size: .8rem; }
.birth-reels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); gap: 3px; }
.birth-date .birth-reels { grid-template-columns: minmax(0,1.12fr) repeat(2,minmax(0,1fr)); }
.birth-reel {
  position: relative; isolation: isolate; display: grid; place-items: center;
  min-width: 0; min-height: clamp(58px, 11vw, 84px);
}
.birth-reel::before, .shell-mark, .nexus-scute {
  background: var(--shell-image) center / contain no-repeat;
  filter: saturate(.78) drop-shadow(1px 4px 5px #0d0805c4);
}
.birth-reel::before {
  content: ""; position: absolute; z-index: -1; inset: 0;
  transform: rotate(var(--shell-tilt, -5deg));
  transition: filter 180ms ease;
}
.birth-reel:nth-child(2)::before { --shell-tilt: 6deg; }
.birth-reel:nth-child(3)::before { --shell-tilt: -2deg; }
.birth-time .birth-reel:first-child::before { --shell-tilt: 3deg; }
.birth-time .birth-reel:last-child::before { --shell-tilt: -8deg; }
.birth-reel select { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; font-size: 16px; opacity: 0; cursor: pointer; }
.birth-reel::after {
  content: ""; position: absolute; top: 66%; width: 4px; height: 4px;
  border-right: 1px solid #d0aa76; border-bottom: 1px solid #d0aa76;
  transform: rotate(45deg); pointer-events: none;
}
.birth-reel:hover::before, .birth-reel:focus-within::before, .cast-chart:hover .shell-mark {
  filter: saturate(.82) brightness(1.2) drop-shadow(1px 4px 6px #0d0805c4);
}
.birth-reel:has(select:focus-visible) { outline: 1px solid var(--metal-light); outline-offset: 1px; border-radius: 34%; z-index: 2; }
.reel-value {
  padding: 0 2px 4px; font: 600 clamp(.81rem, 2.2vw, 1.15rem)/1 var(--serif);
  font-variant-numeric: tabular-nums; color: #ffedcb; text-shadow: 0 1px 4px #100802;
  white-space: nowrap; pointer-events: none;
}
.birth-place { grid-column: 1 / -1; display: grid; }
.birth-place select {
  width: 100%; min-height: 44px; border: 0; border-bottom: 1px solid #a37c515c;
  background: linear-gradient(90deg,#37271a83,transparent); border-radius: 0; padding: 5px 8px;
}
.birth-place option { background: #231a12; }
.chart-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 17px; margin-top: 10px; }
.cast-chart {
  display: inline-flex; align-items: center; gap: 8px; min-height: 54px; padding: 0 4px 0 0;
  border: 0; background: transparent;
  color: #f4d6a4; font: 600 clamp(.96rem, 3.3vw, 1.16rem)/1.2 var(--serif);
}
.cast-chart span:last-child {
  padding: 4px 0;
  border-bottom: 1px solid #b08250a8;
  text-shadow: 0 2px 3px #190e08;
}
.shell-mark { width: 37px; height: 45px; transform: rotate(-13deg); transition: filter 180ms ease; }
.cast-chart:hover { color: #fff1d8; }
#chart-form { position: relative; z-index: 2; }
#chart-form[aria-busy="true"] { pointer-events: none; }
#chart-form[aria-busy="true"] .birth-reel::after { opacity: 0; }
#chart-form :is(legend,.birth-place,.chart-submit,.chart-support) { transition: opacity 240ms ease; }
#chart-form[aria-busy="true"] :is(legend,.birth-place,.chart-submit,.chart-support) { opacity: 0; }
.chart-submit .text-link { min-height: 44px; }
.chart-support { display: flex; align-items: center; justify-content: space-between; gap: 1px 12px; flex-wrap: wrap; margin-top: 5px; color: var(--muted); font-size: .76rem; }
.chart-support .text-link { font-size: inherit; }
#chart-status { margin: 8px 0 0; min-height: 1.4em; }
#chart-status:empty { margin: 0; min-height: 0; }

/* Continuous Crack Canopy & Pillar Reveal */
.chart-result { position: relative; z-index: 1; }
.chart-result[data-overlay="true"] { position: absolute; inset: 0 0 auto; }

.crack-canopy {
  position: relative;
  width: 100%;
  margin-bottom: -1px;
}
.shell-nexus {
  position: absolute;
  left: 50%;
  top: 2px;
  width: clamp(58px, 14vw, 72px);
  height: clamp(58px, 14vw, 72px);
  transform: translateX(-50%);
  z-index: 1;
  pointer-events: none;
}
.shell-nexus::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, #f3a65252 0%, #c6763022 48%, transparent 72%);
  opacity: .55;
  transition: opacity 420ms ease;
}
.chart-result[data-casting="true"] .shell-nexus::after { opacity: 1; }
.nexus-scute { position: absolute; inset: 0; }
.nexus-scute-back { transform: translate(-5px, 3px) rotate(-14deg) scale(.92); opacity: .7; }
.nexus-scute-mid { transform: translate(5px, 1px) rotate(11deg) scale(.95); opacity: .82; }
.nexus-scute-top { transform: rotate(-2deg); }

.crack-svg {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.crack-path {
  fill: none;
  stroke: url(#crack-grad);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.crack-primary { stroke-width: 2.5; }
.crack-branch { stroke-width: 1.85; }
.crack-fine { stroke-width: 1.05; opacity: .78; }
.crack-node {
  fill: #fff1cc;
  stroke: #d4964c;
  stroke-width: 1.4;
}
.chart-result[data-settled="true"] .crack-glow-group { filter: none; }
.chart-result[data-settled="true"] .crack-path { opacity: .82; }
.chart-result[data-settled="true"] .crack-node { fill: var(--metal-light); }

/* Pillar Slips (Unified Across Desk) */
.slips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid #b48c5854;
  background: linear-gradient(165deg, #523d2824, transparent 74%), #181410;
}
.slip {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  min-width: 0;
  min-height: 92px;
  padding: 12px 4px 12px;
  margin: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink);
  background: transparent;
  text-align: center;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.slip + .slip { border-left: 1px solid #a8835530; }
.slip .slip-pillar { color: #d5bea0; font-size: .72rem; line-height: 1.2; letter-spacing: .06em; }
.slip strong {
  display: block;
  padding-top: 7px;
  color: #f0cf9b;
  font: 600 clamp(1.1rem, 2.5vw, 1.85rem)/1.15 var(--serif);
  white-space: nowrap;
  text-shadow: 0 2px 3px #0e0b08;
}
.slip .slip-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
button.slip:hover, button.slip[aria-pressed="true"] {
  border-bottom-color: var(--metal-light);
  background: linear-gradient(180deg, #9b73462c, #694a2926);
}
.slip[data-empty] strong { font-size: .8rem; color: var(--muted); font-family: var(--sans); font-weight: 500; }

.result-slips {
  border-top: 1px solid #c69a6066;
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, #c4945685 16% 84%, transparent) 1;
  background: radial-gradient(ellipse at 50% 0%, #7d532b42, #18130eb3 78%);
}
.result-slips .slip { min-height: 102px; padding-top: 14px; }
.result-slips .slip::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 7px;
  background: var(--metal-light);
  transform: translateX(-50%);
  opacity: .75;
}
.result-slips .slip + .slip { border-left-color: #b7874d33; }
.result-slips .slip strong { color: #f6d9a8; font-size: clamp(1.32rem, 4.2vw, 1.95rem); }

.chart-notes { margin-top: 12px; font-size: .84rem; color: var(--ink-soft); }
.chart-notes p { margin: 0 0 6px; }
.chart-result-actions { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.chart-result-actions .text-link { min-height: 40px; }

.carry-layer { position: fixed; z-index: 25; inset: 0; overflow: hidden; pointer-events: none; }
.carry-layer .slip { position: absolute; margin: 0; min-width: 0; min-height: 0; background: #261e15; border: 1px solid #c69d6673; box-shadow: 0 10px 24px #08060485; }

/* Scholar's Desk Lower Surface */
.desk {
  position: relative;
  background:
    radial-gradient(ellipse 75% 420px at 50% 0%, #2a211799, transparent 70%),
    linear-gradient(180deg, #161310 0%, #1e1913 24%, #191510 62%, #13110e 100%);
}
.scene { padding-block: clamp(52px, 7.5vw, 108px); }
.scene + .scene {
  border-top: 1px solid var(--line);
}
h2 { margin: 0; font: 600 clamp(1.85rem, 3.6vw, 3.1rem)/1.18 var(--serif); letter-spacing: -.015em; }
:lang(en) h2, :lang(en) h3 { font-family: "Newsreader Local", Georgia, serif; font-weight: 500; }

/* Section 2: Redesigned Illustrated, Tactile Casebook (#case) */
.section-line {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: clamp(22px, 3.2vw, 40px);
}
.case-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  background: #1a1510;
}
.case-tabs button {
  position: relative;
  padding: 9px 18px;
  min-height: 42px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  font-size: .92rem;
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}
.case-tabs button:hover { color: var(--ink); }
.case-tabs button[aria-selected="true"] {
  color: var(--metal-light);
  background: linear-gradient(180deg, #382b1d, #281f16);
  border-color: #b78d5885;
}
.case-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 18% -1px;
  height: 2px;
  background: var(--cinnabar-bright);
}

.folio {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.12fr);
  gap: clamp(28px, 6vw, 88px);
  align-items: start;
  padding: clamp(24px, 4.8vw, 56px);
  border: 1px solid #b58d584d;
  background:
    radial-gradient(ellipse at 18% 22%, #4735222e, transparent 62%),
    linear-gradient(108deg, #282118 0%, #211b14 48%, #261f16 52%, #292118 100%);
  box-shadow:
    inset 0 1px 0 #e6c48f29,
    0 24px 56px #0705036e;
}
.folio::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid #b58d581f;
  pointer-events: none;
}

/* Stitched Thread-Bound Spine */
.folio-spine {
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 45.4%;
  width: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  pointer-events: none;
}
.folio-spine::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  width: 1px;
  background: linear-gradient(180deg, transparent, #0f0b08 12% 88%, transparent);
  box-shadow: 1px 0 0 #c9a1681f;
}
.folio-spine span {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #694d2c, #c9a168, #694d2c);
  opacity: .55;
}

.folio-record { position: relative; z-index: 1; }
.record-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.record-label { margin: 0; font-size: .9rem; color: var(--ink); font-weight: 500; }
.birth-note { margin: 2px 0 0; font-size: .82rem; }

/* Stem-Relationship Illustrated Schematic */
.stem-bridge {
  position: relative;
  margin-bottom: -2px;
  padding-top: 20px;
  transition: opacity 240ms ease;
}
.stem-bridge-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.bridge-arc {
  fill: none;
  stroke: var(--cinnabar-bright);
  stroke-width: 1.75;
  stroke-dasharray: 0;
  transition: stroke 220ms ease, opacity 220ms ease;
}
.bridge-arrow {
  fill: none;
  stroke: var(--cinnabar-bright);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bridge-dot {
  fill: var(--metal-light);
  stroke: var(--cinnabar-bright);
  stroke-width: 1.5;
}
.bridge-tag {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 11px;
  white-space: nowrap;
  font-size: .75rem;
  color: #f4d3a4;
  background: #2b1d15;
  border: 1px solid #c95a4880;
  letter-spacing: .03em;
  box-shadow: 0 4px 12px #09060466;
}
.stem-bridge[data-active="false"] { opacity: .55; }
.stem-bridge[data-active="false"] .bridge-arc { stroke: var(--metal); stroke-dasharray: 4 4; }
.stem-bridge[data-active="false"] .bridge-arrow { stroke: var(--metal); }
.stem-bridge[data-pulse="true"] .bridge-tag { border-color: #f09585; background: #3e2219; }

/* Carved Wooden Tally Slips */
.case-slips {
  border: 1px solid #b58d5852;
  background: #17130f;
}
.case-slips .slip {
  min-height: clamp(104px, 10vw, 134px);
  padding: 16px 4px 14px;
  background: linear-gradient(180deg, #241c14, #19140f);
}
.case-slips .slip::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #5b432a;
  border: 1px solid #b58d5870;
  transform: translateX(-50%);
}
.case-slips .slip[data-evidence="true"]::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cinnabar-bright);
  box-shadow: 0 0 6px #d96b5999;
}
.case-slips .slip[aria-pressed="true"] {
  background: linear-gradient(180deg, #3c2c1c, #271e15);
  border-bottom-color: var(--cinnabar-bright);
  box-shadow: inset 0 1px 0 #f0d7a84d;
}
.case-slips .slip[aria-pressed="true"]::before {
  background: var(--metal-light);
  border-color: var(--metal-light);
}

.tally-hint {
  margin: 10px 0 0;
  font-size: .78rem;
  color: var(--muted);
}

.record-note {
  margin-top: 14px;
  padding: 13px 15px;
  border-left: 2px solid var(--cinnabar-bright);
  background: linear-gradient(90deg, #3523199e, #241b1340);
  color: var(--ink);
  font-size: .92rem;
  min-height: 4.8em;
}

/* Right Leaf: Illustrated Vignette + Reading Cards */
.folio-reading { position: relative; z-index: 1; }
.case-vignette {
  margin-bottom: 18px;
  padding: 12px 14px 10px;
  border: 1px solid #b58d5836;
  background: radial-gradient(ellipse at 50% 42%, #3a2b1c55, #18130e 82%);
}
.case-vignette svg { display: block; width: 100%; height: auto; }
.vignette-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #b58d5824;
  font-size: .74rem;
  color: var(--muted);
}

.folio h3 { margin: 0 0 10px; font: 600 clamp(1.6rem, 2.8vw, 2.35rem)/1.2 var(--serif); color: var(--ink); }
.folio-reading > p { margin: 0 0 18px; color: var(--ink-soft); }

.reading { margin: 0 0 20px; display: grid; gap: 12px; }
.reading-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #a7855638;
  background: linear-gradient(125deg, #2d241a99, #1f1913cc);
}
.reading-card[data-kind="quote"] { border-left: 2px solid var(--metal); }
.reading-step-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #b78d586b;
  color: var(--metal-light);
  font: 600 .8rem/1 var(--serif);
  background: #1b150f;
}
.reading-body { min-width: 0; }
.reading-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 4px; }
.reading dt { color: var(--metal-light); font-size: .86rem; font-weight: 600; letter-spacing: .02em; }
.reading dd { margin: 0; color: var(--ink); font-size: .94rem; }
.stem-callout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border: 1px solid #c95a4880;
  background: #3a2019;
  color: #f4c89b;
  font-size: .74rem;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.stem-callout:hover { background: #52291f; border-color: #f09585; }

.folio-foot { padding-top: 4px; }

/* Section 3: Calm 3-Step Question Sequence (#ask) */
.entry-head { margin-bottom: clamp(22px, 3vw, 38px); }
.entry-head p { margin: 10px 0 0; max-width: 44em; color: var(--muted); }

.consultation-desk { width: min(100%, 820px); margin-inline: auto; }

/* Sequence Progress Rail */
.ritual-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
}
.ritual-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #a7855630;
  background: #1a1510;
  color: var(--muted);
  font-size: .86rem;
  transition: border-color 220ms ease, background-color 220ms ease, color 220ms ease;
}
.ritual-steps .step-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border: 1px solid #a7855659;
  font: 600 .78rem/1 var(--serif);
  color: var(--metal);
}
.ritual-steps li[aria-current="step"] {
  border-color: var(--metal);
  background: linear-gradient(180deg, #32261a, #231b13);
  color: var(--metal-light);
}
.ritual-steps li[aria-current="step"] .step-num {
  background: var(--cinnabar);
  border-color: #e47f6e;
  color: #fff3e4;
}
.ritual-steps li[data-done="true"] {
  border-color: #a7855666;
  color: var(--ink-soft);
}

/* Attached Chart Header Ribbon */
.ask-record {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #b58d584d;
  background: linear-gradient(90deg, #271f16, #1c1611);
}
.ask-record-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.ask-slips { width: min(100%, 420px); }
.ask-slips .slip { min-height: 70px; padding: 8px 4px; }
.ask-slips .slip strong { font-size: clamp(1.05rem, 2.4vw, 1.45rem); padding-top: 4px; }

/* Stage 1: Scholar's Ruled Writing Slip */
.question-paper {
  position: relative;
  padding: clamp(20px, 3.2vw, 30px);
  border: 1px solid #c69e7357;
  background:
    linear-gradient(180deg, #2e241a, #241c14 75%, #201912);
  box-shadow: 0 14px 36px #09060466;
}
.paper-corner {
  position: absolute;
  width: 11px;
  height: 11px;
  border-color: var(--metal);
  border-style: solid;
  opacity: .75;
  pointer-events: none;
}
.paper-corner.tl { top: 6px; left: 6px; border-width: 1px 0 0 1px; }
.paper-corner.tr { top: 6px; right: 6px; border-width: 1px 1px 0 0; }
.paper-corner.bl { bottom: 6px; left: 6px; border-width: 0 0 1px 1px; }
.paper-corner.br { bottom: 6px; right: 6px; border-width: 0 1px 1px 0; }

.question-label {
  display: block;
  margin-bottom: 8px;
  color: var(--metal-light);
  font-size: .84rem;
  letter-spacing: .04em;
}
#question {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 92px;
  max-height: 280px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #b58d5845;
  background:
    repeating-linear-gradient(180deg, transparent 0 33px, #b58d5814 33px 34px),
    #19140fcc;
  color: var(--ink);
  line-height: 1.7;
  caret-color: var(--metal-light);
}
#question::placeholder { color: #a99985; }
#question:focus { border-color: var(--metal); outline: none; box-shadow: 0 0 0 1px #d6ae7366; }

.question-actions { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.question-actions button[aria-disabled="true"] { cursor: progress; opacity: .78; }

/* Stage 2: Lacquer Lot Vessel & Wooden Cradle */
.lot-ritual {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr);
  align-items: center;
  gap: 18px 28px;
  padding: 18px clamp(16px, 3vw, 28px);
  border-inline: 1px solid #a7855636;
  border-bottom: 1px solid #a7855640;
  background:
    radial-gradient(ellipse at 18% 55%, #59381f38, transparent 58%),
    linear-gradient(180deg, #1d1712, #17130f);
}
.vessel-wrap { display: grid; place-items: center; }
.lot-vessel-svg { width: 148px; height: auto; overflow: visible; filter: drop-shadow(0 10px 16px #070503b3); }
.vessel-group { transform-origin: 90px 128px; }

.cradle-wrap { min-width: 0; }
.lot-cradle {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 68px;
  padding: 14px 20px;
  border-block: 1px solid #a7855645;
  background:
    radial-gradient(ellipse at 50% 50%, #5c3e242e, transparent 74%),
    #14100d;
}
.lot-cradle::before, .lot-cradle::after {
  content: "";
  position: absolute;
  bottom: 8px;
  width: 14px;
  height: 5px;
  background: linear-gradient(90deg, #6e4e2a, #c79d62, #6e4e2a);
  opacity: .75;
}
.lot-cradle::before { left: 18%; }
.lot-cradle::after { right: 18%; }
.cradle-placeholder { color: var(--muted); font-size: .84rem; letter-spacing: .08em; }

.lot-tally {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #d7ae7299;
  background: linear-gradient(180deg, #e2ba7c, #c29354 55%, #9f723c);
  color: #241509;
  box-shadow: 0 6px 18px #080503a6;
}
.lot-tally-tip {
  width: 24px;
  flex: none;
  background: linear-gradient(180deg, #c95240, #963426);
  border-right: 1px solid #632016;
}
.lot-tally-body {
  padding: 8px 18px;
  font: 600 .96rem/1.2 var(--serif);
  letter-spacing: .08em;
  white-space: nowrap;
}

/* Stage 3: Unfolded Reading & Clear Follow-Up */
.question-receipt {
  padding: clamp(20px, 3.2vw, 30px);
  border: 1px solid #b58d5857;
  border-top: 0;
  background: linear-gradient(180deg, #322519 0%, #241c14 38%, #1e1812 100%);
  box-shadow: 0 18px 42px #08060475;
}
.receipt-asked-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
#asked {
  margin: 0;
  font-size: 1.04rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.choices-label {
  margin: 16px 0 10px;
  color: var(--metal-light);
  font-size: .82rem;
  letter-spacing: .06em;
}
.branch-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.branch-choices button {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid #b389526e;
  color: var(--ink);
  background: #221a12;
  text-align: left;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}
.branch-choices button:hover { border-color: var(--metal-light); background: #302418; }
.branch-choices button .branch-badge {
  flex: none;
  padding: 2px 6px;
  border: 1px solid #b3895275;
  font: 600 .72rem/1.1 var(--serif);
  color: var(--metal-light);
  margin-top: 2px;
}
.branch-choices button[aria-pressed="true"] {
  color: #24170a;
  background: linear-gradient(178deg, #ecd0a1, #ca9f62);
  border-color: #f4deb6;
  box-shadow: 0 4px 14px #0a070466;
}
.branch-choices button[aria-pressed="true"] .branch-badge {
  border-color: #69441e;
  background: #3a2310;
  color: #f6ddb0;
}

.answer-folio {
  margin-top: 16px;
  padding: 16px 18px;
  border-left: 2px solid var(--metal);
  background: #19140fd1;
}
.answer { margin: 0; min-height: 2.8em; color: var(--ink); overflow-wrap: anywhere; }
.refine-link { margin-top: 10px; font-size: .84rem; }

#previous-question {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
#previous-question summary { cursor: pointer; color: var(--metal-light); font-size: .88rem; }
#previous-question p { margin: 6px 0 0; font-size: .88rem; }

/* Section 4: Twin Lacquer Comparison Case (#pair) */
.pair-case {
  border: 1px solid #b58d5852;
  background:
    radial-gradient(ellipse at 50% 0%, #44311f38, transparent 66%),
    linear-gradient(180deg, #251e16, #1b1611);
  box-shadow: 0 18px 46px #0705035c;
}
.pair details { border: 0; }
.pair summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px clamp(16px, 3vw, 28px);
  color: var(--metal-light);
  cursor: pointer;
  list-style: none;
  font-size: 1rem;
  font-weight: 500;
}
.pair summary::-webkit-details-marker { display: none; }
.pair-summary-icon { display: inline-flex; color: var(--metal); opacity: .9; }
.pair-summary-text { flex: 1; }
.pair-summary-chevron {
  width: 10px;
  height: 10px;
  border-right: 1.5px solid var(--metal-light);
  border-bottom: 1.5px solid var(--metal-light);
  transform: rotate(45deg);
  transition: transform 220ms ease;
}
.pair details[open] .pair-summary-chevron { transform: rotate(-135deg); }
.pair details[open] summary { border-bottom: 1px solid var(--line); background: #2b221866; }

.pair-board { padding: clamp(18px, 3.2vw, 32px); }

.comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 4vw, 48px);
  margin-bottom: 20px;
}
.pair-side {
  min-width: 0;
  padding: 14px;
  border: 1px solid #a7855638;
  background: #17130fcc;
}
.pair-side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.pair-meta { font-size: .78rem; color: var(--muted); }
.pair-slips .slip { min-height: 82px; }
.pair-slips .slip[data-empty] {
  color: var(--muted);
  background:
    repeating-linear-gradient(-45deg, transparent 0 6px, #a7855612 6px 7px),
    #1b1611;
  box-shadow: inset 0 0 0 1px #a7855640;
}

/* Central Calibrated Comparison Bridge (Shown When Aligned) */
.pair-bridge {
  display: none;
}
.comparison[data-aligned="true"] {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  max-width: 780px;
}
.comparison[data-aligned="true"] .pair-side {
  display: grid;
  grid-template-columns: minmax(150px, 1.15fr) minmax(0, 3.4fr);
  align-items: center;
  column-gap: 14px;
  padding: 10px 14px;
}
.comparison[data-aligned="true"] .pair-side-head {
  flex-direction: column;
  gap: 2px;
  margin: 0;
}
.comparison[data-aligned="true"] .slip:not([data-empty]) { border-bottom-color: #c69a6088; }
.comparison[data-aligned="true"] .slip[data-pillar="2"] {
  background: linear-gradient(180deg, #4b311f59, #2b1d1470);
  border-bottom-color: var(--cinnabar-bright);
}
.comparison[data-aligned="true"] .pair-bridge {
  display: grid;
  grid-template-columns: minmax(150px, 1.15fr) repeat(4, minmax(0, .85fr));
  align-items: center;
  column-gap: 0;
  padding: 8px 14px;
  border-inline: 1px solid #a7855638;
  background: #211a13;
}
.comparison[data-aligned="true"] .pair-bridge::before {
  content: "";
}
.bridge-cell {
  display: grid;
  place-items: center;
  font-size: .74rem;
  color: var(--muted);
}
.bridge-cell i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8f6f4770;
}
.bridge-cell em { font-style: normal; }
.bridge-match em {
  padding: 2px 9px;
  border: 1px solid #c95a4888;
  background: #3a1f18;
  color: #f4ce9d;
  white-space: nowrap;
}
.bridge-cell[data-blank="true"] em {
  padding: 2px 8px;
  border: 1px dashed #a7855666;
  color: var(--muted);
  white-space: nowrap;
}

.pair-actions { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.pair-toggle { display: inline-flex; align-items: center; min-height: 44px; gap: 8px; cursor: pointer; color: var(--ink-soft); }
.pair-toggle input { width: 17px; height: 17px; accent-color: var(--metal); }
#pair-status { margin: 12px 0 0; }

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding-block: 26px 32px;
  border-top: 1px solid var(--line);
  font-size: .85rem;
  color: var(--muted);
}
.footer p { margin: 0; }
.footer a:hover { color: var(--metal-light); }

/* Responsive Breakpoints */
@media (max-width: 860px) {
  .folio { grid-template-columns: 1fr; gap: 28px; }
  .folio-spine { display: none; }
  .folio-record { max-width: 520px; }
  .comparison { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 750px) {
  .masthead-inner { min-height: 58px; }
  .opening { min-height: 0; padding-block: 28px 34px; }
  .opening h1 { font-size: clamp(32px, 7.6vw, 54px); }
  .opening-copy p { max-width: 30em; }
  .section-line { align-items: start; gap: 12px; flex-direction: column; }
  .comparison[data-aligned="true"] .pair-side { display: block; }
  .comparison[data-aligned="true"] .pair-side-head { flex-direction: row; margin-bottom: 8px; }
  .comparison[data-aligned="true"] .pair-bridge { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .comparison[data-aligned="true"] .pair-bridge::before { display: none; }
}

@media (max-width: 560px) {
  .ritual-steps { gap: 6px; }
  .ritual-steps li { padding: 8px 9px; gap: 6px; font-size: .78rem; }
  .lot-ritual { grid-template-columns: 1fr; gap: 10px; justify-items: center; text-align: center; }
  .lot-vessel-svg { width: 124px; }
  .cradle-wrap { width: 100%; }
  .branch-choices { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .brand { font-size: 20px; gap: 7px; }
  .brand-seal { width: 23px; height: 23px; font-size: 14px; }
  nav { gap: clamp(8px, 2.6vw, 12px); font-size: .8rem; }
  .opening-copy p { margin-top: 12px; }
  .instrument { --dial-size: min(84vw, 350px); }
  .open-chart { width: 88px; padding-inline: 7px; }
  .open-chart strong { font-size: .96rem; }
  .folio { padding: 18px; }
  .reading-card { grid-template-columns: 1fr; gap: 8px; padding: 12px; }
  .case-slips .slip { min-height: 92px; }
  .slip { min-height: 72px; }
  .slip .slip-meta { font-size: .62rem; }
  .pair-slips .slip { padding-inline: 2px; }
  .pair-slips strong { font-size: 1.02rem; }
  .pair-slips .slip-pillar { font-size: .66rem; }
  .bridge-match em, .bridge-cell[data-blank="true"] em { font-size: .66rem; padding: 2px 5px; }
}

@media (max-width: 360px) {
  .masthead-inner { padding-inline: 13px; gap: 9px; }
  .brand { font-size: 18px; }
  nav { gap: 7px; font-size: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0ms !important; }
  .dial-face { animation: none; }
}
