/* ============================================================
   GLOBAL BASE
============================================================ */
html, body {
  margin: 0;
  height: 100%;
  width: 100%;
  background: radial-gradient(circle at 50% 100%, rgba(255,0,150,0.05), #000 85%);
  overflow: hidden;                 /* scrolling happens in #scroll-container */
  scroll-behavior: smooth;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #fff;
}

/* Ensure the visual viewport on mobile */
@supports (-webkit-touch-callout: none) {
  html, body {
    height: 100vh;
    min-height: -webkit-fill-available;
  }
}

/* ============================================================
   PANORAMA SCROLL CONTAINER — touch + mouse
============================================================ */
#scroll-container {
  position: relative;
  width: 100vw;
  height: 100dvh;                   /* modern viewport unit to avoid iOS bars */
  overflow: auto;                   /* both directions when content overflows */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  background: transparent;
  cursor: grab;
  will-change: scroll-position;
}

#panorama-wrapper,
#panorama {
  will-change: transform, width, height;
  transform: translateZ(0);
}

#panorama-wrapper {
  position: relative;
  overflow: visible;                /* never clip the image */
  width: max-content;
  height: max-content;
}

#panorama {
  display: block;
  max-width: none;
  max-height: none;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: auto;             /* allow finger pan on the image itself */
  opacity: 0;
  transition: opacity 1.5s ease, transform 0.8s ease;
}
#panorama.active { opacity: 1; transform: scale(1); }

/* ============================================================
   LOADING MASK
============================================================ */
#loading-mask {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  opacity: 1;
  transition: opacity 1s ease;
}
#loading-mask.fade-out { opacity: 0; pointer-events: none; }

.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 1rem; font-size: .9rem; opacity: .8; }

/* ============================================================
   BEGIN EXPERIENCE (keep on top to avoid hijacks)
============================================================ */
#start {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 1em 2em;
  background: linear-gradient(90deg, #00e6ff, #ff00aa);
  color: #000;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  text-transform: uppercase;
  z-index: 9999;                    /* higher than footer & links */
  transition: opacity .6s ease, transform .35s ease;
}
#start:hover { transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 0 30px rgba(255,0,170,0.4); }

/* ============================================================
   FOOTER (Links | Player | Joystick)
   - Invisible until Begin
   - No blur mask (per your request)
   - Pass horizontal pan through, but keep buttons clickable
============================================================ */
#footer {
  position: fixed;
  left: 0; right: 0;
  bottom: env(safe-area-inset-bottom, 0px);
  z-index: 5000;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  padding: 0 1rem;
  opacity: 0;                       /* hidden initially */
  pointer-events: none;             /* allow panning underneath */
  transform: translateZ(0);
  transition: opacity .6s ease;
  background: transparent;          /* removed blur mask */
  backdrop-filter: none;
  border-top: none;
}
#footer.visible {
  opacity: 1;
  /* keep pointer-events on container NONE so horizontal pan passes through;
     we re-enable events only on interactive children below */
}

/* Make children clickable while parent stays pan-transparent */
#footer * {
  pointer-events: auto;
  touch-action: manipulation;       /* taps/clicks only; no pan capture */
}

/* Group layouts */
#footer-left { display: flex; gap: 1.2rem; flex-wrap: wrap; justify-content: center; }
#footer-right { display: flex; align-items: flex-end; justify-content: center; flex: 1; }

/* ============================================================
   AUDIO CONTROLS
============================================================ */
#controls {
  display: flex;
  gap: 1rem;
  background: rgba(255,255,255,0.08);
  border-radius: 50px;
  padding: .8rem 1.4rem;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
}
#controls button {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .25s ease;
}
#controls button:hover { background: linear-gradient(90deg, rgba(0,230,255,0.4), rgba(255,0,170,0.4)); transform: scale(1.08); }
#controls svg { width: 22px; height: 22px; fill: #fff; }

/* ============================================================
   PROGRESS BAR — Gradient Glow + Smooth Animation
============================================================ */
#progress-bar,
#progress-block {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 10px 16px; border-radius: 40px;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(0,200,255,0.4);
  box-shadow:
    0 0 20px rgba(0,200,255,0.25),
    0 0 30px rgba(255,0,150,0.2),
    0 0 8px rgba(190,160,255,0.15);
  animation: pulseProgress 6s ease-in-out infinite alternate;
}
@keyframes pulseProgress {
  0%,100% { box-shadow: 0 0 20px rgba(0,200,255,0.25), 0 0 30px rgba(255,0,150,0.2); }
  50%     { box-shadow: 0 0 28px rgba(0,220,255,0.45), 0 0 36px rgba(255,0,170,0.35); }
}
#progress-svg { width: 200px; height: 10px; }
#progress-line { stroke-width: 4; stroke: url(#progressGradient); filter: drop-shadow(0 0 8px rgba(0,255,255,0.5)); transition: stroke-dashoffset .25s linear; }
#progress-pointer { r: 6; fill: #fff; transition: cx .2s linear; pointer-events: none; }
#time-display { font-size: 12px; color: #fff; font-family: monospace; letter-spacing: .5px; opacity: .85; }

/* gradient ids come from your inline SVG */
svg defs #progressGradient stop:first-child { stop-color: #00e6ff; }
svg defs #progressGradient stop:last-child  { stop-color: #ff00aa; }

/* ============================================================
   GLOWING THEMED BUTTONS
============================================================ */
#footer-left button {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.05rem;
  letter-spacing: .06em;
  padding: .9em 1.6em;
  border-radius: 2rem;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06);
  color: #fff;
  transition: transform .25s ease, box-shadow .4s ease, background .3s ease;
}
#footer-left button:hover { transform: scale(1.05); border-color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.12); }

#buy-btn        { border-color: rgba(0,220,255,0.5); animation: glowCyan 1s ease-in-out infinite alternate; }
#soundcloud-btn { border-color: rgba(255,150,0,0.5); animation: glowOrange 1s ease-in-out infinite alternate; }
#lyrics-btn     { border-color: rgba(200,170,255,0.5); animation: glowViolet 1s ease-in-out infinite alternate; }

@keyframes glowCyan   { 0%,100% { box-shadow: 0 0 12px rgba(0,220,255,0.25); } 80% { box-shadow: 0 0 22px rgba(0,240,255,0.55); } }
@keyframes glowOrange { 0%,100% { box-shadow: 0 0 12px rgba(255,140,0,0.25); } 80% { box-shadow: 0 0 22px rgba(255,170,0,0.55); } }
@keyframes glowViolet { 0%,100% { box-shadow: 0 0 12px rgba(190,160,255,0.25); } 80% { box-shadow: 0 0 22px rgba(210,180,255,0.55); } }

/* ============================================================
   JOYSTICK GRID
============================================================ */
#joystick { display: flex; flex-direction: column; align-items: center; gap: 1.2rem; }
.zoom-controls { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.arrow-controls {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.joy-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.45);
  color: #fff; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: all .25s ease;
  box-shadow: 0 0 10px rgba(0,255,255,0.15);
}
.joy-btn:hover { background: linear-gradient(90deg, rgba(0,230,255,0.3), rgba(255,0,170,0.3)); border-color: rgba(255,255,255,0.6); transform: scale(1.1); box-shadow: 0 0 16px rgba(0,230,255,0.4), 0 0 20px rgba(190,160,255,0.25); }
#arrow-up    { grid-column: 2; grid-row: 1; }
#arrow-left  { grid-column: 1; grid-row: 2; }
#arrow-right { grid-column: 3; grid-row: 2; }
#arrow-down  { grid-column: 2; grid-row: 3; }

/* ============================================================
   LYRICS MODAL
============================================================ */
#lyrics-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(12px);
  overflow-y: auto;
  z-index: 6000;
  opacity: 0; pointer-events: none;
  transition: opacity .4s ease;
}
#lyrics-modal.active { opacity: 1; pointer-events: auto; }

#lyrics-gallery { display: flex; flex-direction: column; align-items: center; padding: 100px 0 60px; gap: 2rem; }
#lyrics-gallery img {
  max-width: 90%;
  border-radius: 12px;
  box-shadow: 0 0 30px rgba(255,255,255,0.1);
  opacity: 0; transform: translateY(30px);
  animation: fadeUp .6s ease forwards;
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

#close-lyrics {
  position: sticky; top: 24px; right: 32px; align-self: flex-end;
  font-size: 2.8rem; color: #fff;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 50%; width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 0 15px rgba(255,255,255,0.4);
  transition: all .25s ease;
}
#close-lyrics:hover { background: linear-gradient(90deg, rgba(0,230,255,0.4), rgba(255,0,170,0.4)); }

/* ============================================================
   RESPONSIVE TUNING
============================================================ */
@media (max-width: 768px) {
  #footer {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .5rem;
  }
  #footer-left, #player-cluster, #footer-right {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    min-width: 0;
  }
  #controls button { width: 42px; height: 42px; }
  #footer-left button { font-size: .9rem; padding: .5em 1.2em; margin: .2rem; }
  #joystick .joy-btn { width: 42px; height: 42px; font-size: 1rem; }
}

/* Landscape: center groups & avoid cutoff */
@media (orientation: landscape) {
  #footer {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    max-height: 70dvh;             /* if lots of buttons, allow internal scroll */
    overflow-y: auto;
  }
  #footer-left, #footer-right, #player-cluster { flex: 1 1 auto; justify-content: center; }
}

/* ============================================================
   PLAYER VISIBILITY (no clipping)
============================================================ */
#player-cluster {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  width: 100%; margin: 0 auto;
  padding-bottom: .8rem;
}
#progress-block, #progress-bar { transform: translateY(0); margin-bottom: .6rem; }

/* ============================================================
   SAFARI / CHROMIUM SAFE-AREA + PAN REINFORCEMENT
============================================================ */
#scroll-container, #panorama {
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

/* Ensure taps don’t get hijacked by footer when hidden */
#footer:not(.visible) * { pointer-events: none; }
