/* ==========================================================================
   Paramètres du compte (compte.html) : feuille autonome, classes .st-*.
   Identité du site : encre, crème, un seul accent (corail), Manrope (voir css/brand-hv2.css).
   N'utilise rien de auth.css : les anciennes règles .settings-* ne s'appliquent plus à cette page.
   Contrastes visés : texte >= 4.5:1, bordures de champs >= 3:1.
   ========================================================================== */

.compte-page {
  --st-ink: #14141a;
  --st-muted: #4a4a52; /* 8.9:1 sur blanc, 7.9:1 sur la crème */
  --st-canvas: #f7f2ea;
  --st-paper: #ffffff;
  --st-line: #ddd3bb; /* contour des groupes */
  --st-line-soft: #efe8d8; /* filets entre les lignes */
  --st-field: #8d8570; /* contour des champs et boutons : 3.7:1 sur blanc */
  --st-accent: #ef4a34;
  --st-accent-hover: #ff6049;
  --st-accent-text: #c93620; /* l'accent en texte : 5.2:1 sur blanc */
  --st-danger: #b42318; /* 6.6:1 sur blanc */
  --st-danger-hover: #8f1a10;
  --st-danger-soft: #fdf1ef;
  --st-danger-line: #e6b3ab;
  --st-ok: #14683f;
  --st-ok-soft: #e8f5ee;
  --st-ok-line: #9fd3b5;
  --st-top: calc(var(--nv-h, 66px) + 28px);
  --st-ease: cubic-bezier(0.16, 0.84, 0.44, 1);
  color: var(--st-ink);
}

body.modal-open {
  overflow: hidden;
}

/* ---------- Mise en page ---------- */
.st-main {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 48px 24px 112px;
}

.st-head {
  margin-bottom: 40px;
}

.st-head h1 {
  font-size: clamp(2rem, 1.55rem + 1.7vw, 2.6rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--st-ink);
}

.st-head__sub {
  margin-top: 10px;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--st-muted);
}

.st-layout {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.st-content {
  display: flex;
  flex-direction: column;
  gap: 56px;
  min-width: 0;
  max-width: 740px;
}

/* ---------- Navigation entre sections ---------- */
.st-nav {
  position: sticky;
  top: var(--st-top);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.st-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.93rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--st-muted);
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease;
}

.st-nav a:hover {
  color: var(--st-ink);
  background: rgba(20, 20, 26, 0.06);
}

.st-nav a[aria-current="location"] {
  color: var(--st-ink);
  background: var(--st-paper);
  box-shadow: 0 1px 2px rgba(20, 20, 26, 0.08), inset 0 0 0 1px var(--st-line);
}

.st-nav .st-nav__danger {
  margin-top: 14px;
  color: var(--st-danger);
}

.st-nav .st-nav__danger:hover {
  color: var(--st-danger-hover);
  background: var(--st-danger-soft);
}

/* Les sections que le script n'affiche pas (abonnement, accès payant, administration) disparaissent aussi du menu. */
.st-page:has(#compte-billing-block[hidden]) .st-nav a[href="#compte-billing-block"],
.st-page:has(#compte-lifetime-block[hidden]) .st-nav a[href="#compte-lifetime-block"],
.st-page:has(#compte-admin-block[hidden]) .st-nav a[href="#compte-admin-block"] {
  display: none;
}

/* ---------- Sections ---------- */
.st-section {
  scroll-margin-top: var(--st-top);
}

.st-section[hidden] {
  display: none;
}

.st-section__head {
  margin-bottom: 14px;
}

.st-section__head h2 {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--st-ink);
}

.st-section__head p {
  margin-top: 4px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--st-muted);
}

/* Un seul conteneur par section ; les lignes y sont séparées par des filets (pas de cartes dans des cartes). */
.st-list {
  background: var(--st-paper);
  border: 1px solid var(--st-line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(20, 20, 26, 0.05);
}

.st-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 24px;
  padding: 18px 22px;
}

.st-row + .st-row {
  border-top: 1px solid var(--st-line-soft);
}

.st-row__label {
  display: block;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--st-ink);
}

.st-row__meta {
  display: block;
  margin-top: 3px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--st-muted);
  overflow-wrap: anywhere;
}

.st-row__meta code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--st-canvas);
  font-size: 0.85em;
  color: var(--st-ink);
}

.st-row__note {
  grid-column: 1 / -1;
  max-width: 64ch;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--st-muted);
}

.st-row__note a,
.st-link {
  color: var(--st-accent-text);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.st-row__note a:hover,
.st-link:hover {
  color: var(--st-danger-hover);
}

/* ---------- Photo de profil ---------- */
.st-row--avatar {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px 20px;
}

.st-avatar {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 84px;
  height: 84px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--st-accent);
  box-shadow: 0 0 0 4px var(--st-paper), 0 0 0 5px var(--st-line);
  color: var(--st-ink);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  user-select: none;
  transition: opacity 0.16s ease;
}

.st-avatar.is-busy {
  opacity: 0.55;
}

.st-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 12px;
}

.st-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Pseudo : champ et bouton sur la ligne ---------- */
.st-row--form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
}

.st-inline {
  display: flex;
  gap: 10px;
}

/* ---------- Champs ---------- */
.st-input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--st-field);
  border-radius: 10px;
  background: var(--st-paper);
  color: var(--st-ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.st-input::placeholder {
  color: #6b6b73;
  opacity: 1;
}

.st-input:hover {
  border-color: var(--st-ink);
}

.st-input:focus {
  outline: none;
  border-color: var(--st-accent-text);
  box-shadow: 0 0 0 4px rgba(239, 74, 52, 0.24);
}

/* ---------- Boutons ---------- */
.st-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1.5px solid var(--st-field);
  border-radius: 10px;
  background: var(--st-paper);
  color: var(--st-ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease,
    transform 0.16s var(--st-ease);
}

.st-btn:hover:not(:disabled) {
  border-color: var(--st-ink);
  background: var(--st-canvas);
}

.st-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.st-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.st-btn--primary {
  border-color: var(--st-accent);
  background: var(--st-accent);
  color: var(--st-ink);
  box-shadow: 0 1px 2px rgba(20, 20, 26, 0.18);
}

.st-btn--primary:hover:not(:disabled) {
  border-color: var(--st-accent-hover);
  background: var(--st-accent-hover);
}

.st-btn--danger {
  border-color: var(--st-danger);
  background: var(--st-danger);
  color: #fff;
  box-shadow: 0 1px 2px rgba(20, 20, 26, 0.2);
}

.st-btn--danger:hover:not(:disabled) {
  border-color: var(--st-danger-hover);
  background: var(--st-danger-hover);
}

/* Action secondaire en texte : « Annuler », « Supprimer la photo ». */
.st-btn--text {
  min-height: 40px;
  padding: 0 6px;
  border-color: transparent;
  background: transparent;
  color: var(--st-muted);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.st-btn--text:hover:not(:disabled) {
  border-color: transparent;
  background: transparent;
  color: var(--st-ink);
}

.st-btn--text-danger {
  color: var(--st-danger);
}

.st-btn--text-danger:hover:not(:disabled) {
  color: var(--st-danger-hover);
}

.compte-page :focus-visible {
  outline: 3px solid var(--st-ink);
  outline-offset: 3px;
}

.st-input:focus-visible {
  outline: none;
}

/* [hidden] doit l'emporter sur les display ci-dessus. */
.st-btn[hidden],
.st-modal[hidden],
.st-alert[hidden] {
  display: none;
}

/* ---------- Zone de suppression ---------- */
.st-section--danger .st-list {
  border-color: var(--st-danger-line);
  background: var(--st-danger-soft);
}

.st-section--danger .st-section__head h2 {
  color: var(--st-danger);
}

.st-danger {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.st-danger__text {
  max-width: 64ch;
  font-size: 0.93rem;
  line-height: 1.6;
  color: var(--st-ink);
}

.st-danger__confirm {
  display: grid;
  gap: 8px;
  max-width: 420px;
}

.st-danger__confirm label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--st-ink);
}

.st-danger__confirm .st-input {
  border-color: #a8554b;
  letter-spacing: 0.04em;
}

.st-danger__actions {
  display: flex;
  justify-content: flex-start;
}

/* ---------- Messages (toujours visibles, où que l'on soit sur la page) ---------- */
.st-alert {
  position: fixed;
  top: calc(var(--nv-h, 66px) + 14px);
  left: 50%;
  z-index: 1500;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  width: min(580px, calc(100vw - 32px));
  padding: 14px 16px 14px 18px;
  border: 1px solid var(--st-line);
  border-radius: 14px;
  background: var(--st-paper);
  box-shadow: 0 10px 22px -10px rgba(20, 20, 26, 0.38);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--st-ink);
  transform: translateX(-50%);
  cursor: pointer;
  animation: stAlertIn 0.24s var(--st-ease) both;
}

/* Croix dessinée (masque SVG) : le message se ferme au clic, avec Échap ou tout seul (js/compte-ui.js). */
.st-alert::after {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  background: currentColor;
  opacity: 0.7;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
}

.st-alert:hover::after {
  opacity: 1;
}

.st-alert--error {
  border-color: var(--st-danger);
  background: var(--st-danger-soft);
  color: #6f130b;
}

.st-alert--ok {
  border-color: var(--st-ok-line);
  background: var(--st-ok-soft);
  color: #0d4a2c;
}

@keyframes stAlertIn {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ---------- Fenêtres (mot de passe, e-mail) ---------- */
.st-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.st-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 26, 0.58);
  animation: stFade 0.2s ease both;
}

.st-modal__dialog {
  position: relative;
  width: min(100%, 460px);
  max-height: calc(100vh - 40px);
  padding: 30px 30px 26px;
  overflow-y: auto;
  border-radius: 20px;
  background: var(--st-paper);
  box-shadow: 0 28px 70px -24px rgba(20, 20, 26, 0.55);
  animation: stRise 0.28s var(--st-ease) both;
}

@supports (height: 1dvh) {
  .st-modal__dialog {
    max-height: calc(100dvh - 40px);
  }
}

.st-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--st-muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.st-modal__close:hover {
  background: var(--st-canvas);
  color: var(--st-ink);
}

.st-modal__close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.st-modal__title {
  padding-right: 44px;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--st-ink);
}

.st-modal__hint {
  margin-top: 8px;
  font-size: 0.93rem;
  line-height: 1.55;
  color: var(--st-muted);
}

.st-modal__error {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1.5px solid var(--st-danger);
  border-radius: 12px;
  background: var(--st-danger-soft);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.5;
  color: #6f130b;
}

.st-modal__error[hidden] {
  display: none;
}

.st-modal__form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.st-field {
  display: grid;
  gap: 7px;
}

.st-field label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--st-ink);
}

.st-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

@keyframes stFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes stRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Pied de page ---------- */
.st-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
  margin-top: -16px;
  font-size: 0.9rem;
  color: var(--st-muted);
}

.st-foot a {
  padding: 12px 0; /* zone de clic confortable, même sur téléphone */
  color: var(--st-ink);
  font-weight: 700;
  text-underline-offset: 0.2em;
}

.st-foot a:hover {
  color: var(--st-accent-text);
}

/* ---------- Badges (js/badges.js) ----------
   Une étagère de médailles : seuls les badges GAGNÉS sont montrés, chacun avec son titre et ce qu'il récompense. Aucune case
   « verrouillée ». Les médailles sont des SVG (js/badges.js) ; ici, la mise en page, l'ombre et l'apparition. */
.bd {
  overflow: hidden;
}

.bd-count {
  padding: 16px 22px 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--st-muted);
}

.bd-count strong {
  color: var(--st-ink);
  font-weight: 800;
}

.bd-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr));
  gap: 26px 10px;
  margin: 0;
  padding: 18px 16px 28px;
  list-style: none;
}

.bd-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  text-align: center;
  animation: bd-pop 0.55s var(--st-ease) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

.bd-medal {
  display: block;
  margin-bottom: 6px;
  line-height: 0;
  filter: drop-shadow(0 5px 5px rgba(20, 20, 26, 0.22));
  transition: transform 0.28s var(--st-ease), filter 0.28s var(--st-ease);
}

.bd-badge:hover .bd-medal {
  transform: translateY(-4px) rotate(-3deg);
  filter: drop-shadow(0 9px 8px rgba(20, 20, 26, 0.26));
}

.bd-medal__svg {
  display: block;
}

/* Le style des pictogrammes gravés au centre (traits crème arrondis) est dans le SVG lui-même (js/badges.js) : la médaille
   s'affiche aussi en bas des fiches, qui ne chargent pas cette feuille. Ne pas le remettre ici. */

.bd-badge__title {
  max-width: 100%;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--st-ink);
  overflow-wrap: anywhere;
}

.bd-badge__desc {
  max-width: 10.5rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--st-muted);
}

/* Les badges d'ensemble sont dorés : un liseré doré sous le titre les distingue des autres. */
.bd-badge--master .bd-badge__title {
  position: relative;
  padding-bottom: 5px;
}

.bd-badge--master .bd-badge__title::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 2.2rem;
  height: 2px;
  border-radius: 2px;
  background: #c8920f;
  transform: translateX(-50%);
}

@keyframes bd-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.6) rotate(-9deg);
  }
  60% {
    opacity: 1;
    transform: translateY(0) scale(1.07) rotate(2deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bd-badge {
    animation: none;
  }

  .bd-medal,
  .bd-badge:hover .bd-medal {
    transition: none;
    transform: none;
  }
}

/* Aucun badge encore : une phrase qui dit comment en gagner un, et rien d'autre. */
.bd-empty {
  padding: 26px 22px 28px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--st-muted);
}

.bd-empty__t {
  margin-bottom: 4px;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--st-ink);
}

.bd-empty__go {
  display: inline-block;
  margin-top: 12px;
  font-weight: 800;
  color: var(--st-accent-text);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.15s ease;
}

.bd-empty__go:hover {
  text-decoration-color: currentColor;
}

/* ---------- Badge Platine : tous les badges obtenus (js/badges.js, platinumHtml) ----------
   Même mise en page que la carte de la flamme, mais froide : une lueur gris-bleu derrière la plus grande médaille de la page, en métal
   blanc bleuté. Pas d'animation ni de décor : la médaille se peint dans son SVG. */
.bd-plat {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--st-line-soft);
  background: radial-gradient(120% 170% at 0% 50%, #dfe6f0 0%, #eef2f8 36%, var(--st-paper) 74%);
}

.bd-plat__medal {
  flex: none;
  line-height: 0;
  filter: drop-shadow(0 8px 8px rgba(30, 40, 60, 0.3));
}

.bd-plat__svg,
.bd-plat__medal .bd-medal__svg {
  display: block;
}

.bd-plat__body {
  min-width: 0;
}

.bd-plat__kicker {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #3d4a63;
}

.bd-plat__title {
  margin-top: 2px;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--st-ink);
}

.bd-plat__desc {
  margin-top: 8px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--st-muted);
}

/* ---------- La flamme : plus longue série de jours de révision (js/streak.js, js/badges.js) ----------
   Le chiffre dans la flamme est le record ; la série en cours est écrite à côté. Une lueur chaude derrière la flamme, un
   filet dessous pour la séparer de l'étagère. La flamme ne vacille que si la série est en cours. */
.bd-streak {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 22px 26px;
  border-bottom: 1px solid var(--st-line-soft);
  background: radial-gradient(120% 160% at 0% 50%, #fff1e3 0%, #fff9f3 38%, var(--st-paper) 72%);
}

.bd-streak__flame {
  flex: none;
  line-height: 0;
  filter: drop-shadow(0 6px 7px rgba(209, 47, 28, 0.28));
}

.bd-flame__svg {
  display: block;
}

.bd-streak__body {
  min-width: 0;
}

.bd-streak__kicker {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--st-accent-text);
}

.bd-streak__title {
  margin-top: 2px;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--st-ink);
}

.bd-streak__now {
  margin-top: 8px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--st-muted);
}

.bd-streak__now strong {
  font-weight: 800;
  color: var(--st-ink);
}

/* Série arrêtée : le record reste, la lueur s'éteint. */
.bd-streak:not(.bd-streak--live) {
  background: var(--st-paper);
}

.bd-streak:not(.bd-streak--live) .bd-streak__flame {
  filter: drop-shadow(0 5px 5px rgba(20, 20, 26, 0.2));
}

.bd-flame__svg--live .bd-flame__fire {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: bd-flicker 3.2s ease-in-out infinite;
}

@keyframes bd-flicker {
  0%,
  100% {
    transform: scale(1, 1);
  }
  28% {
    transform: scale(0.98, 1.035);
  }
  55% {
    transform: scale(1.012, 0.985);
  }
  78% {
    transform: scale(0.99, 1.02);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bd-flame__svg--live .bd-flame__fire {
    animation: none;
  }
}

/* ---------- Écrans étroits ---------- */
@media (max-width: 900px) {
  .st-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  /* Le menu devient une rangée défilante au-dessus des sections. */
  .st-nav {
    position: static;
    flex-direction: row;
    gap: 6px;
    margin: 0 -24px;
    padding: 0 24px 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .st-nav::-webkit-scrollbar {
    display: none;
  }

  .st-nav a {
    flex: none;
    padding: 9px 14px;
    border: 1.5px solid var(--st-line);
    border-radius: 999px;
    background: var(--st-paper);
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .st-nav .st-nav__danger {
    margin-top: 0;
    border-color: var(--st-danger-line);
  }

  .st-content {
    max-width: none;
    gap: 44px;
  }
}

@media (max-width: 640px) {
  .st-main {
    padding: 32px 16px 88px;
  }

  .st-head {
    margin-bottom: 28px;
  }

  .st-nav {
    margin: 0 -16px;
    padding: 0 16px 4px;
  }

  .st-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 18px;
  }

  .bd-count {
    padding: 14px 18px 0;
  }

  .bd-shelf {
    grid-template-columns: repeat(auto-fill, minmax(7.4rem, 1fr));
    gap: 22px 6px;
    padding: 14px 8px 24px;
  }

  .bd-empty {
    padding: 20px 18px 22px;
  }

  .bd-plat {
    gap: 16px;
    padding: 18px;
  }

  .bd-plat__medal .bd-medal__svg {
    width: 84px;
    height: auto;
  }

  .bd-plat__title {
    font-size: 1.25rem;
  }

  .bd-streak {
    gap: 16px;
    padding: 18px;
  }

  .bd-streak__flame .bd-flame__svg {
    width: 68px;
    height: auto;
  }

  .bd-streak__title {
    font-size: 1.2rem;
  }

  .st-row > .st-btn {
    justify-self: start;
  }

  /* Photo : l'avatar à côté du titre, les boutons sur toute la largeur en dessous (sinon trois boutons s'empilent dans 190 px). */
  .st-row--avatar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 16px;
  }

  .st-row--avatar .st-row__main {
    display: contents;
  }

  .st-row--avatar .st-avatar {
    grid-row: 1 / span 2;
  }

  .st-row--avatar .st-row__label {
    grid-column: 2;
    align-self: end;
  }

  .st-row--avatar .st-row__meta {
    grid-column: 2;
    align-self: start;
  }

  .st-row--avatar .st-actions {
    grid-column: 1 / -1;
    margin-top: 12px;
  }

  .st-row--avatar .st-actions .st-btn:not(.st-btn--text) {
    flex: 1 1 auto;
  }

  .st-row--avatar .st-row__note {
    margin-top: 6px;
  }

  .st-row--form {
    grid-template-columns: minmax(0, 1fr);
  }

  .st-inline {
    flex-direction: column;
  }

  .st-btn {
    min-height: 44px;
  }

  .st-danger {
    padding: 18px;
  }

  .st-danger__actions .st-btn {
    width: 100%;
  }

  .st-modal {
    align-items: end;
    padding: 0;
  }

  .st-modal__dialog {
    width: 100%;
    max-height: 92vh;
    padding: 26px 20px calc(22px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px 22px 0 0;
  }

  .st-modal__actions {
    flex-direction: column-reverse;
  }

  .st-modal__actions .st-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .compte-page *,
  .compte-page *::before,
  .compte-page *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
