/* ============================================
   UTILITIES MENU & FINGER CHOOSER
   ============================================ */

/* Utilities Menu Overlay */
.utilities-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-base);
  padding: 20px;
  overflow-y: auto;
}

.utilities-overlay.active {
  display: flex;
  opacity: 1;
}

.utilities-container {
  background: #1a1a1a;
  border: 1px solid rgba(46, 204, 113, 0.3);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 40px 35px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.utilities-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.6);
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.utilities-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

.utilities-header {
  text-align: center;
  margin-bottom: 32px;
}

.utilities-title {
  font-size: 26px;
  font-weight: 700;
  color: #2ecc71;
  margin-bottom: 8px;
}

.utilities-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--mono);
}

.utilities-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.utility-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(46, 204, 113, 0.2);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.utility-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(46, 204, 113, 0.4);
  transform: translateY(-2px);
}

.utility-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.utility-name {
  font-size: 15px;
  font-weight: 600;
  color: white;
  margin-bottom: 6px;
  font-family: var(--mono);
}

.utility-description {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--mono);
}

/* Finger Chooser Overlay */
.finger-chooser-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%);
  z-index: 10000;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.finger-chooser-overlay.active {
  display: flex;
  opacity: 1;
}

.finger-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.6);
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 10;
}

.finger-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

.finger-header {
  text-align: center;
  padding: 30px 20px 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.2) 100%);
}

.finger-title {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  text-shadow: 0 0 30px rgba(46, 204, 113, 0.3);
}

.finger-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--mono);
  letter-spacing: 0.5px;
}

.finger-instructions {
  text-align: center;
  padding: 20px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--mono);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 100%);
  border-bottom: 1px solid rgba(46, 204, 113, 0.2);
  font-weight: 600;
  letter-spacing: 0.5px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.finger-canvas {
  flex: 1;
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.finger-touch {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.9);
  transform: translate(-50%, -50%);
  transition: all 0.15s ease;
  box-shadow:
    0 0 30px currentColor,
    0 0 60px rgba(255, 255, 255, 0.3),
    inset 0 0 20px rgba(255, 255, 255, 0.2);
  pointer-events: none;
  animation: gentle-pulse 2s ease-in-out infinite;
}

@keyframes gentle-pulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.95;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.05);
    opacity: 1;
  }
}

.finger-touch.suspense {
  animation: suspense-grow 0.8s ease-in-out infinite;
}

@keyframes suspense-grow {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.15);
  }
}

.finger-touch.about-to-explode {
  animation: pre-explode 0.5s ease-in-out;
  border-width: 6px;
}

@keyframes pre-explode {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
  }
  25% {
    transform: translate(-50%, -50%) scale(1.3);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
  75% {
    transform: translate(-50%, -50%) scale(1.4);
  }
}

.finger-touch.eliminated {
  animation: explode 0.6s ease-out forwards;
}

@keyframes explode {
  0% {
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 1;
    border-width: 6px;
  }
  30% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0.8;
    box-shadow:
      0 0 80px currentColor,
      0 0 120px rgba(255, 255, 255, 0.5);
  }
  60% {
    transform: translate(-50%, -50%) scale(2.2);
    opacity: 0.4;
  }
  100% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    border-width: 0;
  }
}


body.utilities-open {
  overflow: hidden;
}

body.finger-chooser-open {
  overflow: hidden;
}

/* Mobile */
@media (max-width: 768px) {
  .utilities-container {
    padding: 32px 24px;
  }

  .utilities-title {
    font-size: 22px;
  }

  .utilities-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .utility-icon {
    font-size: 40px;
  }

  .finger-title {
    font-size: 26px;
  }

  .finger-subtitle {
    font-size: 13px;
  }

  .finger-instructions {
    font-size: 14px;
    padding: 16px;
  }

  .finger-touch {
    width: 85px;
    height: 85px;
    border-width: 3px;
  }
}
