/* scan-doc — thème sombre, mobile d'abord, gros boutons sous le pouce. */
:root { color-scheme: dark; --bg: #0f1115; --card: #181b22; --line: #262a34; --fg: #e6e8ee; --muted: #9aa4b2; --blue: #2f81f7; --green: #3fb950; --yellow: #e3b341; --red: #f85149; --safe-b: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.4 system-ui, -apple-system, Roboto, sans-serif; height: 100%; }
#app { min-height: 100%; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
button { font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 16px; margin: 0; cursor: pointer; background: #2a2f3a; color: var(--fg); min-height: 46px; }
button.primary { background: var(--blue); color: #fff; } button.ghost { background: transparent; border: 1px solid var(--line); } button.danger { color: var(--red); border-color: var(--red); }
button.wide { width: 100%; } button.on { background: var(--green); color: #06210f; } button:disabled { opacity: .4; }
input, select { font: inherit; background: #0b0d11; color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
input.title { font-weight: 700; font-size: 17px; flex: 1; min-width: 0; } input.title.sm { font-size: 15px; padding: 6px 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; }
.row { display: flex; gap: 8px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); } .tiny { font-size: 12px; }
.screen { max-width: 900px; margin: 0 auto; padding: 12px 12px calc(24px + var(--safe-b)); }
header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 10px; } header h1 { font-size: 20px; margin: 0; flex: 1; }
h2 { font-size: 16px; margin: 14px 0 6px; color: var(--muted); }
.pill { border-radius: 999px; padding: 3px 10px; font-size: 12px; background: #21262f; } .pill.ok { background: #12331c; color: var(--green); } .pill.ko { background: #3a1414; color: var(--red); }
.list .card { margin: 8px 0; cursor: pointer; }
.docs .doc .thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0; } .mini { position: relative; width: 54px; height: 76px; flex: 0 0 auto; border-radius: 6px; overflow: hidden; background: #000; } .mini img { width: 100%; height: 100%; object-fit: cover; } .mini .badge { position: absolute; bottom: 2px; left: 2px; font-size: 9px; }
.badge { display: inline-block; border-radius: 6px; padding: 1px 6px; font-size: 11px; background: #2a2f3a; margin: 1px; } .badge.glare { background: #4a3a08; color: #ffd66b; } .badge.blurry { background: #3a2a4a; color: #d2a8ff; } .badge.low_res { background: #0f3a4a; color: #79c0ff; } .badge.needs_review, .badge.possible_duplicate { background: #4a1f1f; color: #ff8a80; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; } .page .imgwrap { aspect-ratio: 3 / 4.2; background: #000; border-radius: 8px; overflow: hidden; } .page img { width: 100%; height: 100%; object-fit: cover; } .page .num { font-weight: 700; margin-bottom: 4px; }
#toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: #21262f; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; opacity: 0; transition: .2s; pointer-events: none; max-width: 90vw; z-index: 50; }
#toast.show { opacity: 1; transform: translateX(-50%); }
img.broken { opacity: .3; }
.error pre { white-space: pre-wrap; font-size: 12px; }

/* ---- écran scan : plein écran, préview cover, overlay, bandeau haut, bandeau hints, vignettes, boutons bas */
#scan { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#banner { position: relative; display: flex; gap: 10px; align-items: center; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; background: linear-gradient(rgba(0,0,0,.75), transparent); font-weight: 600; }
#banner .doc { font-size: 17px; } #banner .count { color: var(--green); } #banner .up { color: var(--muted); } #banner .perf { color: var(--muted); font-size: 12px; margin-left: auto; }
#hint { position: relative; text-align: center; padding: 8px 16px; font-size: 17px; font-weight: 600; text-shadow: 0 1px 4px #000; min-height: 36px; }
#strip { position: relative; display: flex; gap: 6px; overflow-x: auto; padding: 6px 12px; margin-top: auto; }
#strip .thumb { position: relative; width: 52px; height: 74px; flex: 0 0 auto; border-radius: 6px; overflow: hidden; background: #111; border: 1px solid var(--line); }
#strip .thumb img { width: 100%; height: 100%; object-fit: cover; } #strip .st { position: absolute; right: 2px; bottom: 2px; font-size: 12px; background: rgba(0,0,0,.7); border-radius: 4px; padding: 0 4px; } #strip .st.ok { color: var(--green); } #strip .st.warn { color: var(--yellow); } #strip .st.err { color: var(--red); } #strip .badge { position: absolute; left: 2px; top: 2px; font-size: 13px; padding: 1px 7px; }
#controls { position: relative; display: grid; grid-template-columns: 1fr 64px 1fr 1fr; grid-template-areas: "redo shoot pause finish" "next next next next"; gap: 8px; padding: 8px 12px calc(10px + var(--safe-b)); background: linear-gradient(transparent, rgba(0,0,0,.85)); }
#controls button:nth-child(1) { grid-area: redo; } #controls button.shoot { grid-area: shoot; border-radius: 50%; font-size: 22px; padding: 0; min-height: 56px; background: #fff; color: #000; }
#controls button:nth-child(3) { grid-area: pause; } #controls button:nth-child(4) { grid-area: finish; } #controls .wide { grid-area: next; min-height: 52px; font-size: 17px; }
#veil { position: absolute; inset: 0; background: rgba(0,0,0,.82); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; } #veil .big { font-size: 42px; font-weight: 800; letter-spacing: .2em; }
.hidden { display: none !important; }

/* ---- éditeur */
.editor .canvaswrap { position: relative; } .editor canvas:first-child { width: 100%; height: auto; touch-action: none; display: block; border-radius: 10px; }
.loupe { position: fixed; width: 140px; height: 140px; border-radius: 50%; border: 2px solid var(--green); pointer-events: none; z-index: 30; display: none; }

.card.warn { border-color: var(--yellow); } #hint.err { color: var(--red); font-size: 14px; }

#subcontrols { position: relative; display: flex; gap: 8px; padding: 0 12px 6px; background: rgba(0,0,0,.6); } #subcontrols button { flex: 1; min-height: 40px; font-size: 14px; }
.badge.cover { background: #4a3a08; color: #ffd66b; }
