/* ============================================================
   Bubble Catch — Styles
   ============================================================ */

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

body {
  overflow: hidden;
  background: #1a2a3a;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #fff;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

canvas#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

.hidden { display: none !important; }

/* --- Start Screen --- */
#start-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1a3a2a 0%, #2a4a3a 40%, #1a2a1a 100%);
  z-index: 100;
}

.title-card {
  text-align: center;
  animation: fadeIn 0.8s ease-out;
}

.title-card h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 800;
  background: linear-gradient(135deg, #7BC950, #FFD93D, #FF8C42);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: clamp(1rem, 3vw, 1.4rem);
  color: rgba(255,255,255,0.7);
  margin-bottom: 2rem;
}

#play-btn {
  font-size: 1.3rem;
  padding: 0.8rem 2.5rem;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, #7BC950, #4A8C3F);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

#play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(96,165,250,0.4);
}

.controls-hint {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
}

.mobile-hint { display: none; }

@media (max-width: 768px), (pointer: coarse) {
  .desktop-hint { display: none; }
  .mobile-hint { display: inline; }
}

/* --- Loading Screen --- */
#loading-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #1a2a3a;
  z-index: 99;
}

.loader { text-align: center; }

.loader-bubble {
  width: 60px; height: 60px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(150,200,255,0.8), rgba(100,150,255,0.2));
  border: 2px solid rgba(150,200,255,0.3);
  animation: bubbleFloat 2s ease-in-out infinite;
}

.progress-bar {
  width: 200px; height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin-top: 1rem;
  overflow: hidden;
}

#progress-fill {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, #7BC950, #FFD93D);
  border-radius: 2px;
  transition: width 0.3s ease-out;
}

/* --- HUD --- */
#hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
}

#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 20px; height: 20px;
}

.cross-h, .cross-v {
  position: absolute;
  background: rgba(255,255,255,0.6);
  border-radius: 1px;
}

.cross-h {
  width: 20px; height: 2px;
  top: 50%; left: 0;
  transform: translateY(-50%);
}

.cross-v {
  width: 2px; height: 20px;
  left: 50%; top: 0;
  transform: translateX(-50%);
}

#crosshair.locked .cross-h,
#crosshair.locked .cross-v {
  background: rgba(150, 255, 180, 0.9);
  animation: crosshairPulse 0.8s ease-in-out infinite;
}

#creature-counter {
  position: absolute;
  top: 20px; right: 20px;
  font-size: 1.4rem;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

#caught-count {
  color: #7BC950;
}

.counter-label {
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0.6;
  margin-left: 4px;
}

#bubble-indicator {
  position: absolute;
  bottom: 30px; right: 30px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(123,201,80,0.4);
  overflow: hidden;
}

#bubble-cooldown {
  width: 100%; height: 100%;
  background: rgba(123,201,80,0.3);
  transform-origin: bottom;
  transform: scaleY(1);
  transition: transform 0.05s linear;
}

#hint {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  animation: hintFade 0.5s ease-out;
  pointer-events: none;
}

/* --- Gallery --- */
#gallery {
  position: fixed; inset: 0;
  background: rgba(10, 10, 26, 0.92);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}

.gallery-inner {
  text-align: center;
  max-width: 600px;
  width: 90%;
}

.gallery-inner h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #7BC950, #4A8C3F);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.creature-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: border-color 0.3s;
}

.creature-card.caught {
  border-color: rgba(123, 201, 80, 0.5);
  background: rgba(123, 201, 80, 0.08);
}

.creature-card .name {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.creature-card .count {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
}

.creature-card .difficulty {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.3);
  margin-top: 0.3rem;
}

#gallery-close {
  font-size: 1rem;
  padding: 0.6rem 2rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

#gallery-close:hover {
  background: rgba(255,255,255,0.1);
}

/* --- Win Screen --- */
#win-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(10px);
  z-index: 60;
  animation: fadeIn 0.5s ease-out;
}

.win-card {
  text-align: center;
}

.win-card h1 {
  font-size: clamp(2rem, 6vw, 3.5rem);
  background: linear-gradient(135deg, #FFD93D, #FF8C42, #7BC950);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.win-card p {
  color: rgba(255,255,255,0.6);
  margin-bottom: 2rem;
}

#win-continue {
  font-size: 1.1rem;
  padding: 0.7rem 2rem;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, #FFD93D, #FF8C42);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* --- Pause Overlay --- */
#pause-overlay {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(10, 10, 26, 0.6);
  backdrop-filter: blur(4px);
  z-index: 40;
  cursor: pointer;
}

#pause-overlay p { font-size: 1.5rem; }
#pause-overlay .small { font-size: 0.85rem; color: rgba(255,255,255,0.4); margin-top: 0.5rem; }

/* --- Mobile Controls --- */
#mobile-controls {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 15;
}

#joystick-zone {
  position: absolute;
  left: 0; bottom: 0;
  width: 40%; height: 50%;
  pointer-events: auto;
}

#mobile-shoot-btn {
  position: absolute;
  right: 20px; bottom: 80px;
  width: 70px; height: 70px;
  border-radius: 50%;
  border: 2px solid rgba(123,201,80,0.5);
  background: rgba(123,201,80,0.2);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  pointer-events: auto;
  cursor: pointer;
}

#mobile-gallery-btn {
  position: absolute;
  top: 20px; left: 20px;
  padding: 0.4rem 0.8rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(0,0,0,0.3);
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  pointer-events: auto;
  cursor: pointer;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.05); }
}

@keyframes crosshairPulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.5; }
}

@keyframes hintFade {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- Capture flash overlay --- */
.capture-flash {
  position: fixed; inset: 0;
  background: rgba(123, 201, 80, 0.15);
  pointer-events: none;
  z-index: 11;
  animation: flashPop 0.3s ease-out forwards;
}

@keyframes flashPop {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
