* { box-sizing: border-box; user-select: none; }

body {
  margin: 0;
  overflow: hidden;
  background: #000;
  font-family: 'Segoe UI', sans-serif;
}

#hud {
  position: absolute;
  top: 15px;
  width: 100%;
  text-align: center;
  color: white;
  font-size: 22px;
  text-shadow: 0 0 10px cyan;
  display: none;
  z-index: 10;
  pointer-events: none;
}
#amDisplay {

  position: absolute;

  top: 92px;
  right: 18px;

  display: flex;
  align-items: center;

  gap: 8px;

  color: #00ffff;

  font-size: 28px;
  font-weight: 200;

  text-shadow: 0 0 12px cyan;

}

#amIcon {

  width: 36px;
  height: 36px;

  object-fit: contain;

}
.subtitle {
  display: none;
}

#levelBox {
  position: absolute;
  left: 20px;
  top: 15px;
  font-size: 20px;
  color: white;
}

#livesDisplay {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 21.6px;
  color: cyan;
  text-shadow: 0 0 10px blue;
  display: flex;
  align-items: center;
  gap: 4px;
}
#coinsDisplay {
  position: absolute;
  right: 20px;
  top: 60px;
  font-size: 22px;
  color: gold;
  text-shadow: 0 0 10px orange, 0 0 20px gold;
}
#livesIcon {
  font-size: 28.8px;
  filter: drop-shadow(0 0 8px cyan);
}

#timer {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  color: white;
  text-shadow: 0 0 10px cyan;
  display: block;
}

#timer.park {
  display: none;
}

#info {
  position: absolute;
  top: 70px;
  right: 20px;
  color: cyan;
  background: rgba(0,0,0,0.7);
  padding: 8px 15px;
  border-radius: 20px;
  border: 1px solid cyan;
  z-index: 100;
  white-space: pre-line;
  text-align: right;
  transition: opacity 0.2s;
}

#info.hidden {
  opacity: 0;
  pointer-events: none;
}

#info span {
  color: yellow;
  font-weight: bold;
}

#countdownOverlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 120px;
  font-weight: bold;
  text-shadow: 0 0 40px red;
  z-index: 25;
  pointer-events: none;
}

#scoreboardOverlay,
#failureOverlay {
  position: absolute;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background: rgba(0,0,0,0.96);
  z-index: 30;
}

#failureOverlay {
  background: rgba(50,0,0,0.98);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background: radial-gradient(circle at 30% 30%, #0a0a1a, #000);
  z-index: 20;
}

.neonTitle {
  font-size: 146px;
  letter-spacing: 7px;
  text-shadow: 0 0 10px white, 0 0 20px currentColor, 0 0 40px currentColor;
}

@keyframes flicker {
  0% { opacity:1; text-shadow:0 0 10px white,0 0 20px currentColor,0 0 40px currentColor; }
  25% { opacity:0.8; text-shadow:0 0 5px white,0 0 10px currentColor,0 0 20px currentColor; }
  50% { opacity:0.3; text-shadow:0 0 2px white,0 0 5px currentColor,0 0 10px currentColor; }
  75% { opacity:0.9; text-shadow:0 0 8px white,0 0 15px currentColor,0 0 30px currentColor; }
  100% { opacity:1; text-shadow:0 0 10px white,0 0 20px currentColor,0 0 40px currentColor; }
}

.copyright {
  color: #666;
  font-size: 14px;
  margin-bottom: 25px;
}

button {
  padding: 12px 30px;
  margin: 10px;
  font-size: 18px;
  background: black;
  border: 2px solid cyan;
  color: white;
  border-radius: 40px;
  cursor: pointer;
  transition: 0.2s;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;
}

button:hover {
  box-shadow: 0 0 15px cyan, 0 0 30px cyan;
  background: #111;
  transform: scale(1.05);
}

#entranceMessage {
  position: absolute;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,255,136,0.2);
  border: 2px solid #00ff88;
  color: white;
  padding: 15px 30px;
  border-radius: 40px;
  backdrop-filter: blur(5px);
  display: none;
  z-index: 100;
  font-size: 18px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 0 15px rgba(0,255,136,0.5);
}

#entranceMessage:hover {
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 0 20px rgba(0,255,136,0.9);
  background: rgba(0,255,136,0.35);
}

#usernameInput {
  padding: 10px 20px;
  font-size: 18px;
  background: #111;
  border: 2px solid cyan;
  color: white;
  border-radius: 40px;
  margin-bottom: 20px;
  text-align: center;
  width: 300px;
}

#usernameInput::placeholder {
  color: #666;
}

#leaderboardEntries {
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  margin: 20px 0;
}

.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  margin: 5px;
  background: #1a1a2e;
  border-radius: 5px;
  color: white;
}

.leaderboard-rank {
  color: gold;
  font-weight: bold;
}

.leaderboard-time {
  color: cyan;
}

#closeLeaderboard,
#quitToMenu {
  margin-top: 10px;
}
.platinum {
  color: #e5ccff;
  font-weight: bold;
  text-shadow:
    0 0 5px #fff,
    0 0 10px #d9b3ff,
    0 0 20px #cc99ff,
    0 0 30px #b366ff;
  animation: platinumGlow 1.5s infinite alternate, sparkle 2s infinite linear;
}

/* Soft pulsing glow */
@keyframes platinumGlow {
  0% {
    text-shadow:
      0 0 5px #fff,
      0 0 10px #d9b3ff,
      0 0 20px #cc99ff;
  }
  100% {
    text-shadow:
      0 0 10px #fff,
      0 0 20px #e6ccff,
      0 0 40px #cc99ff;
  }
}

/* Sparkle flicker effect */
@keyframes sparkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
#shopOverlay h2 {
  text-shadow: 0 0 10px #fff, 0 0 20px #ff1493, 0 0 40px #ff1493;
}

#shopOptions button {
  width: 100%;
}
#mazeSelectOverlay h2 {
  text-shadow: 0 0 10px #fff, 0 0 20px #00ff66, 0 0 40px #00ff66;
}

#mazeButtons {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;

  scrollbar-width: none;
  -ms-overflow-style: none;
}

#mazeButtons::-webkit-scrollbar {
  display: none;
}

#mazeButtons button {
  width: 100%;
}
#shopOverlay {
  overflow-y: auto;
  padding: 40px 20px;
}

#sphereShopOptions {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}
/* Hide scrollbar but keep scrolling */
#sphereShopOptions {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;

  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge */
}

#sphereShopOptions::-webkit-scrollbar {
  display: none;               /* Chrome/Safari */
}
.sphere-btn {
  width: 70px;
  height: 70px;

  border-radius: 50%;
  border: none;
  cursor: pointer;
  margin: 8px auto;
  transition: 0.2s;
  position: relative;
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;

  background-size: cover;
  background-position: center;

  box-shadow:
    0 0 12px rgba(255,255,255,0.3),
    inset -12px -12px 20px rgba(0,0,0,0.5),
    inset 10px 10px 15px rgba(255,255,255,0.3);
}
.sphere-btn::after {
  content: "";
  position: absolute;
  top: 10%;
  left: 20%;
  width: 30%;
  height: 30%;
  background: rgba(255,255,255,0.6);
  border-radius: 50%;
  filter: blur(4px);
  opacity: 0.9;
}
/* Neon glow from data-color */
.sphere-btn[data-color] {
  color: inherit;
}

.sphere-btn:hover {
  transform: scale(1.15);
  box-shadow:
    0 0 15px white,
    0 0 30px currentColor;
}

/* Special cases */
/* ⚫ Black sphere (no glow, deep shading) */
.sphere-btn.black {
  background: black;
  box-shadow:
    inset -10px -10px 20px rgba(0,0,0,0.8),
    inset 10px 10px 10px rgba(255,255,255,0.1);
}

/* 🫥 Clear sphere (glass look) */
.sphere-btn.clear {
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.3);
  backdrop-filter: blur(6px);

  box-shadow:
    inset -10px -10px 20px rgba(0,0,0,0.2),
    inset 10px 10px 20px rgba(255,255,255,0.3);
}

#profileBestTimes {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#profileBestTimes::-webkit-scrollbar {
  display: none;
}

.profile-time-entry {
  display: flex;
  justify-content: space-between;
  color: white;
  background: #1a1a2e;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 6px 0;
}
#profileSphereList {
  max-height: 300px; /* adjust as needed */
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;

  /* 🔥 Hide scrollbar (all browsers) */
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge */
}

#profileSphereList::-webkit-scrollbar {
  display: none;               /* Chrome/Safari */
}
#profileSphereList {
  scroll-behavior: smooth;
}
#profileSphereList {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

/* Overlay base */
.sphere-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  pointer-events: none;
}

/* Purchased style */
.sphere-overlay.owned {
  background: rgba(0, 0, 0, 0.6);
  color: lime;
}

/* Price style */
.sphere-overlay.price {
  background: rgba(0, 0, 0, 0.5);
  color: gold;
}

/* Coin emoji polish */
.coin {
  margin-left: 4px;
}
.sphere-btn:not(:disabled):hover {
  transform: scale(1.08);
  box-shadow: 0 0 15px gold;
}
#sphereShopOptions {
  display: grid;
}
#sphereGrid {
  display: grid;
  grid-template-columns: repeat(4, 70px);
  justify-content: center;
  gap: 15px;

  max-height: 50vh;
  overflow-y: auto;

  padding: 50px;              /* fixes edge clipping */
  box-sizing: border-box;

  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* IE/Edge */
}

#sphereGrid::-webkit-scrollbar {
  display: none;              /* Chrome/Safari */
}
.best-time-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  margin: 4px 0;
  background: rgba(0,0,0,0.5);
  border: 1px solid cyan;
  border-radius: 8px;
  color: white;
  text-shadow: 0 0 6px cyan;
}
.best-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  text-align: center;
  padding: 6px 12px;
  margin: 4px 0;
  background: rgba(0,0,0,0.5);
  border: 1px solid cyan;
  border-radius: 8px;
  color: white;
  text-shadow: 0 0 6px cyan;
}
#cameraUI {
  position: absolute;
  top: 95px;
  right: 20px;
  z-index: 50;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* 📸 button */
#cameraBtn {
  font-size: 28px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;

  color: cyan;
  text-shadow: 0 0 10px cyan, 0 0 20px cyan; /* ✨ neon glow */
}
/* vertical slider */
#cameraSlider {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 30px;
  height: 150px;
}
#cameraSliderWrap {
  margin-top: 10px;
  display: block;            /* always block */
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: 0.2s;
}

#cameraSliderWrap.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#optionsBtn{
  position:fixed;
  top:15px;
  left:15px;

  z-index:99999;

  padding:8px 14px;

  border:none;
  border-radius:10px;

  background:#111;
  color:#0ff;

  font-weight:bold;
  cursor:pointer;

  box-shadow:0 0 10px #0ff;

  pointer-events:auto;
}

/* ---------- MOBILE JOYSTICK ---------- */
#mobileJoystick {
  position: fixed;
  left: 140px;
  bottom: 135px;
  width: 190px;
  height: 190px;
  display: none;
  z-index: 9999;
  touch-action: none;
  opacity: 0.28;
}

#joystickBase {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 255, 255, 0.55);
  background: rgba(0, 255, 255, 0.08);
  box-shadow: 0 0 18px rgba(0, 255, 255, 0.35);
}

#joystickKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 16px rgba(0, 255, 255, 0.65);
}
.leaderboard-sphere {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-sphere img,
.leaderboard-sphere-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-block;
  object-fit: cover;
  box-shadow: 0 0 10px cyan;
}

.leaderboard-sphere-fallback {
  background: cyan;
}
/* =========================================
   SPHERE INSPECT OVERLAY
========================================= */

#sphereInspectOverlay {
  position: fixed;
  inset: 0;
  display: none;

  justify-content: center;
  align-items: center;

  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(10px);

  z-index: 500;
}

#sphereInspectPanel {
  width: 90%;
  max-width: 950px;

  min-height: 520px;

  border-radius: 28px;

  border: 2px solid #8844ff;

  background:
    linear-gradient(
      145deg,
      rgba(10,10,18,0.96),
      rgba(18,18,30,0.92)
    );

  box-shadow:
    0 0 30px #8844ff,
    0 0 60px rgba(136,68,255,0.5);

  display: flex;

  position: relative;

  overflow: hidden;
}

#closeSphereInspect {
  position: absolute;

  top: 18px;
  right: 18px;

  width: 42px;
  height: 42px;

  border-radius: 50%;

  border: none;

  background: #ff2255;
  color: white;

  font-size: 20px;
  font-weight: bold;

  cursor: pointer;

  box-shadow:
    0 0 15px #ff2255;
}

#inspectLeft,
#inspectRight {
  flex: 1;

  display: flex;
  flex-direction: column;

  justify-content: center;
  align-items: center;

  padding: 30px;
}

#inspectSphereDisplay {

  width: 240px;
  height: 240px;

  border-radius: 50%;

  position: relative;

  overflow: hidden;

  background-size: cover;
  background-position: center;

  box-shadow:
    inset -25px -25px 40px rgba(0,0,0,0.55),
    inset 12px 12px 25px rgba(255,255,255,0.22),
    0 0 40px rgba(0,255,255,0.35);

  animation:
    inspectSphereFloat 3s ease-in-out infinite;
  background-repeat: repeat-x;
}
#inspectSphereDisplay::before {

  content: "";

  position: absolute;

  top: 18%;
  left: 20%;

  width: 32%;
  height: 32%;

  border-radius: 50%;

  background:
    radial-gradient(
      circle,
      rgba(255,255,255,0.95),
      rgba(255,255,255,0.08)
    );

  filter: blur(6px);

}

#inspectSphereDisplay::after {

  content: "";

  position: absolute;

  inset: 0;

  border-radius: 50%;

  background:
    radial-gradient(
      circle at 30% 30%,
      rgba(255,255,255,0.15),
      transparent 55%
    );

}
@keyframes inspectSphereFloat {

  0% {

    transform:
      translateY(0px)
      rotate(0deg);

    background-position:
      0% 50%;

  }

  50% {

    transform:
      translateY(-10px)
      rotate(4deg);

    background-position:
      50% 50%;

  }

  100% {

    transform:
      translateY(0px)
      rotate(0deg);

    background-position:
      100% 50%;

  }

}
@keyframes inspectSpin {
  from {
    transform: rotateY(0deg);
  }

  to {
    transform: rotateY(360deg);
  }
}

#inspectSphereName {
  color: #00ffff;

  font-size: 38px;

  margin-bottom: 30px;

  text-shadow:
    0 0 15px #00ffff;
}

.statBar {
  width: 100%;

  margin-bottom: 22px;
}

.statBar span {
  display: block;

  margin-bottom: 8px;

  color: white;

  font-size: 16px;
  letter-spacing: 2px;
}

.bar {
  width: 100%;
  height: 18px;

  border-radius: 999px;

  background: rgba(255,255,255,0.08);

  overflow: hidden;

  border: 1px solid rgba(255,255,255,0.08);
}

.fill {
  width: 70%;
  height: 100%;

  border-radius: 999px;

  background:
    linear-gradient(
      90deg,
      #00ffff,
      #00ff88
    );

  box-shadow:
    0 0 15px #00ffff;
}

#inspectButtons {
  display: flex;

  gap: 14px;

  margin-top: 35px;
}

#inspectButtons button,
#backInspectBtn {
  padding: 12px 20px;

  border: none;
  border-radius: 14px;

  font-size: 16px;
  font-weight: bold;

  cursor: pointer;

  color: white;

  background:
    linear-gradient(
      145deg,
      #151525,
      #252545
    );

  box-shadow:
    0 0 15px rgba(136,68,255,0.5);

  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

#inspectButtons button:hover,
#backInspectBtn:hover {
  transform: scale(1.05);

  box-shadow:
    0 0 25px #00ffff;
}

#backInspectBtn {
  margin-top: 25px;
}
#inspectSpherePrice {

  color: gold;

  font-size: 28px;

  font-weight: bold;

  margin-bottom: 28px;

  text-shadow:
    0 0 12px gold;

}

.upgradeOption:hover {

  transform:
    scale(1.04);

  box-shadow:
    0 0 16px cyan;

}
.upgradeExpand {

  display: none;

  margin-top: 12px;

  padding: 12px;

  border-radius: 14px;

  background:
    rgba(0,0,0,0.45);

  border:
    1px solid rgba(0,255,255,0.35);

}

.upgradePreview {

  color: white;

  font-size: 18px;

  line-height: 1.5;

  margin-bottom: 10px;

}

.upgradeActionRow {

  display: flex;

  gap: 10px;

}

.buyUpgradeBtn,
.cancelUpgradeBtn {

  flex: 1;

  border: none;

  border-radius: 12px;

  padding: 10px;

  font-size: 16px;

  cursor: pointer;

}

.buyUpgradeBtn {

  background:
    linear-gradient(
      90deg,
      #00ccff,
      #00ffee
    );

  color: black;

  font-weight: bold;

}

.cancelUpgradeBtn {

  background:
    rgba(255,255,255,0.12);

  color: white;

}
.statHeader {

  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 6px;

}
#speedReadout {

  margin-top: 4px;

  margin-bottom: 6px;

  text-align: center;

  color: #7efcff;

  font-size: 12px;

  font-weight: bold;

  line-height: 1.35;

  letter-spacing: 1px;

  text-shadow:
    0 0 8px rgba(0,255,255,0.7);

}

.miniUpgradeBtn:hover {

  transform: scale(1.1);

  box-shadow:
    0 0 10px cyan;

}
.meterWrap {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.miniUpgradeBtn,
.miniDowngradeBtn {

  width: 34px;
  height: 34px;

  border-radius: 999px;

  border: 2px solid #7efcff;

  background: rgba(0,255,255,.12);

  color: white;

  font-size: 24px;
  font-weight: bold;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  flex-shrink: 0;

  box-shadow:
    0 0 12px rgba(0,255,255,.8);
}

.miniUpgradeBtn.hidden {
  display: none;
}
.bar {
  position: relative;
  width: 100%;
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
}

.fill,
.previewFill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 999px;
}

.fill {
  width: 70%;
  z-index: 2;
  background: linear-gradient(90deg, #00ffff, #00ff88);
  box-shadow: 0 0 15px #00ffff;
}

.previewFill {
  width: 0%;
  z-index: 3;
  background: red;
  box-shadow: 0 0 18px red;
}
#jumpBtn {
  position: fixed;
  right: 28px;
  bottom: 125px;

  width: 88px;
  height: 88px;

  border: none;
  border-radius: 24px;

  background-image: url("textures/jumpbtn.png");
  background-size: cover;
  background-position: center;

  z-index: 9999;
  pointer-events: auto;

  padding: 0;
  margin: 0;

  box-shadow: 0 0 18px rgba(0,255,255,0.7);
  display: none;
}

#jumpBtn:hover {
  transform: scale(1.05);
}

#jumpCount {
  position: absolute;
  left: 50px;
  top: 36px;

  width: 26px;
  height: 26px;

  border-radius: 50%;

  background: rgba(0,0,0,0.75);
  color: cyan;

  font-size: 18px;
  font-weight: bold;

  display: flex;
  align-items: center;
  justify-content: center;

  pointer-events: none;
}
#sphereInspectPanel {
  max-height: 92vh;
  overflow-y: auto;
}

#inspectLeft,
#inspectRight {
  padding: 18px;
}

#inspectSphereDisplay {
  width: 190px;
  height: 190px;
}

#inspectSphereName {
  font-size: 30px;
  margin-bottom: 14px;
}

#inspectSpherePrice {
  font-size: 22px;
  margin-bottom: 14px;
}

.statBar {
  margin-bottom: 12px;
}

#inspectButtons {
  margin-top: 16px;
}

#backInspectBtn {
  margin-top: 10px;
}
/* ---------- MOBILE / SMALL SCREEN FIT FIXES ---------- */

.screen {
  overflow-y: auto;
  padding: 18px;
}

#mainMenu > div:first-child {
  transform: scale(0.82);
  transform-origin: center;
}

.neonTitle {
  font-size: clamp(56px, 14vw, 120px);
  margin-bottom: 10px;
}

#startBtn {
  padding: 14px 42px !important;
  font-size: 26px !important;
  margin-top: 8px;
}

/* Sphere inspect fit */
#sphereInspectPanel {
  max-height: 88vh;
  overflow-y: auto;
}

#inspectLeft,
#inspectRight {
  padding: 12px;
}

#inspectSphereDisplay {
  width: 165px;
  height: 165px;
}

#inspectButtons {
  margin-top: 10px;
}

#backInspectBtn {
  margin-top: 4px;
  padding: 9px 18px;
}

/* Shop fit */
#shopOverlay {
  overflow-y: auto;
  padding: 18px;
}

#sphereShopOptions {
  max-height: 78vh;
}

#sphereGrid {
  max-height: 62vh;
  padding: 24px;
}

#backToShopBtn {
  margin-top: 6px !important;
  padding: 9px 18px;
}
/* ---------- SPHERE INSPECT LANDSCAPE FIT ---------- */

#sphereInspectPanel {

  max-height: 78vh;

  max-width: 760px;

  transform: scale(0.82);

  transform-origin: center;

  overflow-y: auto;

  border-radius: 22px;

}

#inspectLeft,
#inspectRight {
  padding: 8px;
}

#inspectSphereDisplay {
  width: 145px;
  height: 145px;
}

#inspectSphereName {
  font-size: 26px;
  margin-bottom: 8px;
}

#inspectSpherePrice {
  font-size: 18px;
  margin-bottom: 8px;
}

.statBar {
  margin-bottom: 7px;
}

.statBar span {
  font-size: 13px;
  margin-bottom: 4px;
}

.bar {
  height: 14px;
}
.jumpBarWrap {

  width: 100%;

  display: flex;

  flex-direction: column;

  gap: 4px;

}

.jumpMarkers {

  display: flex;

  justify-content: space-between;

  padding: 0 2px;

  color: #7efcff;

  font-size: 10px;

  font-weight: bold;

  letter-spacing: 1px;

  text-shadow:
    0 0 6px rgba(0,255,255,0.7);

}

.jumpBar {

  position: relative;

}

.jumpDivider {

  position: absolute;

  top: 0;

  width: 2px;

  height: 100%;

  background:
    rgba(255,255,255,0.18);

  z-index: 4;

}

.jumpDivider:nth-child(1) {
  left: 20%;
}

.jumpDivider:nth-child(2) {
  left: 40%;
}

.jumpDivider:nth-child(3) {
  left: 60%;
}

.jumpDivider:nth-child(4) {
  left: 80%;
}

.miniUpgradeBtn,
.miniDowngradeBtn {
  width: 28px;
  height: 28px;
  font-size: 19px;
}

.upgradeExpand {
  margin-top: 6px;
  padding: 8px;
}

.upgradePreview {
  font-size: 14px;
  margin-bottom: 6px;
}

.buyUpgradeBtn,
.cancelUpgradeBtn {
  padding: 7px;
  font-size: 13px;
}

#inspectButtons {

  display: flex;

  flex-wrap: wrap;

  justify-content: center;

  align-items: center;

  gap: 10px;

  margin-top: 18px;

}
#inspectButtons button {

  min-width: 92px;

}
#inspectButtons button,
#backInspectBtn {
  padding: 8px 14px;
  font-size: 14px;
}

#backInspectBtn {
  margin-top: 4px;
}
#profileOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.55);
  background-image: url("textures/profilebg.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #000;
  z-index: 600;
  display: none;
  overflow-y: auto;
  padding: 16px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#changeProfileRoomBtn {
  position: absolute;
  left: 50%;
  bottom: 78px;

  transform: translateX(-50%);

  z-index: 620;

  border-color: gold;
  color: gold;

  box-shadow:
    0 0 12px rgba(255,215,0,0.7);
}
/* Add these rules for profile overlay children */
#profileOverlay h2 {
  text-shadow: 0 0 10px #fff, 0 0 20px #00ccff, 0 0 40px #00ccff;
}

#profileOverlay > div {
  transform: scale(0.92);
  transform-origin: center top;
}

#profileCurrentSphere {
  color: cyan;
  font-size: 24px;
  margin: 20px;
  padding: 20px;
  border: 2px solid cyan;
  border-radius: 50%;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
#sphereChestBtn {
  position: absolute;

  right: 16%;
  bottom: 18%;

  width: 180px;
  height: 120px;

  background: transparent;
  border: 2px solid transparent;

  z-index: 610;
  cursor: pointer;
  pointer-events: auto;

  padding: 0;
  margin: 0;
}

#sphereChestBtn:hover {
  border-color: rgba(0, 255, 255, 0.55);
  box-shadow: 0 0 18px cyan;
  transform: none;
}
#leaderboardMonitorBtn {
  position: absolute;

  left: 34%;
  top: 33%;

  width: 340px;
  height: 120px;

  background: transparent;
  border: 2px solid transparent;

  z-index: 610;

  cursor: pointer;
  pointer-events: auto;
}

#leaderboardMonitorBtn:hover {
  border-color: rgba(0,255,255,0.55);
  box-shadow: 0 0 18px cyan;
}
#leaderboardRoomOverlay {
  position: fixed;
  inset: 0;

  display: none;

  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,0.82);

  z-index: 900;
}

#leaderboardRoomPanel {
  width: 92%;
  max-width: 1100px;
  max-height: 70vh;

  overflow-y: auto;

  padding: 30px;

  border-radius: 20px;

  background: rgba(10,10,20,0.96);

  border: 2px solid cyan;

  box-shadow: 0 0 30px cyan;

  color: white;

  scrollbar-width: none;
  -ms-overflow-style: none;
}

#leaderboardRoomPanel::-webkit-scrollbar {
  display: none;
}

#leaderboardRoomControls {
  display: flex;
  gap: 18px;

  margin-top: 14px;

  align-items: center;
  justify-content: center;
}

#leaderboardRoomControls button {
  min-width: 90px;
}

#profileBestTimes {
  display: flex;
  flex-direction: column;
  gap: 10px;

  margin-top: 20px;
  margin-bottom: 20px;
}

.best-time-row {
  display: grid;

  grid-template-columns:
    1.2fr
    0.8fr
    1.1fr
    0.8fr
    1fr
    1fr;

  align-items: center;

  gap: 12px;

  padding: 6px 12px;

  min-height: 72px;

  overflow: hidden;

  border-radius: 10px;

  background:
    rgba(255,255,255,0.06);

  border:
    2px solid rgba(0,255,255,0.45);
}
.ldrTrophy {
  width: 58px;
  height: 58px;

  object-fit: contain;

  image-rendering: auto;

  filter:
    drop-shadow(0 0 8px rgba(255,255,255,0.35));
}
.best-time-row {
  display: grid;

  grid-template-columns:
    1.4fr
    1fr
    0.9fr
    0.8fr
    1fr;

  align-items: center;
  min-height: 72px;
  gap: 12px;

  padding: 4px 12px;
  overflow: hidden;
  border-radius: 14px;

  background:
    rgba(255,255,255,0.04);

  border:
    2px solid rgba(0,255,255,0.55);
}

.ldrWorldImg {
  height: 124px;

  object-fit: contain;

  filter:
    drop-shadow(0 0 10px rgba(0,255,255,0.45));
}

.ldrMaze,
.ldrTime {
  font-weight: bold;

  color: white;
}

.ldrRank,
.ldrSphere,
.ldrWorld {
  display: flex;

  justify-content: center;

  align-items: center;
}
.ldrSphereImg {
  width: 42px;
  height: 42px;

  border-radius: 50%;

  object-fit: cover;

  box-shadow:
    0 0 12px rgba(0,255,255,0.65);
}

.ldrSphereDot {
  width: 42px;
  height: 42px;

  border-radius: 50%;

  display: inline-block;

  background: cyan;

  box-shadow:
    0 0 12px rgba(0,255,255,0.65);
}
.ldrPlayer {
  font-size: 0.7rem;
  color: #00ffff;
  font-weight: bold;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#leaderboardRoomPanel h2 {
  text-align: center;
}
#closeProfileBtn {
  position: absolute;
  left: 50%;
  bottom: 18px;

  transform: translateX(-50%);

  z-index: 620;
}
#profileTitle {
  position: absolute;
  top: 14%;
  left: 50%;

  transform: translateX(-50%);

  margin: 0 !important;

  z-index: 620;
}
#collectiblesShelfBtn {
  position: absolute;

  left: 9%;
  top: 18%;

  width: 240px;
  height: 300px;

  background: transparent;

  border: 2px solid transparent;

  z-index: 610;

  cursor: pointer;
}

#collectiblesShelfBtn:hover {
  border-color: rgba(255,215,0,0.55);

  box-shadow:
    0 0 18px gold;
}
#collectiblesOverlay {
  position: fixed;
  inset: 0;

  display: none;

  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,0.82);

  z-index: 950;
}

#collectiblesPanel {
  width: 85%;
  max-width: 900px;

  padding: 30px;

  border-radius: 20px;

  background:
    rgba(15,15,25,0.96);

  border:
    2px solid gold;

  color: white;
}

#collectiblesGrid {
  display: grid;

  grid-template-columns:
    repeat(3, 1fr);

  gap: 20px;

  margin-top: 20px;
}

.collectibleSlot {
  aspect-ratio: 1;

  border-radius: 14px;

  display: flex;

  align-items: center;
  justify-content: center;

  background:
    rgba(255,255,255,0.05);

  border:
    2px solid rgba(255,215,0,0.4);
}
#mobileJoystick {
  display: none !important;
}

#joystickBase,
#joystickKnob {
  display: none !important;
}
html,
body,
canvas {
  margin: 0;
  width: 100%;
  height: 100%;

  overflow: hidden;

  touch-action: none;
  overscroll-behavior: none;

  position: fixed;
}
#jungleRelicDisplay {
  display: flex;

  justify-content: center;
  align-items: center;

  gap: 20px;

  width: 100%;
}

.jungleRelicPiece {
  width: 140px;
  max-width: 28vw;

  object-fit: contain;

  filter:
    drop-shadow(0 0 12px rgba(0,255,120,0.45));
}
#levelCompleteRelicBox {
  margin: 14px 0;
  text-align: center;
  color: white;
}

.relicTitle {
  color: #00ff88;
  font-size: 22px;
  font-weight: bold;
  text-shadow: 0 0 10px #00ff88;
  margin-bottom: 8px;
}

#levelCompleteRelics {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.completeRelicPiece {
  width: 72px;
  height: 72px;
  object-fit: contain;

  opacity: 0.18;

  filter:
    grayscale(1)
    brightness(0.45);

  transition: 0.25s;
}

.completeRelicPiece.found {

  opacity: 1;

  filter:
    drop-shadow(0 0 12px #00ff88);

}

#relicProgressText {
  margin-top: 6px;
  font-size: 18px;
  color: #bfffe0;
}
/* Prevent touch zoom on canvas */
canvas {
  touch-action: none;
}

/* Optional: Prevent pull-to-refresh on body */
body {
  overscroll-behavior: none;
  touch-action: pan-y pinch-zoom; /* Allow pinch but prevent panning on body */
}
/* Fix leaderboard scroll and visibility */
#leaderboardEntries {
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  margin: 20px 0;
  scrollbar-width: thin;
  -ms-overflow-style: auto;
}

#leaderboardEntries::-webkit-scrollbar {
  display: block;
  width: 8px;
}

#scoreboardOverlay .screen,
#failureOverlay .screen {
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}

/* Make sure the overlays scroll properly */
#scoreboardOverlay,
#failureOverlay {
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

/* Fix leaderboard entry layout on small screens */
.leaderboard-entry {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px;
  margin: 5px;
  background: #1a1a2e;
  border-radius: 5px;
  color: white;
}

/* Ensure text doesn't overflow */
.leaderboard-entry span {
  word-break: break-word;
  font-size: 14px;
}

/* Make the leaderboard container scrollable */
#scoreboardOverlay > div,
#failureOverlay > div {
  max-height: 85vh;
  overflow-y: auto;
  width: 90%;
  max-width: 500px;
}
/* Victory screen responsive fixes */
#scoreboardOverlay .neonTitle {
  font-size: clamp(32px, 8vw, 60px);
  margin-bottom: 10px;
}

#finalTime {
  font-size: clamp(24px, 6vw, 48px);
}

#leaderboardEntries {
  max-height: 40vh;
  overflow-y: auto;
}
/* Fix victory/leaderboard screen */
#scoreboardOverlay,
#failureOverlay {
  position: absolute;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.96);
  z-index: 30;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

#scoreboardOverlay > div,
#failureOverlay > div {
  width: 100%;
  max-width: 500px;
  margin: auto;
  text-align: center;
}

#leaderboardEntries {
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  margin: 15px 0;
}

/* Make entries readable */
.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 8px 12px;
  margin: 5px 0;

  background: #1a1a2e;
  border-radius: 5px;
  color: white;

  gap: 10px;
  overflow: hidden;
}

.leaderboard-rank {
  min-width: 80px;
}

.leaderboard-time {
  min-width: 70px;
  text-align: right;
}

.leaderboard-entry span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* For small screens */
@media (max-width: 500px) {

  .leaderboard-entry {
    font-size: 12px;
    padding: 6px 8px;
  }

  .leaderboard-rank {
    min-width: 60px;
  }

  #leaderboardEntries {
    max-height: 200px;
  }

}
#welcomeOverlay {

  position: fixed;

  inset: 0;

  display: none;

  align-items: flex-start;

  justify-content: center;

  overflow-y: auto;

  padding: 10px;

  background:
    rgba(0,0,0,0.55);

  backdrop-filter:
    blur(6px);

  z-index: 1200;

}

#welcomePanel {

  width: 94%;

  max-width: 1200px;
  background-position: center center;
  aspect-ratio: 16 / 7.2;

  background-image:
    url("textures/welcome.png");

  background-size: cover;

  background-repeat: no-repeat;

  background-position: center;

  background-color:
    rgba(0,0,0,0.92);

  border: none;

  box-shadow: none;

  position: relative;

}

#welcomePanel h2 {

  margin-top: 0;

  color: #00ffff;

  font-size: 30px;

  text-shadow:
    0 0 18px cyan;

}

.welcomeText {

  font-size: 15px;

  line-height: 1.25;

  color: #d8faff;

}

.welcomeText ul {

  list-style: none;

  padding: 0;

  margin: 14px 0;

}

.welcomeText li {

  margin-bottom: 6px;

}

#welcomeActions {

  display: flex;
  position: absolute;

  bottom: -2%;

  left: 50%;

  transform: translateX(-50%);

  width: 100%;
  justify-content: center;
  align-items: center;

  gap: 20px;

  margin-top: 10px;

}

#hideWelcomeForever {

  color: white;

  font-size: 15px;

  text-decoration: underline;

  cursor: pointer;

  opacity: 0.82;

}

#hideWelcomeForever:hover {

  opacity: 1;

  color: cyan;

}
#startScreenBg {

  position: absolute;

  inset: 0;

  background-image:
    url("textures/strtscreen.png");

  background-size: cover;

 background-position: center 15%;

  background-repeat: no-repeat;

  z-index: 0;

  animation:
    startScreenFlicker 0.55s infinite alternate;

}

@keyframes startScreenFlicker {

  0% {

    background-image:
      url("textures/strtscreen.png");

  }

  100% {

    background-image:
      url("textures/strtscreenz.png");

  }

}

#mainMenu > *:not(#startScreenBg) {

  position: relative;

  z-index: 1;

}
#optionsOverlay {

  position: fixed;

  inset: 0;

  display: none;

  justify-content: center;

  align-items: flex-start;

  overflow-y: auto;

  padding: 10px;

  padding-top: 20px;

  padding-bottom: 20px;

  background:
    rgba(0,0,0,0.55);

  backdrop-filter:
    blur(6px);

  z-index: 1500;

}

#optionsPanel {

  width: 88%;

  max-width: 650px;

  max-height: 85vh;

  overflow-y: scroll;

  padding: 18px;

  border-radius: 26px;

  background:
    rgba(10,10,20,0.94);

  border:
    2px solid rgba(0,255,255,0.45);

  box-shadow:
    0 0 35px rgba(0,255,255,0.35);

  color: white;
  padding-bottom: 80px;
  
}

#optionsPanel h2 {

  margin-top: 0;

  text-align: center;

  color: cyan;

  font-size: 28px;

  text-shadow:
    0 0 18px cyan;

}

.optionSection {

  margin-top: 14px;

}

.optionLabel {

  margin-bottom: 12px;

  font-size: 18px;

  font-weight: bold;

  color: #d8faff;

}

#controlToggleRow {

  display: flex;

  gap: 18px;

}

.controlModeBtn {

  flex: 1;

  padding: 10px;

  font-size: 18px;

  border-radius: 16px;

}

.activeControl {

  border:
    2px solid cyan;

  box-shadow:
    0 0 18px cyan;

  background:
    rgba(0,255,255,0.12);

}

#musicVolumeSlider,
#sfxVolumeSlider {

  width: 100%;

  margin-top: 10px;

}

#closeOptionsBtn {
  
  width: 100%;

  margin-top: 6px;

  padding: 10px;

  font-size: 20px;

}
#musicVolumeSlider,
#sfxVolumeSlider {

  pointer-events: auto;

}

#optionsPanel input[type="range"] {

  width: 100%;

  cursor: pointer;

}
#loadingOverlay {

  position: fixed;

  inset: 0;

  display: none;

  justify-content: center;
  align-items: center;

  overflow: hidden;

  z-index: 999999;

  background: black;

}

#loadingImage {

  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: cover;

  filter:
    brightness(0.45)
    saturate(1.15);

}

#loadingPanel {

  position: absolute;

  inset: 0;

  z-index: 2;

  pointer-events: none;

}

#loadingTitle {

  position: absolute;

  top: 45px;

  left: 50%;

  transform: translateX(-50%);

  font-size: 64px;

  font-weight: bold;

  letter-spacing: 5px;

  color: #e7f5d0;

  text-shadow:
    0 0 12px black,
    0 0 24px rgba(0,255,140,0.45);

}

#loadingRiddle {

  position: absolute;

  left: 90px;

  top: 260px;

  width: 340px;

  white-space: pre-line;

  text-align: left;

  font-size: 38px;

  line-height: 1.6;

  color: #d9e7b4;

  text-shadow:
    0 0 10px black,
    0 0 20px rgba(0,0,0,0.85);

}

#loadingContinueBtn {

  position: absolute;

  left: 50%;

  bottom: 55px;

  transform: translateX(-50%);

  pointer-events: auto;

  font-size: 30px;

  font-weight: bold;

  padding:
    18px 60px;

  border: none;

  border-radius: 14px;

  cursor: pointer;

  color: #f2f0d8;

  background:
    linear-gradient(
      180deg,
      rgba(35,35,35,0.95),
      rgba(12,12,12,0.98)
    );

  border:
    2px solid rgba(180,255,160,0.5);

  box-shadow:
    0 0 20px rgba(0,255,140,0.25);

  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;

}

#loadingContinueBtn:hover {

  transform: scale(1.06);

  box-shadow:
    0 0 30px #00ff88,
    0 0 60px rgba(0,255,136,0.75);

}
#mazeSelectTitleImage {
  width: 180px;
  max-width: 55%;
  margin-bottom: 8px;
  object-fit: contain;
  pointer-events: none;
}
#circleTransitionOverlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999999;
  display: none;

  background: radial-gradient(
    circle at center,
    transparent 0%,
    transparent 18%,
    black 19%,
    black 100%
  );
}
.jumpSideOptionImg {
  width: 170px;
  max-width: 38vw;
  border-radius: 16px;
  opacity: 0.4;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.jumpSideOptionImg.activeJumpSide {
  opacity: 1;
  transform: scale(1.04);
  box-shadow: 0 0 20px cyan;
}
#woodsBackBtn {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  padding: 12px 22px;
  font-size: 16px;
  font-weight: bold;
  display: none;
}

/* --- aMAZEd Profile leaderboard final spacing fix --- */
#profileBestTimes {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}

.best-time-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: clamp(10px, 2vw, 26px) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 0 clamp(20px, 4vw, 52px) !important;
  min-height: 72px !important;
  white-space: nowrap !important;
  overflow: visible !important;
  font-size: clamp(15px, 2.8vw, 22px) !important;
  line-height: 1 !important;
}

.best-time-row > span {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  min-width: 0 !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

.ldrWorldImg {
  width: 150px !important;
  height: 56px !important;
  max-width: 150px !important;
  object-fit: contain !important;
}

.ldrTrophy,
.ldrSphereImg {
  width: 44px !important;
  height: 44px !important;
  object-fit: contain !important;
}

.ldrSphereImg {
  border-radius: 50% !important;
}

.ldrSphereDot {
  width: 40px !important;
  height: 40px !important;
}

.ldrPlayer {
  max-width: 34vw !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: clamp(15px, 2.8vw, 22px) !important;
  text-align: center !important;
}

.ldrTime {
  text-align: right !important;
  font-size: clamp(15px, 2.8vw, 22px) !important;
  font-variant-numeric: tabular-nums !important;
}


/* --- aMAZEd Profile leaderboard sphere thumbnail ball fix --- */
.ldrSphereBall {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  display: inline-block !important;
  flex: 0 0 auto !important;
  background-size: cover !important;
  background-position: center !important;
  box-shadow:
    inset -9px -9px 14px rgba(0,0,0,0.55),
    inset 8px 8px 12px rgba(255,255,255,0.28),
    0 0 12px rgba(0,255,255,0.65) !important;
}
