/* Self-hosted fonts (SIL OFL 1.1, see fonts/LICENSE-*.txt) — no third-party requests. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/space-grotesk-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/space-grotesk-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/space-grotesk-latin-700-normal.woff2) format('woff2'); }

/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #f7f7fb; --bg-2: #ffffff; --surface: rgba(255,255,255,.72); --surface-solid: #fff;
  --text: #14141f; --muted: #5d5d73; --line: rgba(20,20,40,.1); --line-strong: rgba(20,20,40,.18);
  --accent: #6b4dff; --accent-2: #0fb5c6; --accent-soft: rgba(107,77,255,.1);
  --good: #16a34a; --bad: #dc2626; --warn: #ea7a0c;
  --shadow: 0 1px 2px rgba(20,20,40,.04), 0 8px 24px -8px rgba(20,20,40,.12);
  --shadow-lg: 0 24px 60px -20px rgba(40,30,90,.3);
  --r: 18px; --r-sm: 12px;
  --font: 'Inter', system-ui, -apple-system, sans-serif; --display: 'Space Grotesk', var(--font);
  --tag-l: 42%; --tag-bg-l: 94%;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b14; --bg-2: #11111d; --surface: rgba(24,24,40,.6); --surface-solid: #161625;
    --text: #ececf6; --muted: #9a9ab4; --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.16);
    --accent: #8f78ff; --accent-2: #2fd6e6; --accent-soft: rgba(143,120,255,.14);
    --good: #4ade80; --bad: #f87171; --warn: #fb923c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.7);
    --tag-l: 75%; --tag-bg-l: 20%; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b14; --bg-2: #11111d; --surface: rgba(24,24,40,.6); --surface-solid: #161625;
  --text: #ececf6; --muted: #9a9ab4; --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.16);
  --accent: #8f78ff; --accent-2: #2fd6e6; --accent-soft: rgba(143,120,255,.14);
  --good: #4ade80; --bad: #f87171; --warn: #fb923c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.7);
  --tag-l: 75%; --tag-bg-l: 20%; color-scheme: dark;
}

/* -------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--text); background: var(--bg); min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); } h2 { font-size: clamp(1.4rem, 3vw, 2rem); } h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; } a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
kbd { font: 600 .72em var(--font); padding: .15em .45em; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--bg-2); color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); } .center { text-align: center; justify-content: center; }
.bg-grid { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%); opacity: .6; }

#app { max-width: 1180px; margin: 0 auto; padding: 0 16px 80px; outline: none; }

/* --------------------------------------------------------------------- nav */
.nav { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; padding: 12px max(16px, calc((100vw - 1180px) / 2 + 16px));
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); background: color-mix(in srgb, var(--bg) 70%, transparent); border-bottom: 1px solid transparent; transition: border-color .3s; }
body.scrolled .nav { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font: 700 1.15rem var(--display); color: var(--text); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 4px; margin-left: 12px; }
.nav-links a { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 500; font-size: .95rem; transition: color .2s, background .2s; }
.nav-links a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.nav-links a.active { color: var(--text); background: var(--accent-soft); }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-btn { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: .9rem; transition: border-color .2s; }
.search-btn:hover { border-color: var(--accent); }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; font-size: 1rem; }
.menu-btn { display: none; }
.progress-ring { --p: 0; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font: 700 .68rem var(--font); color: var(--text);
  background: radial-gradient(closest-side, var(--bg) 78%, transparent 80%), conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line-strong) 0); transition: --p .6s; }
.progress-ring:hover { text-decoration: none; transform: scale(1.06); }
@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }

/* ---------------------------------------------------------- primitives */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-solid); color: var(--text); font-weight: 600; font-size: .95rem; transition: transform .15s, box-shadow .2s, background .2s; }
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { border: 0; color: #fff; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2))); box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-primary:hover { box-shadow: 0 12px 32px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-ghost { background: transparent; }
.btn-lg { padding: 14px 24px; font-size: 1rem; border-radius: 14px; }
.btn.is-done { background: color-mix(in srgb, var(--good) 15%, transparent); border-color: var(--good); color: var(--good); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.input { width: 100%; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--bg-2); color: var(--text); font: inherit; resize: vertical; transition: border-color .2s, box-shadow .2s; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-solid); font-size: .85rem; font-weight: 500; color: var(--text); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.link-chip { border-color: hsl(var(--h) 60% 50% / .35); }
.link-chip:hover { text-decoration: none; background: hsl(var(--h) 70% 50% / .12); }
.link-chip.ok { background: hsl(var(--h) 70% 50% / .15); }
.cat-chip[aria-selected="true"] { background: hsl(var(--h) 70% 55%); color: #fff; border-color: transparent; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font: 600 .72rem var(--font); letter-spacing: .04em; text-transform: uppercase; color: hsl(var(--h) 70% var(--tag-l)); background: hsl(var(--h) 70% var(--tag-bg-l)); }
.done-tag { --h: 140; }
.pill { font-size: .75rem; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--muted); font-weight: 500; }
.eyebrow { font: 600 .8rem var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }

.card, .glass { position: relative; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.card { padding: 22px; color: var(--text); transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s; overflow: hidden; }
.card::before, .glass::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%); }
.card:hover::before, .glass:hover::before { opacity: 1; }
a.card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.glass { padding: 22px; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s cubic-bezier(.2,.8,.2,1) var(--d, 0ms), transform .6s cubic-bezier(.2,.8,.2,1) var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }

/* ------------------------------------------------------------------- hero */
.hero { position: relative; padding: clamp(60px, 12vw, 130px) 0 70px; text-align: center; isolation: isolate; }
.hero-inner { position: relative; z-index: 2; max-width: 780px; margin: 0 auto; }
.hero h1 { font-size: clamp(2.5rem, 7.5vw, 5rem); letter-spacing: -.035em; }
.grad { background: linear-gradient(100deg, var(--accent), var(--accent-2) 60%, var(--accent)); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite; }
@keyframes shine { to { background-position: 200% center; } }
.lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-kbd { margin-top: 22px; color: var(--muted); font-size: .88rem; }
.orbs { position: absolute; inset: -40px -40px 0; overflow: hidden; z-index: -1; pointer-events: none; }
@media (max-width: 860px) { .orbs { inset: 0; } }
.orbs i { position: absolute; z-index: -1; border-radius: 50%; filter: blur(70px); opacity: .45; animation: float 18s ease-in-out infinite; }
.orbs i:nth-child(1) { width: 380px; height: 380px; background: var(--accent); top: 0; left: 8%; }
.orbs i:nth-child(2) { width: 320px; height: 320px; background: var(--accent-2); top: 30%; right: 6%; animation-delay: -6s; }
.orbs i:nth-child(3) { width: 260px; height: 260px; background: #ff5ca8; bottom: 0; left: 40%; opacity: .25; animation-delay: -12s; }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(40px,-30px) scale(1.08); } 66% { transform: translate(-30px,20px) scale(.95); } }
.floaters { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.floaters span { position: absolute; font: 600 .8rem var(--font); padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); opacity: 0; animation: drift 14s ease-in-out infinite; animation-delay: calc(var(--i) * -1.1s); }
@keyframes drift { 0% { opacity: 0; transform: translateY(20px); } 20%, 70% { opacity: .55; } 100% { opacity: 0; transform: translateY(-40px); } }

/* --------------------------------------------------------------- sections */
.section { padding: 56px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 32px; }
.section-head p { color: var(--muted); }
.page-head { padding: 48px 0 28px; max-width: 760px; }
.page-head p { color: var(--muted); font-size: 1.08rem; }
.page-head.center { margin: 0 auto; text-align: center; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.feature .feat-ico { font-size: 1.8rem; display: block; margin-bottom: 10px; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }
.grid-demos { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.demo-card { border-top: 3px solid hsl(var(--h) 70% 55%); }
.demo-card h3 { margin: 8px 0 4px; } .demo-card p { margin: 0; color: var(--muted); font-size: .9rem; }
.demo-ico { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 1rem; flex: none; }
.grid-paths { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.path-card p { color: var(--muted); font-size: .93rem; }
.path-emoji { font-size: 2rem; display: block; margin-bottom: 8px; } .path-emoji.big { font-size: 3rem; }
.path-meta { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); margin-bottom: 8px; }
.meter { height: 6px; border-radius: 99px; background: var(--line-strong); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.cta-band { text-align: center; border-radius: 28px; margin: 40px 0; padding: 56px 24px; background: radial-gradient(120% 140% at 50% 0%, var(--accent-soft), transparent 70%), var(--surface); border: 1px solid var(--line); }
.cta-band p { color: var(--muted); }

/* -------------------------------------------------------------- explore */
.filters { display: flex; flex-direction: column; gap: 14px; margin-bottom: 10px; position: sticky; top: 64px; z-index: 5; padding: 12px 0; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); }
.search-box { position: relative; max-width: 420px; } .search-box span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.search-box .input { padding-left: 40px; }
.cat-blurb { color: var(--muted); min-height: 1.6em; margin-bottom: 12px; }
.grid-terms { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.term-card { display: flex; flex-direction: column; border-top: 3px solid hsl(var(--h) 70% 55%); }
.term-card h3 { margin: 12px 0 6px; } .term-card h3 small { color: var(--muted); font-weight: 500; font-size: .8em; }
.term-card p { color: var(--muted); font-size: .92rem; flex: 1; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-foot { display: flex; gap: 6px; }
.done { width: 22px; height: 22px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px; }

/* ----------------------------------------------------------------- term */
.term { max-width: 860px; margin: 0 auto; padding-top: 28px; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 18px; } .crumbs a { color: var(--muted); }
.term-head h1 { margin-top: 12px; font-size: clamp(2.2rem, 6vw, 3.6rem); }
.term-head .short { color: hsl(var(--h) 70% 60%); }
.levels { margin: 8px 0 18px; }
.seg { position: relative; display: inline-flex; padding: 4px; gap: 2px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.seg button { position: relative; z-index: 1; border: 0; background: none; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: .9rem; color: var(--muted); transition: color .2s; }
.seg button[aria-selected="true"] { color: var(--text); }
.seg:not(:has(.seg-ind)) button[aria-selected="true"] { background: var(--surface-solid); box-shadow: var(--shadow); }
.seg-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: 10px; background: var(--surface-solid); box-shadow: var(--shadow); transition: transform .35s cubic-bezier(.2,.8,.2,1), width .35s; }
.level-text { font-size: clamp(1.1rem, 2.3vw, 1.35rem); line-height: 1.55; margin: 0; }
.level-text.swap { animation: swap .4s cubic-bezier(.2,.8,.2,1); }
@keyframes swap { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } }
.term-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 18px; }
.term-grid p { margin: 0; color: var(--muted); }
.analogy { background: linear-gradient(135deg, hsl(var(--h) 80% 60% / .1), transparent 60%), var(--surface); }
.demo-panel { margin: 26px 0; border: 1px solid hsl(var(--h) 60% 55% / .35); }
.demo-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.demo-head small { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.demo-head h2 { margin: 0; font-size: 1.35rem; }

/* myth flip */
.flip { perspective: 1200px; margin: 24px 0; cursor: pointer; outline-offset: 6px; border-radius: var(--r); }
.flip-inner { display: grid; transition: transform .7s cubic-bezier(.3,.8,.2,1); transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face { grid-area: 1 / 1; padding: 26px; border-radius: var(--r); backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 1px solid var(--line); min-height: 150px; display: flex; flex-direction: column; justify-content: center; }
.flip-face small { font-weight: 700; letter-spacing: .1em; font-size: .75rem; }
.flip-face p { font-size: 1.15rem; margin: 8px 0 0; font-weight: 500; }
.front { background: linear-gradient(135deg, color-mix(in srgb, var(--warn) 14%, transparent), var(--surface)); } .front small { color: var(--warn); }
.back { transform: rotateY(180deg); background: linear-gradient(135deg, color-mix(in srgb, var(--good) 14%, transparent), var(--surface)); } .back small { color: var(--good); }
.flip-hint { margin-top: 12px; font-size: .82rem; color: var(--muted); }

/* quiz */
.quiz-q { font-weight: 600; font-size: 1.05rem; }
.quiz-opts { display: grid; gap: 10px; }
.opt { text-align: left; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg-2); font-weight: 500; transition: transform .15s, border-color .2s, background .2s; }
.opt:hover { border-color: var(--accent); transform: translateX(3px); }
.opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); animation: pop .4s; }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); animation: shake .4s; }
.opt.off { opacity: .5; }
.answered .opt { pointer-events: none; }
.quiz-why { margin: 14px 0 0; min-height: 1em; }
@keyframes pop { 50% { transform: scale(1.03); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.understood { display: flex; justify-content: center; margin: 28px 0; }
.links { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin: 20px 0 30px; }
.links h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pager .card { padding: 16px 20px; } .pager small { color: var(--muted); display: block; } .pager .next { text-align: right; }
.path-bar { display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 20px; font-size: .9rem; }
.path-bar > a { font-weight: 600; white-space: nowrap; color: var(--text); }
.path-bar .steps { display: flex; gap: 6px; flex: 1; }
.path-bar .steps a { flex: 1; height: 6px; border-radius: 99px; background: var(--line-strong); transition: background .3s; }
.path-bar .steps a.ok { background: var(--good); } .path-bar .steps a.cur { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.path-bar > span { color: var(--muted); }

/* path timeline */
.timeline { list-style: none; padding: 0; margin: 0 auto; max-width: 760px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 21px; top: 10px; bottom: 10px; width: 2px; background: var(--line-strong); }
.timeline li a { display: flex; gap: 16px; align-items: flex-start; padding: 14px; border-radius: var(--r-sm); color: var(--text); position: relative; }
.timeline li a:hover { background: var(--surface); text-decoration: none; }
.timeline p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.timeline div { flex: 1; }
.tl-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--bg-2); border: 2px solid hsl(var(--h) 70% 55%); z-index: 1; }
.timeline li.ok .tl-num { background: var(--good); border-color: var(--good); color: #fff; }

/* ---------------------------------------------------------------- X-ray */
.xray { max-width: 860px; margin: 0 auto; }
.xr-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 600; }
.xr-badge { white-space: nowrap; flex: none; font: 700 .7rem var(--font); letter-spacing: .14em; padding: 4px 9px; border-radius: 6px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.xr-samples { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0 16px; font-size: .88rem; color: var(--muted); }
.xr-samples .chip { cursor: pointer; }
.xr-out { font-size: 1.1rem; line-height: 2; padding: 16px 18px; border-radius: var(--r-sm); background: var(--bg-2); border: 1px dashed var(--line-strong); }
.xr { position: relative; padding: 2px 6px; border-radius: 6px; color: hsl(var(--h) 70% var(--tag-l)); background: hsl(var(--h) 80% 55% / .16); font-weight: 600; box-shadow: inset 0 -2px hsl(var(--h) 70% 55% / .6); animation: glow .6s both; }
.xr:hover { text-decoration: none; background: hsl(var(--h) 80% 55% / .28); }
.xr::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px); width: max-content; max-width: 260px; padding: 9px 12px; border-radius: 10px;
  background: var(--text); color: var(--bg); font: 500 .8rem/1.4 var(--font); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 10; }
.xr:hover::after, .xr:focus::after { opacity: 1; transform: translateX(-50%); }
@media (hover: none), (max-width: 860px) { .xr::after { display: none; } }
@keyframes glow { from { background: hsl(var(--h) 80% 55% / .5); } }
.xr-count { margin: 16px 0 10px; color: var(--muted); }
.xr-terms { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.xr-term { display: block; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); border-left: 3px solid hsl(var(--h) 70% 55%); background: var(--bg-2); color: var(--text); }
.xr-term:hover { text-decoration: none; border-color: hsl(var(--h) 70% 55%); }
.xr-term b { display: block; } .xr-term span { font-size: .85rem; color: var(--muted); }

/* ------------------------------------------------------------------ map */
.legend { display: flex; gap: 8px; flex-wrap: wrap; }
.map-wrap { padding: 0; overflow: hidden; }
svg.map { width: 100%; }
.map .edges line { stroke: var(--line-strong); stroke-width: 1.5; transition: stroke .2s, opacity .2s; }
.map marker path { fill: var(--line-strong); }
.map .node circle { fill: hsl(var(--h) 75% 58%); stroke: var(--bg); stroke-width: 3; transition: r .2s, opacity .2s; filter: drop-shadow(0 0 8px hsl(var(--h) 80% 60% / .5)); }
.map .node.ok circle { stroke: var(--good); stroke-width: 3.5; }
.map .node text { fill: var(--text); font: 600 12px var(--font); paint-order: stroke; stroke: var(--bg); stroke-width: 4px; transition: opacity .2s; }
.map .node:hover circle, .map .node:focus circle { r: 14; }
.map.focusing .node:not(.hi) { opacity: .2; } .map.focusing .edges line:not(.hi) { opacity: .1; }
.map .edges line.hi { stroke: var(--accent); stroke-width: 2.5; }

/* ------------------------------------------------------------------- me */
.me-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 30px; }
.ring-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.ring { --p: 0; width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 10px; font: 700 1.5rem var(--display);
  background: radial-gradient(closest-side, var(--surface-solid) 80%, transparent 82%), conic-gradient(var(--accent), var(--accent-2) calc(var(--p) * 1%), var(--line-strong) 0); }
.stat-card { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.stat-card b { font: 700 2.2rem var(--display); } .stat-card span { color: var(--muted); }
.me-cat { margin-bottom: 26px; } .me-cat-head { display: flex; justify-content: space-between; align-items: baseline; } .me-cat .meter { margin-bottom: 12px; }
.me-cat .meter i { background: hsl(var(--h) 70% 55%); }

/* ----------------------------------------------------------------- book */
.book { max-width: 760px; margin: 0 auto; padding-top: 30px; }
.book-cover { text-align: center; padding: 60px 0; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.book-cover h1 { font-size: clamp(2.6rem, 8vw, 4.5rem); }
.book-ch { margin-bottom: 40px; } .book-ch > h2 { border-bottom: 2px solid var(--accent); padding-bottom: 8px; }
.book-entry { padding: 16px 0; border-bottom: 1px solid var(--line); break-inside: avoid; } .book-entry p { margin: 0 0 6px; }

/* ---------------------------------------------------------------- demos */
.demo-hint { color: var(--muted); }
.demo-note { color: var(--muted); font-size: .85rem; margin: 12px 0 0; }
.stat-row { display: flex; gap: 12px; margin: 14px 0; flex-wrap: wrap; }
.stat { flex: 1; min-width: 110px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.stat b { display: block; font: 700 1.5rem var(--display); } .stat span { font-size: .8rem; color: var(--muted); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; margin: 10px 0; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .25s cubic-bezier(.2,.8,.2,1); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked { background: var(--accent); } .switch input:checked::after { transform: translateX(18px); }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); outline-offset: 6px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: grab; }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: grab; }
.slider-row { display: flex; align-items: center; gap: 12px; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.temp-val { margin: 10px 0; font-size: .92rem; color: var(--muted); } .temp-val b { color: var(--text); }
.tok-out { display: flex; flex-wrap: wrap; gap: 4px; margin: 14px 0; min-height: 40px; padding: 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.tok { --hue: calc(var(--i) * 45); padding: 3px 7px; border-radius: 6px; font: 500 .95rem ui-monospace, SFMono-Regular, Menlo, monospace; background: hsl(var(--hue) 80% 60% / .2); box-shadow: inset 0 0 0 1px hsl(var(--hue) 70% 50% / .35); white-space: pre; animation: tokIn .3s both; }
@keyframes tokIn { from { opacity: 0; transform: scale(.8); } }
.prompt-line { font-size: 1.3rem; font-weight: 600; }
.blank { display: inline-block; min-width: 80px; color: var(--accent); border-bottom: 2px dashed var(--accent); text-align: center; }
.bars { display: grid; gap: 8px; margin: 14px 0; }
.bar { display: grid; grid-template-columns: 96px 1fr 56px; align-items: center; gap: 10px; font-size: .9rem; }
.bar-label { font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 14px; border-radius: 99px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .35s cubic-bezier(.2,.8,.2,1); }
.bar-pct { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .82rem; }
.samples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; min-height: 32px; }
.chip.pop { animation: tokIn .35s both; }
.msg { display: flex; margin: 8px 0; transition: opacity .35s, filter .35s, transform .35s; }
.msg > span { padding: 10px 14px; border-radius: 16px; max-width: 85%; background: var(--bg-2); border: 1px solid var(--line); }
.msg small { align-self: center; margin: 0 8px; color: var(--muted); font-size: .72rem; white-space: nowrap; }
.msg-user { flex-direction: row-reverse; } .msg-user > span { background: var(--accent); color: #fff; border: 0; border-bottom-right-radius: 4px; }
.msg-ai > span { border-bottom-left-radius: 4px; }
.msg.out { opacity: .25; filter: grayscale(1) blur(1px); transform: scale(.98); }
.msg.good > span { border-color: var(--good); } .msg.bad > span { border-color: var(--bad); }
.ctx-chat { padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--bg-2) 60%, transparent); border: 1px solid var(--line); }
.ctx-reply { margin-top: 10px; }
.good { color: var(--good); } .bad { color: var(--bad); } .msg.good, .msg.bad { color: inherit; }
.emb-svg { width: 100%; max-width: 640px; margin: 0 auto; aspect-ratio: 1.3; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.emb-pt { cursor: pointer; transition: opacity .25s; } .emb-pt text { font: 600 3px var(--font); fill: var(--text); } .emb-pt.dim { opacity: .25; }
.emb-pt:hover circle { r: 2.4; } .emb-pt circle { transition: r .2s; }
.emb-line { stroke: var(--accent); stroke-width: .5; stroke-dasharray: 2 1; animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -6; } }
.emb-info { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hal-a .fake { background: color-mix(in srgb, var(--bad) 20%, transparent); text-decoration: line-through wavy var(--bad); border-radius: 4px; }
.conf { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: .82rem; color: var(--muted); margin: 6px 0 16px; }
.hal-truth p { margin: 14px 0 0; font-weight: 500; }
.demo-rag .seg { display: flex; } .demo-rag .seg button { text-align: left; }
.rag-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.rag-step { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); font-size: .82rem; opacity: .45; transition: opacity .3s, border-color .3s, transform .3s; }
.rag-step b { display: block; font-size: .9rem; } .rag-step span { color: var(--muted); }
.rag-step.on { opacity: 1; border-color: var(--accent); transform: translateY(-2px); }
.rag-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 14px; }
.doc { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); font-size: .82rem; transition: all .35s; position: relative; }
.doc b { display: block; font-size: .88rem; } .doc span { color: var(--muted); } .doc em { position: absolute; top: 8px; right: 10px; font-size: .7rem; font-style: normal; color: var(--muted); }
.doc.hit { border-color: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 20%, transparent); transform: scale(1.02); }
.doc.miss { opacity: .45; }
.cite { display: block; margin-top: 6px; color: var(--muted); }
.plot { width: 100%; height: 260px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; } .dot-a { background: var(--text); } .dot-b { border: 2px solid var(--warn); }
.spark { width: 100%; height: 40px; } .spark polyline { stroke: var(--accent); }
.play-list { display: grid; gap: 22px; }
.play-list .demo-panel { margin: 0; }

/* ------------------------------------------------------------- palette */
#palette { width: min(620px, calc(100vw - 32px)); max-height: 70vh; margin: 12vh auto auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
#palette[open] { animation: palIn .22s cubic-bezier(.2,.8,.2,1); }
#palette::backdrop { background: rgba(5,5,15,.45); backdrop-filter: blur(4px); }
@keyframes palIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pal-in input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); font: 500 1.05rem var(--font); }
#palette ul { list-style: none; margin: 0; padding: 8px; overflow-y: auto; max-height: calc(70vh - 60px); }
#palette li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
#palette li div { flex: 1; min-width: 0; } #palette li b { display: block; font-size: .95rem; }
#palette li small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#palette li kbd { opacity: 0; } #palette li[aria-selected="true"] { background: var(--accent-soft); } #palette li[aria-selected="true"] kbd { opacity: 1; }
.pi { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--bg-2); flex: none; }

/* -------------------------------------------------------------- effects */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { padding: 11px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 500; font-size: .9rem; box-shadow: var(--shadow-lg); animation: toastIn .35s cubic-bezier(.2,.8,.2,1); transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateY(10px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.confetti { position: fixed; z-index: 70; width: 8px; height: 8px; border-radius: 2px; background: hsl(var(--h) 85% 60%); pointer-events: none; animation: burst .9s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes burst { to { transform: translate(var(--x), calc(var(--y) + 80px)) rotate(540deg); opacity: 0; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }

.footer { border-top: 1px solid var(--line); padding: 28px 16px; text-align: center; color: var(--muted); font-size: .88rem; }
.footer p { margin: 4px 0; }

/* ----------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .nav-links { position: fixed; inset: 63px 0 auto 0; flex-direction: column; margin: 0; padding: 12px 16px 18px; background: var(--surface-solid); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg);
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
  .menu-open .nav-links { opacity: 1; transform: none; pointer-events: auto; }
  .nav-links a { padding: 12px; }
  .menu-btn { display: grid; }
  .search-label, .search-btn kbd { display: none; }
  .filters { top: 62px; }
}
@media (max-width: 1100px) { .floaters { display: none; } }
@media (max-width: 560px) {
  .rag-steps { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 74px 1fr 46px; }
  .pager { grid-template-columns: 1fr; }
  .path-bar > a { display: none; }
  .floaters { display: none; }
  .slider-row span { display: none; }
  .msg > span { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
@media print {
  .nav, .footer, .no-print, .bg-grid, #toasts { display: none !important; }
  body { background: #fff; color: #000; } .book-entry { page-break-inside: avoid; }
}

/* privacy */
.prose { max-width: 720px; } .prose h2 { margin-top: 1.6em; font-size: 1.3rem; } .prose li { margin-bottom: .4em; }
