/* ============ Tokens ============ */
:root {
    color-scheme: light;
    --bg: #f3f0ea;
    --bg-2: #ebe7de;
    --surface: #fbfaf7;
    --surface-2: #f0ece4;
    --ink: #16150f;
    --muted: #5d5a52;
    --quiet: #8e8a80;
    --line: #dcd6ca;
    --line-strong: #c7c0b1;
    --accent: #f2541b;
    --accent-ink: #c43d0a;
    --accent-soft: rgba(242, 84, 27, .12);
    --blue: #2f5bea;
    --blue-soft: rgba(47, 91, 234, .12);
    --cyan: #0a8fb0;
    --lime: #5a9a12;
    --violet: #7650ff;
    --shadow-sm: 0 1px 2px rgba(40, 30, 10, .06), 0 4px 14px rgba(40, 30, 10, .05);
    --shadow: 0 2px 6px rgba(40, 30, 10, .05), 0 24px 60px -20px rgba(40, 30, 10, .22);
    --dot: rgba(22, 21, 15, .16);
    --max: 1240px;
    --radius: 18px;
    --font: "Geist", ui-sans-serif, system-ui, sans-serif;
    --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    --serif: "Instrument Serif", ui-serif, Georgia, serif;
    --ease: cubic-bezier(.2, .8, .2, 1);
}
html.dark {
    color-scheme: dark;
    --bg: #0d0d10;
    --bg-2: #121216;
    --surface: #16161b;
    --surface-2: #1d1d23;
    --ink: #f2efe8;
    --muted: #a7a39a;
    --quiet: #6f6c66;
    --line: #2a2a31;
    --line-strong: #3a3a43;
    --accent: #ff6a33;
    --accent-ink: #ff8a5c;
    --accent-soft: rgba(255, 106, 51, .14);
    --blue: #6b8cff;
    --blue-soft: rgba(107, 140, 255, .14);
    --cyan: #3fd6ef;
    --lime: #a6e24a;
    --violet: #a58bff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .25);
    --shadow: 0 2px 6px rgba(0, 0, 0, .3), 0 30px 80px -24px rgba(0, 0, 0, .7);
    --dot: rgba(242, 239, 232, .14);
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-width: 320px; background: var(--bg); color: var(--ink);
    font: 400 16px/1.6 var(--font); -webkit-font-smoothing: antialiased;
    transition: background-color .35s ease, color .35s ease;
    overflow-x: hidden;
}
::selection { background: var(--accent); color: #fff; }
a { color: inherit; }
img, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
kbd {
    display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; height: 1.6em; padding: 0 .4em;
    border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface);
    font: 500 .72em/1 var(--mono); color: var(--muted);
}
code { font: 500 .9em var(--mono); padding: .1em .35em; border-radius: 5px; background: var(--surface-2); }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 999; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); text-decoration: none; transition: top .2s; }
.skip-link:focus { top: 16px; }
.shell { width: min(calc(100% - 48px), var(--max)); margin-inline: auto; }

.progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), var(--blue)); }

/* ============ Header ============ */
.header { position: sticky; top: 0; z-index: 50; transition: background-color .3s, border-color .3s, backdrop-filter .3s; border-bottom: 1px solid transparent; }
.header.scrolled { background: color-mix(in srgb, var(--bg) 78%, transparent); border-color: var(--line); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); }
.nav { height: 68px; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 600 1.02rem/1 var(--font); letter-spacing: -.02em; }
.brand img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--line); transition: transform .5s var(--ease); }
.brand:hover img { transform: rotate(-12deg) scale(1.06); }
.brand b { color: var(--accent); }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a { position: relative; padding: 8px 12px; border-radius: 999px; color: var(--muted); font-size: .88rem; font-weight: 500; text-decoration: none; transition: color .2s, background-color .2s; }
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.nav-links a.active { color: var(--ink); }
.nav-links a.active::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.nav-tools { display: flex; align-items: center; gap: 10px; }
.cmd-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: .84rem; transition: border-color .2s, color .2s, box-shadow .2s; }
.cmd-btn:hover { color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.cmd-btn svg { width: 15px; height: 15px; }
.cmd-btn kbd { font-size: .68rem; }

.theme-switch { position: relative; display: inline-grid; grid-template-columns: repeat(3, 32px); height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.theme-switch button { position: relative; z-index: 1; display: grid; place-items: center; border: 0; border-radius: 999px; background: transparent; color: var(--quiet); cursor: pointer; transition: color .25s; }
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-checked="true"] { color: var(--ink); }
.theme-switch svg { width: 15px; height: 15px; }
.theme-thumb { position: absolute; top: 3px; left: 3px; width: 32px; height: 30px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm); transition: transform .4s var(--ease); }
html[data-theme="light"] .theme-thumb { transform: translateX(32px); }
html[data-theme="dark"] .theme-thumb { transform: translateX(64px); }

/* ============ Buttons ============ */
.btn { position: relative; display: inline-flex; align-items: center; gap: 10px; height: 50px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent; font-weight: 500; font-size: .95rem; text-decoration: none; cursor: pointer; transition: transform .35s var(--ease), box-shadow .3s, background-color .3s, border-color .3s; will-change: transform; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary::before { content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; background: linear-gradient(120deg, var(--accent), var(--blue)); filter: blur(14px); opacity: 0; transition: opacity .35s; }
.btn.primary:hover::before { opacity: .55; }
.btn.ghost { border-color: var(--line-strong); background: color-mix(in srgb, var(--surface) 70%, transparent); font-family: var(--mono); font-size: .84rem; }
.btn.ghost:hover { border-color: var(--ink); }

/* ============ Hero ============ */
.hero { position: relative; isolation: isolate; min-height: calc(100svh - 68px); display: flex; align-items: center; padding-block: 48px 72px; }
.hero-field { position: absolute; inset: -68px 0 0; z-index: -1; width: 100%; height: calc(100% + 68px); mask-image: linear-gradient(to bottom, #000 60%, transparent); -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: clamp(40px, 6vw, 96px); align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 28px; padding: 7px 14px 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(8px); font: 500 .74rem/1 var(--mono); color: var(--muted); letter-spacing: .02em; }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: ping 2.2s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 9px transparent; } }
.hero h1 { margin: 0; font-size: clamp(3rem, 7.6vw, 7.2rem); font-weight: 600; line-height: .95; letter-spacing: -.055em; }
.det-word { position: relative; display: inline-block; padding: 0 .08em; font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.02em; color: var(--accent); }
.det-word.alt { color: var(--blue); }
.det-word::before { content: ""; position: absolute; inset: 0 -.04em -.02em; border: 2px solid currentColor; border-radius: 3px; opacity: 0; transform: scale(1.25); transition: opacity .35s, transform .5s var(--ease); }
.det-pill { position: absolute; left: -2px; top: 0; transform: translateY(-100%); padding: 4px 7px; font-size: clamp(.6rem, .9vw, .78rem); line-height: 1; border-radius: 3px 3px 3px 0; background: currentColor; white-space: nowrap; opacity: 0; transition: opacity .3s .15s; pointer-events: none; }
.det-pill > span { display: block; color: var(--bg); font: 500 1em/1 var(--mono); letter-spacing: 0; font-style: normal; }
.det-word.on::before, .det-word:hover::before { opacity: 1; transform: none; }
.det-word.on > .det-pill, .det-word:hover > .det-pill { opacity: 1; }
.lede { max-width: 580px; margin: 30px 0 0; color: var(--muted); font-size: clamp(1.02rem, 1.35vw, 1.18rem); line-height: 1.7; }
.lede strong { color: var(--ink); font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hint { margin: 26px 0 0; color: var(--quiet); font-size: .82rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Perception viewport */
.viewport { position: relative; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 24px; background: color-mix(in srgb, var(--surface) 86%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(14px); transform-style: preserve-3d; transition: transform .25s ease-out; }
.vp-bar { display: flex; align-items: center; gap: 9px; padding: 4px 6px 12px; font: 500 .72rem/1 var(--mono); color: var(--muted); }
.rec { width: 8px; height: 8px; border-radius: 50%; background: #ff3b30; animation: blink 1.4s steps(1) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.vp-fps { margin-left: auto; color: var(--quiet); }
.vp-screen { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #0b0b0e; cursor: crosshair; touch-action: none; }
.vp-screen canvas { width: 100%; height: 100%; }
.vp-screen[data-mode="points"] { cursor: grab; }
.vp-screen[data-mode="points"]:active { cursor: grabbing; }
.vp-readout { position: absolute; left: 10px; bottom: 10px; padding: 5px 8px; border-radius: 6px; background: rgba(0, 0, 0, .55); color: #fff; font: 500 .68rem/1 var(--mono); backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s; pointer-events: none; }
.vp-readout.show { opacity: 1; }
.vp-modes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 10px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.vp-modes button { height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font: 500 .7rem/1 var(--mono); transition: background-color .2s, color .2s, box-shadow .2s; }
.vp-modes button:hover { color: var(--ink); }
.vp-modes button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.vp-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 12px; padding: 8px 6px 2px; }
.vp-stats div { padding: 0 10px; border-left: 1px solid var(--line); }
.vp-stats div:first-child { padding-left: 0; border: 0; }
.vp-stats strong { display: block; font-size: 1.3rem; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.vp-stats span { color: var(--quiet); font: 400 .64rem/1.3 var(--mono); }

/* Ticker */
.ticker { position: relative; overflow: hidden; border-block: 1px solid var(--line); background: var(--surface); }
.ticker::before, .ticker::after { content: ""; position: absolute; top: 0; bottom: 0; z-index: 1; width: 80px; pointer-events: none; }
.ticker::before { left: 0; background: linear-gradient(90deg, var(--surface), transparent); }
.ticker::after { right: 0; background: linear-gradient(-90deg, var(--surface), transparent); }
.ticker-track { display: flex; width: max-content; padding: 14px 0; animation: ticker 50s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.tk { display: inline-flex; align-items: center; gap: 8px; margin-right: 34px; font: 500 .78rem/1 var(--mono); color: var(--muted); white-space: nowrap; }
.tk i { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--c); border-radius: 2px; }
.tk b { color: var(--ink); font-weight: 500; }
.tk small { color: var(--quiet); font-size: .72rem; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ============ Sections ============ */
.section { padding-block: clamp(96px, 12vw, 160px); scroll-margin-top: 40px; }
.section-head { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: clamp(40px, 5vw, 64px); max-width: 860px; }
.kicker { display: flex; align-items: center; gap: 10px; margin: 0; font: 500 .76rem/1 var(--mono); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.kicker span { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .7rem; }
.section-head h2 { margin: 6px 0 0; font-size: clamp(2.4rem, 5.6vw, 5rem); font-weight: 600; line-height: .98; letter-spacing: -.05em; }
.section-head h2 em { color: var(--accent); }
.section-sub { margin: 10px 0 0; max-width: 560px; color: var(--muted); font-size: 1.05rem; }

/* ============ Lab ============ */
.lab { display: grid; grid-template-columns: minmax(250px, .36fr) 1fr; gap: 20px; align-items: start; }
.lab-stages { display: grid; gap: 8px; position: sticky; top: 90px; }
.stage { position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: left; cursor: pointer; overflow: hidden; transition: border-color .25s, box-shadow .25s, transform .3s var(--ease); }
.stage::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); transform: scaleY(0); transition: transform .4s var(--ease); }
.stage:hover { border-color: var(--line-strong); transform: translateX(3px); }
.stage[aria-selected="true"] { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.stage[aria-selected="true"]::before { transform: none; }
.stage-num { font: 500 .72rem/1.6 var(--mono); color: var(--quiet); }
.stage[aria-selected="true"] .stage-num { color: var(--accent); }
.stage-name { font-weight: 600; font-size: 1.05rem; letter-spacing: -.02em; }
.stage-desc { grid-column: 2; max-height: 0; overflow: hidden; opacity: 0; color: var(--muted); font-size: .86rem; line-height: 1.5; transition: max-height .45s var(--ease), opacity .3s; }
.stage[aria-selected="true"] .stage-desc { max-height: 120px; opacity: 1; }

.lab-view { min-width: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); padding: 12px; box-shadow: var(--shadow); }
.lab-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 44px; padding: 0 2px 10px; }
.tool-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.tool-group[hidden] { display: none; }
.tool-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; font-size: .82rem; font-weight: 500; transition: border-color .2s, background-color .2s, transform .15s; white-space: nowrap; }
.tool-btn:hover { border-color: var(--line-strong); }
.tool-btn:active { transform: scale(.97); }
.tool-btn svg { width: 14px; height: 14px; }
.tool-btn.small { height: 30px; padding: 0 10px; font-size: .76rem; }
.tool-btn.toggle[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tool-meta { margin-left: auto; font: 500 .72rem/1 var(--mono); color: var(--quiet); white-space: nowrap; }
.tool-range { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font: 500 .74rem/1 var(--mono); color: var(--muted); }
.tool-range output { min-width: 2.4em; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 110px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--fill, 100%), var(--line) var(--fill, 100%)); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: var(--shadow-sm); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.seg-ctl { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.seg-ctl button { height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: .76rem; font-weight: 500; transition: background-color .2s, color .2s; white-space: nowrap; }
.seg-ctl button:hover { color: var(--ink); }
.seg-ctl button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.lab-canvas-wrap { position: relative; border-radius: 14px; overflow: hidden; background: var(--bg-2); aspect-ratio: 48 / 30; }
.lab-canvas-wrap canvas { width: 100%; height: 100%; touch-action: manipulation; }
.lab-canvas-wrap[data-stage="3"] canvas { cursor: crosshair; }
.lab-tip { position: absolute; z-index: 2; max-width: 240px; padding: 8px 10px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--bg); font: 500 .7rem/1.5 var(--mono); pointer-events: none; box-shadow: var(--shadow); white-space: pre; }
.lab-hud { min-height: calc(4 * 1.6em + 16px); margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font: 500 .7rem/1.6 var(--mono); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.lab-caption { margin: 12px 4px 2px; color: var(--muted); font-size: .9rem; min-height: 1.5em; }
.lab-caption b { color: var(--ink); font-weight: 600; }

/* ============ Arc ============ */
.arc { padding: clamp(22px, 4vw, 44px); border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.arc-display { position: relative; display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 5vw, 64px); align-items: start; min-height: 230px; }
.arc-year { display: flex; align-items: flex-start; gap: 6px; font-size: clamp(4.2rem, 11vw, 9.5rem); font-weight: 700; line-height: .82; letter-spacing: -.07em; font-variant-numeric: tabular-nums; background: linear-gradient(160deg, var(--ink) 30%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.arc-year small { margin-top: .2em; font: 500 .8rem/1 var(--mono); letter-spacing: 0; color: var(--accent); -webkit-text-fill-color: var(--accent); }
.arc-body { max-width: 560px; padding-right: 90px; }
.arc-tag { margin: 4px 0 10px; font: 500 .74rem/1 var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.arc-body h3 { margin: 0 0 12px; font-size: clamp(1.5rem, 2.6vw, 2.2rem); font-weight: 600; line-height: 1.1; letter-spacing: -.035em; }
.arc-body p { margin: 0; color: var(--muted); }
.arc-body.swap { animation: swap .45s var(--ease); }
@keyframes swap { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } }
.arc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 0; padding: 0; list-style: none; }
.arc-chips li { padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; font: 500 .72rem/1 var(--mono); color: var(--muted); }
.arc-replay { position: absolute; top: 0; right: 0; }
.arc-track { position: relative; margin-top: 40px; height: 130px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.arc-track:focus-visible { outline-offset: 8px; }
.arc-lane { position: absolute; left: 0; right: 0; height: 4px; }
.arc-lane.main { top: 34px; }
.arc-lane.side { top: 76px; }
.arc-rail { position: absolute; inset: 0; border-radius: 4px; background: var(--line); }
.arc-rail.dotted { height: 0; top: 2px; background: none; border-top: 2px dotted var(--line-strong); border-radius: 0; }
.arc-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: linear-gradient(90deg, var(--blue), var(--accent)); width: 100%; }
.arc-markers, .arc-sides { position: absolute; inset: 0; pointer-events: none; }
.arc-marker { position: absolute; top: 36px; transform: translate(-50%, -50%); width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--surface); background: var(--line-strong); box-shadow: 0 0 0 1px var(--line-strong); transition: background-color .3s, transform .3s var(--ease); }
.arc-marker.passed { background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.arc-marker.current { transform: translate(-50%, -50%) scale(1.35); }
.arc-marker span { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); font: 500 .66rem/1 var(--mono); color: var(--quiet); white-space: nowrap; }
.arc-marker.current span { color: var(--ink); }
.arc-side { position: absolute; top: 78px; transform: translate(-50%, -50%); width: 10px; height: 10px; border-radius: 3px; rotate: 45deg; background: var(--surface); border: 2px solid var(--blue); pointer-events: auto; cursor: help; transition: background-color .25s, scale .25s var(--ease); }
.arc-side.passed { background: var(--blue); }
.arc-side:hover, .arc-side.near { scale: 1.5; }
.arc-side-tip { position: absolute; top: 92px; transform: translateX(-50%); padding: 6px 9px; border-radius: 8px; background: var(--ink); color: var(--bg); font: 500 .68rem/1.3 var(--mono); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .2s; }
.arc-side-tip.show { opacity: 1; }
.arc-knob { position: absolute; top: 36px; left: 100%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink); box-shadow: var(--shadow), 0 0 0 6px var(--accent-soft); pointer-events: none; transition: box-shadow .2s; }
.arc-knob::after { content: ""; position: absolute; left: 50%; top: 22px; width: 1px; height: 64px; background: linear-gradient(var(--ink), transparent); }
.arc-track.dragging .arc-knob { box-shadow: var(--shadow), 0 0 0 10px var(--accent-soft); }
.arc-years { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font: 500 .7rem/1 var(--mono); color: var(--quiet); }
.arc-years span { width: 0; display: flex; justify-content: center; }

/* ============ Workshop ============ */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.filter { height: 36px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-size: .86rem; font-weight: 500; transition: all .2s; }
.filter:hover { color: var(--ink); border-color: var(--line-strong); }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.workshop { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.card { --mx: 50%; --my: 50%; position: relative; grid-column: span 2; display: flex; flex-direction: column; min-height: 330px; padding: 10px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: inherit; text-decoration: none; overflow: hidden; transform-style: preserve-3d; transition: transform .3s var(--ease), border-color .3s, box-shadow .3s, opacity .35s; }
.card.wide { grid-column: span 3; }
.card::before { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none; background: radial-gradient(420px circle at var(--mx) var(--my), color-mix(in srgb, var(--accent) 12%, transparent), transparent 45%); opacity: 0; transition: opacity .3s; }
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.card.hide { display: none; }
.card-art { position: relative; height: 170px; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.card-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 16px 8px 6px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card h3 { margin: 0; font-size: 1.2rem; font-weight: 600; letter-spacing: -.025em; }
.card-arrow { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); transition: transform .35s var(--ease), background-color .3s, color .3s; flex: none; }
.card:hover .card-arrow { transform: rotate(45deg); background: var(--accent); color: #fff; border-color: var(--accent); }
.card-arrow svg { width: 14px; height: 14px; }
.card p { margin: 8px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.card-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: auto; padding-top: 16px; font: 500 .7rem/1 var(--mono); color: var(--quiet); }
.card-meta .lang::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--lc, var(--accent)); vertical-align: -1px; }
.workshop-more { margin: 28px 0 0; text-align: center; }
.workshop-more a { color: var(--muted); font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--line-strong); padding-bottom: 3px; transition: color .2s, border-color .2s; }
.workshop-more a:hover { color: var(--accent); border-color: var(--accent); }

/* card art animations */
.art-stroke { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.art-poly { stroke-dasharray: 520; }
.art-poly-fill { fill: var(--accent-soft); }
.art-vert { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.card:hover .art-poly { animation: draw-poly 1.2s var(--ease) both; }
.card:hover .art-vert circle { animation: pop .4s var(--ease) both; }
.card:hover .art-vert circle:nth-child(odd) { animation-delay: .15s; }
@keyframes draw-poly { from { stroke-dashoffset: 520; } to { stroke-dashoffset: 0; } }
.art-frames { transition: transform 1.4s var(--ease); }
.card:hover .art-frames { transform: translateX(-90px); }
.art-panel { transition: transform .6s var(--ease); transform: translateX(60px); }
.card:hover .art-panel { transform: none; }
.art-spin { transform-origin: 50% 50%; transform-box: fill-box; }
.card:hover .art-spin { animation: spin 1.2s var(--ease); }
@keyframes spin { to { transform: rotate(360deg); } }
.art-bubble { transform-box: fill-box; }
.card:hover .art-bubble { animation: bubble .45s var(--ease) both; }
.card:hover .art-bubble:nth-of-type(2) { animation-delay: .25s; }
.card:hover .art-bubble:nth-of-type(3) { animation-delay: .5s; }
@keyframes bubble { from { opacity: 0; transform: translateY(10px); } }
.art-line { stroke-dasharray: 320; }
.card:hover .art-line { animation: draw-line .6s var(--ease) both; }
.card:hover .art-line:nth-of-type(2) { animation-delay: .15s; }
.card:hover .art-line:nth-of-type(3) { animation-delay: .3s; }
.card:hover .art-line:nth-of-type(4) { animation-delay: .45s; }
@keyframes draw-line { from { stroke-dashoffset: 320; } to { stroke-dashoffset: 0; } }

/* ============ Shell ============ */
.shell-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(32px, 5vw, 72px); align-items: start; }
.shell-grid .section-head { margin: 0; position: sticky; top: 100px; }
.term-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.term-suggest button { height: 32px; padding: 0 12px; border: 1px dashed var(--line-strong); border-radius: 8px; background: transparent; cursor: pointer; font: 500 .78rem/1 var(--mono); color: var(--muted); transition: all .2s; }
.term-suggest button:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
.term { border-radius: 18px; overflow: hidden; background: #111114; color: #e8e5de; box-shadow: var(--shadow); border: 1px solid #26262c; }
html.dark .term { background: #08080a; }
.term-bar { display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; background: #1b1b20; border-bottom: 1px solid #26262c; font: 500 .72rem/1 var(--mono); color: #8d8a83; }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-left: auto; margin-right: auto; transform: translateX(-24px); }
.term-body { height: 440px; padding: 16px 18px; overflow-y: auto; font: 400 .84rem/1.65 var(--mono); cursor: text; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.term-body a { color: #7fd4ff; }
#term-out > div { white-space: pre-wrap; word-break: break-word; }
.term-line { display: flex; align-items: baseline; gap: 10px; }
.term-prompt, .t-prompt { color: #ff8a5c; white-space: nowrap; }
.term-line input { flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; caret-color: #ff8a5c; }
.t-dim { color: #8d8a83; }
.t-acc { color: #ff8a5c; }
.t-blue { color: #8ea6ff; }
.t-cyan { color: #5fe0f5; }
.t-lime { color: #b4ea6a; }
.t-err { color: #ff6b6b; }
.t-ok { color: #6ee7a8; }
.t-bad { color: #ff6b6b; text-decoration: underline; }
.t-cur { background: #ff8a5c; color: #111; }
.t-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; }
.t-neo { display: flex; gap: 22px; flex-wrap: wrap; }
.t-neo pre { margin: 0; font: inherit; color: #ff8a5c; }

/* ============ Contact ============ */
.contact { position: relative; overflow: hidden; }
.hello { margin: 18px 0 clamp(40px, 6vw, 70px); font-size: clamp(4.4rem, 17vw, 16rem); font-weight: 300; line-height: .85; letter-spacing: -.06em; white-space: nowrap; user-select: none; -webkit-user-select: none; }
.hello span { display: inline-block; transition: color .3s; will-change: font-weight; }
.hello span.dot { color: var(--accent); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 72px); align-items: start; }
.contact-mail p { margin: 0 0 20px; color: var(--muted); font-size: 1.08rem; max-width: 420px; }
.mail-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; width: 100%; padding: 26px 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); cursor: pointer; text-align: left; overflow: hidden; transition: border-color .3s, transform .3s var(--ease), box-shadow .3s; }
.mail-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, var(--accent-soft) 50%, transparent 70%); transform: translateX(-100%); transition: transform .8s var(--ease); }
.mail-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-3px); }
.mail-card:hover::before { transform: translateX(100%); }
.mail-addr { position: relative; font-size: clamp(1.3rem, 2.8vw, 2.1rem); font-weight: 500; letter-spacing: -.03em; }
.mail-state { position: relative; font: 500 .74rem/1 var(--mono); color: var(--quiet); }
.mail-card.copied .mail-state { color: var(--lime); }
.mail-link { display: inline-block; margin-top: 14px; color: var(--muted); font-size: .88rem; text-decoration: none; }
.mail-link:hover { color: var(--accent); }
.socials { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.socials li { border-bottom: 1px solid var(--line); }
.socials a { position: relative; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 16px; padding: 22px 4px; text-decoration: none; overflow: hidden; }
.socials a::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink); transform: scaleY(0); transform-origin: bottom; transition: transform .45s var(--ease); }
.socials a:hover { color: var(--bg); padding-left: 18px; padding-right: 18px; }
.socials a { transition: color .3s, padding .45s var(--ease); isolation: isolate; }
.socials a:hover::before { transform: none; }
.s-name { font-size: clamp(1.5rem, 3vw, 2.3rem); font-weight: 500; letter-spacing: -.04em; }
.s-handle { font: 500 .8rem/1 var(--mono); color: var(--quiet); }
.socials a:hover .s-handle { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.s-arrow { font-size: 1.4rem; transition: transform .4s var(--ease); }
.socials a:hover .s-arrow { transform: rotate(45deg); color: var(--accent); }

.footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-block: 32px 40px; border-top: 1px solid var(--line); font: 500 .74rem/1.5 var(--mono); color: var(--quiet); }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--accent); }
.footer-secret { opacity: .6; letter-spacing: .1em; }

/* ============ Vision mode ============ */
.vision { position: fixed; left: 0; top: 0; z-index: 80; width: 40px; height: 40px; pointer-events: none; border: 2px solid var(--accent); border-radius: 3px; opacity: 0; transition: opacity .25s, border-color .25s; will-change: transform, width, height; }
.vision::before, .vision::after { content: ""; position: absolute; width: 8px; height: 8px; border-color: var(--accent); border-style: solid; }
.vision::before { right: -6px; bottom: -6px; border-width: 0 2px 2px 0; }
.vision::after { left: -6px; bottom: -6px; border-width: 0 0 2px 2px; }
html.vision-on .vision.active { opacity: 1; }
.vision-label { position: absolute; left: -2px; bottom: 100%; padding: 3px 7px; border-radius: 3px 3px 3px 0; background: var(--accent); color: #fff; font: 500 .66rem/1.2 var(--mono); white-space: nowrap; }
.vision.label-below .vision-label { bottom: auto; top: 100%; border-radius: 0 3px 3px 3px; }
.vision.snapped { border-color: var(--blue); }
.vision.snapped::before, .vision.snapped::after { border-color: var(--blue); }
.vision.snapped .vision-label { background: var(--blue); }
.vision-toggle { position: fixed; right: 18px; bottom: 18px; z-index: 70; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(12px); box-shadow: var(--shadow-sm); cursor: pointer; font: 500 .74rem/1 var(--mono); color: var(--muted); transition: color .2s, border-color .2s, opacity .3s, transform .3s var(--ease); }
.vision-toggle:hover { color: var(--ink); border-color: var(--line-strong); }
.vt-dot { width: 10px; height: 10px; border: 2px solid currentColor; border-radius: 2px; }
.vision-toggle[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.vision-toggle[aria-pressed="true"] .vt-dot { background: var(--accent); }

/* ============ Toast, confetti ============ */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 120; padding: 11px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: .88rem; font-weight: 500; box-shadow: var(--shadow); transform: translate(-50%, 140%); opacity: 0; transition: transform .45s var(--ease), opacity .3s; pointer-events: none; white-space: nowrap; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.confetti { position: fixed; z-index: 110; pointer-events: none; border: 2px solid var(--c); border-radius: 2px; }
.confetti span { position: absolute; left: -2px; bottom: 100%; padding: 1px 4px; background: var(--c); color: #fff; font: 500 9px/1.2 var(--mono); white-space: nowrap; border-radius: 2px 2px 2px 0; }

/* ============ Palette ============ */
.palette { width: min(600px, calc(100% - 32px)); max-height: min(520px, 80vh); margin: 12vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink); box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .5); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); overflow: hidden; }
.palette::backdrop { background: rgba(10, 10, 12, .35); backdrop-filter: blur(3px); }
.palette[open] { animation: pop .28s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.palette-inner { display: flex; flex-direction: column; max-height: inherit; }
.palette-search { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette-search svg { width: 18px; height: 18px; color: var(--quiet); flex: none; }
.palette-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1.02rem; }
.palette-list { flex: 1; margin: 0; padding: 8px; list-style: none; overflow-y: auto; }
.palette-group { padding: 10px 10px 6px; font: 500 .66rem/1 var(--mono); color: var(--quiet); text-transform: uppercase; letter-spacing: .06em; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: .92rem; }
.palette-item .pi-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); font-size: .85rem; flex: none; }
.palette-item .pi-hint { margin-left: auto; font: 500 .7rem/1 var(--mono); color: var(--quiet); }
.palette-item[aria-selected="true"] { background: var(--accent-soft); }
.palette-item[aria-selected="true"] .pi-icon { background: var(--accent); color: #fff; }
.palette-empty { padding: 26px; text-align: center; color: var(--quiet); font-size: .9rem; }
.palette-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: .74rem; color: var(--quiet); }
.palette-foot span { display: inline-flex; gap: 4px; align-items: center; }

/* ============ Reveal ============ */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.visible { opacity: 1; transform: none; }
.hero .reveal:nth-child(2) { transition-delay: .08s; }
.hero .reveal:nth-child(3) { transition-delay: .16s; }
.hero .reveal:nth-child(4) { transition-delay: .24s; }
.hero .reveal:nth-child(5) { transition-delay: .32s; }
.viewport.reveal { transition-delay: .2s; }

html.party .det-word, html.party .section-head h2 em, html.party .brand b { animation: hue 1.6s linear infinite; }
@keyframes hue { to { filter: hue-rotate(360deg); } }

/* ============ Responsive ============ */
@media (max-width: 1080px) {
    .nav-links { display: none; }
    .nav-tools { margin-left: auto; }
    .workshop { grid-template-columns: repeat(2, 1fr); }
    .card, .card.wide { grid-column: span 1; }
}
@media (max-width: 920px) {
    .hero { min-height: auto; padding-block: 40px 80px; }
    .hero-inner { grid-template-columns: 1fr; }
    .viewport { max-width: 460px; width: 100%; justify-self: center; }
    .lab { grid-template-columns: 1fr; }
    .lab-stages { position: relative; top: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; padding-bottom: 4px; scrollbar-width: none; }
    .lab-stages::-webkit-scrollbar { display: none; }
    .stage { flex: 0 0 auto; scroll-snap-align: start; grid-template-columns: auto auto; padding: 12px 14px; }
    .stage:hover { transform: none; }
    .stage-desc { display: none; }
    .shell-grid { grid-template-columns: 1fr; }
    .shell-grid .section-head { position: static; }
    .contact-grid { grid-template-columns: 1fr; }
    .arc-display { grid-template-columns: 1fr; gap: 12px; }
    .arc-body { padding-right: 0; }
}
@media (max-width: 640px) {
    .shell { width: min(calc(100% - 32px), var(--max)); }
    .nav { height: 60px; gap: 12px; }
    .cmd-label, .cmd-btn kbd { display: none; }
    .cmd-btn { width: 38px; padding: 0; justify-content: center; }
    .hero h1 { font-size: clamp(2.9rem, 14.5vw, 4.2rem); }
    .hint { display: none; }
    .btn { height: 48px; padding: 0 18px; }
    .workshop { grid-template-columns: 1fr; }
    .card { min-height: 0; }
    .lab-view { padding: 8px; border-radius: 18px; }
    .tool-meta { margin-left: 0; }
    input[type="range"] { width: 84px; }
    .lab-hud { font-size: .62rem; padding: 6px 9px; }
    .term-body { height: 380px; font-size: .76rem; padding: 12px; }
    .t-row { grid-template-columns: 96px 1fr; }
    .arc { padding: 20px 16px; }
    .arc-replay { position: static; justify-self: start; }
    .arc-marker span { display: none; }
    .footer { flex-direction: column; align-items: flex-start; gap: 6px; }
    .vision-toggle { display: none; }
    .socials a { grid-template-columns: 1fr auto; }
    .s-handle { display: none; }
}
@media (hover: none) {
    .vision-toggle { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .reveal { opacity: 1; transform: none; }
}
