* { margin:0; padding:0; box-sizing:border-box; }
body {
  background: radial-gradient(ellipse at 50% 30%, #1e003a 0%, #050010 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; font-family: 'Nunito', sans-serif; overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.star { position: absolute; border-radius: 50%; background: white; animation: twinkle linear infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.1; transform: scale(1); } 50% { opacity: 0.8; transform: scale(1.5); } }

.game-wrapper {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 1; width: 100%; max-width: 400px;
}

.score-bar {
  width: 100%; display: flex; justify-content: space-around; align-items: center;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  border-radius: 18px 18px 0 0;
  border: 1px solid rgba(255,255,255,0.12); border-bottom: none;
  backdrop-filter: blur(12px);
}
.score-item { text-align: center; }
.score-label { font-size: 9px; text-transform: uppercase; letter-spacing: 2px; color: rgba(255,255,255,0.45); font-weight: 700; }
.score-value { font-family: 'Fredoka One', cursive; font-size: 20px; color: #FFD700; text-shadow: 0 0 12px rgba(255,215,0,0.6); line-height: 1.2; }

.canvas-container {
  position: relative; width: 100%; display: flex;
}
#gameCanvas {
  width: 100%; height: auto; display: block; cursor: crosshair;
  border: 1px solid rgba(255,255,255,0.08); border-top: none; border-bottom: none;
}

.bottom-bar {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border-radius: 0 0 18px 18px;
  border: 1px solid rgba(255,255,255,0.1); border-top: none;
  backdrop-filter: blur(12px);
}
.hint { font-size: 11px; color: rgba(255,255,255,0.35); letter-spacing: 1px; text-transform: uppercase; }
.sound-toggle {
  cursor: pointer; font-size: 18px; opacity: 0.8;
  transition: transform 0.2s, opacity 0.2s;
  user-select: none; margin-left: auto; text-shadow: 0 0 8px rgba(255,255,255,0.3);
}
.sound-toggle:hover { opacity: 1; transform: scale(1.1); }
.sound-toggle:active { transform: scale(0.9); }

/* === OVERLAY SCREENS === */
.overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(5,0,20,0.93); z-index: 20; padding: 20px; text-align: center;
}
.overlay h1 {
  font-family: 'Fredoka One', cursive; font-size: 46px; text-align: center;
  background: linear-gradient(135deg, #FF3366 0%, #FFD700 35%, #00E676 65%, #00B4FF 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 6px; animation: titleFloat 3s ease-in-out infinite; line-height: 1.2;
}
@keyframes titleFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.overlay .subtitle { color: rgba(255,255,255,0.55); font-size: 14px; text-align: center; line-height: 1.5; margin-bottom: 24px; }
.final-score-label { color: rgba(255,255,255,0.45); font-size: 13px; text-transform: uppercase; letter-spacing: 2px; margin-top: 8px; }
.final-score-val { font-family: 'Fredoka One', cursive; font-size: 54px; color: #FFD700; text-shadow: 0 0 20px rgba(255,215,0,0.7); margin-bottom: 6px; }

.btn {
  background: linear-gradient(135deg, #FF3366, #FF6B35); color: white; border: none;
  padding: 14px 44px; border-radius: 50px; font-family: 'Fredoka One', cursive; font-size: 20px;
  cursor: pointer; box-shadow: 0 6px 28px rgba(255,51,102,0.45);
  transition: transform 0.15s, box-shadow 0.15s; margin-top: 8px;
}
.btn:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 10px 36px rgba(255,51,102,0.6); }
.btn:active { transform: scale(0.97); }

.instructions { display: flex; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; justify-content: center; }
.inst-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.05); border-radius: 14px; padding: 12px;
  border: 1px solid rgba(255,255,255,0.08); width: 85px; text-align: center;
}
.inst-item.large { width: 140px; padding: 20px; background: rgba(255,255,255,0.08); border-width: 2px; }
.inst-item.large .inst-icon { font-size: 40px; }
.inst-item.large .inst-text { font-size: 14px; font-weight: 900; color: #fff; text-transform: uppercase; letter-spacing: 1px; }
.inst-icon { font-size: 24px; }
.inst-text { font-size: 10px; color: rgba(255,255,255,0.5); text-align: center; line-height: 1.3; }

/* Guide System */
.guide-container { width: 100%; min-height: 240px; position: relative; overflow: hidden; margin-bottom: 20px; }
.guide-step {
  display: none; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; animation: slideIn 0.4s ease-out;
}
.guide-step.active { display: flex; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.guide-visual { margin: 15px 0; }
.guide-desc { color: rgba(255,255,255,0.7); font-size: 13px; line-height: 1.6; max-width: 280px; }

.guide-dots { display: flex; gap: 8px; margin-bottom: 25px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.15); transition: background 0.3s, transform 0.3s; }
.dot.active { background: #FF3366; transform: scale(1.3); box-shadow: 0 0 10px rgba(255,51,102,0.5); }

/* Background floating bubbles */
.bg-bubble {
  position: fixed; border-radius: 50%; opacity: 0.12; pointer-events: none;
  animation: floatUp linear infinite; z-index: 0;
}
@keyframes floatUp {
  0% { transform: translateY(110vh) scale(0.3) rotate(0deg); opacity: 0; }
  10% { opacity: 0.12; } 90% { opacity: 0.08; }
  100% { transform: translateY(-20vh) scale(1) rotate(360deg); opacity: 0; }
}

/* Juice Animations */
.shake { animation: shakeEffect 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shakeEffect {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}
