/* Bloomer - Enchanted Garden Theme */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600;700&family=Quicksand:wght@400;500;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Quicksand', sans-serif;
}

html, body {
  height: 100%;
  width: 100%;
}

body {
  background: linear-gradient(135deg, #0d1f0d 0%, #051005 50%, #020502 100%);
  color: #c8e6c8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.small-header {
  flex-shrink: 0;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.game-container {
  background: transparent;
  border-radius: 12px;
  box-shadow: none;
  padding: 10px;
  width: 100%;
  height: 100%;
  text-align: center;
  border: none;
  display: flex;
  flex-direction: column;
  position: relative;
}

.game-info {
  margin: 0 auto 10px auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  width: 100%;
  max-width: 700px;
  gap: 15px;
}

.score-section,
.level-section,
.best-section {
  font-size: 1rem;
  color: #7a9a7a;
}

.score-section span:last-child {
  color: #90ee90;
  font-weight: 600;
}

.level-section span:last-child {
  color: #98d998;
  font-weight: 600;
}

.best-section span:last-child {
  color: #ffd700;
  font-weight: 600;
}

.game-area {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  border-radius: 8px;
  transition: filter 0.5s ease;
}

/* Dead effect when game is over */
canvas.dead {
  filter: grayscale(100%) sepia(30%) brightness(0.6);
}

/* Text colors for instructions */
.red-text {
  color: #e57373;
  text-shadow: 0 0 8px rgba(229, 115, 115, 0.3);
}

.green-text {
  color: #81c784;
  text-shadow: 0 0 8px rgba(129, 199, 132, 0.3);
}

.yellow-text {
  color: #fff176;
  text-shadow: 0 0 8px rgba(255, 241, 118, 0.3);
}

/* Botanical button style */
button {
  background: linear-gradient(180deg, #4a7c4a 0%, #2d5a2d 100%);
  border: 2px solid #5d8a5d;
  color: #e8f5e8;
  padding: 12px 24px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Quicksand', sans-serif;
  margin: 10px 2px;
  cursor: pointer;
  border-radius: 25px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(45, 90, 45, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

button:hover {
  background: linear-gradient(180deg, #5a8c5a 0%, #3d6a3d 100%);
  border-color: #6d9a6d;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 90, 45, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(45, 90, 45, 0.3);
}

/* Modal styles - Garden themed */
.modal {
  display: none;
  position: fixed;
  z-index: 10;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: radial-gradient(ellipse at center, rgba(10, 30, 10, 0.85) 0%, rgba(0, 10, 0, 0.95) 100%);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: linear-gradient(180deg, #1a2f1a 0%, #0f1f0f 100%);
  margin: auto;
  padding: 30px;
  border-radius: 16px;
  width: 85%;
  max-width: 420px;
  text-align: left;
  color: #c8e6c8;
  border: 1px solid rgba(100, 180, 100, 0.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
              0 0 40px rgba(80, 150, 80, 0.1),
              inset 0 1px 0 rgba(100, 180, 100, 0.1);

  .start-btn {
    display: block;
    width: 100%;
    padding: 15px 32px;
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 14px;
    letter-spacing: 0.5px;
  }

  .story-section {
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(100, 180, 100, 0.15);
    margin-bottom: 10px;

    h1 {
      font-family: 'Great Vibes', cursive;
      font-size: 3.2rem;
      font-weight: 400;
      color: #90ee90;
      margin-bottom: 0;
      text-shadow: 0 0 20px rgba(144, 238, 144, 0.3);
      letter-spacing: 1px;
    }

    .story-text {
      font-size: 1.05rem;
      color: #98d998;
      margin: 10px 0;
      line-height: 1.5;
      font-weight: 500;
    }
  }

  .instructions {
    padding: 8px 0;

    h3 {
      font-size: 0.85rem;
      color: #6a8a6a;
      margin-bottom: 10px;
      text-transform: uppercase;
      letter-spacing: 2px;
      font-weight: 600;
    }

    h4 {
      font-size: 0.75rem;
      color: #6a8a6a;
      margin: 10px 0 8px;
      text-transform: uppercase;
      letter-spacing: 1px;
      font-weight: 600;
    }

    p {
      margin: 8px 0;
      font-size: 0.95rem;
      color: #a8c8a8;
      line-height: 1.4;
    }

    strong {
      color: #b8d8b8;
    }
  }

  .controls-section {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(144, 238, 144, 0.15);
  }

  .control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
  }

  .control-icon {
    width: 24px;
    height: 24px;
    color: #b0e0b0;
    flex-shrink: 0;
  }

  .control-label {
    font-size: 0.9rem;
    color: #a8c8a8;
    flex: 1;
  }

  .control-or {
    font-size: 0.9rem;
  }

  .control-key-text {
    font-size: 0.8rem;
    color: #b0e0b0;
    background: rgba(144, 238, 144, 0.15);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 500;
  }

  .inline-icon {
    vertical-align: middle;
    margin-right: 8px;
  }

  .inline-icon.petal-icon {
    width: 32px;
    height: 18px;
    color: #ffcc00;
  }

  .inline-icon.leaf-icon {
    width: 24px;
    height: 32px;
    color: #4ade80;
  }

  .inline-icon.worm-icon {
    width: 36px;
    height: 18px;
  }

  .inline-icon.snake-icon {
    width: 36px;
    height: 18px;
  }
}

/* Game Over Modal - Transparent */
.game-over-modal {
  background: transparent !important;
  backdrop-filter: none !important;
}

.game-over-modal.show {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.game-over-content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: auto !important;
  margin: 0 !important;
}

#playAgainButton {
  display: block;
  padding: 20px 48px;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

/* Controls hint at bottom - Garden themed */
.controls-hint {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 12px 16px;
  color: #5a7a5a;
  font-size: 0.85rem;
  background: linear-gradient(180deg, rgba(20, 40, 20, 0.6) 0%, rgba(10, 25, 10, 0.8) 100%);
  border-radius: 20px;
  margin: 8px auto;
  border: 1px solid rgba(80, 120, 80, 0.2);
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

kbd {
  background: linear-gradient(180deg, #2a3a2a 0%, #1a2a1a 100%);
  border: 1px solid #3a5a3a;
  border-radius: 6px;
  padding: 4px 8px;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #90b090;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2),
              inset 0 1px 0 rgba(100, 150, 100, 0.1);
}

/* Game Control Buttons */
.game-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin: 8px auto;
  width: 90%;
  max-width: 400px;
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: none;
  background: linear-gradient(180deg, #2a4a2a 0%, #1a3a1a 100%);
  color: #90c090;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.control-btn:hover {
  background: linear-gradient(180deg, #3a5a3a 0%, #2a4a2a 100%);
  color: #b0e0b0;
}

.control-btn:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3),
              inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Jump button - 80% of container */
.jump-btn {
  flex: 4;
  height: 70px;
  border-radius: 16px;
  background: linear-gradient(180deg, #3a5a3a 0%, #2a4a2a 100%);
}

.jump-btn:active {
  background: linear-gradient(180deg, #2a4a2a 0%, #1a3a1a 100%);
}

.jump-btn svg {
  width: 40px;
  height: 40px;
}

.spacebar-icon {
  width: 120px;
  height: 40px;
  color: #b0e0b0;
}

/* Direction toggle button - 20% of container */
.direction-btn {
  flex: 1;
  height: 70px;
  border-radius: 16px;
}

.direction-btn svg {
  width: 36px;
  height: 36px;
  color: #b0e0b0;
}

/* Show/hide based on device */
.mobile-only {
  display: none;
}

.desktop-only {
  display: flex;
}

.hidden {
  display: none !important;
}

/* Mobile styles */
@media (max-width: 600px) {
  .game-container {
    padding: 8px;
  }

  .game-info {
    font-size: 0.85rem;
  }

  button {
    padding: 10px 20px;
    font-size: 15px;
  }

  .modal-content {
    padding: 24px;
    width: 90%;

    .story-section h1 {
      font-size: 1.8rem;
    }

    .story-section .story-text {
      font-size: 1rem;
    }
  }

  .controls-hint {
    gap: 16px;
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  /* Full height control buttons on mobile */
  .game-controls {
    padding: 0;
    margin: 0;
    gap: 8px;
    width: 100%;
    max-width: none;
    flex: 0 0 auto;
  }

  .control-btn {
    border-radius: 0;
  }

  .jump-btn,
  .direction-btn {
    height: 80px;
    border-radius: 0;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block;
  }

  .mobile-only.hidden {
    display: none !important;
  }
}

/* Subtle animations */
@keyframes gentle-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

.modal-content .story-section h1 {
  animation: gentle-pulse 3s ease-in-out infinite;
}

/* Floral modal decorations */
.modal-content.floral-modal {
  position: relative;
  padding: 45px 25px;
  overflow: hidden;
}

.floral-decoration {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  height: auto;
  pointer-events: none;
  z-index: 1;
}

.floral-top {
  top: -50px;
  transform: scaleY(-1);
}

.floral-bottom {
  bottom: -50px;
}

.modal-inner {
  position: relative;
  z-index: 2;
}
