/* Hallo · tournage. Téléphone d'abord. */
:root {
  --porte: #17342B; --soleil: #F2B33D; --jour: #F6F5F1; --pierre: #ECEAE3; --encre: #14201B; --lichen: #5A6862;
  --bg: var(--jour); --surface: #FFFFFF; --surface2: var(--pierre); --fg: var(--encre); --fg2: var(--lichen); --ligne: #DCD9CF;
  --ok: #2F6B4F; --okfond: #DCEBE2; --alerte: #8A5A00; --alertefond: #FBEBC7; --err: #A63A2B;
  --f-titre: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif; --f-texte: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0F1713; --surface: #17221D; --surface2: #1E2B25; --fg: #ECEAE3; --fg2: #A7B2AC; --ligne: #2C3B34; --okfond: #1E3A2D; --ok: #9ED3B4; --alertefond: #3A2F12; --alerte: #F2C66B; --err: #F0A497; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 16px/1.5 var(--f-texte); -webkit-font-smoothing: antialiased; }
h1 { font: 700 26px/1.15 var(--f-titre); margin: 0; text-wrap: balance; }
.page { max-width: 640px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 16px) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 110px) max(16px, env(safe-area-inset-left)); display: grid; gap: 18px; align-content: start; }
.tete { display: flex; justify-content: space-between; align-items: center; }
.logo { display: inline-flex; gap: 8px; align-items: center; font: 700 20px var(--f-titre); color: var(--porte); }
@media (prefers-color-scheme: dark) { .logo { color: var(--fg); } }
.logo svg { width: 18px; height: 22px; }
.badge { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--surface2); color: var(--fg2); font-weight: 600; }
.etapes { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.champ { display: grid; gap: 6px; font-weight: 600; }
.champ input { font: 16px var(--f-texte); min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--ligne); background: var(--surface); color: var(--fg); }
.note { font-size: 14px; color: var(--fg2); margin: 0; }
.erreur { background: var(--alertefond); color: var(--alerte); padding: 12px 14px; border-radius: 12px; margin: 0; }
.btn { font: 600 17px var(--f-texte); min-height: 52px; padding: 0 20px; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:focus-visible { outline: 3px solid var(--soleil); outline-offset: 2px; }
.btn-p { background: var(--porte); color: #fff; }
.btn-s { background: var(--soleil); color: var(--encre); }
.btn-l { background: var(--surface); color: var(--fg); border-color: var(--ligne); }
.btn-plein { width: 100%; }
.btn.petit { min-height: 44px; font-size: 14px; padding: 0 14px; }
.bas-fixe { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: var(--bg); border-top: 1px solid var(--ligne); }

/* Caméra plein écran */
.camera { position: fixed; inset: 0; background: #000; color: #fff; z-index: 10; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-haut { position: absolute; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; background: linear-gradient(rgba(0,0,0,.6), transparent); display: grid; gap: 6px; }
.cam-info { display: flex; align-items: center; gap: 8px; font: 700 18px var(--f-titre); font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px #000; }
.rec { color: #FF4D3D; animation: clignote 1s infinite; }
@keyframes clignote { 50% { opacity: .2; } }
.sep { opacity: .6; }
.cam-tech { font-size: 12px; opacity: .8; text-shadow: 0 1px 2px #000; }
.alerte-direct { justify-self: start; background: var(--soleil); color: var(--encre); font-weight: 700; padding: 6px 12px; border-radius: 999px; font-size: 15px; }
.cam-bas { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 0 calc(env(safe-area-inset-bottom) + 14px); background: linear-gradient(transparent, rgba(0,0,0,.75) 30%); display: grid; gap: 14px; }
.pieces-bar { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px; scrollbar-width: none; }
.pieces-bar::-webkit-scrollbar { display: none; }
.pieces-bar button { flex: none; font: 600 16px var(--f-texte); min-height: 48px; padding: 0 16px; border-radius: 999px; border: 2px solid rgba(255,255,255,.7); background: rgba(0,0,0,.45); color: #fff; cursor: pointer; }
.pieces-bar button.faite { border-color: rgba(158,211,180,.9); }
.pieces-bar button.active { background: var(--soleil); border-color: var(--soleil); color: var(--encre); }
.pieces-bar button.ajout { border-style: dashed; }
.cam-actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 14px; gap: 10px; }
.cam-actions .btn { background: rgba(0,0,0,.5); color: #fff; border-color: rgba(255,255,255,.5); }
#btn-annuler-marque { justify-self: start; }
#btn-quitter { justify-self: end; }
.btn-rec { width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.btn-rec span { width: 56px; height: 56px; border-radius: 50%; background: #FF4D3D; transition: all .2s; }
.btn-rec.enregistre span { width: 30px; height: 30px; border-radius: 8px; }
.btn-rec:disabled { opacity: .4; }
.flash { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); background: rgba(0,0,0,.65); padding: 14px 22px; border-radius: 18px; font: 700 26px var(--f-titre); pointer-events: none; }

/* Visite */
.ecran-video { background: #000; border-radius: 16px; overflow: hidden; }
.ecran-video video { display: block; width: 100%; max-height: 60vh; background: #000; }
.piece-lue { margin: 0; font: 700 20px var(--f-titre); display: flex; align-items: center; gap: 8px; }
.piece-lue::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--soleil); }
.progres { display: flex; gap: 3px; }
.progres span { flex: var(--d) 1 0; min-width: 4px; height: 6px; border-radius: 3px; background: var(--ligne); overflow: hidden; display: block; }
.progres span i { display: block; height: 100%; width: 0; background: var(--porte); }
.progres span.en-cours i { background: var(--soleil); }
.chips { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 0 6px; margin: -6px 0 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; scroll-snap-align: center; font: 600 15px var(--f-texte); min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--ligne); background: var(--surface); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chips button small { font-weight: 500; color: var(--fg2); font-variant-numeric: tabular-nums; }
.chips button[aria-current="true"] { background: var(--soleil); border-color: var(--soleil); color: var(--encre); }
.chips button[aria-current="true"] small { color: var(--encre); }
.chips button:focus-visible { outline: 3px solid var(--soleil); outline-offset: 2px; }
.bilan, .liste-pieces { background: var(--surface); border: 1px solid var(--ligne); border-radius: 16px; padding: 14px 16px; display: grid; gap: 8px; }
.ligne { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.ligne strong { text-align: right; }
.lp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid var(--ligne); }
.lp:last-child { border-bottom: 0; }
.lp .verdict { grid-column: 1 / -1; font-size: 13.5px; font-weight: 600; padding: 2px 10px; border-radius: 999px; justify-self: start; }
.verdict.ok { background: var(--okfond); color: var(--ok); } .verdict.attention { background: var(--alertefond); color: var(--alerte); }
.actions-visite { display: grid; gap: 10px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
