:root {
  --bg: #0f1115;
  --fg: #f5f7fa;
  --accent: #3b82f6;
  --ok: #22c55e;
  --warn: #f59e0b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

/* ---------- Page QR (desktop) ---------- */
.page-index {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.card {
  background: #171a21;
  border: 1px solid #262b36;
  border-radius: 16px;
  padding: 32px;
  max-width: 760px;
  text-align: center;
}
.card h1 { font-size: 1.4rem; margin-top: 0; }
.versions {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin: 20px 0 8px;
}
.version {
  flex: 1 1 300px;
  max-width: 340px;
  background: #12151c;
  border: 1px solid #262b36;
  border-radius: 14px;
  padding: 18px;
}
.version h2 { font-size: 1.1rem; margin: 0 0 8px; color: var(--accent); }
.version-desc { color: #9aa4b2; font-size: .85rem; margin: 8px 0; }
.qr {
  width: 220px;
  height: 220px;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  margin: 8px auto;
  display: block;
}
.hint { color: #9aa4b2; font-size: .9rem; margin-bottom: 4px; }
.scan-link { color: var(--accent); word-break: break-all; }
.legend {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
  color: #c4ccd8;
}

/* ---------- Page caméra (mobile) ---------- */
.page-scan { overflow: hidden; }
.viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000;
}
#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: env(safe-area-inset-top, 16px);
}
.badge {
  margin-top: 20px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 1.2rem;
  font-weight: 700;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  border: 2px solid transparent;
}
.badge.searching { color: #cbd5e1; border-color: #475569; }
.badge.detected  { color: #fff;     border-color: var(--ok); background: rgba(34,197,94,.25); }
.detail {
  margin-top: 8px;
  font-size: .85rem;
  color: #e2e8f0;
  background: rgba(0,0,0,.5);
  padding: 4px 12px;
  border-radius: 8px;
  max-width: 90vw;
  text-align: center;
}
.controls {
  position: absolute;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 0; right: 0;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.btn-debug { background: #6b7280; }

/* Cadre guide (v2) : matérialise la zone réellement analysée (~90%×66% centré). */
.guide {
  position: absolute;
  left: 5%;
  top: 17%;
  width: 90%;
  height: 66%;
  border: 2px solid rgba(59,130,246,.9);
  border-radius: 14px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.25);
  pointer-events: none;
}
.version-tag {
  margin-top: env(safe-area-inset-top, 12px);
  align-self: center;
  font-size: .8rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(0,0,0,.5);
  padding: 3px 10px;
  border-radius: 999px;
}
.btn {
  pointer-events: auto;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px 26px;
  border-radius: 12px;
}
.btn:disabled { opacity: .4; }
