*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:      #16a34a;
  --green-dark: #15803d;
  --green-bg:   #f0fdf4;
  --green-border: rgba(22,163,74,.2);
  --white:      #ffffff;
  --off:        #f8fafc;
  --border:     rgba(0,0,0,.07);
  --border-sm:  rgba(0,0,0,.05);
  --muted:      #aaa;
  --muted2:     #bbb;
  --ink:        #0f0f0f;
  --ink2:       #1a1a1a;
  --ink3:       #555;
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  20px;
  --shadow:     0 1px 2px rgba(0,0,0,.04), 0 8px 32px rgba(0,0,0,.07);
  --shadow-btn: 0 4px 14px rgba(22,163,74,.35);
}

html { font-size: 15px; }
body {
  font-family: 'Inter', sans-serif;
  background: #ffffff;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* ── Background blobs ─────────────────────────────── */
.bg-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: .16;
}
.blob-1 { width: 500px; height: 500px; background: #22c55e; top: -180px; right: -120px; }
.blob-2 { width: 380px; height: 380px; background: #3b82f6; bottom: 40px; left: -130px; }
.blob-3 { width: 280px; height: 280px; background: #a3e635; top: 42%; left: 38%; }

/* ── Layout ───────────────────────────────────────── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 55px; height: 55px;
  background: var(--green);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(22,163,74,.35);
  flex-shrink: 0;
}
.logo-icon svg { width: 33px; height: 33px; fill: white; }
.logo-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
}
.logo-sub { font-size: 1.1rem; color: var(--muted); font-weight: 400; margin-top: 1px; }

.header-badge {
  font-size: .72rem;
  font-weight: 500;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: .02em;
  white-space: nowrap;
}

/* ── Grid ─────────────────────────────────────────── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 720px) {
  .main-grid { grid-template-columns: 1fr; }
}

/* ── Glass Card ───────────────────────────────────── */
.card {
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
}
.card-body { padding: 16px 22px 22px; }

/* ── Upload Zone ──────────────────────────────────── */
.upload-zone {
  border: 1.5px dashed rgba(0,0,0,.13);
  border-radius: 14px;
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: rgba(248,250,252,.6);
  position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--green);
  background: rgba(22,163,74,.04);
}
.upload-zone input[type=file] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}
.upload-icon {
  width: 48px; height: 48px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.upload-icon svg { width: 22px; height: 22px; stroke: var(--green); }
.upload-text { font-size: .9rem; font-weight: 500; color: var(--ink2); }
.upload-hint { font-size: .75rem; color: var(--muted); margin-top: 5px; }

/* ── Preview ──────────────────────────────────────── */
.preview-wrap {
  display: none;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #0f0f0f;
  aspect-ratio: 4/3;
}
.preview-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.preview-clear {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px;
  background: rgba(0,0,0,.55);
  border: none; border-radius: 50%;
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  transition: background .15s;
  backdrop-filter: blur(4px);
}
.preview-clear:hover { background: rgba(0,0,0,.8); }

/* ── Bouton analyser ──────────────────────────────── */
.btn-analyse {
  width: 100%;
  margin-top: 14px;
  padding: 13px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .01em;
  box-shadow: var(--shadow-btn);
  transition: background .15s, transform .1s, box-shadow .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-analyse:hover { background: var(--green-dark); box-shadow: 0 6px 20px rgba(22,163,74,.42); }
.btn-analyse:active { transform: scale(.99); }
.btn-analyse:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ── Pipeline ─────────────────────────────────────── */
.pipeline-card { margin-top: 16px; }
.pipeline-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-sm);
}
.pipeline-step:last-child { border-bottom: none; }
.step-num {
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: var(--green);
  font-size: .68rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.step-name { font-size: .82rem; font-weight: 500; color: var(--ink2); }
.step-desc { font-size: .73rem; color: var(--muted); margin-top: 1px; }

/* ── Error ────────────────────────────────────────── */
.error-box {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .81rem;
  color: #dc2626;
  margin-top: 12px;
  align-items: flex-start;
  gap: 8px;
}

/* ── Loader ───────────────────────────────────────── */
.loader-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 0;
  color: var(--muted);
  font-size: .83rem;
}
.loader-ring {
  width: 34px; height: 34px;
  border: 2.5px solid #e5e7eb;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Result empty ─────────────────────────────────── */
.result-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 12px;
  text-align: center;
}
.result-empty-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: var(--off);
  border: 1px solid #e5e7eb;
  display: flex; align-items: center; justify-content: center;
}
.result-empty-icon svg { width: 24px; height: 24px; stroke: #d1d5db; }
.result-empty-text { font-size: 1.1rem; color: var(--muted2); line-height: 1.55; }

/* ── Result main ──────────────────────────────────── */
.result-main { display: none; }

/* Verdict */
.verdict {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.verdict-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
}
.verdict-class {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
  line-height: 1.2;
}
.verdict-conf {
  font-size: .75rem;
  color: var(--muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.verdict-desc {
  font-size: .8rem;
  color: var(--ink3);
  line-height: 1.6;
  margin-top: 7px;
  font-style: italic;
}

/* Probabilités */
.proba-section {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-sm);
}
.section-label {
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted2);
  font-weight: 600;
  margin-bottom: 14px;
}
.proba-row { margin-bottom: 11px; }
.proba-head {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  margin-bottom: 5px;
  color: var(--ink3);
}
.proba-val { font-variant-numeric: tabular-nums; font-weight: 500; font-size: .76rem; }
.proba-track {
  height: 5px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
}
.proba-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .7s cubic-bezier(.4,0,.2,1);
  width: 0;
}

/* GLCM */
.glcm-section { padding: 18px 22px; }
.glcm-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 8px;
}
.glcm-item {
  background: rgba(248,250,252,.85);
  border: 1px solid var(--border-sm);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.glcm-label { font-size: .65rem; color: var(--muted2); text-transform: uppercase; letter-spacing: .07em; }
.glcm-value { font-size: .88rem; font-weight: 600; color: var(--ink2); margin-top: 3px; }

/* Meta pills */
.meta-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 22px 18px;
  border-top: 1px solid var(--border-sm);
}
.meta-pill {
  font-size: .7rem;
  font-weight: 500;
  background: var(--off);
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 3px 10px;
  color: #888;
}

/* ── Footnote ─────────────────────────────────────── */
.footnote {
  text-align: center;
  font-size: .73rem;
  color: #ccc;
  margin-top: auto;
  padding: 24px 0 32px;
  border-top: 1px solid var(--border);
}