/* PWA Android : ajout isole. Aucun changement au rendu PC ou au site mobile classique. */
.tot-pwa-bottom-nav { display: none !important; }
#tot-install-button[hidden] { display: none !important; }
#tot-install-button { display: block; margin: 18px auto 0; border: 1px solid #bf9a58; background: #263849; color: #f2e7cf; border-radius: 11px; padding: 12px 18px; font: 650 14px/1.3 system-ui,sans-serif; cursor: pointer; }
#tot-install-button:focus-visible { outline: 3px solid #f2d087; outline-offset: 2px; }
@media (max-width: 1199px), (hover: none) and (pointer: coarse) and (max-width: 1400px) {
  html.tot-pwa-standalone { --tot-pwa-nav-height: 65px; --tot-pwa-safe-bottom: env(safe-area-inset-bottom, 0px); }
  html.tot-pwa-standalone body { padding-bottom: calc(var(--tot-pwa-nav-height) + var(--tot-pwa-safe-bottom)); }
  html.tot-pwa-standalone .tot-pwa-bottom-nav {
    position: fixed; z-index: 2100; inset-inline: 0; bottom: 0;
    display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr));
    height: calc(var(--tot-pwa-nav-height) + var(--tot-pwa-safe-bottom));
    padding: 0 5px var(--tot-pwa-safe-bottom); box-sizing: border-box;
    background: #192532; border-top: 1px solid #344555;
    box-shadow: 0 -5px 18px rgba(0,0,0,.35);
    font-family: system-ui, sans-serif;
  }
  html.tot-pwa-standalone .tot-pwa-bottom-nav a {
    min-width: 0; min-height: 58px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px; padding: 6px 3px;
    text-decoration: none !important; color: #ced8e1 !important;
    font-size: 11px; font-weight: 600; line-height: 1.15;
    border-radius: 8px; border: 1px solid transparent;
  }
  html.tot-pwa-standalone .tot-pwa-bottom-nav a svg {
    width: 23px; height: 23px; flex: 0 0 auto; fill: none;
    stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  }
  html.tot-pwa-standalone .tot-pwa-bottom-nav a[aria-current="page"] {
    color: #f2d087 !important; background: #293a49; border-color: #48596a;
  }
  html.tot-pwa-standalone .tot-pwa-bottom-nav a:focus-visible { outline: 2px solid #e7bd74; outline-offset: -2px; }
  /* Le selecteur de Game ne doit pas etre recouvert par la navigation native. */
  html.tot-pwa-standalone #tot-game-picker {
    bottom: calc(var(--tot-pwa-nav-height) + var(--tot-pwa-safe-bottom) + 9px);
    z-index: 1600;
  }
  /* L'interface dashboard peut defiler jusqu'a la fin du bilan. */
  html.tot-pwa-standalone main { scroll-padding-bottom: calc(var(--tot-pwa-nav-height) + 16px); }
  html.tot-pwa-standalone #page { scroll-padding-bottom: calc(var(--tot-pwa-nav-height) + 16px); }
  /* Respect de la palette claire du dashboard, sans impacter la carte. */
  html.tot-pwa-standalone[data-theme="parchemin"] .tot-pwa-bottom-nav { background: #f9f3e5; border-color: #b5a17c; }
  html.tot-pwa-standalone[data-theme="parchemin"] .tot-pwa-bottom-nav a { color: #584633 !important; }
  html.tot-pwa-standalone[data-theme="parchemin"] .tot-pwa-bottom-nav a[aria-current="page"] { color: #392813 !important; background: #e9dcc0; border-color: #b5a17c; }
}

/* Carte PWA : pas de panneaux lateraux accessibles par swipe.
   Les classements restent disponibles dans l'onglet Classements.
   Ces styles sont strictement limites au mode application installee. */
html.tot-pwa-standalone #colonne-gauche {
  display: none !important;
}
html.tot-pwa-standalone #page {
  width: 100% !important;
  max-width: 100% !important;
}
html.tot-pwa-standalone #zone-carte {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin-inline: 0 !important;
}

/* Accueil : accès Strava distinct du mot de passe du Game. */
.tot-strava-access { width: min(100%, 390px); margin: 16px auto 12px; text-align: center;
  font: 14px/1.45 system-ui, sans-serif; color: #f0e9da; }
.tot-strava-separator { display: block; margin: 4px 0 12px; font-size: 13px;
  color: #cbbba2; }
.tot-strava-login { display: flex; align-items: center; justify-content: center;
  min-height: 45px; padding: 10px 16px; border-radius: 10px;
  background: #fc4c02; border: 1px solid #fe824f; color: #fff !important;
  box-sizing: border-box; font: 700 14px/1.25 system-ui, sans-serif;
  text-decoration: none !important; }
.tot-strava-login:hover, .tot-strava-login:focus-visible { background: #d83d00; }
.tot-strava-login:focus-visible { outline: 3px solid #fce0a0; outline-offset: 2px; }
.tot-strava-hint { color: #ccc3b7; font-size: 12px; margin: 8px 0 0; }
.tot-strava-status { color: #ede5d4; font-size: 13px; margin: 6px 0; }
.tot-strava-status strong { color: #f2d087; }
.tot-strava-message { background: #372423; color: #ffe4d5; border: 1px solid #ab655a;
  border-radius: 9px; padding: 10px 12px; margin-top: 12px; font-size: 13px; }

/* Le menu bas de l'application remplace l'accès Dashboard depuis la carte.
   Le lien reste visible dans le navigateur et sur PC. */
html.tot-pwa-standalone .tot-pwa-hide,
html.tot-pwa-standalone .tot-exploration-dashboard { display: none !important; }

/* Accueil connecté : accès aux parties et déconnexion, visibles PC et PWA. */
.tot-strava-connected { display:flex; flex-direction:column; align-items:stretch; gap:10px; }
.tot-strava-connected .tot-strava-status { margin:0 0 4px; }
.tot-strava-open, .tot-strava-logout { display:flex; box-sizing:border-box; align-items:center;
  justify-content:center; min-height:44px; padding:10px 16px; border-radius:10px;
  font:650 14px/1.25 system-ui,sans-serif; text-decoration:none !important; }
.tot-strava-open { background:#263c34; color:#fff5e7 !important; border:1px solid #6f9a84; }
.tot-strava-open:hover, .tot-strava-open:focus-visible { background:#355546; }
.tot-strava-logout { background:#283442; color:#ece1ce !important; border:1px solid #8c7662; }
.tot-strava-logout:hover, .tot-strava-logout:focus-visible { background:#374859; }
.tot-strava-open:focus-visible, .tot-strava-logout:focus-visible {
  outline:3px solid #f2d087; outline-offset:2px; }


/* Tablette : la carte reste visible intégralement au-dessus de la barre PWA. */
@media (max-width: 1199px), (hover: none) and (pointer: coarse) and (max-width: 1400px) {
  html.tot-pwa-standalone #page,
  html.tot-pwa-standalone #zone-carte {
    height:calc(100dvh - var(--tot-pwa-nav-height, 65px) - var(--tot-pwa-safe-bottom, 0px)) !important;
    min-height:0;
  }
  html.tot-pwa-standalone .tot-pwa-bottom-nav a {touch-action:manipulation;}
  html.tot-pwa-standalone #tot-game-picker {
    max-width:calc(100vw - 24px); 
  }
}

/* Menus Admin : les cinq colonnes tiennent sur les ecrans etroits. */
@media (max-width: 390px) {
  html.tot-pwa-standalone .tot-pwa-bottom-nav a {
    font-size: 10px; padding-inline: 1px; letter-spacing: -0.15px;
  }
  html.tot-pwa-standalone .tot-pwa-bottom-nav a svg {
    width: 21px; height: 21px;
  }
}

/* TOT-28 : déconnexion en POST — le bouton reprend le style du lien d'origine. */
:where(.tot-logout-form) { display: contents; }
:where(.tot-logout-form) > button { all: unset; cursor: pointer; box-sizing: border-box; }

/* Marque Strava (guidelines officielles) : bouton « Connect with Strava » et
   logo « Powered by Strava » non modifiés, plus discrets que le nom du jeu. */
.tot-strava-connect { display:inline-block; line-height:0; border-radius:6px; }
.tot-strava-connect:focus-visible { outline:3px solid #fce0a0; outline-offset:3px; }
.tot-strava-connect-img { display:block; width:237px; height:auto; max-width:100%; }
/* Audit CF-46 : logo à pleine opacité et lisible (pas d'altération du logo). */
.tot-powered-strava { display:block; width:auto; height:24px; max-width:100%; margin:10px auto 0; }

/* Messagerie interne : point rouge sur l'icône quand un message est non lu. */
.tot-messages-icone { position: relative; display: inline-flex; }
.tot-point-rouge { position: absolute; top: -2px; right: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e02424; box-shadow: 0 0 0 2px #192532; }
.tot-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Avec Messages, Réglages et Admin, la barre a jusqu'à 7 entrées : libellés plus courts. */
@media (max-width: 1199px), (hover: none) and (pointer: coarse) and (max-width: 1400px) {
  html.tot-pwa-standalone .tot-pwa-bottom-nav a span:not(.tot-sr):not(.tot-messages-icone):not(.tot-point-rouge) { font-size: 10px; letter-spacing: -.1px; }
  html.tot-pwa-standalone .tot-pwa-bottom-nav a { padding: 6px 1px; }
}

/* Lot 4 : préférence « réduire les animations » respectée partout. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Audit SCII-08 : « View on Strava » reste en gras et souligné (Brand
   Guidelines) ; l'orange #FC5200 n'atteint pas 4,5:1 sur les fonds clairs
   ni dans les popups blancs de la carte : la couleur du texte le remplace. */
html[data-theme="parchemin"], html[data-theme="clair"], .leaflet-popup-content {
  --tot-lien-strava: currentColor;
}
