/* Tongue cursor — injected into every HTML page served by the proxy. */

/* While the tongue is showing, hide the native cursor everywhere. */
html.tongue-active,
html.tongue-active * {
  cursor: none !important;
}

#tongue-cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 52px;
  height: 52px;
  pointer-events: none;
  user-select: none;
  z-index: 2147483647;
  opacity: 0;
  /* The tongue tip (bottom of the image) sits on the pointer; the root hangs above it. */
  transform-origin: 50% 8%;
  transform: translate(-50%, -88%);
  transition: opacity 0.12s ease-out;
  will-change: transform, opacity;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

#tongue-cursor.tongue-show {
  opacity: 1;
}

#tongue-cursor.tongue-lick {
  animation: tongue-lick 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes tongue-lick {
  0%   { transform: translate(-50%, -88%) scale(1, 1) rotate(0deg); }
  30%  { transform: translate(-50%, -88%) scale(1.1, 1.5) rotate(-10deg); }
  55%  { transform: translate(-50%, -88%) scale(0.95, 1.25) rotate(9deg); }
  75%  { transform: translate(-50%, -88%) scale(1.05, 1.35) rotate(-5deg); }
  100% { transform: translate(-50%, -88%) scale(1, 1) rotate(0deg); }
}

/* ---------- droplets ---------- */
#tongue-droplets {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483646;
  overflow: hidden;
}

.tongue-droplet {
  position: absolute;
  width: var(--size, 8px);
  height: var(--size, 8px);
  margin: calc(var(--size, 8px) / -2) 0 0 calc(var(--size, 8px) / -2);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #bfe6ff 40%, #6cc4ff 100%);
  box-shadow: 0 0 2px rgba(120, 200, 255, 0.8);
  animation: tongue-droplet var(--dur, 700ms) cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}

/* Fly out along (--dx, --dy), then fall back down under gravity and fade. */
@keyframes tongue-droplet {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 1; }
  45%  { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.15), calc(var(--dy) + 90px)) scale(0.7); opacity: 0; }
}

/* ---------- click-to-begin overlay ---------- */
#tongue-begin {
  position: fixed;
  inset: 0;
  z-index: 2147483645;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 16, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: tongue-begin-in 0.35s ease-out both;
}

#tongue-begin.tongue-begin-out {
  animation: tongue-begin-out 0.45s ease-in both;
  pointer-events: none;
}

.tongue-begin-card {
  text-align: center;
  color: #fff;
  font: 500 18px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 36px 48px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  user-select: none;
}

.tongue-begin-icon {
  width: 120px;
  height: 120px;
  display: block;
  margin: 0 auto 14px;
  animation: tongue-begin-bob 1.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}

.tongue-begin-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tongue-begin-sub {
  margin-top: 8px;
  font-size: 17px;
  color: #b9c3d6;
}

@keyframes tongue-begin-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes tongue-begin-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes tongue-begin-bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-10px) rotate(3deg); }
}

@media (prefers-reduced-motion: reduce) {
  #tongue-cursor.tongue-lick { animation-duration: 0.15s; }
  .tongue-begin-icon { animation: none; }
}
