﻿:root {
  --bg: #040405;
  --bg-lift: #15141a;
  --ink: #e9e8ec;
  --ink-dim: #8b8a93;
  --ink-faint: #55545c;
  --line: rgba(255, 255, 255, 0.09);
  --ice: #9fd8ff;
}

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

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

body {
  background:
    radial-gradient(ellipse 46% 52% at 50% 54%, var(--bg-lift) 0%, #0b0b0e 48%, var(--bg) 82%);
}

.stage { position: fixed; inset: 0; }

#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  opacity: 0;
  transition: opacity 1.4s ease;
}
#scene.ready { opacity: 1; }
#scene.grabbing { cursor: grabbing; }

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 75% 70% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.title {
  position: fixed;
  top: clamp(20px, 4.5vh, 44px);
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  padding: 0 16px;
  opacity: 0;
  transform: translateY(-6px);
  animation: rise 1.2s 0.3s ease forwards;
}
.title h1 {
  font-weight: 600;
  font-size: clamp(13px, 1.25vw, 15px);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  margin-right: -0.42em;
}
.title p {
  margin-top: 10px;
  font-size: clamp(13px, 1.1vw, 15px);
  color: var(--ink-dim);
  letter-spacing: 0.01em;
}

.swatch-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 6px 14px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: auto;
}
.swatches { display: flex; gap: 8px; }
.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.22), transparent 55%), var(--sw);
  cursor: pointer;
  outline: none;
  box-shadow: 0 0 0 2px transparent;
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px rgba(233, 232, 236, 0.75); }
.swatch:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--ice); }
.swatch-name {
  min-width: 86px;
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}

.captions {
  position: fixed;
  right: clamp(16px, 3vw, 36px);
  bottom: calc(clamp(16px, 4vh, 36px) + 58px);
  max-width: 340px;
  text-align: right;
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.captions p:first-child { color: var(--ink); }
.captions.show { opacity: 1; transform: none; transition-delay: 0.35s; }

.controls {
  position: fixed;
  right: clamp(16px, 3vw, 36px);
  bottom: clamp(16px, 4vh, 36px);
  opacity: 0;
  animation: rise 1.2s 0.8s ease forwards;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 500 13px/1 "Instrument Sans", system-ui, sans-serif;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 18px 11px 14px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.25s ease, border-color 0.25s ease;
}
.pill:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.16); }
.pill:focus-visible { outline: 1px solid var(--ice); outline-offset: 3px; }
.pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ice);
  box-shadow: 0 0 10px var(--ice);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.pill[aria-pressed="true"] .dot { background: #f0b27a; box-shadow: 0 0 10px #f0b27a; }

.hint {
  position: fixed;
  left: 50%;
  bottom: clamp(18px, 4.5vh, 40px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  pointer-events: none;
  opacity: 0;
  animation: fade-in 1.2s 1.4s ease forwards;
  transition: opacity 0.8s ease;
}
.hint.gone { opacity: 0 !important; animation: none; }

.credit {
  position: fixed;
  left: clamp(16px, 3vw, 36px);
  bottom: clamp(20px, 4.5vh, 40px);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  pointer-events: none;
}

.loader {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 1px solid var(--line);
  border-top-color: var(--ink-dim);
  animation: spin 0.9s linear infinite;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.loader.done { opacity: 0; }

@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { to { opacity: 1; } }

@media (max-width: 640px) {
  .credit { display: none; }
  .controls { left: 0; right: 0; text-align: center; bottom: 64px; }
  .hint { bottom: 24px; }
  .captions { left: 16px; right: 16px; max-width: none; text-align: center; bottom: 116px; font-size: 12px; }
}
