* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #0a0a0f;
  color: #fff;
  overflow: hidden;
  touch-action: manipulation;
}

/* Fixed fullscreen */
.fixed-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Loading screen */
.loading-content {
  text-align: center;
  padding: 2rem;
}

.loading-content p {
  margin-top: 1rem;
  opacity: 0.8;
}

.loading-progress {
  width: 200px;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  margin: 1.5rem auto 0;
  overflow: hidden;
}

#loading-progress-bar {
  width: 0%;
  height: 100%;
  background: #3b82f6;
  transition: width 2s ease-out;
}

/* Camera consent (mobile - tap to trigger permission) */
.consent-content {
  text-align: center;
  padding: 2rem;
  max-width: 340px;
}

.consent-content p {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  line-height: 1.4;
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.1rem;
  min-height: 48px;
  cursor: pointer;
}
.btn-outline {
  margin-top: 12px;
  background: transparent;
  border: 2px solid rgba(255,255,255,0.5);
}
.btn-outline:hover {
  background: rgba(255,255,255,0.1);
}

#camera-consent-screen {
  z-index: 1100;
}

/* Permission denied */
.permission-denied-content {
  text-align: center;
  padding: 2rem;
  max-width: 320px;
}

.permission-denied-content .hint {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 0.5rem;
}

.btn {
  margin-top: 1.5rem;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: #3b82f6;
  color: white;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn:hover {
  background: #2563eb;
}

.btn:active {
  transform: scale(0.98);
}

/* AR container */
#ar-view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.ar-container {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.ar-container canvas,
.ar-container video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
}

/* Top controls */
.controls-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: max(env(safe-area-inset-top), 12px) 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
  z-index: 10;
}

.mode-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.1);
  padding: 4px;
  border-radius: 12px;
}

.mode-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn:hover {
  color: #fff;
}

.mode-btn.active {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.3);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

/* Hide flip button when in upload mode */
.controls-top.upload-mode #btn-flip-camera {
  visibility: hidden;
  pointer-events: none;
}

/* Sticker carousel */
.sticker-carousel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px max(env(safe-area-inset-bottom), 12px);
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  z-index: 10;
}

.sticker-carousel::-webkit-scrollbar {
  height: 4px;
}

.sticker-carousel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
}

.carousel-inner {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  min-width: min-content;
}

.sticker-btn {
  flex-shrink: 0;
  padding: 10px 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 24px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.sticker-btn:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.5);
}

.sticker-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
}

/* Screenshot button */
.screenshot-btn {
  position: absolute;
  bottom: 140px;
  right: 16px;
  z-index: 5;
}

/* Responsive - smaller screens */
@media (max-width: 480px) {
  .mode-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  .sticker-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .screenshot-btn {
    bottom: 120px;
  }
}
