:root {
  --primary-color: #ff3333;
  --secondary-color: #1a1a1a;
  --background-dark: #0a0a0a;
  --text-color: #e0e0e0;
  --text-muted: #999999;
  --border-color: #333333;
  --input-background: #2a2a2a;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --spacing-unit: 1.5rem;
}

html, body {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  overflow: hidden !important;
  height: 100% !important;
  width: 100% !important;
}

::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

body {
  font-family: 'Onest', sans-serif;
  background: linear-gradient(135deg, var(--background-dark) 0%, #151515 100%);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  position: relative;
}

/* Fond : un halo rouge derrière le titre, un autre derrière la carte, et une
   trame de points qui s'efface vers les bords. */
body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

body::before {
    background:
      radial-gradient(620px 420px at 22% 38%, rgba(255, 51, 51, 0.10), transparent 70%),
      radial-gradient(520px 520px at 76% 52%, rgba(255, 51, 51, 0.08), transparent 70%);
}

body::after {
    background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 20%, transparent 75%);
}

#loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--background-dark);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999999;
}

#loader-overlay.is-visible {
  display: flex;
}

.is-hidden {
  display: none !important;
}

.progress-bar.is-loaded {
  width: 100%;
}

.loader-logo-container {
  margin-bottom: 25px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: pulseLogo var(--loader-pulse-duration, 0.85s) infinite ease-in-out;
}

@keyframes pulseLogo {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.progress-container {
  width: 200px;
  height: 4px;
  background: #151515;
  border: 1px solid #222;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 4px;
  transition: width var(--loader-progress-duration, 0.18s) ease;
}

.container-auth {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 1rem var(--spacing-unit) var(--spacing-unit);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  margin-bottom: auto;
  overflow: visible;
}

.remembered-account-banner {
  width: 100%;
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid rgba(255, 68, 75, 0.38);
  border-radius: 16px;
  background: rgba(24, 20, 21, 0.88);
  color: var(--text-color);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34), 0 0 24px rgba(255, 51, 51, 0.08);
  backdrop-filter: blur(18px);
  text-align: left;
  transform: none;
}

.remembered-account-banner:hover {
  background: rgba(34, 25, 26, 0.96);
  border-color: rgba(255, 76, 82, 0.72);
  transform: translateY(-2px);
}

.remembered-account-banner:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 3px;
}

.remembered-account-banner.is-loading {
  opacity: 0.68;
  pointer-events: none;
}

.remembered-account-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #ff4d52, #d91f27);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(255, 51, 51, 0.25);
}

.remembered-account-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.remembered-account-title {
  overflow: hidden;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remembered-account-subtitle {
  color: #999;
  font-size: 0.74rem;
  font-weight: 400;
}

.remembered-account-arrow {
  color: var(--primary-color);
  font-size: 1.15rem;
  text-align: center;
  transition: transform 0.2s ease;
}

.remembered-account-banner:hover .remembered-account-arrow {
  transform: translateX(3px);
}

.auth-box {
  background-color: rgba(21, 21, 21, 0.75);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
  text-align: center;
  margin-bottom: 1.5rem;
}

.logo {
  font-family: 'Onest', sans-serif;
  font-weight: 900;
  font-size: 2.5rem;
  color: var(--primary-color);
  letter-spacing: -1px;
  margin-bottom: 2rem;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(255, 51, 51, 0.2);
}

h1,
h2 {
  font-weight: 600;
  margin-bottom: 2rem;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
}

input {
  width: 100%;
  padding: 1rem;
  margin-bottom: 1.2rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  background-color: var(--input-background);
  color: var(--text-color);
  font-family: 'Onest', sans-serif;
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: all 0.3s ease;
  color-scheme: dark;
}

input[type="date"] {
  color: var(--text-color);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.72);
  cursor: pointer;
}

input:focus {
  border-color: var(--primary-color);
  outline: none;
  background-color: #2e2e2e;
  box-shadow: 0 0 15px rgba(255, 51, 51, 0.15);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-color) !important;
  caret-color: var(--text-color);
  border-color: var(--border-color);
  box-shadow: 0 0 0 1000px var(--input-background) inset !important;
  -webkit-box-shadow: 0 0 0 1000px var(--input-background) inset !important;
  transition: background-color 9999s ease-out, color 9999s ease-out;
}

button {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #ff4d4d, #d91f27);
  color: white;
  border: none;
  border-radius: var(--border-radius-md);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 51, 51, 0.24);
  transition: 0.3s ease;
  margin-top: 0.5rem;
}

button:hover {
  background-color: #e62e2e;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(255, 51, 51, 0.3);
}

.link-auth {
  display: block;
  margin-top: 1.5rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.link-auth:hover {
  text-decoration: underline;
}

.link-forgot {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.3s;
    opacity: 0.9;
}

.link-forgot:hover {
    opacity: 1;
    text-decoration: underline;
    transform: translateY(-1px);
}

/* En-tête : retour + logo à gauche, langue à droite, comme l'accueil. */
.auth-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: 84px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.floating-back-arrow {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: #d9d9df;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.floating-back-arrow svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.floating-back-arrow:hover {
    border-color: rgba(255, 51, 51, 0.45);
    background: rgba(255, 51, 51, 0.1);
    color: #fff;
}

html[dir="rtl"] .floating-back-arrow svg {
    transform: scaleX(-1);
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: #d9d9df;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: -0.04em;
}

.auth-logo img {
    display: block;
    border-radius: 9px;
}

.auth-logo strong {
    color: #fff;
    font-weight: 760;
}

.auth-lang-switcher {
    margin-inline-start: auto;
}

.registration-age-notice {
  margin: -0.55rem 0 1rem;
  color: #a9a9b2;
  font-size: 0.76rem;
  line-height: 1.45;
  text-align: left;
}

.registration-legal-consent {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 0.7rem;
  align-items: start;
  margin: 0 0 0.65rem;
  color: #bebec6;
  font-size: 0.76rem;
  line-height: 1.5;
  text-align: left;
}

.registration-legal-consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0.1rem 0 0;
  accent-color: var(--primary-color);
}

.registration-legal-consent a {
  color: var(--primary-color);
  text-underline-offset: 2px;
}

/* ---- Marque "B" du chargement (voir interface.css pour le detail) ----
   L'ancien /faviconUrl.ico etait une image matricielle etiree, donc floue.
   L'animation est ici et non dans le SVG : la CSP interdit 'unsafe-inline'
   pour style-src. */
.app-loader-mark {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.app-loader-mark-trace {
    stroke-dasharray: 420;
    stroke-dashoffset: 420;
    animation: loaderMarkTrace var(--loader-trace-duration, 1.7s) ease-in-out infinite;
}

@keyframes loaderMarkTrace {
    0%   { stroke-dashoffset: 420; opacity: .35; }
    45%  { stroke-dashoffset: 0;   opacity: 1; }
    70%  { stroke-dashoffset: 0;   opacity: 1; }
    100% { stroke-dashoffset: -420; opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
    .app-loader-mark-trace { animation: none; stroke-dashoffset: 0; }
}

/* ==========================================================================
   Refonte 2026 : deux colonnes sur ordinateur (présentation + formulaire),
   une seule carte sur mobile. Même logique que l'écran de l'app native :
   sélecteur Connexion / Inscription, lien « Mot de passe oublié ? » sous le
   mot de passe, bouton pour afficher le mot de passe, erreurs sous le champ.
   ========================================================================== */

.auth-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1120px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 96px 32px 48px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 420px);
  align-items: center;
  gap: 72px;
}

.auth-card-brand span {
  color: var(--primary-color);
}

/* Petite ligne de marque au-dessus du titre, reprise de l'accueil. */
.auth-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 24px;
  color: #bcbcc4;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
}

.status-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #91d3ac;
  box-shadow: 0 0 0 4px rgba(145, 211, 172, 0.12);
}

.auth-hero-title {
  margin: 0 0 18px;
  max-width: 560px;
  font-size: clamp(2.4rem, 4.4vw, 3.6rem);
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -2px;
  color: #fff;
  text-wrap: balance;
}

.auth-hero-subtitle {
  margin: 0 0 32px;
  max-width: 440px;
  color: #a7a7b1;
  font-size: 1.05rem;
  line-height: 1.6;
}

.auth-hero-features {
  list-style: none;
  margin: 0 0 34px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 480px;
}

.auth-hero-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(20, 20, 22, 0.7);
  color: #e6e6ea;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.auth-hero-features li:hover {
  border-color: rgba(255, 51, 51, 0.3);
  background: rgba(28, 20, 21, 0.8);
}

.auth-feature-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 51, 51, 0.1);
  color: var(--accent-red-bright, #ff4d55);
}

.auth-feature-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Badge Google Play + nombre de langues, séparés par un trait. */
.auth-hero-platforms {
  display: flex;
  align-items: center;
  gap: 20px;
}

.auth-hero-languages {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline-start: 20px;
  border-inline-start: 1px solid rgba(255, 255, 255, 0.12);
  color: #8d8d97;
  font-size: 0.82rem;
  font-weight: 600;
}

.auth-hero-languages svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.auth-play-badge {
  display: inline-flex;
  border-radius: 9px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-play-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.auth-play-badge svg {
  display: block;
  height: 44px;
  width: auto;
}

/* --- Carte du formulaire --- */

.container-auth {
  max-width: none;
  padding: 0;
  margin: 0;
}

.auth-card {
  position: relative;
  width: 100%;
  padding: 30px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(24, 24, 27, 0.92), rgba(16, 16, 18, 0.92));
  backdrop-filter: blur(20px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Fin trait rouge en haut de la carte. */
.auth-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 77, 85, 0.85), transparent);
}

.auth-card-brand {
  display: none;
  margin: 0 0 20px;
  text-align: center;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: #fff;
}

.auth-box {
  background: none;
  backdrop-filter: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
  text-align: left;
}

.auth-box h2 {
  margin: 0 0 18px;
  font-size: 1.25rem;
  text-align: center;
}

.remembered-account-banner {
  margin: 0;
  box-shadow: none;
  font-size: inherit;
}

.remembered-account-banner:hover {
  transform: none;
  box-shadow: none;
}

/* Trait « ou » entre la session mémorisée et le formulaire. */
.auth-divider {
  display: none;
  height: 1px;
  margin: 18px 0;
  background: linear-gradient(90deg, transparent, #34343d, transparent);
}

.remembered-account-banner:not(.is-hidden) + .auth-divider {
  display: block;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 20px;
  padding: 4px;
  border-radius: 14px;
  background: #1b1b21;
}

.auth-switch .auth-switch-btn {
  margin: 0;
  padding: 0.7rem 0.5rem;
  border-radius: 11px;
  background: transparent;
  box-shadow: none;
  color: #9a9aa4;
  font-size: 0.92rem;
  font-weight: 600;
}

.auth-switch .auth-switch-btn:hover {
  transform: none;
  box-shadow: none;
  color: #e6e6ea;
  background: transparent;
}

.auth-switch .auth-switch-btn.active {
  background: #26262e;
  color: #fff;
}

.auth-card.is-2fa .auth-switch {
  display: none;
}

.auth-card input:not([type="checkbox"]) {
  margin-bottom: 12px;
  padding: 0.95rem 1rem;
  border-color: #2a2a31;
  background-color: #1b1b21;
  font-size: 0.95rem;
}

.auth-card input:not([type="checkbox"]):focus {
  border-color: var(--primary-color);
  background-color: #1e1e25;
  box-shadow: 0 0 0 3px rgba(255, 51, 71, 0.14);
}

.auth-card input.is-invalid {
  border-color: #ff7a86;
}

.password-field {
  position: relative;
}

.password-field input:not([type="checkbox"]) {
  padding-right: 3.2rem;
}

.password-field .password-toggle {
  position: absolute;
  top: 0;
  right: 4px;
  width: 44px;
  height: calc(100% - 12px);
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: none;
  box-shadow: none;
  color: #9a9aa4;
}

.password-field .password-toggle:hover {
  transform: none;
  box-shadow: none;
  background: none;
  color: #fff;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle.is-revealed {
  color: var(--primary-color);
}

.field-error {
  margin: -6px 0 12px 4px;
  color: #ffa6af;
  font-size: 0.78rem;
}

.auth-card .link-forgot {
  display: block;
  margin: -2px 0 16px auto;
  width: fit-content;
  font-size: 0.85rem;
  font-weight: 600;
}

.auth-card .link-forgot:hover {
  transform: none;
}

.auth-box button[type="submit"] {
  margin-top: 4px;
  border-radius: 14px;
  font-size: 1rem;
}

.auth-box button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: progress;
}

.auth-box .link-auth {
  margin-top: 16px;
  text-align: center;
}

@media (max-width: 900px) {
  .auth-header {
    padding: 0 20px;
  }

  .auth-layout {
    grid-template-columns: minmax(0, 440px);
    justify-content: center;
    gap: 0;
    padding: 108px 20px 40px;
  }

  .auth-hero {
    display: none;
  }
}

@media (max-width: 480px) {
  .auth-header {
    height: 68px;
    padding: 0 16px;
    gap: 10px;
  }

  .auth-logo {
    font-size: 1.1rem;
  }

  .auth-logo img {
    width: 28px;
    height: 28px;
  }

  .auth-layout {
    padding: 88px 16px 32px;
  }

  .auth-card {
    padding: 22px 18px;
  }
}

/* Sur un très petit écran, le logo seul suffit à côté de la langue. */
@media (max-width: 360px) {
  .auth-logo span {
    display: none;
  }
}

/* Pages à une seule carte (récupération de compte) : même carte, centrée. */
.auth-layout-single {
  grid-template-columns: minmax(0, 440px);
  justify-content: center;
  gap: 0;
}

.auth-description {
  margin: -8px 0 18px;
  color: #a9a9b2;
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: center;
}

/* Les champs et boutons suivent la police du site (Onest). */
:where(button, input, select, textarea) { font-family: inherit; }
