:root { color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #000; }
body { color: #c5ad7c; font-family: Georgia, serif; }

/* Le formulaire reste dans le flux : erreurs et clavier ne le font pas
   déborder sur le bouton Strava, même sur un écran peu haut. */
.accueil {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-height: 100svh;
  min-height: 100dvh;
  padding: 12px 22px max(12px, env(safe-area-inset-bottom, 0px));
}
/* Décision du 2026-11-09 : l'image est dans le flux et prend la place restante ;
   les panneaux passent dessous, jamais par-dessus le titre. */
.accueil-visuel {
  flex: 1 1 0;
  min-height: 160px;
  width: 100%;
  max-width: 720px;
  object-fit: contain;
  object-position: center bottom;
}
.accueil > :not(.accueil-visuel) { flex: none; }

/* Accès principal : libellé lisible, champ contrasté et bouton pleine largeur. */
.access-form {
  flex: none;
  width: min(460px, 100%);
  margin: 0;
  padding: 22px;
  border: 1px solid #987d49;
  border-radius: 19px;
  background: rgb(5 5 5 / 90%);
  box-shadow: 0 10px 35px #000b, inset 0 1px 0 #e7c78926;
}
.access-label {
  display: block;
  color: #f3dfb0;
  font: bold 22px/1.25 Georgia, serif;
  text-align: center;
}
.access-hint {
  margin: 8px 0 18px;
  color: #c5b698;
  font: 14px/1.4 system-ui, sans-serif;
  text-align: center;
}
.password-field {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 17px;
  min-height: 60px;
  border: 2px solid #d0b373;
  border-radius: 12px;
  background: #11100d;
}
.password-field:focus-within { outline: 2px solid #f3dca5; outline-offset: 4px; }
.password-field svg { width: 19px; height: 23px; flex: none; fill: currentColor; }
.password-field input {
  width: 100%; min-width: 0; border: 0; outline: none; background: transparent;
  color: #f7e7c7; font: 18px Georgia, serif; padding: 16px 0;
}
.password-field input::placeholder { color: #c5ad7c; opacity: 1; }
/* Connexion par mot de passe (2026-11-13) : trois champs, libellés visibles. */
.access-form .access-label { margin: 0; }
.access-field-label { display: block; margin: 14px 0 6px; color: #f3dfb0; font: 600 15px/1.3 system-ui, sans-serif; }
.access-form .password-field { min-height: 54px; }
.access-form .password-field input { padding: 13px 0; }
.access-hint-bas { margin: 14px 0 0; }
.access-form #access-error { margin: 10px 0 4px; color: #ffd2b8; font-weight: 600; }
.access-strava .access-hint a { color: #f2d087; }
.access-strava-bouton { margin: 4px 0 10px; text-align: center; }
.access-strava-bouton img { display: inline-block; width: 237px; height: 48px; }
#access-error { margin: 14px 0 0; color: #f0c6ac; font: 14px/1.5 system-ui, sans-serif; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.access-submit {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; margin-top: 12px; min-height: 52px; padding: 12px;
  border: 1px solid #e3c488; border-radius: 12px;
  background: linear-gradient(180deg, #73582e 0%, #3c2b15 100%);
  color: #fff0c9; font: bold 17px/1.3 Georgia, serif; letter-spacing: .03em;
  text-shadow: 0 1px 2px #000; cursor: pointer;
  box-shadow: inset 0 1px 0 #ffffff24, 0 4px 14px #0009;
  touch-action: manipulation;
  transition: background .2s, transform .2s, border-color .2s;
}
.access-submit:hover { background: linear-gradient(180deg, #89703e, #4d371a); border-color: #ffe3a6; }
.access-submit:active { transform: translateY(1px); }
.access-submit:focus-visible { outline: 2px solid #f0d49a; outline-offset: 3px; }
.access-submit span { font-size: 21px; }

/* Accès secondaire en bas à droite. Ces sélecteurs priment sur pwa.css,
   chargé ensuite, sans changer ses boutons sur les autres vues. */
.accueil .tot-strava-secondary {
  position: absolute;
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  width: auto;
  max-width: calc(100% - 32px);
  margin: 0;
  text-align: right;
  z-index: 2;
}
.accueil .tot-strava-secondary .tot-strava-login {
  width: auto;
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid #a95d3b;
  border-radius: 8px;
  background: #542a18;
  color: #fff1e7 !important;
  font: 600 12px/1.25 system-ui, sans-serif;
  touch-action: manipulation;
}
.accueil .tot-strava-secondary .tot-strava-login:hover,
.accueil .tot-strava-secondary .tot-strava-login:focus-visible { background: #74371b; border-color: #e08455; }

/* Connecté ou non : texte et boutons dans un panneau sombre lisible. */
.accueil .tot-strava-panneau,
.accueil .tot-strava-connected {
  flex: none;
  width: min(460px, 100%);
  margin: 0;
  padding: 22px;
  border: 1px solid #987d49;
  border-radius: 19px;
  background: rgb(5 5 5 / 90%);
}
.accueil .tot-strava-message { flex: none; width: min(460px, 100%); margin: 0; }
.accueil #tot-install-ios {
  flex: none; width: min(460px, 100%); margin: 0; padding: 10px 14px;
  border: 1px solid #68604f; border-radius: 10px; background: #161b20;
  color: #d5c9b0; font: 12px/1.45 system-ui, sans-serif; text-align: center;
}
.accueil #tot-install-button {
  flex: none; width: min(460px, 100%); margin: 0; padding: 10px 14px;
  min-height: 44px; background: #161b20; border-color: #68604f;
  color: #d5c9b0; font-size: 12px;
}

/* Écran en largeur (ordinateur, tablette couchée) : l'image est réduite et
   calée en haut pour que le titre reste au-dessus des panneaux. */
@media (max-width: 540px) {
  /* Place pour le bloc Strava en bas (texte sur 3 lignes + bouton officiel de 48 px). */
  .accueil { padding-inline: 16px; gap: 10px; }
  .access-form, .accueil .tot-strava-panneau, .accueil .tot-strava-connected { padding: 16px; }
  .access-label { font-size: 20px; }
  .password-field { padding-inline: 13px; gap: 11px; }
  .password-field input { font-size: 17px; }
  .access-submit { font-size: 16px; letter-spacing: 0; }
  .accueil .tot-strava-secondary { right: max(16px, env(safe-area-inset-right, 0px)); }
  .accueil nav { padding: 4px 16px 0 !important; }
}
@media (max-width: 700px), (pointer: coarse) {
  .accueil .tot-strava-secondary .tot-strava-login { min-height: 44px; }
}

/* Le panneau reste au-dessus de la navigation de l'application installée,
   avec les mêmes seuils mobile/tablette que pwa.css. */
@media (max-width: 1199px), (hover: none) and (pointer: coarse) and (max-width: 1400px) {
  html.tot-pwa-standalone .accueil {
    min-height: calc(100svh - var(--tot-pwa-nav-height, 65px) - var(--tot-pwa-safe-bottom, 0px));
    min-height: calc(100dvh - var(--tot-pwa-nav-height, 65px) - var(--tot-pwa-safe-bottom, 0px));
  }
}

.accueil .tot-strava-panneau .tot-strava-hint { font-size: 13px; line-height: 1.5; margin: 0 0 12px; color: #e3d9c6; }
.accueil .tot-strava-panneau .tot-strava-hint a { color: #f2d087; }

/* Audit SCII-02 : l'accueil explique le jeu avant le bouton de connexion. */
.accueil .tot-strava-panneau .accueil-titre { margin: 0 0 6px; font-size: 22px; line-height: 1.2; color: #f2d087; }
.accueil .tot-strava-panneau .accueil-accroche { margin: 0 0 10px; font-size: 16px; line-height: 1.45; color: #f4ecdc; }
.accueil .tot-strava-panneau .accueil-etapes { margin: 0 0 10px; padding-left: 22px; font-size: 15px; line-height: 1.5; color: #f4ecdc; }
.accueil .tot-strava-panneau .accueil-inscription { margin: 0 0 14px; font-size: 15px; line-height: 1.45; color: #e3d9c6; }
.accueil .tot-strava-panneau .tot-strava-hint { margin: 12px 0 0; }

/* Revue du 2026-11-13 : « Afficher le mot de passe » (SCII-92), champ
   identifiant masqué pour les gestionnaires (IOS-35), message hors ligne (IOS-38). */
.password-field .afficher-mdp { flex: 0 0 auto; min-height: 40px; margin-left: 6px; padding: 4px 10px; border-radius: 8px;
  border: 1px solid rgba(242, 208, 135, .6); background: transparent; color: #f2d087; font: 600 14px/1.2 system-ui, sans-serif; cursor: pointer; }
.password-field .afficher-mdp:focus-visible { outline: 3px solid #fce0a0; outline-offset: 2px; }
.visuellement-masque { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tot-hors-ligne { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: #5a1d14; color: #ffe3dc; }
.tot-installee { display: none; }
@media (display-mode: standalone) { .tot-installee { display: block; } }
.access-form .access-hint a { color: #f2d087; }
