:root {
  --ink: #08092a;
  --sea: #0a49ff;
  --orchard: #ff6687;
  --salt: #e6e1ff;
  --lime: #d5ff4b;
  --orange: #ff4f2e;
  font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #0a0924;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  min-height: 100svh;
  background: #0a0924;
}

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

.experience {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

#world {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: ns-resize;
  touch-action: none;
  outline: 0;
}

#world:focus-visible {
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.92);
}

.masthead {
  position: absolute;
  z-index: 4;
  top: max(18px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  right: max(20px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.identity {
  max-width: min(54vw, 520px);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: clamp(0.62rem, 1.15vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.1;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 12ch;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.8rem, 3.4vw, 3.8rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 0.86;
  text-transform: uppercase;
}

body.is-folding .masthead {
  color: #fff;
  mix-blend-mode: normal;
  text-shadow: 0 1px 8px rgba(8, 9, 42, 0.45);
}

body.is-folding .identity h1 {
  max-width: none;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 0.9;
}

body.is-folding .identity .eyebrow {
  display: none;
}

.discoveries {
  display: flex;
  gap: 7px;
  padding-top: 2px;
}

.discovery {
  display: block;
  width: clamp(12px, 1.35vw, 18px);
  aspect-ratio: 1;
  border: 2px solid currentColor;
  border-radius: 50%;
  transition: background-color 260ms ease, transform 260ms ease;
}

.discovery.is-found {
  background: currentColor;
  transform: rotate(45deg);
  border-radius: 2px 50% 50%;
}

.horizon-label {
  position: absolute;
  z-index: 3;
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: rgba(8, 9, 42, 0.82);
  font-size: clamp(0.58rem, 0.9vw, 0.72rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.horizon-label span:nth-child(2) {
  opacity: 0.68;
}

.horizon-label--one {
  top: calc(33.333% - 18px);
}

.horizon-label--two {
  top: calc(66.666% - 18px);
}

body.is-folding .horizon-label {
  opacity: 0;
}

.exchange {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: max(70px, calc(env(safe-area-inset-bottom) + 58px));
  width: min(92vw, 780px);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.45));
}

.exchange p {
  margin: 0;
}

.exchange__pair {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.35rem, 3.8vw, 3.4rem);
  letter-spacing: -0.025em;
  line-height: 0.92;
  text-transform: uppercase;
}

.exchange__rule {
  margin-top: 6px !important;
  font-size: clamp(0.72rem, 1.5vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

body.is-folding .exchange {
  right: max(22px, env(safe-area-inset-right));
  left: auto;
  bottom: max(64px, calc(env(safe-area-inset-bottom) + 54px));
  width: min(42vw, 510px);
  transform: none;
  text-align: right;
}

body.is-folding .exchange__pair {
  font-size: clamp(1.15rem, 2.5vw, 2.1rem);
}

body.is-folding .exchange__rule {
  font-size: clamp(0.62rem, 1vw, 0.76rem);
}

.controls {
  position: absolute;
  z-index: 6;
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  bottom: max(13px, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  color: rgba(8, 9, 42, 0.86);
}

.controls p {
  margin: 0;
  max-width: 660px;
  font-size: clamp(0.62rem, 1vw, 0.75rem);
  font-weight: 800;
  letter-spacing: 0.045em;
  line-height: 1.35;
  text-transform: uppercase;
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.08em 0.25em;
  border: 1px solid currentColor;
  border-radius: 2px;
  font: inherit;
  text-align: center;
}

#reset {
  min-width: 72px;
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid currentColor;
  border-radius: 999px;
  color: inherit;
  background: rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(8px);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

#reset:hover,
#reset:focus-visible {
  color: #fff;
  background: var(--ink);
  outline: 0;
}

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

@media (max-width: 700px) {
  .masthead {
    gap: 14px;
  }

  .identity {
    max-width: 76vw;
  }

  h1 {
    max-width: none;
    font-size: clamp(1.55rem, 7.8vw, 2.3rem);
    line-height: 0.9;
  }

  .eyebrow {
    max-width: 31ch;
  }

  .exchange {
    bottom: max(86px, calc(env(safe-area-inset-bottom) + 74px));
  }

  .exchange__rule {
    max-width: 32ch;
    margin-inline: auto;
  }

  body.is-folding .exchange {
    right: 20px;
    left: 20px;
    bottom: max(78px, calc(env(safe-area-inset-bottom) + 68px));
    width: auto;
    text-align: left;
  }

  body.is-folding .exchange__pair {
    font-size: 1.15rem;
  }

  body.is-folding .exchange__rule {
    max-width: 28ch;
    margin-inline: 0;
    font-size: 0.64rem;
  }

  .controls {
    align-items: center;
  }

  .controls p {
    width: auto;
    max-width: none;
    font-size: 0;
  }

  .controls p::before {
    display: block;
    content: "Drag · Keys 1–3 · Esc";
    font-size: 0.6rem;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .discovery {
    transition: none;
  }
}

@media (forced-colors: active) {
  #reset {
    background: Canvas;
  }
}
