:root {
  --bg: #f4f5f8;
  --card: #ffffff;
  --ink: #171a26;
  --muted: #5d6478;
  --line: #e2e5ee;
  --accent: #2f3fb5;
  --accent-ink: #ffffff;
  --soft: #eef0fb;
  --real: #12805a;
  --ai: #c52f2a;
  --mixed: #b46300;
  --unknown: #5d6478;
  --neutral: #2f6f9f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 8px 24px rgba(20, 24, 40, .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1118; --card: #181b26; --ink: #eceef6; --muted: #9aa1b6; --line: #2a2f40; --accent: #8c9bff; --accent-ink: #0f1118;
    --soft: #20253a; --real: #4fd1a1; --ai: #ff7b73; --mixed: #f0a94a; --unknown: #9aa1b6; --neutral: #74b6e4;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; }

.top { display: flex; align-items: center; justify-content: space-between; max-width: 1180px; margin: 0 auto; padding: 18px 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand svg { width: 28px; height: 28px; color: var(--accent); }
main { max-width: 1180px; margin: 0 auto; padding: 8px 24px 64px; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); padding: 9px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .93rem; text-decoration: none; color: var(--ink); transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn:focus-visible, .dropzone:focus-visible, .link:focus-visible, .check-head:focus-visible, .chip:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.qmark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .8rem; font-weight: 700; }
.link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: inherit; }

/* ---------- dépôt ---------- */
#view-drop { max-width: 760px; margin: 5vh auto 0; text-align: center; }
#view-drop h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
.lead { color: var(--muted); margin: 14px auto 28px; max-width: 620px; font-size: 1.05rem; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 54px 24px; border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 22px; background: var(--card); cursor: pointer; transition: background .15s, border-color .15s, transform .15s; box-shadow: var(--shadow); }
.dropzone svg { width: 54px; height: 54px; color: var(--accent); margin-bottom: 6px; }
.dropzone strong { font-size: 1.25rem; }
.dropzone span { color: var(--muted); }
.dropzone small { color: var(--muted); margin-top: 8px; font-size: .85rem; }
.dropzone:hover, .dropzone.over { background: var(--soft); border-color: var(--accent); }
.dropzone.over { transform: scale(1.01); }
.dropzone.busy { pointer-events: none; opacity: .6; }
.fineprint { color: var(--muted); font-size: .86rem; margin-top: 18px; }
.error { margin-top: 16px; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--ai) 12%, var(--card)); color: var(--ai); font-weight: 600; text-align: left; }

/* ---------- analyse ---------- */
.jobbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 16px; }
.filename { color: var(--muted); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h3 { font-size: 1rem; margin-bottom: 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card h3 small { color: var(--muted); font-weight: 400; font-size: .8rem; }
.grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.side { display: grid; gap: 20px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

.queuebox { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.queuebox p { color: var(--muted); font-size: .93rem; }
.queue-main { flex: 1; min-width: 0; }
.queue-main .progress { height: 8px; margin: 12px 0 2px; }
#models-bar { transition: width 14s cubic-bezier(.15, .6, .3, 1); }
.engine { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; font-size: .86rem; color: var(--muted); }
.engine i { width: 9px; height: 9px; border-radius: 50%; background: var(--unknown); flex: none; }
.engine.ready i { background: var(--real); }
.engine.loading i { background: var(--mixed); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- verdict ---------- */
.verdict { margin-bottom: 20px; border-left: 6px solid var(--tone, var(--unknown)); }
.tag { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: .85rem; color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); }
.verdict h2 { font-size: clamp(1.25rem, 2.6vw, 1.7rem); margin: 10px 0 18px; }
.scoreline { display: flex; align-items: center; gap: 24px; }
.scorenum { font-size: 3.4rem; font-weight: 800; line-height: 1; color: var(--tone); font-variant-numeric: tabular-nums; flex: none; }
.scorenum small { font-size: 1.4rem; font-weight: 700; margin-left: 2px; }
.scoretrack-wrap { flex: 1; min-width: 0; }
.scorelabel { font-size: .88rem; color: var(--muted); margin-bottom: 8px; }
.scoretrack { position: relative; height: 14px; border-radius: 999px; background: linear-gradient(90deg, #1b9c6e 0%, #8fbf4a 28%, #f0c23a 50%, #f08a2d 72%, #d43a31 100%); }
.band { position: absolute; top: -5px; bottom: -5px; border-radius: 8px; background: color-mix(in srgb, var(--ink) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); }
.needle { position: absolute; top: -8px; width: 6px; height: 30px; margin-left: -3px; border-radius: 3px; background: var(--ink); box-shadow: 0 0 0 2px var(--card); transition: left .6s cubic-bezier(.2, .8, .2, 1); }
.scalelabels { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); margin-top: 10px; }
.meta { color: var(--muted); font-size: .92rem; margin-top: 16px; }
.meta b { color: var(--ink); font-weight: 600; }
@media (max-width: 560px) { .scoreline { flex-direction: column; align-items: flex-start; gap: 14px; } .scoretrack-wrap { width: 100%; } }

/* ---------- image + carte ---------- */
.viewer-card { padding: 14px; position: sticky; top: 14px; }
@media (max-width: 900px) { .viewer-card { position: static; } }
.viewer { position: relative; border-radius: 10px; overflow: hidden; background: repeating-conic-gradient(color-mix(in srgb, var(--line) 60%, transparent) 0% 25%, transparent 0% 50%) 50% / 20px 20px; line-height: 0; min-height: 120px; }
.viewer img { display: block; width: 100%; height: auto; }
#img-map { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .65; pointer-events: none; transition: opacity .15s; }
.scan { position: absolute; left: 0; right: 0; height: 30%; top: -30%; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 38%, transparent), transparent); animation: scan 2.2s ease-in-out infinite; }
@keyframes scan { to { top: 100%; } }
.mapctl { padding: 14px 6px 4px; display: grid; gap: 12px; }
.mapctl-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mapctl-row > strong { flex: 1; }
.mapctl-row label { font-size: .88rem; color: var(--muted); }
.mapctl input[type=range] { flex: 1; min-width: 120px; accent-color: var(--accent); }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: .85rem; cursor: pointer; }
.chip[aria-selected=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip.quiet { color: var(--muted); }
.legend { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); }
.legend i { width: 90px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, rgba(40, 90, 255, .15), #00c8ff, #78e65a, #ffdc00, #ff7800, #e1142d); }
.hint { color: var(--muted); font-size: .86rem; }

/* ---------- raisons / faits / familles ---------- */
.reasons { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.reasons li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-size: .94rem; }
.reasons .arrow { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.reasons .ai .arrow { background: color-mix(in srgb, var(--ai) 14%, transparent); color: var(--ai); }
.reasons .real .arrow { background: color-mix(in srgb, var(--real) 14%, transparent); color: var(--real); }
.reasons b { display: block; font-weight: 600; }
.reasons span { color: var(--muted); }
.contra { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--mixed) 12%, transparent); font-size: .92rem; }
.contra strong { color: var(--mixed); display: block; margin-bottom: 4px; }
.contra p + p { margin-top: 6px; }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .93rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.families { display: grid; gap: 10px; }
.fam { display: grid; grid-template-columns: minmax(0, 1fr) 110px 42px; gap: 10px; align-items: center; font-size: .9rem; }
.fam .bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.fam .bar i { display: block; height: 100%; border-radius: 4px; }
.fam .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.fam.na { color: var(--muted); }
.fam.na .val { font-weight: 400; font-size: .78rem; }

/* ---------- liste des vérifications ---------- */
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 10px 0 12px; }
.progress div { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .35s; }
.checks { list-style: none; margin: 0; padding: 0; }
.check { border-top: 1px solid var(--line); }
.check:first-child { border-top: 0; }
.check-head { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 10px 2px; background: none; border: 0; text-align: left; cursor: pointer; border-radius: 8px; }
.check-head .title { font-weight: 600; font-size: .94rem; }
.check-head .sum { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check.open .check-head .sum { white-space: normal; }
.state { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 800; }
.check.pending .state { border: 2px solid var(--line); }
.check.running .state { border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.check.done .state { background: color-mix(in srgb, var(--real) 16%, transparent); color: var(--real); }
.check.error .state { background: color-mix(in srgb, var(--ai) 16%, transparent); color: var(--ai); }
.check.pending .title { color: var(--muted); }
.pill { font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill.hi { background: color-mix(in srgb, var(--ai) 14%, transparent); color: var(--ai); }
.pill.mid { background: color-mix(in srgb, var(--mixed) 14%, transparent); color: var(--mixed); }
.pill.lo { background: color-mix(in srgb, var(--real) 14%, transparent); color: var(--real); }
.pill.na { color: var(--muted); font-weight: 500; }
.check-body { padding: 2px 2px 14px 34px; font-size: .9rem; display: grid; gap: 10px; }
.check-body .desc { color: var(--muted); }
.findings { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.findings li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; overflow-wrap: anywhere; }
.findings .ico { font-weight: 800; text-align: center; }
.f-authentic .ico { color: var(--real); }
.f-suspect .ico { color: var(--mixed); }
.f-decisive .ico { color: var(--ai); }
.f-decisive { font-weight: 600; }
.f-info .ico, .f-warn .ico { color: var(--muted); }
.f-warn { color: var(--muted); font-style: italic; }
.took { color: var(--muted); font-size: .78rem; }
.trust { color: var(--muted); font-size: .84rem; padding: 6px 10px; border-left: 3px solid var(--line); }
#validation-box { display: grid; gap: 10px; }

.foot { margin-top: 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.foot p { color: var(--muted); font-size: .88rem; flex: 1; min-width: 260px; }

/* ---------- aide ---------- */
dialog { border: 0; padding: 0; border-radius: 18px; background: var(--card); color: var(--ink); width: min(760px, calc(100vw - 24px)); max-height: min(88vh, 900px); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
dialog::backdrop { background: rgba(12, 14, 24, .55); backdrop-filter: blur(2px); }
.help-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; background: var(--card); border-bottom: 1px solid var(--line); z-index: 1; }
.help-head h2 { font-size: 1.25rem; }
.help-body { padding: 20px 24px 28px; display: grid; gap: 16px; font-size: .96rem; }
.help-body h3 { font-size: 1.02rem; margin-top: 8px; }
.howto { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.method, .plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.method li { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.method b { display: block; margin-bottom: 2px; }
.method span { color: var(--muted); font-size: .92rem; }
.plain li { padding-left: 18px; position: relative; }
.plain li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.vtable { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: 10px; }
.vtable th, .vtable td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.vtable td:not(:first-child), .vtable th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.vtable th { color: var(--muted); font-weight: 600; font-size: .82rem; }

@media (prefers-reduced-motion: reduce) { * { animation-duration: .001s !important; transition-duration: .001s !important; } }
