/* The in-browser viewer. Shares the site's tokens from site.css. */

.try {
  overflow: hidden;
  height: 100svh;
  margin: 0;
}

#stage {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;          /* or the browser pans instead of the camera */
}

/* ---------- chooser ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: rgba(13, 14, 14, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.overlay[hidden] { display: none; }

.overlay__panel {
  width: min(100%, 42rem);
  text-align: center;
}
.overlay__home {
  display: inline-block;
  margin-bottom: 1.6rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}
.overlay__home:hover { color: var(--paper); }
.overlay__panel h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); margin-bottom: 0.9rem; }
.overlay__lede {
  color: rgba(244, 241, 234, 0.72);
  max-width: 34rem;
  margin: 0 auto 2rem;
}
.overlay__note { margin-top: 1.4rem; font-size: 0.8rem; color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.85rem;
}
.card {
  padding: 1.1rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 0.8rem;
  background: var(--ink-raised);
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: center;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: rgba(244, 241, 234, 0.32); }
.card strong { display: block; font-size: 1rem; margin-bottom: 0.3rem; }
.card span { display: block; font-size: 0.78rem; color: var(--muted); }
.card em {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  font-size: 0.72rem;
  color: var(--ochre);
}

/* ---------- loading ---------- */

.loading {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  gap: 1rem;
  background: rgba(13, 14, 14, 0.9);
  color: var(--paper);
}
.loading[hidden] { display: none; }
.loading__bar {
  width: min(70vw, 22rem);
  height: 3px;
  background: rgba(244, 241, 234, 0.14);
  border-radius: 2px;
  overflow: hidden;
}
.loading__bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ochre);
  transition: width 0.2s var(--ease);
}
.loading p { font-size: 0.85rem; color: var(--muted); margin: 0.8rem 0 0; }

/* ---------- palette ---------- */

.hud {
  position: fixed;
  z-index: 15;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100vw - 2rem), 26rem);
  padding: 0.9rem 1rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 0.9rem;
  background: rgba(13, 14, 14, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.hud[hidden] { display: none; }

.hud__row { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.7rem; }
.hud__row--tools { margin: 0.7rem 0 0; }
.hud__name { font-weight: 600; font-size: 0.92rem; }
.hud__hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: var(--muted);
  margin-left: auto;
}
.hud__status {
  margin: 0.65rem 0 0;
  font-size: 0.74rem;
  color: var(--muted);
  min-height: 1.1em;
}

.hud button, .hud__back {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  border-radius: 1.2rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--paper);
  cursor: pointer;
}
.hud button:hover:not(:disabled) { background: rgba(244, 241, 234, 0.08); }
.hud button:disabled { opacity: 0.4; cursor: default; }

#mix {
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 0.4rem;
  background: transparent;
  cursor: pointer;
}

.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.35rem; }
.swatch {
  aspect-ratio: 1;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 0.3rem;
  padding: 0;
  cursor: pointer;
  transition: transform 0.14s var(--ease);
}
.swatch:hover { transform: translateY(-2px) scale(1.06); }
.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 3px var(--ochre);
}

/* Four by four on a phone, as on the controller; eight wide has more room on a
   desktop and keeps the panel short. */
@media (max-width: 30rem) {
  .swatches { grid-template-columns: repeat(4, 1fr); gap: 0.45rem; }
}

/* ---------- VR button ---------- */

.vr-slot { position: fixed; z-index: 15; top: 1rem; right: 1rem; }
.vr-slot button {
  position: static !important;
  font: inherit !important;
  font-size: 0.8rem !important;
  letter-spacing: 0 !important;
  padding: 0.5rem 1rem !important;
  border-radius: 1.2rem !important;
  border: 1px solid var(--rule) !important;
  background: rgba(13, 14, 14, 0.9) !important;
  color: var(--paper) !important;
  opacity: 1 !important;
  width: auto !important;
  cursor: pointer;
}
