/* ---- type: Geist Pixel (SIL OFL), self-hosted — same face as sinaida.eu.
   One weight (400); .wordmark below intentionally doesn't request 700 so
   the browser never faux-bolds a pixel face into a smear. See
   assets/fonts/. ---- */
@font-face {
  font-family: 'Geist Pixel';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/geist-pixel-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist Pixel';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/geist-pixel-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

html, body {
  height: 100%;
  background: #000;
  color: #eaf5ff;
  font-family: 'Geist Pixel', monospace;
  font-weight: 400;
  letter-spacing: 0;
  overflow: hidden;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#splash, #overlay {
  position: fixed;
  inset: 0;
}

#overlay {
  pointer-events: none;
}

/* ---- splash: glass floating on the water (Act-0 shows through) ---- */
.splash {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 6, 12, 0.18);
  color: #dfeaf2;
  transition: opacity 1.5s ease;
  overflow-y: auto;
  z-index: 10;
}

/* ---- glassmorphism: bubble-panel over the live shader ---- */
.glass {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.10), rgba(120, 210, 255, 0.04));
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  border: 1px solid rgba(190, 235, 255, 0.22);
  border-radius: 22px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -12px 30px rgba(90, 200, 255, 0.06),
    0 18px 50px rgba(0, 0, 0, 0.45);
}

/* ---- wordmark: plain, legible, Geist Pixel — its own slower, wider ripple
   and chroma separation carries the psychedelic feel without breaking
   layout the way the old per-letter goo filter did. ---- */
.wordmark {
  font-family: 'Geist Pixel', monospace;
  font-weight: 400;
  font-size: clamp(1.8rem, 6vw, 3.2rem);
  letter-spacing: 0.06em;
  color: #eaf6ff;
  text-shadow: 0 0 26px rgba(120, 220, 255, 0.45);
  text-align: center;
  margin-bottom: 0.6rem;
  line-height: 1.25;
  animation: psyFloat 7s ease-in-out infinite, wordmarkChroma 9s linear infinite;
}
@keyframes wordmarkChroma {
  0%   { filter: drop-shadow(3px 0 0 rgba(255, 70, 120, 0.4)) drop-shadow(-3px 0 0 rgba(70, 220, 255, 0.4)); }
  33%  { filter: drop-shadow(-2px 2.4px 0 rgba(255, 70, 120, 0.4)) drop-shadow(2px -2.4px 0 rgba(70, 220, 255, 0.4)); }
  66%  { filter: drop-shadow(2.4px -2px 0 rgba(255, 70, 120, 0.4)) drop-shadow(-2.4px 2px 0 rgba(70, 220, 255, 0.4)); }
  100% { filter: drop-shadow(3px 0 0 rgba(255, 70, 120, 0.4)) drop-shadow(-3px 0 0 rgba(70, 220, 255, 0.4)); }
}
@media (prefers-reduced-motion: reduce) {
  .wordmark { animation: none; }
}

/* ---- unified glass tile: every choice in the app is one of these ---- */
.tile-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 1.2rem 0 0.4rem;
  flex-wrap: wrap;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 9.5rem;
  padding: 0.85rem 1.5rem;
  font: inherit;
  font-size: 1rem;
  color: #eaf6ff;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(120, 210, 255, 0.035));
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border: 1px solid rgba(190, 235, 255, 0.20);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 6px 18px rgba(0, 0, 0, 0.35);
  text-shadow: 0 0 12px rgba(130, 210, 255, 0.35);
  transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease, background 0.35s ease, opacity 0.3s ease;
}
.tile:hover:not(:disabled), .tile:focus-visible {
  border-color: rgba(160, 220, 255, 0.6);
  transform: translateY(-2px);
  outline: none;
}
.tile.selected {
  border-color: rgba(170, 230, 255, 0.9);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(120, 210, 255, 0.10));
  box-shadow:
    0 0 26px rgba(110, 210, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
  transform: translateY(-2px);
}
.tile:disabled { opacity: 0.35; cursor: default; transform: none; }

/* ---- psychedelic ripple: every tile/pill/text-plate floats on its own
   phase and drifts through a slow RGB (chromatic) separation. `translate`
   is used instead of `transform` for the bob so it composites cleanly with
   the existing hover/selected `transform: translateY(...)` rather than
   fighting it — modern browsers animate translate/rotate/scale alongside
   transform as independent layers. ---- */
@keyframes psyFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -5px; }
}
@keyframes psyChroma {
  0%   { filter: drop-shadow(1.6px 0 0 rgba(255, 70, 120, 0.45)) drop-shadow(-1.6px 0 0 rgba(70, 220, 255, 0.45)); }
  33%  { filter: drop-shadow(-1.1px 1.3px 0 rgba(255, 70, 120, 0.45)) drop-shadow(1.1px -1.3px 0 rgba(70, 220, 255, 0.45)); }
  66%  { filter: drop-shadow(1.3px -1.1px 0 rgba(255, 70, 120, 0.45)) drop-shadow(-1.3px 1.1px 0 rgba(70, 220, 255, 0.45)); }
  100% { filter: drop-shadow(1.6px 0 0 rgba(255, 70, 120, 0.45)) drop-shadow(-1.6px 0 0 rgba(70, 220, 255, 0.45)); }
}
.tile, .corner-pill, .text-plate, .station-hud {
  animation: psyFloat 5.2s ease-in-out infinite, psyChroma 7.3s linear infinite;
}
/* Non-integer-ratio delays so panels drift out of phase with each other
   instead of bobbing in unison. */
.tile-row .tile:nth-child(2) { animation-delay: -1.7s, -2.4s; }
.tile-row .tile:nth-child(3) { animation-delay: -3.1s, -4.9s; }
.mute-btn { animation-delay: -0.9s, -1.6s; }
.rest-btn { animation-delay: -2.6s, -3.3s; }
.finish-btn { animation-delay: -4.1s, -0.4s; }
@media (prefers-reduced-motion: reduce) {
  .tile, .corner-pill, .text-plate, .station-hud { animation: none; }
}

.deck-title {
  font-size: 1.1rem;
  color: #d6f2ff;
}
.deck-sub { font-size: 0.82rem; opacity: 0.75; }

.splash-privacy {
  margin-top: 0.7rem;
  font-size: 0.9rem;
  font-style: italic;
  opacity: 0.8;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

/* ---- step area: quality -> camera -> path, one glass step at a time ---- */
.step-area { margin-top: 0.4rem; }
.step-label {
  font-size: 0.95rem;
  opacity: 0.85;
  margin-bottom: 0.2rem;
}
.step-panel {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.step-panel.step-out {
  opacity: 0;
  transform: translateY(-6px);
}

/* ---- station HUD: ghost target + live self + rep count ---- */
.station-hud {
  position: fixed;
  left: 50%;
  bottom: 6%;
  transform: translateX(-50%) translateY(12px);
  width: min(30vmin, 220px);
  padding: 0.7rem 0.9rem 0.6rem;
  text-align: center;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.station-hud.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.hud-canvas {
  width: 100%;
  aspect-ratio: 1 / 1.15;
  display: block;
}
.hud-guide {
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0.95;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8), 0 0 14px rgba(120, 210, 255, 0.35);
}
.hud-count {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  opacity: 0.7;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.constellation-figure {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 700px) {
  .station-hud { width: min(44vmin, 190px); bottom: 4%; }
}
.splash.fading { opacity: 0; }
.splash.fading-in { animation: splashIn 1.5s ease; }
@keyframes splashIn { from { opacity: 0; } to { opacity: 1; } }

.splash-inner {
  max-width: 34rem;
  padding: 3rem 1.5rem;
  text-align: center;
}
.splash-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: normal;
  letter-spacing: 0.35em;
  margin-bottom: 0.8rem;
  text-shadow: 0 0 24px rgba(140, 190, 255, 0.35);
}
.splash-subtitle {
  opacity: 0.75;
  font-style: italic;
  margin-bottom: 1.6rem;
}
.hairline {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin: 1.4rem 0;
}
.splash-intro { line-height: 1.65; opacity: 0.9; }
.splash-credit { margin-top: 1.2rem; font-size: 0.95rem; }
.splash-credit a {
  color: #cfd8e3;
  text-shadow: 0 0 18px rgba(140, 190, 255, 0.35);
}
.splash-warning { margin-top: 0.7rem; font-size: 0.85rem; opacity: 0.6; }
.splash-bench { font-size: 0.95rem; opacity: 0.8; min-height: 1.4em; }
.shimmer { animation: shimmer 1.8s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.95; } }
@media (prefers-reduced-motion: reduce) {
  .shimmer { animation: none; }
}
.splash-quality { margin-top: 0.7rem; font-size: 0.95rem; }
.quality-select {
  background: transparent;
  color: #cfd8e3;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  font: inherit;
  padding: 0.15rem 0.5rem;
}
.splash-eco-note { margin-top: 0.5rem; font-size: 0.85rem; opacity: 0.65; font-style: italic; }
.splash-fallback-note { margin-top: 0.8rem; font-size: 0.9rem; opacity: 0.75; font-style: italic; }

/* ---- text plate: glass backing for any text drawn over the live tunnel —
   fixes the contrast problem where cues/hints/calibration text crossed a
   bright ring and became unreadable. ---- */
.text-plate {
  display: inline-block;
  background: linear-gradient(135deg, rgba(4, 14, 24, 0.42), rgba(4, 14, 24, 0.24));
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  border: 1px solid rgba(190, 235, 255, 0.14);
  border-radius: 16px;
  padding: 0.7rem 1.3rem;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8), 0 0 18px rgba(120, 210, 255, 0.4);
}

/* ---- calibration ---- */
.calibration {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
}
.calibration[hidden] { display: none; }
.cal-plate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  padding: 2.4rem 2.8rem;
}
.cal-circle {
  width: 72px;
  height: 72px;
  border: 1px solid rgba(160, 210, 255, 0.7);
  border-radius: 50%;
  box-shadow: 0 0 32px rgba(140, 190, 255, 0.45);
  animation: calPulse 3s ease-in-out infinite;
}
@keyframes calPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.12); opacity: 1; }
}
.cal-text { opacity: 0.85; font-style: italic; text-align: center; }

/* ---- in-journey overlay ---- */
.question-text {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: min(80vw, 40rem);
  text-align: center;
  font-style: italic;
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  color: #eaf6ff;
  opacity: 0;
  transition: opacity 4s ease;
}
.question-text.visible { opacity: 1; transition: opacity 1.5s ease; }

.cue-text {
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: min(85vw, 34rem);
  text-align: center;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 2s ease;
}
.cue-text.visible { opacity: 0.92; transition: opacity 1s ease; }

.hint {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  width: min(85vw, 34rem);
  text-align: center;
  font-size: 0.95rem;
  font-style: italic;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.hint.visible { opacity: 0.92; }

/* ---- corner pills: mute + rest, small glass plates instead of bare text -- */
.corner-pill {
  position: absolute;
  bottom: 1rem;
  pointer-events: auto;
  color: #eaf6ff;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(120, 210, 255, 0.03));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(190, 235, 255, 0.14);
  opacity: 0.65;
  transition: opacity 0.35s ease, border-color 0.35s ease;
}
.corner-pill:hover, .corner-pill:focus-visible { opacity: 1; border-color: rgba(160, 220, 255, 0.5); outline: none; }
.mute-btn { right: 1.2rem; }
.rest-btn { left: 1.2rem; }
.finish-btn {
  bottom: auto;
  top: 1.2rem;
  left: 50%;
  /* Static centering uses `transform` (not `translate`) so it composes
     independently of the animated `translate` float — see psyFloat. */
  transform: translateX(-50%);
}

/* ---- step-back: subtle link back to the main menu from steps 2 & 3 ---- */
.step-back {
  display: block;
  margin: 0 auto 0.9rem;
  background: none;
  border: none;
  color: #eaf6ff;
  opacity: 0.55;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline dotted;
}
.step-back:hover, .step-back:focus-visible { opacity: 1; outline: none; }

/* ---- end screen: quote + playlist ---- */
.end-quote {
  margin: 0.8rem 0 0.4rem;
  font-style: italic;
  font-size: 1.05rem;
  opacity: 0.9;
  line-height: 1.5;
}

/* ---- tunnel dim (pause active) ---- */
#gl.gl-dim {
  filter: brightness(0.35);
  transition: filter 1s ease;
}

/* ---- pause layer ---- */
.pause-layer {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  z-index: 20;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease, pointer-events 1s ease;
}
.pause-layer.visible {
  opacity: 1;
  pointer-events: auto;
}
.pause-layer.surfacing {
  animation: surfaceFade 2s ease forwards;
}
@keyframes surfaceFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
/* Direct "finish here" exit: a clean black fade, no empty figure/mantra
   box or return-or-surface buttons floating in it (see pause.js finishNow). */
.pause-layer.exit-only .pause-figure,
.pause-layer.exit-only .pause-mantra,
.pause-layer.exit-only .pause-buttons {
  visibility: hidden;
}

.pause-figure {
  flex-shrink: 0;
  width: 40vmin;
  height: 40vmin;
  max-width: 420px;
  max-height: 420px;
}

.pause-mantra {
  max-width: 32rem;
  text-align: center;
  font-style: italic;
  font-size: 1rem;
  opacity: 0.85;
  line-height: 1.6;
  padding: 0 1.5rem;
}

.pause-buttons {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 1.5rem;
}
.pause-buttons .tile {
  flex-shrink: 0;
  min-width: 9rem;
}

/* ---- mobile pause ---- */
@media (max-width: 700px) {
  .pause-figure {
    width: 50vmin;
    max-width: 280px;
  }
  .pause-mantra {
    font-size: 0.95rem;
  }
  .pause-buttons {
    flex-direction: column;
    gap: 0.8rem;
  }
  .pause-buttons .tile {
    width: 100%;
    min-height: 48px;
  }
}

/* ---- mobile ---- */
@media (max-width: 700px) {
  .splash-inner { padding: 2rem 1.2rem; }
  .tile-row { flex-direction: column; align-items: stretch; }
  .tile { width: 100%; min-height: 48px; }
  .question-text { top: 12%; }
}
