:root {
  --void: #050805;
  --moss: #0b2010;
  --green: #2e9c28;
  --signal: #53d449;
  --bone: #e0fadb;
  --mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --edge: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--bone);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  /* canvas renders at half res — keep the dither dots crisp and chunky */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: grab;
  touch-action: none; /* let the canvas own drag gestures on touch */
}
body.is-dragging #gl { cursor: grabbing; }

.ui {
  position: fixed;
  z-index: 2;
}

.tabular-nums { font-variant-numeric: tabular-nums; }

/* ---------------- header ---------------- */

.header {
  top: var(--edge);
  left: var(--edge);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

.btn-link {
  pointer-events: auto;
  appearance: none;
  background: none;
  border: 0;
  padding: 0 0 2px;
  color: var(--bone);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid currentColor;
  cursor: pointer;
  opacity: 0.85;
  transition: color 0.2s ease, opacity 0.2s ease;
}
.btn-link:hover { color: var(--signal); opacity: 1; }

.wordmark {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(38px, 5.4vw, 76px);
  line-height: 0.92;
  letter-spacing: -0.025em;
  display: flex;
  gap: 0.22em;
  text-transform: uppercase;
}
.wordmark__mark { color: var(--signal); }
.wordmark__dyn {
  color: var(--bone);
  min-width: 5.6em;
}

.tagline {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(224, 250, 219, 0.42);
}

/* ---------------- bottom bar ---------------- */

.bottom-bar {
  bottom: var(--edge);
  left: var(--edge);
  right: var(--edge);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.timer {
  font-size: clamp(22px, 2.6vw, 34px);
  letter-spacing: 0.02em;
  color: var(--bone);
  text-shadow: 0 0 14px rgba(83, 212, 73, 0.35);
}

.speed-control {
  pointer-events: auto;
  appearance: none;
  background: none;
  border: 0;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--bone);
  font-family: var(--mono);
  font-size: clamp(12px, 1.2vw, 15px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}
.speed-control:hover,
.speed-control:active { color: var(--signal); }
.speed-control__hint { opacity: 0.7; }
.speed-control__divider {
  width: 1px;
  height: 14px;
  background: currentColor;
  opacity: 0.4;
}
.speed-control__value { font-size: 1.05em; }
.speed-control__x { opacity: 0.55; margin-left: -8px; }

.mobile-only { display: none; }

/* ---------------- sidebar ---------------- */

.sidebar {
  top: 0;
  right: 0;
  height: 100%;
  width: min(520px, 100vw);
  background: rgba(4, 8, 4, 0.86);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-left: 1px solid rgba(83, 212, 73, 0.22);
  transform: translateX(101%);
  transition: transform 0.5s cubic-bezier(0.65, 0, 0.2, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sidebar.is-open { transform: translateX(0); }

.sidebar__inner {
  padding: var(--edge);
  padding-bottom: 64px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar__close {
  align-self: flex-end;
  appearance: none;
  background: none;
  border: 1px solid rgba(224, 250, 219, 0.25);
  border-radius: 999px;
  padding: 6px 14px;
  color: var(--bone);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.sidebar__close:hover { border-color: var(--signal); color: var(--signal); }

.sidebar__heading {
  margin: 14px 0 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--bone);
}
.sidebar__heading::before {
  content: '';
  display: block;
  width: 26px;
  height: 2px;
  margin-bottom: 12px;
  background: var(--signal);
}

.sidebar p {
  margin: 0;
  font-size: 13px;
  line-height: 1.72;
  color: rgba(224, 250, 219, 0.72);
}

.sidebar__meta {
  font-size: 10px !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(83, 212, 73, 0.8) !important;
}

.sidebar__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar__list li {
  display: flex;
  gap: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(224, 250, 219, 0.72);
}
.sidebar__list span {
  color: var(--signal);
  font-size: 10px;
  padding-top: 4px;
}

.sidebar__links {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(224, 250, 219, 0.12);
}
.link-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(224, 250, 219, 0.12);
}
.link-row__label {
  width: 46px;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(224, 250, 219, 0.4);
}
.link-row__anchor {
  color: var(--bone);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s ease;
}
.link-row__anchor:hover { color: var(--signal); }

.sidebar__foot {
  margin-top: 8px;
  font-size: 10px !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(224, 250, 219, 0.32) !important;
}

/* ---------------- enter overlay ---------------- */

.enter-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  appearance: none;
  border: 0;
  background: rgba(3, 6, 3, 0.72);
  color: var(--bone);
  font-family: var(--mono);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
.enter-overlay__text {
  font-size: clamp(12px, 1.4vw, 16px);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  animation: pulse 2.1s ease-in-out infinite;
}
.enter-overlay__sub {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(224, 250, 219, 0.4);
}
.enter-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------------- no-js / no-webgl ---------------- */

.fallback-note {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
}
.fallback-note a { color: var(--signal); }

/* ---------------- responsive ---------------- */

@media (max-width: 700px) {
  :root { --edge: 18px; }
  .desktop-only { display: none; }
  .mobile-only { display: inline; }
  .wordmark { flex-direction: column; gap: 0; }
  .bottom-bar { align-items: flex-end; }
  .sidebar { width: 100vw; border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .enter-overlay__text { animation: none; }
  .sidebar { transition: none; }
}
