:root {
  --paper: #f2eee4;
  --paper-2: #e7e0d3;
  --ink: #171716;
  --muted: #716d65;
  --line: rgba(23, 23, 22, 0.22);
  --red: #ff3b1f;
  --blue: #244cff;
  --acid: #cbff36;
  --panel: #191918;
  --white: #fffdf7;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 23, 22, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 28px;
  font-family: "Arial Narrow", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.lab-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
  padding: 12px clamp(18px, 4vw, 58px);
  border-top: 5px solid var(--red);
  border-bottom: 1px solid var(--line);
  background: rgba(242, 238, 228, 0.94);
  backdrop-filter: blur(18px);
}

.lab-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--acid);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.lab-header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.lab-header-meta a {
  padding: 10px 12px;
  border: 1px solid var(--ink);
  color: inherit;
  text-decoration: none;
}

.lab-header-meta a:hover {
  color: var(--white);
  background: var(--ink);
}

.lab-shell {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  min-height: calc(100vh - 86px);
}

.demo-rail {
  position: sticky;
  top: 86px;
  align-self: start;
  height: calc(100vh - 86px);
  padding: 26px 18px;
  overflow: auto;
  border-right: 1px solid var(--line);
}

.rail-label {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.demo-tab {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 10px;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.demo-tab:last-child {
  border-bottom: 1px solid var(--line);
}

.demo-tab > span,
.demo-tab > small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.demo-tab strong {
  font-size: 15px;
}

.demo-tab:hover {
  transform: translateX(4px);
}

.demo-tab.is-active {
  color: var(--white);
  background: var(--ink);
}

.demo-tab.is-active > span,
.demo-tab.is-active > small {
  color: var(--acid);
}

.demo-workspace {
  min-width: 0;
  padding: clamp(26px, 4vw, 64px);
}

.demo-panel[hidden] {
  display: none;
}

.demo-panel {
  width: min(1240px, 100%);
  margin: 0 auto;
  animation: panel-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.demo-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.65fr);
  align-items: end;
  gap: 34px;
  margin-bottom: 28px;
}

.demo-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 15px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.demo-kicker::before {
  content: "";
  width: 5px;
  height: 24px;
  background: var(--blue);
}

.demo-kicker span {
  padding: 5px 7px;
  color: var(--white);
  background: var(--ink);
}

.demo-heading h1 {
  margin: 0;
  font-size: clamp(48px, 7.3vw, 112px);
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: -0.075em;
}

.demo-summary {
  max-width: 410px;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.demo-stage,
.chart-console,
.bits-stage,
.splat-console,
.graph-console,
.router-console {
  position: relative;
  min-height: 500px;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 34px;
  box-shadow: 12px 12px 0 var(--ink);
}

.demo-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.demo-notes span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.35);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
}

/* Anime.js */
.anime-stage {
  min-height: 560px;
  color: var(--white);
  background:
    radial-gradient(circle at 72% 24%, rgba(203,255,54,.17), transparent 24%),
    radial-gradient(circle at 20% 78%, rgba(36,76,255,.35), transparent 34%),
    #11110f;
}

.motion-path {
  position: absolute;
  inset: 8% 4%;
  width: 92%;
  height: 84%;
}

.motion-path path {
  fill: none;
  stroke: rgba(255,255,255,.2);
  stroke-width: 2;
  stroke-dasharray: 6 10;
}

.anime-copy {
  position: absolute;
  top: 54px;
  left: 54px;
  z-index: 2;
  display: grid;
}

.anime-copy span {
  display: block;
  font-size: clamp(52px, 9vw, 132px);
  font-weight: 950;
  line-height: .76;
  letter-spacing: -.08em;
  transform-origin: left center;
}

.anime-copy span:nth-child(2) { color: var(--acid); }
.anime-copy span:nth-child(3) { -webkit-text-stroke: 1px var(--white); color: transparent; }

.anime-particles i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid var(--acid);
  border-radius: 50%;
}

.path-runner {
  position: absolute;
  z-index: 4;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 8px rgba(255,59,31,.18), 0 0 34px rgba(255,59,31,.7);
}

.stage-actions {
  position: absolute;
  right: 26px;
  bottom: 26px;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.stage-action {
  padding: 13px 16px;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 999px;
  color: var(--white);
  background: rgba(0,0,0,.35);
  cursor: pointer;
}

.stage-action.is-active { color: var(--ink); background: var(--acid); border-color: var(--acid); }

/* ECharts */
.chart-console {
  min-height: 570px;
  padding: 28px;
  background: #fffaf0;
}

.chart-toolbar {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 5;
  display: flex;
  gap: 6px;
}

.chart-mode,
.splat-tools button {
  padding: 9px 13px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}

.chart-mode.is-active,
.splat-tools button.is-active {
  color: var(--white);
  background: var(--ink);
}

.chart-stat {
  position: absolute;
  top: 22px;
  right: 28px;
  z-index: 5;
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.chart-stat strong { font-size: 36px; line-height: 1; }
.chart-stat span { color: var(--muted); font-size: 12px; font-weight: 800; }
.echarts-stage { width: 100%; height: 520px; padding-top: 36px; }

/* React Bits */
.bits-stage {
  min-height: 580px;
  color: var(--white);
  background: #080b17;
  cursor: crosshair;
}

.aurora-layer {
  position: absolute;
  inset: -45%;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(36,76,255,.85), transparent 28%),
    radial-gradient(ellipse at 65% 35%, rgba(80,255,195,.62), transparent 28%),
    radial-gradient(ellipse at 62% 72%, rgba(255,59,31,.58), transparent 24%);
  filter: blur(45px);
  animation: aurora 10s ease-in-out infinite alternate;
}

@keyframes aurora {
  to { transform: translate3d(9%, -7%, 0) rotate(9deg) scale(1.08); }
}

.bits-copy {
  position: absolute;
  top: 52px;
  left: 52px;
  z-index: 3;
  width: min(660px, calc(100% - 104px));
}

.bits-copy p,
.spotlight-card > span,
.click-hint {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
}

.bits-copy h2 {
  min-height: 2.1em;
  margin: 18px 0;
  font-size: clamp(44px, 7vw, 96px);
  line-height: .91;
  letter-spacing: -.06em;
}

.bits-copy button {
  padding: 10px 13px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  color: var(--white);
  background: rgba(255,255,255,.08);
  cursor: pointer;
}
.bits-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.bits-controls button.is-active { color: var(--ink); background: var(--acid); border-color: var(--acid); }
.bits-stage.is-aurora-muted .aurora-layer { opacity: .08; }
.aurora-layer { transition: opacity 260ms ease; }

.spotlight-card {
  --spot-x: 50%;
  --spot-y: 50%;
  position: absolute;
  right: 42px;
  bottom: 38px;
  z-index: 4;
  width: min(360px, calc(100% - 84px));
  padding: 26px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 26px;
  background:
    radial-gradient(circle at var(--spot-x) var(--spot-y), rgba(255,255,255,.24), transparent 34%),
    rgba(8,11,23,.67);
  backdrop-filter: blur(18px);
}

.spotlight-card strong { display: block; margin: 32px 0 10px; font-size: 30px; }
.spotlight-card p { margin: 0; color: rgba(255,255,255,.66); line-height: 1.6; }
.click-hint { position: absolute; bottom: 28px; left: 34px; z-index: 4; margin: 0; color: rgba(255,255,255,.55); }
.click-spark { position: absolute; z-index: 8; width: 8px; height: 8px; pointer-events: none; }
.click-spark i { position: absolute; width: 2px; height: 28px; background: var(--acid); transform-origin: 50% 34px; }

/* SuperSplat */
.splat-console {
  min-height: 600px;
  background: #070706;
}

#splat-canvas { display: block; width: 100%; height: 600px; cursor: grab; touch-action: none; }
#splat-canvas:active { cursor: grabbing; }
.splat-hud { position: absolute; top: 22px; right: 24px; left: 24px; display: flex; justify-content: space-between; color: rgba(255,255,255,.72); font-size: 10px; font-weight: 900; letter-spacing: .13em; pointer-events: none; }
.splat-tools { position: absolute; right: 22px; bottom: 22px; display: flex; gap: 7px; }
.splat-tools button { border-color: rgba(255,255,255,.36); color: var(--white); }
.splat-tools button.is-active { color: var(--ink); background: var(--acid); }
.splat-help { position: absolute; bottom: 22px; left: 24px; margin: 0; color: rgba(255,255,255,.58); font-size: 11px; }

/* CodeGraph */
.compact-heading { align-items: end; }
.graph-search { display: grid; gap: 8px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.graph-search input { min-height: 48px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 0; background: rgba(255,255,255,.48); color: var(--ink); outline: none; }
.graph-search input:focus { box-shadow: 5px 5px 0 var(--blue); }
.graph-search span { min-height: 14px; color: var(--blue); font-size: 9px; }
.graph-console { display: grid; grid-template-columns: minmax(0, 1fr) 290px; min-height: 590px; background: #f8f4ea; }
.graph-canvas-wrap { position: relative; min-width: 0; border-right: 1px solid var(--ink); background: radial-gradient(circle, rgba(23,23,22,.13) 1px, transparent 1px); background-size: 22px 22px; }
.codegraph-stage { display: block; width: 100%; height: 590px; }
.graph-edge { stroke: rgba(23,23,22,.24); stroke-width: 2; }
.graph-edge.is-hot { stroke: var(--red); stroke-width: 4; }
.graph-node { cursor: pointer; }
.graph-node circle { stroke: var(--ink); stroke-width: 2; transition: transform 160ms ease, stroke-width 160ms ease; transform-box: fill-box; transform-origin: center; }
.graph-node text { fill: var(--ink); font-size: 12px; font-weight: 900; pointer-events: none; }
.graph-node:hover circle,
.graph-node.is-active circle { transform: scale(1.18); stroke-width: 4; }
.graph-node.is-muted { opacity: .18; }
.graph-legend { position: absolute; bottom: 18px; left: 18px; display: flex; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); background: rgba(248,244,234,.9); font-size: 10px; font-weight: 900; }
.graph-legend span { display: flex; align-items: center; gap: 6px; }
.graph-legend i { width: 10px; height: 10px; border-radius: 50%; }
.node-ui { background: var(--blue); }.node-core { background: var(--red); }.node-data { background: var(--acid); }
.graph-inspector { padding: 28px 24px; background: var(--ink); color: var(--white); }
.graph-inspector > p:first-child { margin: 0; color: var(--acid); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.graph-inspector h2 { margin: 24px 0 7px; font-size: 34px; word-break: break-word; }
.graph-inspector > span { color: rgba(255,255,255,.55); font-size: 11px; }
.graph-inspector dl { display: grid; gap: 0; margin: 38px 0; }
.graph-inspector dl div { display: flex; justify-content: space-between; padding: 14px 0; border-top: 1px solid rgba(255,255,255,.18); }
.graph-inspector dt { color: rgba(255,255,255,.5); font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.graph-inspector dd { margin: 0; font-weight: 900; }
.inspector-copy { color: rgba(255,255,255,.62); line-height: 1.65; }

/* 9Router */
.router-console { padding: 28px; background: #0e1210; color: var(--white); }
.router-prompt { display: grid; gap: 10px; padding: 18px; border: 1px solid rgba(255,255,255,.2); border-radius: 20px; background: rgba(255,255,255,.05); }
.router-prompt label { color: var(--acid); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.router-prompt textarea { width: 100%; resize: vertical; border: 0; color: var(--white); background: transparent; font-size: 20px; line-height: 1.45; outline: none; }
.router-prompt > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: rgba(255,255,255,.45); font-size: 10px; font-weight: 900; }
.router-prompt button { padding: 11px 16px; border: 0; border-radius: 999px; background: var(--acid); color: var(--ink); font-weight: 900; cursor: pointer; }
.route-track { display: grid; grid-template-columns: 1fr 34px 1fr 34px 1fr 34px 1fr; align-items: center; gap: 7px; margin: 24px 0; }
.route-track > i { height: 2px; background: rgba(255,255,255,.16); }
.route-node { display: grid; gap: 5px; min-height: 92px; padding: 13px; border: 1px solid rgba(255,255,255,.16); border-radius: 14px; color: rgba(255,255,255,.46); transition: background 180ms ease, color 180ms ease, border-color 180ms ease; }
.route-node span,.route-node small { font-size: 9px; font-weight: 900; letter-spacing: .1em; }
.route-node.is-ready { color: var(--white); border-color: var(--acid); background: rgba(203,255,54,.1); }
.route-node.is-running { color: var(--ink); border-color: var(--acid); background: var(--acid); }
.provider-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.provider-grid button { display: grid; gap: 8px; padding: 16px; border: 1px solid rgba(255,255,255,.15); border-radius: 16px; color: var(--white); text-align: left; background: transparent; cursor: pointer; transition: transform 180ms ease, border-color 180ms ease, background 180ms ease; }
.provider-grid button > span { color: rgba(255,255,255,.44); font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.provider-grid button > small { color: rgba(255,255,255,.52); }
.provider-grid button:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.45); }
.provider-grid button.is-selected { transform: translateY(-5px); border-color: var(--red); background: rgba(255,59,31,.12); }
.router-result { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 7px 18px; margin-top: 18px; padding: 18px; border-left: 5px solid var(--red); background: rgba(255,255,255,.06); }
.router-result span { color: var(--red); font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.router-result strong { font-size: 24px; }
.router-result p { grid-column: 1 / -1; margin: 0; color: rgba(255,255,255,.6); line-height: 1.6; }

@media (max-width: 980px) {
  .lab-shell { grid-template-columns: 1fr; }
  .demo-rail { position: sticky; top: 86px; z-index: 40; display: flex; height: auto; padding: 10px 14px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); background: rgba(242,238,228,.96); }
  .rail-label { display: none; }
  .demo-tab { flex: 0 0 auto; grid-template-columns: auto auto; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); }
  .demo-tab + .demo-tab { margin-left: 6px; }
  .demo-tab small { display: none; }
  .demo-workspace { padding: 34px 22px 54px; }
  .demo-heading { grid-template-columns: 1fr; gap: 18px; }
  .graph-console { grid-template-columns: 1fr; }
  .graph-canvas-wrap { border-right: 0; border-bottom: 1px solid var(--ink); }
  .graph-inspector { min-height: 280px; }
}

@media (max-width: 640px) {
  .lab-header { min-height: 74px; padding: 10px 14px; }
  .lab-header-meta > span { display: none; }
  .lab-header-meta { gap: 8px; }
  .lab-header-meta a { padding: 8px; font-size: 10px; }
  .lab-shell { min-height: calc(100vh - 74px); }
  .demo-rail { top: 74px; }
  .demo-heading h1 { font-size: clamp(45px, 15vw, 72px); }
  .demo-stage,.chart-console,.bits-stage,.splat-console,.graph-console,.router-console { border-radius: 24px; box-shadow: 7px 7px 0 var(--ink); }
  .anime-stage { min-height: 520px; }
  .anime-copy { top: 38px; left: 28px; }
  .anime-copy span { font-size: 17vw; }
  .chart-console { padding: 14px; }
  .chart-stat { top: 68px; right: 18px; }
  .echarts-stage { height: 500px; padding-top: 70px; }
  .bits-copy { top: 34px; left: 26px; width: calc(100% - 52px); }
  .spotlight-card { right: 22px; bottom: 62px; width: calc(100% - 44px); }
  .click-hint { bottom: 24px; left: 24px; }
  #splat-canvas { height: 540px; }
  .splat-console { min-height: 540px; }
  .splat-tools { right: 14px; bottom: 14px; flex-wrap: wrap; justify-content: flex-end; max-width: 250px; }
  .splat-help { top: 50px; bottom: auto; left: 16px; }
  .route-track { grid-template-columns: repeat(4,1fr); }
  .route-track > i { display: none; }
  .route-node { min-height: 78px; padding: 10px; }
  .provider-grid { grid-template-columns: 1fr; }
  .router-prompt textarea { font-size: 17px; }
  .router-prompt > div { align-items: flex-end; }
}

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