﻿/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  /* Android Chrome fallback before dvh support */
  height: -webkit-fill-available;
  background: #000;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── AR container ── */
.ar-container {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  touch-action: none;
}

/* Chrome: explicitly fill the container so the GL canvas matches the viewport */
a-scene {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── No-face overlay ── */
#no-face {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 50;
}
#no-face img {
  width: 85%;
  max-width: 360px;
  height: auto;
}

/* ── Top bar ── */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: 12px;
  padding-left: 16px;
  padding-right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, transparent 100%);
  z-index: 100;
  pointer-events: none;
}
#top-bar img {
  height: 24px;
  width: auto;
  display: block;
}

/* ── Bottom bar ── */
#bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  padding-left: max(40px, env(safe-area-inset-left));
  padding-right: max(40px, env(safe-area-inset-right));
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
  z-index: 100;
}

/* ── Side buttons ── */
.bar-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: #fff;
  min-width: 52px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  opacity: 0.9;
}
.bar-btn img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
}

/* ── Capture button ── */
#capture-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
#capture-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: transparent;
  border: 4px solid rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
  touch-action: manipulation;
}
#capture-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
  -webkit-transition: border-radius 0.2s, background 0.2s, width 0.2s, height 0.2s;
  transition: border-radius 0.2s, background 0.2s, width 0.2s, height 0.2s;
}
#capture-btn.recording #capture-inner {
  border-radius: 10px;
  background: #e0303a;
  width: 36px;
  height: 36px;
}

/* ── REC badge ── */
#rec-badge {
  position: absolute;
  top: -28px;
  left: 50%;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  background: #e0303a;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  display: none;
  font-family: sans-serif;
  white-space: nowrap;
}

/* ── Share overlay ── */
#share-overlay {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 150;
  background: rgba(0,0,0,0.82);
  align-items: center;
  justify-content: center;
}
#share-overlay.visible {
  display: -webkit-flex;
  display: flex;
}
#share-overlay > img {
  max-width: 88%;
  max-height: 82vh;
  height: auto;
  border-radius: 16px;
}
#share-close {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  background: rgba(0,0,0,0.55);
  border: 2px solid rgba(255,255,255,0.6);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: -webkit-flex;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
  touch-action: manipulation;
}

canvas {
  touch-action: none;
}

/* ── Processing overlay ── */
#processing-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 300;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.processing-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: #fff;
  font-family: sans-serif;
  font-size: 1rem;
}
.processing-box p { margin: 0; }
.processing-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
