/* ═══════════════════════════════════════════════════════════
   NatureVision — Design "Field Guide" v3
   Professionnel · Nature · Mobile-first
═══════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────── */
:root {
  /* Palette nature */
  --forest:       #1b4332;
  --forest-mid:   #2d6a4f;
  --forest-l:     #40916c;
  --leaf:         #52b788;
  --leaf-l:       #74c69d;
  --mint:         #b7e4c7;
  --wash:         #d8f3dc;
  --earth:        #a07850;
  --earth-l:      #c9a07a;
  --cream:        #fdf8f0;
  --parchment:    #f5ede0;

  /* Neutrals */
  --text:         #1c2b1e;
  --text-mid:     #3d5a41;
  --text-muted:   #7a9e7e;
  --white:        #ffffff;
  --surface:      #ffffff;
  --surface-2:    #fafaf8;
  --border:       #e6ded4;
  --border-green: #c3dfc9;

  /* Semantic */
  --c-excellent:  #2d6a4f;
  --c-bon:        #52b788;
  --c-moyen:      #e07b39;
  --c-mauvais:    #c0392b;
  --c-critique:   #922b21;
  --c-weed:       #6c3483;
  --c-weed-l:     #e8daef;
  --c-animal:     #1a5276;
  --c-animal-l:   #d6eaf8;

  /* Shadows */
  --sh-xs: 0 1px 3px rgba(27,67,50,.08);
  --sh-sm: 0 2px 10px rgba(27,67,50,.10);
  --sh:    0 4px 24px rgba(27,67,50,.13);
  --sh-lg: 0 12px 48px rgba(27,67,50,.18);

  /* Typography */
  --ff-display: 'Playfair Display', Georgia, serif;
  --ff-body:    'Nunito', system-ui, sans-serif;

  /* Geometry */
  --r-xs:   6px;
  --r-sm:   10px;
  --r:      16px;
  --r-lg:   22px;
  --r-xl:   32px;
  --r-full: 999px;

  --safe-b: env(safe-area-inset-bottom, 16px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--ff-body);
  background: var(--cream);
  color: var(--text);
  min-height: 100%;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.55;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── Screens ────────────────────────────────────────────── */
.screen { display: none; flex-direction: column; min-height: 100dvh; min-height: 100vh; }
.screen.active { display: flex; }

/* ══════════════════════════════════════════════════════════
   ÉCRAN ACCUEIL
══════════════════════════════════════════════════════════ */

/* Hero vert forêt */
.app-header {
  background: var(--forest);
  padding: calc(14px + var(--safe-t)) 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 5;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-text {
  font-family: var(--ff-display);
  font-size: 1.25rem;
  color: var(--mint);
  letter-spacing: .3px;
}
.logo-text strong { color: var(--white); font-weight: 900; }

.status-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.85);
  font-size: .75rem; font-weight: 700;
  border: 1px solid rgba(255,255,255,.15);
  transition: background .2s;
}
.status-pill:hover { background: rgba(255,255,255,.2); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; transition: background .4s; }
.status-dot.ok  { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.status-dot.err { background: #f87171; }

/* Hero section */
.home-hero {
  background: linear-gradient(165deg, var(--forest) 0%, var(--forest-mid) 60%, var(--forest-l) 100%);
  padding: 36px 28px 48px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* Feuilles décoratives */
.hero-leaves {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero-leaf {
  position: absolute;
  opacity: .07;
  animation: leaf-drift 8s ease-in-out infinite;
}
.hero-leaf:nth-child(1) { top: -10%; right: -5%; width: 180px; animation-delay: 0s; }
.hero-leaf:nth-child(2) { bottom: -5%; left: -8%; width: 140px; animation-delay: -3s; animation-direction: reverse; }
.hero-leaf:nth-child(3) { top: 30%; right: 10%; width: 80px; animation-delay: -5s; }
@keyframes leaf-drift {
  0%,100% { transform: rotate(0deg) scale(1); }
  50%      { transform: rotate(8deg) scale(1.05); }
}

.hero-content { position: relative; z-index: 2; text-align: center; }
.hero-icon-wrap {
  width: 80px; height: 80px;
  margin: 0 auto 20px;
  background: rgba(255,255,255,.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,.2);
  backdrop-filter: blur(8px);
}
.hero-icon-wrap svg { width: 44px; height: 44px; }

.hero-title {
  font-family: var(--ff-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -.3px;
}
.hero-sub {
  font-size: .95rem;
  color: rgba(255,255,255,.7);
  line-height: 1.6;
  max-width: 300px;
  margin: 0 auto;
}

/* Carte blanche inférieure */
.home-card {
  flex: 1;
  background: var(--cream);
  border-radius: 28px 28px 0 0;
  margin-top: -24px;
  position: relative;
  z-index: 3;
  padding: 28px 24px calc(28px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 -4px 24px rgba(27,67,50,.1);
}

/* Poignée */
.card-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto -8px;
}

/* Bouton appareil photo principal */
.btn-camera-main {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--forest-mid), var(--forest));
  border-radius: var(--r-xl);
  box-shadow: var(--sh), 0 4px 16px rgba(27,67,50,.3);
  transition: transform .15s, box-shadow .15s;
  text-align: left;
}
.btn-camera-main:active { transform: scale(.98); box-shadow: var(--sh-sm); }
.btn-camera-icon {
  width: 52px; height: 52px; flex-shrink: 0;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  border: 1px solid rgba(255,255,255,.2);
}
.btn-camera-text { flex: 1; }
.btn-camera-label { font-size: 1.1rem; font-weight: 800; color: var(--white); display: block; }
.btn-camera-hint  { font-size: .78rem; color: rgba(255,255,255,.65); display: block; margin-top: 2px; }
.btn-camera-arrow { color: rgba(255,255,255,.5); font-size: 1.2rem; }

/* Séparateur */
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: .82rem; font-weight: 600;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Bouton galerie */
.btn-gallery {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid var(--border-green);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--forest-mid);
  font-size: .95rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all .15s;
}
.btn-gallery:hover { background: var(--wash); border-color: var(--leaf); }

/* Chips de fonctionnalités */
.features-scroll {
  overflow-x: auto;
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.features-scroll::-webkit-scrollbar { display: none; }
.feature-chip {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  font-size: .8rem; font-weight: 700;
  color: var(--text-mid);
  box-shadow: var(--sh-xs);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   HEADER COMMUN (preview, résultats)
══════════════════════════════════════════════════════════ */
.app-header--light {
  background: var(--surface);
  padding: calc(14px + var(--safe-t)) 16px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--sh-xs);
  position: sticky; top: 0; z-index: 10;
}
.app-header--results {
  background: var(--forest);
  padding: calc(14px + var(--safe-t)) 16px 14px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}

.header-title     { font-family: var(--ff-display); font-size: 1.1rem; font-weight: 700; color: var(--text); }
.header-title--light { color: var(--white); }

.btn-back {
  display: flex; align-items: center; gap: 4px;
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: .88rem; font-weight: 700; color: var(--text-mid);
  transition: background .15s;
  min-width: 70px;
}
.btn-back:hover { background: var(--wash); }
.btn-back--light { color: rgba(255,255,255,.85); }
.btn-back--light:hover { background: rgba(255,255,255,.12); }

.btn-icon-action {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); transition: background .15s;
}
.btn-icon-action:hover { background: rgba(255,255,255,.15); }
.api-link {
  padding: 5px 10px; border-radius: var(--r-sm);
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.75);
  font-size: .75rem; font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.15);
}
.api-link:hover { background: rgba(255,255,255,.2); }

/* ══════════════════════════════════════════════════════════
   ÉCRAN PREVIEW
══════════════════════════════════════════════════════════ */
.preview-main {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; padding: 24px 20px calc(24px + var(--safe-b)); gap: 20px;
  background: var(--cream);
}

.preview-frame {
  width: 100%; max-width: 500px;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh);
  background: #111;
  position: relative;
}
.preview-frame img { width: 100%; max-height: 56vh; object-fit: contain; }
.preview-badge {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(0,0,0,.55); color: white;
  font-size: .7rem; font-weight: 700; padding: 3px 8px;
  border-radius: var(--r-full); backdrop-filter: blur(4px);
}

.preview-hint {
  font-size: .88rem; color: var(--text-muted); text-align: center;
  display: flex; align-items: center; gap: 6px;
}

.preview-actions {
  display: flex; gap: 12px; width: 100%; max-width: 500px;
}

.btn-ghost {
  flex: 1; padding: 14px; border-radius: var(--r-lg);
  border: 2px solid var(--border); color: var(--text-mid);
  font-size: .92rem; font-weight: 700; display: flex; align-items: center;
  justify-content: center; gap: 8px; transition: all .15s; background: var(--surface);
}
.btn-ghost:hover { background: var(--wash); border-color: var(--leaf); }

.btn-analyze {
  flex: 2; padding: 14px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--forest-l), var(--forest));
  color: white; font-size: 1rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--sh-sm), 0 4px 14px rgba(27,67,50,.3);
  transition: all .15s;
}
.btn-analyze:active { transform: scale(.98); }

/* ══════════════════════════════════════════════════════════
   ÉCRAN CHARGEMENT
══════════════════════════════════════════════════════════ */
#screen-loading {
  background: linear-gradient(165deg, var(--forest) 0%, var(--forest-mid) 100%);
}

.loading-container {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 32px; gap: 24px; text-align: center;
}

/* Animation feuille poussant */
.leaf-grow-anim {
  width: 100px; height: 100px; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.leaf-circle {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.15);
  animation: expand 2.5s ease-in-out infinite;
}
.leaf-circle:nth-child(2) { animation-delay: .8s; opacity: .6; }
.leaf-circle:nth-child(3) { animation-delay: 1.6s; opacity: .3; }
@keyframes expand {
  0%   { transform: scale(.6); opacity: .8; }
  100% { transform: scale(1.8); opacity: 0; }
}
.leaf-center {
  position: relative; z-index: 2; font-size: 2.8rem;
  animation: leaf-pulse 1.5s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
}
@keyframes leaf-pulse {
  0%,100% { transform: scale(1) rotate(-5deg); }
  50%      { transform: scale(1.1) rotate(5deg); }
}

.loading-title {
  font-family: var(--ff-display); font-size: 1.6rem; font-weight: 700;
  color: var(--white); letter-spacing: -.3px;
}
.loading-subtitle { font-size: .92rem; color: rgba(255,255,255,.65); }

.loading-steps { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 280px; }
.lstep {
  display: flex; align-items: center; gap: 10px;
  font-size: .85rem; font-weight: 600; color: rgba(255,255,255,.4);
  transition: color .3s; padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid transparent;
}
.lstep.active {
  color: var(--white); background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.15);
}
.lstep.done { color: var(--mint); }
.lstep-dot {
  width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.2);
  flex-shrink: 0; transition: background .3s;
}
.lstep.active .lstep-dot { background: var(--leaf-l); animation: blink-dot 1s ease infinite; }
.lstep.done   .lstep-dot { background: var(--mint); }
@keyframes blink-dot { 0%,100%{opacity:1} 50%{opacity:.2} }

/* ══════════════════════════════════════════════════════════
   ÉCRAN RÉSULTATS
══════════════════════════════════════════════════════════ */
.results-main {
  flex: 1; overflow-y: auto;
  background: var(--cream);
  padding-bottom: calc(24px + var(--safe-b));
}

/* Bannière résumé */
.results-summary {
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-mid) 100%);
  padding: 22px 20px;
  position: relative; overflow: hidden;
}
.results-summary::after {
  content: '🌿';
  position: absolute; right: -10px; bottom: -15px;
  font-size: 5rem; opacity: .07; pointer-events: none;
}
.summary-eyebrow {
  font-size: .72rem; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--mint); font-weight: 800; margin-bottom: 6px;
}
.summary-text {
  font-size: .95rem; color: rgba(255,255,255,.9); line-height: 1.65;
}
.summary-conseil {
  margin-top: 12px; display: flex; gap: 10px; align-items: flex-start;
  background: rgba(255,255,255,.1); border-radius: var(--r);
  padding: 10px 14px; font-size: .87rem; color: rgba(255,255,255,.9);
  border: 1px solid rgba(255,255,255,.15);
}

/* Séparateur de section */
.results-section-label {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px 8px;
  font-size: .7rem; font-weight: 900; text-transform: uppercase;
  letter-spacing: 1.2px;
}
.results-section-label.plants { color: var(--forest-mid); }
.results-section-label.animals { color: var(--c-animal); }
.results-section-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── CARTE VÉGÉTAL ──────────────────────────────────────── */
.plant-card {
  margin: 0 16px 16px;
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-sm);
  border: 1px solid var(--border);
  transition: box-shadow .2s;
}
.plant-card:hover { box-shadow: var(--sh); }
.plant-card.is-weed { border-color: #c8b6e2; }

/* Photo espèce */
.species-photo-wrap {
  position: relative; width: 100%; height: 200px; overflow: hidden;
  background: linear-gradient(135deg, var(--wash), var(--mint));
}
.species-photo {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease;
}
.plant-card:hover .species-photo { transform: scale(1.03); }
.species-photo-credit {
  position: absolute; bottom: 8px; right: 10px;
  background: rgba(0,0,0,.45); color: rgba(255,255,255,.85);
  font-size: .65rem; font-weight: 600; padding: 2px 8px;
  border-radius: var(--r-full); backdrop-filter: blur(4px);
}
.species-photo-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--leaf); gap: 8px;
}
.species-photo-placeholder span { font-size: .75rem; color: var(--text-muted); font-weight: 600; }

/* En-tête carte */
.plant-card-header {
  padding: 16px 18px 12px;
  display: flex; align-items: flex-start; gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.plant-card.is-weed .plant-card-header { background: var(--c-weed-l); }

.plant-name-block { flex: 1; min-width: 0; }
.plant-common-name {
  font-family: var(--ff-display);
  font-size: 1.15rem; font-weight: 700;
  color: var(--forest); line-height: 1.2;
}
.plant-card.is-weed .plant-common-name { color: var(--c-weed); }
.plant-scientific-name {
  font-size: .8rem; font-style: italic;
  color: var(--text-muted); margin-top: 3px;
}

.plant-type-badge {
  font-size: .7rem; font-weight: 800; padding: 4px 10px;
  border-radius: var(--r-full); white-space: nowrap; flex-shrink: 0;
  background: var(--wash); color: var(--forest-mid);
  border: 1px solid var(--border-green);
}
.plant-card.is-weed .plant-type-badge { background: var(--c-weed-l); color: var(--c-weed); border-color: #c8b6e2; }

/* Santé */
.plant-health-block {
  padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.health-score-ring { position: relative; width: 54px; height: 54px; flex-shrink: 0; }
.health-score-ring svg { width: 54px; height: 54px; transform: rotate(-90deg); }
.health-ring-bg { fill: none; stroke: var(--border); stroke-width: 4; }
.health-ring-fg { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .9s ease; }
.health-score-number {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: .78rem; font-weight: 900;
}
.health-info { flex: 1; min-width: 0; }
.health-label { font-size: .82rem; font-weight: 800; text-transform: capitalize; }
.health-location { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }
.health-bar-track {
  height: 5px; background: var(--border); border-radius: var(--r-full);
  margin-top: 8px; overflow: hidden;
}
.health-bar-fill { height: 100%; border-radius: var(--r-full); transition: width .9s ease; }

/* Grille fiche culture */
.plant-id-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--border); border-bottom: 1px solid var(--border);
}
.id-cell {
  background: var(--surface-2);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 2px;
}
.id-label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); }
.id-value { font-size: .85rem; font-weight: 700; color: var(--text-mid); line-height: 1.3; }

/* Corps carte */
.plant-card-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.plant-description { font-size: .9rem; color: var(--text-muted); line-height: 1.7; }
.tag-item.sol { background: var(--parchment); border-left: 3px solid var(--earth); color: var(--text); }

/* Sections */
.card-section { display: flex; flex-direction: column; gap: 7px; }
.card-section-title {
  font-size: .72rem; font-weight: 900; text-transform: uppercase;
  letter-spacing: .8px; display: flex; align-items: center; gap: 5px;
}
.card-section-title.danger  { color: var(--c-mauvais); }
.card-section-title.warning { color: var(--c-moyen); }
.card-section-title.success { color: var(--c-excellent); }
.card-section-title.weed    { color: var(--c-weed); }

.tag-list { display: flex; flex-direction: column; gap: 6px; }
.tag-item {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: .87rem; line-height: 1.55; padding: 9px 12px;
  border-radius: var(--r-sm);
}
.tag-item.problem  { background: #fef2f2; border-left: 3px solid var(--c-mauvais); color: #5c1515; }
.tag-item.solution { background: #f0fdf4; border-left: 3px solid var(--c-excellent); color: #14532d; }
.tag-item.weed-method { background: var(--c-weed-l); border-left: 3px solid var(--c-weed); color: #4a1d7a; }
.tag-item.tip      { background: var(--wash); border-left: 3px solid var(--leaf); color: var(--forest-mid); }
.tag-bullet { font-size: .9rem; flex-shrink: 0; margin-top: 1px; }

/* Avertissement mauvaise herbe */
.weed-warning {
  background: linear-gradient(135deg, #6c3483, #5b1fa2);
  color: white; border-radius: var(--r); padding: 12px 16px;
  font-size: .87rem; display: flex; gap: 8px; align-items: flex-start;
}

/* Accordéon */
.card-accordion { border-top: 1px solid var(--border); }
.accordion-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; font-size: .84rem; font-weight: 700; color: var(--text-muted);
  background: none; text-align: left; cursor: pointer; transition: background .15s;
}
.accordion-toggle:hover { background: var(--surface-2); color: var(--forest-mid); }
.accordion-arrow { font-size: .7rem; transition: transform .25s; }
.accordion-toggle.open .accordion-arrow { transform: rotate(180deg); }
.accordion-body { display: none; padding: 4px 18px 16px; flex-direction: column; gap: 12px; }
.accordion-body.open { display: flex; }

/* ── CARTE ANIMAL ───────────────────────────────────────── */
.animal-card {
  margin: 0 16px 16px;
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-sm);
  border: 1px solid #c5dae8;
}

.animal-card-header {
  padding: 16px 18px 12px;
  display: flex; align-items: flex-start; gap: 12px;
  background: #eaf3fa;
  border-bottom: 1px solid #c5dae8;
}
.animal-name-block { flex: 1; min-width: 0; }
.animal-common-name {
  font-family: var(--ff-display); font-size: 1.15rem; font-weight: 700;
  color: var(--c-animal); line-height: 1.2;
}
.animal-scientific-name { font-size: .8rem; font-style: italic; color: var(--text-muted); margin-top: 3px; }
.animal-type-badge {
  font-size: .7rem; font-weight: 800; padding: 4px 10px; border-radius: var(--r-full);
  white-space: nowrap; flex-shrink: 0;
  background: var(--c-animal-l); color: var(--c-animal);
  border: 1px solid #aacde0;
}

/* Statut conservation */
.conservation-block {
  padding: 12px 18px; display: flex; flex-wrap: wrap;
  gap: 8px; align-items: center; background: var(--surface-2);
  border-bottom: 1px solid #c5dae8;
}
.conservation-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: var(--r-full);
  font-size: .78rem; font-weight: 800; letter-spacing: .2px;
}
.conservation-LC  { background: #d4efdf; color: #145a32; }
.conservation-NT  { background: #d5f5e3; color: #0e6655; }
.conservation-VU  { background: #fdebd0; color: #784212; }
.conservation-EN  { background: #fadbd8; color: #7b241c; }
.conservation-CR  { background: #f9ebea; color: #6e2c00; }
.conservation-DD  { background: #f2f3f4; color: #515a5a; }
.conservation-non_evalue { background: #f2f3f4; color: #515a5a; }

.danger-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: .75rem; font-weight: 800;
}
.danger-aucun  { background: #eafaf1; color: #145a32; }
.danger-faible { background: #fef9e7; color: #7d6608; }
.danger-modere { background: #fef0e7; color: #784212; }
.danger-eleve  { background: #fdedec; color: #7b241c; }

/* Grille identité animal */
.animal-id-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: #c5dae8; border-bottom: 1px solid #c5dae8;
}
.animal-id-grid .id-cell { background: var(--surface-2); }
.animal-id-grid .id-value { color: var(--c-animal); }

.animal-card-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.animal-description { font-size: .9rem; color: var(--text-muted); line-height: 1.7; }

.tag-item.animal-fact { background: #eaf3fa; border-left: 3px solid #5dade2; color: #1a5276; }
.tag-item.animal-tip  { background: #eaf3fa; border-left: 3px solid #85c1e9; color: #1a5276; }
.tag-item.animal-danger { background: #fdedec; border-left: 3px solid #e74c3c; color: #7b241c; }

/* ── TOXICITÉ ────────────────────────────────────────────── */
.toxicity-block { border-radius: var(--r); overflow: hidden; border: 2px solid; margin-bottom: 2px; }
.toxicity-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; font-weight: 800; font-size: .88rem;
}
.toxicity-body {
  padding: 10px 14px; display: flex; flex-direction: column;
  gap: 8px; background: rgba(255,255,255,.6);
}
.toxicity-row { display: flex; align-items: center; gap: 10px; font-size: .84rem; }
.toxicity-label { font-weight: 700; min-width: 110px; flex-shrink: 0; }

.tox-badge { padding: 2px 10px; border-radius: var(--r-full); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.tox-aucune   { background: #d4efdf; color: #145a32; }
.tox-faible   { background: #fdebd0; color: #784212; }
.tox-moderee  { background: #fadbd8; color: #7b241c; }
.tox-elevee   { background: #f9ebea; color: #641e16; }
.tox-mortelle { background: #641e16; color: #fff; }

.toxicity-block.tox-aucune   { border-color: #a9dfbf; }
.toxicity-block.tox-faible   { border-color: #f0b27a; }
.toxicity-block.tox-moderee  { border-color: #e59866; }
.toxicity-block.tox-elevee   { border-color: #e74c3c; }
.toxicity-block.tox-mortelle { border-color: #922b21; }
.toxicity-block.tox-aucune   .toxicity-header { background: #eafaf1; color: #145a32; }
.toxicity-block.tox-faible   .toxicity-header { background: #fef5e7; color: #7d6608; }
.toxicity-block.tox-moderee  .toxicity-header { background: #fef0e7; color: #784212; }
.toxicity-block.tox-elevee   .toxicity-header { background: #fdedec; color: #641e16; }
.toxicity-block.tox-mortelle .toxicity-header { background: #922b21; color: #fff; }

.urgence-bloc {
  background: var(--c-mauvais); color: white;
  border-radius: var(--r); padding: 10px 14px;
  font-size: .87rem; font-weight: 700;
  display: flex; gap: 8px; align-items: flex-start;
  animation: pulse-danger 2s ease infinite;
}
@keyframes pulse-danger {
  0%,100% { box-shadow: 0 0 0 0 rgba(192,57,43,.3); }
  50%      { box-shadow: 0 0 0 8px rgba(192,57,43,.0); }
}

/* Carte saison */
.season-card {
  margin: 0 16px 24px;
  background: linear-gradient(135deg, var(--parchment), var(--cream));
  border: 1px solid var(--earth-l);
  border-radius: var(--r-lg); padding: 16px 18px;
  display: flex; gap: 12px; align-items: flex-start;
}
.season-icon { font-size: 1.8rem; flex-shrink: 0; }
.season-text h4 { font-size: .75rem; font-weight: 900; text-transform: uppercase; letter-spacing: .6px; color: var(--earth); margin-bottom: 4px; }
.season-text p  { font-size: .88rem; color: var(--text-mid); }

/* Erreur résultats */
.results-error {
  margin: 32px 20px; text-align: center;
  padding: 36px 20px; background: var(--surface);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
  border: 1px solid var(--border);
}
.results-error-icon { font-size: 3rem; margin-bottom: 14px; }
.results-error h3 { font-family: var(--ff-display); font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.results-error p { font-size: .9rem; color: var(--text-muted); line-height: 1.6; }
.results-new-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 20px; padding: 12px 24px;
  background: var(--forest); color: white;
  border-radius: var(--r-lg); font-size: .95rem; font-weight: 700;
  box-shadow: var(--sh-sm);
}

/* ══════════════════════════════════════════════════════════
   MODAL CAMÉRA
══════════════════════════════════════════════════════════ */
.camera-modal {
  position: fixed; inset: 0; z-index: 100;
  background: #000;
  display: flex; align-items: center; justify-content: center;
}
.camera-modal.hidden { display: none; }
.camera-modal video { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.camera-ui {
  position: relative; z-index: 2; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center;
  justify-content: space-between;
  padding: calc(20px + var(--safe-t)) 28px calc(40px + var(--safe-b));
}
.cam-btn {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.15);
  transition: background .15s;
}
.cam-btn:hover { background: rgba(0,0,0,.65); }
.cam-btn--close { align-self: flex-end; }

.cam-frame-guide { position: absolute; inset: 18%; pointer-events: none; }
.frame-corner { position: absolute; width: 28px; height: 28px; border-color: rgba(255,255,255,.75); border-style: solid; }
.frame-corner.tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-top-left-radius: 4px; }
.frame-corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-top-right-radius: 4px; }
.frame-corner.bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-bottom-left-radius: 4px; }
.frame-corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-bottom-right-radius: 4px; }

.cam-hint {
  color: rgba(255,255,255,.8); font-size: .85rem; text-align: center;
  background: rgba(0,0,0,.35); padding: 6px 16px; border-radius: var(--r-full);
  backdrop-filter: blur(4px);
}
.cam-shutter {
  position: relative; width: 76px; height: 76px; border-radius: 50%;
  background: transparent; display: flex; align-items: center; justify-content: center;
}
.cam-shutter-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid white; }
.cam-shutter-core { width: 62px; height: 62px; border-radius: 50%; background: white; transition: transform .1s; }
.cam-shutter:active .cam-shutter-core { transform: scale(.88); }

/* ══════════════════════════════════════════════════════════
   BOTTOM SHEET PARTAGE
══════════════════════════════════════════════════════════ */
.share-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(27,67,50,.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end;
  animation: fade-in .2s ease;
}
.share-overlay.hidden { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.share-sheet {
  width: 100%; background: var(--cream);
  border-radius: 28px 28px 0 0;
  padding: 12px 20px calc(24px + var(--safe-b));
  animation: slide-up .25s ease;
  border-top: 1px solid var(--border);
}
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.share-sheet-handle { width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 18px; }
.share-sheet-title {
  font-family: var(--ff-display); font-size: 1.1rem; font-weight: 700;
  color: var(--text); margin-bottom: 16px; text-align: center;
}
.share-options { display: flex; flex-direction: column; gap: 8px; }
.share-option {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--r);
  background: var(--surface); border: 1.5px solid var(--border);
  text-align: left; transition: all .15s; width: 100%;
}
.share-option:hover, .share-option:active { background: var(--wash); border-color: var(--border-green); }
.share-option-icon { font-size: 1.5rem; flex-shrink: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 50%; }
.share-option-text { display: flex; flex-direction: column; gap: 1px; }
.share-option-label { font-size: .95rem; font-weight: 700; color: var(--text); }
.share-option-hint  { font-size: .76rem; color: var(--text-muted); }
.share-cancel {
  width: 100%; margin-top: 10px; padding: 14px;
  border-radius: var(--r-lg); font-size: .95rem; font-weight: 700;
  color: var(--text-muted); background: var(--surface); border: 1.5px solid var(--border);
}

/* PDF overlay */
.pdf-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(253,248,240,.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; font-size: 1rem; font-weight: 700; color: var(--forest);
  backdrop-filter: blur(4px);
}
.pdf-overlay.hidden { display: none; }

/* ══════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: calc(24px + var(--safe-b));
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: white;
  padding: 12px 24px; border-radius: var(--r-full);
  font-size: .88rem; font-weight: 700;
  z-index: 200; opacity: 0; transition: opacity .25s, transform .25s;
  white-space: nowrap; max-width: calc(100vw - 48px);
  text-align: center; pointer-events: none; box-shadow: var(--sh);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error   { background: var(--c-mauvais); }
.toast.toast-success { background: var(--c-excellent); }

/* ══════════════════════════════════════════════════════════
   PRINT
══════════════════════════════════════════════════════════ */
@media print {
  body { background: white; font-size: 11pt; }
  .app-header, #screen-home, #screen-preview, #screen-loading,
  #btn-new-analysis, #btn-share, .share-overlay, .toast,
  .btn-back, .api-link { display: none !important; }
  #screen-results { display: block !important; }
  .results-main { padding: 0; }
  .plant-card, .animal-card { break-inside: avoid; box-shadow: none; margin: 8px 0; }
  .accordion-body { display: flex !important; }
  .results-summary { background: #e8f5ee !important; -webkit-print-color-adjust: exact; }
  @page { margin: 15mm; size: A4; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (min-width: 600px) {
  .hero-title { font-size: 2.4rem; }
  .plant-card, .animal-card { margin-inline: 24px; }
}
@media (min-width: 900px) {
  .results-main, .preview-main, .home-card { max-width: 720px; margin-inline: auto; }
  .plant-card, .animal-card { margin-inline: 0; }
  .species-photo-wrap { height: 260px; }
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
