/* Karwan-e-Taqi — Hand gesture overlay for any page */

#kth-gesture-root {
  --kth-green: #0d4a2b;
  --kth-gold: #c9a227;
  --cursor-size: 22px;
  font-family: Inter, "Segoe UI", sans-serif;
}

#kth-gesture-toggle {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100000;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.2rem;
  background: var(--kth-green);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(13, 74, 43, 0.28);
  transition: transform 0.15s ease, background 0.15s ease;
}

#kth-gesture-toggle:hover {
  transform: translateY(-2px);
}

#kth-gesture-toggle.active {
  background: #8a2b2b;
}

#kth-gesture-panel {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 99999;
  width: min(280px, calc(100vw - 2rem));
  border-radius: 16px;
  overflow: hidden;
  background: #0b1410;
  border: 2px solid rgba(201, 162, 39, 0.45);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

#kth-gesture-panel[hidden] {
  display: none;
}

.kth-gesture-camera {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #000;
}

.kth-gesture-camera video,
.kth-gesture-camera canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.kth-gesture-camera canvas {
  pointer-events: none;
}

.kth-gesture-meta {
  padding: 0.75rem 0.9rem;
  background: #fff;
  color: #1f2933;
}

.kth-gesture-meta strong {
  display: block;
  color: var(--kth-green);
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
}

.kth-gesture-meta span {
  display: block;
  font-size: 0.82rem;
  color: #5f6b7a;
  line-height: 1.45;
}

.kth-gesture-badge {
  display: inline-block;
  margin-top: 0.45rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(201, 162, 39, 0.16);
  color: #8a6d12;
  font-size: 0.78rem;
  font-weight: 700;
}

.kth-gesture-stop {
  width: 100%;
  border: none;
  padding: 0.7rem;
  background: #f3f6f4;
  color: var(--kth-green);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

#kth-virtual-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--cursor-size);
  height: var(--cursor-size);
  margin-left: calc(var(--cursor-size) / -2);
  margin-top: calc(var(--cursor-size) / -2);
  border: 2px solid var(--kth-gold);
  border-radius: 50%;
  background: rgba(201, 162, 39, 0.25);
  box-shadow: 0 0 0 6px rgba(201, 162, 39, 0.12);
  pointer-events: none;
  z-index: 99998;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.08s linear;
}

#kth-virtual-cursor.visible {
  opacity: 1;
}

#kth-virtual-cursor.clicking {
  transform: scale(0.78);
  background: rgba(201, 162, 39, 0.55);
}

#kth-virtual-cursor.scrolling {
  border-radius: 6px;
  transform: rotate(90deg);
}

body.kth-gesture-active {
  cursor: none;
}

body.kth-gesture-active #kth-gesture-root button {
  cursor: pointer;
}

@media (max-width: 640px) {
  #kth-gesture-panel {
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
  }

  #kth-gesture-toggle {
    right: 0.75rem;
    bottom: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
  }
}
