:root {
  --ink: #0b0c10;
  --paper: #ffffff;
  --accent: #ff385c;
  --glass: rgba(0, 0, 0, 0.35);
  --glass-strong: rgba(0, 0, 0, 0.6);
  --radius: 50%;
}

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

html,
body {
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family:
    -apple-system, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000;
}

#camera-feed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#ar-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
  pointer-events: none;
}

/* ── Top bar ── */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) 20px 12px;
  z-index: 10;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--glass-strong);
  color: var(--paper);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.status-pill {
  background: var(--glass-strong);
  color: var(--paper);
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 5px 12px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.4s ease;
}
.status-pill.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Bottom bar ── */
.bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0.3) 60%,
    transparent 100%
  );
}

/* ── Filter carousel ── */
.filter-carousel {
  display: flex;
  gap: 14px;
  padding: 12px 20px 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.filter-carousel::-webkit-scrollbar {
  display: none;
}

.filter-thumb {
  flex: 0 0 auto;
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  scroll-snap-align: center;
  cursor: pointer;
}

.filter-thumb > img,
.filter-thumb > .filter-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}

.filter-thumb.active > img,
.filter-thumb.active > .filter-icon {
  border-color: var(--accent);
  transform: scale(1.08);
}

.filter-label {
  color: rgba(255, 255, 255, 0.85);
  font-size: 10px;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 64px;
}

/* ── Capture row ── */
.capture-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 52px;
  padding: 4px 0 8px;
}

.capture-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3.5px solid var(--paper);
  background: transparent;
  position: relative;
  cursor: pointer;
}
.capture-btn::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--paper);
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}
.capture-btn:active::after {
  background: var(--accent);
  transform: scale(0.88);
}

.side-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--paper);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: linear-gradient(180deg, #0b0b0d 0%, #1c1c1e 100%);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

#loading-screen.loading-hidden {
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

.loading-ring {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-ring svg:first-child {
  position: absolute;
  inset: 0;
  animation: loading-spin 1.6s linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(270deg);
  }
}

.loading-face {
  animation: loading-pulse 2.4s ease-in-out infinite;
}

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

#loading-status {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #f5f5f7;
  letter-spacing: 0.2px;
  margin: 0;
}

.loading-dots {
  display: flex;
  gap: 8px;
}

.loading-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition:
    background 0.3s ease,
    transform 0.3s ease;
}

.loading-dots .dot.active {
  background: linear-gradient(135deg, #0a84ff, #34c759);
  transform: scale(1.3);
}
