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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a2e;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#gameContainer {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

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

#gameUI {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#gameUI > * {
  pointer-events: auto;
}

/* Glassmorphism panels */
.ui-panel {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 15px;
  padding: 12px 20px;
  color: white;
}

#scoreDisplay {
  position: absolute;
  top: 15px;
  left: 15px;
}

#nextFruitDisplay {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 15px;
}

.ui-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 4px;
}

.ui-value {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

canvas#nextFruitCanvas {
  width: 60px;
  height: 60px;
  margin-top: 4px;
}

/* Overlays */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  pointer-events: auto;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  text-align: center;
  color: white;
  max-width: 380px;
  padding: 40px 30px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.game-title {
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ff6b6b, #ffa500, #a8d948, #2ecc71);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-description {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  margin-bottom: 30px;
}

.overlay-content h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 20px;
}

.final-stats {
  display: flex;
  gap: 30px;
  justify-content: center;
  margin-bottom: 30px;
}

.stat {
  text-align: center;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
}

.btn-primary {
  display: inline-block;
  padding: 14px 40px;
  font-size: 18px;
  font-weight: 700;
  color: #667eea;
  background: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  margin: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

.btn-secondary {
  display: inline-block;
  padding: 12px 30px;
  font-size: 15px;
  font-weight: 600;
  color: white;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  cursor: pointer;
  margin: 8px;
  transition: transform 0.2s, background 0.2s;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.25);
}

.leaderboard-msg {
  margin-top: 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

/* Mobile adjustments */
@media (max-width: 500px) {
  .game-title {
    font-size: 32px;
  }

  .overlay-content {
    padding: 30px 20px;
    margin: 0 15px;
  }

  .ui-value {
    font-size: 22px;
  }

  .btn-primary {
    padding: 12px 32px;
    font-size: 16px;
  }

  .final-stats {
    gap: 20px;
  }

  .stat-value {
    font-size: 26px;
  }

  #scoreDisplay, #nextFruitDisplay {
    top: 10px;
  }

  #scoreDisplay {
    left: 10px;
    padding: 8px 14px;
  }

  #nextFruitDisplay {
    right: 10px;
    padding: 8px 12px;
  }
}
