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

html, body {
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Prevent pull-to-refresh and bounce on mobile */
  overscroll-behavior: none;
  touch-action: none;
  position: fixed;
  top: 0;
  left: 0;
}

#ar-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Loading overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-content p {
  margin-top: 16px;
  font-size: 18px;
  font-weight: 500;
}

.loading-hint {
  font-size: 14px !important;
  opacity: 0.6;
  margin-top: 8px !important;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Coaching overlay */
#coaching-overlay {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  text-align: center;
  color: white;
  transition: opacity 0.4s ease;
}

#coaching-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.coaching-content p {
  margin-top: 12px;
  font-size: 16px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.scan-icon {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.05); }
}

/* Fullscreen prompt toast */
#fullscreen-prompt {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: opacity 0.4s ease, transform 0.4s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  max-width: calc(100% - 32px);
}

#fullscreen-prompt.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
  pointer-events: none;
}

#fullscreen-prompt .fs-icon {
  font-size: 20px;
  flex-shrink: 0;
}

#fullscreen-prompt .fs-text {
  line-height: 1.3;
}

#fullscreen-prompt .fs-dismiss {
  opacity: 0.5;
  font-size: 12px;
  margin-left: 8px;
  flex-shrink: 0;
}

/* Model loading progress bar */
#model-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 800;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#model-loader.hidden {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

#model-loader .loader-label {
  color: white;
  font-size: 13px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

#model-loader .loader-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

#model-loader .loader-fill {
  height: 100%;
  width: 0%;
  background: #4fc3f7;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── Zoom Slider ────────────────────────────────────────────────── */

#zoom-slider {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 550;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: 20px;
  transition: opacity 0.3s ease;
  max-width: calc(100% - 48px);
}

#zoom-slider.hidden {
  opacity: 0;
  pointer-events: none;
}

.zoom-label {
  color: white;
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
}

#zoom-value {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  font-weight: 600;
  min-width: 32px;
  text-align: right;
  flex-shrink: 0;
}

#zoom-range {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  outline: none;
}

#zoom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

#zoom-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* ── Record Button ──────────────────────────────────────────────── */

#record-wrapper {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  pointer-events: auto;
}

#record-btn {
  position: relative;
  width: 72px;
  height: 72px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

#record-btn svg {
  position: absolute;
  top: 0;
  left: 0;
}

#record-icon {
  width: 28px;
  height: 28px;
  background: #ff3b30;
  border-radius: 50%;
  display: block;
  transition: border-radius 0.2s ease, width 0.2s ease, height 0.2s ease;
  box-shadow: 0 0 12px rgba(255, 59, 48, 0.5);
  z-index: 1;
}

#record-btn.recording #record-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
}

#record-timer {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  white-space: nowrap;
  z-index: 1;
}

#ring-progress {
  transition: stroke-dashoffset 0.3s linear;
}

/* ── Share Overlay ──────────────────────────────────────────────── */

#share-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

#share-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.share-card {
  width: min(90vw, 360px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#share-preview {
  width: 100%;
  max-height: 50vh;
  border-radius: 12px;
  background: #111;
  object-fit: contain;
}

.share-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.share-btn {
  padding: 12px 24px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s;
}

.share-btn:active {
  background: rgba(255,255,255,0.2);
}

.share-btn.primary {
  background: #007AFF;
  border-color: #007AFF;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.share-btn.primary svg {
  flex-shrink: 0;
}

.share-btn.dismiss {
  opacity: 0.6;
  border: none;
}

/* Social platform buttons */
.social-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  transition: opacity 0.3s ease, max-height 0.3s ease;
  max-height: 80px;
  overflow: hidden;
}

.social-links.hidden {
  opacity: 0;
  max-height: 0;
  pointer-events: none;
}

.social-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.social-btn:active {
  transform: scale(0.92);
}

.social-btn[data-platform="twitter"] { background: #000; }
.social-btn[data-platform="facebook"] { background: #1877F2; }
.social-btn[data-platform="whatsapp"] { background: #25D366; }
.social-btn[data-platform="linkedin"] { background: #0A66C2; }
.share-status {
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  text-align: center;
}
