/*
 * UntetheredChaos — the world's chrome.
 *
 * The 3D canvas does the heavy lifting. Everything here is deliberately quiet
 * and flat so it reads as an overlay ON a world, not a webpage with a canvas
 * stuck in it. Neon is spent on the world; the HUD is near-monochrome.
 */

:root {
  --void:    #05060a;
  --ink:     #e8f0ee;
  --ink-2:   rgba(232, 240, 238, .62);
  --ink-3:   rgba(232, 240, 238, .30);
  --hair:    rgba(232, 240, 238, .14);

  --acid:    #7cff4f;   /* the signature green */
  --magenta: #ff3ea5;
  --cyan:    #35e8ff;

  --font: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--void);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}
body { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;   /* the world owns the gesture, not the browser */
}

/* ------------------------------------------------------------------ mark */

.mark {
  font-weight: 700;
  letter-spacing: .18em;
  font-size: 13px;
  color: var(--ink);
}
.mark span { color: var(--acid); }
.mark.big { font-size: clamp(22px, 6vw, 34px); letter-spacing: .16em; }

/* ------------------------------------------------------------------ boot */

#boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--void);
  transition: opacity .7s ease, visibility .7s;
}
#boot.gone { opacity: 0; visibility: hidden; pointer-events: none; }

.boot-mark {
  font-weight: 700;
  letter-spacing: .22em;
  font-size: clamp(18px, 5vw, 26px);
}
.boot-mark span { color: var(--acid); }

.boot-bar {
  width: min(240px, 60vw);
  height: 2px;
  background: var(--hair);
  overflow: hidden;
}
.boot-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--acid);
  box-shadow: 0 0 12px var(--acid);
  transition: width .35s ease;
}
.boot-hint {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ------------------------------------------------------------------- hud */

#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top));
  pointer-events: none;
}
#hud[hidden] { display: none; }
.hud-right { pointer-events: auto; }

.ghost {
  font: inherit;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: none;
  border: 1px solid var(--hair);
  border-radius: 4px;
  padding: 7px 11px;
  cursor: pointer;
  min-height: 34px;
}
.ghost:hover { color: var(--ink); border-color: var(--ink-3); }
.ghost:focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; }

/* ---------------------------------------------------------------- prompt */

#prompt {
  position: fixed;
  left: 50%;
  bottom: 12%;
  transform: translate(-50%, 10px);
  z-index: 30;
  text-align: center;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
#prompt[hidden] { display: none; }
#prompt.show { opacity: 1; transform: translate(-50%, 0); }

.prompt-name {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--acid);
  text-shadow: 0 0 18px rgba(124, 255, 79, .55);
}
.prompt-sub { margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }
.prompt-key { margin-top: 10px; font-size: 11px; letter-spacing: .12em; color: var(--ink-3); text-transform: uppercase; }

kbd {
  font: inherit;
  font-size: 11px;
  border: 1px solid var(--hair);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 2px 6px;
  color: var(--ink);
  background: rgba(232, 240, 238, .06);
  margin: 0 2px;
}

/* ------------------------------------------------------------ touch ctrl */

#stick {
  position: fixed;
  left: 22px;
  bottom: max(26px, env(safe-area-inset-bottom));
  width: 116px; height: 116px;
  border: 1px solid var(--hair);
  border-radius: 50%;
  z-index: 40;
  touch-action: none;
  background: rgba(232, 240, 238, .03);
}
#stick[hidden] { display: none; }
#stick i {
  position: absolute;
  left: 50%; top: 50%;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(124, 255, 79, .22);
  border: 1px solid var(--acid);
  will-change: transform;
}

#touchAction {
  position: fixed;
  right: 22px;
  bottom: max(40px, env(safe-area-inset-bottom));
  z-index: 40;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--void);
  background: var(--acid);
  border: 0;
  border-radius: 50%;
  width: 84px; height: 84px;
  cursor: pointer;
  opacity: .25;
  transition: opacity .18s;
  touch-action: manipulation;
}
#touchAction[hidden] { display: none; }
#touchAction.live { opacity: 1; box-shadow: 0 0 28px rgba(124, 255, 79, .5); }

/* ------------------------------------------------------------ help modal */

#help {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(5, 6, 10, .86);
  backdrop-filter: blur(5px);
  padding: 20px;
}
#help[hidden] { display: none; }

.card {
  border: 1px solid var(--hair);
  border-radius: 10px;
  background: var(--void);
  padding: 26px;
  max-width: 380px;
  width: 100%;
}
.card h2 { margin: 0 0 16px; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--acid); }
.card ul { margin: 0 0 14px; padding: 0; list-style: none; font-size: 13.5px; line-height: 2; color: var(--ink-2); }
.muted { font-size: 12px; color: var(--ink-3); margin: 0 0 18px; }

.solid {
  font: inherit; font-size: 13px; font-weight: 600;
  width: 100%; padding: 12px;
  color: var(--void); background: var(--acid);
  border: 0; border-radius: 6px; cursor: pointer; min-height: 44px;
}
.solid:hover { filter: brightness(1.08); }

/* -------------------------------------------------------------- fallback */

#fallback {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow-y: auto;
  background: var(--void);
  padding: 8vh 20px 40px;
}
#fallback[hidden] { display: none; }
.fb-inner { max-width: 640px; margin: 0 auto; }
.fb-lead { margin: 14px 0 30px; color: var(--ink-2); font-size: 15px; }

.fb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.fb-card {
  display: block;
  border: 1px solid var(--hair);
  border-radius: 8px;
  padding: 18px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, background .15s;
}
.fb-card:hover { border-color: var(--acid); background: rgba(124, 255, 79, .05); }
.fb-card h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: .16em; }
.fb-card p { margin: 0; font-size: 12.5px; color: var(--ink-2); }
.fb-card.soon { opacity: .5; }
.fb-card.soon:hover { border-color: var(--hair); background: none; }
.fb-note { margin-top: 26px; font-size: 12px; color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
