:root {
  --ink: #11100f;
  --paper: #f4f0e5;
  --paper-solid: #fbf8ef;
  --line: 3px solid var(--ink);
  --mx: 0px;
  --my: 0px;
}

* {
  box-sizing: border-box;
}

html {
  background: #171614;
  color: var(--ink);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    repeating-linear-gradient(92deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 5px),
    #171614;
  font-family: "Trebuchet MS", Arial, sans-serif;
}

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

a {
  color: inherit;
}

.stage {
  position: relative;
  isolation: isolate;
  width: min(100vw, calc(100vh * 16 / 9), 1920px);
  aspect-ratio: 16 / 9;
  max-height: 1080px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 0 0 1px #000, 0 26px 90px rgba(0, 0, 0, 0.5);
}

.moon-background {
  position: absolute;
  z-index: -3;
  inset: -1.5%;
  background: url("assets/moon-doodle-bg.jpg") center / cover no-repeat;
  transform: translate(calc(var(--mx) * -0.12), calc(var(--my) * -0.12)) scale(1.03);
  animation: background-breathe 13s ease-in-out infinite alternate;
  will-change: transform;
}

.paper-grain {
  position: absolute;
  z-index: 10;
  inset: 0;
  pointer-events: none;
  opacity: 0.17;
  mix-blend-mode: multiply;
  background-image:
    repeating-radial-gradient(circle at 25% 30%, rgba(17, 16, 15, 0.13) 0 0.5px, transparent 0.7px 4px),
    repeating-linear-gradient(88deg, transparent 0 9px, rgba(17, 16, 15, 0.035) 10px 11px);
}

.site-header {
  position: absolute;
  z-index: 6;
  top: 3.8%;
  left: 4.4%;
  right: 4.4%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(1rem, 1.7vw, 2rem);
  letter-spacing: 0.06em;
  transform: rotate(-1deg);
}

.brand img {
  width: clamp(36px, 3vw, 56px);
  height: clamp(36px, 3vw, 56px);
  object-fit: contain;
  filter: drop-shadow(2px 2px 0 var(--paper-solid));
}

.social-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 1.4vw, 1.8rem);
}

.scribble-link {
  position: relative;
  color: var(--ink);
  text-decoration: none;
  font-family: "Comic Sans MS", "Trebuchet MS", sans-serif;
  font-size: clamp(0.72rem, 0.92vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.06em;
}

.scribble-link::after {
  content: "";
  position: absolute;
  left: -2%;
  right: 3%;
  bottom: -7px;
  height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='8' viewBox='0 0 160 8'%3E%3Cpath d='M1 5 C26 1 50 7 79 4 S130 2 159 5' fill='none' stroke='%2311100f' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.scribble-link:hover::after,
.scribble-link:focus-visible::after {
  transform: scaleX(1);
}

.hero {
  position: absolute;
  inset: 0;
}

.hero-copy {
  position: absolute;
  z-index: 4;
  top: 25.8%;
  left: 5.1%;
  width: 47%;
}

.eyebrow {
  width: max-content;
  max-width: 100%;
  margin: 0 0 0.4rem;
  padding: 0.35em 0.7em;
  border: 2px solid var(--ink);
  background: rgba(251, 248, 239, 0.88);
  font-family: "Courier New", monospace;
  font-size: clamp(0.56rem, 0.76vw, 0.9rem);
  font-weight: 900;
  transform: rotate(-1.2deg);
}

.eyebrow span {
  text-decoration: line-through 2px;
}

h1 {
  position: relative;
  width: max-content;
  max-width: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(3.4rem, 8vw, 9.65rem);
  font-weight: 900;
  line-height: 0.89;
  letter-spacing: -0.035em;
  transform: rotate(-1deg);
  text-shadow: 3px 3px 0 var(--paper-solid), 5px 5px 0 var(--ink);
  animation: title-jitter 5s steps(1, end) infinite;
}

h1::after {
  content: attr(data-text);
  position: absolute;
  z-index: -1;
  inset: 0;
  color: transparent;
  -webkit-text-stroke: 1px var(--ink);
  transform: translate(8px, -5px) rotate(0.6deg);
  opacity: 0.55;
}

.tagline {
  margin: 0.85rem 0 1.2rem;
  font-family: "Comic Sans MS", "Trebuchet MS", sans-serif;
  font-size: clamp(0.76rem, 1.2vw, 1.4rem);
  font-weight: 900;
  letter-spacing: 0.14em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(0.55rem, 1vw, 1rem);
}

.copy-button,
.round-link {
  min-height: clamp(44px, 3.2vw, 62px);
  border: var(--line);
  color: var(--ink);
  background: var(--paper-solid);
  box-shadow: 5px 6px 0 var(--ink);
  font-family: "Comic Sans MS", "Trebuchet MS", sans-serif;
  font-size: clamp(0.75rem, 1.05vw, 1.12rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease, color 120ms ease, background 120ms ease;
}

.copy-button {
  position: relative;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 0.35rem;
  padding: 0.55rem 1.05rem 0.4rem;
  cursor: copy;
  transform: rotate(-1deg);
}

.copy-label {
  font-family: Impact, "Arial Black", sans-serif;
  letter-spacing: 0.08em;
}

.copy-hint {
  grid-column: 1 / -1;
  font-family: "Courier New", monospace;
  font-size: 0.53em;
  letter-spacing: 0.13em;
  opacity: 0.66;
}

.round-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.1rem;
  border-radius: 48% 52% 44% 56% / 56% 45% 55% 44%;
  transform: rotate(1.2deg);
}

.copy-button:hover,
.copy-button:focus-visible,
.round-link:hover,
.round-link:focus-visible {
  color: var(--paper-solid);
  background: var(--ink);
  box-shadow: 2px 3px 0 var(--ink);
  transform: translate(3px, 3px) rotate(0deg);
  outline: none;
}

.lore-card {
  position: relative;
  width: min(100%, 680px);
  margin-top: clamp(1.1rem, 2vw, 2.3rem);
  padding: clamp(0.85rem, 1.3vw, 1.4rem) clamp(1rem, 1.6vw, 1.7rem);
  border: var(--line);
  background: rgba(251, 248, 239, 0.9);
  box-shadow: 8px 9px 0 rgba(17, 16, 15, 0.95);
  transform: rotate(-0.65deg);
}

.lore-card::after {
  content: "?";
  position: absolute;
  top: -25px;
  right: 18px;
  font-family: "Comic Sans MS", sans-serif;
  font-size: clamp(2rem, 3.2vw, 4rem);
  font-weight: 900;
  transform: rotate(17deg);
}

.tape {
  position: absolute;
  top: -14px;
  left: 37%;
  width: 25%;
  height: 26px;
  border-left: 1px solid rgba(17, 16, 15, 0.35);
  border-right: 1px solid rgba(17, 16, 15, 0.35);
  background: rgba(244, 240, 229, 0.73);
  transform: rotate(2deg);
}

.lore-card h2 {
  margin: 0 0 0.45rem;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(0.9rem, 1.3vw, 1.45rem);
  letter-spacing: 0.06em;
}

.lore-card p {
  margin: 0;
  font-size: clamp(0.64rem, 0.88vw, 1rem);
  font-weight: 700;
  line-height: 1.38;
}

.lore-card .lore-note {
  margin-top: 0.55rem;
  font-family: "Comic Sans MS", "Trebuchet MS", sans-serif;
  font-weight: 900;
  text-decoration: underline 2px wavy;
}

.character-zone {
  position: absolute;
  z-index: 3;
  top: 15.5%;
  right: 1.6%;
  width: 48%;
  height: 76%;
  transform: translate(calc(var(--mx) * 0.23), calc(var(--my) * 0.23));
  will-change: transform;
}

.character {
  position: absolute;
  z-index: 2;
  inset: 1% 1% 0 3%;
  width: 96%;
  height: 98%;
  padding: 0;
  border: 0;
  appearance: none;
  cursor: pointer;
  background: transparent;
  transform-origin: 46% 88%;
  animation: astronaut-float 4.8s ease-in-out infinite;
}

.character:focus-visible {
  outline: 4px dashed var(--ink);
  outline-offset: -12px;
  border-radius: 40%;
}

.character img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(7px 9px 0 rgba(17, 16, 15, 0.16));
  user-select: none;
  -webkit-user-drag: none;
}

.flag-name {
  position: absolute;
  top: 25.5%;
  left: 66.5%;
  width: 31%;
  color: var(--ink);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(0.72rem, 1.8vw, 2.25rem);
  letter-spacing: -0.015em;
  text-align: center;
  transform: rotate(4deg) skewX(-4deg);
  animation: flag-shiver 2.7s steps(2, end) infinite;
}

.helmet-glint {
  position: absolute;
  top: 22.4%;
  left: 26.8%;
  width: 6.5%;
  height: 18%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
  filter: blur(1px);
  transform: rotate(21deg) translateY(-90%);
  opacity: 0;
  animation: visor-scan 5.6s ease-in-out infinite;
  pointer-events: none;
}

.orbit-ring {
  position: absolute;
  z-index: 0;
  border: 3px dashed rgba(17, 16, 15, 0.62);
  border-radius: 50%;
  pointer-events: none;
}

.orbit-ring::after {
  content: "★";
  position: absolute;
  top: -0.7em;
  left: 42%;
  padding: 0 0.18em;
  background: var(--paper);
  font-size: clamp(0.8rem, 1.5vw, 1.8rem);
}

.orbit-ring-one {
  top: 13%;
  left: 4%;
  width: 72%;
  height: 65%;
  transform: rotate(-18deg);
  animation: ring-wobble 9s linear infinite;
}

.orbit-ring-two {
  top: 28%;
  left: 19%;
  width: 65%;
  height: 52%;
  border-style: dotted;
  transform: rotate(26deg);
  animation: ring-wobble-reverse 12s linear infinite;
}

.tap-note {
  position: absolute;
  z-index: 4;
  right: 3%;
  bottom: 20%;
  margin: 0;
  font-family: "Comic Sans MS", "Trebuchet MS", sans-serif;
  font-size: clamp(0.58rem, 0.92vw, 1rem);
  font-weight: 900;
  transform: rotate(-9deg);
  animation: note-bounce 1.7s ease-in-out infinite;
}

.character-status {
  position: absolute;
  z-index: 5;
  right: 2%;
  bottom: 5%;
  max-width: 48%;
  margin: 0;
  padding: 0.55em 0.8em;
  border: 2px solid var(--ink);
  background: var(--paper-solid);
  font-family: "Courier New", monospace;
  font-size: clamp(0.52rem, 0.72vw, 0.82rem);
  font-weight: 900;
  transform: rotate(1.8deg);
}

.character.bonk {
  animation: astronaut-bonk 650ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.mission-strip {
  position: absolute;
  z-index: 8;
  right: -4%;
  bottom: 1.8%;
  width: 61%;
  overflow: hidden;
  border-block: 2px solid var(--ink);
  background: rgba(251, 248, 239, 0.91);
  font-family: "Courier New", monospace;
  font-size: clamp(0.55rem, 0.75vw, 0.82rem);
  font-weight: 900;
  white-space: nowrap;
  transform: rotate(-1.2deg);
}

.mission-strip span {
  display: inline-block;
  padding: 0.45em 0;
  animation: ticker 19s linear infinite;
}

.copy-toast {
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: 7%;
  padding: 0.7em 1.1em;
  border: var(--line);
  color: var(--paper-solid);
  background: var(--ink);
  box-shadow: 6px 6px 0 var(--paper-solid), 9px 9px 0 var(--ink);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(0.85rem, 1.3vw, 1.45rem);
  letter-spacing: 0.06em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 30px) rotate(-2deg) scale(0.85);
  transition: opacity 180ms ease, transform 220ms ease;
}

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

.noscript {
  position: fixed;
  z-index: 100;
  inset: auto 1rem 1rem;
  margin: 0;
  padding: 1rem;
  border: 3px solid #111;
  color: #111;
  background: #fff;
  font-weight: 900;
  text-align: center;
}

@keyframes background-breathe {
  from { transform: translate(calc(var(--mx) * -0.12), calc(var(--my) * -0.12)) scale(1.03) rotate(-0.08deg); }
  to { transform: translate(calc(var(--mx) * -0.12), calc(var(--my) * -0.12)) scale(1.045) rotate(0.08deg); }
}

@keyframes title-jitter {
  0%, 92%, 100% { transform: rotate(-1deg) translate(0); }
  93% { transform: rotate(-0.5deg) translate(2px, -1px); }
  95% { transform: rotate(-1.4deg) translate(-2px, 1px); }
  97% { transform: rotate(-0.8deg) translate(1px, 1px); }
}

@keyframes astronaut-float {
  0%, 100% { transform: translateY(0) rotate(-0.7deg); }
  50% { transform: translateY(-14px) rotate(0.8deg); }
}

@keyframes astronaut-bonk {
  0% { transform: translateY(0) rotate(0) scale(1); }
  28% { transform: translateY(-32px) rotate(-6deg) scale(1.025, 0.975); }
  57% { transform: translateY(8px) rotate(4deg) scale(0.98, 1.04); }
  78% { transform: translateY(-5px) rotate(-2deg); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}

@keyframes flag-shiver {
  0%, 100% { transform: rotate(4deg) skewX(-4deg) translateX(0); }
  50% { transform: rotate(3.2deg) skewX(-2deg) translateX(2px); }
}

@keyframes visor-scan {
  0%, 61%, 100% { opacity: 0; transform: rotate(21deg) translateY(-90%); }
  68% { opacity: 0.72; }
  79% { opacity: 0.08; transform: rotate(21deg) translateY(120%); }
}

@keyframes ring-wobble {
  to { transform: rotate(342deg); }
}

@keyframes ring-wobble-reverse {
  to { transform: rotate(-334deg); }
}

@keyframes note-bounce {
  0%, 100% { transform: rotate(-9deg) translateX(0); }
  50% { transform: rotate(-5deg) translateX(-8px); }
}

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

@media (max-width: 900px), (max-aspect-ratio: 4 / 5) {
  body {
    display: block;
    overflow: auto;
    background: var(--paper);
  }

  .stage {
    width: 100%;
    max-width: none;
    min-height: 100svh;
    max-height: none;
    aspect-ratio: auto;
    overflow: hidden;
    box-shadow: none;
  }

  .moon-background {
    inset: 0;
    background-position: 48% top;
    background-size: auto 62%;
    background-repeat: repeat-y;
    opacity: 0.34;
  }

  .site-header {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    padding: 1rem 1rem 0;
  }

  .social-nav {
    gap: 0.8rem;
  }

  .hero {
    position: relative;
    display: flex;
    flex-direction: column;
    padding-bottom: 4.5rem;
  }

  .hero-copy {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    padding: 5.5rem 1.1rem 0;
  }

  h1 {
    font-size: clamp(3.15rem, 16vw, 6.7rem);
    text-shadow: 2px 2px 0 var(--paper-solid), 4px 4px 0 var(--ink);
  }

  .tagline {
    letter-spacing: 0.08em;
  }

  .lore-card {
    width: 95%;
  }

  .lore-card p {
    font-size: 0.9rem;
  }

  .character-zone {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    height: auto;
    min-height: 520px;
    margin-top: 0.3rem;
    transform: none;
  }

  .character {
    inset: 0 0 auto 0;
    width: 100%;
    height: auto;
    aspect-ratio: 1.08 / 1;
  }

  .character-status {
    right: 4%;
    bottom: 3%;
    max-width: 65%;
    font-size: 0.7rem;
  }

  .tap-note {
    right: 4%;
    bottom: 17%;
  }

  .orbit-ring-one {
    top: 8%;
  }

  .mission-strip {
    position: absolute;
    right: -8%;
    bottom: 1rem;
    width: 115%;
  }
}

@media (max-width: 520px) {
  .brand span {
    display: none;
  }

  .scribble-link {
    font-size: 0.66rem;
  }

  .hero-copy {
    padding-top: 4.3rem;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .copy-button,
  .round-link {
    width: 94%;
  }

  .copy-button {
    justify-content: center;
  }

  .character-zone {
    min-height: 430px;
  }
}

@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;
  }
}
