* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #08090d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#app-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #000;
}

/* Hidden camera video element (drawn directly onto canvas for recording) */
#camera-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

#camera-video.mirrored {
  transform: scaleX(-1);
}

/* Master 3D WebGL Gauntlet Layer */
#three-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

/* 2D Overlay: Whip physics, shockwaves, sparks & comic text */
#whip-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

/* Top HUD Bar */
.top-hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

/* Speed Frenzy Gauge */
.frenzy-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 20, 30, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 234, 0, 0.3);
  color: #ffea00;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.8px;
  box-shadow: 0 4px 20px rgba(255, 234, 0, 0.25);
  transition: transform 0.15s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.frenzy-badge.blazing {
  color: #ff0077;
  border-color: rgba(255, 0, 119, 0.6);
  box-shadow: 0 4px 25px rgba(255, 0, 119, 0.5);
  transform: scale(1.1);
  animation: pulseFrenzy 0.4s infinite alternate;
}

@keyframes pulseFrenzy {
  from { transform: scale(1.08); filter: drop-shadow(0 0 8px #ff0077); }
  to { transform: scale(1.15); filter: drop-shadow(0 0 16px #ff0077); }
}

.counter-badge {
  background: rgba(255, 59, 48, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(255, 59, 48, 0.4);
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.counter-badge.bump {
  transform: scale(1.22);
}

/* Floating Action Controls */
.controls-container {
  position: absolute;
  top: 72px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}

.btn-control {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 22, 32, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s, background-color 0.2s, border-color 0.2s;
  pointer-events: auto;
}

.btn-control:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.25);
}

/* Record Button Styling */
.btn-control.record-btn {
  background: rgba(220, 38, 38, 0.85);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 18px rgba(220, 38, 38, 0.45);
}

.btn-control.record-btn.recording {
  background: #ffffff;
  color: #dc2626;
  border-color: #dc2626;
  animation: pulseRecord 1s infinite alternate;
}

@keyframes pulseRecord {
  from { transform: scale(1); box-shadow: 0 0 10px #dc2626; }
  to { transform: scale(1.12); box-shadow: 0 0 25px #ff2222; }
}

/* Recording Timer Banner */
.record-timer {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(220, 38, 38, 0.9);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
}

.record-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: blink 0.8s infinite alternate;
}

@keyframes blink {
  from { opacity: 0.2; }
  to { opacity: 1; }
}

.record-timer.hidden {
  display: none;
}

/* Floating Tap Hint */
.tap-hint {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.4s ease;
  animation: pulseHint 2s infinite ease-in-out;
}

@keyframes pulseHint {
  0%, 100% { opacity: 0.85; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

.tap-hint.hidden {
  opacity: 0;
  visibility: hidden;
}

/* Center Tactical AR Targeting Reticle */
.target-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  pointer-events: none;
  z-index: 5;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0.75;
  transition: transform 0.12s ease, opacity 0.2s ease;
}

.target-crosshair.active {
  transform: translate(-50%, -50%) scale(1.35);
  opacity: 1;
}

.crosshair-ring {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 234, 0, 0.8);
  box-shadow: 0 0 12px rgba(255, 234, 0, 0.45);
  animation: spinReticle 12s linear infinite;
}

@keyframes spinReticle {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.crosshair-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffea00;
  box-shadow: 0 0 8px #ffea00;
}

/* Video Preview Modal */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 10, 16, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 20px;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.modal-card {
  background: #151824;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  color: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.preview-video-container {
  width: 100%;
  max-height: 50vh;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  margin: 16px 0 20px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#preview-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-btn {
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  border: none;
  background: #ff3b30;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 59, 48, 0.4);
  transition: opacity 0.15s, transform 0.15s;
}

.modal-btn:active {
  transform: scale(0.98);
}

.modal-btn.share-btn {
  background: #007aff;
  box-shadow: 0 4px 15px rgba(0, 122, 255, 0.4);
}

.modal-btn.replay-btn {
  background: #34c759;
  box-shadow: 0 4px 15px rgba(52, 199, 89, 0.4);
}

.modal-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}
