@font-face {
  font-family: "Silkscreen";
  src: url("/fonts/silkscreen-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --sky-top: #1f2a5a;
  --sky-mid: #8c5b8c;
  --sky-low: #ffa060;
  --ink: #fff3ea;
  --ink-soft: rgb(255 243 234 / .72);
  --data: #5ff2ff;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }

body {
  overflow: hidden;
  /* The same sunset the world renders, so loading has no flash. */
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-low) 100%);
  color: var(--ink);
  font-family: "Silkscreen", ui-monospace, monospace;
  -webkit-font-smoothing: none;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  opacity: 0;
  transition: opacity 1.2s ease;
}
canvas:active { cursor: grabbing; }
.ready canvas { opacity: 1; }

/* Shown only when there is no WebGL. */
.fallback {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  font-weight: 400;
  font-size: clamp(32px, 9vw, 120px);
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 4px 0 rgb(0 0 0 / .18);
}
.no-gl .fallback { display: grid; }
.no-gl canvas, .no-gl .hint, .no-gl .build { display: none; }

.hud {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 0 max(20px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  pointer-events: none;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgb(40 20 50 / .35);
}

.who {
  font-size: clamp(13px, 1.3vw, 17px);
  letter-spacing: .2em;
}

.build {
  display: grid;
  justify-items: end;
  gap: 7px;
  font-size: clamp(10px, .9vw, 12px);
  letter-spacing: .16em;
  color: var(--ink-soft);
}
.track {
  width: clamp(96px, 12vw, 160px);
  height: 8px;
  padding: 2px;
  background: rgb(20 16 40 / .45);
  box-shadow: inset 0 0 0 1px rgb(255 243 234 / .35);
}
.track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--data);
  box-shadow: 0 0 8px var(--data);
  transition: width .4s steps(4);
}

.hint {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  translate: -50% 0;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  pointer-events: none;
  opacity: 0;
  transition: opacity .8s ease;
}
.ready .hint { opacity: 1; animation: hint 1s ease 7s forwards; }
.touched .hint { opacity: 0; animation: none; }
@keyframes hint { to { opacity: 0; } }

@media (max-width: 520px) {
  .hud { flex-direction: column; align-items: start; gap: 10px; }
  .build { justify-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  canvas, .track i { transition: none; }
}
