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

:root {
  --bg:          #0a0a0f;
  --surface:     #12121a;
  --border:      #1e1e2e;
  --accent:      #00d4ff;
  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --ok:          #22c55e;
  --warn:        #f59e0b;
  --error:       #ef4444;
  --pinch:       #ff6b35;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────── */
header {
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.accent { color: var(--accent); }

#status-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

#status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s, box-shadow 0.3s;
}

#status-dot.ok    { background: var(--ok);    box-shadow: 0 0 8px var(--ok); }
#status-dot.warn  { background: var(--warn);  box-shadow: 0 0 8px var(--warn); }
#status-dot.error { background: var(--error); box-shadow: 0 0 8px var(--error); }

/* ── Main ────────────────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

#scene-wrapper {
  position: relative;
  width: 100%;
  max-width: 900px;
}

/* selfie mirror — only the visual content, not the badge */
#scene {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  transform: scaleX(-1);
  box-shadow: 0 0 40px rgba(0, 212, 255, 0.06);
}

video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Touch badge ─────────────────────────────────────── */
#pinch-badge {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  background: linear-gradient(135deg, var(--pinch), #f7931e);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  padding: 0.45rem 1.2rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: calc(100% - 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
  z-index: 10;
}

#pinch-badge.active {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

#pinch-badge.snap {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.7);
  letter-spacing: 0.18em;
  font-size: 0.9rem;
}

/* ── Footer ──────────────────────────────────────────── */
footer {
  padding: 1rem 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

footer strong { color: var(--accent); }
