:root {
  --bg: #0a0b0d;
  --ink: #eef1f4;
  --dim: #8a929c;
  --line: #22262c;
  --gold: #e7b75a;
  --violet: #9b6bff;
  --blue: #3d8bff;
  --p: 0;
  --r: 0deg;
  --tx: 0deg;
  --ty: 0deg;
  --size: min(62vw, 34svh);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.mono { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; }

body::before {
  content: "";
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(40% 35% at 50% 38%, color-mix(in oklab, var(--violet) calc(var(--p) * 28%), #1a1d22) 0%, transparent 70%),
    radial-gradient(30% 30% at 80% 90%, #15181d 0%, transparent 70%);
  transition: background .3s;
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  opacity: .07;
  pointer-events: none;
  z-index: 5;
  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='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.stage {
  position: relative;
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: max(16px, env(safe-area-inset-top)) 20px max(12px, env(safe-area-inset-bottom));
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: rise .8s .1s both;
}
.logo { font-weight: 700; letter-spacing: .28em; font-size: 15px; }
.logo sup { font-size: 9px; letter-spacing: 0; color: var(--gold); margin-left: 2px; }
.tag { font-size: 10px; color: var(--dim); letter-spacing: .08em; }

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3svh, 32px);
  text-align: center;
  min-height: 0;
}

/* Bolt */
.bolt-wrap {
  position: relative;
  width: var(--size);
  aspect-ratio: 1;
  max-width: 100%;
  perspective: 900px;
  transform: rotateX(var(--tx)) rotateY(var(--ty));
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
  animation: pop 1s cubic-bezier(.2, .9, .3, 1.3) both;
  touch-action: none;
  cursor: grab;
}
.bolt-wrap:active { cursor: grabbing; }

.gauge { position: absolute; inset: -9%; width: 118%; height: 118%; transform: rotate(-90deg); }
.gauge .track { fill: none; stroke: var(--line); stroke-width: 1.5; }
.gauge .fill {
  fill: none;
  stroke: color-mix(in oklab, var(--gold), var(--blue) calc(var(--p) * 100%));
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 578;
  stroke-dashoffset: calc(578 - var(--p) * 578);
  filter: drop-shadow(0 0 6px currentColor);
}
.gauge .ticks line { stroke: #3a3f46; stroke-width: 1; }
.gauge .ticks line.on { stroke: var(--ink); }

.bolt {
  position: absolute;
  inset: 0;
  transform: rotate(var(--r));
  filter: drop-shadow(0 24px 30px rgba(0, 0, 0, .6));
}
.washer, .hex { position: absolute; }
.washer {
  inset: 2%;
  border-radius: 50%;
  background: conic-gradient(from calc(var(--r) * -1), #5b626b, #d9dee3, #6d747c, #aab1b8, #4d535a, #c7ccd2, #5b626b);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08), inset 0 0 30px rgba(0, 0, 0, .5);
}
.hex {
  inset: 14%;
  clip-path: polygon(25% 6.7%, 75% 6.7%, 100% 50%, 75% 93.3%, 25% 93.3%, 0 50%);
  background: conic-gradient(from calc(var(--r) * -1 + 20deg), #7d858e, #f2f5f7, #8a9199, #c3c9cf, #60676f, #e4e8ec, #7d858e);
}
.anod {
  position: absolute;
  inset: 0;
  background: conic-gradient(from calc(var(--r) * -1), var(--gold), var(--violet), var(--blue), var(--violet), var(--gold));
  mix-blend-mode: color;
  opacity: calc(var(--p) * .95);
}
.socket {
  position: absolute;
  inset: 32%;
  clip-path: polygon(25% 6.7%, 75% 6.7%, 100% 50%, 75% 93.3%, 25% 93.3%, 0 50%);
  background: radial-gradient(circle at 50% 40%, #1b1e22, #050607 70%);
  box-shadow: inset 0 0 12px #000;
}

.burst {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  border: 2px solid var(--blue);
  opacity: 0;
}
.locked .burst { animation: burst .9s ease-out; }
.locked .bolt-wrap { animation: thunk .35s ease-out; }

/* Copy */
.eyebrow {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  animation: rise .8s .35s both;
}
h1 {
  font-size: clamp(34px, 10vw, 84px);
  line-height: .95;
  letter-spacing: -.035em;
  font-weight: 700;
  margin-top: 10px;
}
h1 span { display: inline-block; animation: rise .9s both; }
h1 span:nth-child(1) { animation-delay: .45s; }
h1 span:nth-child(2) { animation-delay: .55s; }
.ti {
  background: linear-gradient(100deg, #8b939c 0%, #fff 20%, #9aa2ab 40%, var(--gold) 60%, var(--violet) 78%, var(--blue) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise .9s .55s both, sheen 6s linear infinite;
}
.sub {
  color: var(--dim);
  font-size: clamp(14px, 3.6vw, 17px);
  max-width: 34ch;
  margin: 12px auto 0;
  line-height: 1.45;
  animation: rise .9s .7s both;
}

/* Controls */
.controls { display: grid; gap: 10px; justify-items: center; animation: rise .9s .85s both; }
.hold {
  position: relative;
  overflow: hidden;
  width: min(280px, 78vw);
  height: 56px;
  border-radius: 99px;
  border: 1px solid #3a3f46;
  background: #121418;
  color: var(--ink);
  font: 600 13px/1 "JetBrains Mono", monospace;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: transform .15s, border-color .3s;
}
.hold:active, .hold.down { transform: scale(.97); }
.hold:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.hold-fill {
  position: absolute;
  inset: 0;
  transform-origin: left;
  transform: scaleX(var(--p));
  background: linear-gradient(90deg, var(--gold), var(--violet), var(--blue));
}
.hold-label { position: relative; mix-blend-mode: difference; }
.locked .hold { border-color: var(--blue); }
.readout { font-size: 12px; color: var(--dim); letter-spacing: .06em; }
.readout b { color: var(--ink); font-weight: 600; display: inline-block; min-width: 4ch; text-align: right; }

/* Ticker */
.ticker {
  overflow: hidden;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--dim);
  mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
}
.track-x { display: flex; gap: 18px; width: max-content; animation: marquee 28s linear infinite; }
.track-x i { font-style: normal; color: var(--gold); }

@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } }
@keyframes pop { from { opacity: 0; transform: scale(.6) rotate(-90deg); } }
@keyframes sheen { to { background-position: -250% 0; } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes burst { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.8); } }
@keyframes thunk { 40% { transform: scale(.94); } }

@media (min-width: 900px) {
  :root { --size: min(30vw, 44svh); }
  .stage { padding-inline: 48px; }
  .hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    column-gap: 6vw;
    text-align: left;
    align-content: center;
  }
  .bolt-wrap { grid-row: 1 / 3; grid-column: 2; justify-self: center; }
  .copy { align-self: end; }
  .sub { margin-left: 0; }
  .controls { justify-items: start; align-self: start; }
  .tag { font-size: 11px; }
}

@media (max-height: 620px) and (max-width: 899px) {
  :root { --size: min(50vw, 26svh); }
  .sub { display: none; }
}

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

.locked .hold-label { mix-blend-mode: normal; color: #0a0b0d; }
