/* ═══════════════════════════════════════════════
   Hand Gesture Controller — UI Styles
   ═══════════════════════════════════════════════ */

/* ── Overlay (contains cursor + feedback) ── */
#hand-gesture-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
}

#hand-gesture-overlay.active {
  opacity: 1;
}

/* ── Hand Cursor ── */
.hg-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 100000;
  transition: opacity .2s ease;
  will-change: transform;
}

.hg-cursor svg circle:first-child {
  transition: stroke .2s, r .2s;
}

.hg-cursor.hg-pinching svg circle:first-child {
  stroke: #ffbd2e;
  r: 8;
}

.hg-cursor.hg-clicked svg circle:first-child {
  stroke: #1DD1A1;
  r: 16;
  stroke-width: 3;
}

.hg-cursor.hg-clicked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 2px solid #1DD1A1;
  animation: hg-click-ripple .4s ease-out forwards;
}

@keyframes hg-click-ripple {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

/* ── Gesture Feedback Label ── */
.hg-feedback {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(29, 209, 161, 0.3);
  color: #1DD1A1;
  font-family: 'Manrope', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 10px 22px;
  border-radius: 50px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, transform .3s, visibility .3s;
  z-index: 100001;
  pointer-events: none;
}

.hg-feedback.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ── Status Indicator ── */
.hg-status {
  position: fixed;
  top: 18px;
  right: 80px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 50px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .4s, visibility .4s;
  z-index: 100001;
  pointer-events: none;
}

.hg-status.visible {
  opacity: 1;
  visibility: visible;
}

.hg-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #555;
  transition: background .3s, box-shadow .3s;
}

.hg-status-dot.active {
  background: #1DD1A1;
  box-shadow: 0 0 8px rgba(29, 209, 161, 0.6);
  animation: hg-dot-pulse 2s ease-in-out infinite;
}

@keyframes hg-dot-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(29, 209, 161, 0.6); }
  50% { box-shadow: 0 0 16px rgba(29, 209, 161, 0.9); }
}

.hg-status-text {
  font-family: 'Manrope', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
}

/* ── Toggle Button ── */
.hg-toggle-btn {
  position: fixed;
  bottom: 100px;
  left: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(29, 209, 161, 0.4);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99998;
  transition: all .3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.hg-toggle-btn:hover {
  border-color: #1DD1A1;
  color: #1DD1A1;
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(29, 209, 161, 0.25);
}

.hg-toggle-btn.active {
  background: rgba(29, 209, 161, 0.15);
  border-color: #1DD1A1;
  color: #1DD1A1;
  box-shadow: 0 0 24px rgba(29, 209, 161, 0.3);
  animation: hg-btn-glow 3s ease-in-out infinite;
}

@keyframes hg-btn-glow {
  0%, 100% { box-shadow: 0 0 24px rgba(29, 209, 161, 0.3); }
  50% { box-shadow: 0 0 36px rgba(29, 209, 161, 0.5); }
}

.hg-toggle-btn svg {
  width: 24px;
  height: 24px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .hg-toggle-btn {
    bottom: 80px;
    left: 16px;
    width: 44px;
    height: 44px;
  }

  .hg-toggle-btn svg {
    width: 20px;
    height: 20px;
  }

  .hg-status {
    top: 12px;
    right: 12px;
    padding: 6px 12px;
  }

  .hg-feedback {
    top: 70px;
    font-size: 0.78rem;
    padding: 8px 16px;
  }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  .hg-status-dot.active { animation: none; }
  .hg-toggle-btn.active { animation: none; }
  .hg-cursor.hg-clicked::after { animation: none; opacity: 0; }
}
