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

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0F0F23;
  color: #fff;
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-wrapper {
  width: 100%;
  max-width: 640px;
  height: 100vh;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  position: relative;
  background: linear-gradient(180deg, #0F0F23 0%, #1A1A2E 100%);
}

/* HUD */
#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(26, 26, 46, 0.9);
  border-bottom: 2px solid #2D2D44;
}

#score-section {
  display: flex;
  gap: 24px;
}

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

.hud-label {
  font-size: 10px;
  color: #A0A0A0;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

#score, #high-score {
  font-size: 24px;
  font-weight: 800;
  color: #F4C430;
}

#lives-section {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#lives {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.life-icon {
  width: 20px;
  height: 20px;
}

/* Canvas */
#game-canvas {
  flex: 1;
  width: 100%;
  background: #16213E;
  image-rendering: pixelated;
}

/* Screens */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #0F0F23 0%, #1A1A2E 100%);
  z-index: 100;
  padding: 20px;
}

.screen.hidden {
  display: none;
}

.screen-content {
  text-align: center;
  max-width: 400px;
  width: 100%;
}

/* Logo */
.logo {
  margin-bottom: 20px;
}

.logo-doodle {
  width: 100px;
  height: 100px;
  animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #F4C430 0%, #FFD54F 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 16px;
  color: #A0A0A0;
  margin-bottom: 30px;
}

/* Difficulty Select */
.difficulty-select {
  margin-bottom: 24px;
}

.difficulty-select p {
  font-size: 14px;
  color: #A0A0A0;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.difficulty-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diff-btn {
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid #2D2D44;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.diff-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #F4C430;
}

.diff-btn.active {
  background: rgba(244, 196, 48, 0.2);
  border-color: #F4C430;
  box-shadow: 0 0 20px rgba(244, 196, 48, 0.3);
}

.diff-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.diff-desc {
  font-size: 12px;
  color: #A0A0A0;
}

/* Buttons */
.btn-primary, .btn-secondary {
  width: 100%;
  padding: 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #F4C430 0%, #E5B82E 100%);
  color: #1A1A2E;
  box-shadow: 0 4px 15px rgba(244, 196, 48, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244, 196, 48, 0.6);
}

.btn-secondary {
  background: transparent;
  color: #F4C430;
  border: 2px solid #F4C430;
}

.btn-secondary:hover {
  background: rgba(244, 196, 48, 0.1);
}

/* Controls hint */
.controls-hint {
  margin-top: 20px;
  font-size: 14px;
  color: #666;
}

/* Game Over Screen */
h2 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 20px;
  color: #FF5252;
}

.final-score-box {
  margin-bottom: 16px;
}

.final-score-label {
  display: block;
  font-size: 14px;
  color: #A0A0A0;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

#final-score {
  font-size: 56px;
  font-weight: 800;
  color: #F4C430;
}

#new-record {
  font-size: 18px;
  font-weight: 700;
  color: #4CAF50;
  margin-bottom: 24px;
  animation: pulse 1s ease-in-out infinite;
}

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

.hidden {
  display: none !important;
}

/* Mobile Controls */
#mobile-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 50;
}

.control-row {
  display: flex;
  gap: 8px;
}

.control-btn {
  width: 60px;
  height: 60px;
  background: rgba(244, 196, 48, 0.2);
  border: 2px solid #F4C430;
  border-radius: 12px;
  color: #F4C430;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn:active {
  background: rgba(244, 196, 48, 0.4);
  transform: scale(0.95);
}

@media (min-width: 768px) {
  #mobile-controls {
    opacity: 0.6;
  }
  #mobile-controls:hover {
    opacity: 1;
  }
}

@media (max-height: 700px) {
  #mobile-controls {
    bottom: 10px;
  }
  
  .control-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
}
