:root {
  --bg: #0a1512;
  --surface: #12211d;
  --surface-2: #143029;
  --border: #22332e;
  --text: #e9f5f1;
  --muted: #8fb3aa;
  --brand: #2dd4bf;
  --brand-strong: #14b8a6;
  --brand-dark: #0e2a25;
  --peach: #f3b582;
  --shadow: rgba(0, 0, 0, 0.32);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

body[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f3faf8;
  --surface-2: #e4f6f1;
  --border: #dbebe6;
  --text: #0c201b;
  --muted: #557b72;
  --brand: #0c8175;
  --brand-strong: #096a60;
  --brand-dark: #d1efe9;
  --peach: #e89c63;
  --shadow: rgba(12, 32, 27, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  transition: background 280ms ease, color 280ms ease;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 3px; }

.ambient { position: fixed; border-radius: 50%; pointer-events: none; filter: blur(2px); opacity: .7; transition: background 280ms ease; }
.ambient-one { width: 46vw; height: 46vw; right: -17vw; top: -24vw; background: radial-gradient(circle, color-mix(in srgb, var(--brand) 28%, transparent), transparent 68%); }
.ambient-two { width: 40vw; height: 40vw; left: -24vw; bottom: -30vw; background: radial-gradient(circle, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%); }

.topbar {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0; height: 72px; padding: 0 clamp(24px, 4vw, 64px);
  display: grid; grid-template-columns: 190px 1fr 190px; align-items: center; gap: 28px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: blur(20px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 760; letter-spacing: -.02em; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.progress { height: 3px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { display: block; width: 12.5%; height: 100%; background: linear-gradient(90deg, var(--brand-strong), var(--brand)); border-radius: inherit; transition: width 450ms cubic-bezier(.2,.8,.2,1); }
.top-actions { display: flex; justify-content: flex-end; gap: 8px; }
.icon-button { width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: 20px; }
.icon-button:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }

.deck { position: fixed; inset: 72px 0 72px; }
.chapter { position: absolute; inset: 0; padding: clamp(34px, 5vh, 64px) clamp(30px, 6vw, 92px); overflow: auto; opacity: 0; visibility: hidden; transform: translateX(32px) scale(.99); transition: opacity 360ms ease, transform 430ms cubic-bezier(.2,.8,.2,1), visibility 0s 430ms; }
.chapter.active { opacity: 1; visibility: visible; transform: translateX(0) scale(1); transition-delay: 0s; }
.chapter.exiting { transform: translateX(-32px) scale(.99); }
.section-heading { max-width: 960px; margin-bottom: clamp(28px, 5vh, 54px); }
.section-heading.compact { margin-bottom: 28px; }
.section-heading h2, .final-layout h2 { margin: 8px 0 12px; font-size: clamp(2.1rem, 4.3vw, 4.5rem); line-height: 1.02; letter-spacing: -.055em; }
.section-heading p { margin: 0; color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.25rem); line-height: 1.6; }
.eyebrow { color: var(--brand); font-size: .78rem; font-weight: 800; letter-spacing: .13em; }

.chapter-grid { min-height: 100%; display: grid; align-content: center; }
.intro-grid { grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); column-gap: clamp(30px, 6vw, 100px); }
.intro-grid > .eyebrow { grid-column: 1 / -1; margin-bottom: 20px; }
.intro-copy { align-self: center; }
.kicker { margin: 0 0 16px; color: var(--brand); font-size: clamp(1rem, 1.5vw, 1.3rem); font-weight: 700; }
h1 { margin: 0; max-width: 850px; font-size: clamp(3.4rem, 7.5vw, 7.3rem); line-height: .92; letter-spacing: -.075em; }
.lead { max-width: 760px; color: var(--muted); font-size: clamp(1.15rem, 1.7vw, 1.45rem); line-height: 1.55; }
.lead strong { color: var(--text); }
.primary-button { display: inline-flex; align-items: center; gap: 18px; padding: 14px 22px; border: 0; border-radius: 14px; background: linear-gradient(135deg, var(--brand-strong), var(--brand)); color: #052420; font-weight: 800; cursor: pointer; box-shadow: 0 16px 40px color-mix(in srgb, var(--brand) 18%, transparent); }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 20px 48px color-mix(in srgb, var(--brand) 25%, transparent); }
.primary-button.small { padding: 12px 18px; white-space: nowrap; }
.intro-visual { position: relative; width: min(42vw, 540px); aspect-ratio: 1; justify-self: end; align-self: center; }
.core-card { position: absolute; inset: 31%; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid color-mix(in srgb, var(--brand) 46%, var(--border)); border-radius: 28%; background: linear-gradient(145deg, color-mix(in srgb, var(--surface) 86%, var(--brand)), var(--surface)); box-shadow: 0 26px 60px var(--shadow), inset 0 1px 0 color-mix(in srgb, var(--text) 14%, transparent); z-index: 3; }
.core-mark { color: var(--brand); font-size: 2.3rem; }
.core-card strong { font-size: 1.25rem; }
.core-card small { color: var(--muted); margin-top: 4px; }
.orbit { position: absolute; border: 1px solid color-mix(in srgb, var(--brand) 42%, transparent); border-radius: 50%; }
.orbit-one { inset: 17%; }
.orbit-two { inset: 5%; border-style: dashed; opacity: .55; animation: spin 24s linear infinite; }
.satellite { position: absolute; z-index: 4; display: grid; place-items: center; min-width: 96px; min-height: 52px; padding: 10px 16px; border: 1px solid var(--border); border-radius: 17px; background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: 0 14px 28px var(--shadow); color: var(--text); font-weight: 750; }
.satellite-a { top: 8%; left: 24%; }
.satellite-b { top: 28%; right: 0; }
.satellite-c { bottom: 15%; right: 13%; }
.satellite-d { bottom: 7%; left: 12%; }
@keyframes spin { to { transform: rotate(360deg); } }

.stack-layout { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(420px, 1.15fr); gap: clamp(24px, 5vw, 72px); align-items: stretch; }
.stack-list { display: grid; gap: 10px; }
.stack-item { display: grid; grid-template-columns: 42px 1fr; text-align: left; gap: 2px 14px; padding: 15px 17px; border: 1px solid var(--border); border-radius: 16px; background: color-mix(in srgb, var(--surface) 74%, transparent); color: var(--text); cursor: pointer; }
.stack-item > span { grid-row: 1 / 3; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-dark); color: var(--brand); font-weight: 850; font-size: .8rem; }
.stack-item strong { font-size: 1rem; }
.stack-item small { color: var(--muted); }
.stack-item:hover, .stack-item.active { transform: translateX(8px); border-color: var(--brand); background: color-mix(in srgb, var(--surface-2) 88%, transparent); }
.explain-card { min-height: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(26px, 4vw, 52px); background: linear-gradient(145deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--brand-dark) 70%, transparent)); box-shadow: 0 28px 70px var(--shadow); }
.explain-card .detail-index { color: var(--brand); font-weight: 850; letter-spacing: .1em; }
.explain-card h3 { margin: 22px 0 14px; font-size: clamp(2rem, 3.4vw, 3.4rem); letter-spacing: -.045em; }
.explain-card p { max-width: 730px; color: var(--muted); font-size: 1.12rem; line-height: 1.7; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 26px; }
.detail-tags span { padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .9rem; }

.engine-layout { display: grid; grid-template-columns: minmax(290px, .8fr) minmax(460px, 1.2fr); gap: clamp(24px, 5vw, 70px); }
.engine-rail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stage-button { min-height: 86px; padding: 14px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.stage-button span { display: block; color: var(--brand); font-weight: 850; font-size: .76rem; letter-spacing: .08em; margin-bottom: 8px; }
.stage-button strong { font-size: 1rem; }
.stage-button:hover, .stage-button.active { border-color: var(--brand); background: var(--surface-2); transform: translateY(-3px); box-shadow: 0 14px 34px var(--shadow); }
.engine-detail { position: relative; overflow: hidden; min-height: 390px; padding: clamp(28px, 4vw, 50px); border: 1px solid var(--border); border-radius: 28px; background: linear-gradient(140deg, var(--surface), color-mix(in srgb, var(--brand-dark) 72%, var(--surface))); }
.engine-detail::after { content: ""; position: absolute; width: 260px; height: 260px; right: -110px; bottom: -130px; border: 1px solid color-mix(in srgb, var(--brand) 55%, transparent); border-radius: 50%; }
.skill-chip { display: inline-flex; padding: 7px 11px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 15%, transparent); color: var(--brand); font-size: .82rem; font-weight: 760; }
.engine-detail h3 { margin: 20px 0 8px; font-size: clamp(2rem, 3.2vw, 3.2rem); letter-spacing: -.045em; }
.engine-detail > p { color: var(--muted); font-size: 1.08rem; line-height: 1.65; max-width: 710px; }
.record-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 28px; }
.record-box { padding: 16px; border: 1px solid var(--border); border-radius: 15px; background: color-mix(in srgb, var(--bg) 44%, transparent); }
.record-box span { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 6px; }
.record-box strong { font-size: .95rem; }

.demo-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; max-width: none; }
.demo-heading h2 { font-size: clamp(2rem, 3.7vw, 3.7rem); }
.demo-console { display: grid; grid-template-columns: .9fr 1.6fr .75fr; gap: 16px; align-items: stretch; }
.prompt-card, .pipeline, .demo-result { border: 1px solid var(--border); border-radius: 20px; background: color-mix(in srgb, var(--surface) 90%, transparent); }
.prompt-card { padding: 22px; }
.prompt-label { color: var(--brand); font-size: .78rem; font-weight: 800; letter-spacing: .08em; }
.prompt-card blockquote { margin: 20px 0 0; font-size: 1.15rem; line-height: 1.55; font-weight: 630; }
.pipeline { padding: 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.pipe-step { position: relative; min-height: 92px; padding: 13px; border: 1px solid var(--border); border-radius: 15px; background: var(--bg); transition: .3s ease; }
.pipe-step span { display: block; color: var(--muted); font-size: .72rem; margin-bottom: 10px; }
.pipe-step strong { display: block; font-size: .9rem; }
.pipe-step small { display: block; margin-top: 7px; color: var(--muted); font-size: .72rem; }
.pipe-step.running { border-color: var(--brand); transform: translateY(-3px); box-shadow: 0 10px 28px color-mix(in srgb, var(--brand) 18%, transparent); }
.pipe-step.done { background: var(--surface-2); border-color: color-mix(in srgb, var(--brand) 70%, var(--border)); }
.pipe-step.done span { color: var(--brand); }
.demo-result { display: flex; flex-direction: column; justify-content: center; padding: 22px; }
.demo-result span { color: var(--brand); font-size: .8rem; font-weight: 800; letter-spacing: .08em; }
.demo-result strong { margin: 12px 0; font-size: 1.4rem; }
.demo-result small { color: var(--muted); line-height: 1.5; }

.lab-layout { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(24px, 5vw, 70px); }
.lab-controls { display: grid; gap: 20px; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 10px; color: var(--muted); font-size: .86rem; font-weight: 700; }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { min-height: 48px; display: grid; place-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); text-align: center; font-size: .9rem; font-weight: 700; }
.segmented input:checked + span { border-color: var(--brand); background: var(--surface-2); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.prompt-preview { padding: clamp(26px, 4vw, 44px); border: 1px solid var(--border); border-radius: 24px; background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--brand-dark) 70%, var(--surface))); }
.preview-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .83rem; }
.preview-top button { border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px; background: var(--bg); color: var(--text); cursor: pointer; }
#generatedPrompt { min-height: 128px; margin: 28px 0; font-size: clamp(1.05rem, 1.7vw, 1.35rem); line-height: 1.65; font-weight: 620; }
.customize-map { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.customize-map span { padding: 11px; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); font-size: .84rem; }
.customize-map b { color: var(--brand); }

.skill-edit-heading { max-width: 1120px; }
.skill-edit-heading h2 { font-size: clamp(2rem, 3.9vw, 4rem); }
.skill-edit-layout { display: grid; grid-template-columns: minmax(245px, .72fr) minmax(440px, 1.35fr) minmax(250px, .78fr); gap: 16px; align-items: stretch; }
.edit-tabs { display: grid; gap: 9px; }
.edit-tab { display: grid; grid-template-columns: 38px 1fr; gap: 2px 12px; min-height: 78px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 16px; background: color-mix(in srgb, var(--surface) 82%, transparent); color: var(--text); text-align: left; cursor: pointer; }
.edit-tab > span { grid-row: 1 / 3; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--brand-dark); color: var(--brand); font-size: .75rem; font-weight: 850; }
.edit-tab strong { font-size: .92rem; line-height: 1.25; }
.edit-tab small { color: var(--muted); font-size: .77rem; }
.edit-tab:hover, .edit-tab.active { border-color: var(--brand); background: var(--surface-2); transform: translateX(5px); }
.edit-detail { min-height: 410px; padding: clamp(24px, 3vw, 38px); border: 1px solid var(--border); border-radius: 24px; background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--brand-dark) 74%, var(--surface))); box-shadow: 0 24px 60px var(--shadow); }
.edit-detail .detail-index { color: var(--brand); font-size: .78rem; font-weight: 850; letter-spacing: .1em; }
.edit-detail h3 { margin: 14px 0 20px; font-size: clamp(1.7rem, 2.8vw, 2.8rem); line-height: 1.05; letter-spacing: -.04em; }
.edit-prompt { padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--brand) 42%, var(--border)); border-radius: 16px; background: color-mix(in srgb, var(--bg) 58%, transparent); }
.edit-prompt > span { color: var(--brand); font-size: .76rem; font-weight: 800; letter-spacing: .08em; }
.edit-prompt blockquote { margin: 10px 0 0; font-size: 1rem; line-height: 1.55; font-weight: 620; }
.edit-meta { display: grid; grid-template-columns: .72fr 1.28fr; gap: 10px; margin-top: 14px; }
.edit-meta > div { padding: 13px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--bg) 38%, transparent); }
.edit-meta span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .74rem; }
.edit-meta strong { font-size: .86rem; line-height: 1.42; }
.edit-cycle { padding: 22px; border: 1px solid var(--border); border-radius: 22px; background: color-mix(in srgb, var(--surface) 88%, transparent); }
.cycle-label { display: block; margin-bottom: 16px; color: var(--brand); font-size: .74rem; font-weight: 850; letter-spacing: .1em; }
.edit-cycle ol { display: grid; gap: 13px; margin: 0; padding: 0; list-style: none; }
.edit-cycle li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }
.edit-cycle li > b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: var(--brand-dark); color: var(--brand); font-size: .75rem; }
.edit-cycle li span { display: grid; gap: 2px; }
.edit-cycle li strong { font-size: .84rem; }
.edit-cycle li small { color: var(--muted); font-size: .73rem; line-height: 1.35; }
.edit-cycle code { display: block; margin-top: 18px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg); color: var(--brand); font-size: .86rem; }

.checkpoint-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.checkpoint-grid article { min-height: 250px; padding: 24px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); transition: .25s ease; }
.checkpoint-grid article:hover { transform: translateY(-6px); border-color: var(--brand); }
.checkpoint-grid article > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--brand-dark); color: var(--brand); font-weight: 850; }
.checkpoint-grid h3 { margin: 40px 0 12px; font-size: 1.3rem; }
.checkpoint-grid p { color: var(--muted); line-height: 1.6; }

.final-layout { min-height: 100%; display: flex; flex-direction: column; justify-content: center; max-width: 1180px; margin: auto; text-align: center; align-items: center; }
.final-layout h2 { font-size: clamp(3rem, 6.8vw, 6.7rem); margin-top: 18px; }
.final-statement { max-width: 920px; color: var(--muted); font-size: clamp(1.2rem, 2vw, 1.7rem); line-height: 1.55; }
.final-statement strong { color: var(--text); }
.final-pair { display: flex; align-items: center; gap: 16px; margin: 26px 0; }
.final-pair > div:not(.pair-plus) { min-width: 210px; padding: 18px 22px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); display: grid; grid-template-columns: auto 1fr; text-align: left; column-gap: 12px; }
.pair-icon { grid-row: 1 / 3; font-size: 1.6rem; color: var(--brand); }
.final-pair small { color: var(--muted); }
.pair-plus { color: var(--brand); font-size: 1.5rem; }
.doc-link { color: var(--brand); text-underline-offset: 5px; }

.controls { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 clamp(24px, 4vw, 64px); border-top: 1px solid color-mix(in srgb, var(--border) 75%, transparent); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(20px); }
.chapter-label { display: flex; align-items: center; gap: 12px; }
.chapter-label span { color: var(--brand); font-weight: 850; }
.chapter-label strong { font-size: .9rem; }
.keyboard-help { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .78rem; }
kbd { min-width: 26px; padding: 4px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 7px; background: var(--surface); color: var(--text); text-align: center; }
.nav-buttons { justify-self: end; display: flex; align-items: center; gap: 10px; }
.nav-buttons button { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; }
.nav-buttons button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.nav-buttons button:disabled { opacity: .35; cursor: default; }
.nav-buttons span { min-width: 50px; text-align: center; color: var(--muted); font-size: .8rem; }

@media (max-width: 980px) {
  .topbar { grid-template-columns: 150px 1fr auto; }
  .intro-grid { grid-template-columns: 1fr; }
  .intro-visual { display: none; }
  .stack-layout, .engine-layout, .lab-layout { grid-template-columns: 1fr; }
  .skill-edit-layout { grid-template-columns: minmax(220px, .7fr) minmax(420px, 1.3fr); }
  .edit-cycle { grid-column: 1 / -1; }
  .edit-cycle ol { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stack-list { grid-template-columns: 1fr 1fr; }
  .stack-item:last-child { grid-column: 1 / -1; }
  .demo-console { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(4, minmax(100px, 1fr)); overflow-x: auto; }
  .checkpoint-grid { grid-template-columns: 1fr 1fr; }
  .checkpoint-grid article { min-height: 190px; }
}

@media (max-width: 640px) {
  .topbar { height: 62px; grid-template-columns: auto 1fr auto; padding: 0 16px; gap: 14px; }
  .brand span, .keyboard-help { display: none; }
  .deck { inset: 62px 0 62px; }
  .chapter { padding: 28px 18px; }
  .controls { height: 62px; padding: 0 16px; grid-template-columns: 1fr auto; }
  .chapter-label strong { display: none; }
  .nav-buttons { grid-column: 2; }
  h1 { font-size: clamp(3.1rem, 15vw, 5rem); }
  .stack-list, .engine-rail, .segmented, .checkpoint-grid, .skill-edit-layout { grid-template-columns: 1fr; }
  .stack-item:last-child { grid-column: auto; }
  .record-row, .customize-map, .edit-meta { grid-template-columns: 1fr; }
  .edit-cycle { grid-column: auto; }
  .edit-cycle ol { grid-template-columns: 1fr; }
  .demo-heading { display: grid; align-items: start; }
  .final-pair { display: grid; width: 100%; }
  .final-pair > div:not(.pair-plus) { min-width: 0; }
  .pair-plus { transform: rotate(90deg); }
}

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