:root {
  --bg-color: #050505;
  --text-color: #ffffff;
  --accent-color: #ff3e3e;
  /* Aggressive Red */
  --glass-bg: rgba(20, 20, 20, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --font-main: 'Inter', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-main);
  overflow: hidden;
  /* Prevent scrolling during drag */
  user-select: none;
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ambient-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, #1a1a1a 0%, #000000 100%);
  z-index: -1;
  pointer-events: none;
}

.paper-stage {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  perspective: 1000px;
  /* For 3D crumple effects */
}

/* Paper Pieces */
.paper-piece {
  position: absolute;
  /* transform-origin: center center; */
  will-change: transform, clip-path;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  /* Shadow for depth */
  transition: filter 0.2s ease;
  cursor: crosshair;
}

.paper-piece img {
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

.paper-piece:hover {
  filter: brightness(1.1);
}

/* UI Overlay */
#instruction-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  transition: opacity 0.5s ease;
}

#instruction-overlay h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(to right, #fff, #888);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.upload-btn {
  display: inline-block;
  padding: 1rem 2rem;
  background: var(--accent-color);
  color: white;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.upload-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255, 62, 62, 0.4);
}

#file-upload {
  display: none;
}

/* Controls */
.glass-panel {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  display: flex;
  gap: 2rem;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.glass-panel.visible {
  opacity: 1;
  pointer-events: all;
}

.mode-selector {
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.3rem;
  border-radius: 40px;
}

.mode-btn {
  background: transparent;
  border: none;
  color: #888;
  padding: 0.6rem 1.2rem;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mode-btn:hover {
  color: #fff;
}

.mode-btn.active {
  background: #333;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s;
  color: #fff;
  opacity: 0.7;
}

.icon-btn:hover {
  transform: rotate(90deg);
  opacity: 1;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Finger Animation */
.emoji-projectile {
  position: absolute;
  font-size: 4rem;
  pointer-events: none;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  z-index: 100;
}

@keyframes popIn {
  0% {
    transform: scale(0) rotate(-45deg);
    opacity: 0;
  }

  50% {
    transform: scale(1.5) rotate(10deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}


/* Shake Effect */
.shake {
  animation: shake 0.3s cubic-bezier(.36, .07, .19, .97) both;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 1;
  transition: opacity 0.3s;
  pointer-events: all;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  /* Override glass-panel slightly for modal shape */
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  flex-direction: column;
  padding: 2rem;
  border-radius: 20px;
  align-items: flex-start;
  min-width: 300px;
  opacity: 1 !important;
  /* Force visibility overriding glass-panel */
  pointer-events: auto !important;
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.modal-content ul {
  list-style: none;
  padding: 0;
  margin-bottom: 2rem;
  text-align: left;
}

.modal-content li {
  margin-bottom: 0.8rem;
  font-size: 1.1rem;
}

.modal-content strong {
  color: #fff;
  margin-right: 0.5rem;
}

#close-help-btn {
  width: 100%;
  text-align: center;
}

@keyframes shake {

  10%,
  90% {
    transform: translate3d(-10px, 0, 0) rotate(-1deg);
  }

  20%,
  80% {
    transform: translate3d(10px, 0, 0) rotate(1deg);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-10px, 0, 0) rotate(-1deg);
  }

  40%,
  60% {
    transform: translate3d(10px, 0, 0) rotate(1deg);
  }
}

/* Particles */
.particle {
  position: absolute;
  pointer-events: none;
  background: white;
  opacity: 0.8;
  z-index: 50;
  border-radius: 50%;
  animation: fadeOut 0.5s linear forwards;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(0);
  }
}

/* Bullet Hole */
.bullet-hole {
  position: absolute;
  width: 10px;
  height: 10px;
  background: black;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
  z-index: 15;
}

/* Fire Particle */
.fire-particle {
  position: absolute;
  background: radial-gradient(circle, #ffe600 0%, #ff0000 60%, rgba(0, 0, 0, 0) 100%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 200;
  mix-blend-mode: screen;
  animation: fireRise 0.8s ease-out forwards;
}

@keyframes fireRise {
  0% {
    transform: scale(0.5) translateY(0);
    opacity: 1;
  }

  100% {
    transform: scale(2) translateY(-60px);
    opacity: 0;
  }
}

/* Custom Cursor */
.custom-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 9999;
  font-size: 3rem;
  transform-origin: center center;
  transition: transform 0.05s;
  will-change: transform, left, top;
}

/* Muzzle Flash */
.muzzle-flash {
  position: absolute;
  font-size: 4rem;
  pointer-events: none;
  z-index: 10000;
  animation: flash 0.1s ease-out forwards;
}

@keyframes flash {
  0% {
    transform: scale(0.5) rotate(0deg);
    opacity: 1;
  }

  50% {
    transform: scale(1.5) rotate(45deg);
    opacity: 1;
  }

  100% {
    transform: scale(1) rotate(90deg);
    opacity: 0;
  }
}