:root {
  --bg: #0a0a12;
  --bg-alt: #110f1d;
  --panel: #181629;
  --line: #2a2742;
  --ink: #f2f2f8;
  --muted: #9a9ab4;
  --neon: #ff2e88;
  --cyan: #28dcff;
  --gold: #ffcd3c;
  --radius: 14px;
  --display: "Chakra Petch", system-ui, sans-serif;
  --pixel: "VT323", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--display); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, video { max-width: 100%; display: block; }
a { color: var(--cyan); }
h1, h2, h3 { line-height: 1.1; margin: 0 0 .5em; }
h2 { font-size: clamp(30px, 5vw, 52px); font-style: italic; font-weight: 700; text-transform: uppercase; letter-spacing: -.01em; }
h3 { font-size: 20px; }
code, kbd, pre { font-family: var(--pixel); font-size: 20px; }
pre { background: #000; padding: 10px 14px; border-radius: 8px; overflow-x: auto; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.narrow-wrap { max-width: 820px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.lead { font-size: clamp(18px, 2.2vw, 22px); }
.narrow { max-width: 760px; }
.kicker { font-family: var(--pixel); font-size: 22px; color: var(--neon); text-transform: uppercase; letter-spacing: .12em; margin: 0 0 6px; }
.section { padding: clamp(56px, 9vw, 110px) 0; }
.section-alt { background: linear-gradient(180deg, var(--bg-alt), var(--bg)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; gap: .4em; padding: 10px 20px; border-radius: 999px; border: 2px solid var(--neon);
  background: var(--neon); color: #fff; font: 700 16px var(--display); text-decoration: none; cursor: pointer;
  box-shadow: 0 0 24px rgba(255, 46, 136, .35); transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 0 34px rgba(255, 46, 136, .6); }
.btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn-ghost:hover { border-color: var(--cyan); box-shadow: none; }
.btn-big { padding: 14px 26px; font-size: 18px; }
.btn-small { padding: 6px 14px; font-size: 14px; }

/* ---------------------------------------------------------------- nav */
.nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 16px; background: rgba(10, 10, 18, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-mark { font: italic 700 24px var(--display); color: var(--neon); margin: 0; letter-spacing: .02em; }
.brand-sub { font-family: var(--pixel); font-size: 20px; color: var(--muted); }
.nav nav { display: flex; align-items: center; gap: 20px; }
.nav nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.nav nav a:not(.btn):hover { color: var(--cyan); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); color: var(--ink); font-size: 20px; border-radius: 8px; padding: 2px 10px; cursor: pointer; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: flex-start;
    padding: 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .nav nav.open { display: flex; }
}

/* ---------------------------------------------------------------- hero */
.hero { position: relative; min-height: min(92vh, 860px); display: flex; align-items: center; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,10,18,.94) 0%, rgba(10,10,18,.7) 45%, rgba(10,10,18,.2) 100%),
  linear-gradient(0deg, var(--bg) 0%, transparent 30%); }
.hero-inner { position: relative; padding-top: 40px; padding-bottom: 40px; width: 100%; }
.hero h1 { font-size: clamp(38px, min(6.4vw, 9vh), 84px); font-style: italic; text-transform: uppercase; letter-spacing: -.02em; max-width: 14ch; }
.hero h1 span { color: var(--neon); text-shadow: 0 0 30px rgba(255, 46, 136, .55); }
.hero .lead { max-width: 560px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0; }
.stats { display: flex; flex-wrap: wrap; gap: 10px 26px; list-style: none; padding: 0; margin: 0; font-family: var(--pixel); font-size: 22px; color: var(--muted); }
.stats b { color: var(--gold); font-size: 30px; margin-right: 4px; }

/* ---------------------------------------------------------------- trailer */
.trailer { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: 0 20px 80px rgba(255, 46, 136, .18); background: #000; }
.trailer video { width: 100%; aspect-ratio: 16 / 9; image-rendering: pixelated; }

/* ---------------------------------------------------------------- story */
.cast { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin: 36px 0; }
.cast-card { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--who); border-radius: var(--radius); padding: 16px; }
.cast-card img { width: 100px; height: 120px; image-rendering: pixelated; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--who) 35%, transparent), transparent 70%); border-radius: 10px; }
.cast-card h3 { color: var(--who); font-family: var(--pixel); font-size: 28px; font-weight: 400; margin: 10px 0 4px; letter-spacing: .06em; text-transform: uppercase; }
.cast-card p { margin: 0; font-size: 15px; color: var(--muted); }
.acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.act h3 { font-style: italic; text-transform: uppercase; color: var(--cyan); }
.act ol { list-style: none; padding: 0; margin: 0; }
.act li { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.num { flex: 0 0 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: var(--panel); border: 1px solid var(--line);
  font-family: var(--pixel); font-size: 22px; color: var(--gold); }
.tag { font-family: var(--pixel); font-size: 17px; color: var(--neon); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; margin-left: 4px; white-space: nowrap; }

/* ---------------------------------------------------------------- features */
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.feature { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.feature img { width: 100%; aspect-ratio: 16 / 9; image-rendering: pixelated; }
.feature > div { padding: 16px 18px 20px; }
.feature p { margin: 0; color: var(--muted); }
.ico { color: var(--neon); margin-right: 8px; }

/* ---------------------------------------------------------------- shorts */
.shorts { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 20px; margin-top: 24px; }
@media (max-width: 760px) {
  .shorts { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 10px; }
  .short { scroll-snap-align: start; }
}
.short { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.short video { width: 100%; aspect-ratio: 9 / 16; background: #000; object-fit: cover; }
.short figcaption { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.short .dl { font-size: 14px; margin-top: 6px; }

/* ---------------------------------------------------------------- gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.gallery a { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.gallery img { width: 100%; aspect-ratio: 16 / 9; image-rendering: pixelated; transition: transform .25s; }
.gallery a:hover img { transform: scale(1.04); }
.tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; margin-top: 56px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); }
th { white-space: nowrap; color: var(--gold); font-weight: 600; }

.lightbox { border: 0; padding: 0; background: transparent; max-width: min(96vw, 1400px); color: var(--ink); }
.lightbox::backdrop { background: rgba(0, 0, 0, .88); }
.lightbox figure { margin: 0; }
.lightbox img { width: 100%; image-rendering: pixelated; border-radius: 8px; }
.lightbox figcaption { text-align: center; padding: 10px; color: var(--muted); }
.lb-close { position: fixed; top: 12px; right: 16px; font-size: 38px; }
.lb-nav { position: fixed; top: 50%; transform: translateY(-50%); font-size: 54px; }
.lb-prev { left: 8px; } .lb-next { right: 8px; }
.lb-close, .lb-nav { background: rgba(0,0,0,.4); border: 0; color: #fff; cursor: pointer; border-radius: 10px; padding: 0 12px; line-height: 1.1; }

/* ---------------------------------------------------------------- install wizard */
.section-install { background: radial-gradient(ellipse at 50% 0%, rgba(255, 46, 136, .16), transparent 60%), var(--bg); border-top: 1px solid var(--line); }
.wizard { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: clamp(18px, 4vw, 34px); margin-top: 26px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; list-style: none; padding: 0; margin: 0 0 26px; counter-reset: s; }
.steps li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); padding-bottom: 10px; border-bottom: 3px solid var(--line); }
.steps li span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--line); font-weight: 700; flex: none; }
.steps li.active { color: var(--ink); border-color: var(--neon); }
.steps li.active span { border-color: var(--neon); background: var(--neon); color: #fff; }
.steps li.done { color: var(--ink); border-color: var(--cyan); }
.steps li.done span { border-color: var(--cyan); color: var(--cyan); }
@media (max-width: 520px) { .steps li { font-size: 0; justify-content: center; } .steps li span { font-size: 14px; } }
.step { display: none; }
.step.active { display: block; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 22px; }
.link { color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: #0d0c18; border: 1px solid var(--line); }
.check .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.check.ok .dot { background: #39ce41; box-shadow: 0 0 10px #39ce41; }
.check.bad .dot { background: var(--neon); box-shadow: 0 0 10px var(--neon); }
.warn { display: block; padding: 12px 14px; border-radius: 10px; background: rgba(255, 205, 60, .08); border: 1px solid rgba(255, 205, 60, .4); color: var(--ink); }
esp-web-install-button { display: block; margin: 18px 0; }
.plain { padding-left: 20px; }
.plain li { margin: 6px 0; }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; margin-top: 14px; font-size: 15px; color: var(--muted); }
kbd { display: inline-block; min-width: 28px; text-align: center; padding: 0 6px; border-radius: 6px; background: #2c2e38; border: 1px solid #4a4e5c; border-bottom-width: 3px; color: var(--ink); font-size: 18px; line-height: 1.3; }
.manual { margin-top: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.manual summary { cursor: pointer; font-weight: 600; }

/* ---------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--line); padding: 48px 0 24px; background: #07070d; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; }
.footer h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.footer p { margin: 6px 0; font-size: 15px; }
.fine { font-size: 13px; color: #5d5d76; margin-top: 30px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .step.active { animation: none; }
  .gallery img, .btn { transition: none; }
}

/* ---------------------------------------------------------------- labs home */
.labs-hero { padding: clamp(70px, 12vw, 150px) 0 clamp(30px, 5vw, 60px);
  background: radial-gradient(ellipse at 20% 0%, rgba(255, 46, 136, .22), transparent 55%), radial-gradient(ellipse at 90% 30%, rgba(40, 220, 255, .12), transparent 50%); }
.labs-hero h1 { font-size: clamp(44px, 9vw, 110px); font-style: italic; text-transform: uppercase; letter-spacing: -.02em; }
.labs-hero h1 span { color: var(--neon); text-shadow: 0 0 30px rgba(255, 46, 136, .55); }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 22px; }
.project { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.project-media video, .project-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; image-rendering: pixelated; background: #000; }
.project-body { padding: 20px 22px 24px; }
.project-body h3 { font-size: 30px; font-style: italic; text-transform: uppercase; margin-bottom: 4px; }
.project-body h3 a { color: var(--ink); text-decoration: none; }
.project-kind { font-family: var(--pixel); font-size: 20px; color: var(--cyan); text-transform: uppercase; letter-spacing: .1em; margin: 0 0 4px; }
.project-tag { font-weight: 600; margin: 0 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 12px 0 0; }
.chips li { font-family: var(--pixel); font-size: 18px; color: var(--gold); border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; }
.project-next { border-style: dashed; background: transparent; justify-content: center; }

/* ---------------------------------------------------------------- guide */
.nav nav a[aria-current="page"] { color: var(--neon); }
.guide-head { padding: clamp(48px, 8vw, 90px) 0 24px; background: radial-gradient(ellipse at 15% 0%, rgba(255, 46, 136, .18), transparent 60%); }
.guide-head h1 { font-size: clamp(40px, 7vw, 76px); font-style: italic; text-transform: uppercase; }
.guide-head .kicker a { color: inherit; text-decoration: none; }
.guide { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; padding-bottom: 90px; }
.toc { position: sticky; top: 80px; align-self: start; font-size: 15px; }
.toc-title { font-family: var(--pixel); font-size: 20px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin: 0 0 8px; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -2px; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; }
.toc a:hover, .toc a.active { color: var(--ink); border-left-color: var(--neon); }
@media (max-width: 860px) {
  .guide { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .toc { position: static; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
  .toc ol { columns: 2; column-gap: 16px; border: 0; }
  .toc a { padding-left: 0; border: 0; break-inside: avoid; }
  .toc li { break-inside: avoid; }
}
.guide > * { min-width: 0; }
.doc { max-width: 780px; }
.doc section { padding: 28px 0 18px; border-bottom: 1px solid var(--line); scroll-margin-top: 70px; }
.doc section:last-child { border-bottom: 0; }
.doc h2 { font-size: clamp(26px, 3.4vw, 36px); }
.doc h3 { margin-top: 22px; color: var(--cyan); }
.doc li { margin: 6px 0; }
.steps-list { padding-left: 22px; }
.steps-list li::marker { color: var(--neon); font-weight: 700; }
.note { padding: 12px 16px; border-left: 4px solid var(--cyan); background: rgba(40, 220, 255, .07); border-radius: 0 10px 10px 0; }
.keys-table, .data-table { margin: 10px 0 16px; }
.keys-table td:first-child { white-space: nowrap; width: 1%; padding-right: 18px; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.data-table td:first-child { color: var(--gold); font-weight: 600; white-space: nowrap; }
.data-table { display: block; overflow-x: auto; }
.defs dt { font-weight: 700; color: var(--gold); margin-top: 14px; }
.defs dd { margin: 4px 0 0; color: var(--ink); }
.cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 14px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin-top: 0; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.doc-shot { margin: 16px 0; }
.doc-shot img { width: 100%; image-rendering: pixelated; border-radius: 10px; border: 1px solid var(--line); }
.doc-shot figcaption { color: var(--muted); font-size: 14px; margin-top: 6px; }
