/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #0f172a; /* Dark bg */
}
::-webkit-scrollbar-thumb {
  background: #ff2e93; /* Primary pink */
  border-radius: 10px;
}

/* Responsive Game Canvas */
#game-canvas {
  max-width: 100%;
  height: auto;
  aspect-ratio: 9 / 6;
  display: block;
  margin: 0 auto;
  touch-action: none;
}

/* Hide default cursor for our custom one */
html,
body {
  cursor: none;
  scroll-behavior: smooth;
}
/* Ensure all interactive elements use the custom cursor, not the default pointer */
a,
button,
[role="button"],
.cursor-hover {
  cursor: none;
}

/* Custom Cursor Styles */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background-color: #00f0ff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
  opacity: 0; /* Hidden by default */
  transition:
    width 0.2s,
    height 0.2s,
    background-color 0.2s,
    opacity 0.2s;
}

.custom-cursor.hovering {
  width: 60px;
  height: 60px;
  background-color: #ff2e93;
}

.custom-cursor.visible {
  opacity: 1;
}

/* Infinite Marquee Animation */
@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}
.animate-marquee {
  flex-shrink: 0;
  animation: marquee 15s linear infinite;
}

/* Bounce Animation for Scroll Indicator */
@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0) translateX(-50%);
  }
  40% {
    transform: translateY(-10px) translateX(-50%);
  }
  60% {
    transform: translateY(-5px) translateX(-50%);
  }
}
.animate-bounce {
  animation: bounce 2s infinite;
}

/* Companion Sleep State */
.sleeping .eye {
  height: 4px !important;
  border-radius: 2px !important;
  margin-top: 6px;
  background-color: #000;
}
.sleeping .pupil {
  opacity: 0;
}

/* Companion Dragging Styles */
#companion {
  /* Ensure clicks pass through the container to elements below when not hitting body */
  pointer-events: none;
}
#companion-body {
  /* Re-enable pointer events for the robot body so we can grab it */
  pointer-events: auto;
  cursor: grab;
}
#companion-body:active {
  cursor: grabbing;
}
#companion.is-dragging {
  z-index: 100;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.3));
}

/* Drop Zones */
.drop-zone {
  position: fixed;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 46, 147, 0.3);
  background: rgba(255, 46, 147, 0.05);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  transform: scale(0.8) translate(-50%, -50%);
}
.drop-zone.active {
  background: rgba(255, 46, 147, 0.2);
  border-color: #ff2e93;
  transform: scale(1.2) translate(-50%, -50%);
}

/* Base Companion Scaling */
#companion {
  pointer-events: none;
  transition: transform 0.3s ease;
}

/* Responsive Scaling for Laptops, Tablets, and Mobile */
@media (max-width: 1400px) {
  html {
    font-size: 14px; /* Scaled down base for "zoomed out" effect on smaller desktops/laptops */
  }

  .hero-content {
    padding-top: 10rem; /* Adjusted to clear nav without pushing content off-screen on 768p */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100svh; /* Ensure full viewport height */
  }

  /* Ensure buttons/links in hero don't hit the bottom arrow */
  .hero-content a,
  .hero-content button {
    margin-bottom: 1.5rem;
  }

  /* Fix scroll down indicator being obscured by buttons */
  .animate-bounce {
    position: absolute;
    bottom: 1.5rem !important;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60; /* Higher z-index to stay above "Explore Games" buttons */
  }
}

/* Specific fix for short screens (like 1360x768) */
@media (max-height: 800px) and (min-width: 1025px) {
  .hero-content {
    padding-top: 8rem;
    gap: 1rem;
  }
}

/* Extra scaling for very small devices */
@media (max-width: 640px) {
  html {
    font-size: 12px;
  }
  #companion {
    transform: scale(0.75); /* Shrink companion on small phones */
    transform-origin: bottom right;
  }
}

/* Disable custom cursor on touch devices for better UX */
@media (hover: none) and (pointer: coarse) {
  .custom-cursor {
    display: none !important;
  }
  html,
  body,
  a,
  button,
  [role="button"],
  .cursor-hover {
    cursor: auto !important;
  }
}
