/* Whispering Garden - Romantic Pixel Stroll Stylesheet */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  position: fixed;
  top: 0;
  left: 0;
  overflow: hidden;
  background-color: #1a2416;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

#game-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: radial-gradient(circle at center, #233b1e 0%, #111a0d 100%);
  overflow: hidden;
  touch-action: none;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

/* UI Overlay Layer */
#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* Top Bar Controls */
.top-bar {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top, 16px)) max(16px, env(safe-area-inset-right, 16px)) 16px 16px;
  pointer-events: auto;
  z-index: 25;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(22, 33, 20, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  touch-action: manipulation;
}

.icon-btn:hover {
  background: rgba(45, 68, 40, 0.85);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.4);
}

.icon-btn:active {
  transform: scale(0.92);
}

.ui-svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* Touch Controls Layout */
#touch-controls {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Virtual Joystick Zone: covers entire left 55% of screen for thumb movement */
#joystick-zone {
  position: absolute;
  top: 0;
  left: 0;
  width: 55%;
  height: 100%;
  pointer-events: auto;
  touch-action: none;
  z-index: 15;
}

#joystick-base {
  position: absolute;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: calc(24px + env(safe-area-inset-left, 0px));
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, rgba(20, 35, 18, 0.6) 80%);
  border: 2px solid rgba(255, 255, 255, 0.38);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  opacity: 0.8;
  will-change: transform, left, top, opacity;
  transition: opacity 0.2s ease;
}

#joystick-stick {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff5f5 0%, #ffccd5 40%, #e07a8b 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 14px rgba(224, 122, 139, 0.6), 0 2px 5px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  transform: translate(0px, 0px);
  will-change: transform;
}

/* Action Buttons Container (Right Side) */
#action-buttons {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom, 28px));
  right: max(20px, env(safe-area-inset-right, 20px));
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  pointer-events: auto;
  z-index: 25;
}

.action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(25, 38, 22, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  touch-action: manipulation;
}

.action-btn:hover {
  transform: translateY(-2px) scale(1.05);
  border-color: rgba(255, 255, 255, 0.6);
}

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

.action-svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Romantic Heart Button Styling */
.heart-btn {
  background: linear-gradient(135deg, rgba(235, 87, 119, 0.8) 0%, rgba(184, 51, 80, 0.8) 100%);
  border-color: rgba(255, 192, 203, 0.6);
  box-shadow: 0 8px 24px rgba(235, 87, 119, 0.45);
}

.heart-btn:hover {
  box-shadow: 0 10px 28px rgba(235, 87, 119, 0.6);
  border-color: #fff;
}

/* Sit Button Special State */
#sit-btn {
  opacity: 0.4;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

#sit-btn.available {
  opacity: 1;
  transform: scale(1);
  background: linear-gradient(135deg, rgba(94, 187, 118, 0.8) 0%, rgba(56, 128, 77, 0.8) 100%);
  border-color: rgba(200, 255, 210, 0.7);
  box-shadow: 0 0 18px rgba(120, 220, 140, 0.6);
  animation: pulse-glow 2s infinite alternate;
}

#sit-btn.sitting {
  opacity: 1;
  transform: scale(1);
  background: linear-gradient(135deg, rgba(160, 100, 210, 0.85) 0%, rgba(110, 60, 160, 0.85) 100%);
  border-color: rgba(230, 200, 255, 0.8);
  box-shadow: 0 0 18px rgba(180, 130, 255, 0.6);
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 10px rgba(120, 220, 140, 0.4); transform: scale(1); }
  100% { box-shadow: 0 0 22px rgba(120, 220, 140, 0.8); transform: scale(1.06); }
}

/* Floating Hint Card */
.hint-overlay {
  position: absolute;
  top: max(68px, calc(env(safe-area-inset-top, 0px) + 60px));
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 1.2s ease, transform 1.2s ease;
  z-index: 20;
}

.hint-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: rgba(20, 32, 18, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  color: #f0f5ed;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.hint-icon {
  font-size: 16px;
}

.hint-overlay.fade-out {
  opacity: 0;
  transform: translate(-50%, -15px);
}

/* Desktop vs Mobile adjustments */
@media (min-width: 900px) and (hover: hover) {
  /* On desktop with mouse/keyboard, keep joystick subtle or auto-hide if using keyboard */
  #joystick-zone {
    opacity: 0.65;
    transition: opacity 0.3s;
  }
  #joystick-zone:hover {
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .top-bar {
    gap: 8px;
    padding: calc(12px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) 12px 12px;
  }
  .icon-btn {
    width: 40px;
    height: 40px;
  }
  .ui-svg {
    width: 20px;
    height: 20px;
  }
  #joystick-base {
    width: 96px;
    height: 96px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: calc(20px + env(safe-area-inset-left, 0px));
  }
  #joystick-stick {
    width: 42px;
    height: 42px;
  }
  #action-buttons {
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    right: calc(18px + env(safe-area-inset-right, 0px));
    gap: 14px;
  }
  .action-btn {
    width: 58px;
    height: 58px;
  }
  .action-svg {
    width: 26px;
    height: 26px;
  }
  .hint-card {
    padding: 8px 14px;
    font-size: 12px;
  }
}
