:root {
  --bg: #0d0221;
  --fg: #f4ecff;
  --muted: #cbb8f5;
  --pink: #ff2a6d;
  --purple: #b146ff;
  --cyan: #05d9e8;
  --horizon: 45vh; /* height of the floor, i.e. distance from the bottom to the horizon */
}

* {
  box-sizing: border-box;
}

html {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background-color: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 38vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* Sky gradient, brightest at the horizon */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    to bottom,
    #0d0221 0%,
    #1f0b45 30%,
    #5c1a6e calc(100% - var(--horizon) - 18vh),
    #ff2a6d calc(100% - var(--horizon) - 4vh),
    #ff9e4a calc(100% - var(--horizon))
  );
}

#stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100vh - var(--horizon));
}

/* Striped retro sun, half-set behind the horizon */
.sun {
  position: fixed;
  left: 50%;
  bottom: var(--horizon);
  width: min(46vh, 80vw);
  aspect-ratio: 1;
  transform: translate(-50%, 28%);
  filter: drop-shadow(0 0 40px rgba(255, 42, 109, 0.7));
}

.sun-disc {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(to bottom, #fff36b 10%, #ff9e4a 45%, #ff2a6d 80%, #b146ff);
  mask-image: linear-gradient(
    to bottom,
    #000 0 48%,
    transparent 48% 51%,
    #000 51% 58%,
    transparent 58% 63%,
    #000 63% 69%,
    transparent 69% 76%,
    #000 76% 81%,
    transparent 81% 89%,
    #000 89%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0 48%,
    transparent 48% 51%,
    #000 51% 58%,
    transparent 58% 63%,
    #000 63% 69%,
    transparent 69% 76%,
    #000 76% 81%,
    transparent 81% 89%,
    #000 89%
  );
}

.mountains {
  position: fixed;
  left: 0;
  bottom: var(--horizon);
  width: 100%;
  height: 14vh;
}

.mountains polygon {
  fill: #12002b;
  stroke: var(--cyan);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 6px var(--cyan));
}

/* Mode 7 floor, rendered at a low internal resolution and scaled up */
#floor {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: var(--horizon);
  image-rendering: pixelated;
  box-shadow: 0 -4px 30px var(--pink);
}

main {
  position: relative;
  z-index: 1;
  padding: 16px;
  text-align: center;
}

@keyframes fade-in {
  from { opacity: 0; }
}

/* Top Gear style title: a fast, italic slide-in from the right with speed streaks trailing behind */
h1 {
  position: relative;
  margin: 8px 0 40px;
  font-size: clamp(3rem, 15vw, 9rem);
  font-style: italic;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--pink);
  filter: blur(0) drop-shadow(0 0 18px rgba(255, 42, 109, 0.75));
  animation: swoosh 0.9s cubic-bezier(0.12, 0.8, 0.25, 1) both;
}

@keyframes swoosh {
  0% {
    transform: translateX(110vw) skewX(-24deg);
    filter: blur(14px) drop-shadow(0 0 18px rgba(255, 42, 109, 0.75));
  }
  70% {
    transform: translateX(-3vw) skewX(-8deg);
    filter: blur(2px) drop-shadow(0 0 18px rgba(255, 42, 109, 0.75));
  }
  85% {
    transform: translateX(1vw) skewX(-12deg);
  }
  100% {
    transform: translateX(0) skewX(-12deg);
    filter: blur(0) drop-shadow(0 0 18px rgba(255, 42, 109, 0.75));
  }
}

/* Speed streaks that trail the title and collapse into it as it settles */
h1::before {
  content: "";
  position: absolute;
  top: 8%;
  bottom: 8%;
  left: 100%;
  width: 70vw;
  background: repeating-linear-gradient(to bottom, var(--pink) 0 3px, transparent 3px 14px);
  mask-image: linear-gradient(to right, #000, transparent);
  -webkit-mask-image: linear-gradient(to right, #000, transparent);
  transform-origin: left center;
  animation: streaks 0.9s ease-out both;
}

@keyframes streaks {
  0% { transform: scaleX(1); opacity: 1; }
  70% { transform: scaleX(0.6); opacity: 1; }
  100% { transform: scaleX(0); opacity: 0; }
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border: 1px solid var(--cyan);
  border-radius: 999px;
  color: var(--cyan);
  font-size: 1rem;
  text-decoration: none;
  background: rgba(13, 2, 33, 0.7);
  box-shadow: 0 0 20px rgba(5, 217, 232, 0.35), inset 0 0 12px rgba(5, 217, 232, 0.2);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  animation: fade-in 0.5s ease-out 0.9s both;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-3px) scale(1.04);
  background: rgba(5, 217, 232, 0.15);
  box-shadow: 0 0 40px rgba(5, 217, 232, 0.7), inset 0 0 16px rgba(5, 217, 232, 0.3);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  h1::before {
    display: none;
  }

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
