:root {
  --ink: #1e1e1e;
  --muted: #5d5d5d;
  --paper: #ffffff;
  --lav: #E4DDF4;
  --blue: #DCE8FA;
  --green: #DDF0D9;
  --yellow: #FBF1D0;
  --grey: #F6F6F6;
  --peach: #F9DCC4;
  --hand: "Patrick Hand", "LXGW WenKai", "Comic Sans MS", cursive;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --r: 18px 6px 16px 8px / 8px 16px 6px 18px;
  --r2: 8px 16px 6px 18px / 18px 6px 16px 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
}
html[lang="zh-CN"] body { font-size: 16.5px; line-height: 1.8; }

h1, h2, h3, .hand { font-family: var(--hand); font-weight: 400; }
h1 { font-size: clamp(36px, 5.2vw, 58px); line-height: 1.08; margin: 0.15em 0 0.35em; }
h2 { font-size: clamp(30px, 3.6vw, 40px); line-height: 1.15; margin: 0 0 0.2em; }
h3 { font-size: 25px; line-height: 1.2; margin: 0.1em 0 0.35em; }
html[lang="zh-CN"] h1 { font-size: clamp(32px, 4.6vw, 50px); line-height: 1.25; }
p { margin: 0 0 0.8em; }
a { color: inherit; }
.muted { color: var(--muted); }
.lede { font-size: 1.08em; max-width: 46em; color: #2c2c2c; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(6px);
  border-bottom: 1.6px solid var(--ink);
}
.brand { font-family: var(--hand); font-size: 21px; text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  font-family: var(--hand); font-size: 17px; text-decoration: none;
  padding: 3px 10px; border-radius: var(--r); white-space: nowrap;
  border: 1.4px solid transparent;
}
.nav a:hover { border-color: var(--ink); }
.nav a.active { background: var(--lav); border-color: var(--ink); }
.lang-btn { flex: none; padding: 4px 14px; }

main { max-width: 1140px; margin: 0 auto; padding: 0 22px 40px; }

/* ---------- shared pieces ---------- */
.section { padding: 64px 0 12px; border-top: 1.6px dashed #cfcfcf; }
.card {
  border: 1.8px solid var(--ink);
  border-radius: var(--r);
  background: #fff;
  padding: 18px 22px;
  box-shadow: 3px 4px 0 rgba(30, 30, 30, 0.08);
}
.fill-blue { background: var(--blue); }
.fill-green { background: var(--green); }
.btn {
  font-family: var(--hand); font-size: 18px; line-height: 1.2;
  border: 1.8px solid var(--ink); border-radius: var(--r);
  background: #fff; color: var(--ink);
  padding: 7px 16px; cursor: pointer; text-decoration: none; display: inline-block;
  transition: transform 0.15s, box-shadow 0.15s, background 0.25s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--ink); }
.btn.primary { background: var(--lav); }
.btn.on { background: var(--green); }
.btn:disabled { opacity: 0.35; cursor: default; transform: none; box-shadow: none; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible, input:focus-visible {
  outline: 3px solid #7a5af8; outline-offset: 2px;
}
.seg { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.source-note { font-size: 14px; color: var(--muted); margin-top: 12px; }
.sub-h { font-size: 30px; margin-top: 46px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 18px; align-items: start; }
.bars { margin-top: 18px; display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 9.5em 1fr; align-items: center; gap: 10px; font-family: var(--hand); font-size: 18px; }
.bar { height: 20px; width: 0; border: 1.6px solid var(--ink); border-radius: var(--r2); transition: width 1.4s cubic-bezier(.5,.1,.2,1); }
.bar.long { background: var(--peach); }
.bar.short { background: var(--green); transition-delay: 0.5s; }
.bars.in .bar.long { width: 100%; }
.bars.in .bar.short { width: 5%; min-width: 14px; }
.big-quote {
  font-family: var(--hand); font-size: 26px; line-height: 1.3;
  margin: 10px 0 4px; padding: 8px 0 8px 18px; border-left: 4px solid var(--ink);
}
html[lang="zh-CN"] .big-quote { font-size: 23px; line-height: 1.55; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: center; padding: 48px 0 40px; }
.kicker { font-family: var(--hand); font-size: 19px; color: var(--muted); margin: 0; }
.disclaimer { font-size: 13.5px; color: var(--muted); margin-top: 18px; max-width: 40em; }
.hero-art svg { width: 100%; height: auto; display: block; }
.hero-art .paper { animation: drift 6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes drift { from { transform: rotate(-5deg) translate(0, 0); } to { transform: rotate(-3deg) translate(4px, -3px); } }

/* ---------- timeline ---------- */
.timeline {
  position: relative; display: flex; gap: 10px; overflow-x: auto;
  padding: 26px 4px 14px; margin: 12px 0 14px;
}
.timeline::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: 39px;
  border-top: 2px solid var(--ink);
}
.tl-node {
  position: relative; flex: 1 0 128px; min-width: 128px;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 0 4px 6px; color: var(--ink); font-family: var(--body);
}
.tl-dot {
  display: block; width: 26px; height: 26px; margin-bottom: 8px;
  background: #fff; border: 2px solid var(--ink); border-radius: 50% 46% 52% 48%;
  transition: transform 0.2s, background 0.25s;
}
.tl-node.career .tl-dot { border-style: dashed; }
.tl-node:hover .tl-dot { transform: scale(1.15); }
.tl-node.active .tl-dot { background: var(--lav); transform: scale(1.25); }
.tl-date { display: block; font-family: var(--hand); font-size: 17px; color: var(--muted); }
.tl-name { display: block; font-size: 14px; line-height: 1.35; }
.tl-node.active .tl-name { font-weight: 650; }
.tag {
  display: inline-block; margin-top: 4px; font-family: var(--hand); font-size: 14px;
  background: var(--yellow); border: 1.4px solid var(--ink); border-radius: var(--r2); padding: 0 8px;
}
.tl-detail { min-height: 150px; }
.tl-detail .kind { font-family: var(--hand); font-size: 17px; color: var(--muted); margin: 0; }
.fade-in { animation: fadein 0.35s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- walkthroughs ---------- */
.walk { display: grid; grid-template-columns: 1.45fr 1fr; gap: 22px; margin-top: 18px; align-items: start; }
.scene { padding: 10px; }
.scene svg { width: 100%; height: auto; display: block; }
.narration { display: flex; flex-direction: column; min-height: 100%; }
.step-of { font-family: var(--hand); font-size: 17px; color: var(--muted); margin: 0; }
.narr { min-height: 7.5em; }
.controls { display: flex; gap: 10px; margin-top: auto; padding-top: 12px; }
.dots { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 14px; }
.dots button {
  width: 15px; height: 15px; padding: 0; cursor: pointer;
  border: 1.6px solid var(--ink); border-radius: 50% 44% 52% 46%; background: #fff;
}
.dots button.on { background: var(--ink); }
.extra:empty { display: none; }
.extra { margin: 4px 0 6px; }

.svg-hand { font-family: var(--hand); fill: var(--ink); }
.svg-h { font-size: 27px; }
.svg-sub { font-size: 16px; fill: var(--muted); }
.svg-small { font-size: 15px; }
.badge-t { font-family: var(--hand); font-size: 14px; font-weight: 700; }

.dot .body { transition: fill 0.6s ease; }
.dot .ic, .dot .badge, .dot .ring { transition: opacity 0.5s ease; }
.dot .inner { transform-box: fill-box; transform-origin: center; }
.dot .inner.pop { animation: pop 0.6s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

.meter { padding: 8px 8px 4px; }
.meter-bar { display: flex; gap: 3px; margin-bottom: 10px; }
.meter-bar span {
  flex: 1; height: 16px; border: 1.3px solid var(--ink); border-radius: 4px 2px 5px 3px;
  background: #fff; transition: background 0.6s ease;
}
.counters { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.cnt { display: inline-flex; align-items: center; gap: 6px; padding: 1px 6px; border-radius: 6px; transition: background 0.4s; }
.cnt i { width: 14px; height: 14px; border: 1.3px solid var(--ink); border-radius: 50%; display: inline-block; }
.cnt i.ring { border-style: dashed; }
.cnt b { font-family: var(--hand); font-size: 18px; font-weight: 400; }
.cnt.changed { background: var(--yellow); animation: flash 1s ease; }
@keyframes flash { 0% { background: #f6d77a; } 100% { background: var(--yellow); } }

/* ---------- quadrants ---------- */
.quad-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 18px; align-items: start; }
.quad {
  display: grid; grid-template-columns: 26px 30px 1fr 1fr; grid-template-rows: auto auto 1fr 1fr;
  gap: 8px 10px;
}
.quad .axis { font-family: var(--hand); font-size: 16px; color: var(--muted); display: flex; align-items: center; justify-content: center; text-align: center; }
.quad .axis-y { writing-mode: vertical-rl; transform: rotate(180deg); }
html[lang="zh-CN"] .quad .axis-y { transform: none; letter-spacing: 2px; }
.quad .corner { font-family: var(--hand); font-size: 13px; color: var(--muted); }
.qcell {
  min-height: 140px; cursor: pointer; text-align: left; color: var(--ink);
  border: 1.8px solid var(--ink); border-radius: var(--r); padding: 12px 14px;
  font-family: var(--hand); font-size: 23px; line-height: 1.2;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column; justify-content: space-between;
}
.qcell small { font-family: var(--body); font-size: 13.5px; color: #3c3c3c; line-height: 1.35; }
.qcell:hover { transform: translate(-1px, -2px); box-shadow: 3px 3px 0 var(--ink); }
.qcell.on { box-shadow: 4px 4px 0 var(--ink); outline: 3px solid var(--ink); outline-offset: -6px; }
.qcell.kk { background: var(--green); }
.qcell.ku { background: var(--yellow); }
.qcell.uk { background: var(--blue); }
.qcell.uu { background: var(--lav); }
.qlabel { font-family: var(--hand); font-size: 17px; color: var(--muted); margin: 12px 0 2px; }
.prompt-box {
  position: relative; background: var(--grey); border: 1.5px dashed var(--ink);
  border-radius: var(--r2); padding: 12px 14px 12px; font-size: 15px;
}
.prompt-box .btn { font-size: 15px; padding: 2px 10px; margin-top: 8px; }

/* ---------- flowchart ---------- */
.flow-card { margin-top: 18px; overflow-x: auto; }
.flowchart { min-height: 220px; display: flex; justify-content: center; }
.flowchart svg { max-width: 100%; height: auto; }
.nodeLabel b { font-weight: 700; font-synthesis: weight; }

/* ---------- unhobbling ---------- */
.oh-steps { list-style: none; padding: 0; margin: 12px 0; }
.oh-steps li {
  border: 1.5px solid var(--ink); border-radius: var(--r2); padding: 8px 12px; margin-bottom: 8px;
  background: #fff; animation: fadein 0.4s ease both;
}
.oh-steps.chat li { background: var(--peach); }
.oh-steps.agent li { background: var(--green); }
.oh-steps li:nth-child(2) { animation-delay: 0.15s; }
.oh-steps li:nth-child(3) { animation-delay: 0.3s; }
.same { font-family: var(--hand); font-size: 20px; }
.ce-row { border-top: 1.4px dashed #bdbdbd; padding: 10px 0 6px; }
.ce-row:first-of-type { border-top: none; }
.ce-row h4 { font-family: var(--hand); font-weight: 400; font-size: 20px; margin: 0 0 4px; }
.ce-text { margin: 0; animation: fadein 0.35s ease; }
.ce-bar { margin-top: 10px; }
.ce-bar .track { height: 22px; border: 1.6px solid var(--ink); border-radius: var(--r2); background: #fff; overflow: hidden; }
.ce-bar .fill { height: 100%; background: var(--lav); border-right: 1.6px solid var(--ink); transition: width 0.9s cubic-bezier(.6,.1,.2,1); }
.ce-bar .lbl { font-family: var(--hand); font-size: 16px; color: var(--muted); }

/* ---------- triangle ---------- */
.tri svg { width: 100%; max-width: 420px; display: block; margin: 0 auto; }
.tri .vertex { cursor: pointer; }
.tri .vertex .vbody { transition: fill 0.35s; }
.tri .edge { transition: stroke-width 0.35s, opacity 0.35s; }
.tri .area { transition: opacity 0.5s; }
.tri-note { min-height: 3.4em; font-size: 15.5px; }

/* ---------- newest talk ---------- */
.meta-line { font-family: var(--hand); font-size: 18px; color: var(--muted); margin-bottom: 8px; }
.right-line { background: var(--green); border: 1.5px solid var(--ink); border-radius: var(--r2); padding: 8px 14px; display: inline-block; font-size: 15.5px; }
.flips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 10px; }
.flip { display: block; width: 100%; perspective: 900px; background: none; border: none; padding: 0; cursor: pointer; min-height: 230px; text-align: left; color: var(--ink); font-family: var(--body); }
.flip-inner { display: block; position: relative; width: 100%; height: 100%; min-height: 230px; transition: transform 0.6s; transform-style: preserve-3d; }
.face .lbl, .face .q { display: block; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1.8px solid var(--ink); border-radius: var(--r); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.face .lbl { font-family: var(--hand); font-size: 16px; color: var(--muted); }
.face.front { background: var(--peach); }
.face.front .q { font-family: var(--hand); font-size: 25px; line-height: 1.2; }
.face.back { background: var(--green); transform: rotateY(180deg); font-size: 14.5px; line-height: 1.5; }

.frontier-wrap { display: grid; grid-template-columns: 1.45fr 1fr; gap: 22px; margin-top: 12px; align-items: start; }
.slider-row { margin: 10px 0 6px; }
.slider-row input[type=range] { width: 100%; accent-color: #6d5bd0; }
.stops { display: flex; justify-content: space-between; gap: 6px; }
.stops .btn { font-size: 15px; padding: 3px 10px; }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.55;
  background: var(--yellow); border: 1.5px solid var(--ink); border-radius: var(--r2);
  padding: 10px 12px; margin: 6px 0 4px; overflow-x: auto; white-space: pre;
}
.code .cm { color: #6b5b2e; }
.code .hl { background: #f3d36b; border-radius: 3px; }
.sketch-cap { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.size-row { display: flex; align-items: center; gap: 10px; font-family: var(--hand); font-size: 18px; }
.size-row input { flex: 1; accent-color: #6d5bd0; }

.chip { transition: transform 0.8s cubic-bezier(.5,.1,.2,1), opacity 0.5s; }
.chip .cbody { transition: fill 0.6s; }
.fade { transition: opacity 0.6s; }
.rock { transition: transform 0.35s ease; transform-box: fill-box; transform-origin: center; }

.list-h { font-family: var(--hand); font-size: 19px; margin: 8px 0 2px; }
.sketch-list { margin: 0; padding-left: 1.1em; }
.sketch-list li { margin: 2px 0; }
.closing { margin: 26px 0 0; }
.closing figcaption { font-size: 14px; color: var(--muted); padding-left: 22px; }

/* ---------- thread ---------- */
.quotes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; position: relative; }
.qcard { border: 1.8px solid var(--ink); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.qcard:nth-child(1) { background: var(--lav); }
.qcard:nth-child(2) { background: var(--blue); }
.qcard:nth-child(3) { background: var(--green); }
.qcard p { font-family: var(--hand); font-size: 22px; line-height: 1.3; margin: 0; }
html[lang="zh-CN"] .qcard p { font-size: 20px; line-height: 1.6; }
.qcard span { font-size: 13.5px; color: var(--muted); }
.summary { font-size: 1.1em; margin: 20px 0; max-width: 48em; padding: 10px 16px; border: 1.6px dashed var(--ink); border-radius: var(--r2); }
.practices-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.progress { font-family: var(--hand); font-size: 18px; color: var(--muted); }
#practices { list-style: none; padding: 0; margin: 6px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
#practices label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 5px 4px; border-radius: 6px; }
#practices label:hover { background: var(--grey); }
#practices input { width: 18px; height: 18px; margin-top: 4px; accent-color: #3f8f4a; flex: none; }
#practices input:checked + span { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--muted); }

/* ---------- sources ---------- */
.sources { padding-left: 1.3em; }
.sources li { margin: 6px 0; }
.kind-tag { font-family: var(--hand); font-size: 14px; border: 1.3px solid var(--ink); border-radius: var(--r2); padding: 0 7px; margin-right: 6px; }
.kind-tag.primary { background: var(--green); }
.kind-tag.recap { background: var(--yellow); }

.footer { max-width: 1140px; margin: 0 auto; padding: 28px 22px 50px; border-top: 1.6px solid var(--ink); font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero, .walk, .two-col, .quad-wrap, .frontier-wrap { grid-template-columns: 1fr; }
  .flips { grid-template-columns: 1fr 1fr; }
  .quotes { grid-template-columns: 1fr; }
  #practices { grid-template-columns: 1fr; }
  .brand { display: none; }
  .flowchart { justify-content: flex-start; }
  .flowchart svg { max-width: none; width: 760px; flex-shrink: 0; }
  .flow-card::after { content: "⟷"; display: block; text-align: center; color: #888; }
}
@media (max-width: 520px) {
  .flips { grid-template-columns: 1fr; }
  main { padding: 0 14px 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
