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

:root {
  --bg: #0a0a0f;
  --accent: #3ddc84;
  --text: #f5f5f7;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}

#app, .screen { position: fixed; inset: 0; }
.hidden { display: none !important; }

/* ---------- Écran d'accueil ---------- */
#start-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) 28px env(safe-area-inset-bottom);
  background: radial-gradient(circle at 50% 30%, #16213a 0%, #0a0a0f 70%);
}
.start-content { text-align: center; max-width: 340px; }
.logo { font-size: 72px; margin-bottom: 8px; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { color: #9aa0b0; margin-top: 6px; font-size: 16px; }
.features {
  list-style: none;
  text-align: left;
  margin: 28px auto;
  display: inline-block;
}
.features li {
  padding: 8px 0 8px 28px;
  position: relative;
  color: #d0d3dd;
  font-size: 15px;
}
.features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}
#start-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 16px;
  background: var(--accent);
  color: #04160c;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
#start-btn:active { transform: scale(0.98); }
.hint { margin-top: 16px; font-size: 13px; color: #6b7080; }

/* ---------- Écran caméra ---------- */
#camera-screen { background: #000; }
#video, #overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#overlay { pointer-events: none; }

/* Barre de diagnostic (temporaire, pour débugger sans console sur iPhone) */
#debug-bar {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 58px);
  left: 12px;
  right: 12px;
  z-index: 5;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: #9adfb5;
  word-break: break-word;
}
#debug-bar.error { color: #ff8a80; }

#hud-top {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 5;
}
.hud-pill {
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.1);
}
.hud-btn { margin-left: auto; cursor: pointer; color: var(--text); font-size: 16px; }
.hud-btn-float {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  z-index: 6;
}

/* ---------- Loading ---------- */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0,0,0,0.75);
  z-index: 10;
}
.spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-size: 14px; color: #c0c4cf; }

/* ---------- Settings ---------- */
#settings-panel {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  left: 20px;
  right: 20px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 18px;
  z-index: 6;
}
#settings-panel label { display: block; font-size: 14px; font-weight: 600; }
#settings-panel input[type=range] { width: 100%; margin: 12px 0 4px; accent-color: var(--accent); }
.settings-note { font-size: 12px; color: #8a8f9d; margin-top: 8px; line-height: 1.4; }
