:root {
  --void: #07040a;
  --wine: #1a0806;
  --rust: #b44820;
  --spot: #8b2419;
  --cream: #e8c99a;
  --ivory: #f6e6c8;
  --amber: #f0a84b;
  --foil: #c9bba8;
  --mute: #a78d70;
  --hud: rgba(7, 4, 10, 0.55);
  --probe-y: 68%;
  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: clip;
}

html,
body {
  background: var(--void);
  color: var(--ivory);
  font-family: var(--font-mono);
  min-height: 100%;
}

body {
  cursor: ns-resize;
  touch-action: pan-y;
}

.plaque.finale {
  width: min(520px, calc(100vw - 40px));
  padding: 22px 22px 18px;
  border-color: var(--amber);
}

.plaque.finale h2 {
  font-size: clamp(40px, 7vw, 64px);
  color: var(--amber);
}

img {
  max-width: 100%;
  display: block;
}

#world-bg {
  position: relative;
  z-index: 0;
  width: 100%;
  background: transparent;
}

#world-fg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  z-index: 3;
  pointer-events: none;
}

#tint,
#heat {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

#heat {
  mix-blend-mode: screen;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(180, 72, 32, 0.55) 100%);
}

#sky {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: var(--void);
}

.stratum {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  will-change: opacity;
}

.stratum-paint {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
}

.stratum-paint.drift {
  animation: drift 48s linear infinite;
}

.stratum-paint.drift-slow {
  animation: drift 90s linear infinite;
}

@keyframes drift {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 100% 50%;
  }
}

.stars {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 55%, transparent 100%);
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #f6e6c8;
  border-radius: 50%;
  opacity: 0.7;
}

.plaque {
  position: absolute;
  z-index: 8;
  width: min(400px, calc(100vw - 40px));
  padding: 16px 18px 14px;
  border: 1px solid rgba(240, 168, 75, 0.5);
  background: linear-gradient(180deg, rgba(18, 8, 6, 0.94), rgba(7, 4, 10, 0.96));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 28px 50px rgba(0, 0, 0, 0.4);
}

.plaque.left {
  left: max(24px, 6vw);
}

.plaque.right {
  right: max(24px, 6vw);
}

.plaque .kicker {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
}

.plaque h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.92;
  margin: 6px 0 10px;
  color: var(--ivory);
}

.plaque p {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--cream);
  font-weight: 400;
}

.plaque .thumb {
  width: 100%;
  height: 132px;
  object-fit: cover;
  margin: 0 0 12px;
  filter: saturate(1.05) contrast(1.05);
}

.sprite {
  position: absolute;
  z-index: 7;
  width: min(170px, 24vw);
  pointer-events: none;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.55));
}

.sprite.left {
  left: 8vw;
}

.sprite.right {
  right: 8vw;
}

.sprite.finale {
  display: none;
}

#probe-wrap {
  position: fixed;
  left: 50%;
  top: var(--probe-y);
  transform: translate(-50%, -50%);
  z-index: 30;
  width: min(138px, 26vw);
  pointer-events: none;
}

#probe-glow {
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle, rgba(240, 168, 75, 0.35), transparent 62%);
  opacity: 0.15;
  filter: blur(8px);
}

#probe {
  width: 100%;
  transform: rotate(90deg);
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.5));
}

#probe-wrap.ghost #probe {
  opacity: 0.55;
  filter: grayscale(0.35) drop-shadow(0 0 12px rgba(240, 168, 75, 0.45));
}

#probe-wrap.ghost #probe-glow {
  opacity: 0.55;
}

#title {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: 11vh 24px 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 18%, rgba(7, 4, 10, 0.28), rgba(7, 4, 10, 0.04) 46%, transparent 70%);
}

#title .kicker {
  letter-spacing: 0.34em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--amber);
  margin-bottom: 14px;
}

#title h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(52px, 12vw, 120px);
  line-height: 0.82;
  letter-spacing: -0.03em;
  color: var(--ivory);
  max-width: 12ch;
  text-shadow: 0 10px 32px rgba(7, 4, 10, 0.72);
}

#title h1 em {
  font-style: normal;
  color: var(--amber);
}

#title .lede {
  margin-top: 18px;
  font-size: 14px;
  color: var(--cream);
  letter-spacing: 0.04em;
}

#title .hint {
  margin-top: 18px;
  font-size: 28px;
  color: var(--amber);
  animation: bob 1.8s ease-in-out infinite;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  50% {
    transform: translateY(10px);
    opacity: 1;
  }
}

#hud {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
}

.hud-top,
.gauges,
.brand {
  display: flex;
  align-items: center;
}

.hud-top {
  justify-content: space-between;
  gap: 12px;
}

.brand {
  gap: 14px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--foil);
}

.status {
  letter-spacing: 0.14em;
}

.status.ok {
  color: #d4c48a;
}

.status.warn {
  color: var(--amber);
}

.status.dead {
  color: #ff6a3d;
}

#radio {
  pointer-events: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
  background: var(--hud);
  border: 1px solid rgba(240, 168, 75, 0.55);
  padding: 8px 12px;
  cursor: pointer;
}

#radio:hover,
#radio:focus-visible {
  background: rgba(240, 168, 75, 0.14);
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.hud-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.readout .label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 2px;
}

.readout .value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  color: var(--ivory);
  letter-spacing: -0.02em;
}

.readout.depth .value {
  font-size: clamp(56px, 11vw, 108px);
  font-weight: 800;
  color: var(--amber);
  line-height: 0.8;
}

.readout.depth .unit {
  font-family: var(--font-display);
  font-size: 22px;
  margin-left: 6px;
  color: var(--cream);
}

.gauges {
  gap: 22px;
  padding: 10px 12px;
  background: var(--hud);
  border: 1px solid rgba(232, 201, 154, 0.18);
}

.tiny {
  font-size: 0.65em;
}

#ruler {
  position: fixed;
  top: 64px;
  right: 10px;
  bottom: 120px;
  width: 18px;
  z-index: 35;
  pointer-events: none;
  border-right: 1px solid rgba(240, 168, 75, 0.35);
}

.tick {
  position: absolute;
  right: 0;
  width: 8px;
  height: 1px;
  background: rgba(240, 168, 75, 0.55);
}

.tick.major {
  width: 14px;
  background: var(--amber);
}

.tick-label {
  position: absolute;
  right: 18px;
  transform: translateY(-50%);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--mute);
  white-space: nowrap;
}

.needle {
  position: absolute;
  right: -5px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 8px solid var(--amber);
  filter: drop-shadow(0 0 6px var(--amber));
}

#static {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.08) 0px,
    transparent 1px,
    transparent 3px
  );
}

#crash-banner {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 55;
  text-align: center;
  padding: 22px 26px;
  border: 1px solid #ff6a3d;
  background: rgba(12, 2, 2, 0.88);
  max-width: 440px;
  width: calc(100% - 40px);
}

#crash-banner .kicker {
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #ff6a3d;
  font-size: 11px;
  margin-bottom: 8px;
}

#crash-banner p {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 0.95;
}

#crash-banner .sub {
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 10px;
  color: var(--cream);
}

.stratum-fallback {
  position: absolute;
  left: 0;
  width: 100%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 100%);
}

@media (max-width: 720px) {
  .plaque.left,
  .plaque.right {
    left: 16px;
    right: 16px;
    width: auto;
  }

  .sprite {
    opacity: 0.55;
    width: 22vw;
  }

  .hud-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .gauges {
    gap: 12px;
    width: 100%;
    justify-content: space-between;
  }

  .readout .value {
    font-size: 16px;
  }

  .readout.depth .value {
    font-size: 52px;
  }

  #ruler {
    display: none;
  }

  #probe-wrap {
    width: min(108px, 30vw);
    top: 46%;
  }

  #title {
    padding-top: 9vh;
  }

  #title h1 {
    font-size: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stratum-paint.drift,
  .stratum-paint.drift-slow,
  #title .hint {
    animation: none;
  }
}
