@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;700;900&display=swap');

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a0a2e;
  touch-action: none;
  user-select: none;
  font-family: 'Nunito', sans-serif;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ===== UI Overlay ===== */
#ui-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
}

.screen {
  text-align: center;
  padding: 2rem;
  max-width: 520px;
  width: 90%;
  animation: slideIn 0.6s ease-out;
}

/* ===== Title ===== */
.game-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.2rem, 6vw, 4rem);
  color: #fff;
  text-shadow: 4px 4px 0 rgba(230,57,70,0.5), 8px 8px 0 rgba(0,0,0,0.2);
  margin-bottom: 0.5rem;
  animation: bounceTitle 2s ease-in-out infinite;
}

.game-subtitle {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  font-size: clamp(0.9rem, 2.5vw, 1.2rem);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* ===== Theme Grid ===== */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.theme-btn {
  font-family: 'Nunito', sans-serif;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  backdrop-filter: blur(4px);
}

.theme-btn:hover {
  border-color: #f5576c;
  background: rgba(245,87,108,0.15);
  transform: scale(1.08);
  box-shadow: 0 8px 25px rgba(245,87,108,0.3);
}

.theme-btn:active { transform: scale(0.95); }

.theme-emoji {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.theme-name {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
}

/* ===== Screen headings ===== */
.screen h1 {
  font-family: 'Fredoka One', cursive;
  color: #fff;
  font-size: clamp(1.5rem, 4.5vw, 2.5rem);
  margin-bottom: 1rem;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.3);
  animation: bounceTitle 1.5s ease-in-out infinite;
}

.stats {
  color: rgba(255,255,255,0.85);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 2.2;
}

.lives-display {
  font-size: 2.5rem;
  letter-spacing: 8px;
  margin-bottom: 0.5rem;
}

.unlock-msg {
  font-family: 'Fredoka One', cursive;
  color: #ffd700;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  margin-bottom: 1.2rem;
  padding: 0.75rem 1rem;
  background: rgba(255,215,0,0.1);
  border: 2px solid rgba(255,215,0,0.3);
  border-radius: 16px;
  box-shadow: 0 0 20px rgba(255,215,0,0.15);
  animation: gentlePulse 2s ease-in-out infinite;
}

/* ===== Action buttons ===== */
.action-btn {
  font-family: 'Fredoka One', cursive;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 45px;
  font-size: clamp(1.1rem, 2.8vw, 1.4rem);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  background: linear-gradient(135deg, #f093fb, #f5576c);
  box-shadow: 0 8px 25px rgba(240,87,108,0.4);
}

.action-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 35px rgba(240,87,108,0.6);
}

.action-btn:active { transform: scale(0.95); }

/* ===== Touch Controls ===== */
#touch-buttons {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 12px;
  z-index: 5;
}

.touch-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  font-family: 'Fredoka One', cursive;
  font-size: 0.65rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.touch-btn:active {
  background: rgba(255,255,255,0.25);
  transform: scale(0.9);
}

.touch-btn-turbo {
  border-color: rgba(10,132,255,0.5);
  box-shadow: 0 4px 15px rgba(10,132,255,0.2);
}

.touch-btn-shake {
  border-color: rgba(255,159,10,0.5);
  box-shadow: 0 4px 15px rgba(255,159,10,0.2);
}

.touch-btn-pause {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  font-size: 0.8rem;
  z-index: 5;
}

/* ===== Animations ===== */
@keyframes bounceTitle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes slideIn {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

@keyframes wiggle {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}
