/* ==========================================================================
   SAUVAGE (sauvage.app) — DIRECTION ARTISTIQUE "IN THE FOOTSTEPS OF DARWIN"
   - Carnet d'expédition naturaliste, planches d'herbier & muséum d'histoire naturelle
   - Palette : Papier vélin d'archive, encre de Chine bistre, or vieilli & vert herbier
   - Zéro vibecoding : Zéro néons, zéro dégradés violets/cyan, zéro boutons pills fluos
   - Typographie victorienne : Cormorant Garamond, Cinzel & Plus Jakarta Sans
   ========================================================================== */

:root {
  /* Atmosphère : Papier vélin d'herbier d'expédition, reliure lin & buvard */
  --bg-page: #f7f4ec;
  --bg-surface: #fbf9f4;
  --bg-card: #fdfcf9;
  --bg-card-hover: #ffffff;
  --bg-subtle: #eae3d3;
  --bg-felt: #1e2d24; /* Drap de travail de l'explorateur (vert herbier anglais) */

  /* Filets d'imprimerie et reliure d'artisan */
  --border: rgba(75, 60, 42, 0.14);
  --border-strong: rgba(75, 60, 42, 0.28);
  --border-gold: #9e7938;

  /* Encres et textes d'histoire naturelle */
  --text-primary: #1c1813;      /* Encre de Chine bistre profond */
  --text-secondary: #4a3e31;    /* Brun terre d'ombre de carnet */
  --text-muted: #746452;        /* Encre sépia patinée */
  --text-accent: #244b34;       /* Vert sauge d'herbier */
  --accent-gold: #9e7938;       /* Or antique mat pressé */
  --accent-gold-soft: rgba(158, 121, 56, 0.12);

  /* Raretés naturalistes (pigments minéraux d'aquarelle de terrain) */
  --r-commune: #524d45;         /* Ardoise & encre sépia */
  --r-peu-commune: #245838;     /* Terre verte / mousse */
  --r-rare: #214b6e;            /* Bleu de Prusse / lapis */
  --r-tres-rare: #5e326c;       /* Améthyste naturelle */
  --r-epique: #94491c;          /* Terre de Sienne brûlée */
  --r-legendaire: #8f6a1e;      /* Or impérial d'expédition */
  --r-shiny: #a67c24;           /* Dorure à la feuille d'or */

  /* Typographies d'expédition */
  --font-serif: "Cormorant Garamond", Garamond, Georgia, serif;
  --font-title: "Cinzel", "Cormorant Garamond", Georgia, serif;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Plus Jakarta Sans", monospace;

  /* Proportions et coupes d'imprimeur (angles nets d'imprimerie) */
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-card: 6px;
  --card-width: 270px;
  --card-height: 395px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  background-color: var(--bg-page);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(158, 121, 56, 0.03) 0%, transparent 60%);
  overflow-x: hidden;
  max-width: 100vw;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* Canvas de particules pour célébrations */
.fx-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
}

/* ==========================================================================
   TOPBAR & IDENTITÉ ÉDITORIALE "IN THE FOOTSTEPS OF DARWIN"
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 249, 244, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--border);
  box-shadow: 0 2px 10px rgba(60, 45, 30, 0.04);
}

.topbar__inner {
  max-width: 1560px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  transition: transform 160ms ease;
}

.brand:hover {
  transform: translateY(-1px);
}

.brand__emblem {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(60, 45, 30, 0.15));
  transition: transform 220ms ease;
}

.brand:hover .brand__emblem {
  transform: scale(1.05) rotate(-2deg);
}

.brand__text {
  display: flex;
  flex-direction: column;
}

.brand__name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.85rem;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  line-height: 1;
}

.brand__tag {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--accent-gold);
  letter-spacing: 0.16em;
  font-weight: 700;
  margin-top: 3px;
}

/* Plaque officielle de la région */
.region-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  font-size: 0.78rem;
  color: var(--text-secondary);
  box-shadow: 0 1px 3px rgba(60, 45, 30, 0.03);
}

.region-flag { font-size: 0.95rem; }
.region-name { font-weight: 700; color: var(--text-primary); letter-spacing: 0.04em; }
.region-status { font-size: 0.74rem; color: var(--text-muted); }

/* Navigation principale style onglets de carnet relié */
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav__icon {
  display: none;
}

.nav__label {
  display: inline;
}

.nav__link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 7px 15px;
  border-radius: var(--radius-sm);
  transition: all 140ms ease;
  position: relative;
  letter-spacing: 0.02em;
}

.nav__link:hover {
  color: var(--text-primary);
  background: rgba(75, 60, 42, 0.05);
}

.nav__link[aria-current="page"] {
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 4px rgba(60, 45, 30, 0.05);
}

/* Compteurs en-tête style gravure */
.topbar__stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgba(60, 45, 30, 0.03);
}

.stat-badge__lbl {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-badge__val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-badge__val strong {
  font-size: 1.02rem;
  color: var(--text-primary);
}

.stat-badge__total {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-badge--shiny {
  background: #fcf9f0;
  border-color: rgba(158, 121, 56, 0.4);
}

.stat-badge--shiny .stat-badge__lbl {
  color: var(--accent-gold);
}

.stat-badge--shiny .stat-badge__val {
  color: var(--accent-gold);
}

/* ==========================================================================
   STRUCTURE GÉNÉRALE
   ========================================================================== */
main#app {
  max-width: 1560px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.view[hidden] {
  display: none !important;
}

.section-head {
  margin-bottom: 24px;
}

.section-head--page {
  margin-bottom: 32px;
}

.section-head h2 {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.section-head__note {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* En-tête de la saison naturaliste */
.season-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: flex-end;
  margin-bottom: 24px;
}

.badge-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-accent);
  background: rgba(36, 75, 52, 0.08);
  border: 1px solid rgba(36, 75, 52, 0.22);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.season__title {
  font-family: var(--font-serif);
  font-size: 2.75rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.season__title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-gold);
}

.season__lede {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 720px;
  line-height: 1.6;
}

/* Boîte de légende des raretés (registre officiel) */
.rarity-legend-box {
  background: var(--bg-card);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(60, 45, 30, 0.03);
}

.legend-box__title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.rarity-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rtag {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.rtag--commune     { color: #433f38; background: #eeebe3; border-color: #d2cbbe; }
.rtag--peu-commune { color: #1c4d31; background: #ebf3ee; border-color: #bad3c2; }
.rtag--rare        { color: #1a4261; background: #edf3f8; border-color: #bdd0e1; }
.rtag--tres-rare   { color: #4e295a; background: #f3ecf7; border-color: #d5bedc; }
.rtag--epique      { color: #783812; background: #f8ebe3; border-color: #ecc0a8; }
.rtag--legendaire  { color: #6e5012; background: #f8f2e2; border-color: #e5cf92; }
.rtag--shiny       { color: #795712; background: #fbf4de; border-color: #d8b75e; }

/* Groupes favorisés ce mois (étiquettes botaniques) */
.season-tags-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.season-tags-lbl {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.season__groups {
  display: flex;
  gap: 8px;
  list-style: none;
  flex-wrap: wrap;
}

.season__group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  box-shadow: 0 1px 3px rgba(60, 45, 30, 0.02);
}

.season__group .group-icon {
  font-size: 0.95rem;
}

.season__group b {
  color: var(--accent-gold);
  font-weight: 700;
}

.season__group.is-low {
  opacity: 0.45;
}

/* ==========================================================================
   ARÈNE DE TIRAGE — LA TABLE DE TRAVAIL DU NATURALISTE
   ========================================================================== */
.arena {
  position: relative;
  background: radial-gradient(ellipse at 50% 40%, #1e2d24 0%, #15221a 100%);
  border: 1.5px solid #8e7343;
  outline: 1px solid rgba(142, 115, 67, 0.35);
  outline-offset: -6px;
  border-radius: var(--radius-md);
  padding: 56px 32px;
  margin-bottom: 48px;
  display: grid;
  place-items: center;
  min-height: 580px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.4), 0 14px 34px rgba(50, 40, 25, 0.12);
}

.pack-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.pack-wrapper[hidden],
#pack-zone[hidden] {
  display: none !important;
}

/* Pochette d'expédition en papier kraft naturel avec reliure artisanale */
.field-pack {
  width: 295px;
  height: 425px;
  background: linear-gradient(180deg, #dfd4c3 0%, #cbbea8 100%);
  border: 1.5px solid #8e7a63;
  outline: 1px dashed rgba(120, 100, 75, 0.45);
  outline-offset: -7px;
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 4px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  cursor: pointer;
  user-select: none;
  transition: transform 200ms ease, box-shadow 200ms ease;
  position: relative;
  overflow: hidden;
  color: #261f18;
}

.field-pack::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #244b34, #9e7938, #8a3622);
}

.field-pack:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55);
}

.field-pack__band {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.band-tag {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: #684e20;
  text-transform: uppercase;
}

.band-month {
  font-family: var(--font-title);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #1a150f;
  line-height: 1.1;
}

.field-pack__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.field-pack__emblem-img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(35, 25, 15, 0.35));
}

.field-pack__title {
  font-family: var(--font-title);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #1a150f;
  line-height: 1;
}

.field-pack__specimens {
  font-size: 0.88rem;
  font-weight: 600;
  color: #4a3d2e;
}

.field-pack__hint {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #1c3e27;
  background: rgba(36, 75, 52, 0.12);
  border: 1px solid rgba(36, 75, 52, 0.3);
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.field-pack__footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  font-weight: 600;
  color: #554738;
  border-top: 1px solid rgba(130, 110, 88, 0.35);
  padding-top: 12px;
  letter-spacing: 0.02em;
}

.field-pack.is-ripping {
  animation: pack-open 400ms ease forwards;
}

@keyframes pack-open {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04) translateY(-8px); }
  100% { transform: scale(0.92) translateY(18px); opacity: 0; }
}

.pack-status {
  font-size: 0.95rem;
  color: #d1d9d4;
  text-align: center;
}

.pack-status strong { color: #fdfaf0; }

.pack-status .countdown {
  font-weight: 700;
  color: #1a150f;
  background: #fdfcf9;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-left: 6px;
}

/* ==========================================================================
   ZONE DE RÉVÉLATION DU TIRAGE
   ========================================================================== */
.reveal-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  box-sizing: border-box;
  overflow: hidden;
}

.reveal-wrapper[hidden],
#reveal[hidden] {
  display: none !important;
}

.reveal-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.reveal-title {
  font-family: var(--font-serif);
  font-size: 2.35rem;
  font-weight: 600;
  color: #fbf9f4;
  letter-spacing: -0.01em;
  margin: 6px 0 2px;
}

.reveal-sub {
  font-size: 0.92rem;
  color: #c9d2cd;
}

/* Commutateur de mode Découverte (Onglets de naturaliste) */
.reveal-modes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(18, 28, 22, 0.85);
  border: 1px solid rgba(158, 121, 56, 0.4);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-top: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.reveal-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #c5cec8;
  padding: 7px 18px;
  border-radius: var(--radius-sm);
  transition: all 160ms ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.reveal-mode-btn:hover {
  color: #ffffff;
}

.reveal-mode-btn.is-active {
  color: #1a150f;
  background: #fdfcf9;
  border-color: #9e7938;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.reveal-mode-btn .mode-icon {
  font-size: 0.95rem;
}

/* -------------------------------------------------- 1. Mode Découverte 1 par 1 */
.showcase-arena {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  margin: 0 auto;
}

.showcase-arena[hidden] {
  display: none !important;
}

.showcase-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.showcase-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(253, 252, 249, 0.1);
  border: 1px solid rgba(253, 252, 249, 0.22);
  color: #d1d9d4;
  cursor: pointer;
  transition: all 160ms ease;
  user-select: none;
}

.showcase-step:hover {
  border-color: #fdfcf9;
  color: #ffffff;
}

.showcase-step.is-current {
  background: #fdfcf9;
  border-color: #9e7938;
  color: #1c1813;
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.showcase-step.is-revealed {
  border-color: rgba(158, 121, 56, 0.7);
}

.showcase-step__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.showcase-main {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.showcase-nav-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: #fdfcf9;
  border: 1.5px solid var(--border-strong);
  color: #1c1813;
  font-size: 1.8rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 160ms ease;
  user-select: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.showcase-nav-btn:hover:not(:disabled) {
  background: #ffffff;
  border-color: #9e7938;
  color: #9e7938;
  transform: scale(1.05);
}

.showcase-nav-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  transform: none;
}

.showcase-card-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-height: 480px;
}

.showcase-card-slot .card-unit {
  animation: showcase-enter 280ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes showcase-enter {
  0% { opacity: 0; transform: translateY(12px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.showcase-card-slot .card {
  width: 295px;
  height: 432px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
}

.showcase-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* -------------------------------------------------- 2. Mode 5 Cartes en Ligne Stricte */
.reveal__cards--row {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: clamp(10px, 1.4vw, 20px);
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  align-items: start;
}

.reveal__cards--row[hidden] {
  display: none !important;
}

.reveal__cards--row .card-unit {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.reveal__cards--row .card {
  width: 100%;
  max-width: 270px;
  height: auto;
  aspect-ratio: 270 / 395;
}

@media (max-width: 860px) {
  .reveal__cards--row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-snap-type: x mandatory !important;
    scroll-padding: 0 16px;
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 14px 22px !important;
    gap: 14px !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(158, 121, 56, 0.6) rgba(18, 28, 22, 0.4);
  }

  .reveal__cards--row::-webkit-scrollbar {
    height: 6px;
  }

  .reveal__cards--row::-webkit-scrollbar-track {
    background: rgba(18, 28, 22, 0.4);
    border-radius: 3px;
  }

  .reveal__cards--row::-webkit-scrollbar-thumb {
    background: rgba(158, 121, 56, 0.6);
    border-radius: 3px;
  }

  .reveal__cards--row .card-unit {
    flex: 0 0 min(240px, 72vw) !important;
    width: min(240px, 72vw) !important;
    min-width: 0 !important;
    scroll-snap-align: center !important;
    scroll-snap-stop: always !important;
  }

  .reveal__cards--row .card {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 270 / 395 !important;
  }
}

.row-scroll-hint {
  display: none;
}

@media (max-width: 860px) {
  .row-scroll-hint:not([hidden]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #e5cf92;
    background: rgba(18, 28, 22, 0.7);
    border: 1px solid rgba(158, 121, 56, 0.4);
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    margin: 4px auto 0;
    user-select: none;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

.reveal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

/* Boutons d'action de terrain */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  transition: all 140ms ease;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.btn--primary {
  background: #244b34;
  color: #fdfcf9;
  border: 1px solid #1a3826;
  box-shadow: 0 2px 6px rgba(25, 55, 35, 0.2);
}

.btn--primary:hover {
  background: #2c5c40;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(25, 55, 35, 0.3);
}

.btn--subtle {
  background: #fdfcf9;
  color: #1c1813;
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 3px rgba(60, 45, 30, 0.04);
}

.btn--subtle:hover {
  background: #ffffff;
  border-color: #9e7938;
}

/* ==========================================================================
   LES CARTES NATURALISTES (PLANCHES D'HISTOIRE NATURELLE)
   ========================================================================== */
.card-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.card-unit__badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  user-select: none;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  transition: all 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.card-unit__badge.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(6px) scale(0.95);
  pointer-events: none;
}

.card-unit__badge.is-revealed {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1);
}

.card-unit__badge--new {
  color: #1c4d31;
  background: #ebf3ee;
  border: 1px solid #bad3c2;
}

.card-unit__badge--dup {
  color: #554738;
  background: #f4eee2;
  border: 1px solid #dcd1be;
}

/* La carte physique (planche de muséum) */
.card {
  position: relative;
  width: 100%;
  max-width: var(--card-width);
  aspect-ratio: 270 / 395;
  height: auto;
  perspective: 1000px;
  cursor: pointer;
  user-select: none;
}

.card__inner {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  transform-style: preserve-3d;
  transition: transform 450ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.card.is-facedown .card__inner {
  transform: rotateY(180deg);
}

.card__front,
.card__back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

/* Recto : Planche d'Herbier & d'Histoire Naturelle */
.card__front {
  background: #fdfcf9;
  border: 1.5px solid #d4cbb8;
  display: flex;
  flex-direction: column;
  padding: clamp(6px, 1.8vw, 11px) clamp(6px, 1.8vw, 11px) clamp(5px, 1.5vw, 9px);
  gap: clamp(3px, 1.2vw, 7px);
  box-shadow: 0 4px 16px rgba(60, 45, 30, 0.08);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  position: relative;
}

/* Double filet d'encadrement classique d'imprimeur */
.card__front::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(130, 110, 88, 0.16);
  border-radius: calc(var(--radius-card) - 2px);
  pointer-events: none;
}

.card:hover .card__front {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(60, 45, 30, 0.14);
  border-color: #9e7938;
}

/* Header de la planche */
.card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}

.card__taxon {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.card__taxon-icon {
  font-size: 0.85rem;
}

.card__number {
  color: var(--text-muted);
  font-family: var(--font-title);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.card__rarity-slot {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.card__rarity-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(75, 60, 42, 0.06);
  border: 1px solid rgba(75, 60, 42, 0.16);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.card__rarity-badge[data-rarity="commune"]     { color: #433f38; background: #eeebe3; border-color: #d2cbbe; }
.card__rarity-badge[data-rarity="peu-commune"] { color: #1c4d31; background: #ebf3ee; border-color: #bad3c2; }
.card__rarity-badge[data-rarity="rare"]        { color: #1a4261; background: #edf3f8; border-color: #bdd0e1; }
.card__rarity-badge[data-rarity="tres-rare"]   { color: #4e295a; background: #f3ecf7; border-color: #d5bedc; }
.card__rarity-badge[data-rarity="epique"]      { color: #783812; background: #f8ebe3; border-color: #ecc0a8; }
.card__rarity-badge[data-rarity="legendaire"]  { color: #6e5012; background: #f8f2e2; border-color: #e5cf92; }

.card__shiny-pill {
  font-size: 0.62rem;
  font-weight: 800;
  color: #795712;
  background: #fbf4de;
  border: 1px solid #d8b75e;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
}

/* Passe-partout pour l'illustration de terrain */
.card__photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 248 / 176;
  height: auto;
  max-height: 176px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #eae3d3;
  border: 1px solid rgba(75, 60, 42, 0.16);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card__photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 260ms ease;
}

.card:hover .card__photo-frame img {
  transform: scale(1.02);
}

.card__season-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(251, 249, 244, 0.95);
  border: 1px solid var(--border-strong);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-gold);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

/* Carte Shiny dorée à la feuille */
.card.is-shiny .card__front {
  border-color: #b8860b;
  outline: 1px solid rgba(184, 134, 11, 0.35);
  outline-offset: -5px;
  box-shadow: 0 6px 22px rgba(158, 121, 56, 0.2);
}

.card__photo-frame.is-shiny-frame {
  border-color: #b8860b;
  box-shadow: 0 0 0 1px #d4a342;
}

.shiny-foil-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 235, 175, 0.2) 0%, rgba(184, 134, 11, 0.1) 50%, rgba(255, 245, 210, 0.25) 100%);
  pointer-events: none;
}

.shiny-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  color: #ffd700;
  font-size: 0.85rem;
  animation: sparkle-twinkle 2s infinite ease-in-out;
}

.sp-1 { top: 8%; left: 10%; animation-delay: 0s; }
.sp-2 { top: 12%; right: 12%; animation-delay: 0.5s; }
.sp-3 { bottom: 12%; left: 15%; animation-delay: 1s; }
.sp-4 { bottom: 8%; right: 10%; animation-delay: 1.5s; }

@keyframes sparkle-twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* Corps de la planche */
.card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

.card__naming {
  display: flex;
  flex-direction: column;
}

.card__fr {
  font-family: var(--font-serif);
  font-size: clamp(0.85rem, 3.2vw, 1.15rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.card__shiny-star {
  color: #b8860b;
  margin-left: 4px;
}

.card__la {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(0.68rem, 2.3vw, 0.82rem);
  color: var(--text-muted);
  line-height: 1.2;
}

/* Histogramme phénologique naturaliste (12 mois) */
.card__phenology {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  background: #f6f0e4;
  padding: 3px 2px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(75, 60, 42, 0.1);
  text-align: center;
}

.pheno-m {
  font-size: 0.62rem;
  font-weight: 600;
  color: #928472;
  padding: 1px 0;
  border-radius: 2px;
}

.pheno-m.is-active {
  color: var(--text-primary);
  background: rgba(75, 60, 42, 0.08);
}

.pheno-m.is-now {
  background: #244b34;
  color: #ffffff;
  font-weight: 700;
}

/* Pied de planche */
.card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(75, 60, 42, 0.1);
  padding-top: 5px;
  margin-top: auto;
}

.card__count {
  font-weight: 600;
  white-space: nowrap;
  font-size: clamp(0.58rem, 1.8vw, 0.7rem);
}
.card__credit {
  max-width: 48%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(0.58rem, 1.8vw, 0.7rem);
}

/* Dos de carte (Gravure de reliure victorienne) */
.card__back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #1c2921 0%, #141e18 100%);
  border: 1.5px solid rgba(158, 121, 56, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  color: #f7f4ec;
}

.card-back-frame {
  flex: 1;
  border: 1px solid rgba(158, 121, 56, 0.35);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
}

.card-back-emblem {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(158, 121, 56, 0.15);
  border: 1px solid rgba(158, 121, 56, 0.45);
  display: grid;
  place-items: center;
}

.card-back-img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}

.card-back-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-back-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.14em;
  color: #f7f4ec;
}

.card-back-subtitle {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: #d4a342;
}

.card-back-hint {
  font-size: 0.72rem;
  color: #c9d2cd;
}

/* ==========================================================================
   À L'AFFICHE EN CE MOMENT (PLANCHES DE SAISON)
   ========================================================================== */
.spotlight-section {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1.5px solid var(--border);
}

.spotlight__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
  margin-top: 24px;
}

/* ==========================================================================
   ALBUM DES SPÉCIMENS (CATALOGUE RELIÉ)
   ========================================================================== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 140ms ease;
}

.chip:hover {
  border-color: #9e7938;
  color: var(--text-primary);
}

.chip[aria-selected="true"] {
  background: #244b34;
  color: #fdfcf9;
  border-color: #1a3826;
  box-shadow: 0 1px 4px rgba(25, 55, 35, 0.2);
}

.chip__count {
  font-size: 0.72rem;
  opacity: 0.85;
}

.toolbar__right {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.select-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.select-label select {
  font: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

/* Carte manquante */
.card--missing .card__front {
  background: #f0ebe0;
  border: 1.5px dashed #cdbfa8;
  display: grid;
  place-items: center;
  box-shadow: none;
}

.card--missing .card__front::after { display: none; }

.missing-num {
  font-size: 1.15rem;
  font-weight: 700;
  color: #948574;
  font-family: var(--font-title);
}

.missing-group {
  font-size: 0.76rem;
  color: #948574;
  font-weight: 600;
  margin-top: 4px;
}

/* ==========================================================================
   CYCLE DES 4 SAISONS (CALENDRIER PHÉNOLOGIQUE DE TERRAIN)
   ========================================================================== */
.seasons-diagram-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 8px;
}

.seasons-live-banner {
  background: #fdfbf7;
  border: 1.5px solid #d4cbb8;
  border-radius: var(--radius-sm);
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(60, 45, 30, 0.04);
}

.live-indicator {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-accent);
  background: rgba(36, 75, 52, 0.08);
  border: 1px solid rgba(36, 75, 52, 0.22);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.seasons-live-banner h3 {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.seasons-live-banner p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 4px;
  max-width: 680px;
  line-height: 1.5;
}

/* Grille des 4 saisons */
.seasons-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.season-box {
  background: #fdfcf9;
  border: 1.5px solid #d4cbb8;
  border-radius: var(--radius-sm);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  box-shadow: 0 2px 8px rgba(60, 45, 30, 0.03);
}

.season-box:hover {
  transform: translateY(-3px);
  border-color: #9e7938;
  box-shadow: 0 8px 20px rgba(60, 45, 30, 0.08);
}

.season-box.is-active-season {
  border: 2px solid #9e7938;
  background: #fffdf9;
  box-shadow: 0 8px 24px rgba(158, 121, 56, 0.12);
}

.badge-active-pill {
  color: #fdfcf9;
  background: #9e7938;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-left: 4px;
}

.season-box__header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.season-icon {
  font-size: 2rem;
}

.season-dates {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.season-name {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.season-theme {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.45;
  min-height: 44px;
}

.season-changes {
  background: #f6f1e6;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.changes-heading {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.changes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.changes-list li {
  line-height: 1.4;
}

.changes-list strong {
  color: var(--text-primary);
}

.season-sim {
  margin-top: auto;
}

.btn--sm {
  font-size: 0.8rem;
  padding: 7px 12px;
  width: 100%;
  justify-content: center;
  text-align: center;
}

.pheno-explainer-card {
  background: #fdfbf7;
  border: 1.5px solid #d4cbb8;
  border-radius: var(--radius-sm);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 2px 10px rgba(60, 45, 30, 0.03);
}

.pheno-explainer-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.explainer-icon {
  font-size: 1.6rem;
}

.pheno-explainer-title h4 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pheno-points-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.pheno-point {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pheno-point strong {
  font-size: 0.92rem;
  color: var(--text-primary);
}

.pheno-point p {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   QUIZ DE TERRAIN
   ========================================================================== */
.quiz__panel {
  background: #fdfbf7;
  border: 1.5px solid #d4cbb8;
  border-radius: var(--radius-sm);
  padding: 32px;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 32px;
  box-shadow: 0 4px 16px rgba(60, 45, 30, 0.04);
}

.quiz__photo {
  width: 100%;
  height: 380px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #eae3d3;
  border: 1px solid var(--border-strong);
}

.quiz__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quiz__body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.quiz__progress {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-accent);
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.quiz__q {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.quiz__options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.quiz__opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1.5px solid #d4cbb8;
  border-radius: var(--radius-sm);
  text-align: left;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 140ms ease;
  cursor: pointer;
}

.quiz__opt small {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.quiz__opt:hover:not(:disabled) {
  border-color: #9e7938;
  transform: translateX(3px);
  background: #fffdf9;
}

.quiz__opt.is-ok {
  background: #ebf3ee !important;
  border-color: #244b34 !important;
  color: #1c4d31 !important;
}

.quiz__opt.is-ko {
  background: #faede8 !important;
  border-color: #b3392b !important;
  color: #8c281e !important;
}

/* ==========================================================================
   CLASSEMENT DES NATURALISTES (REGISTRE OFFICIEL)
   ========================================================================== */
.lb-categories {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.lb-cat-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}

.lb-cat-btn:hover {
  color: var(--text-primary);
  border-color: #9e7938;
}

.lb-cat-btn.is-active {
  background: #244b34;
  color: #fdfcf9;
  border-color: #1a3826;
  box-shadow: 0 1px 4px rgba(25, 55, 35, 0.2);
}

.lb-explainer {
  background: #fdfbf7;
  border: 1.5px solid #d4cbb8;
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  margin-bottom: 24px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.lb-explainer strong {
  color: var(--text-primary);
}

.lb-table-wrapper {
  background: #fdfcf9;
  border: 1.5px solid #d4cbb8;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 2px 10px rgba(60, 45, 30, 0.04);
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.lb-table th {
  background: #f5efe3;
  padding: 12px 18px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1.5px solid #d4cbb8;
}

.lb-table td {
  padding: 14px 18px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.lb-row:hover {
  background: rgba(75, 60, 42, 0.03);
}

.lb-row.is-player-row {
  background: #ebf3ee;
  border-left: 3px solid #244b34;
}

.lb-row.is-player-row td {
  font-weight: 700;
  color: #1c4d31;
}

.lb-medal {
  font-size: 1.2rem;
  display: inline-block;
}

.lb-rank-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.lb-you-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #ffffff;
  background: #244b34;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-left: 8px;
}

.lb-val {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.02rem;
}

.td-detail {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* ==========================================================================
   MODALES (FICHE DÉTAILLÉE & PARTAGE SOCIAL) — CENTRAGE PARFAIT
   ========================================================================== */
dialog.sheet:not([open]) {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

dialog.sheet[open] {
  position: fixed !important;
  inset: 0 !important;
  margin: auto !important;
  width: min(1040px, calc(100vw - 36px)) !important;
  max-height: min(780px, calc(100vh - 48px)) !important;
  padding: 0 !important;
  border: 1.5px solid #9e7938 !important;
  border-radius: var(--radius-sm) !important;
  background: #fdfcf9 !important;
  color: var(--text-secondary) !important;
  box-shadow: 0 20px 60px rgba(35, 25, 15, 0.4) !important;
  overflow: hidden !important;
  z-index: 1000 !important;
}

dialog.sheet::backdrop {
  background: rgba(25, 20, 15, 0.65) !important;
  backdrop-filter: blur(8px) !important;
}

.sheet-close-btn {
  background: #f4eee2;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 140ms ease;
  flex-shrink: 0;
}

.sheet-close-btn:hover {
  background: #ffffff;
  border-color: #9e7938;
}

.sheet__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.sheet__media {
  position: relative;
  min-height: 480px;
  background: #eae3d3;
}

.sheet__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.sheet__credit {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  background: rgba(253, 252, 249, 0.95);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.sheet__content {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: calc(100vh - 50px);
}

.sheet__fr {
  font-family: var(--font-serif);
  font-size: 2.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.sheet__la {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--accent-gold);
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.fact__k {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.fact__v {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.calendar__chart {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
  height: 64px;
  align-items: end;
  background: #f5efe3;
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.calendar__bar {
  background: rgba(75, 60, 42, 0.2);
  border-radius: 2px 2px 0 0;
}

.calendar__bar.is-now {
  background: #244b34;
}

/* Modale de partage social */
dialog.sheet--share[open] {
  width: min(640px, calc(100vw - 32px)) !important;
  max-height: calc(100vh - 60px) !important;
}

.share-modal-box {
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.share-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.share-modal-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.share-preview-card {
  background: #f6f1e6;
  border: 1.5px solid #d4cbb8;
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.share-preview-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-preview-emblem {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.share-preview-brand {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-right: 6px;
  letter-spacing: 0.08em;
}

.share-preview-sub {
  font-size: 0.78rem;
  color: var(--accent-gold);
  font-weight: 700;
}

.share-preview-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.share-mini-card {
  aspect-ratio: 270 / 395;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-strong);
  background: #eae3d3;
}

.share-mini-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.share-mini-card__tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
  background: rgba(28, 24, 19, 0.88);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-preview-footer {
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: flex;
  justify-content: space-between;
}

.share-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-share-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1.5px solid #d4cbb8;
  text-align: left;
  cursor: pointer;
  transition: all 140ms ease;
  color: var(--text-primary);
}

.btn-share-channel:hover {
  transform: translateY(-2px);
  border-color: #9e7938;
  box-shadow: 0 4px 10px rgba(60, 45, 30, 0.06);
}

.btn-share-channel .ch-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.btn-share-channel .ch-text {
  display: flex;
  flex-direction: column;
}

.btn-share-channel strong {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.btn-share-channel small {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==========================================================================
   TOAST & PIED DE PAGE
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 16px);
  background: #1c1813;
  border: 1px solid rgba(158, 121, 56, 0.45);
  color: #fdfcf9;
  font-size: 0.9rem;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: all 160ms ease;
  z-index: 10000;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.footer {
  border-top: 1.5px solid var(--border);
  background: #f4eee2;
  padding: 32px 32px;
}

.footer__inner {
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.footer__inner a {
  text-decoration: underline;
  color: var(--text-primary);
}

/* ==========================================================================
   ADAPTATION RESPONSIVE & MOBILE (IN THE FOOTSTEPS OF DARWIN)
   - Conçu pour écran tactile, petits viewports (360px - 768px)
   - Zéro overflow horizontal, navigation par onglets scrollables
   - Grilles 2 colonnes proportionnelles pour les planches d'herbier
   - Modales pleines et commandes ergonomiques sous le pouce
   ========================================================================== */

/* -------------------------------------------------- 1. Tablettes (< 1100px) */
@media (max-width: 1100px) {
  .seasons-grid { grid-template-columns: 1fr 1fr; }
  .pheno-points-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .season-header {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .rarity-legend-box {
    width: 100%;
  }
  .quiz__panel {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px;
  }
  .quiz__photo {
    height: 280px;
  }
  .th-canton, .td-canton {
    display: none;
  }
}

/* -------------------------------------------------- 2. Mobile & Petites Tablettes (< 768px) */
@media (max-width: 768px) {
  /* En-tête de navigation : Ligne unique élégante et aérée */
  .topbar {
    position: sticky;
    top: 0;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #fbf9f4 !important;
  }

  .topbar__inner {
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
  }

  .brand {
    gap: 10px;
  }

  .brand__emblem {
    width: 36px;
    height: 36px;
  }

  .brand__name {
    font-size: 1.35rem;
    letter-spacing: 0.08em;
  }

  .brand__tag {
    font-size: 0.62rem;
    letter-spacing: 0.1em;
  }

  .region-pill {
    display: none; /* Allège l'en-tête pour laisser respirer le logo et les stats */
  }

  .topbar__stats {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .stat-badge {
    padding: 4px 8px;
    gap: 5px;
  }

  .stat-badge__lbl {
    font-size: 0.6rem;
    letter-spacing: 0.04em;
  }

  .stat-badge__val {
    font-size: 0.82rem;
  }

  .stat-badge__val strong {
    font-size: 0.88rem;
  }

  .stat-badge__total {
    font-size: 0.72rem;
  }

  /* ==========================================================================
     BARRE D'ONGLETS MOBILE FIXE EN BAS (ACCÈS DIRECT SOUS LE POUCE)
     ========================================================================== */
  .nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: rgba(251, 249, 244, 0.98);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1.5px solid var(--border-strong);
    box-shadow: 0 -4px 18px rgba(45, 35, 20, 0.08);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    margin: 0;
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom, 8px));
    gap: 2px;
  }

  .nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    min-height: 48px;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    transition: all 140ms ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .nav__icon {
    display: block;
    font-size: 1.25rem;
    line-height: 1;
    transition: transform 140ms ease;
  }

  .nav__label {
    font-size: 0.64rem;
    line-height: 1.1;
    font-weight: 600;
    white-space: nowrap;
  }

  .nav__link:hover {
    background: transparent;
    color: var(--text-primary);
  }

  .nav__link[aria-current="page"] {
    color: #244b34;
    background: rgba(36, 75, 52, 0.08);
    border-color: rgba(36, 75, 52, 0.22);
    box-shadow: 0 1px 3px rgba(36, 75, 52, 0.08);
  }

  .nav__link[aria-current="page"] .nav__icon {
    transform: scale(1.14);
  }

  .nav__link[aria-current="page"] .nav__label {
    font-weight: 800;
    color: #244b34;
  }

  /* Conteneur principal avec marge basse pour la bottom bar */
  main#app {
    padding: 18px 12px calc(80px + env(safe-area-inset-bottom, 16px));
  }

  /* Toast notification positionné juste au-dessus de la bottom bar */
  .toast {
    bottom: calc(76px + env(safe-area-inset-bottom, 12px));
  }

  .section-head {
    margin-bottom: 16px;
  }

  .section-head--page {
    margin-bottom: 20px;
  }

  .section-head h2 {
    font-size: 1.65rem;
  }

  .section-head__note {
    font-size: 0.85rem;
  }

  /* Titre de saison */
  .season__title {
    font-size: clamp(1.65rem, 6.5vw, 2.3rem);
    margin-bottom: 6px;
  }

  .season__lede {
    font-size: 0.92rem;
    line-height: 1.5;
  }

  .season-tags-bar {
    gap: 8px;
    margin-bottom: 18px;
  }

  .season-tags-lbl {
    font-size: 0.74rem;
    width: 100%;
  }

  .season__group {
    font-size: 0.76rem;
    padding: 3px 8px;
  }

  /* Arène de tirage */
  .arena {
    padding: 20px 8px;
    min-height: auto;
    margin-bottom: 28px;
    outline-offset: -4px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
  }

  /* Paquet booster */
  .field-pack {
    width: min(275px, 86vw);
    height: auto;
    aspect-ratio: 295 / 425;
    padding: 20px 16px;
  }

  .field-pack__center {
    gap: 6px;
  }

  .field-pack__emblem-img {
    width: 64px;
    height: 64px;
  }

  .field-pack__title {
    font-size: 1.45rem;
  }

  .field-pack__specimens {
    font-size: 0.82rem;
  }

  .band-month {
    font-size: 1.55rem;
  }

  /* Révélation */
  .reveal-wrapper {
    gap: 16px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
  }

  .reveal-title {
    font-size: 1.85rem;
  }

  .reveal-sub {
    font-size: 0.84rem;
  }

  .reveal-modes {
    width: 100%;
    max-width: 320px;
    display: flex;
    margin-top: 12px;
  }

  .reveal-mode-btn {
    flex: 1;
    justify-content: center;
    padding: 7px 10px;
    font-size: 0.78rem;
    gap: 5px;
  }

  /* Actions de révélation */
  .reveal__actions {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .reveal__actions .btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 0.88rem;
  }

  /* Toolbar de l'Album */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }

  .chips {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    width: 100%;
    gap: 5px;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 11px;
    font-size: 0.76rem;
  }

  .toolbar__right {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .select-label {
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    font-size: 0.74rem;
  }

  .select-label select {
    width: 100%;
    padding: 7px 10px;
    font-size: 0.82rem;
  }

  /* Grille d'Album & Spotlight : 2 colonnes sur mobile */
  .album-grid,
  .spotlight__list {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .spotlight-section {
    margin-top: 36px;
    padding-top: 28px;
  }

  /* Quiz */
  .quiz__panel {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px 14px;
  }

  .quiz__photo {
    height: 220px;
  }

  .quiz__q {
    font-size: 1.25rem;
    line-height: 1.3;
  }

  .quiz__opt {
    padding: 11px 14px;
    font-size: 0.88rem;
  }

  /* Leaderboard */
  .lb-categories {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 6px;
    width: 100%;
    gap: 5px;
  }

  .lb-categories::-webkit-scrollbar {
    display: none;
  }

  .lb-cat-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 7px 12px;
    font-size: 0.78rem;
  }

  .lb-explainer {
    padding: 12px 14px;
    font-size: 0.84rem;
    margin-bottom: 16px;
  }

  .lb-table th, .lb-table td {
    padding: 10px 8px;
    font-size: 0.82rem;
  }

  .th-detail, .td-detail {
    display: none; /* Cacher le détail verbeux pour laisser la place au nom et score */
  }

  /* Saisons */
  .seasons-live-banner {
    padding: 16px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .seasons-live-banner h3 {
    font-size: 1.3rem;
  }

  .seasons-live-banner p {
    font-size: 0.86rem;
  }

  .season-progress-box {
    width: 100%;
  }

  .seasons-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .season-box {
    padding: 16px 14px;
  }

  .season-theme {
    min-height: auto;
  }

  .pheno-explainer-card {
    padding: 18px 14px;
    gap: 14px;
  }

  .pheno-explainer-title h4 {
    font-size: 1.15rem;
  }

  /* Modale Fiche Détail (dialog.sheet) */
  dialog.sheet[open] {
    width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 20px) !important;
    border-radius: var(--radius-sm) !important;
  }

  .sheet__inner {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sheet__media {
    position: relative;
    height: 220px;
    min-height: 220px;
    flex-shrink: 0;
  }

  .sheet__content {
    padding: 16px 14px 24px;
    overflow-y: visible;
    max-height: none;
    gap: 14px;
  }

  .sheet__fr {
    font-size: 1.45rem;
    line-height: 1.2;
  }

  .sheet__la {
    font-size: 0.95rem;
  }

  .facts {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px 0;
  }

  .fact__k {
    font-size: 0.6rem;
  }

  .fact__v {
    font-size: 0.88rem;
  }

  .sheet-close-btn {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  /* Modale Partage Social */
  dialog.sheet--share[open] {
    width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 20px) !important;
  }

  .share-modal-box {
    padding: 16px 12px;
    gap: 14px;
  }

  .share-modal-title {
    font-size: 1.25rem;
  }

  .share-preview-card {
    padding: 12px 10px;
    gap: 10px;
  }

  .share-preview-cards {
    gap: 4px;
  }

  .share-actions-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .btn-share-channel {
    padding: 10px 12px;
  }

  /* Pied de page */
  .footer {
    padding: 24px 14px 48px;
  }

  .footer__inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }
}

/* -------------------------------------------------- 3. Écrans Étroits (< 560px) */
@media (max-width: 560px) {
  /* Tirage Mode 1 par 1 : Boutons latéraux flottants et carte centrée */
  .showcase-main {
    position: relative;
    gap: 0;
    width: 100%;
    justify-content: center;
    padding: 0;
  }

  .showcase-card-slot {
    min-height: auto;
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .showcase-card-slot .card {
    width: min(265px, 78vw);
    height: auto;
    aspect-ratio: 270 / 395;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  }

  .showcase-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(253, 252, 249, 0.96);
    border: 1.5px solid var(--border-strong);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    font-size: 1.6rem;
  }

  .showcase-nav-btn--prev { left: 2px; }
  .showcase-nav-btn--next { right: 2px; }

  .showcase-controls {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .showcase-controls .btn {
    width: 100%;
    justify-content: center;
    padding: 11px 16px;
  }

  .showcase-steps {
    gap: 5px;
  }

  .showcase-step {
    padding: 4px 8px;
    font-size: 0.72rem;
  }
}

/* -------------------------------------------------- 4. Écrans Très Compacts (< 400px) */
@media (max-width: 400px) {
  .topbar__inner {
    padding: 8px 10px;
  }

  .brand__name {
    font-size: 1.2rem;
  }

  .brand__emblem {
    width: 30px;
    height: 30px;
  }

  .stat-badge {
    padding: 3px 6px;
  }

  .stat-badge__lbl {
    font-size: 0.55rem;
  }

  .stat-badge__val {
    font-size: 0.75rem;
  }

  .nav__icon {
    font-size: 1.15rem;
  }

  .nav__label {
    font-size: 0.6rem;
  }

  .album-grid,
  .spotlight__list {
    gap: 8px !important;
  }
}
