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

body, html {
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

/* Fullscreen Root Container */
.camera-root {
  position: relative;
  width: 100vw;
  height: 100dvh;
  background: #000;
  overflow: hidden;
}

/* Fullscreen Viewfinder Canvas */
#steadyCanvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Tap to Focus Reticle Box */
.focus-box {
  position: absolute;
  width: 64px;
  height: 64px;
  border: 2px solid #10b981;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.3);
  opacity: 0;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease;
  z-index: 30;
}

.focus-box.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Permission Tap-to-Start Overlay (100% Mobile Browser Compatibility) */
.permission-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, #111827 0%, #030712 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

.permission-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
}

.perm-icon {
  font-size: 48px;
  margin-bottom: 4px;
}

.permission-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.permission-card p {
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.5;
}

.perm-btn {
  width: 100%;
  background: #10b981;
  color: #032218;
  font-size: 14px;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
  transition: transform 0.1s ease;
}

.perm-btn:active {
  transform: scale(0.97);
}

/* Minimal Horizon Line Guide */
.horizon-guide {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.horizon-line {
  width: 80px;
  height: 1px;
  background: rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 4px rgba(0,0,0,0.8);
  transition: transform 0.05s linear;
}

/* Minimal Top Floating Controls */
.camera-top-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: env(safe-area-inset-top, 14px) 16px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
  z-index: 20;
}

.mode-tag {
  font-size: 11px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.85);
  color: #032218;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.top-right-actions {
  display: flex;
  gap: 10px;
}

.glass-icon-btn {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Floating Floating Controls (Axis Lock + Zoom) */
.camera-floating-controls {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 20;
}

.axis-lock-bar {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.axis-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  border: none;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.axis-btn.active {
  background: #3b82f6;
  color: #fff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Floating Clean Zoom Chips */
.camera-zoom-bar {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.zoom-chip {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: none;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.zoom-chip.active {
  background: #10b981;
  color: #022017;
}

/* Native Camera Bottom Controls */
.camera-bottom-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 24px calc(env(safe-area-inset-bottom, 16px) + 16px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: linear-gradient(0deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0) 100%);
  z-index: 20;
}

.sub-action-btn {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.main-shutter-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
}

.shutter-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #ef4444;
  transition: all 0.2s ease;
}

.main-shutter-btn.recording .shutter-core {
  width: 46%;
  height: 46%;
  border-radius: 8px;
}

/* Recording Pill Indicator */
.rec-pill {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  z-index: 25;
}

.rec-blink {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: blink 1s infinite;
}

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

/* Settings Modal Sheet */
.settings-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.settings-modal-sheet {
  background: #111420;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px 24px 0 0;
  padding: 20px;
  max-height: 75vh;
  overflow-y: auto;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.settings-header h3 {
  font-size: 16px;
  color: #fff;
}

.close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.setting-item label {
  font-size: 12px;
  color: #9ca3af;
}

.setting-item label b {
  color: #10b981;
}

.setting-item input[type="range"] {
  accent-color: #10b981;
}

.mode-select-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #9ca3af;
  border-radius: 8px;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.mode-btn.active {
  background: #10b981;
  color: #022017;
  font-weight: 700;
  border-color: #10b981;
}

.setting-select {
  background: #181c2a;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e5e7eb !important;
  cursor: pointer;
}

.check-label input {
  accent-color: #10b981;
  width: 16px;
  height: 16px;
}

/* Video Saved Modal */
.save-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.save-modal-card {
  background: #111420;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  padding: 18px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.modal-video-wrap {
  width: 100%;
  height: 200px;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}

.modal-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

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

.modal-btn {
  padding: 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
}

.modal-btn.primary {
  background: #10b981;
  color: #032218;
}

.modal-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #9ca3af;
}

/* Toast */
.toast {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 185, 129, 0.95);
  color: #032218;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  z-index: 40;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}
