/* ═══════════════════════════════════════════════════════════════════════════
   NEON FINGER PAINTING GAME - STANDALONE
   ═══════════════════════════════════════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Montserrat', sans-serif;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  color: white;
  -webkit-overflow-scrolling: touch;
}

.game-container {
  width: 100%;
  min-height: 100vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

/* Game Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(255, 107, 138, 0.3);
}

.game-title {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, #ff7a65, #ff5b7a, #ffa6c9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: 'Cormorant Garamond', serif;
  text-shadow: 0 0 30px rgba(255, 107, 138, 0.5);
  animation: glow-title 3s ease-in-out infinite;
}

@keyframes glow-title {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.3);
  }
}

.back-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #ff7a65, #ff5b7a);
  border: none;
  border-radius: 50px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(255, 107, 138, 0.4);
  text-decoration: none;
}

.back-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(255, 107, 138, 0.6);
  filter: brightness(1.1);
}

.back-button span:first-child {
  font-size: 20px;
}

/* Game Content */
.game-content {
  display: flex;
  gap: 20px;
  flex: 1;
  overflow: hidden;
}

/* Webcam Section */
.webcam-section {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.webcam-container {
  position: relative;
  width: 100%;
  height: 240px;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  border: 3px solid rgba(255, 107, 138, 0.3);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

#webcam {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.webcam-status {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.7);
  color: #4ade80;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Color Palette */
.color-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  border: 2px solid rgba(255, 107, 138, 0.2);
  overflow: hidden;
}

.color-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid transparent;
  position: relative;
  overflow: hidden;
}

.color-option::before {
  content: '';
  position: absolute;
  inset: -5px;
  background: inherit;
  filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.color-option:hover::before {
  opacity: 0.4;
}

.color-option:hover {
  transform: scale(1.05);
  border-color: white;
}

.color-option.active {
  border-color: white;
  transform: scale(1.1);
}

.color-option.active::before {
  opacity: 0.6;
}

/* Neon Colors - Enhanced Glittery Glow (contained) */
.color-neon-pink { 
  background: linear-gradient(135deg, #ff006e, #ff4d94);
  box-shadow: inset 0 0 15px #ff006e, inset 0 0 30px #ff006e;
}
.color-neon-blue { 
  background: linear-gradient(135deg, #00f5ff, #4dffff);
  box-shadow: inset 0 0 15px #00f5ff, inset 0 0 30px #00f5ff;
}
.color-neon-green { 
  background: linear-gradient(135deg, #39ff14, #7dff5c);
  box-shadow: inset 0 0 15px #39ff14, inset 0 0 30px #39ff14;
}
.color-neon-yellow { 
  background: linear-gradient(135deg, #ffff00, #ffff66);
  box-shadow: inset 0 0 15px #ffff00, inset 0 0 30px #ffff00;
}
.color-neon-purple { 
  background: linear-gradient(135deg, #bc13fe, #d966ff);
  box-shadow: inset 0 0 15px #bc13fe, inset 0 0 30px #bc13fe;
}
.color-neon-orange { 
  background: linear-gradient(135deg, #ff6600, #ff9933);
  box-shadow: inset 0 0 15px #ff6600, inset 0 0 30px #ff6600;
}
.color-neon-cyan { 
  background: linear-gradient(135deg, #00ffff, #66ffff);
  box-shadow: inset 0 0 15px #00ffff, inset 0 0 30px #00ffff;
}
.color-neon-red { 
  background: linear-gradient(135deg, #ff0000, #ff4d4d);
  box-shadow: inset 0 0 15px #ff0000, inset 0 0 30px #ff0000;
}

/* Tools */
.tools-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-button {
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 107, 138, 0.3);
  border-radius: 15px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: 'Montserrat', sans-serif;
}

.tool-button:hover {
  background: rgba(255, 107, 138, 0.2);
  border-color: rgba(255, 107, 138, 0.6);
  transform: translateX(5px);
}

.tool-button.active {
  background: linear-gradient(135deg, #ff7a65, #ff5b7a);
  border-color: #ff7a65;
  box-shadow: 0 4px 20px rgba(255, 107, 138, 0.5);
}

.tool-button span {
  font-size: 20px;
}

/* Canvas Section */
.canvas-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.canvas-container {
  flex: 1;
  position: relative;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  border: 3px solid rgba(255, 107, 138, 0.3);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

#drawingCanvas {
  width: 100%;
  height: 100%;
  cursor: none;
}

/* Finger Cursor on Canvas */
.finger-cursor {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 3px solid white;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10;
  transform: translate(-50%, -50%);
  transition: all 0.05s ease;
  box-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
  animation: pulse-cursor 1.5s ease-in-out infinite;
  display: none;
  color: #ff006e;
}

.finger-cursor::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 15px currentColor;
}

@keyframes pulse-cursor {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.8;
  }
}

.canvas-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.control-button {
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 107, 138, 0.3);
  border-radius: 12px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Montserrat', sans-serif;
}

.control-button:hover {
  background: rgba(255, 107, 138, 0.2);
  border-color: rgba(255, 107, 138, 0.6);
  transform: translateY(-2px);
}

.control-button.clear {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: #ef4444;
}

.control-button.clear:hover {
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
}

/* Instructions */
.instructions {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 20px;
  pointer-events: none;
  font-family: 'Montserrat', sans-serif;
}

.instructions.hidden {
  display: none;
}

.instructions-small {
  font-size: 14px;
  opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
  }
  
  .game-container {
    padding: 10px;
    height: auto !important;
    min-height: 100vh;
    overflow-y: visible !important;
  }
  
  .game-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  
  .game-title {
    font-size: 24px;
  }
  
  .game-content {
    flex-direction: column;
    overflow: visible !important;
    height: auto !important;
  }
  
  .webcam-section {
    width: 100%;
  }
  
  .webcam-container {
    height: 200px;
  }
  
  .color-palette {
    grid-template-columns: repeat(8, 1fr);
  }
  
  .tools-section {
    flex-direction: row;
  }
  
  .canvas-section {
    height: auto !important;
    min-height: 500px;
  }
  
  .canvas-container {
    height: 400px !important;
  }
  
  .canvas-controls {
    margin-top: 15px;
    margin-bottom: 30px;
  }
}
