:root { --u: min(1vw, 1vh); }

body {
  margin: 0;
  overflow: hidden;
  background-color: skyblue;
  font-family: 'Baloo 2', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: black;
}

#instructions {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: skyblue;
  color: black;
  font-family: monospace;
  font-size: clamp(16px, calc(var(--u) * 2.5), 28px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  box-sizing: border-box;
  text-align: left;
  line-height: 1.5;
  overflow: auto; /* allow scroll at extreme zoom */
}

.mobile-hint { display: none; }
.desktop-hint { display: block; }
.mobile-only { display: none; }
.desktop-only { display: inline; }
@media (pointer: coarse), (hover: none) {
  .mobile-hint { display: block; }
  .desktop-hint { display: none; }
  .mobile-only { display: inline; }
  .desktop-only { display: none; }
}

/* Remove old continue-hint logic */

#mobile-start {
  font-size: 1em;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: #0b74ff;
  color: #fff;
}

.intro-bullets { margin: 8px 0 10px 22px; }
.ico { display:inline-block; width:1.4em; height:1.4em; vertical-align:-0.25em; }
.ico svg { width:100%; height:100%; display:block; }

#game-area {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#butterfly {
  position: absolute;
  font-size: calc(var(--u) * 3.3);
  left: 0;
  top: 50%;
  transform-origin: 50% 50%;
  transition: transform 120ms ease;
}

/* removed mobile speed bar */

/* Super timer badge next to butterfly */
#super-timer {
  position: absolute;
  font-size: calc(var(--u) * 3);
  color: #000;
  background: transparent;
  z-index: 9000;
}
#super-timer[hidden] { display: none !important; }

.flower {
  position: absolute;
  font-size: calc(var(--u) * 4.2);
  pointer-events: none;
}

.net {
  position: absolute;
  width: calc(var(--u) * 5.5);
  height: calc(var(--u) * 5.5);
  font-size: 32px;
  color: red;
  content: 'X';
  transform-origin: center center;
}

/* HUD container - responsive row with wrapping */
#hud {
  position: absolute;
  top: 6px;
  left: 10px;
  right: 10px;
  font-size: clamp(12px, calc(var(--u) * 3), 24px);
  display: flex;
  flex-wrap: wrap;
  column-gap: 12px;
  row-gap: 4px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5), 0 2px 4px rgba(0,0,0,0.25);
}

/* Place Skill at the end of the row; it will wrap if space is tight */
#skill {
  margin-left: auto;
  padding-left: 12px;
}

#mute-btn {
  margin-left: 16px;
  font-size: 18px;
  padding: 2px 8px;
  border: none;
  background: rgba(255,255,255,0.5);
  border-radius: 6px;
  cursor: pointer;
}
 #mute-btn:focus { outline: 2px solid rgba(0,0,0,0.3); }

#mute-sfx, #mute-music {
  margin-left: 8px;
  font-size: 18px;
  padding: 2px 8px;
  border: none;
  background: rgba(255,255,255,0.5);
  border-radius: 6px;
  cursor: pointer;
}
#mute-sfx:focus, #mute-music:focus { outline: 2px solid rgba(0,0,0,0.3); }

#music-volume {
  vertical-align: middle;
  width: 120px;
  margin-left: 8px;
}

#game-over {
  position: absolute;
  top: 40%;
  width: 100%;
  text-align: center;
  font-size: calc(var(--u) * 3.3);
}
#leaderboard {
  margin-top: 12px;
  font-size: calc(var(--u) * 2.4);
}

#pause-message {
  position: absolute;
  top: 45%;
  width: 100%;
  text-align: center;
  font-size: calc(var(--u) * 3.3);
  color: black;
}

/* ✅ New rule to force-hide instructions when hidden */
#instructions[hidden] {
  display: none !important;
}

/* Level-up overlay */
#levelup {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.35);
  z-index: 10000; /* always above clouds, nets, flowers */
}
#levelup[hidden] { display: none !important; }
.levelup-wrap {
  background: rgba(255,255,255,0.9);
  color: #0c2340;
  padding: 24px 28px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  text-align: center;
}

/* Super message shares same overlay style */
#supermsg { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.35); z-index: 10000; }
#supermsg[hidden] { display: none !important; }
/* Flower and net overlays share style */
#flowermsg { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.35); z-index: 10000; }
#flowermsg[hidden] { display: none !important; }
#netmsg { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.35); z-index: 10000; }
#netmsg[hidden] { display: none !important; }
/* Skill tutorial - more compact */
#skillmsg { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.35); z-index: 10000; }
#skillmsg[hidden] { display: none !important; }
#skillmsg .levelup-wrap { 
  padding: 16px 20px; 
  max-width: 400px; 
  font-size: 0.9em; 
}

/* Training banner overlay */
#training-banner { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.35); z-index: 10000; }
#training-banner[hidden] { display: none !important; }

/* Mobile overlays */
#rotate-overlay, #tap-start { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.35); z-index: 10000; }
#rotate-overlay[hidden], #tap-start[hidden] { display: none !important; }

/* Gesture locks during gameplay */
.touch-lock {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

/* Parallax sky */
#sky {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  background: linear-gradient(#90d7f5, #8cd0f0);
}
.cloud {
  position: absolute;
  width: calc(var(--u) * 16);
  height: calc(var(--u) * 8);
  filter: blur(0.4px);
  animation: drift linear infinite;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  border-radius: 50% / 40%;
  /* Soft oval mask to remove any straight edges from the bounding box */
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 68%, transparent 70%);
          mask-image: radial-gradient(ellipse at 50% 50%, #000 68%, transparent 70%);
  pointer-events: none;
}
/* Pause cloud animation when game is paused */
.paused .cloud { animation-play-state: paused !important; }

/* Fun cloud silhouettes using CSS gradients (no images) */
.cloud-puff {
  background:
    radial-gradient(ellipse at 20% 60%, rgba(255,255,255,0.95) 0 60%, rgba(255,255,255,0) 61%),
    radial-gradient(ellipse at 45% 40%, rgba(255,255,255,0.95) 0 62%, rgba(255,255,255,0) 63%),
    radial-gradient(ellipse at 70% 55%, rgba(255,255,255,0.95) 0 58%, rgba(255,255,255,0) 59%),
    radial-gradient(ellipse at 85% 50%, rgba(255,255,255,0.9) 0 48%, rgba(255,255,255,0) 49%);
}
.cloud-chicken {
  background:
    radial-gradient(ellipse at 25% 60%, rgba(255,255,255,0.97) 0 56%, transparent 57%), /* body */
    radial-gradient(ellipse at 45% 40%, rgba(255,255,255,0.97) 0 48%, transparent 49%), /* head */
    radial-gradient(ellipse at 65% 35%, rgba(255,255,255,0.97) 0 33%, transparent 34%), /* comb */
    radial-gradient(ellipse at 18% 75%, rgba(255,255,255,0.97) 0 35%, transparent 36%); /* tail */
}
.cloud-dino {
  background:
    radial-gradient(ellipse at 30% 55%, rgba(255,255,255,0.97) 0 60%, transparent 61%), /* body */
    radial-gradient(ellipse at 55% 35%, rgba(255,255,255,0.97) 0 36%, transparent 37%), /* head */
    radial-gradient(ellipse at 60% 20%, rgba(255,255,255,0.97) 0 20%, transparent 21%), /* crest */
    radial-gradient(ellipse at 15% 70%, rgba(255,255,255,0.97) 0 26%, transparent 27%); /* tail */
}
.cloud-eggplant {
  background:
    radial-gradient(ellipse at 35% 60%, rgba(255,255,255,0.97) 0 60%, transparent 61%), /* body */
    radial-gradient(ellipse at 60% 35%, rgba(255,255,255,0.97) 0 28%, transparent 29%), /* cap */
    radial-gradient(ellipse at 75% 45%, rgba(255,255,255,0.97) 0 22%, transparent 23%); /* tip */
}

/* Level 3 winds */
.wind {
  position: absolute;
  width: calc(var(--u) * 16);
  height: calc(var(--u) * 8);
  filter: blur(0.2px);
  z-index: 0;
}
@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(160vw); }
}

/* Flower pop animation on collect */
.flower.pop {
  animation: popOut 300ms ease forwards;
}
@keyframes popOut {
  0%   { transform: scale(1); opacity: 1; }
  80%  { transform: scale(1.4); opacity: 0.9; }
  100% { transform: scale(0.2); opacity: 0; }
}

/* Screen shake for hits */
.shake {
  animation: shake 150ms ease;
}
@keyframes shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(3px, -2px); }
  50% { transform: translate(-2px, 2px); }
  75% { transform: translate(2px, -1px); }
  100% { transform: translate(0, 0); }
}

/* Developer Mode Styles */
.dev-tab {
  background: none;
  border: none;
  color: #0f0;
  padding: 6px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: monospace;
  font-size: 12px;
}

.dev-tab:hover {
  background: rgba(0, 255, 0, 0.1);
}

.dev-tab.active {
  border-bottom-color: #0f0;
  color: #fff;
}

.dev-tab-content {
  line-height: 1.4;
}

.dev-tab-content label {
  cursor: pointer;
  user-select: none;
}

.dev-tab-content input[type="checkbox"] {
  margin-right: 6px;
}

.dev-tab-content input[type="number"] {
  background: rgba(0, 255, 0, 0.1);
  border: 1px solid #0f0;
  color: #0f0;
  padding: 2px 4px;
  font-family: monospace;
}

.dev-tab-content button {
  background: rgba(0, 255, 0, 0.2);
  border: 1px solid #0f0;
  color: #0f0;
  padding: 4px 8px;
  cursor: pointer;
  font-family: monospace;
  font-size: 11px;
}

.dev-tab-content button:hover {
  background: rgba(0, 255, 0, 0.3);
}