/* ==========================================================================
   GULEL WALA – FRUIT SHOOTER: MOBILE STYLESHEET
   ========================================================================== */

:root {
  --primary-gold: #ffb300;
  --primary-orange: #ff6d00;
  --village-green: #2e7d32;
  --leaf-green: #4caf50;
  --wood-brown: #5d4037;
  --wood-dark: #3e2723;
  --terracotta: #d84315;
  --sky-blue: #81d4fa;
  --card-bg: rgba(25, 30, 20, 0.88);
  --font-display: 'Fredoka One', 'Nunito', cursive, sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --safe-area-top: env(safe-area-inset-top, 16px);
  --safe-area-bottom: env(safe-area-inset-bottom, 16px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #1a2412;
  font-family: var(--font-body);
  touch-action: none;
  position: fixed;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* ==========================================================================
   UI SCREENS & MODALS
   ========================================================================== */
.ui-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: auto;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ==========================================================================
   TOP HUD
   ========================================================================== */
#hud-top {
  position: absolute;
  top: var(--safe-area-top);
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 15;
  pointer-events: auto;
}

.hud-left, .hud-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hud-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 2px solid var(--primary-gold);
  border-radius: 24px;
  padding: 4px 12px 4px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
}

.hud-icon {
  font-size: 1.2rem;
}

.hud-info {
  display: flex;
  flex-direction: column;
}

.hud-label {
  font-size: 0.65rem;
  font-weight: 900;
  color: #c8e6c9;
  letter-spacing: 0.5px;
  line-height: 1;
}

.hud-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #fff;
  line-height: 1.1;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.target-card {
  background: linear-gradient(135deg, rgba(230, 81, 0, 0.9), rgba(255, 179, 0, 0.9));
  border: 2px solid #fff;
  border-radius: 20px;
  padding: 4px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.5), inset 0 2px 4px rgba(255,255,255,0.4);
}

.target-title {
  font-size: 0.65rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1px;
}

.target-counter {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 4px;
  text-shadow: 1px 2px 3px rgba(0,0,0,0.5);
}

.fruit-mini-icon {
  font-size: 1.2rem;
  animation: bounceMini 1.5s infinite ease-in-out;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--primary-gold);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  transition: transform 0.1s ease, background 0.2s ease;
}

.icon-btn:active {
  transform: scale(0.92);
  background: var(--primary-gold);
}

/* ==========================================================================
   CENTER FLOATING BANNER (1 FRUIT DOWN!)
   ========================================================================== */
#floating-banner-container {
  position: absolute;
  top: 32%;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 20;
}

.banner-text {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: #fff;
  text-transform: uppercase;
  text-align: center;
  padding: 8px 24px;
  background: linear-gradient(90deg, transparent, rgba(230, 81, 0, 0.95), transparent);
  text-shadow: 0 3px 6px rgba(0,0,0,0.8), 0 0 16px var(--primary-gold);
  letter-spacing: 1.5px;
  animation: bannerPop 1.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.floating-score {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--primary-gold);
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
  margin-top: 4px;
  animation: floatUp 1.2s ease-out forwards;
}

@keyframes bannerPop {
  0% { transform: scale(0.4) translateY(20px); opacity: 0; }
  25% { transform: scale(1.15) translateY(-5px); opacity: 1; }
  45% { transform: scale(1.0) translateY(0); opacity: 1; }
  80% { transform: scale(1.0) translateY(0); opacity: 1; }
  100% { transform: scale(0.8) translateY(-40px); opacity: 0; }
}

@keyframes floatUp {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-50px); opacity: 0; }
}

/* ==========================================================================
   BOTTOM HUD (BUCKET & CONTROLS)
   ========================================================================== */
#hud-bottom {
  position: absolute;
  bottom: var(--safe-area-bottom);
  left: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 15;
  pointer-events: none;
}

.bucket-card {
  pointer-events: auto;
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border: 2px solid #a1887f;
  border-radius: 28px;
  padding: 6px 16px 6px 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
}

.bucket-icon-wrapper {
  position: relative;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #8d6e63, #4e342e);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #d7ccc8;
}

.bucket-emoji {
  font-size: 1.6rem;
}

.bucket-counter-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--terracotta);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.85rem;
  border-radius: 12px;
  padding: 1px 6px;
  border: 1px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.bucket-label-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bucket-label {
  font-size: 0.7rem;
  font-weight: 900;
  color: #ffcc80;
  letter-spacing: 0.5px;
}

.bucket-progress-bar {
  width: 100px;
  height: 8px;
  background: rgba(0,0,0,0.6);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
}

.bucket-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-gold), var(--primary-orange));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.slingshot-hint {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffecb3;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  animation: pulseHint 2s infinite ease-in-out;
}

.pull-arrow {
  font-size: 1rem;
}

@keyframes pulseHint {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}

/* ==========================================================================
   CINEMATIC OVERLAY
   ========================================================================== */
#cinematic-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  pointer-events: none;
}

.cinematic-letterbox {
  position: absolute;
  left: 0;
  width: 100%;
  height: 6vh;
  background: #000;
  pointer-events: none;
  z-index: 5;
}

.letterbox-top {
  top: 0;
}

.letterbox-bottom {
  bottom: 0;
}

.cinematic-content {
  position: absolute;
  bottom: 7vh;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 16px 24px;
  pointer-events: auto;
  z-index: 10;
}

.cinematic-story-card {
  max-width: 70%;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  padding: 12px 18px;
  border-left: 4px solid var(--primary-gold);
  border-radius: 0 12px 12px 0;
  color: #fff;
}

#cinematic-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--primary-gold);
  margin-bottom: 4px;
}

#cinematic-sub {
  font-size: 0.85rem;
  line-height: 1.3;
  color: #e0e0e0;
}

.skip-btn {
  background: rgba(0,0,0,0.7) !important;
  border: 2px solid var(--primary-gold) !important;
  padding: 10px 18px !important;
  font-size: 0.9rem !important;
}

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */
.btn {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  padding: 14px 28px;
  border-radius: 32px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  box-shadow: 0 6px 18px rgba(0,0,0,0.4), inset 0 2px 4px rgba(255,255,255,0.4);
  transition: transform 0.12s ease, filter 0.15s ease;
  min-width: 180px;
}

.btn:active {
  transform: translateY(3px) scale(0.97);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.btn-primary {
  background: linear-gradient(180deg, #ff9800 0%, #e65100 100%);
  color: #fff;
  border-bottom: 4px solid #bf360c;
}

.btn-secondary {
  background: linear-gradient(180deg, #4caf50 0%, #2e7d32 100%);
  color: #fff;
  border-bottom: 4px solid #1b5e20;
}

.btn-tertiary {
  background: linear-gradient(180deg, #8d6e63 0%, #4e342e 100%);
  color: #fff;
  border-bottom: 4px solid #3e2723;
}

.pulse-btn {
  animation: pulseButton 2s infinite;
}

@keyframes pulseButton {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 18px rgba(230,81,0,0.5); }
  50% { transform: scale(1.04); box-shadow: 0 8px 24px rgba(255,152,0,0.8); }
}

/* ==========================================================================
   MAIN MENU SCREEN
   ========================================================================== */
#menu-screen {
  background: radial-gradient(circle at center, rgba(30, 70, 32, 0.7) 0%, rgba(10, 25, 12, 0.92) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 40px 20px;
  backdrop-filter: blur(4px);
}

.title-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.game-badge {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 4px 14px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 900;
  color: #ffeb3b;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.game-title {
  font-family: var(--font-display);
  font-size: 3.4rem;
  line-height: 1;
  text-shadow: 0 6px 12px rgba(0,0,0,0.8);
}

.title-wood {
  color: #ffcc80;
  -webkit-text-stroke: 2px #5d4037;
}

.title-gold {
  color: var(--primary-gold);
  -webkit-text-stroke: 2px #e65100;
}

.game-subtitle {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 3px;
  color: #a5d6a7;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
  margin-top: 4px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 260px;
}

.menu-footer {
  color: #c8e6c9;
  font-size: 0.85rem;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.menu-decorations {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.floating-fruit {
  position: absolute;
  font-size: 2.5rem;
  opacity: 0.25;
  animation: floatFruit 6s infinite ease-in-out;
}

.f1 { top: 15%; left: 10%; animation-delay: 0s; }
.f2 { top: 25%; right: 12%; animation-delay: 1.5s; }
.f3 { bottom: 20%; left: 15%; animation-delay: 3s; }
.f4 { bottom: 15%; right: 10%; animation-delay: 4.5s; }

@keyframes floatFruit {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(15deg); }
}

/* ==========================================================================
   MODAL DIALOGS (Stage Complete, Pause, How to Play)
   ========================================================================== */
.modal-screen {
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  background: linear-gradient(180deg, #37474f 0%, #212121 100%);
  border: 3px solid var(--primary-gold);
  border-radius: 28px;
  padding: 24px 20px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.7), inset 0 2px 6px rgba(255,255,255,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  text-align: center;
}

.bounce-in {
  animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  margin-bottom: 16px;
}

.stars-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.star-icon {
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
  animation: starPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

.star-1 { animation-delay: 0.2s; }
.star-2 { animation-delay: 0.4s; }
.star-3 { animation-delay: 0.6s; }

@keyframes starPop {
  0% { transform: scale(0) rotate(-45deg); opacity: 0; }
  80% { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--primary-gold);
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

.modal-subtitle {
  font-size: 0.9rem;
  color: #b0bec5;
}

.modal-stats {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #cfd8dc;
}

.stat-row.highlight {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 6px;
  color: #fff;
  font-weight: 900;
  font-size: 1rem;
}

.stat-value {
  font-family: var(--font-display);
  color: var(--primary-gold);
  font-size: 1.1rem;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.pause-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
}

/* ==========================================================================
   HOW TO PLAY
   ========================================================================== */
.howto-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  margin: 16px 0 20px 0;
}

.howto-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #e0e0e0;
}

.step-num {
  background: var(--primary-gold);
  color: #3e2723;
  font-family: var(--font-display);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

/* ==========================================================================
   STAGE SELECT
   ========================================================================== */
.stage-select-card {
  max-width: 360px;
  max-height: 80vh;
}

.stage-select-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
  margin-bottom: 12px;
}

.close-x-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  overflow-y: auto;
  max-height: 55vh;
  padding: 6px;
}

.stage-tile {
  background: #424242;
  border: 2px solid #616161;
  border-radius: 14px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.2s ease;
}

.stage-tile.unlocked {
  background: linear-gradient(145deg, #388e3c, #1b5e20);
  border-color: #81c784;
  color: #fff;
}

.stage-tile.current {
  border-color: var(--primary-gold);
  box-shadow: 0 0 10px var(--primary-gold);
}

.stage-tile.locked {
  opacity: 0.5;
  cursor: not-allowed;
  color: #9e9e9e;
}

.stage-tile:active:not(.locked) {
  transform: scale(0.92);
}

.stage-num-text {
  font-size: 1.1rem;
}

.stage-stars-mini {
  font-size: 0.65rem;
  color: var(--primary-gold);
}

/* ==========================================================================
   CONFETTI CANVASES
   ========================================================================== */
.confetti-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  border-radius: 28px;
}
