/* ============================================================
   Sweet Sortie - main stylesheet
   ============================================================ */
/* Google Fonts — loaded via CDN <link> tags in index.html (Fredoka, Nunito). */
/* ---------- theme colors ---------- */
:root {
  --cream: #fff6ec;
  --cream2: #ffe9d6;
  --pink: #ff6fa5;
  --pink-dark: #e14f86;
  --pink-deep: #c7386c;
  --blue: #4fc1e9;
  --blue-dark: #2e9bc7;
  --blue-deep: #1d6e92;
  --mint: #3dd9a6;
  --yellow: #ffc94d;
  --purple: #b18cff;
  --purple-dark: #8f6be0;
  --purple-deep: #6c4cc0;
  --plum: #4a2545;
  --plum-soft: #7a5c74;
  --white: #ffffff;
  --shadow-soft: 0 8px 20px rgba(46, 120, 180, 0.22);
  --ray-bright: #5b6fe0;
  --ray-mid: #3e3fa8;
  --ray-dark: #241c5e;
  --ray-deep: #120b33;
  --gold: #ffd24c;
  --glass-blue: #bfe0ff;
  --card-hi: rgba(255, 255, 255, 0.9);
  --node-ring: rgba(255, 255, 255, 0.85);
}

/* ---------- base ---------- */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Nunito", sans-serif;
  background: radial-gradient(
    ellipse at 50% 8%,
    var(--ray-bright) 0%,
    var(--ray-mid) 32%,
    var(--ray-dark) 72%,
    var(--ray-deep) 100%
  );
  color: var(--white);
}
#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ---------- decorative candy blobs + sunburst rays ---------- */
.bg-decor {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.bg-decor::before {
  content: "";
  position: absolute;
  top: -30%;
  left: -30%;
  right: -30%;
  bottom: -30%;
  background: repeating-conic-gradient(
    from 0deg at 50% 12%,
    rgba(255, 255, 255, 0.035) 0deg 4deg,
    transparent 4deg 9deg
  );
  mix-blend-mode: overlay;
}
.bg-decor::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(
      circle at 22% 18%,
      rgba(255, 255, 255, 0.5) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 78% 12%,
      rgba(255, 255, 255, 0.4) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 12% 55%,
      rgba(255, 255, 255, 0.35) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 88% 46%,
      rgba(255, 255, 255, 0.45) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 32% 82%,
      rgba(255, 255, 255, 0.3) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 68% 90%,
      rgba(255, 255, 255, 0.4) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 50% 40%,
      rgba(255, 255, 255, 0.25) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      ellipse at 50% 100%,
      rgba(6, 4, 20, 0.5) 0%,
      transparent 55%
    ),
    radial-gradient(ellipse at 50% 0%, rgba(6, 4, 20, 0.28) 0%, transparent 45%);
  opacity: 0.9;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.55;
}
.blob.b1 {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, #7a6fe8, transparent 70%);
  top: -90px;
  left: -80px;
}
.blob.b2 {
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, #c15fe0, transparent 70%);
  bottom: -60px;
  right: -70px;
}
.blob.b3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, #4fc1e9, transparent 70%);
  top: 38%;
  right: -70px;
}
.blob.b4 {
  width: 230px;
  height: 230px;
  background: radial-gradient(circle, #8f5fe8, transparent 70%);
  bottom: 14%;
  left: -80px;
}
.blob.b5 {
  width: 190px;
  height: 190px;
  background: radial-gradient(circle, #e86fa8, transparent 70%);
  top: 14%;
  right: 18%;
}

/* ---------- screens ---------- */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  flex-direction: column;
  z-index: 1;
}
.screen.active {
  display: flex;
}

/* ---------- HOME ---------- */
#screen-home {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
  padding: 20px;
  background: radial-gradient(
    ellipse at 50% 0%,
    #8c7df2 0%,
    #6152d6 20%,
    #3e33a8 42%,
    #221a66 70%,
    #120b33 100%
  );
}
#screen-home .bg-decor::after {
  background:
    radial-gradient(
      circle at 22% 18%,
      rgba(255, 255, 255, 0.5) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 78% 12%,
      rgba(255, 255, 255, 0.4) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 12% 55%,
      rgba(255, 255, 255, 0.35) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 88% 46%,
      rgba(255, 255, 255, 0.45) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 32% 82%,
      rgba(255, 255, 255, 0.3) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 68% 90%,
      rgba(255, 255, 255, 0.4) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 50% 40%,
      rgba(255, 255, 255, 0.25) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      ellipse at 50% 100%,
      rgba(10, 6, 35, 0.5) 0%,
      transparent 55%
    ),
    radial-gradient(
      ellipse at 50% 0%,
      rgba(180, 160, 255, 0.28) 0%,
      transparent 45%
    );
}
.home-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: min(60vw, 480px);
  margin: 0 auto;
  background: linear-gradient(
    165deg,
    rgba(150, 130, 235, 0.55),
    rgba(70, 55, 150, 0.5) 55%,
    rgba(45, 35, 110, 0.5)
  );
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 32px;
  padding: 40px 30px 34px;
  backdrop-filter: blur(10px);
  box-shadow:
    0 0 0 6px rgba(140, 120, 255, 0.16),
    0 30px 60px rgba(5, 3, 25, 0.65),
    0 2px 0 rgba(255, 255, 255, 0.1) inset,
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -40px 50px -30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.home-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 6%;
  right: 6%;
  height: 46%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.28),
    rgba(255, 255, 255, 0)
  );
  border-radius: 32px 32px 60% 60%;
  pointer-events: none;
}
.logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}
.logo-glow {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(220, 210, 255, 0.75) 0%,
    rgba(200, 180, 255, 0.2) 55%,
    transparent 75%
  );
  z-index: 0;
  pointer-events: none;
}
.logo-title {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 56px;
  position: relative;
  z-index: 1;
  background: linear-gradient(
    180deg,
    #f0fbff 0%,
    #9fe6ff 28%,
    #4fc1e9 58%,
    #2377b0 88%,
    #1d6e92 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.95);
  filter: drop-shadow(0 2px 0 #c7eeff) drop-shadow(0 6px 0 #1d6e92)
    drop-shadow(0 16px 22px rgba(10, 6, 35, 0.55));
  letter-spacing: 1px;
  line-height: 1.05;
}
.logo-sub {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 19px;
  color: rgba(255, 255, 255, 0.9);
  position: relative;
  z-index: 1;
}
.candy-icon-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  position: relative;
  z-index: 1;
}
.candy-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.15),
    0 3px 6px rgba(0, 0, 0, 0.15);
}

/* ---------- buttons ---------- */
.btn {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 19px;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 16px 34px;
  color: var(--white);
  position: relative;
  overflow: hidden;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.18);
  letter-spacing: 0.3px;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease;
}
.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 46%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.55),
    rgba(255, 255, 255, 0)
  );
  border-radius: 999px 999px 50% 50%;
  pointer-events: none;
}
.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 999px;
  box-shadow: inset 0 -10px 14px -6px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.btn:active {
  transform: translateY(3px);
}
.btn-primary {
  background: linear-gradient(
    180deg,
    #7dd4f5,
    var(--blue) 55%,
    var(--blue-dark)
  );
  box-shadow:
    0 5px 0 var(--blue-deep),
    var(--shadow-soft);
}
.btn-primary:active {
  box-shadow:
    0 2px 0 var(--blue-deep),
    var(--shadow-soft);
}
.btn-secondary {
  background: linear-gradient(
    180deg,
    #d3bfff,
    var(--purple) 55%,
    var(--purple-dark)
  );
  box-shadow:
    0 5px 0 var(--purple-deep),
    0 8px 20px rgba(140, 100, 220, 0.25);
}
.btn-secondary:active {
  box-shadow:
    0 2px 0 var(--purple-deep),
    0 8px 20px rgba(140, 100, 220, 0.25);
}
.btn-mint {
  background: linear-gradient(180deg, #8ff2d3, var(--mint) 55%, #22a87e);
  box-shadow:
    0 5px 0 #26b588,
    0 8px 20px rgba(61, 217, 166, 0.25);
}
.btn-mint:active {
  box-shadow:
    0 2px 0 #26b588,
    0 8px 20px rgba(61, 217, 166, 0.25);
}
.btn-small {
  font-size: 13px;
  padding: 8px 18px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
  width: 230px;
  position: relative;
  z-index: 1;
}

/* floating candies behind the home panel */
.floating-candies {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.floating-candy {
  position: absolute;
  border-radius: 50%;
  opacity: 0.55;
  transition:
    opacity 0.4s ease,
    filter 0.4s ease;
}
.floating-candy.locked {
  opacity: 0.22;
  filter: grayscale(0.85);
}
.sound-toggle.icon-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 5;
  width: clamp(38px, 11vw, 52px);
  height: clamp(38px, 11vw, 52px);
}
.floating-candy .candy {
  width: 100%;
  height: 100%;
}
@keyframes floatDrift {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-18px) rotate(12deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}
.progress-pill {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  background: rgba(20, 55, 120, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 8px 20px;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 210, 76, 0.4);
  display: none;
}
.progress-pill.show {
  display: block;
}
.currency-row {
  display: flex;
  gap: 14px;
  margin-top: 4px;
}
.currency-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 3px 10px rgba(199, 56, 108, 0.12);
  color: var(--plum);
}
.currency-icon {
  width: 16px;
  height: 16px;
}

/* ---------- LEVEL MAP ---------- */
#screen-map {
  overflow: hidden;
}
.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 14px 4px;
  padding: 10px 16px;
  z-index: 3;
  position: relative;
  background: linear-gradient(
    180deg,
    rgba(30, 70, 140, 0.55),
    rgba(15, 45, 100, 0.4)
  );
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 22px;
  box-shadow:
    0 10px 24px rgba(3, 14, 42, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(6px);
}
.icon-btn {
  width: clamp(38px, 11vw, 52px);
  height: clamp(38px, 11vw, 52px);
  border-radius: 50%;
  border: none;
  background: var(--white);
  box-shadow: 0 4px 10px rgba(10, 30, 70, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn svg {
  width: clamp(18px, 5.2vw, 24px);
  height: clamp(18px, 5.2vw, 24px);
}
.icon-btn-bold {
  position: relative;
  border: clamp(2px, 0.7vw, 3px) solid #ffffff;
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.25),
    0 8px 16px rgba(2, 10, 30, 0.45),
    0 0 0 3px rgba(255, 255, 255, 0.25),
    inset 0 2px 3px rgba(255, 255, 255, 0.5);
  transition: transform 0.08s ease;
}
.icon-btn-bold::before {
  content: "";
  position: absolute;
  top: 8%;
  left: 16%;
  width: 42%;
  height: 30%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.75),
    rgba(255, 255, 255, 0)
  );
  border-radius: 50%;
  pointer-events: none;
  filter: blur(0.3px);
}
.icon-btn-bold::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 -10px 12px -6px rgba(0, 0, 0, 0.22);
}
.icon-btn-bold:active {
  transform: translateY(2px);
}
.icon-btn-bold svg {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}
.icon-btn-teal {
  background: linear-gradient(160deg, #6fffd9, var(--mint) 60%, #1c9e76);
}
.icon-btn-blue {
  background: linear-gradient(
    160deg,
    #9fe6ff,
    var(--blue) 60%,
    var(--blue-dark)
  );
}
.icon-btn-orange {
  background: linear-gradient(160deg, #ffde7a 0%, #ffc533 55%, #ffa820 100%);
}
.icon-btn-pink {
  background: linear-gradient(
    160deg,
    #ffafcb,
    var(--pink) 60%,
    var(--pink-dark)
  );
}
.sound-toggle.is-muted {
  background: linear-gradient(160deg, #c7ccd6, #8a93a3 55%, #5b6472) !important;
  opacity: 0.85;
}
.sound-toggle.is-muted::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  box-shadow:
    inset 0 -10px 12px -6px rgba(0, 0, 0, 0.35),
    0 0 0 2px rgba(255, 90, 90, 0.55);
}
.map-title {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--white);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
#map-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  padding: 10px 0 40px;
}
#map-path-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 0;
}

/* level node circles on the path */
.level-node {
  position: relative;
  z-index: 1;
  width: clamp(52px, 15vw, 70px);
  height: clamp(52px, 15vw, 70px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(15px, 4.2vw, 21px);
  color: var(--white);
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.15),
    0 10px 18px rgba(0, 0, 0, 0.22),
    inset 0 2px 3px rgba(255, 255, 255, 0.4);
  cursor: pointer;
  border: 4px solid var(--node-ring);
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.22);
}
.level-node::after {
  content: "";
  position: absolute;
  top: 8%;
  left: 16%;
  width: 38%;
  height: 26%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.55),
    rgba(255, 255, 255, 0)
  );
  border-radius: 50%;
  pointer-events: none;
  filter: blur(0.3px);
}
.level-node.locked {
  background: linear-gradient(160deg, #e8e1dc, #b9afab);
  color: #fff;
  cursor: default;
  box-shadow:
    0 6px 0 #9c918c,
    inset 0 2px 3px rgba(255, 255, 255, 0.3);
}
.level-node.current {
  animation: pulseNode 1.4s ease-in-out infinite;
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.15),
    0 0 0 6px rgba(255, 255, 255, 0.18),
    0 10px 18px rgba(0, 0, 0, 0.22),
    inset 0 2px 3px rgba(255, 255, 255, 0.4);
}
@keyframes pulseNode {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}
.node-stars {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
}
.world-banner {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--white);
  padding: 8px 26px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.45);
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.map-decor-candy {
  position: absolute;
  width: 36px;
  height: 36px;
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}
.node-star {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}
.map-row {
  position: relative;
  height: 100px;
  display: flex;
  align-items: center;
}

/* ---------- GAME SCREEN ---------- */
#screen-game {
}
.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 14px 2px;
  padding: clamp(6px, 2vw, 10px) clamp(10px, 4vw, 16px);
  z-index: 2;
  position: relative;
  background: linear-gradient(
    180deg,
    rgba(30, 70, 140, 0.55),
    rgba(15, 45, 100, 0.4)
  );
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 22px;
  box-shadow:
    0 10px 24px rgba(3, 14, 42, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(6px);
}
.game-top-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.level-label {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.counter-badges {
  display: flex;
  gap: 12px;
}
.counter-badge {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.12),
    rgba(10, 30, 70, 0.5)
  );
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  padding: 6px 20px;
  text-align: center;
  min-width: 64px;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.25),
    inset 0 0 10px rgba(255, 255, 255, 0.1);
}
.counter-num {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 26px;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 210, 76, 0.55);
  line-height: 1.1;
}
.counter-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--glass-blue);
}

/* tube play area */
#tubes-container {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: clamp(10px, 2.8vw, 26px) clamp(9px, 2.4vw, 24px);
  padding: clamp(6px, 1.8vw, 10px) clamp(8px, 2.5vw, 20px);
  overflow: visible;
  position: relative;
}
#tubes-container::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  bottom: 6%;
  background: radial-gradient(
    ellipse 60% 100% at 50% 0%,
    rgba(0, 0, 0, 0.18),
    transparent 70%
  );
  pointer-events: none;
  z-index: -1;
}

/* ---------- tubes ---------- */
.tube {
  width: clamp(40px, 12vw, 60px);
  height: clamp(140px, 32vh, 190px);
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  filter: drop-shadow(0 6px 8px rgba(74, 37, 69, 0.18));
  transition: transform 0.15s ease;
}
.tube::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 70%;
  height: 10px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.32), transparent 72%);
  transform: translateX(-50%);
  z-index: -1;
  pointer-events: none;
}
.tube.selected {
  transform: translateY(-14px);
}
.tube-glass {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px 8px 26px 26px;
  background: linear-gradient(
    180deg,
    rgba(230, 248, 255, 0.7),
    rgba(191, 224, 255, 0.22) 38%,
    rgba(224, 244, 255, 0.5) 78%,
    rgba(255, 255, 255, 0.15) 100%
  );
  border: 3.5px solid rgba(230, 248, 255, 0.95);
  box-shadow:
    inset 0 0 16px rgba(255, 255, 255, 0.7),
    inset 0 -8px 14px rgba(79, 151, 242, 0.15),
    inset 4px 0 8px rgba(255, 255, 255, 0.3),
    0 0 12px rgba(120, 190, 255, 0.4),
    0 6px 14px rgba(20, 40, 80, 0.25);
  overflow: hidden;
  backdrop-filter: blur(1px);
}
.tube-glass::after {
  content: "";
  position: absolute;
  top: 6%;
  left: 12%;
  width: 20%;
  bottom: 10%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0.3) 55%,
    rgba(255, 255, 255, 0.05)
  );
  border-radius: 10px;
  filter: blur(0.4px);
  pointer-events: none;
}
.tube-accent-base {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0;
  height: 14%;
  background: linear-gradient(
    180deg,
    rgba(120, 190, 255, 0.05),
    rgba(79, 151, 242, 0.35) 60%,
    rgba(45, 110, 200, 0.45)
  );
  border-radius: 0 0 20px 20px;
  pointer-events: none;
}
.tube-sparkle {
  position: absolute;
  top: 16%;
  right: 20%;
  width: 10%;
  height: 5%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0)
  );
  border-radius: 50%;
  pointer-events: none;
}
.tube-rim {
  position: absolute;
  top: -6px;
  left: -4px;
  right: -4px;
  height: 10px;
  background: rgba(224, 244, 255, 0.95);
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
/* shared glossy diagonal shine, only for the plain CSS-shaped classic skin */
.tube.tilt-left,
.tube.tilt-right {
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}
.tube-receive-bounce {
  animation: receiveBounce 0.35s ease;
}
.candy-ghost {
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
  will-change: transform;
}
@keyframes receiveBounce {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}
.liquid-stack {
  position: absolute;
  left: 3px;
  right: 3px;
  top: 3px;
  bottom: 3px;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 4px 4px 22px 22px;
  overflow: hidden;
}
.candy-slot {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- candies ---------- */
.candy {
  width: 76%;
  aspect-ratio: 1/1;
  border-radius: 50%;
  position: relative;
  border: 3px solid var(--outline);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.32);
}
.candy::after {
  content: "";
  position: absolute;
  top: 13%;
  left: 20%;
  width: 32%;
  height: 19%;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  filter: blur(0.5px);
  transform: rotate(-20deg);
  pointer-events: none;
}
.candy-shape {
  border-radius: 0;
  border: none;
  isolation: isolate;
}
.shape-outline {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--outline);
  z-index: -1;
  transform: scale(1.08);
}

/* donut (ring) */
.candy-donut {
  background: radial-gradient(
    circle at 50% 50%,
    transparent 0% 30%,
    var(--outline) 30% 35%,
    var(--c-light) 35% 78%,
    var(--c) 78% 88%,
    var(--outline) 88% 100%
  );
}
/* gummy (spool/pinched pillow) - shape via inline clip-path */
.candy-gummy {
  background:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.45) 0%,
      rgba(255, 255, 255, 0.05) 45%,
      rgba(0, 0, 0, 0.12) 100%
    ),
    var(--c);
}
/* jellybean (kidney curve) - shape via inline clip-path */
.candy-jellybean {
  transform: rotate(-15deg);
  background:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.5) 0%,
      rgba(255, 255, 255, 0.05) 45%,
      rgba(0, 0, 0, 0.11) 100%
    ),
    var(--c);
}
.candy-solid {
  background:
    radial-gradient(
      ellipse 32% 24% at 32% 22%,
      rgba(255, 255, 255, 0.95) 0%,
      rgba(255, 255, 255, 0.5) 40%,
      rgba(255, 255, 255, 0) 100%
    ),
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.35) 0%,
      rgba(255, 255, 255, 0.02) 40%,
      rgba(0, 0, 0, 0.12) 100%
    ),
    var(--c);
}
.candy-swirl {
  background:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 0.05) 45%,
      rgba(0, 0, 0, 0.11) 100%
    ),
    repeating-conic-gradient(var(--c) 0deg 22.5deg, #ffffff 22.5deg 45deg);
}
.candy-stripe {
  background:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 0.05) 45%,
      rgba(0, 0, 0, 0.11) 100%
    ),
    repeating-linear-gradient(180deg, var(--c) 0 13%, #ffffff 13% 22%);
}
/* gem (hexagon facets) - shape via inline clip-path */
.candy-gem {
  background:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 0.05) 45%,
      rgba(0, 0, 0, 0.11) 100%
    ),
    repeating-conic-gradient(
      var(--c-light) 0deg 15deg,
      var(--c) 15deg 30deg,
      var(--c-dark) 30deg 45deg,
      var(--c) 45deg 60deg
    );
}
/* cream cookie (wafer bands + cream center) */
.candy-creamcookie {
  background:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.35) 0%,
      rgba(255, 255, 255, 0.05) 45%,
      rgba(0, 0, 0, 0.1) 100%
    ),
    linear-gradient(
      180deg,
      var(--wafer) 0% 16%,
      var(--c-light) 18% 82%,
      var(--wafer) 84% 100%
    );
}
/* cake slice (wedge, layered frosting) - shape via inline clip-path */
.candy-cakeslice {
  background:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.35) 0%,
      rgba(255, 255, 255, 0.05) 40%,
      rgba(0, 0, 0, 0.11) 100%
    ),
    linear-gradient(180deg, var(--c-light) 0% 22%, var(--c) 24% 100%);
}
/* lollipop (circle head + simple stick) */
.candy-lollipop {
  isolation: isolate;
  background:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 0.05) 45%,
      rgba(0, 0, 0, 0.11) 100%
    ),
    repeating-conic-gradient(
      var(--c) 0deg 22.5deg,
      var(--c-light) 22.5deg 45deg
    );
}
.lollipop-stick {
  position: absolute;
  left: 50%;
  top: 94%;
  width: 10%;
  height: 22%;
  background: linear-gradient(90deg, #f0e4d0, #ffffff, #f0e4d0);
  border: 2px solid var(--outline);
  border-top: none;
  transform: translateX(-50%);
  border-radius: 0 0 3px 3px;
  z-index: -1;
}
/* chocolate bar (segmented rectangle, no clip-path needed) */
/* biscuit (rectangular cracker with fork-hole dots) */
.candy-biscuit {
  width: 86%;
  aspect-ratio: 1.2/1;
  border-radius: 18%;
  border: 3px solid var(--outline);
  background:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.3) 0%,
      rgba(255, 255, 255, 0.02) 40%,
      rgba(0, 0, 0, 0.09) 100%
    ),
    radial-gradient(circle at 25% 28%, var(--c-darker) 0 6%, transparent 6.5%),
    radial-gradient(circle at 50% 26%, var(--c-darker) 0 6%, transparent 6.5%),
    radial-gradient(circle at 75% 28%, var(--c-darker) 0 6%, transparent 6.5%),
    radial-gradient(circle at 25% 50%, var(--c-darker) 0 6%, transparent 6.5%),
    radial-gradient(circle at 50% 50%, var(--c-darker) 0 6%, transparent 6.5%),
    radial-gradient(circle at 75% 50%, var(--c-darker) 0 6%, transparent 6.5%),
    radial-gradient(circle at 25% 72%, var(--c-darker) 0 6%, transparent 6.5%),
    radial-gradient(circle at 50% 72%, var(--c-darker) 0 6%, transparent 6.5%),
    radial-gradient(circle at 75% 72%, var(--c-darker) 0 6%, transparent 6.5%),
    var(--c-light);
}
/* confetti (speckled dragée ball) */
.candy-confetti {
  background:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.3) 0%,
      rgba(255, 255, 255, 0.04) 45%,
      rgba(0, 0, 0, 0.13) 100%
    ),
    radial-gradient(circle at 61% 65%, #b18cff 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 54% 41%, #ffffff 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 69% 57%, #3dd9a6 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 51% 72%, #3dd9a6 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 60% 30%, #ffffff 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 23% 21%, #3dd9a6 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 14% 31%, #ff6fa5 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 52% 60%, #3dd9a6 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 41% 86%, #ffd24c 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 26% 39%, #3dd9a6 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 65% 82%, #3dd9a6 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 16% 57%, #ff6fa5 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 36% 71%, #ff6fa5 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 68% 48%, #ffffff 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 40% 46%, #4fc1e9 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 44% 34%, #ffffff 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 80% 49%, #ff6fa5 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 37% 62%, #b18cff 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 35% 37%, #ff6fa5 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 70% 32%, #ff6fa5 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 87% 40%, #ffd24c 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 48% 20%, #ff6fa5 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 57% 12%, #b18cff 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 23% 72%, #ff6fa5 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 29% 52%, #ff6fa5 0 5.2%, transparent 5.6%),
    radial-gradient(circle at 59% 54%, #ffd24c 0 5.2%, transparent 5.6%),
    var(--c-dark);
}
.sprinkle {
  position: absolute;
  width: 16%;
  height: 5%;
  border-radius: 3px;
  pointer-events: none;
  box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

/* unlock banner + control buttons */
.unlock-banner {
  position: absolute;
  top: 74px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: var(--pink);
  color: var(--white);
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 20px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(199, 56, 108, 0.35);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}
.unlock-banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.controls-bar {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 14px 20px;
  flex-wrap: wrap;
  margin: 0 14px 16px;
  border-radius: 26px;
  background: linear-gradient(
    180deg,
    rgba(30, 70, 140, 0.4),
    rgba(15, 45, 100, 0.32)
  );
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 10px 24px rgba(3, 14, 42, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
}
.ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  min-width: 60px;
  position: relative;
}
.ctrl-btn-circle {
  width: clamp(56px, 15vw, 76px);
  height: clamp(56px, 15vw, 76px);
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #ffffff;
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.22),
    0 10px 20px rgba(2, 10, 30, 0.4),
    0 0 0 3px rgba(255, 255, 255, 0.22),
    inset 0 2px 4px rgba(255, 255, 255, 0.4);
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease;
}
.ctrl-btn-circle::before {
  content: "";
  position: absolute;
  top: 8%;
  left: 16%;
  width: 42%;
  height: 28%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.7),
    rgba(255, 255, 255, 0)
  );
  border-radius: 50%;
  pointer-events: none;
}
.ctrl-btn-circle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 -12px 14px -7px rgba(0, 0, 0, 0.2);
}
.ctrl-btn-circle svg {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
  width: 40%;
  height: 40%;
}
.ctrl-btn:active .ctrl-btn-circle {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.22),
    0 4px 8px rgba(0, 0, 0, 0.25),
    inset 0 2px 4px rgba(255, 255, 255, 0.4);
}
.ctrl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ctrl-btn:disabled .ctrl-btn-circle {
  transform: none;
}
.ctrl-btn-undo .ctrl-btn-circle {
  background: linear-gradient(
    160deg,
    #ffafcb,
    var(--pink) 60%,
    var(--pink-dark)
  );
}
.ctrl-btn-hint .ctrl-btn-circle {
  background: linear-gradient(160deg, #ffe68a, var(--yellow) 55%, #e8940a);
}
.ctrl-btn-tube .ctrl-btn-circle {
  background: linear-gradient(
    160deg,
    #e3d3ff,
    var(--purple) 60%,
    var(--purple-dark)
  );
}
.ctrl-label {
  font-size: 13px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.ctrl-badge {
  position: absolute;
  top: -5px;
  right: -7px;
  background: var(--white);
  color: var(--plum);
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(0, 0, 0, 0.06);
}
.ctrl-btn.hint-glow .ctrl-btn-circle {
  animation: hintPulse 1s ease-in-out infinite;
}
@keyframes hintPulse {
  0%,
  100% {
    box-shadow:
      0 5px 0 rgba(0, 0, 0, 0.08),
      0 0 0 rgba(255, 201, 77, 0);
  }
  50% {
    box-shadow:
      0 5px 0 rgba(0, 0, 0, 0.08),
      0 0 18px rgba(255, 201, 77, 0.9);
  }
}
.hint-glowtube {
  animation: tubeHint 0.9s ease-in-out infinite;
}
@keyframes tubeHint {
  0%,
  100% {
    filter: drop-shadow(0 6px 8px rgba(74, 37, 69, 0.18));
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(255, 201, 77, 0.95));
  }
}

/* ---------- MODAL ---------- */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(74, 37, 69, 0.45);
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active {
  display: flex;
}
.modal-card {
  background: var(--white);
  border-radius: 28px;
  padding: clamp(28px, 4vw, 40px) clamp(24px, 3.5vw, 36px);
  text-align: center;
  width: 100%;
  max-width: clamp(320px, 32vw, 480px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.modal-title {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(24px, 2.6vw, 32px);
  color: var(--blue-deep);
  margin-bottom: 6px;
}
.modal-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0;
}
.modal-star {
  width: clamp(64px, 7vw, 84px);
  height: clamp(64px, 7vw, 84px);
  opacity: 0;
  transform: scale(0);
  filter: drop-shadow(0 5px 4px rgba(199, 148, 10, 0.35));
}
.modal-star.show {
  animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes starPop {
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.modal-stats {
  font-size: 14px;
  font-weight: 800;
  color: var(--plum-soft);
  margin-bottom: 16px;
}
.howto-card {
  text-align: left;
  max-width: 380px;
}
.howto-card .btn {
  font-size: 21px;
  padding: 17px 34px;
}
.howto-card .modal-title {
  text-align: center;
}
.howto-list {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.howto-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--plum);
  line-height: 1.4;
}
.howto-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  font-family: "Fredoka", sans-serif;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 var(--blue-deep);
}
.howto-text {
  flex: 1;
  padding-top: 2px;
}
.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* confetti layer (win celebration) */
#confetti-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 20;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  border-radius: 2px;
}
.hidden {
  display: none !important;
}

/* svg-defs: hidden SVG gradient definitions */
.svg-defs {
  position: absolute;
}

/* logo lollipop candy — fixed brand colors */
.logo-lollipop {
  --c: #ff6fa5;
  --c-light: #ffe1ec;
  --outline: #8f2a51;
}

/* candy-icon-row dots */
.candy-dot-1 {
  background: #ff6b8b;
}
.candy-dot-2 {
  background: #4fc1e9;
}
.candy-dot-3 {
  background: #ffc94d;
}
.candy-dot-4 {
  background: #3dd9a6;
}
.candy-dot-5 {
  background: #b18cff;
}

/* map header spacer (balances the back button) */
.map-header-spacer {
  width: 40px;
}

/* home logo lollipop */
.logo-lollipop-wrap {
  width: 92px;
  height: 112px;
  margin-bottom: 2px;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  filter: drop-shadow(0 14px 16px rgba(10, 6, 35, 0.5));
  animation: logoBob 3.2s ease-in-out infinite;
}
@keyframes logoBob {
  0%,
  100% {
    transform: rotate(-6deg) translateY(0px);
  }
  50% {
    transform: rotate(5deg) translateY(-6px);
  }
}
.logo-lollipop-wrap .candy {
  width: 82px;
  height: 82px;
  border-width: 4px;
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.3),
    inset 0 3px 5px rgba(255, 255, 255, 0.5);
}

/* ---------- responsive ---------- */
@media (max-width: 380px) {
  .tube {
    width: 46px;
    height: 151px;
  }
}
@media (max-width: 700px) {
  .home-panel {
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    padding: 20px 12px;
    max-width: 380px;
    border-radius: 0;
  }
  .home-panel::before {
    display: none;
  }
}
