:root {
  --bg-deep: #070b14;
  --bg-card: rgba(15, 23, 42, 0.82);
  --border-card: rgba(148, 163, 184, 0.16);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --amber: #f59e0b;
  --amber-bright: #fbbf24;
  --emerald: #10b981;
  --anim-speed: 1;
}

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

html,
body {
  min-height: 100%;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-main);
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 3.5rem 1.25rem;
  position: relative;
}

body.turbo {
  --anim-speed: 0.35;
}

/* Blueprint grid background */
.blueprint-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(56, 189, 248, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(56, 189, 248, 0.05) 1px, transparent 1px),
    linear-gradient(to right, rgba(56, 189, 248, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(56, 189, 248, 0.025) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  animation: gridDrift 24s linear infinite;
  pointer-events: none;
}

@keyframes gridDrift {
  0% {
    background-position: 0 0, 0 0, 0 0, 0 0;
  }
  100% {
    background-position: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  }
}

/* Ambient glowing blobs */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.25;
  z-index: 0;
  pointer-events: none;
}

.glow-one {
  width: 420px;
  height: 420px;
  background: #f59e0b;
  top: -120px;
  left: -100px;
  animation: floatGlow 10s ease-in-out infinite alternate;
}

.glow-two {
  width: 380px;
  height: 380px;
  background: #38bdf8;
  bottom: -100px;
  right: -80px;
  animation: floatGlow 12s ease-in-out infinite alternate-reverse;
}

@keyframes floatGlow {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(35px, 25px) scale(1.1);
  }
}

#sparksCanvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* Animated hazard stripes at top and bottom */
.hazard-tape {
  position: fixed;
  left: 0;
  right: 0;
  height: 14px;
  z-index: 10;
  background: repeating-linear-gradient(
    -45deg,
    var(--amber) 0px,
    var(--amber) 14px,
    #0f172a 14px,
    #0f172a 28px
  );
  background-size: 40px 40px;
  animation: slideStripes calc(1.4s * var(--anim-speed)) linear infinite;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.25);
}

.top-tape {
  top: 0;
}

.bottom-tape {
  bottom: 0;
  animation-direction: reverse;
}

@keyframes slideStripes {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 40px 0;
  }
}

/* Main glass card */
.container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 680px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-card);
  border-radius: 24px;
  padding: 2.25rem 2.25rem 1.85rem;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
  animation: cardEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Status badge */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.32);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--amber-bright);
  margin-bottom: 1.25rem;
}

.beacon {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber-bright);
  box-shadow: 0 0 10px var(--amber-bright);
  animation: pulseBeacon calc(1.5s * var(--anim-speed)) ease-in-out infinite;
}

.divider {
  opacity: 0.45;
}

.build-tag {
  color: #cbd5e1;
}

@keyframes pulseBeacon {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7);
  }
  50% {
    transform: scale(1.2);
    opacity: 0.75;
    box-shadow: 0 0 0 8px rgba(251, 191, 36, 0);
  }
}

/* SVG construction illustration animations */
.scene-wrapper {
  margin: 0.25rem auto 1.25rem;
  max-width: 500px;
}

.construction-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.gear-spin-cw {
  transform-box: fill-box;
  transform-origin: center;
  animation: spinCW calc(9s * var(--anim-speed)) linear infinite;
}

.gear-spin-ccw {
  transform-box: fill-box;
  transform-origin: center;
  animation: spinCCW calc(5.8s * var(--anim-speed)) linear infinite;
}

@keyframes spinCW {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes spinCCW {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

.crane-beacon {
  animation: beaconFlash calc(1.2s * var(--anim-speed)) ease-in-out infinite;
}

@keyframes beaconFlash {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

.crane-trolley {
  animation: trolleySlide calc(6s * var(--anim-speed)) ease-in-out infinite;
}

@keyframes trolleySlide {
  0%,
  100% {
    transform: translateX(0px);
  }
  50% {
    transform: translateX(34px);
  }
}

.crane-hoist {
  transform-origin: 302px 52px;
  animation: hoistBob calc(3.2s * var(--anim-speed)) ease-in-out infinite;
}

@keyframes hoistBob {
  0%,
  100% {
    transform: translateY(0px) rotate(-1.5deg);
  }
  50% {
    transform: translateY(14px) rotate(1.5deg);
  }
}

.skeleton-pulse {
  animation: skeletonShimmer calc(2s * var(--anim-speed)) ease-in-out infinite;
}

@keyframes skeletonShimmer {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

/* Typography */
h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #ffffff 30%, #fde68a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
  max-width: 52ch;
  margin: 0 auto 1.35rem;
}

/* Live build console */
.build-console {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.75);
  border: 1px solid rgba(51, 65, 85, 0.8);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  color: #e2e8f0;
  margin-bottom: 1.65rem;
  max-width: 100%;
}

.prompt {
  color: var(--amber-bright);
  font-weight: 600;
}

.console-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  background: var(--amber-bright);
  animation: blinkCursor 0.9s steps(2, start) infinite;
}

@keyframes blinkCursor {
  to {
    visibility: hidden;
  }
}

/* Progress bar */
.progress-section {
  text-align: left;
  margin-bottom: 1.65rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.5rem;
}

.progress-value {
  font-family: "JetBrains Mono", monospace;
  color: var(--amber-bright);
}

.progress-track {
  height: 12px;
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(71, 85, 105, 0.65);
  border-radius: 999px;
  overflow: hidden;
  padding: 2px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: repeating-linear-gradient(
    -45deg,
    var(--amber-bright) 0px,
    var(--amber-bright) 10px,
    var(--amber) 10px,
    var(--amber) 20px
  );
  background-size: 28px 28px;
  animation: moveProgressStripes calc(1s * var(--anim-speed)) linear infinite;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.55);
  transition: width 0.5s ease;
}

@keyframes moveProgressStripes {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 28px 0;
  }
}

.milestones {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
  font-size: 0.76rem;
  color: #64748b;
}

.milestone.done {
  color: var(--emerald);
}

.milestone.active {
  color: var(--amber-bright);
  font-weight: 600;
}

/* Email notification form */
.notify-form {
  display: flex;
  gap: 0.6rem;
  max-width: 470px;
  margin: 0 auto;
}

.notify-form input {
  flex: 1;
  min-width: 0;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(71, 85, 105, 0.8);
  background: rgba(2, 6, 23, 0.7);
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.notify-form input:focus {
  border-color: var(--amber-bright);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18);
}

.btn-primary {
  padding: 0.8rem 1.35rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #0f172a;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.form-message {
  min-height: 1.3rem;
  margin-top: 0.55rem;
  font-size: 0.84rem;
  color: var(--emerald);
}

.form-message.error {
  color: #f87171;
}

/* Footer row inside card */
.card-footer {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.5);
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  border-color: var(--amber-bright);
  color: var(--amber-bright);
}

body.turbo .btn-ghost {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--amber-bright);
  color: var(--amber-bright);
}

.eta-text strong {
  color: #e2e8f0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 560px) {
  .card {
    padding: 1.75rem 1.25rem 1.4rem;
  }

  .notify-form {
    flex-direction: column;
  }

  .card-footer {
    justify-content: center;
  }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
