:root {
  --bg: #050507;
  --lav: #C4BBE0;
  --blue: #2B2BFF;
  --amber: #FFA500;
  --ink: rgba(255, 255, 255, 0.92);
  --mute: rgba(196, 187, 224, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#stage {
  position: fixed;
  inset: 0;
}
#stage canvas { display: block; }

/* Cinematic vignette over the canvas */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(
    ellipse at center,
    transparent 38%,
    rgba(0, 0, 0, 0.35) 78%,
    rgba(0, 0, 0, 0.72) 100%
  );
}

/* ── Type overlay ─────────────────────────────────────────── */
.ui {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(20px, 4vw, 52px);
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 1s ease, transform 1s ease;
}
.brand {
  font-weight: 500;
  font-size: clamp(18px, 2vw, 24px);
  letter-spacing: 0.04em;
}
.tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--mute);
}

.bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.tagline {
  font-weight: 700;
  font-size: clamp(28px, 6vw, 76px);
  line-height: 0.96;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1.1s ease 0.15s, transform 1.1s ease 0.15s;
  text-shadow: 0 2px 40px rgba(5, 5, 7, 0.6);
}
.hint {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--mute);
  white-space: nowrap;
  padding-bottom: 0.4em;
  opacity: 0;
  transition: opacity 1.2s ease 0.5s;
}

body.ready .top,
body.ready .tagline { opacity: 1; transform: translateY(0); }
body.ready .hint { opacity: 1; }

/* ── Loader ───────────────────────────────────────────────── */
.loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--bg);
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
.loader.hidden { opacity: 0; visibility: hidden; }
.loader-mark {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.05em;
}
.loader-bar {
  width: 140px;
  height: 1px;
  background: rgba(196, 187, 224, 0.15);
  overflow: hidden;
}
.loader-bar span {
  display: block;
  height: 100%;
  width: 40%;
  background: var(--lav);
  animation: sweep 1.1s ease-in-out infinite;
}
.loader-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--mute);
}
@keyframes sweep {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(360%); }
}

/* ── Fallback ─────────────────────────────────────────────── */
.fallback {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  background: var(--bg);
  color: var(--mute);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
}
/* The class selector above would otherwise override the `hidden` attribute's
   display:none (UA style has lower specificity), leaving this panel painted on
   top of the canvas forever. This makes `hidden` actually hide it. */
.fallback[hidden] { display: none; }

@media (max-width: 600px) {
  .bottom { flex-direction: column; align-items: flex-start; gap: 14px; }
  .hint { padding-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .loader-bar span { animation: none; width: 100%; }
}
