:root {
  --paper: #f7f4ec;
  --ink: #0a0a0a;
  --warm-paper: #ebe4d7;
  --stage-width: 1920;
  --stage-height: 1080;
  --mouse-x: 0px;
  --mouse-y: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #161616;
}

body {
  color: var(--ink);
  font-family: "Segoe Print", "Comic Sans MS", ui-rounded, cursive;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 6px solid var(--ink);
  outline-offset: 7px;
}

.viewport {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at center, #3a3a3a 0 1px, transparent 1.5px) 0 0 / 14px 14px,
    #191919;
}

.stage {
  position: absolute;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  isolation: isolate;
  background: var(--paper);
  transform-origin: center center;
  box-shadow: 0 0 0 2px #000, 0 40px 120px rgb(0 0 0 / 55%);
}

.paper-background {
  position: absolute;
  inset: -18px;
  z-index: -5;
  background: var(--paper) url("assets/moon-track-background.png") center / cover no-repeat;
  transform: translate(calc(var(--mouse-x) * -0.22), calc(var(--mouse-y) * -0.22)) scale(1.025);
  transition: transform 160ms ease-out;
}

.paper-background::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.28;
  background-image:
    repeating-linear-gradient(2deg, transparent 0 6px, rgb(0 0 0 / 2%) 7px 8px),
    repeating-linear-gradient(91deg, transparent 0 11px, rgb(0 0 0 / 1.5%) 12px 13px);
  mix-blend-mode: multiply;
  animation: paperShift 0.7s steps(2, end) infinite;
  pointer-events: none;
}

.ink-vignette {
  position: absolute;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  box-shadow: inset 0 0 0 14px var(--ink), inset 0 0 90px rgb(0 0 0 / 12%);
}

.topbar {
  position: absolute;
  z-index: 20;
  top: 34px;
  left: 50px;
  right: 50px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 5px solid var(--ink);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 12px;
  bottom: -12px;
  height: 3px;
  background: var(--ink);
  transform: rotate(-0.18deg);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  text-decoration: none;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 31px;
  letter-spacing: -1px;
}

.brand img {
  width: 66px;
  height: 66px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  object-fit: cover;
  filter: contrast(1.12);
  transform: rotate(-5deg);
  transition: transform 180ms ease;
}

.brand:hover img {
  transform: rotate(8deg) scale(1.06);
}

.top-note {
  margin: 0 0 0 80px;
  padding: 8px 18px 6px;
  border: 3px solid var(--ink);
  background: var(--paper);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  transform: rotate(-1deg);
}

.socials {
  display: flex;
  gap: 15px;
}

.ink-button {
  position: relative;
  display: inline-flex;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 15px 23px 13px;
  border: 4px solid var(--ink);
  border-radius: 4px 11px 5px 8px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 7px 7px 0 var(--ink);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 19px;
  line-height: 1;
  letter-spacing: 0.4px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, color 120ms ease, background 120ms ease;
}

.ink-button:hover {
  color: var(--paper);
  background: var(--ink);
  transform: translate(3px, 3px) rotate(-0.7deg);
  box-shadow: 4px 4px 0 var(--ink);
}

.ink-button:active {
  transform: translate(7px, 7px) scale(0.98);
  box-shadow: 0 0 0 var(--ink);
}

.ink-button--small {
  min-height: 48px;
  padding: 11px 16px 9px;
  border-width: 3px;
  box-shadow: 5px 5px 0 var(--ink);
  font-size: 16px;
}

.ink-button--primary {
  color: var(--paper);
  background: var(--ink);
}

.ink-button--primary:hover {
  color: var(--ink);
  background: var(--paper);
}

.social-mark {
  font-family: Arial, sans-serif;
  font-size: 22px;
}

.hero-copy {
  position: absolute;
  z-index: 10;
  top: 160px;
  left: 76px;
  width: 760px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 15px;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 18px;
  letter-spacing: 2.5px;
}

.eyebrow span {
  padding: 7px 12px 5px;
  color: var(--paper);
  background: var(--ink);
  transform: rotate(-1.2deg);
}

h1 {
  margin: 0;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 111px;
  line-height: 0.75;
  letter-spacing: -8px;
  text-transform: uppercase;
  transform: rotate(-1.1deg);
}

h1 > span {
  display: block;
  width: max-content;
  text-shadow: 4px 3px 0 var(--paper), 7px 6px 0 var(--ink);
  animation: titleJitter 5s steps(1, end) infinite;
}

h1 > span:nth-child(2) {
  margin-left: 58px;
  animation-delay: -1.6s;
}

h1 > span:nth-child(3) {
  margin-top: 7px;
  margin-left: 5px;
  animation-delay: -3.1s;
}

.title-outline {
  color: var(--paper);
  -webkit-text-stroke: 5px var(--ink);
  paint-order: stroke fill;
  text-shadow: 8px 7px 0 var(--ink);
}

.tagline {
  position: absolute;
  top: 111px;
  left: 472px;
  width: 254px;
  margin: 0;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 28px;
  line-height: 0.95;
  letter-spacing: -1px;
  transform: rotate(6deg);
}

.tagline::before {
  content: "↙";
  position: absolute;
  left: -47px;
  top: 27px;
  font-size: 48px;
}

.intro {
  width: 520px;
  margin: 29px 0 0 5px;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.42;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 22px;
}

.ca-button {
  min-width: 210px;
}

.copy-icon {
  font-family: Arial, sans-serif;
  font-size: 26px;
  line-height: 0;
}

.copy-status {
  margin: 13px 0 0 7px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.lore-card {
  position: absolute;
  z-index: 11;
  left: 72px;
  bottom: 105px;
  width: 530px;
  min-height: 230px;
  padding: 25px 31px 22px;
  border: 4px solid var(--ink);
  background: rgb(247 244 236 / 94%);
  box-shadow: 10px 12px 0 var(--ink);
  transform: rotate(0.8deg);
}

.lore-card::before,
.lore-card::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}

.lore-card::before {
  left: 14px;
  bottom: 12px;
}

.lore-card::after {
  right: 15px;
  top: 14px;
}

.lore-kicker {
  margin: 0 0 6px;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 14px;
  letter-spacing: 2px;
}

.lore-card h2 {
  margin: 0 0 9px;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 31px;
  line-height: 1;
  letter-spacing: -1px;
}

.lore-card p:not(.lore-kicker):not(.lore-rule) {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.42;
}

.lore-rule {
  display: inline-block;
  margin: 15px 0 0;
  padding-bottom: 3px;
  border-bottom: 4px double var(--ink);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 15px;
  letter-spacing: 1.2px;
}

.tape {
  position: absolute;
  z-index: 2;
  width: 104px;
  height: 29px;
  border: 2px solid rgb(10 10 10 / 42%);
  background:
    repeating-linear-gradient(90deg, transparent 0 8px, rgb(0 0 0 / 10%) 9px 10px),
    rgb(235 228 215 / 86%);
  opacity: 0.78;
}

.tape--one {
  top: -17px;
  left: 36px;
  transform: rotate(-5deg);
}

.tape--two {
  right: 42px;
  bottom: -16px;
  transform: rotate(4deg);
}

.train-zone {
  position: absolute;
  z-index: 8;
  left: 540px;
  right: 13px;
  bottom: 64px;
  height: 720px;
  pointer-events: none;
  transform: translate(calc(var(--mouse-x) * 0.55), calc(var(--mouse-y) * 0.3));
  transition: transform 140ms ease-out;
}

.train-button {
  position: absolute;
  left: 10px;
  bottom: -17px;
  width: 1360px;
  height: 760px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.train-button:focus-visible {
  outline: 5px dashed var(--ink);
  outline-offset: -70px;
}

.train-float {
  position: absolute;
  inset: 0;
  display: block;
  transform-origin: 52% 77%;
  animation: engineRumble 0.34s steps(2, end) infinite, arrival 1.15s cubic-bezier(0.16, 0.8, 0.28, 1) both;
}

.train-float img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: grayscale(1) contrast(3.2) brightness(1.18) drop-shadow(10px 15px 0 rgb(0 0 0 / 10%));
  mix-blend-mode: multiply;
  transform: scaleX(-1) rotate(-1deg);
  user-select: none;
}

.train-button:hover .train-float {
  animation: excitedRumble 0.19s steps(2, end) infinite;
}

.train-button.is-whistling .train-float {
  animation: whistleJump 0.72s cubic-bezier(0.2, 1.8, 0.4, 1);
}

.toot {
  position: absolute;
  z-index: 4;
  top: 61px;
  right: 214px;
  padding: 14px 18px 9px;
  border: 4px solid var(--ink);
  border-radius: 48% 51% 45% 50%;
  background: var(--paper);
  box-shadow: 5px 6px 0 var(--ink);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 32px;
  opacity: 0;
  transform: rotate(9deg) scale(0.3);
  transition: opacity 100ms ease, transform 160ms ease;
}

.toot::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: -19px;
  width: 24px;
  height: 24px;
  border-right: 4px solid var(--ink);
  border-bottom: 4px solid var(--ink);
  background: var(--paper);
  transform: rotate(45deg);
}

.train-button.is-whistling .toot {
  opacity: 1;
  transform: rotate(-5deg) scale(1);
}

.train-hint {
  position: absolute;
  right: 210px;
  bottom: 65px;
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  transform: rotate(-4deg);
  animation: hintBlink 2.2s ease-in-out infinite;
}

.speed-lines {
  position: absolute;
  z-index: -1;
  left: 250px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.72;
  transform-origin: left center;
  animation: speedLine 1.1s ease-in-out infinite;
}

.speed-lines--one {
  top: 355px;
  width: 125px;
}

.speed-lines--two {
  top: 398px;
  left: 185px;
  width: 205px;
  animation-delay: -0.42s;
}

.speed-lines--three {
  top: 448px;
  left: 275px;
  width: 91px;
  animation-delay: -0.77s;
}

.moon-pulse {
  position: absolute;
  z-index: 0;
  top: 27px;
  right: 180px;
  width: 430px;
  height: 430px;
  pointer-events: none;
}

.moon-pulse span {
  position: absolute;
  inset: 0;
  border: 5px dashed var(--ink);
  border-radius: 50%;
  opacity: 0;
  animation: moonRing 4.5s ease-out infinite;
}

.moon-pulse span:nth-child(2) {
  animation-delay: 1.5s;
}

.moon-pulse span:nth-child(3) {
  animation-delay: 3s;
}

.doodle-stamp {
  position: absolute;
  z-index: 5;
  top: 219px;
  right: 64px;
  width: 130px;
  height: 130px;
  display: grid;
  place-content: center;
  border: 5px solid var(--ink);
  border-radius: 50%;
  background: rgb(247 244 236 / 82%);
  box-shadow: 5px 4px 0 var(--ink);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 21px;
  line-height: 0.87;
  text-align: center;
  transform: rotate(11deg);
  animation: stampWobble 5s ease-in-out infinite;
}

.doodle-stamp span {
  display: block;
}

.marquee {
  position: absolute;
  z-index: 30;
  left: 14px;
  right: 14px;
  bottom: 14px;
  height: 54px;
  overflow: hidden;
  border-top: 5px solid var(--ink);
  border-bottom: 5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 27px;
  line-height: 44px;
  letter-spacing: 1px;
  transform: rotate(-0.12deg);
}

.marquee-track {
  display: flex;
  width: max-content;
  white-space: nowrap;
  animation: marquee 22s linear infinite;
}

.marquee-track span {
  display: block;
  padding-right: 24px;
}

.toast {
  position: absolute;
  z-index: 60;
  left: 50%;
  top: 50%;
  padding: 19px 27px 15px;
  border: 5px solid var(--ink);
  border-radius: 4px 10px 3px 7px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: 10px 10px 0 rgb(247 244 236 / 80%), 14px 14px 0 var(--ink);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 27px;
  letter-spacing: 1px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -35%) rotate(-3deg) scale(0.75);
  transition: opacity 140ms ease, transform 240ms cubic-bezier(0.2, 1.8, 0.4, 1);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(1.5deg) scale(1);
}

.cursor-star {
  position: absolute;
  z-index: 80;
  left: 0;
  top: 0;
  font-family: Arial, sans-serif;
  font-size: 25px;
  line-height: 1;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease;
}

.stage:hover .cursor-star {
  opacity: 1;
}

.spark {
  position: absolute;
  z-index: 75;
  color: var(--ink);
  font-family: Arial, sans-serif;
  font-size: 20px;
  pointer-events: none;
  animation: sparkOut 650ms ease-out forwards;
}

noscript {
  position: fixed;
  z-index: 999;
  left: 50%;
  bottom: 16px;
  padding: 10px 15px;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  transform: translateX(-50%);
}

@keyframes arrival {
  0% { transform: translateX(-1450px) rotate(-4deg); }
  68% { transform: translateX(38px) rotate(1deg); }
  82% { transform: translateX(-18px) rotate(-1deg); }
  100% { transform: translateX(0) rotate(0); }
}

@keyframes engineRumble {
  0%, 100% { transform: translate(0, 0) rotate(-0.15deg); }
  50% { transform: translate(2px, -3px) rotate(0.2deg); }
}

@keyframes excitedRumble {
  0%, 100% { transform: translate(0, -2px) rotate(-0.6deg); }
  50% { transform: translate(3px, -8px) rotate(0.6deg); }
}

@keyframes whistleJump {
  0% { transform: translateY(0) rotate(0); }
  32% { transform: translateY(-45px) rotate(-2deg); }
  58% { transform: translateY(7px) rotate(1.2deg); }
  78% { transform: translateY(-10px) rotate(-0.6deg); }
  100% { transform: translateY(0) rotate(0); }
}

@keyframes titleJitter {
  0%, 91%, 100% { transform: translate(0, 0); }
  92% { transform: translate(2px, -3px) rotate(0.3deg); }
  94% { transform: translate(-2px, 2px) rotate(-0.2deg); }
  96% { transform: translate(1px, -1px); }
}

@keyframes paperShift {
  0% { transform: translate(0, 0); }
  50% { transform: translate(1px, -1px); }
  100% { transform: translate(-1px, 1px); }
}

@keyframes speedLine {
  0%, 100% { transform: translateX(0) scaleX(0.7); opacity: 0.1; }
  45% { transform: translateX(-90px) scaleX(1.25); opacity: 0.78; }
  70% { transform: translateX(-135px) scaleX(0.35); opacity: 0; }
}

@keyframes moonRing {
  0% { transform: scale(0.42) rotate(0); opacity: 0; }
  15% { opacity: 0.28; }
  70%, 100% { transform: scale(1.1) rotate(20deg); opacity: 0; }
}

@keyframes stampWobble {
  0%, 100% { transform: rotate(11deg) scale(1); }
  50% { transform: rotate(7deg) scale(1.035); }
}

@keyframes marquee {
  to { transform: translateX(-50%); }
}

@keyframes hintBlink {
  0%, 100% { opacity: 0.42; transform: rotate(-4deg) translateY(0); }
  50% { opacity: 1; transform: rotate(-4deg) translateY(-6px); }
}

@keyframes sparkOut {
  0% { opacity: 0.85; transform: translate(-50%, -50%) scale(0.4) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -90px) scale(1.25) rotate(160deg); }
}

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

  .cursor-star {
    display: none;
  }
}

@media (max-aspect-ratio: 4 / 3) {
  .viewport::after {
    content: "BEST VIEWED SIDEWAYS →";
    position: fixed;
    right: 8px;
    bottom: 8px;
    z-index: 100;
    padding: 5px 8px;
    color: #fff;
    background: #000;
    font: 700 10px/1 Arial, sans-serif;
    letter-spacing: 0.5px;
  }
}
