/* ═══════════ AquaFerme — thème ═══════════ */
:root {
  --fond1: #06222e;
  --fond2: #0a3242;
  --carte: rgba(255, 255, 255, 0.055);
  --carte-bord: rgba(255, 255, 255, 0.10);
  --texte: #e8f4f4;
  --texte2: #9fc3cb;
  --accent: #2dd4bf;
  --accent-fonce: #0d9488;
  --or: #fbbf24;
  --danger: #f87171;
  --ok: #4ade80;
  --warn: #fbbf24;
  --eau1: #0ea5b7;
  --eau2: #075e74;
  --rayon: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(1200px 800px at 20% -10%, #0e4256 0%, var(--fond1) 55%) fixed, var(--fond1);
  color: var(--texte);
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
h1, h2, h3 { margin: 0; }

/* ═══════════ Boutons & champs ═══════════ */
.btn {
  background: rgba(255,255,255,0.09);
  border: 1px solid var(--carte-bord);
  color: var(--texte);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px;
  transition: background .15s, transform .05s;
}
.btn:hover { background: rgba(255,255,255,0.16); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-principal { background: var(--accent-fonce); border-color: var(--accent); font-weight: 600; }
.btn-principal:hover { background: #11a394; }
.btn-mini { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.btn-danger { border-color: rgba(248,113,113,.5); color: #fecaca; }
.btn-danger:hover { background: rgba(248,113,113,.18); }
/* état « sélectionné » d'un bouton (calibre, type de produit, etc.) : surligné en teal */
.btn.choisi { border-color: var(--accent); background: rgba(45,212,191,.16); color: var(--texte); font-weight: 700; }

/* Interrupteur (toggle switch) façon iOS */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; cursor: pointer; flex: 0 0 auto; }
.switch .slider { position: absolute; inset: 0; background: rgba(255,255,255,0.16); border: 1px solid var(--carte-bord); border-radius: 999px; transition: background .2s, border-color .2s; }
.switch .slider::before { content: ''; position: absolute; height: 20px; width: 20px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.45); }
.switch:hover .slider { border-color: var(--accent); }
.switch.on .slider { background: var(--accent-fonce); border-color: var(--accent); }
.switch.on .slider::before { transform: translateX(22px); }
.switch:active .slider::before { width: 23px; }

.champ { display: block; margin-bottom: 12px; }
.champ span { display: block; font-size: 12.5px; color: var(--texte2); margin-bottom: 5px; }
.champ input, .ligne-code input, #formChat input {
  width: 100%;
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--carte-bord);
  border-radius: 10px;
  color: var(--texte);
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
}
.champ input:focus, .ligne-code input:focus, #formChat input:focus { border-color: var(--accent); }

/* ═══════════ Écran de reconnexion (anti-flash au refresh) ═══════════ */
#splashReco {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 800px at 20% -10%, #0e4256 0%, var(--fond1) 55%), var(--fond1);
}
.splash-in { text-align: center; color: var(--texte2); }
.splash-in span { font-size: 54px; display: block; animation: flotte 2.4s ease-in-out infinite; }
.splash-in p { margin-top: 12px; font-size: 15px; }

/* ═══════════ Lobby + écran de connexion ═══════════ */
#lobby, #auth {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 14px;
}
.lobby-carte {
  width: 100%; max-width: 860px;
  background: var(--carte);
  border: 1px solid var(--carte-bord);
  border-radius: 22px;
  padding: 34px 34px 22px;
  backdrop-filter: blur(8px);
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
}
.lobby-titre { text-align: center; margin-bottom: 24px; }
.lobby-titre h1 {
  font-size: 46px; letter-spacing: 1px;
  background: linear-gradient(90deg, #5eead4, #22d3ee, #5eead4);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lobby-poissons span {
  display: inline-block; font-size: 34px; margin: 0 6px;
  animation: flotte 3s ease-in-out infinite;
}
.lobby-poissons span:nth-child(2) { animation-delay: .5s; }
.lobby-poissons span:nth-child(3) { animation-delay: 1s; }
@keyframes flotte { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.sous-titre { color: var(--texte2); margin: 8px auto 0; max-width: 520px; font-size: 15px; }

.lobby-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 6px; }
.lobby-bloc {
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--carte-bord);
  border-radius: var(--rayon);
  padding: 18px;
}
.lobby-bloc h2 { font-size: 17px; margin-bottom: 14px; }
.case { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--texte2); margin: 4px 0 14px; }
.lobby-bloc .btn-principal { width: 100%; padding: 12px; font-size: 15px; }
.ligne-code { display: flex; gap: 8px; margin-bottom: 14px; }
.ligne-code input { text-transform: uppercase; letter-spacing: 3px; font-weight: 700; text-align: center; }
.entete-liste { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--texte2); margin-bottom: 8px; }
.liste-fermes { max-height: 190px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.ferme-ligne {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--carte-bord);
  border-radius: 10px; padding: 9px 12px;
  width: 100%; text-align: left; color: var(--texte); font-size: 13.5px;
}
.ferme-ligne:hover { background: rgba(45,212,191,0.12); border-color: var(--accent); }
.ferme-ligne .meta { color: var(--texte2); font-size: 12px; }
.vide { color: var(--texte2); font-size: 13px; text-align: center; padding: 14px 0; }
.lobby-statut { text-align: center; color: var(--texte2); font-size: 13px; min-height: 18px; margin: 14px 0 0; }

/* ═══════════ Topbar ═══════════ */
#topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(0,0,0,0.32);
  border-bottom: 1px solid var(--carte-bord);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
}
.tb-groupe { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tb-ferme { font-weight: 700; font-size: 15px; }
.code-ferme {
  background: rgba(45,212,191,0.14);
  border: 1px dashed var(--accent);
  color: #99f6e4;
  border-radius: 8px; padding: 3px 10px;
  font-size: 12.5px; letter-spacing: 2px; font-weight: 700;
}
#tbArgent { color: var(--or); font-size: 16px; }
.barre-jour, .barre-xp { width: 70px; height: 7px; background: rgba(0,0,0,0.4); border-radius: 4px; overflow: hidden; }
.barre-jour > div { height: 100%; background: linear-gradient(90deg, #38bdf8, #818cf8); transition: width .8s linear; }
.barre-xp > div { height: 100%; background: linear-gradient(90deg, #fbbf24, #f59e0b); transition: width .4s; }
.tb-droite { margin-left: auto; }
.pastille { font-size: 13px; }
.pastille.ok { color: var(--ok); }
.pastille.ko { color: var(--danger); animation: clignote 1s infinite; }
@keyframes clignote { 50% { opacity: .3; } }
.jeton-joueur {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; padding: 3px 9px;
  border-radius: 999px; background: rgba(255,255,255,0.08);
  border: 1px solid var(--carte-bord);
}
.jeton-joueur .point { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.jeton-joueur.hors-ligne { opacity: .45; }
.jeton-joueur.hors-ligne .point { background: #64748b; }

#bandeauEvenement {
  text-align: center; padding: 7px 12px; font-size: 13.5px;
  background: linear-gradient(90deg, rgba(251,191,36,.16), rgba(248,113,113,.16));
  border-bottom: 1px solid rgba(251,191,36,.35);
}
#bandeauPause {
  text-align: center; padding: 7px 12px; font-size: 13.5px;
  background: rgba(148,163,184,.15);
  border-bottom: 1px solid rgba(148,163,184,.4);
}

/* ═══════════ Disposition principale ═══════════ */
#principal {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  padding: 16px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}

/* ═══════════ Bassins ═══════════ */
#zoneBassins {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}
.bassin {
  background: var(--carte);
  border: 1px solid var(--carte-bord);
  border-radius: var(--rayon);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.bassin.malade { border-color: rgba(248,113,113,.55); box-shadow: 0 0 0 1px rgba(248,113,113,.3), 0 0 18px rgba(248,113,113,.12); }
.bassin-entete {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px 8px;
}
.bassin-entete h3 { font-size: 15px; }
.bassin-entete .type { color: var(--texte2); font-size: 11.5px; font-weight: 400; margin-left: 6px; }
.equips { font-size: 13px; letter-spacing: 2px; }

.eau {
  position: relative;
  height: 92px;
  margin: 0 12px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, var(--eau1), var(--eau2));
}
.eau::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 30% at 25% 0%, rgba(255,255,255,0.22), transparent 60%),
    radial-gradient(ellipse 50% 26% at 75% 4%, rgba(255,255,255,0.14), transparent 60%);
  animation: reflets 7s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes reflets { from { transform: translateX(-6%); } to { transform: translateX(6%); } }
.eau.sale { filter: saturate(.55) hue-rotate(28deg) brightness(.82); }
.eau.tres-sale { filter: saturate(.4) hue-rotate(52deg) brightness(.65); }
.eau .poisson {
  position: absolute;
  animation: nage linear infinite;
  text-shadow: 0 2px 6px rgba(0,0,0,.4);
  will-change: transform;
}
/* Le poisson est dessiné tête à gauche : scaleX(-1) = il regarde à droite.
   Cycle complet aller-retour ; il pivote (flip) à chaque extrémité, comme un vrai poisson. */
@keyframes nage {
  0%   { transform: translateX(0) scaleX(1); }            /* à gauche, regarde à gauche */
  3%   { transform: translateX(0) scaleX(-1); }           /* pivote pour partir à droite */
  47%  { transform: translateX(var(--dist)) scaleX(-1); } /* file vers la droite */
  53%  { transform: translateX(var(--dist)) scaleX(1); }  /* pivote pour repartir à gauche */
  97%  { transform: translateX(0) scaleX(1); }            /* revient vers la gauche */
  100% { transform: translateX(0) scaleX(1); }
}
.eau .etiquette-vide {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(232,244,244,.75); font-size: 13.5px;
}
.badge-maladie {
  position: absolute; top: 6px; left: 6px;
  background: rgba(127,29,29,.85);
  border: 1px solid var(--danger);
  color: #fecaca;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
}
.badge-caviar {
  position: absolute; top: 6px; right: 6px;
  background: rgba(120,53,15,.85);
  border: 1px solid var(--or);
  color: #fde68a;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
}

.bassin-infos {
  display: flex; justify-content: space-between;
  padding: 8px 12px 2px;
  font-size: 12.5px; color: var(--texte2);
}
.bassin-infos b { color: var(--texte); }

.jauges { padding: 6px 12px 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
.jauge { display: grid; grid-template-columns: 52px 1fr 30px; align-items: center; gap: 6px; font-size: 11.5px; color: var(--texte2); }
.jauge .rail { height: 7px; background: rgba(0,0,0,0.38); border-radius: 4px; overflow: hidden; }
.jauge .rempli { height: 100%; border-radius: 4px; transition: width .6s; }
.jauge .rempli.ok { background: var(--ok); }
.jauge .rempli.warn { background: var(--warn); }
.jauge .rempli.danger { background: var(--danger); }
.jauge .val { text-align: right; font-variant-numeric: tabular-nums; }

.bassin-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 12px 12px;
  margin-top: auto;
}
.bassin-actions .btn { font-size: 12.5px; padding: 7px 10px; flex: 1 1 auto; }
.btn-pulse { animation: pulse 1.6s infinite; border-color: var(--danger); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(248,113,113,.45); } 50% { box-shadow: 0 0 0 6px rgba(248,113,113,0); } }

/* ═══════════ Sidebar ═══════════ */
#sidebar {
  background: var(--carte);
  border: 1px solid var(--carte-bord);
  border-radius: var(--rayon);
  display: flex; flex-direction: column;
  min-height: 480px;
  max-height: calc(100vh - 110px);
  position: sticky; top: 70px;
}
#onglets { display: flex; border-bottom: 1px solid var(--carte-bord); }
#onglets button {
  flex: 1; background: none; border: none;
  color: var(--texte2); padding: 11px 4px;
  font-size: 13px; border-bottom: 2px solid transparent;
}
#onglets button.actif { color: var(--texte); border-bottom-color: var(--accent); font-weight: 600; }
#panneau { padding: 13px; overflow-y: auto; flex: 1; }

.section-titre { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--texte2); margin: 14px 0 8px; }
.section-titre:first-child { margin-top: 0; }

.ligne-marche {
  display: grid; grid-template-columns: 40px 1fr 80px; gap: 8px;
  align-items: center; padding: 8px 9px;
  background: rgba(0,0,0,0.18); border-radius: 10px; margin-bottom: 7px;
  border: 1px solid transparent;
}
.ligne-marche.verrouille { opacity: .45; }
.ligne-marche .emoji { display: flex; align-items: center; justify-content: center; }

/* Icône poisson (SVG) en ligne dans les menus, listes et titres */
.fish-ico { display: inline-flex; align-items: center; vertical-align: -0.3em; margin-right: 3px; }
.ligne-marche .nom { font-size: 13.5px; }
.ligne-marche .demande { margin-top: 4px; }
.ligne-marche .prix { text-align: right; font-weight: 700; color: var(--or); font-size: 14px; }
.ligne-marche .sous { display: block; font-weight: 400; font-size: 10.5px; color: var(--texte2); }
.mini-rail { height: 5px; background: rgba(0,0,0,0.4); border-radius: 3px; overflow: hidden; }
.mini-rail > div { height: 100%; border-radius: 3px; }

.carte-achat {
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--carte-bord);
  border-radius: 10px;
  padding: 10px 11px;
  margin-bottom: 8px;
}
.carte-achat .haut { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.carte-achat .haut b { font-size: 13.5px; }
.carte-achat .prix { color: var(--or); font-weight: 700; white-space: nowrap; }
.carte-achat .desc { font-size: 12px; color: var(--texte2); margin: 4px 0 8px; }
.carte-achat .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.carte-achat.verrouille { opacity: .5; }
.verrou { font-size: 11px; color: var(--warn); }

.stock-ligne { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 2px; color: var(--texte2); }
.stock-ligne b { color: var(--texte); }

/* ═══════════ Chat / Journal ═══════════ */
#panneauChat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sous-onglets { display: flex; gap: 6px; padding: 10px 13px 0; }
.sous-onglets button {
  background: rgba(255,255,255,0.06); border: 1px solid var(--carte-bord);
  color: var(--texte2); border-radius: 8px; padding: 5px 12px; font-size: 12.5px;
}
.sous-onglets button.actif { color: var(--texte); border-color: var(--accent); background: rgba(45,212,191,.12); }
.flux { flex: 1; overflow-y: auto; padding: 10px 13px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.msg-chat { font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.msg-chat .auteur { font-weight: 700; }
.msg-journal { font-size: 12.5px; color: var(--texte2); line-height: 1.35; }
.msg-journal .quand { color: #64748b; font-size: 11px; margin-right: 5px; font-variant-numeric: tabular-nums; }
.msg-journal.success { color: #86efac; }
.msg-journal.warn { color: #fcd34d; }
.msg-journal.danger { color: #fca5a5; }
#formChat { display: flex; gap: 7px; padding: 10px 13px 13px; }
#formChat .btn { padding: 8px 14px; }

/* ═══════════ Toasts ═══════════ */
#toasts {
  position: fixed; top: 64px; right: 14px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 360px;
}
.toast {
  background: rgba(8, 35, 46, 0.96);
  border: 1px solid var(--carte-bord);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
  animation: toast-entree .25s ease-out;
}
.toast.success { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.danger { border-left-color: var(--danger); }
.toast.conseil { border-left-color: var(--accent); background: rgba(45,212,191,.14); font-weight: 600; }
@keyframes toast-entree { from { transform: translateX(30px); opacity: 0; } }
.toast.sortie { transition: opacity .4s, transform .4s; opacity: 0; transform: translateX(30px); }

/* ═══════════ Modales ═══════════ */
#voile {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(2, 14, 20, 0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}
#modale {
  background: #0b3140;
  border: 1px solid var(--carte-bord);
  border-radius: 16px;
  width: 100%; max-width: 560px;
  max-height: 86vh; overflow-y: auto;
  padding: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.modale-entete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modale-entete h2 { font-size: 18px; }
.grille-especes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.carte-espece {
  background: rgba(0,0,0,0.22); border: 1px solid var(--carte-bord);
  border-radius: 10px; padding: 10px; text-align: left; color: var(--texte);
}
.carte-espece:hover:not(:disabled) { border-color: var(--accent); }
.carte-espece.choisi { border-color: var(--accent); background: rgba(45,212,191,.13); }
.carte-espece:disabled { opacity: .42; cursor: not-allowed; }
.carte-espece .ce-nom { font-weight: 700; font-size: 13.5px; }
.carte-espece .ce-infos { font-size: 11.5px; color: var(--texte2); margin-top: 3px; line-height: 1.45; }
.curseur-ligne { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.curseur-ligne input[type=range] { flex: 1; accent-color: var(--accent); }
.gros-chiffre { font-size: 15px; font-weight: 700; min-width: 120px; text-align: right; }
.recap {
  background: rgba(0,0,0,0.25); border-radius: 10px;
  padding: 12px 14px; font-size: 13.5px; margin: 12px 0;
  display: flex; flex-direction: column; gap: 5px;
}
.recap .ligne { display: flex; justify-content: space-between; }
.recap .total { border-top: 1px solid var(--carte-bord); padding-top: 7px; font-weight: 700; }
.choix-pct { display: flex; gap: 7px; margin: 12px 0; }
.choix-pct button { flex: 1; }
.choix-pct button.choisi { border-color: var(--accent); background: rgba(45,212,191,.16); font-weight: 700; }
.modale-pied { display: flex; gap: 9px; justify-content: flex-end; margin-top: 14px; }
.aide-bloc { font-size: 13.5px; line-height: 1.55; color: var(--texte2); }
.aide-bloc b { color: var(--texte); }
.aide-bloc ul { padding-left: 18px; margin: 8px 0; }
.aide-bloc li { margin-bottom: 6px; }
.aide-bloc p { margin: 8px 0; }

/* Encart code d'accès dans la modale de bienvenue */
.bienvenue-code {
  background: rgba(45,212,191,.12); border: 1px solid var(--accent);
  border-radius: 10px; padding: 10px 12px; margin: 12px 0; font-size: 14px;
}
.bienvenue-code b { font-size: 20px; letter-spacing: 3px; color: var(--accent); }
.bienvenue-code small { display: block; margin-top: 4px; color: var(--texte2); font-size: 12px; line-height: 1.45; }
.bienvenue-reel { background: rgba(255,255,255,.04); border-left: 3px solid var(--warn); border-radius: 6px; padding: 8px 11px; }
.bienvenue-codex { background: rgba(255,255,255,.04); border-left: 3px solid var(--accent); border-radius: 6px; padding: 8px 11px; }
.bienvenue-zen { background: rgba(34,197,94,.08); border-left: 3px solid var(--ok); border-radius: 6px; padding: 8px 11px; }
.bienvenue-alternant { background: rgba(129,140,248,.10); border-left: 3px solid #818cf8; border-radius: 6px; padding: 8px 11px; }

/* Liste d'objectifs (modale 🎯) */
.objectif-ligne { display: flex; gap: 9px; align-items: flex-start; padding: 7px 9px; margin: 5px 0;
  background: rgba(0,0,0,.18); border-radius: 9px; border: 1px solid transparent; }
.objectif-ligne.fait { border-color: var(--ok); background: rgba(34,197,94,.10); }
.objectif-ligne .oc { font-size: 16px; line-height: 1.2; }
.objectif-ligne .ol { font-size: 13px; }
.objectif-ligne .ol small { color: var(--texte2); }

/* Calendrier (modale 📅) */
.cal-grille { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin: 10px 0; }
.cal-saison { background: rgba(0,0,0,.18); border: 1px solid transparent; border-radius: 10px; padding: 8px; }
.cal-saison.active { border-color: var(--accent); background: rgba(45,212,191,.10); }
.cal-saison-tete { font-weight: 700; font-size: 13px; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: baseline; }
.cal-dur { font-weight: 400; font-size: 11px; color: var(--texte2); }
.cal-barre { height: 8px; background: rgba(0,0,0,.35); border-radius: 5px; overflow: hidden; }
.cal-rempli { height: 100%; background: linear-gradient(90deg, #38bdf8, #818cf8); border-radius: 5px; }

/* ═══════════ Vue du dessus (top-down) ═══════════ */
#zone2d { position: fixed; inset: 0; z-index: 5; background: #06222e; }
#canvas2d { position: absolute; inset: 0; display: block; cursor: pointer; }
body.mode-terrain #principal, body.mode-terrain #bandeauEvenement, body.mode-terrain #bandeauPause { display: none !important; }
#barre2d {
  position: absolute; top: 60px; left: 12px; z-index: 6;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: rgba(5,25,33,.85); border: 1px solid var(--carte-bord);
  border-radius: 12px; padding: 7px 11px; backdrop-filter: blur(4px); max-width: calc(100% - 24px);
}
#banniereVisite {
  position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 7;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: rgba(20,45,60,.95); border: 1px solid var(--accent);
  border-radius: 12px; padding: 8px 14px; backdrop-filter: blur(4px);
  color: #e8f4f4; font-size: 13px; box-shadow: 0 4px 18px rgba(0,0,0,.4); max-width: calc(100% - 24px);
}
#barre2d button[data-outil] {
  background: rgba(255,255,255,0.07); border: 1px solid var(--carte-bord); color: var(--texte);
  border-radius: 8px; padding: 6px 11px; font-size: 13px; cursor: pointer;
}
#barre2d button[data-outil].actif { border-color: var(--accent); background: rgba(45,212,191,.16); font-weight: 600; }
#barre2d #btnConstruire2d {
  background: rgba(255,255,255,0.07); border: 1px solid var(--carte-bord); color: var(--texte);
  border-radius: 8px; padding: 6px 11px; font-size: 13px; cursor: pointer;
}
#barre2d #btnConstruire2d.actif { border-color: var(--or); background: rgba(245,158,11,.18); font-weight: 600; }
#aide2d { font-size: 12px; color: var(--texte2); }

/* Picker du mode Construire (vue Terrain) */
#construire2d {
  position: absolute; z-index: 8; left: 12px; top: 108px; width: 250px;
  background: rgba(5,25,33,.96); border: 1px solid var(--carte-bord); border-radius: 12px;
  padding: 9px; backdrop-filter: blur(4px); box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
#construire2d .cstr-tete { font-weight: 700; font-size: 13.5px; margin-bottom: 7px; }
#construire2d .cstr-tete small { color: var(--texte2); font-weight: 400; }
#construire2d .cstr-info { font-size: 12px; color: var(--warn); margin-bottom: 6px; }
.cstr-item {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  background: rgba(255,255,255,0.05); border: 1px solid var(--carte-bord); color: var(--texte);
  border-radius: 8px; padding: 7px 9px; margin-bottom: 5px; font-size: 12.5px; cursor: pointer; text-align: left;
}
.cstr-item:hover:not(:disabled) { border-color: var(--accent); background: rgba(45,212,191,.12); }
.cstr-item span { color: var(--texte2); }
.cstr-item:disabled { opacity: .5; cursor: not-allowed; }
#popup2d {
  position: absolute; z-index: 7; width: 240px;
  background: rgba(5,25,33,.95); border: 1px solid var(--carte-bord);
  border-radius: 12px; padding: 9px 11px; box-shadow: 0 12px 36px rgba(0,0,0,.5); backdrop-filter: blur(5px);
}
.popup-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.popup-tete b { font-size: 14px; }
.popup-info { font-size: 12px; color: var(--texte2); margin-bottom: 8px; }
.popup-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.popup-actions .btn { font-size: 13px; }

/* Contrôle de zoom de la vue Terrain (pincer/molette + ces boutons) */
#zoom2d {
  position: absolute; z-index: 6; right: 12px; bottom: 18px;
  display: flex; flex-direction: column; gap: 7px;
}
#zoom2d button {
  width: 42px; height: 42px; border-radius: 11px;
  background: rgba(5,25,33,.9); border: 1px solid var(--carte-bord); color: var(--texte);
  font-size: 22px; line-height: 1; cursor: pointer; backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
#zoom2d button:hover { border-color: var(--accent); background: rgba(45,212,191,.15); }
#zoom2d button:active { transform: scale(0.94); }

/* ═══════════ Étape 1 — difficulté & codex ═══════════ */
.champ-label { display: block; font-size: 12.5px; color: var(--texte2); margin-bottom: 6px; }
.choix-diff { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; margin-bottom: 14px; }
.choix-diff button {
  background: rgba(0,0,0,0.22); border: 1px solid var(--carte-bord); border-radius: 10px;
  color: var(--texte); padding: 9px 7px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; transition: border-color .15s, background .15s;
}
.choix-diff button:hover { border-color: var(--accent); }
.choix-diff button.choisi { border-color: var(--accent); background: rgba(45,212,191,.14); }
.choix-diff button b { font-size: 13px; }
.choix-diff button small { font-size: 10.5px; color: var(--texte2); line-height: 1.3; }
.tb-diff { font-size: 13px; }
.codex-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.codex-nav button {
  background: rgba(255,255,255,0.06); border: 1px solid var(--carte-bord); color: var(--texte2);
  border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.codex-nav button.actif { color: var(--texte); border-color: var(--accent); background: rgba(45,212,191,.12); }
.codex-art { background: rgba(0,0,0,0.18); border: 1px solid var(--carte-bord); border-radius: 10px; padding: 11px 13px; margin-bottom: 9px; }
.codex-art h3 { font-size: 14.5px; margin-bottom: 5px; }
.codex-art p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--texte2); }
.codex-art .stats { font-size: 12px; color: var(--accent); margin-top: 5px; }
.codex-art .saviez { font-size: 12px; color: #fcd34d; margin-top: 6px; font-style: italic; }

/* ═══════════ Étape 0 — éléments économie ═══════════ */
.badge-attente {
  position: absolute; top: 6px; left: 6px;
  background: rgba(120,53,15,.85); border: 1px solid var(--warn); color: #fde68a;
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px;
}
.badge-jeune {
  position: absolute; bottom: 6px; left: 6px;
  background: rgba(30,58,80,.85); border: 1px solid var(--accent); color: #99f6e4;
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px;
}
.badge-panne {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(120,53,15,.88); border: 1px solid #f59e0b; color: #fde68a;
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px; cursor: help;
}
.equips .equip-panne { color: var(--danger); filter: saturate(1.3); animation: clignote 1.2s infinite; }
.badge-morts {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  background: rgba(60,20,20,.9); border: 1px solid #b91c1c; color: #fecaca;
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px;
}
.badge-gobage {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  background: rgba(80,60,15,.9); border: 1px solid #f59e0b; color: #fde68a;
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px; animation: clignote 1.2s infinite;
}
.badge-surcharge {
  position: absolute; top: 6px; right: 6px;
  background: rgba(120,53,15,.9); border: 1px solid #f59e0b; color: #fde68a;
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px; animation: clignote 1.2s infinite;
}
/* Pastilles réputation / moral dans la topbar */
.pastille-stat { font-size: 12.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.pastille-stat.ok { color: var(--ok); background: rgba(34,197,94,.12); }
.pastille-stat.warn { color: var(--warn); background: rgba(245,158,11,.12); }
.pastille-stat.danger { color: var(--danger); background: rgba(239,68,68,.14); }
.tb-reput { display: flex; gap: 6px; align-items: center; }
.bandeau-saison {
  background: rgba(45,212,191,.10); border: 1px solid var(--carte-bord);
  border-radius: 10px; padding: 8px 11px; font-size: 13px; margin-bottom: 10px;
}
.sous-titre-info { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--texte2); font-size: 10.5px; }
.carte-achat.gamme-active { border-color: var(--accent); background: rgba(45,212,191,.10); }
.case-modale {
  display: flex; gap: 9px; align-items: center; font-size: 13.5px; color: var(--texte);
  background: rgba(0,0,0,.18); border: 1px solid var(--carte-bord); border-radius: 10px;
  padding: 10px 12px; margin: 4px 0 10px; cursor: pointer;
}
.case-modale input { accent-color: var(--accent); width: 16px; height: 16px; }



/* ═══════════ Responsive ═══════════ */
@media (max-width: 1020px) {
  #principal { grid-template-columns: 1fr; }
  #sidebar { position: static; max-height: none; min-height: 0; }
  #zoneBassins { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
  .flux { max-height: 300px; }
  .lobby-colonnes { grid-template-columns: 1fr; }
  .lobby-carte { padding: 22px 18px 14px; }
  .lobby-titre h1 { font-size: 36px; }
  #topbar { gap: 10px; }
  .tb-temps .barre-jour, .tb-niveau .barre-xp { width: 46px; }
}

/* ════════ ÉCRAN DE FAILLITE ════════ */
#ecranFaillite {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(8, 14, 18, 0.96);
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f8fafc;
  padding: 20px;
}
.faillite-boite {
  background: linear-gradient(135deg, rgba(40, 15, 15, 0.95), rgba(20, 8, 8, 0.98));
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 35px rgba(239, 68, 68, 0.2);
  border-radius: 18px;
  max-width: 540px;
  width: 100%;
  padding: 40px;
  text-align: center;
  animation: faillite-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes faillite-pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.faillite-boite h1 {
  color: #f87171;
  font-size: 28px;
  margin-top: 0;
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 2px 10px rgba(239, 68, 68, 0.3);
}
.faillite-boite p {
  font-size: 15px;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 22px;
}
.faillite-details {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 16px;
  font-size: 15px;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  line-height: 1.8;
}
.faillite-avertissement {
  font-size: 13px !important;
  color: #94a3b8 !important;
  font-style: italic;
  margin-top: 15px;
}
.btn-faillite {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: white !important;
  padding: 14px 28px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  border: 1px solid #f87171 !important;
  border-radius: 10px !important;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.4);
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-faillite:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.6);
  background: linear-gradient(135deg, #f87171, #ef4444) !important;
  border-color: #fca5a5 !important;
}
.btn-faillite:active {
  transform: translateY(0);
}

.separateur-eau {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-left: 2px dashed rgba(255, 255, 255, 0.35);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 5;
}

.select-premium {
  background-color: #0b3749 !important;
  color: #e8f4f4 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 6px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
  font-size: 14px;
}

.select-premium option {
  background-color: #06222e !important;
  color: #e8f4f4 !important;
}

/* Planification d'achat d'aliment */
.planif-aliment {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--carte-bord);
}
.planif-titre {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}
.planif-desc {
  font-size: 11px;
  color: var(--texte2);
  margin-bottom: 8px;
  line-height: 1.3;
}
.planif-controles {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.controle-ligne {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.controle-boutons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.controle-valeur {
  display: inline-block;
  min-width: 95px;
  text-align: center;
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE / TÉLÉPHONE — interface plein écran + navigation du bas
   (portrait, et paysage court pour les téléphones tenus à l'horizontale)
   ═══════════════════════════════════════════════════════════ */
#navmob { display: none; }
#menumob { display: none; }

@media (max-width: 760px), (orientation: landscape) and (max-height: 540px) {

  /* ---------- Topbar compacte : l'essentiel reste, le reste descend ---------- */
  #topbar { gap: 7px 9px; padding: 7px 10px 6px; }
  #topbar .tb-droite { display: none; }                 /* boutons → barre du bas / menu « Plus » */
  #tbStock, #tbCharges, #tbJoueurs { display: none; }   /* infos secondaires (lisibles dans les panneaux) */
  .tb-ferme .code-ferme { display: none; }
  #tbNomFerme { max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tb-groupe { gap: 5px; font-size: 13px; }
  #tbArgent { font-size: 15px; }
  .barre-jour, .barre-xp { width: 40px; }

  /* ---------- Une seule vue plein écran à la fois ---------- */
  #principal {
    display: block; max-width: none;
    padding: 10px 10px calc(74px + env(safe-area-inset-bottom));
  }
  #zoneBassins { grid-template-columns: 1fr; gap: 11px; }
  #sidebar {                                   /* caché par défaut : on est sur la vue Bassins */
    display: none; position: static; max-height: none; min-height: 0;
    border: none; background: transparent;
  }
  body.m-gerer #zoneBassins { display: none; }
  body.m-gerer #sidebar { display: flex; }
  #panneau { padding: 6px 2px 8px; overflow: visible; flex: none; }
  #onglets button { padding: 13px 2px; font-size: 12.5px; }
  #panneauChat { min-height: 62vh; }
  .flux { max-height: none; }

  /* ---------- Barre de navigation du bas (style appli native) ---------- */
  #navmob {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(5, 25, 33, 0.97); backdrop-filter: blur(10px);
    border-top: 1px solid var(--carte-bord);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #navmob button {
    flex: 1; background: none; border: none; color: var(--texte2);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 7px 2px 8px; font-size: 11px; min-height: 54px;
    transition: color .12s;
  }
  #navmob button.actif { color: var(--accent); font-weight: 600; }
  #navmob .nm-ico { font-size: 21px; line-height: 1; }

  /* ---------- Feuille « Plus » (bottom-sheet) ---------- */
  #menumob { display: block; position: fixed; inset: 0; z-index: 320; background: rgba(2, 14, 20, 0.6); }
  #menumob[hidden] { display: none; }
  .menumob-sheet {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: #0b3140; border-top: 1px solid var(--carte-bord);
    border-radius: 18px 18px 0 0; padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -16px 40px rgba(0,0,0,.5); animation: sheet-up .22s ease-out;
  }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .menumob-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  .menumob-tete b { font-size: 16px; }
  .menumob-item {
    display: block; width: 100%; text-align: left;
    background: rgba(255,255,255,0.05); border: 1px solid var(--carte-bord); color: var(--texte);
    border-radius: 12px; padding: 14px 15px; margin-bottom: 8px; font-size: 15px;
  }
  .menumob-item.danger { color: #fecaca; border-color: rgba(248,113,113,.5); }

  /* ---------- Modales en bottom-sheet ---------- */
  #voile { align-items: flex-end; padding: 0; }
  #modale {
    max-width: none; width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: sheet-up .22s ease-out;
  }

  /* ---------- Vue Terrain : barre d'outils tactile ---------- */
  #barre2d { left: 8px; right: 8px; max-width: none; gap: 6px; padding: 7px 9px; }
  #barre2d button[data-outil], #barre2d #btnConstruire2d { padding: 10px 13px; font-size: 13.5px; }
  #aide2d { display: none; }
  #popup2d { width: min(260px, calc(100vw - 20px)); }
  #construire2d { top: auto; left: 8px; right: 8px; width: auto; bottom: calc(66px + env(safe-area-inset-bottom)); }
  #zoom2d { right: 10px; bottom: calc(66px + env(safe-area-inset-bottom)); gap: 9px; }
  #zoom2d button { width: 48px; height: 48px; font-size: 25px; }
  #banniereVisite { left: 8px; right: 8px; transform: none; max-width: none; }

  /* ---------- Cibles tactiles plus généreuses ---------- */
  .btn { padding: 11px 15px; }
  .btn-mini { padding: 8px 12px; font-size: 13px; }
  .bassin-actions .btn { font-size: 13px; padding: 10px 11px; flex: 1 1 40%; }
  .carte-achat .actions .btn { flex: 1 1 auto; }
  #toasts { top: auto; left: 8px; right: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); max-width: none; }
  .toast { font-size: 14px; }

  /* ---------- Lobby ---------- */
  .lobby-carte { padding: 20px 15px 14px; border-radius: 18px; }
  .lobby-titre h1 { font-size: 33px; }
  .lobby-poissons span { font-size: 28px; }
  .lobby-bloc .btn-principal { padding: 14px; font-size: 16px; }
  /* 16px sur les champs = pas de zoom automatique gênant sur iOS */
  .champ input, .ligne-code input, #formChat input, #champPseudo { font-size: 16px; }
}

