/* =========================================================
   Game Help Overlay - Shared CSS
   =========================================================
   Shows intuitive help/tutorial on first visit.
   Auto-detects control scheme from mobile-controls config.
   Loaded by each game via:
     <link rel="stylesheet" href="/games/shared/game-help.css">
   DOM elements are created by game-help.js.
   ========================================================= */

/* --- Help overlay container --- */
#gh-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  opacity: 1;
  transition: opacity 0.4s ease-out;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

#gh-overlay.gh-hidden {
  opacity: 0;
  pointer-events: none;
}

/* --- Help card --- */
#gh-card {
  max-width: 320px;
  width: 85%;
  padding: 28px 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
  color: #fff;
  font-family: system-ui, sans-serif;
}

/* --- Control icons row --- */
#gh-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* --- Control icon group --- */
.gh-ctrl-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.gh-ctrl-group .gh-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- D-pad icon (mini) --- */
.gh-dpad {
  display: grid;
  grid-template-columns: 28px 28px 28px;
  grid-template-rows: 28px 28px 28px;
  gap: 2px;
}

.gh-dpad-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

.gh-dpad-empty {
  width: 28px;
  height: 28px;
}

/* --- Action button icons --- */
.gh-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.85);
  font-size: 16px;
  font-weight: bold;
}

/* --- Tap icon --- */
.gh-tap-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  font-size: 24px;
  animation: gh-pulse 1.5s ease-in-out infinite;
}

/* --- Swipe icon --- */
.gh-swipe-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: rgba(255, 255, 255, 0.8);
  position: relative;
}

.gh-swipe-arrows {
  display: flex;
  gap: 2px;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.6);
}

/* --- Help text --- */
#gh-text {
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 16px;
}

/* --- Dismiss hint --- */
#gh-dismiss {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  animation: gh-pulse 2s ease-in-out infinite;
}

/* --- "?" re-show button --- */
#gh-help-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.5);
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  cursor: pointer;
  transition: opacity 0.3s;
  font-family: system-ui, sans-serif;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#gh-help-btn:hover,
#gh-help-btn:active {
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.8);
}

/* --- Pulse animation --- */
@keyframes gh-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --- Responsive: small screens --- */
@media (max-height: 500px) {
  #gh-card {
    padding: 16px 18px;
    max-width: 280px;
  }

  .gh-dpad-btn {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }

  .gh-dpad-empty {
    width: 22px;
    height: 22px;
  }

  .gh-dpad {
    grid-template-columns: 22px 22px 22px;
    grid-template-rows: 22px 22px 22px;
  }

  .gh-action-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  #gh-text {
    font-size: 13px;
  }
}

/* --- Hide on desktop with pointer (mouse) unless explicitly shown --- */
@media (min-width: 1024px) and (pointer: fine) {
  #gh-help-btn {
    display: none;
  }
}
