:root {
  --black: #080b0d;
  --steel-0: #0e1316;
  --steel-1: #171e22;
  --steel-2: #263137;
  --line: #4a5960;
  --text: #edf4f5;
  --muted: #8f9da2;
  --arc: #75eaff;
  --arc-hot: #e7fdff;
  --warning: #f4c430;
  --orange: #f06a24;
  --green: #39ff88;
  --pink: #ff4ad8;
  --max: 1440px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--black);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    radial-gradient(circle at 70% 34%, rgba(46, 217, 255, .08), transparent 31rem),
    #0b0f11;
  background-size: 38px 38px, 38px 38px, auto, auto;
  font-family: "Arial Narrow", "Roboto Condensed", Impact, system-ui, sans-serif;
  overflow-x: hidden;
}

a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.arc-flash {
  position: fixed;
  inset: 0;
  z-index: 19;
  pointer-events: none;
  background: #d8fbff;
  opacity: 0;
}

.arc-flash.is-active { animation: flash .16s steps(2, end); }

.topbar {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid rgba(157, 185, 195, .28);
  background: rgba(8, 12, 14, .84);
  backdrop-filter: blur(12px);
}

.brand,
.dex-jump {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: .12em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--text);
  clip-path: polygon(9% 0, 91% 0, 100% 18%, 100% 82%, 91% 100%, 9% 100%, 0 82%, 0 18%);
  color: var(--black);
  background: var(--warning);
  font-family: Impact, sans-serif;
}

.dex-jump {
  padding: 9px 13px;
  color: var(--arc);
  border: 1px solid rgba(117, 234, 255, .38);
  font-size: .74rem;
}

.hero {
  position: relative;
  min-height: 100svh;
  max-width: var(--max);
  margin: 0 auto;
  padding: 112px 56px 82px;
  display: grid;
  grid-template-columns: minmax(360px, .82fr) minmax(450px, 1.18fr);
  align-items: center;
  gap: 30px;
  border-inline: 1px solid rgba(157, 185, 195, .18);
  background: #080c0e;
  isolation: isolate;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
}

.factory-backdrop {
  position: absolute;
  z-index: -3;
  inset: 68px 0 0;
  background-image:
    linear-gradient(90deg, rgba(7, 11, 13, .92) 0%, rgba(7, 11, 13, .72) 31%, rgba(7, 11, 13, .15) 62%, rgba(7, 11, 13, .38) 100%),
    linear-gradient(0deg, rgba(5, 8, 9, .9), transparent 36%),
    url("assets/factory-bg.jpg");
  background-position: center;
  background-size: cover;
  transform: scale(1.035);
  animation: factoryDrift 16s ease-in-out infinite alternate;
}

.factory-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .38;
  background:
    repeating-linear-gradient(90deg, transparent 0 89px, rgba(117,234,255,.04) 89px 90px),
    repeating-linear-gradient(0deg, transparent 0 89px, rgba(117,234,255,.03) 89px 90px);
}

.factory-haze {
  position: absolute;
  z-index: -2;
  right: -8%;
  bottom: 0;
  width: 75%;
  height: 50%;
  opacity: .34;
  filter: blur(35px);
  background: radial-gradient(ellipse at 50% 100%, rgba(54, 222, 255, .2), transparent 66%);
  animation: haze 8s ease-in-out infinite alternate;
}

.hero::before {
  left: 34px;
  top: 96px;
  bottom: 70px;
  width: 2px;
  background: repeating-linear-gradient(to bottom, var(--warning) 0 11px, transparent 11px 19px);
  opacity: .55;
}

.hero::after {
  right: 1.8%;
  top: 17%;
  width: 36%;
  aspect-ratio: 1;
  border: 1px solid rgba(117, 234, 255, .12);
  border-radius: 50%;
  box-shadow: inset 0 0 80px rgba(49, 215, 255, .04), 0 0 120px rgba(49, 215, 255, .04);
}

.hazard-line {
  position: absolute;
  top: 68px;
  left: 0;
  right: 0;
  height: 13px;
  background: repeating-linear-gradient(-45deg, var(--warning) 0 13px, #111 13px 26px);
}

.copy-panel { position: relative; z-index: 3; }

.copy-panel::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -42px -44px -38px -68px;
  background: radial-gradient(ellipse at 26% 48%, rgba(7, 11, 13, .96), rgba(7, 11, 13, .82) 44%, transparent 76%);
  pointer-events: none;
}

.shift-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 22px;
  color: var(--muted);
  font: 800 .72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .16em;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
  animation: pulse 1.5s ease-in-out infinite;
}

h1 {
  margin: 0;
  max-width: 8ch;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(5.2rem, 9.5vw, 9.4rem);
  line-height: .78;
  letter-spacing: -.035em;
  transform: scaleX(.88);
  transform-origin: left center;
  text-shadow: 7px 7px 0 #111, 9px 9px 0 #455158;
}

.ticker {
  width: fit-content;
  margin: 26px 0 0;
  padding: 6px 12px;
  color: #111;
  background: var(--warning);
  border: 2px solid #111;
  font: 1000 clamp(1.1rem, 2vw, 1.55rem)/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .05em;
  transform: rotate(-1.2deg);
}

.description {
  max-width: 34rem;
  margin: 23px 0 28px;
  color: #c9d2d5;
  font: 600 clamp(1rem, 1.5vw, 1.22rem)/1.5 system-ui, sans-serif;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.machine-button {
  min-height: 54px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid #52636b;
  border-bottom: 4px solid #050708;
  border-radius: 4px;
  background: linear-gradient(#303b40, #171d20);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 4px 0 #060809;
  text-decoration: none;
  font: 900 .78rem/1 system-ui, sans-serif;
  letter-spacing: .06em;
  transition: transform .15s ease, filter .15s ease, border-color .15s ease;
}

.machine-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.18);
  border-color: var(--arc);
}

.machine-button:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 1px 0 #060809; }
.machine-button svg { width: 19px; height: 19px; fill: currentColor; }
.x-button { color: #fff; }
.pump-button { color: #b6ff52; }
.dex-button { color: #ff7be6; }

.pump-icon {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 2px solid currentColor;
  border-radius: 50%;
  font: 900 11px/1 Arial, sans-serif;
}

.contract {
  width: min(100%, 610px);
  min-height: 62px;
  margin-top: 18px;
  padding: 9px 13px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  color: var(--text);
  border: 1px dashed #66767e;
  border-radius: 2px;
  background: #0c1114;
  cursor: pointer;
  text-align: left;
}

.contract:hover { border-color: var(--arc); }
.contract-label, .copy-status { font: 900 .65rem/1 ui-monospace, monospace; letter-spacing: .1em; }
.contract-label { color: var(--muted); }
.contract strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; font: 800 .82rem/1.2 ui-monospace, monospace; text-align: center; }
.copy-status { color: var(--arc); }

.welder-stage {
  position: relative;
  align-self: end;
  height: min(78vh, 790px);
  min-height: 560px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  perspective: 1000px;
}

.welder {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 3;
  display: block;
  width: min(100%, 790px);
  max-height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(20px 16px 0 rgba(0, 0, 0, .34));
  transform-origin: center bottom;
  transition: opacity .24s steps(2, end), filter .25s ease;
}

.welder-up {
  opacity: 1;
  transform: translateX(-50%);
  animation: shiftUp 5s ease-in-out infinite;
}

.welder-down {
  opacity: 0;
  transform: translateX(-50%);
  animation: shiftDown 5s ease-in-out infinite;
}

.welder-stage.mask-down .welder-up { opacity: 0; }
.welder-stage.mask-down .welder-down { opacity: 1; }
.welder-stage.lowering .welder-up { transform: translateX(-50%) translateY(5px) rotateX(-3deg); }
.welder-stage.raising .welder-down { transform: translateX(-50%) translateY(-6px) rotateX(3deg); }

.welder-stage.is-welding .welder-down {
  filter: drop-shadow(20px 16px 0 rgba(0, 0, 0, .34)) drop-shadow(-8px -3px 12px rgba(117,234,255,.34));
}

.welding-glow {
  position: absolute;
  z-index: 1;
  left: 47%;
  top: 22%;
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--arc-hot);
  filter: blur(60px);
  opacity: .16;
  animation: arcGlow 2.8s steps(3, end) infinite;
}

.arc-point {
  position: absolute;
  z-index: 8;
  left: 60%;
  top: 43%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0;
  background: #fff;
  box-shadow: 0 0 9px 3px #fff, 0 0 24px 11px var(--arc), 0 0 80px 26px rgba(117,234,255,.58);
}

.welder-stage.is-welding .arc-point { animation: arcPoint .12s steps(2,end) infinite; }

.steel-plate {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 18px;
  width: min(82%, 500px);
  min-height: 44px;
  transform: translateX(-50%) skewX(-6deg);
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 12px;
  color: var(--muted);
  border: 1px solid #59686e;
  background: linear-gradient(100deg, #1d2529, #0e1315 52%, #252e32);
  box-shadow: 0 9px 18px rgba(0,0,0,.45), inset 0 1px rgba(255,255,255,.08);
  font: 800 .6rem/1 ui-monospace, monospace;
  letter-spacing: .14em;
}

.sparks { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.spark {
  position: absolute;
  width: 3px;
  height: var(--length, 34px);
  left: var(--x, 55%);
  top: var(--y, 32%);
  border-radius: 999px;
  background: linear-gradient(var(--arc-hot), var(--warning), transparent);
  box-shadow: 0 0 8px var(--arc);
  transform: rotate(var(--angle, 20deg));
  transform-origin: center top;
  animation: sparkFly var(--duration, .7s) ease-out forwards;
}

.incoming-sparks {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  overflow: hidden;
}

.incoming-spark {
  position: absolute;
  right: var(--start-right, -10%);
  bottom: var(--start-bottom, 4%);
  width: var(--size, 86px);
  height: 3px;
  opacity: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #fff 0%, var(--warning) 42%, transparent 100%);
  box-shadow: 0 0 8px var(--orange), 0 0 15px rgba(117,234,255,.65);
  transform: rotate(var(--tilt, 19deg));
  animation: incomingSpark var(--speed, .24s) linear forwards;
}

.hero-footer {
  position: absolute;
  left: 54px;
  right: 54px;
  bottom: 22px;
  display: flex;
  justify-content: space-between;
  color: #77868c;
  font: 800 .62rem/1 ui-monospace, monospace;
  letter-spacing: .13em;
}

.dex-section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 100px 56px 80px;
  border-inline: 1px solid rgba(157, 185, 195, .18);
  background: #0d1215;
}

.panel-heading {
  margin-bottom: 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.panel-heading p { margin: 0 0 8px; color: var(--muted); font: 800 .66rem/1 ui-monospace, monospace; letter-spacing: .13em; }
.panel-heading h2 { margin: 0; font: 900 clamp(2.6rem, 6vw, 5.4rem)/.9 Impact, "Arial Black", sans-serif; letter-spacing: .015em; }
.panel-light { color: var(--green); font: 800 .7rem/1 ui-monospace, monospace; letter-spacing: .12em; text-shadow: 0 0 12px var(--green); }

.chart-shell {
  position: relative;
  padding: 16px;
  border: 2px solid #526168;
  background: linear-gradient(145deg, #252e32, #111719);
  box-shadow: inset 0 0 0 5px #0a0d0f, 18px 18px 0 rgba(0,0,0,.24);
}

.chart-shell iframe {
  display: block;
  width: 100%;
  height: min(72vh, 760px);
  min-height: 560px;
  border: 1px solid #000;
  background: #090b0d;
}

.bolts i {
  position: absolute;
  z-index: 2;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa6aa;
  box-shadow: inset 2px 2px 1px #424a4e, 0 0 0 1px #050708;
}
.bolts i:nth-child(1) { top: 5px; left: 5px; }
.bolts i:nth-child(2) { top: 5px; right: 5px; }
.bolts i:nth-child(3) { bottom: 5px; left: 5px; }
.bolts i:nth-child(4) { bottom: 5px; right: 5px; }

.open-dex {
  display: block;
  width: fit-content;
  margin: 24px 0 0 auto;
  color: var(--arc);
  font: 900 .74rem/1 system-ui, sans-serif;
  letter-spacing: .08em;
  text-decoration: none;
}

footer {
  max-width: var(--max);
  min-height: 78px;
  margin: 0 auto;
  padding: 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #66757b;
  border: 1px solid rgba(157, 185, 195, .18);
  border-top: 8px solid transparent;
  border-image: repeating-linear-gradient(-45deg, var(--warning) 0 12px, #111 12px 24px) 8;
  background: #080b0d;
  font: 800 .62rem/1 ui-monospace, monospace;
  letter-spacing: .12em;
}

@keyframes pulse { 50% { opacity: .35; } }
@keyframes shiftUp { 0%,100% { transform: translateX(-50%) translateY(0) rotate(-.25deg); } 50% { transform: translateX(-50%) translateY(-7px) rotate(.25deg); } }
@keyframes shiftDown { 0%,100% { transform: translateX(-50%) translateY(0) rotate(.15deg); } 50% { transform: translateX(-50%) translateY(-4px) rotate(-.15deg); } }
@keyframes arcGlow { 0%, 16%, 21%, 54%, 59%, 100% { opacity: .08; transform: scale(.8); } 17%, 20%, 55%, 58% { opacity: .42; transform: scale(1.15); } }
@keyframes flash { 0% { opacity: 0; } 45% { opacity: .16; } 100% { opacity: 0; } }
@keyframes sparkFly { from { opacity: 1; transform: translate(0,0) rotate(var(--angle)); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--angle)); } }
@keyframes incomingSpark { 0% { opacity: 0; transform: translate(0, 0) rotate(var(--tilt)); } 10% { opacity: 1; } 78% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--travel-x, -520px), var(--travel-y, -210px)) rotate(var(--tilt)); } }
@keyframes arcPoint { 0%,100% { opacity: .65; transform: scale(.65); } 50% { opacity: 1; transform: scale(1.35); } }
@keyframes factoryDrift { 0% { transform: scale(1.035) translate3d(-.4%, 0, 0); } 100% { transform: scale(1.065) translate3d(.4%, -.5%, 0); } }
@keyframes haze { 0% { transform: translateX(-2%) scale(.92); opacity: .22; } 100% { transform: translateX(3%) scale(1.08); opacity: .42; } }

@media (max-width: 900px) {
  .hero {
    min-height: auto;
    padding: 110px 24px 70px;
    grid-template-columns: 1fr;
  }
  .copy-panel { padding-top: 26px; }
  h1 { font-size: clamp(4.8rem, 20vw, 8rem); }
  .welder-stage { min-height: 470px; height: 68vh; }
  .hero::before, .hero-footer { display: none; }
  .dex-section { padding: 78px 20px 58px; }
  .chart-shell iframe { min-height: 520px; }
  footer { padding: 0 20px; }
}

@media (max-width: 560px) {
  .topbar { height: 60px; padding-inline: 14px; }
  .brand { font-size: .82rem; }
  .dex-jump { font-size: .62rem; }
  .hazard-line { top: 60px; }
  .hero { padding-inline: 16px; }
  .controls { display: grid; grid-template-columns: repeat(3, 1fr); }
  .machine-button { min-width: 0; padding-inline: 9px; font-size: .65rem; }
  .machine-button svg, .pump-icon { display: none; }
  .contract { grid-template-columns: 1fr auto; }
  .contract-label { grid-column: 1 / -1; }
  .contract strong { text-align: left; }
  .welder-stage { height: 59vh; min-height: 420px; }
  .steel-plate { width: 96%; }
  .panel-heading { align-items: center; }
  .chart-shell { padding: 9px; }
  .chart-shell iframe { min-height: 460px; }
  footer { font-size: .52rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
