:root {
  --bg: #0a0a0a;
  --accent: linear-gradient(135deg, #667eea, #764ba2);
  --panel: rgba(255,255,255,0.08);
  --text: #fff;
  --glass: rgba(255,255,255,0.06); 
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  overflow: hidden;
  touch-action: manipulation; /* Prevent double-tap zoom */
}

/* Camera + Overlay */
.stage { position: relative; width: 100%; height: 100%; }
#camera {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 5;
 touch-action: none; 
}

/* Top Bar */
.topbar {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 30;
}
.badge {
  background: var(--panel);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 28px 70px rgba(234, 88, 12, 0.55), 0 0 55px rgba(251, 146, 60, 0.45), inset 0 4px 16px rgba(255,255,255,0.35);
}
.control-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2px solid rgba(255,255,255,0.1);
  color: #fff;
}

/* Capture Button */
#screenshotBtn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.2);
  background: rgba(124, 58, 237, 0.8);
  box-shadow: 0 8px 24px rgba(255,105,135,0.35);
  cursor: pointer;
  z-index: 40;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#screenshotBtn:active { transform: translateX(-50%) scale(0.96); }

/* Side Buttons */
.side-btn {
  position: fixed;
  bottom: 32px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  border: 2px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 41;
  color: #fff;
  backdrop-filter: blur(8px);
  font-size: 20px;
  transition: transform 0.2s;
}
.side-btn.left { left: calc(50% - 140px); }
.side-btn.right { left: calc(50% + 80px); }
.side-btn:active { transform: scale(0.95); }
@media (max-width: 400px) {
  .side-btn.left { left: calc(50% - 120px); }
  .side-btn.right { left: calc(50% + 60px); }
}

/* Controls Panel */
.controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 0px 20px 20px 20px;
  z-index: 20;
  color: #fff;
  overflow-y: auto;
  max-height: 50%;
  transition: transform 0.3s ease;
}
.controls.hidden {
  transform: translateY(100%);
}
.controls h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
  margin: 6px 0 4px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}
input[type="text"], select {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background-color: rgba(255, 255, 255, 0.1); 
  color: #fff;
  font-size: 16px;
  min-height: 48px;
}
input[type="range"] {
  flex: 1;
  height: 48px;
}

/* Emoji Grid */
.emoji-grid {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  padding: 4px 0;
}
.emoji-btn {
  font-size: 24px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: transparent;
  padding: 8px;
  cursor: grab;
  color: #fff;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.emoji-btn:active {
  background: rgba(255,255,255,0.2);
}
.emoji-btn.pulse {
  animation: pulse 0.3s;
}
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 60;
}
.modal img {
  max-width: 90%;
  max-height: 60%;
  border-radius: 12px;
  margin-bottom: 12px;
}
.modal-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.modal-buttons button {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: var(--accent); 
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 16px;
  min-width: 100px;
  flex: 1 1 calc(50% - 10px);
  max-width: 160px;
  text-align: center;
}

@media (max-width: 480px) {
  .modal-buttons button {
    flex: 1 1 calc(50% - 10px); 
  }
}

#sharePromptModal {
  text-align: center;
}
#sharePromptModal h3 {
  font-size: 24px;
  margin: 0 0 10px;
}
#sharePromptModal p {
  font-size: 16px;
  margin: 0 0 20px;
}
#faithSparkCounter {
  margin-top: 20px;
  font-size: 14px;
  opacity: 0.8;
}

.onboarding-tooltip {
    position: fixed;
    background: linear-gradient(135deg, #667eea, #764ba2); /* Matches swapBtn */
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    max-width: 200px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    touch-action: none; /* Ensures tap works on mobile */
}

/* Ensure toggle button is touch-friendly */
#toggleControlsBtn.fab {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px; /* Matches existing FAB */
}

.controls-buttons {
  display: flex; /* Ensure default visibility when controls are hidden */
  z-index: 45; /* Above controls (z-index: 20) */
}

/* Floating Action Button */
.right-mini {
  position: fixed;
  right: 18px;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 55;
}

.fab {
  width: 47px;
  height: 47px;
  border-radius: 12px;
  background: var(--glass);
  backdrop-filter: blur(6px);
  border: none;
  box-shadow: 0 6px 18px rgba(2,6,23,0.45);
  color: #fff;
  font-size: 18px;
  z-index: 50;
  transition: transform 0.2s;
}
.fab:active { transform: scale(0.95); }

.soul-spark-header .emoji {
  font-size: 1.5em; /* Slightly larger than text */
  margin-right: 8px; /* Space between emoji and text */
  display: inline-block;
  vertical-align: middle;
}
.soul-spark-header {
  position: relative;
  margin: 10px auto 20px auto;
  padding: 15px 20px;
  background: linear-gradient(90deg, rgba(124,58, 237, 0.35), rgba(6, 182, 212, 0.55));
  backdrop-filter: blur(5px); /* Frosted glass effect */
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  color: #fff;
  font-size: clamp(1rem, 3vw, 1.25rem); /* Responsive font size */
  font-family: 'Poppins', sans-serif;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  animation: pulse-glow 2s ease-in-out infinite;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3); /* Soft glow */
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3); }
  50% { box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5); }
}
