:root {
  color-scheme: dark;

  --site-bg: #0f1218;
  --site-fg: #e9ecf2;
  --site-accent: #4d9fff;
  --site-on-accent: #0a1322;
  --site-surface: #161a22;
  --site-muted: #99a1b3;
  --site-border: #262c38;
  --site-font: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --site-radius: 10px;
  --site-space: 1;
  --site-type: 1;
  --site-motion: 1;

  --space: calc(24px * var(--site-space, 1));
  --fs-h1: calc(54px * var(--site-type, 1));
  --fs-h2: calc(27px * var(--site-type, 1));
  --fs-h3: calc(17px * var(--site-type, 1));
  --fs-body: calc(16px * var(--site-type, 1));
  --fs-small: calc(14px * var(--site-type, 1));
  --dur: calc(180ms * var(--site-motion, 1));

  --ok: #38d39f;
  --warn: #f0b429;
  --danger: #f2555a;
  --surface-2: color-mix(in srgb, var(--site-surface) 70%, var(--site-fg) 4%);
  --grid-line: color-mix(in srgb, var(--site-fg) 5%, transparent);
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  scrollbar-color: var(--site-border) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  background: var(--site-bg);
  color: var(--site-fg);
  font-family: var(--site-font);
  font-size: var(--fs-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--site-border);
  border: 2px solid var(--site-bg);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: var(--site-muted); }

::selection { background: var(--site-accent); color: var(--site-on-accent); }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--site-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  width: min(1040px, 100% - var(--space) * 2);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: var(--space);
  top: -60px;
  z-index: 60;
  padding: 8px 14px;
  background: var(--site-accent);
  color: var(--site-on-accent);
  border-radius: var(--site-radius);
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- scroll reveal ---------- */

html.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity calc(var(--dur) * 3.2) ease,
    transform calc(var(--dur) * 3.2) ease;
  transition-delay: calc(var(--i, 0) * 70ms * var(--site-motion, 1));
}
html.js .reveal.in { opacity: 1; transform: none; }

/* ---------- header: brand left / nav center / actions right ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--site-bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur), background-color var(--dur);
}
.top.scrolled {
  border-bottom-color: var(--site-border);
  background: color-mix(in srgb, var(--site-bg) 92%, transparent);
}
.top-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space);
  height: 60px;
}
.brand {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand img { border-radius: 7px; }
.brand-name { font-size: calc(18px * var(--site-type, 1)); font-weight: 600; letter-spacing: 0.02em; }
.brand-sub { font-size: var(--fs-small); color: var(--site-muted); font-family: var(--mono); }

.nav {
  justify-self: center;
  display: flex;
  gap: calc(var(--space) * 0.9);
}
.nav a, .link-quiet {
  position: relative;
  color: var(--site-muted);
  text-decoration: none;
  font-size: var(--fs-small);
  transition: color var(--dur);
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: var(--site-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur);
}
.nav a:hover, .link-quiet:hover { color: var(--site-fg); }
.nav a.active { color: var(--site-fg); }
.nav a.active::after { transform: scaleX(1); }

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: calc(var(--space) * 0.75);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 calc(var(--space) * 0.95);
  border: 1px solid transparent;
  border-radius: var(--site-radius);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur), border-color var(--dur), transform var(--dur), box-shadow var(--dur);
}
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 34px; padding: 0 15px; font-size: var(--fs-small); }
.btn-primary {
  background: var(--site-accent);
  color: var(--site-on-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 24px -14px var(--site-accent);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--site-accent) 88%, #fff);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 14px 28px -14px var(--site-accent);
}
.btn-ghost { border-color: var(--site-border); color: var(--site-fg); background: color-mix(in srgb, var(--site-surface) 55%, transparent); }
.btn-ghost:hover { border-color: color-mix(in srgb, var(--site-accent) 55%, var(--site-border)); transform: translateY(-1px); }
.btn .ic { width: 16px; height: 16px; flex: none; }

/* ---------- hero (centered) ---------- */

.hero {
  position: relative;
  padding: calc(var(--space) * 3) 0 calc(var(--space) * 2.75);
  text-align: center;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(820px 460px at 50% -12%, color-mix(in srgb, var(--site-accent) 16%, transparent), transparent 70%),
    radial-gradient(640px 420px at 12% 24%, color-mix(in srgb, var(--ok) 7%, transparent), transparent 72%),
    radial-gradient(640px 420px at 88% 24%, color-mix(in srgb, var(--site-accent) 7%, transparent), transparent 72%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, auto, auto, 44px 44px, 44px 44px;
  -webkit-mask-image: linear-gradient(#000 40%, transparent 96%);
  mask-image: linear-gradient(#000 40%, transparent 96%);
}
.hero .wrap { position: relative; }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: calc(13px * var(--site-type, 1));
  color: var(--site-muted);
  letter-spacing: 0.06em;
}
.kicker .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}

h1 {
  margin: calc(var(--space) * 0.55) auto 0;
  font-size: clamp(calc(30px * var(--site-type, 1)), 5.4vw, var(--fs-h1));
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 18em;
}
.lead {
  max-width: 36em;
  margin: calc(var(--space) * 0.7) auto 0;
  font-size: calc(18px * var(--site-type, 1));
  color: var(--site-muted);
}
.cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(var(--space) * 0.5);
  margin-top: calc(var(--space) * 1.25);
}
.meta-line {
  margin-top: calc(var(--space) * 0.75);
  font-family: var(--mono);
  font-size: calc(13px * var(--site-type, 1));
  color: var(--site-muted);
}
.meta-line b { color: var(--site-fg); font-weight: 500; }

/* ---------- screenshots ---------- */

.shots { margin-top: calc(var(--space) * 2.25); }

.shot-tabs {
  display: flex;
  justify-content: center;
  gap: calc(var(--space) * 0.25);
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: inset 0 -1px 0 var(--site-border);
}
.shot-tabs::-webkit-scrollbar { display: none; }
.shot-tabs button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  background: none;
  color: var(--site-muted);
  font: inherit;
  font-size: var(--fs-small);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur), box-shadow var(--dur);
}
.shot-tabs button:hover { color: var(--site-fg); }
.shot-tabs button[aria-selected="true"] {
  color: var(--site-fg);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--site-accent);
}

.shot { margin-top: calc(var(--space) * 0.85); }
.shot[hidden] { display: none; }
.shot.enter { animation: shot-in calc(var(--dur) * 1.8) ease; }
@keyframes shot-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.shot-frame {
  border: 1px solid var(--site-border);
  border-radius: calc(var(--site-radius) + 4px);
  background: var(--site-surface);
  overflow: hidden;
  box-shadow: 0 30px 70px -38px rgba(0, 0, 0, 0.85), 0 2px 8px rgba(0, 0, 0, 0.35);
}
.shot-frame > img { width: 100%; }

/* ---------- sections ---------- */

.section {
  position: relative;
  padding: calc(var(--space) * 2.75) 0;
  border-top: 1px solid var(--site-border);
}

.sec-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.sec-no {
  font-family: var(--mono);
  font-size: calc(14px * var(--site-type, 1));
  color: var(--site-accent);
  letter-spacing: 0.12em;
}
h2 { font-size: var(--fs-h2); line-height: 1.35; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-h3); line-height: 1.5; font-weight: 600; }

code { font-family: var(--mono); font-size: 0.92em; }
p code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--site-border);
  color: var(--site-fg);
}

.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: calc(var(--space) * 2);
  margin-top: calc(var(--space) * 1.25);
  text-align: left;
}
.features li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 4px;
  padding: calc(var(--space) * 0.8) 8px calc(var(--space) * 0.8) 0;
  border-bottom: 1px solid var(--site-border);
  border-radius: 6px;
  transition: background-color var(--dur);
}
.features li:hover { background: color-mix(in srgb, var(--site-surface) 55%, transparent); }
.features li:nth-last-child(-n + 2) { border-bottom: 0; }
.features .idx {
  font-family: var(--mono);
  font-size: calc(13px * var(--site-type, 1));
  line-height: 1.9;
  color: color-mix(in srgb, var(--site-accent) 75%, var(--site-muted));
}
.features h3 { transition: color var(--dur); }
.features li:hover h3 { color: var(--site-accent); }
.features p { margin-top: 4px; color: var(--site-muted); font-size: calc(15px * var(--site-type, 1)); }

/* ---------- usage: three equal code cards ---------- */

.code-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(var(--space) * 0.75);
  align-items: stretch;
  margin-top: calc(var(--space) * 1.25);
}
.code {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius);
  background: var(--site-surface);
  overflow: hidden;
  transition: border-color var(--dur);
}
.code:hover { border-color: color-mix(in srgb, var(--site-accent) 35%, var(--site-border)); }
.code-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 14px;
  border-bottom: 1px solid var(--site-border);
  background: var(--surface-2);
}
.code-tag {
  font-family: var(--mono);
  font-size: calc(12px * var(--site-type, 1));
  color: var(--site-muted);
  letter-spacing: 0.05em;
}
.code pre {
  flex: 1;
  margin: 0;
  padding: calc(var(--space) * 0.55) calc(var(--space) * 0.7);
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--fs-small);
  line-height: 1.9;
  text-align: left;
}
.cmt { color: var(--site-muted); }
.copy {
  margin-left: auto;
  min-height: 28px;
  padding: 0 11px;
  border: 1px solid var(--site-border);
  border-radius: calc(var(--site-radius) * 0.7);
  background: var(--site-bg);
  color: var(--site-muted);
  font: inherit;
  font-size: calc(13px * var(--site-type, 1));
  cursor: pointer;
  transition: color var(--dur), border-color var(--dur), background-color var(--dur);
}
.copy:hover { color: var(--site-fg); border-color: var(--site-muted); }
.copy[data-copied] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 60%, var(--site-border)); }

/* ---------- stack: horizontal row ---------- */

.stack-wrap {
  margin: calc(var(--space) * 1.25) auto 0;
  text-align: left;
}
.stack {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: calc(var(--space) * 0.6) calc(var(--space) * 0.9);
  color: var(--site-fg);
  font-size: calc(15px * var(--site-type, 1));
  line-height: 1.6;
}
.stack li {
  padding-left: calc(var(--space) * 0.55);
  border-left: 2px solid color-mix(in srgb, var(--site-accent) 45%, transparent);
}
.stack-wrap h3 {
  margin-top: calc(var(--space) * 1.75);
  text-align: center;
}

.oss {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(var(--space) * 0.55);
  margin-top: calc(var(--space) * 0.9);
  font-size: var(--fs-small);
}
.oss li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: calc(var(--space) * 0.5) calc(var(--space) * 0.65);
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius);
  background: color-mix(in srgb, var(--site-surface) 55%, transparent);
  transition: border-color var(--dur), background-color var(--dur);
}
.oss li:hover {
  border-color: color-mix(in srgb, var(--site-accent) 35%, var(--site-border));
  background: color-mix(in srgb, var(--site-surface) 85%, transparent);
}
.oss li span:first-child { color: var(--site-fg); }
.oss li span:nth-child(2) { color: var(--site-muted); font-family: var(--mono); font-size: calc(13px * var(--site-type, 1)); }
.oss li span:nth-child(3) { color: var(--site-muted); }

/* ---------- requirements ---------- */

.req {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(var(--space) * 0.55);
  margin-top: calc(var(--space) * 1.25);
}
.req li {
  padding: calc(var(--space) * 0.7) calc(var(--space) * 0.8);
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius);
  background: color-mix(in srgb, var(--site-surface) 55%, transparent);
  transition: border-color var(--dur);
}
.req li:hover { border-color: color-mix(in srgb, var(--site-accent) 35%, var(--site-border)); }
.req-k {
  display: block;
  font-family: var(--mono);
  font-size: calc(12px * var(--site-type, 1));
  letter-spacing: 0.06em;
  color: var(--site-accent);
}
.req p {
  margin-top: 6px;
  color: var(--site-muted);
  font-size: calc(15px * var(--site-type, 1));
  line-height: 1.65;
}
.req-note {
  margin-top: calc(var(--space) * 0.8);
  padding: calc(var(--space) * 0.55) calc(var(--space) * 0.8);
  border: 1px dashed var(--site-border);
  border-radius: var(--site-radius);
  color: var(--site-muted);
  font-size: var(--fs-small);
  text-align: center;
}

/* ---------- download ---------- */

.download-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
}
.download-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--site-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--site-surface) 55%, transparent);
  transition: border-color var(--dur), background-color var(--dur);
}
.download-card:hover {
  border-color: color-mix(in srgb, var(--site-accent) 35%, var(--site-border));
  background: color-mix(in srgb, var(--site-surface) 85%, transparent);
}
.download-card h3 { font-size: var(--fs-h3); }
.dl-desc {
  color: var(--site-muted);
  font-size: calc(15px * var(--site-type, 1));
  line-height: 1.65;
}
.dl-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--fs-small);
}
.dl-meta li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
}
.dl-meta li span:first-child {
  min-width: 3em;
  padding: 4px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--site-surface) 70%, transparent);
  color: var(--site-muted);
}
.dl-meta code {
  color: var(--site-fg);
  font-family: var(--mono);
  overflow-wrap: anywhere;
}
.download-card .btn {
  justify-content: center;
  padding: 12px 24px;
  border-radius: 10px;
}

.foot {
  position: relative;
  font-size: var(--fs-small);
  color: var(--site-muted);
}
.foot::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--site-accent) 30%, var(--ok) 70%, transparent);
  opacity: 0.55;
}
.foot-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: var(--space) 0 calc(var(--space) * 1.25);
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 16px;
  padding: 8px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--site-border);
  border-radius: 6px;
}
.foot-links-label {
  font-family: var(--mono);
  font-size: calc(12px * var(--site-type, 1));
  letter-spacing: 0.06em;
  color: var(--site-accent);
}
.foot a { text-underline-offset: 3px; transition: color var(--dur); }
.foot a:hover { color: var(--site-fg); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .code-grid { grid-template-columns: minmax(0, 1fr); }
  .stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .oss { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .req { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .download-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .features { grid-template-columns: minmax(0, 1fr); }
  .features li:nth-last-child(2) { border-bottom: 1px solid var(--site-border); }
}

@media (max-width: 560px) {
  .nav, .link-quiet { display: none; }
  .top-row { grid-template-columns: 1fr auto; }
  .hero { padding-top: calc(var(--space) * 2); }
  .section { padding: calc(var(--space) * 2) 0; }
  .shot-tabs { justify-content: flex-start; }
  .shot-tabs button { padding: 0 12px; }
  .stack { grid-template-columns: minmax(0, 1fr); }
  .oss { grid-template-columns: minmax(0, 1fr); }
  .req { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  html.js .reveal { opacity: 1; transform: none; }
}