* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050505;
  color: white;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Hide actual camera feed */
video {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.bg-glow {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  background: radial-gradient(circle, rgba(255,255,255,0.08), rgba(0,0,0,0));
  transition: all 0.8s ease;
  transform: scale(1);
}

.app {
  position: relative;
  z-index: 2;
  width: min(90vw, 420px);
  padding: 18px 22px 28px;
  border-radius: 32px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    0 20px 60px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.06);
  text-align: center;
}

.top-line {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  margin-bottom: 18px;
  background: rgba(255,255,255,0.15);
  box-shadow: 0 0 14px rgba(255,255,255,0.08);
  transition: all 0.5s ease;
}

.orb {
  width: 120px;
  height: 120px;
  margin: 12px auto 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff, #d9d9d9 35%, #141414 75%);
  box-shadow:
    0 0 35px rgba(255,255,255,0.18),
    0 0 90px rgba(255,255,255,0.08);
  transition: all 0.6s ease;
  animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.text-wrap h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 10px;
}

.text-wrap p {
  font-size: 0.98rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.45;
  min-height: 42px;
}

.distance-text {
  margin-top: 10px;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.02em;
}

button {
  margin-top: 26px;
  width: 100%;
  border: none;
  outline: none;
  border-radius: 18px;
  padding: 16px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: #111;
  background: linear-gradient(180deg, #ffffff, #d9d9d9);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: scale(0.99);
}

/* WAITING */
.state-waiting .orb {
  background: radial-gradient(circle at 35% 35%, #ffffff, #d9d9d9 35%, #141414 75%);
  box-shadow:
    0 0 35px rgba(255,255,255,0.18),
    0 0 90px rgba(255,255,255,0.08);
}
.state-waiting .bg-glow {
  background: radial-gradient(circle, rgba(255,255,255,0.08), rgba(0,0,0,0));
}
.state-waiting .top-line {
  background: rgba(255,255,255,0.15);
  box-shadow: 0 0 14px rgba(255,255,255,0.08);
}

/* PERFECT */
.state-perfect .orb {
  background: radial-gradient(circle at 35% 35%, #f1ffe6, #7dff85 35%, #0d160d 75%);
  box-shadow:
    0 0 45px rgba(125,255,133,0.42),
    0 0 110px rgba(125,255,133,0.18);
}
.state-perfect .bg-glow {
  background: radial-gradient(circle, rgba(125,255,133,0.22), rgba(0,0,0,0));
  transform: scale(1.05);
}
.state-perfect .top-line {
  background: linear-gradient(90deg, rgba(125,255,133,0.7), rgba(125,255,133,1));
  box-shadow: 0 0 16px rgba(125,255,133,0.35);
}

/* CLOSE */
.state-close .orb {
  background: radial-gradient(circle at 35% 35%, #ffd7d7, #ff6666 35%, #1c0b0b 75%);
  box-shadow:
    0 0 45px rgba(255,102,102,0.42),
    0 0 110px rgba(255,102,102,0.18);
}
.state-close .bg-glow {
  background: radial-gradient(circle, rgba(255,90,90,0.20), rgba(0,0,0,0));
  transform: scale(0.95);
}
.state-close .top-line {
  background: linear-gradient(90deg, rgba(255,102,102,0.7), rgba(255,102,102,1));
  box-shadow: 0 0 16px rgba(255,102,102,0.35);
}

/* FAR */
.state-far .orb {
  background: radial-gradient(circle at 35% 35%, #dff4ff, #7bcfff 35%, #0a1118 75%);
  box-shadow:
    0 0 45px rgba(123,207,255,0.35),
    0 0 110px rgba(123,207,255,0.14);
}
.state-far .bg-glow {
  background: radial-gradient(circle, rgba(123,207,255,0.16), rgba(0,0,0,0));
  transform: scale(1.1);
}
.state-far .top-line {
  background: linear-gradient(90deg, rgba(123,207,255,0.7), rgba(123,207,255,1));
  box-shadow: 0 0 16px rgba(123,207,255,0.28);
}