:root {
  --ink: #f4f1ea;
  --shade: rgba(10, 12, 16, 0.55);
  --edge: rgba(255, 255, 255, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0c0d10;
  color: var(--ink);
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

#status {
  position: fixed;
  inset: 0;
  z-index: 11;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 17px;
}
body.ready #status { display: none; }
body.ready.notice #status {
  display: grid;
  padding: 16px;
  text-align: center;
  background: rgba(10, 12, 16, 0.7);
}
#status:empty { display: none; }

body[data-intro="hold"] #status { visibility: hidden; }
body[data-intro="wait"] #status,
body[data-intro="failed"] #status {
  place-items: end center;
  padding: 16px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  text-align: center;
}
body[data-intro="wait"] #status { color: rgb(128, 128, 128); font-size: 14px; }
body[data-intro="failed"] #status { display: grid; color: var(--ink); }
body[data-intro="failed"] #status:empty { display: none; }
body[data-intro="wait"].notice #status,
body[data-intro="failed"].notice #status {
  background: none;
  padding: 16px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

#intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 10vmin, 96px);
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(56px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: #000;
  color: rgb(128, 128, 128);
  font-family: Tahoma, Verdana, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  touch-action: none;
  overscroll-behavior: none;
  cursor: default;
}
#intro[hidden] { display: none; }
#intro .scan { visibility: hidden; white-space: pre; }
#intro.run .scan { visibility: visible; }
#intro.run .letters span { animation: scan 250ms linear var(--d) backwards; }
#intro.run.still .letters span { animation: none; }
#intro .intro-credits { visibility: hidden; }
#intro.run .intro-credits { visibility: visible; animation: flicker 1500ms linear 600ms backwards; }
#intro.run.still .intro-credits { animation: none; }
@media (prefers-reduced-motion: reduce) {
  #intro.run .letters span, #intro.run .intro-credits { animation: none; }
}
@keyframes flicker {
  0% { opacity: 0; }
  12% { opacity: 0.35; }
  16% { opacity: 0.1; }
  30% { opacity: 0.55; }
  34% { opacity: 0.25; }
  52% { opacity: 0.75; }
  56% { opacity: 0.5; }
  76% { opacity: 0.95; }
  80% { opacity: 0.7; }
  100% { opacity: 1; }
}
@keyframes scan {
  0% { opacity: 0; color: rgb(240, 110, 0); }
  1% { opacity: 1; color: rgb(240, 110, 0); }
  100% { opacity: 1; }
}
.intro-title {
  margin: 0;
  color: rgb(100, 100, 100);
  font-size: clamp(24px, 6.5vmin, 46px);
  letter-spacing: 0.03em;
}
.intro-servers {
  margin: 0;
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 2.2em;
  row-gap: 0.45em;
  font-size: clamp(14px, 2.6vmin, 19px);
}
.intro-servers div { display: contents; }
.intro-servers dt, .intro-servers dd { margin: 0; }
.intro-credits {
  text-align: center;
  font-size: clamp(12px, 2vmin, 15px);
  line-height: 1.5;
}
.intro-credits p { margin: 0; }
.intro-note { margin: 0; color: var(--ink); }
@media (max-width: 420px) {
  .intro-servers { grid-template-columns: auto; row-gap: 0.2em; text-align: center; }
  .intro-servers dd { margin-bottom: 0.7em; }
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body.intro #title, body.intro #hint, body.intro #touch-hint, body.intro #buttons { display: none; }

#title {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--shade);
  pointer-events: none;
}
#title span { display: block; font-size: 12px; opacity: 0.8; }

#hint {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--shade);
  pointer-events: none;
  text-align: center;
  max-width: calc(100% - 32px);
}
body.locked #hint, body:not(.ready) #hint { display: none; }

#touch-hint {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  right: 112px;
  bottom: max(24px, env(safe-area-inset-bottom));
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--shade);
  pointer-events: none;
}
body.touched #touch-hint, body:not(.ready) #touch-hint { display: none; }

#buttons {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  top: max(12px, env(safe-area-inset-top));
  display: flex;
  gap: 8px;
  pointer-events: none;
}
#buttons button { pointer-events: auto; }
body.touch #buttons {
  top: auto;
  bottom: max(24px, env(safe-area-inset-bottom));
  flex-direction: column-reverse;
  align-items: flex-end;
}

button {
  font: inherit;
  color: var(--ink);
  background: var(--shade);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 8px 16px;
  min-width: 44px;
  min-height: 44px;
  touch-action: none;
  cursor: pointer;
}
button:active { background: rgba(255, 255, 255, 0.2); }
body.touch button { min-width: 64px; min-height: 64px; font-size: 16px; }

body:not(.touch) .touch-only, body.touch .desktop-only { display: none; }
body[data-mode="walk"] .fly-only, body[data-mode="fly"] .walk-only { display: none; }
body:not(.ready) #buttons, body:not(.ready) #title { display: none; }

#stick {
  position: fixed;
  left: -56px;
  top: -56px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 2px solid var(--edge);
  background: rgba(10, 12, 16, 0.25);
  pointer-events: none;
}
#knob {
  position: absolute;
  left: 32px;
  top: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(244, 241, 234, 0.55);
}
