:root {
  --bg: #05060f;
  --bg-2: #0a0e22;
  --panel: rgba(140, 160, 255, 0.05);
  --panel-hover: rgba(140, 160, 255, 0.09);
  --line: rgba(160, 180, 255, 0.14);
  --text: #e9ecff;
  --muted: #9aa3c7;
  --electric: #8ab4ff;
  --violet: #b28cff;
  --bolt: #fff6d5;
  --amber: #ffd166;
  --danger: #ff6b7d;
  --safe: #6ee7b7;
  --radius: 20px;
  --head: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--head); line-height: 1.05; letter-spacing: -0.02em; font-weight: 700; }
a { color: inherit; }
img, svg { display: block; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

:focus-visible { outline: 2px solid var(--electric); outline-offset: 3px; border-radius: 6px; }

.eyebrow {
  font-family: var(--head);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--electric);
  margin-bottom: 14px;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  transition: background 0.3s, border-color 0.3s, backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: rgba(5, 6, 15, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--head); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.logo svg { width: 26px; height: 26px; fill: var(--amber); filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.6)); }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a { text-decoration: none; font-size: 0.95rem; color: var(--muted); transition: color 0.2s; }
.nav a:hover { color: var(--text); }
.nav .nav-cta {
  color: var(--text);
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.nav .nav-cta:hover { border-color: var(--electric); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 26px;
  border-radius: 999px;
  font: 600 1rem var(--body);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(135deg, var(--electric), var(--violet));
  color: #0a0b1a;
  box-shadow: 0 8px 30px -8px rgba(138, 180, 255, 0.7);
}
.btn-primary:hover { box-shadow: 0 12px 40px -8px rgba(178, 140, 255, 0.9); }
.btn-ghost { background: rgba(255, 255, 255, 0.04); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--electric); background: rgba(138, 180, 255, 0.08); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
  cursor: crosshair;
}
.hero > * { position: absolute; inset: 0; }
.sky {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, #1c2350 0%, transparent 70%),
    linear-gradient(180deg, #0b0f28 0%, #121838 45%, #090b1d 80%, var(--bg) 100%);
}
.clouds { pointer-events: none; background-repeat: repeat-x; }
.clouds-back {
  background-image:
    radial-gradient(ellipse 30% 18% at 15% 20%, rgba(70, 82, 140, 0.55), transparent 70%),
    radial-gradient(ellipse 35% 20% at 55% 12%, rgba(60, 70, 125, 0.6), transparent 70%),
    radial-gradient(ellipse 28% 16% at 88% 24%, rgba(70, 82, 140, 0.5), transparent 70%);
  background-size: 1600px 100%;
  animation: drift 90s linear infinite;
}
.clouds-front {
  background-image:
    radial-gradient(ellipse 40% 14% at 30% 4%, rgba(18, 22, 48, 0.95), transparent 70%),
    radial-gradient(ellipse 45% 16% at 80% 2%, rgba(14, 18, 40, 0.95), transparent 70%);
  background-size: 1400px 100%;
  animation: drift 60s linear infinite reverse;
}
@keyframes drift { to { background-position: 1600px 0; } }

#sky { width: 100%; height: 100%; }
.flash {
  --fx: 50%;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse 60% 55% at var(--fx) 0%, rgba(200, 212, 255, 0.85), transparent 70%),
    rgba(170, 185, 255, 0.12);
  mix-blend-mode: screen;
}

.hero-content {
  position: relative;
  inset: auto;
  padding: 140px 0 140px;
  pointer-events: none;
}
.hero-content a { pointer-events: auto; }
.hero h1 {
  font-size: clamp(3.4rem, 11vw, 8.5rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  margin-bottom: 26px;
}
.charge {
  background: linear-gradient(100deg, var(--bolt) 0%, var(--electric) 40%, var(--violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(138, 180, 255, 0.35));
  transition: filter 0.25s;
}
.hero.lit .charge { filter: drop-shadow(0 0 40px rgba(220, 230, 255, 0.9)); transition: filter 0.05s; }
.lede { font-size: clamp(1.1rem, 2vw, 1.35rem); color: #c7cdee; max-width: 32ch; margin-bottom: 34px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.hero-controls {
  position: absolute;
  inset: auto 16px 24px auto;
  display: flex; align-items: center; gap: 10px;
  z-index: 2;
}
.hint { font-size: 0.85rem; color: var(--muted); margin-right: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(5, 6, 15, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  font: 500 0.85rem var(--body);
  cursor: pointer;
  transition: border-color 0.2s;
}
.chip:hover { border-color: var(--electric); }
.chip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chip svg path:first-child { fill: currentColor; stroke: none; }
.chip .waves { opacity: 0.25; transition: opacity 0.2s; }
.chip[aria-pressed="true"] .waves { opacity: 1; }
#sound-toggle[aria-pressed="true"] { border-color: var(--electric); }

/* ---------- Counter ---------- */
.counter-strip {
  border-block: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(138, 180, 255, 0.06), rgba(178, 140, 255, 0.06));
  padding: 22px 0;
  text-align: center;
  color: var(--muted);
}
.counter-strip strong {
  font-family: var(--head);
  font-size: 1.35em;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  display: inline-block;
  min-width: 4ch;
  text-shadow: 0 0 18px rgba(255, 209, 102, 0.45);
}

/* ---------- Sections ---------- */
.section { padding: clamp(80px, 12vw, 140px) 0; position: relative; }
.section-alt { background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 20%, var(--bg-2) 80%, var(--bg) 100%); }
.section-head { max-width: 720px; margin-bottom: 56px; }
.section-head h2 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin-bottom: 18px; }
.section-head p:not(.eyebrow) { color: var(--muted); font-size: 1.1rem; }
.section-head-sub { margin-top: 110px; }

.ingredients, .stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.ingredient, .stage, .fact, .live-card, .list, .rule-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
.ingredient:hover, .stage:hover, .fact:hover { background: var(--panel-hover); border-color: rgba(138, 180, 255, 0.35); }
.ingredient .num { font-family: var(--head); color: var(--violet); font-size: 0.9rem; letter-spacing: 0.1em; }
.ingredient h3, .stage h3 { font-size: 1.6rem; margin: 10px 0 12px; }
.ingredient p, .stage p, .fact p, .live-card p, .rule-item p { color: var(--muted); }

.stage-art { width: 100%; height: auto; max-height: 180px; margin-bottom: 18px; }
.stage-art .cloud { fill: rgba(150, 168, 230, 0.22); stroke: rgba(170, 190, 255, 0.55); stroke-width: 1.5; }
.stage-art .faded { opacity: 0.5; }
.stage-art .bolt { fill: var(--amber); filter: drop-shadow(0 0 6px rgba(255, 209, 102, 0.8)); }
.stage-art .rain, .stage-art .updraft { fill: none; stroke: var(--electric); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stage-art .updraft { stroke: var(--violet); }
.stage:hover .bolt { animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 60% { opacity: 0.2; } 70% { opacity: 1; } }
.stage-tag { font-family: var(--head); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--electric) !important; }

/* Facts */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.fact-num {
  font-family: var(--head);
  font-weight: 700;
  font-size: clamp(2.6rem, 5vw, 3.4rem);
  line-height: 1;
  color: var(--text) !important;
  margin-bottom: 14px;
  letter-spacing: -0.03em;
}
.fact-num span { font-size: 0.42em; color: var(--electric); margin-left: 6px; letter-spacing: 0; }

.uk-panel {
  margin-top: 56px;
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 40px;
  align-items: start;
  padding: 40px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 209, 102, 0.25);
  background:
    radial-gradient(ellipse at 0% 0%, rgba(255, 209, 102, 0.12), transparent 60%),
    var(--panel);
}
.uk-panel .eyebrow { color: var(--amber); }
.uk-panel h3 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.uk-panel p:not(.eyebrow) { color: #c3c9e6; }
.uk-panel em { color: var(--amber); font-style: normal; font-weight: 600; }

/* ---------- Calculator ---------- */
.calc {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background: var(--panel);
}
.calc-controls { padding: 40px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.btn-big { padding: 22px 28px; font-size: 1.1rem; margin-bottom: 36px; width: 100%; }
.btn-big.armed {
  background: linear-gradient(135deg, var(--amber), #ff9f5a);
  box-shadow: 0 0 0 0 rgba(255, 209, 102, 0.7);
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 18px rgba(255, 209, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0); } }
.slider-label { font-size: 0.9rem; color: var(--muted); margin-bottom: 12px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 99px;
  background: linear-gradient(90deg, var(--danger) 0%, var(--danger) 50%, var(--line) 50%);
  outline-offset: 6px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--text); border: 4px solid var(--violet); cursor: grab;
  box-shadow: 0 0 16px rgba(178, 140, 255, 0.8);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text); border: 4px solid var(--violet); cursor: grab;
}
.slider-scale { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-top: 10px; }

.calc-readout { padding: 40px; display: flex; flex-direction: column; gap: 34px; }
.readings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.reading { font-family: var(--head); font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.unit { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

.track { position: relative; height: 110px; }
.track::before { content: ''; position: absolute; left: 0; right: 0; top: 64px; height: 2px; background: var(--line); }
.zone {
  position: absolute; left: 0; top: 40px; height: 50px;
  width: 51.45%; /* 30 s = 10.29 km of a 20 km track */
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(255, 107, 125, 0.28), rgba(255, 107, 125, 0.06));
  border: 1px dashed rgba(255, 107, 125, 0.5);
}
.zone span { position: absolute; right: 10px; bottom: 4px; font-size: 0.75rem; color: var(--danger); white-space: nowrap; }
.you {
  position: absolute; left: 0; top: 54px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--safe);
  box-shadow: 0 0 14px rgba(110, 231, 183, 0.7);
  font-size: 0; transform: translateX(-4px);
}
.storm-marker {
  position: absolute; top: 18px; left: 20%;
  width: 52px; transform: translateX(-50%);
  transition: left 0.35s cubic-bezier(.2, .8, .2, 1);
}
.storm-marker svg path { fill: #b9c4f0; }
.storm-marker svg .b { fill: var(--amber); }
.track-scale { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }

.verdict {
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-weight: 500;
  min-height: 3.6em;
}
.verdict.danger { border-color: rgba(255, 107, 125, 0.5); background: rgba(255, 107, 125, 0.1); color: #ffc4cc; }
.verdict.caution { border-color: rgba(255, 209, 102, 0.4); background: rgba(255, 209, 102, 0.08); color: #ffe6a8; }

/* ---------- Safety ---------- */
.rule { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.rule-item { padding: 40px; }
.rule-num { font-family: var(--head); font-weight: 700; font-size: clamp(4rem, 9vw, 6.5rem); line-height: 0.9; color: var(--amber) !important; letter-spacing: -0.05em; margin-bottom: 16px; }
.rule-num span { display: block; font-size: 1rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.list h3 { font-size: 1.5rem; margin-bottom: 18px; }
.list ul { list-style: none; display: grid; gap: 14px; }
.list li { position: relative; padding-left: 34px; color: #c3c9e6; }
.list li::before {
  position: absolute; left: 0; top: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700;
}
.do li::before { content: '✓'; background: rgba(110, 231, 183, 0.15); color: var(--safe); }
.dont li::before { content: '✕'; background: rgba(255, 107, 125, 0.15); color: var(--danger); }

/* ---------- Live ---------- */
.live { background: radial-gradient(ellipse 70% 60% at 50% 100%, rgba(178, 140, 255, 0.14), transparent 70%); }
.live-links { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.live-card { display: block; text-decoration: none; position: relative; padding: 36px; }
.live-card:hover { transform: translateY(-4px); border-color: var(--electric); background: var(--panel-hover); }
.live-card h3 { font-size: 1.7rem; margin: 18px 0 10px; }
.live-card .go { display: inline-block; margin-top: 20px; color: var(--electric); font-weight: 600; }
.live-card .go::after { content: ' ↗'; }
.live-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--electric); box-shadow: 0 0 0 0 rgba(138, 180, 255, 0.7); animation: ping 2s infinite; }
.live-dot.amber { background: var(--amber); animation-name: ping-amber; }
@keyframes ping { 70% { box-shadow: 0 0 0 14px rgba(138, 180, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(138, 180, 255, 0); } }
@keyframes ping-amber { 70% { box-shadow: 0 0 0 14px rgba(255, 209, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0); } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0 48px; }
.footer-inner { display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.site-footer p { color: var(--muted); font-size: 0.85rem; max-width: 60ch; }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.2, .8, .2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
.ingredients .reveal:nth-child(2), .stages .reveal:nth-child(2), .facts .reveal:nth-child(3n+2) { transition-delay: 0.1s; }
.ingredients .reveal:nth-child(3), .stages .reveal:nth-child(3), .facts .reveal:nth-child(3n) { transition-delay: 0.2s; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .ingredients, .stages { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .uk-panel { grid-template-columns: 1fr; gap: 16px; padding: 30px; }
  .calc { grid-template-columns: 1fr; }
  .calc-controls { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav a:not(.nav-cta) { display: none; }
  .rule, .dos, .live-links, .facts { grid-template-columns: 1fr; }
  .hero-content { padding-bottom: 150px; }
  .hero-controls { left: 16px; right: 16px; justify-content: flex-start; flex-wrap: wrap; }
  .hint { width: 100%; }
  .calc-controls, .calc-readout { padding: 26px; }
  .readings { gap: 8px; }
  .reading { font-size: 2rem; }
  .ingredient, .stage, .fact, .live-card, .list, .rule-item { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .clouds, .live-dot, .btn-big.armed, .stage:hover .bolt { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}
