/* =============================================================
   CROC OVERLAY — Game Easter Egg Trigger & Overlay Panel
   Phase 29: Game Infrastructure
   ============================================================= */

/* ----------------------------------------------------------------
   1. CROCODILE MASCOT ELEMENT
   ---------------------------------------------------------------- */
.croc-mascot {
  position: fixed;
  right: 20px;
  bottom: 30%;
  width: 80px;
  height: 60px;
  z-index: 49000;
  color: #14b8a6; /* AINode teal — matches --teal in colt palette */
  opacity: 0;
  pointer-events: none;
  transform: translateX(60%);
  cursor: pointer;
  transition:
    opacity 0.5s ease,
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Floating animation applied when visible */
  animation: none;
}

.croc-mascot.croc--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  animation: croc-float 8s ease-in-out infinite;
}

.croc-mascot svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(20, 184, 166, 0.4));
}

/* Hover wiggle */
.croc-mascot.croc--visible:hover svg,
.croc-mascot.croc--visible:focus svg {
  animation: croc-wiggle 0.4s ease-in-out;
}

.croc-mascot:focus {
  outline: 2px solid #14b8a6;
  outline-offset: 4px;
  border-radius: 4px;
}

/* Floating animation — gentle bobbing */
@keyframes croc-float {
  0%   { transform: translateX(0) translateY(0px); }
  25%  { transform: translateX(0) translateY(-6px); }
  50%  { transform: translateX(0) translateY(0px); }
  75%  { transform: translateX(0) translateY(-4px); }
  100% { transform: translateX(0) translateY(0px); }
}

/* Wiggle on hover */
@keyframes croc-wiggle {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(-8deg); }
  30%  { transform: rotate(8deg); }
  45%  { transform: rotate(-6deg); }
  60%  { transform: rotate(6deg); }
  75%  { transform: rotate(-3deg); }
  90%  { transform: rotate(3deg); }
  100% { transform: rotate(0deg); }
}

/* Mobile size */
@media (max-width: 767px) {
  .croc-mascot {
    width: 60px;
    height: 45px;
    right: 12px;
    bottom: 25%;
  }
}


/* ----------------------------------------------------------------
   2. GAME OVERLAY — Base (mobile fullscreen default)
   ---------------------------------------------------------------- */
.game-overlay {
  position: fixed;
  inset: 0;
  height: 100vh;
  z-index: 50000;
  background: rgba(10, 14, 23, 0.97);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Hidden state */
  opacity: 0;
  pointer-events: none;
  transform: translateY(100%);
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease;
}

.game-overlay.game-overlay--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Desktop variant — 33% bottom slide-in panel */
@media (min-width: 768px) {
  .game-overlay {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: 33vh;
    min-height: 300px;
    inset: auto 0 0 0;
    border-radius: 16px 16px 0 0;
    border-top: 1px solid rgba(20, 184, 166, 0.2);
    box-shadow:
      0 -8px 40px rgba(0, 0, 0, 0.6),
      0 -1px 0 rgba(20, 184, 166, 0.15);
  }
}


/* ----------------------------------------------------------------
   3. OVERLAY CLOSE BUTTON
   ---------------------------------------------------------------- */
.game-overlay__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  color: #f0f4f8;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
  transition: background 0.2s ease, transform 0.2s ease;
  /* Reset button styles */
  padding: 0;
  font-family: inherit;
}

.game-overlay__close:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.game-overlay__close:focus {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

.game-overlay__close:active {
  transform: scale(0.95);
}


/* ----------------------------------------------------------------
   4. GAME IFRAME CONTAINER
   ---------------------------------------------------------------- */
.game-overlay__frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #0a0e17;
}

@media (min-width: 768px) {
  .game-overlay__frame {
    height: calc(100% - 48px);
    margin-top: 48px;
  }
}


/* ----------------------------------------------------------------
   5. LOADING SCREEN
   ---------------------------------------------------------------- */
.game-overlay__loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(10, 14, 23, 0.97);
  z-index: 2;
  transition: opacity 0.3s ease;
}

.game-overlay__loading.game-overlay__loading--hidden {
  opacity: 0;
  pointer-events: none;
}

.game-overlay__loading-title {
  color: #f0f4f8;
  font-size: 1.2rem;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 16px;
}

.game-overlay__loading-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.game-overlay__loading-fill {
  height: 100%;
  width: 60%;
  background: linear-gradient(90deg, #14b8a6 0%, #8b5cf6 100%);
  border-radius: 2px;
  animation: loading-pulse 1.8s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%   { width: 10%; opacity: 0.6; }
  50%  { width: 80%; opacity: 1; }
  100% { width: 10%; opacity: 0.6; }
}

.game-overlay__loading-text {
  color: rgba(203, 213, 225, 0.6);
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  letter-spacing: 0.05em;
}


/* ----------------------------------------------------------------
   6. ROTATE PROMPT (mobile portrait orientation)
   ---------------------------------------------------------------- */
.game-rotate-prompt {
  position: absolute;
  inset: 0;
  display: none; /* Shown only via media query below */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(10, 14, 23, 0.97);
  z-index: 3;
  color: #f0f4f8;
  text-align: center;
  padding: 24px;
}

.game-rotate-prompt svg {
  width: 64px;
  height: 64px;
  color: #14b8a6;
  animation: rotate-hint 2s ease-in-out infinite;
}

.game-rotate-prompt p {
  font-size: 1rem;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  letter-spacing: 0.08em;
  color: rgba(203, 213, 225, 0.8);
  margin: 0;
}

@keyframes rotate-hint {
  0%   { transform: rotate(0deg); }
  30%  { transform: rotate(-90deg); }
  60%  { transform: rotate(-90deg); }
  80%  { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

/* Show rotate prompt only on mobile in portrait orientation */
@media (max-width: 767px) and (orientation: portrait) {
  .game-overlay.game-overlay--mobile .game-rotate-prompt {
    display: flex;
  }
}

/* Ensure prompt is hidden in landscape */
@media (orientation: landscape) {
  .game-rotate-prompt {
    display: none !important;
  }
}


/* ----------------------------------------------------------------
   7. REDUCED MOTION
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .croc-mascot,
  .croc-mascot.croc--visible {
    animation: none;
    transition: opacity 0.3s ease;
  }

  .croc-mascot.croc--visible:hover svg,
  .croc-mascot.croc--visible:focus svg {
    animation: none;
  }

  .game-overlay {
    transition: opacity 0.2s ease;
    transform: none !important;
  }

  .game-overlay__loading-fill {
    animation: none;
    width: 60%;
  }

  .game-rotate-prompt svg {
    animation: none;
  }
}
