* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: #f4f6f8; color: #1b1f24; }
header { background: #0d3b66; color: #fff; padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
header h1 { font-size: 1.15rem; margin: 0; }
#maj { font-size: .85rem; opacity: .85; }

/* Page pêcheur */
.pecheur main { max-width: 480px; margin: 0 auto; padding: 16px; }
.pecheur label { display: block; margin: 12px 0; font-weight: 600; }
.pecheur input { display: block; width: 100%; font-size: 1.2rem; padding: 10px; margin-top: 4px; border: 1px solid #b0b8c1; border-radius: 8px; }
.gros { display: block; width: 100%; font-size: 1.4rem; font-weight: 700; padding: 18px; margin: 16px 0; border: 0; border-radius: 12px; color: #fff; cursor: pointer; }
.gros small { font-size: .85rem; font-weight: 400; }
.vert { background: #2e7d32; }
.bleu { background: #0d3b66; }
.orange { background: #e65100; text-align: center; text-decoration: none; }
.rouge { background: #c62828; padding: 32px 18px; font-size: 2rem; touch-action: none; user-select: none; -webkit-user-select: none; }
.rouge.appui { background: #7f0000; transition: background 3s linear; }
.etat { padding: 8px 12px; border-radius: 8px; background: #e8ecf0; margin: 8px 0; }
.etat.ok { background: #e3f2e5; }
.etat.attente { background: #fff4d6; }
.etat.alerte { background: #fde3e3; }
.note { font-size: .9rem; color: #555; }
.signature { text-align: center; font-size: .75rem; color: #9aa3ad; padding: 16px 12px 24px; letter-spacing: .05em; }
.signature a { color: inherit; }

/* Pages Licence, Confidentialité et CGU */
.legal main { max-width: 680px; margin: 0 auto; padding: 16px; line-height: 1.55; }
.legal h2 { font-size: 1.05rem; margin: 20px 0 4px; }
.legal p { margin: 0 0 10px; }
.licence-texte { white-space: pre-line; }

/* Carte du village */
.village { height: 100vh; display: flex; flex-direction: column; }
#alertes:empty { display: none; }
.alerte { background: #fff; border-left: 6px solid; padding: 8px 12px; margin: 6px 12px 0; border-radius: 6px; font-size: .95rem; }
.disposition { flex: 1; display: flex; min-height: 0; }
#carte { flex: 1; min-height: 300px; }
aside { width: 340px; overflow-y: auto; background: #fff; border-left: 1px solid #dde2e7; }
#compteurs { padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid #dde2e7; }
.pastille { color: #fff; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.vide { color: #666; }
#liste { list-style: none; margin: 0; padding: 0; }
#liste li { padding: 10px 12px; border-bottom: 1px solid #eef1f4; cursor: pointer; font-size: .92rem; }
#liste li:hover { background: #f6f8fa; }
.ligne-titre { margin-bottom: 4px; }
.detail { color: #555; font-size: .85rem; }
#liste button { margin-top: 6px; font-size: .85rem; padding: 4px 10px; border: 1px solid #2e7d32; color: #2e7d32; background: #fff; border-radius: 6px; cursor: pointer; }
.marqueur { background: none; border: 0; }
.clignote svg { animation: clignote 1s infinite; }
@keyframes clignote { 50% { opacity: .2; } }
.etiquette { font-weight: 600; }
/* Téléphone (ou écran en hauteur) : la carte en haut, la liste en dessous,
   la liste ne prend que la place dont elle a besoin (au plus 45 % de l'écran). */
@media (max-width: 720px), (orientation: portrait) {
  .disposition { flex-direction: column; }
  #carte { flex: 1; min-height: 50vh; }
  /* La liste devient une feuille posée sur la carte, qu'on tire vers le haut (feuille.js). */
  aside { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; width: 100%; height: 45vh; max-height: none; border: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -4px 18px rgba(0,0,0,.25); transition: height .3s ease; }
  aside.glisse { transition: none; }
  aside.ouverte { border-radius: 0; }
}
.poignee { display: none; position: sticky; top: 0; z-index: 2; background: inherit; padding-top: 8px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
@media (max-width: 720px), (orientation: portrait) { .poignee { display: block; } }
.poignee .barre { display: block; width: 46px; height: 5px; border-radius: 3px; background: #b0bcc6; margin: 0 auto; }
.bandeau-mer { position: relative; height: 48px; overflow: hidden; flex: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='40'%3E%3Cpath d='M0 32 q16 -8 32 0 t32 0 V40 H0 Z' fill='%230f4fa0'/%3E%3Cpath d='M0 32 q16 -8 32 0 t32 0' stroke='%2381d4fa' stroke-width='2.5' fill='none'/%3E%3C/svg%3E") repeat-x 0 8px / 64px 40px, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='40'%3E%3Cpath d='M0 22 q12 -9 24 0 t24 0 V40 H0 Z' fill='%231565c0'/%3E%3Cpath d='M0 22 q12 -9 24 0 t24 0' stroke='%234fc3f7' stroke-width='2.5' fill='none'/%3E%3C/svg%3E") repeat-x 0 8px / 48px 40px, #0d3b66; animation: vagues-bandeau 6s linear infinite; }
@keyframes vagues-bandeau { to { background-position: -64px 8px, 48px 8px, 0 0; } }
.bandeau-mer .bateau { position: absolute; bottom: 4px; left: 0; width: 76px; height: 46px; animation: traverse 40s linear -14s infinite; }
.bandeau-mer .bateau svg { display: block; width: 100%; height: 100%; }
.bandeau-mer .bateau rect, .bandeau-mer .bateau .soleil, .bandeau-mer .bateau [class^="vague"] { display: none; }
@keyframes traverse { from { transform: translateX(-80px); } to { transform: translateX(100vw); } }
@media (prefers-reduced-motion: reduce) { .bandeau-mer, .bandeau-mer .bateau { animation: none; } .bandeau-mer .bateau { left: 20px; } }
#liste li { animation: apparait .45s ease both; }
@keyframes apparait { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { #liste li { animation: none; } }
.encadre { margin-top: 24px; padding: 10px 14px; border: 1px solid #cfd8e0; border-radius: 10px; background: #f6f9fb; }
.encadre summary { cursor: pointer; font-weight: 600; }
.encadre ol { padding-left: 20px; }
.encadre li { margin: 6px 0; }
.encadre code { word-break: break-all; background: #e8ecf0; padding: 1px 4px; border-radius: 4px; }
.petit { display: block; margin-top: 6px; font: inherit; font-size: .85rem; background: none; border: 1px solid #9fb3c0; border-radius: 6px; padding: 4px 8px; color: inherit; cursor: pointer; }
#rentres summary { padding: 10px 12px; cursor: pointer; font-weight: 600; color: #2e7d32; border-bottom: 1px solid #eef1f4; }
#liste-rentres { list-style: none; margin: 0; padding: 0; opacity: .8; }
#liste-rentres li { padding: 10px 12px; border-bottom: 1px solid #eef1f4; font-size: .92rem; }
#liste li.vide { color: #666; cursor: default; }
/* Police calligraphique de la Bismillah, incluse dans l'appli (Amiri, licence OFL) pour s'afficher pareil partout, même sans réseau. */
@font-face { font-family: "Bismillah"; src: url("polices/bismillah.woff2") format("woff2"); font-weight: 700; font-display: swap; }
.bismillah { display: block; font-family: "Bismillah", "Noto Naskh Arabic", serif; font-size: 1.8rem; font-weight: 700; line-height: 1.9; margin-bottom: 0; }
@font-face { font-family: "Alhamdulillah"; src: url("polices/alhamdulillah.woff2") format("woff2"); font-weight: 700; font-display: swap; }
.alhamdulillah { font-family: "Alhamdulillah", "Bismillah", serif; }
.km-haut { display: block; font-weight: 800; letter-spacing: .03em; margin-bottom: 2px; }
.shikomori { display: block; font-size: inherit; font-weight: inherit; margin-top: 2px; }
.lien-entete { color: #fff; font-size: .9rem; font-weight: 600; border: 1px solid rgba(255,255,255,.5); border-radius: 6px; padding: 3px 10px; text-decoration: none; margin-right: 8px; }
button.lien-entete { background: none; cursor: pointer; font-family: inherit; }
.entete-droite { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.choix-jour { padding: 10px 12px; border-bottom: 1px solid #eef1f4; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.choix-jour input { font: inherit; padding: 4px 6px; }
.choix-jour button { font: inherit; padding: 4px 10px; border: 1px solid #9fb3c0; border-radius: 6px; background: #fff; cursor: pointer; }
.distance { font-weight: 600; color: #0d3b66; margin: 2px 0; }
.meteo { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; margin: 12px 0; border-radius: 12px; border: 3px solid; font-size: 1.05rem; }
.meteo strong { font-size: 1.4rem; }
.meteo small { font-size: .8rem; opacity: .8; }
.meteo.vert { background: #e8f5e9; border-color: #2e7d32; color: #1b5e20; }
.meteo.orange { background: #fff3e0; border-color: #ef6c00; color: #8a3c00; }
.meteo.rouge { background: #ffebee; border-color: #c62828; color: #8e0000; }
.aide-install { background: #fff8e1; border: 2px solid #f9a825; border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; font-size: 1rem; color: #1b1f24; }
.village > .aide-install { margin: 8px 12px; }
.meteo[hidden], .aide-install[hidden] { display: none; }

/* Mode sombre : suit le réglage du téléphone. Les gros boutons (SOS, Je pars, COSEP) gardent leurs couleurs. */
@media (prefers-color-scheme: dark) {
  body { background: #11161c; color: #e6e9ed; }
  .pecheur input, .choix-jour input { background: #1c232b; color: #e6e9ed; border-color: #3a4552; }
  .etat { background: #1f2730; }
  .etat.ok { background: #183222; }
  .etat.attente { background: #3a3013; }
  .etat.alerte { background: #431c1c; }
  .note, .detail { color: #aab3bd; }
  .vide, #liste li.vide { color: #9aa3ad; }
  .signature { color: #7d8792; }
  .alerte { background: #1c232b; }
  aside { background: #161c22; border-color: #2a333d; }
  #compteurs, #liste li, #rentres summary, #liste-rentres li, .choix-jour { border-color: #2a333d; }
  #liste li:hover { background: #1f2730; }
  #liste button, .choix-jour button { background: #1c232b; }
  #liste button { color: #81c784; border-color: #81c784; }
  #rentres summary { color: #81c784; }
  .encadre { background: #182029; border-color: #2a333d; }
  .encadre code { background: #24303b; }
  .choix-jour button { color: #e6e9ed; border-color: #3a4552; }
  .distance { color: #90caf9; }
  .meteo.vert { background: #142a18; color: #a5d6a7; border-color: #43a047; }
  .meteo.orange { background: #33210d; color: #ffcc80; border-color: #fb8c00; }
  .meteo.rouge { background: #3a1414; color: #ef9a9a; border-color: #e53935; }
  .aide-install { background: #33290f; color: #f1e3b5; }
  .leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #1c232b; color: #e6e9ed; }
}
/* Message affiché à la place du bouton « Installer » dans l'appli Android. */
.message-apk { margin: 16px 0; padding: 14px 16px; border-radius: 12px; background: #e3edf7; color: #0d3b66; border: 2px solid #0d3b66; text-align: center; font-size: 1.3rem; font-weight: 700; }
.entete-droite .message-apk { margin: 0 8px 0 0; padding: 2px 10px; font-size: .9rem; background: none; color: #fff; border-color: rgba(255,255,255,.5); }
@media (prefers-color-scheme: dark) { .message-apk { background: #14273a; color: #cfe3f7; border-color: #3d6a99; } }
/* Page « Installer l'appli » (tuto à partager) */
.tuto main { max-width: 520px; margin: 0 auto; padding: 16px; }
.tuto-titre { display: flex; gap: 14px; align-items: center; margin: 4px 0 18px; font-size: 1.05rem; }
.tuto-titre img { border-radius: 16px; }
.etape { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid #dde2e7; border-radius: 14px; padding: 14px; margin: 12px 0; font-size: 1.1rem; line-height: 1.45; }
.etape > div { flex: 1; min-width: 0; }
.etape .num { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #0d3b66; color: #fff; font-weight: 800; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; }
.etape .gros { text-align: center; text-decoration: none; margin: 12px 0 0; font-size: 1.3rem; }
@media (prefers-color-scheme: dark) { .etape { background: #1c232b; border-color: #2a333d; } }

/* Écran d'ouverture : galawa qui tangue doucement */
#accueil { position: fixed; inset: 0; z-index: 9999; background: #0d3b66; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; transition: opacity .7s; cursor: pointer; }
#accueil.fin { opacity: 0; pointer-events: none; }
#accueil svg { width: min(78vw, 60vh, 420px); height: auto; border-radius: 24px; }
#accueil .accueil-titre { font-size: 1.25rem; white-space: nowrap; font-weight: 700; margin: 18px 16px 4px; text-align: center; }
#accueil .accueil-sig { font-size: .75rem; opacity: .6; margin: 0; letter-spacing: .1em; }
.scene-galawa .galawa { transform-box: view-box; transform-origin: 50% 60%; animation: tangue 3.2s ease-in-out infinite alternate; }
.scene-galawa .vague-loin { animation: glisse12 6s linear infinite; }
.scene-galawa .vague-pres { animation: glisse16 4s linear infinite; }
.scene-galawa .vague-bas { animation: glisse14 5s linear infinite reverse; }
@keyframes tangue { from { transform: rotate(-7deg) translateY(1px); } to { transform: rotate(-2deg) translateY(-2px); } }
@keyframes glisse12 { from { transform: translateX(0); } to { transform: translateX(12px); } }
@keyframes glisse16 { from { transform: translateX(0); } to { transform: translateX(16px); } }
@keyframes glisse14 { from { transform: translateX(0); } to { transform: translateX(14px); } }
/* Case météo : la même scène en bandeau ; elle bouge plus fort quand la mer est mauvaise. */
.meteo-scene { margin: -14px -16px 6px; height: 110px; overflow: hidden; border-radius: 9px 9px 0 0; }
.meteo-scene .soleil { display: none; }
.meteo-scene svg { display: block; width: 100%; height: 100%; border-radius: 0; }
.meteo.orange .galawa { animation: tangue-fort 2s ease-in-out infinite alternate; }
.meteo.orange .vague-pres { animation-duration: 2.4s; }
.meteo.orange .vague-loin { animation-duration: 3.6s; }
.meteo.rouge .galawa { animation: tangue-tempete 1.1s ease-in-out infinite alternate; }
.meteo.rouge .vague-pres { animation-duration: 1.3s; }
.meteo.rouge .vague-loin { animation-duration: 2s; }
.meteo.rouge .vague-bas { animation-duration: 1.6s; }
@keyframes tangue-fort { from { transform: rotate(-11deg) translateY(2px); } to { transform: rotate(3deg) translateY(-3px); } }
@keyframes tangue-tempete { from { transform: rotate(-16deg) translateY(4px); } to { transform: rotate(9deg) translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .scene-galawa .galawa, .scene-galawa [class^="vague"] { animation: none !important; } }
