:root {
  --bg: #07080d;
  --panel: rgba(17, 19, 29, 0.72);
  --panel-solid: #11131d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eceef5;
  --muted: #8b91a7;
  --faint: #4a4f63;
  --light: #ffd36e;
  --light-hot: #fff3cf;
  --cyan: #6ee7ff;
  --violet: #b69cff;
  --ok: #4ade80;
  --bad: #fb7185;
  --radius: 18px;
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }

.aurora {
  position: fixed;
  inset: -20vh -10vw auto;
  height: 80vh;
  background:
    radial-gradient(40% 50% at 30% 40%, rgba(255, 196, 87, 0.16), transparent 70%),
    radial-gradient(35% 45% at 75% 30%, rgba(110, 231, 255, 0.10), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
  z-index: -1;
}

/* ---------- nav ---------- */
.nav { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.brand-mark {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 30%, var(--light) 60%, transparent 72%);
  box-shadow: 0 0 18px 4px rgba(255, 211, 110, 0.55);
}
.nav nav { display: flex; align-items: center; gap: 22px; font-size: 14px; color: var(--muted); }
.nav nav a { text-decoration: none; transition: color 0.2s; }
.nav nav a:hover { color: var(--text); }
.nav-gh {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text);
}
.nav-gh svg { width: 15px; height: 15px; }

/* ---------- hero ---------- */
.hero { padding: 72px 0 48px; }
.pill {
  display: inline-flex; align-items: center; gap: 9px; margin: 0 0 26px;
  padding: 6px 14px; border: 1px solid rgba(255, 211, 110, 0.28); border-radius: 999px;
  background: rgba(255, 211, 110, 0.06); color: var(--light); font-size: 13px; font-weight: 500;
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--light); box-shadow: 0 0 10px var(--light); }
h1 {
  margin: 0; font-size: clamp(44px, 8vw, 88px); line-height: 0.98; letter-spacing: -0.045em; font-weight: 700;
}
.lit {
  background: linear-gradient(100deg, var(--light-hot), var(--light) 45%, #ff9f43);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(255, 196, 87, 0.35);
}
.lede { max-width: 600px; margin: 28px 0 0; color: var(--muted); font-size: 18px; }

/* ---------- console ---------- */
.console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
  padding-bottom: 96px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(12px);
}
.wave-panel { grid-column: 1 / -1; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.hint { font: 12px var(--mono); color: var(--muted); }

.field-label { display: block; margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.pin {
  width: 100%; min-width: 0; margin-bottom: 20px; padding: 12px 16px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line-strong); border-radius: 12px;
  color: var(--text); font: 500 34px var(--mono); letter-spacing: 0.4em; text-align: center;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.pin:focus { border-color: rgba(255, 211, 110, 0.6); box-shadow: 0 0 0 4px rgba(255, 211, 110, 0.12); }
.pin.invalid { border-color: var(--bad); animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 12px; }
.seg button {
  padding: 9px 4px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font: 500 14px var(--font); cursor: pointer; transition: background 0.2s, color 0.2s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: rgba(255, 255, 255, 0.09); color: var(--text); }
.mode-note { min-height: 44px; margin: 10px 2px 16px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.mode-note.warn { color: var(--bad); }

.send {
  position: relative; width: 100%; padding: 15px; border: 0; border-radius: 12px; cursor: pointer; overflow: hidden;
  background: linear-gradient(100deg, var(--light-hot), var(--light) 50%, #ffb347);
  color: #1a1305; font: 600 16px var(--font);
  box-shadow: 0 8px 30px -8px rgba(255, 196, 87, 0.6);
  transition: transform 0.15s, box-shadow 0.2s;
}
.send:hover { transform: translateY(-1px); box-shadow: 0 12px 36px -8px rgba(255, 196, 87, 0.75); }
.send:active { transform: translateY(0); }
.send.busy { background: rgba(255, 255, 255, 0.08); color: var(--text); box-shadow: none; }
.send.busy::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: var(--progress, 0%);
  background: rgba(255, 211, 110, 0.18);
}
.send-label { position: relative; }

/* receiver */
.lock { position: relative; display: grid; place-items: center; height: 168px; }
.halo {
  position: absolute; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 211, 110, 0.0), transparent 70%);
  transition: background 0.4s;
}
.lock-icon { position: relative; width: 104px; height: 104px; overflow: visible; }
.lock-icon .shackle {
  fill: none; stroke: #c9cde0; stroke-width: 5; stroke-linecap: round;
  transition: transform 0.45s cubic-bezier(.3, 1.6, .5, 1), stroke 0.3s;
}
.lock-icon .body { fill: #1c1f2e; stroke: #c9cde0; stroke-width: 2.5; transition: stroke 0.3s, fill 0.3s; }
.lock-icon .sensor { fill: #2a2e40; transition: fill 0.06s; }
.lock.light .sensor { fill: var(--light-hot); filter: drop-shadow(0 0 6px var(--light)); }
.lock.light .halo { background: radial-gradient(circle, rgba(255, 211, 110, 0.28), transparent 70%); transition: background 0.05s; }

.lock[data-state="open"] .shackle { transform: translate(-7px, -9px) rotate(-14deg); stroke: var(--ok); }
.lock[data-state="open"] .body { stroke: var(--ok); }
.lock[data-state="open"] .halo { background: radial-gradient(circle, rgba(74, 222, 128, 0.25), transparent 70%); }
.lock[data-state="denied"] .body,
.lock[data-state="denied"] .shackle,
.lock[data-state="lockout"] .body,
.lock[data-state="lockout"] .shackle { stroke: var(--bad); }
.lock[data-state="denied"] .lock-icon { animation: shake 0.35s; }
.lock[data-state="lockout"] .halo { background: radial-gradient(circle, rgba(251, 113, 133, 0.22), transparent 70%); }

.status { margin: 6px 0 20px; text-align: center; font-weight: 500; min-height: 26px; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }

.bits { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; }
.bits span {
  aspect-ratio: 1 / 1.35; display: grid; place-items: center; border-radius: 4px;
  background: rgba(255, 255, 255, 0.04); color: var(--faint); font: 500 11px var(--mono);
  transition: background 0.15s, color 0.15s;
}
.bits span:nth-child(n + 17) { color: rgba(182, 156, 255, 0.35); }
.bits span:nth-child(16) { margin-right: 5px; }
.bits span.got { background: rgba(110, 231, 255, 0.16); color: var(--cyan); }
.bits span.got:nth-child(n + 17) { background: rgba(182, 156, 255, 0.18); color: var(--violet); }
.bits-legend { display: flex; justify-content: space-between; margin-top: 8px; font: 11px var(--mono); color: var(--faint); }

/* wave */
#wave { display: block; width: 100%; height: 120px; }
.wave-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; margin-right: 7px; border-radius: 3px; vertical-align: -1px; }
.sw-pre { background: var(--light); }
.sw-pin { background: var(--cyan); }
.sw-sum { background: var(--violet); }

/* ---------- sections ---------- */
h2 { margin: 0 0 28px; font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.03em; }
.how, .hardware { padding-bottom: 96px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0; padding: 0; list-style: none; }
.steps li { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.step-n { font: 500 13px var(--mono); color: var(--light); }
.steps h3 { margin: 10px 0 8px; font-size: 20px; }
.steps p { margin: 0; color: var(--muted); font-size: 15px; }

.hw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.parts { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.parts div { display: flex; justify-content: space-between; gap: 16px; padding: 16px 22px; border-top: 1px solid var(--line); }
.parts div:first-child { border-top: 0; }
.parts dt { font-weight: 500; }
.parts dd { margin: 0; color: var(--muted); font: 13px var(--mono); text-align: right; }
.photo { margin: 0; }
.photo img { display: block; width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.photo figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 28px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.foot p { margin: 0; }

/* ---------- full-screen flash ---------- */
.flash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #000; cursor: pointer; }
.flash[hidden] { display: none; }
.flash.on { background: #fff; }
.flash-hint { color: #444; text-align: center; font-size: 15px; }
.flash.on .flash-hint { visibility: hidden; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .console, .hw-grid { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 36px; }
  .nav nav a:not(.nav-gh) { display: none; }
}
@media (max-width: 420px) {
  .panel { padding: 18px; }
  .bits { gap: 2px; }
  .bits span { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
