/* Ghost me! : comptes, classements, équipes et badges.
   Un menu de trois onglets posé sur le bord bas de l'écran (classement, sac de goodies, compte) : sur l'accueil,
   sur le bilan, et sur toutes les pages du panneau qu'il ouvre par-dessus le jeu. Une carte de résultat après
   chaque partie, posée juste au-dessus de lui.

   Tout est habillé comme le jeu, pour qu'on ne voie pas la couture : le fond violet rayonnant de l'accueil,
   ses cartes blanches aux grands coins ronds et à l'ombre franche, ses boutons jaunes posés sur leur tranche,
   ses pastilles sombres, ses couleurs (Style.cs), sa police (Fredoka), ses titres en blocs et ses objets en cubes.
   Pensé d'abord pour un téléphone tenu d'une main ; sur un écran large, le contenu reste en colonne au milieu. */

.gm, .gm * { box-sizing: border-box; }
.gm {
  /* Les couleurs du jeu. */
  --ink: #2a3046;        /* textDark */
  --soft: #6b728a;       /* textSoft */
  --accent: #ffc93c;     /* accent : boutons, titres en jaune */
  --accent-side: #b8912b;
  --good: #2db56a;
  --bad: #e84d4d;
  --bad-side: #a73737;
  --pink: #ff4f9a;       /* concurrents */
  --purple: #8b6cff;     /* hantise */
  --night: #1a1c30;      /* hudPanel : pastilles et boutons sombres */
  --night-side: #10111f;
  --shadow: rgba(8, 8, 26, .32); /* uiShadow */
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 500; color: var(--ink); line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
}
.gm button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
.gm button:disabled { cursor: default; }
.gm [hidden] { display: none !important; }

/* Ce qui a le clavier se voit, à la souris comme au clavier. */
.gm :focus { outline: none; }
.gm :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.gm-card :focus-visible, .gm-list :focus-visible { outline-color: var(--pink); }

/* Un texte en blocs (voir compte.js) et une icône en cubes découpée dans la planche rendue par Unity. */
.gm-blocks { display: block; flex: none; max-width: 100%; height: auto; }
.gi { display: inline-block; flex: none; background-repeat: no-repeat; vertical-align: middle; }
.gi.none { opacity: .22; filter: grayscale(1); }
.gi.bob { animation: gm-bob 1.4s ease-in-out infinite; }
@keyframes gm-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-9px) rotate(3deg); } }

/* ---------------------------------------------------------------- Le menu du bas : accueil, bilan et panneau */

/* Trois onglets dans une seule barre sombre, collée au bord bas de l'écran comme le menu d'une appli : chacun son
   objet en cubes et son nom. Sur un téléphone elle prend toute la largeur ; sur un écran large, elle reste au milieu.
   Elle reste en place quand le panneau s'ouvre (elle passe devant lui) : c'est elle qui fait changer de rubrique,
   et l'onglet de la rubrique qu'on regarde est marqué de jaune.

   Sa hauteur suit celle de l'écran : sous le record de l'accueil et sous les boutons du bilan, le jeu laisse libre
   un peu plus de 8 % de la hauteur (davantage sur un téléphone très allongé). Ses objets et ses noms se règlent sur elle. */
body { --gm-bar: clamp(46px, 7.8vh, 68px); }
/* La hauteur vraiment visible, là où le navigateur sait la donner (ses barres d'outils rétrécissent l'écran). */
@supports (height: 1dvh) { body { --gm-bar: clamp(46px, 7.8dvh, 68px); } }
#gm-bar {
  --bar: var(--gm-bar);
  position: fixed; z-index: 60; left: 50%; bottom: 0;
  width: min(100vw, 480px);
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  display: flex; align-items: stretch;
  background: rgba(26, 28, 48, .95); border-top: 2px solid rgba(255, 255, 255, .13);
  border-radius: 22px 22px 0 0; overflow: hidden;
  box-shadow: 0 -5px 0 rgba(8, 8, 26, .22);
  opacity: 0; transform: translate(-50%, 110%); pointer-events: none;
  transition: transform .4s cubic-bezier(.2, 1.2, .4, 1), opacity .25s ease;
}
#gm-bar.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
/* L'invitation à installer le jeu se pose juste au-dessus du menu, en plus petit : elle tient entre lui et le record. */
body.menu-on #invite {
  bottom: calc(var(--gm-bar) + 10px + env(safe-area-inset-bottom, 0px));
  padding: 7px 10px; grid-template-columns: 34px minmax(0, 1fr) auto 26px; column-gap: 8px;
  border-radius: 18px; box-shadow: 0 4px 0 rgba(27, 23, 87, .45);
}
body.menu-on #invite > img { width: 34px; height: 34px; border-radius: 9px; }
body.menu-on #invite > div > strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.menu-on #invite > div > span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.menu-on #invite-go { padding: 7px 12px; font-size: 14px; border-radius: 12px; }
body.menu-on #invite-close { width: 26px; height: 26px; line-height: 26px; font-size: 16px; }
/* Un écran très étroit : sans sa vignette, pour que « Installe Ghost me! » tienne en entier. */
@media (max-width: 350px) {
  body.menu-on #invite { grid-template-columns: minmax(0, 1fr) auto 26px; }
  body.menu-on #invite > img { display: none; }
}

.gm-nav-item {
  position: relative; flex: 1 1 0; min-width: 0; height: var(--bar); margin: 0; padding: 0 4px;
  border: 0; border-radius: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
}
.gm button.gm-nav-item { color: #fff; font-size: max(10.5px, calc(var(--bar) * .2)); font-weight: 700; line-height: 1.2; letter-spacing: .01em; }
/* L'objet en cubes : un peu plus de la moitié de la hauteur de la barre. */
.gm-nav-item .gi { width: calc(var(--bar) * .56) !important; height: calc(var(--bar) * .56) !important; }
/* Un trait fin entre deux onglets. */
.gm-nav-item + .gm-nav-item::before {
  content: ""; position: absolute; left: -1px; top: 22%; bottom: 22%; width: 2px; border-radius: 1px;
  background: rgba(255, 255, 255, .1);
}
.gm-nav-icon { position: relative; display: flex; transition: transform .12s ease; }
.gm-nav-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .92; }
.gm-nav-item:active { background: rgba(255, 255, 255, .1); }
.gm-nav-item:active .gm-nav-icon { transform: translateY(2px) scale(.92); }
.gm-nav-item:active .gm-nav-name { color: var(--accent); opacity: 1; }
@media (hover: hover) {
  .gm-nav-item:hover { background: rgba(255, 255, 255, .06); }
  .gm-nav-item:hover .gm-nav-name { color: var(--accent); opacity: 1; }
}
/* Cinq onglets (un cadeau attend) : les noms se resserrent, pour que « Classement » tienne sur un petit téléphone. */
#gm-bar.many .gm-nav-item { padding: 0 2px; }
.gm #gm-bar.many button.gm-nav-item, #gm-bar.many.gm button.gm-nav-item { font-size: max(10px, calc(var(--bar) * .17)); letter-spacing: 0; }
/* La rubrique qu'on regarde, panneau ouvert : son nom en jaune, un trait jaune au bord haut, un fond un peu plus clair. */
.gm-nav-item[aria-current="page"] { background: rgba(255, 255, 255, .09); }
.gm-nav-item[aria-current="page"] .gm-nav-name { color: var(--accent); opacity: 1; }
.gm-nav-item[aria-current="page"]::after {
  content: ""; position: absolute; top: 0; left: 24%; right: 24%; height: 4px; border-radius: 0 0 4px 4px;
  background: var(--accent);
}
/* Le contour du clavier reste dans la barre, qui coupe ce qui dépasse de ses coins ronds. */
.gm .gm-nav-item:focus-visible { outline-offset: -5px; border-radius: 16px; }
.gm-nav-item .gm-dot {
  position: absolute; top: -3px; right: -8px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--bad); border: 2px solid #fff;
}
/* Pas encore de pseudo : l'objet de l'onglet du compte bat doucement, sa pastille est jaune. */
.gm-nav-item .gm-dot.new { background: var(--accent); border-color: var(--ink); }
.gm-nav-item.gm-new .gm-nav-icon { animation: gm-beat 1.9s ease-in-out infinite; }
@keyframes gm-beat {
  0%, 62%, 100% { transform: scale(1); }
  74% { transform: scale(1.14); }
  86% { transform: scale(.97); }
}

/* Un téléphone couché : le jeu occupe tout le milieu jusqu'en bas, mais ses coins sont libres. Le menu se range
   dans le coin en bas à gauche, ses onglets côte à côte (quatre au plus, avec le paquet cadeau). */
@media (max-height: 480px) {
  body { --gm-bar: 48px; }
  #gm-bar {
    left: 0; width: auto; border-radius: 0 18px 0 0; border-right: 2px solid rgba(255, 255, 255, .13);
    padding-right: 0; transform: translate(0, 110%);
  }
  #gm-bar.on { transform: none; }
  .gm-nav-item { flex: none; width: 66px; padding: 0 2px; }
  .gm button.gm-nav-item { letter-spacing: 0; }
  /* En anglais, « Leaderboard » est le mot le plus long du menu : ici il tient à un point près, on le resserre un peu. */
  html[lang="en"] .gm button.gm-nav-item { letter-spacing: -.02em; }
}

/* ---------------------------------------------------------------- La carte de résultat, après une partie */

#gm-toast {
  /* Juste au-dessus du menu, qui reste en place. Elle est basse : au bilan, elle doit tenir entre lui et « ACCUEIL ». */
  position: fixed; z-index: 21; left: 50%; bottom: calc(var(--gm-bar) + 5px + env(safe-area-inset-bottom, 0px));
  width: min(100vw - 12px, 440px); padding: 5px 8px 6px;
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 26px; align-items: center; column-gap: 6px;
  background: #1a1c30; color: #fff; border: 2px solid #2f3147;
  border-radius: 18px; box-shadow: 0 4px 0 rgba(8, 8, 20, .45);
  transform: translate(-50%, 160%); opacity: 0; pointer-events: none;
  transition: transform .45s cubic-bezier(.2, 1.3, .4, 1), opacity .3s ease;
}
#gm-toast.on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
#gm-toast .gm-toast-icon { display: flex; align-items: center; justify-content: center; }
#gm-toast strong { display: block; font-size: 15.5px; font-weight: 700; line-height: 1.15; color: var(--accent); }
/* Les lignes de texte de la carte (pas son icône, ni l'étiquette de son bouton). */
#gm-toast > div > span:not(.gi) { display: block; font-size: 12px; line-height: 1.2; color: rgba(255, 255, 255, .82); }
#gm-toast > div > span:not(.gi):empty { display: none; }
#gm-toast > div > span.gm-toast-extra { color: #fff; font-weight: 700; }
#gm-toast .gm-btn { margin: 0 0 3px; padding: 4px 10px 5px; }
#gm-toast .gm-x {
  width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
/* Un téléphone étroit : sans son objet en cubes, pour que chaque ligne tienne sans se replier. */
@media (max-width: 400px) {
  #gm-toast { grid-template-columns: minmax(0, 1fr) auto 26px; padding-left: 12px; }
  #gm-toast .gm-toast-icon { display: none; }
}
/* Un écran peu haut : le titre et une seule ligne. Quand la carte annonce des badges ou des cadeaux, c'est cette
   ligne-là qu'elle garde ; le rang se lit dans le classement. */
@media (max-height: 700px) {
  #gm-toast > div:has(> .gm-toast-extra:not(:empty)) > span:not(.gi):not(.gm-toast-extra) { display: none; }
}

/* Un téléphone couché : le menu est dans le coin en bas à gauche, la carte se pose en bas, à sa droite. */
@media (max-height: 480px) {
  #gm-toast {
    left: auto; right: calc(10px + env(safe-area-inset-right, 0px)); bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: min(440px, calc(100vw - 236px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    transform: translate(0, 160%);
  }
  #gm-toast.on { transform: none; }
}

/* La carte de résultat prend la place de l'invitation à installer le jeu, le temps qu'elle est là. */
body.toast-on #invite { opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- Le panneau : un écran du jeu */

#gm-sheet {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 50; overflow: hidden;
  display: flex; align-items: stretch; justify-content: center;
  /* Le fond de l'écran titre : son dégradé violet (titleTop, titleBottom). */
  background: linear-gradient(#5d4be6, #211c66);
  /* Ici on fait défiler, on sélectionne et on tape du texte, contrairement au reste de la page. */
  touch-action: pan-y; -webkit-user-select: text; user-select: text;
  animation: gm-fade .22s ease;
}
/* Ses rayons qui tournent lentement, et le halo clair d'où ils partent. */
#gm-sheet::before {
  content: ""; position: absolute; left: 50%; top: 34%; width: 240vmax; height: 240vmax; margin: -120vmax 0 0 -120vmax;
  background: repeating-conic-gradient(rgba(255, 255, 255, .07) 0deg 15deg, rgba(255, 255, 255, 0) 15deg 30deg);
  animation: gm-rays 70s linear infinite; pointer-events: none;
}
#gm-sheet::after {
  content: ""; position: absolute; left: 50%; top: 34%; width: 150vmin; height: 150vmin; margin: -75vmin 0 0 -75vmin;
  background: radial-gradient(closest-side, rgba(180, 168, 255, .5), rgba(180, 168, 255, 0));
  pointer-events: none;
}
@keyframes gm-rays { to { transform: rotate(360deg); } }
@keyframes gm-fade { from { opacity: 0; } }
@keyframes gm-rise { from { transform: translateY(26px); opacity: 0; } }

/* Le menu du bas reste devant le panneau : son contenu et sa phrase d'état s'arrêtent juste au-dessus de lui. */
.gm-dialog {
  position: relative; z-index: 1; width: 100%; max-width: 580px; height: 100%; display: flex; flex-direction: column;
  padding-bottom: calc(var(--gm-bar) + 2px + env(safe-area-inset-bottom, 0px));
  animation: gm-rise .3s cubic-bezier(.2, 1.2, .4, 1);
}

.gm-head {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) 10px calc(16px + env(safe-area-inset-left, 0px));
}
.gm-head h2 { flex: 1; min-width: 0; margin: 0; display: flex; align-items: center; gap: 12px; }
/* Fermer : la même pastille sombre que la roue des réglages. */
  flex: none; width: 46px; height: 46px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .1); background: rgba(26, 28, 48, .86); color: #fff !important;
  box-shadow: 0 4px 0 rgba(8, 8, 20, .45);
  display: flex; align-items: center; justify-content: center;
}

/* Les sous-onglets : les pages de la rubrique qu'on regarde (compte, badges, équipe), quand elle en a plusieurs.
   Des boutons du jeu, l'objet en cubes à côté du nom. Celui qu'on regarde est jaune, les autres sombres. */
.gm-tabs {
  flex: none; display: flex; gap: 8px;
  padding: 0 calc(12px + env(safe-area-inset-right, 0px)) 14px calc(12px + env(safe-area-inset-left, 0px));
}
.gm-tab {
  position: relative; flex: 1 1 0; min-width: 0; min-height: 46px; padding: 4px 6px; border: 0; border-radius: 16px;
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px;
  background: rgba(26, 28, 48, .82); color: #fff !important; box-shadow: 0 5px 0 rgba(8, 8, 20, .45);
  font-weight: 700; white-space: nowrap; letter-spacing: -.01em;
}
/* (« .gm button » impose sa police à tous les boutons : il faut le dire plus fort que lui.) */
.gm button.gm-tab { font-size: 15px; }
.gm-tab span:last-of-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Quatre pages dans la rubrique du compte : sur un téléphone, l'objet passe au-dessus du mot, qui tient alors en entier. */
@media (max-width: 520px) {
  .gm-tabs.many .gm-tab { flex-direction: column; gap: 2px; min-height: 54px; padding: 5px 3px; }
  .gm-tabs.many button.gm-tab { font-size: 12.5px; letter-spacing: 0; }
  .gm-tabs.many .gm-tab .gi { width: 24px !important; height: 24px !important; }
  .gm-tabs.many .gm-tab span:last-of-type { max-width: 100%; overflow: visible; text-overflow: clip; }
}
.gm-tab:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(8, 8, 20, .45); }
.gm-tab[aria-selected="true"] { background: var(--accent); color: var(--ink) !important; box-shadow: 0 5px 0 var(--accent-side), 0 8px 0 var(--shadow); }
.gm-tab .gm-dot { position: absolute; top: -4px; right: -3px; width: 14px; height: 14px; border-radius: 50%; background: var(--bad); border: 2px solid #fff; }

.gm-body {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 2px calc(14px + env(safe-area-inset-right, 0px)) 22px calc(14px + env(safe-area-inset-left, 0px));
}
.gm-body > :last-child { margin-bottom: 0; }
/* Le titre de l'onglet, en gros blocs blancs, comme le score du jeu. */
.gm-title { display: flex; justify-content: center; margin: 2px 0 14px; }

/* Une phrase en bas du panneau : jaune quand tout va bien, rouge pour prévenir. */
.gm-status {
  flex: none; margin: 0; padding: 0 14px; max-height: 0; overflow: hidden; text-align: center;
  font-size: 15px; font-weight: 700; color: var(--ink); background: var(--accent); transition: max-height .25s ease, padding .25s ease;
}
.gm-status.on { max-height: 110px; padding: 10px 14px; }
.gm-status.bad { background: var(--bad); color: #fff; }

/* ---------------------------------------------------------------- Briques */

/* La carte du jeu : blanche, de grands coins ronds, et son ombre franche juste dessous. */
.gm-card { background: #fff; border-radius: 22px; padding: 16px; margin: 0 0 18px; box-shadow: 0 7px 0 var(--shadow); }
.gm-card h3 { margin: 0 0 8px; font-size: 19px; font-weight: 700; color: var(--ink); }
.gm-card p { margin: 0 0 10px; font-size: 15.5px; }
.gm-card p:last-child { margin-bottom: 0; }
.gm-soft { color: var(--soft); }
.gm-small { font-size: 14px !important; }
.gm-center { text-align: center; }
.gm-ok { color: var(--good); font-weight: 700; }
.gm-on-dark { color: #fff; text-align: center; font-size: 15.5px; font-weight: 700; margin: 4px 0 14px; text-shadow: 0 2px 0 rgba(27, 23, 87, .55); }

/* Le bouton du jeu : un dessus jaune, un reflet, et la tranche plus sombre sur laquelle il s'enfonce quand on appuie. */
.gm-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 8px 18px 9px; margin: 0 0 9px; border: 0; border-radius: 16px;
  background: var(--accent); color: var(--ink); font-size: 16px; font-weight: 700; line-height: 1.1;
  box-shadow: 0 6px 0 var(--accent-side), 0 9px 0 var(--shadow);
}
.gm-btn::before {
  content: ""; position: absolute; left: 6px; right: 6px; top: 4px; height: 40%;
  border-radius: 11px 11px 7px 7px; background: rgba(255, 255, 255, .22); pointer-events: none;
}
.gm-btn > * { position: relative; }
.gm-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--accent-side), 0 3px 0 var(--shadow); }
.gm-btn:disabled { opacity: .5; }
.gm-btn.wide { display: flex; width: 100%; }
/* Le bouton discret : sombre, comme « ACCUEIL » sur le bilan ou « INFOS » dans les réglages. */
.gm-btn.plain { background: var(--night); color: #fff; box-shadow: 0 6px 0 var(--night-side), 0 9px 0 var(--shadow); }
.gm-btn.plain::before { background: rgba(255, 255, 255, .09); }
.gm-btn.plain:active { box-shadow: 0 1px 0 var(--night-side), 0 3px 0 var(--shadow); }
/* Le bouton qui prévient : rouge, comme « VRAIMENT ? » dans la pause. */
.gm-btn.danger { background: var(--bad); color: #fff; box-shadow: 0 6px 0 var(--bad-side), 0 9px 0 var(--shadow); }
.gm-btn.danger:active { box-shadow: 0 1px 0 var(--bad-side), 0 3px 0 var(--shadow); }
.gm-btn.small { min-height: 42px; padding: 6px 13px 7px; border-radius: 14px; font-size: 14.5px; }
.gm-btn.small::before { border-radius: 9px 9px 6px 6px; }
.gm-label { display: block; }

/* Une pastille à toucher : un joueur à inviter, avec son badge. */
.gm-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 5px 13px 5px 8px;
  border: 0; border-radius: 20px; background: var(--night); color: #fff !important; font-size: 15px; font-weight: 700;
  box-shadow: 0 4px 0 var(--night-side);
}
.gm-chip:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--night-side); }

.gm-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gm-row.end { justify-content: flex-end; }
.gm-row > .grow { flex: 1 1 140px; min-width: 0; }
.gm-row > .gm-btn { margin-bottom: 9px; }
.gm-body > .gm-row { margin: 0 0 12px; }
.gm-who { display: flex; align-items: center; gap: 8px; }
.gm-who span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gm-field { display: block; margin: 0 0 12px; }
.gm-field > span { display: block; margin: 0 0 5px; font-size: 14.5px; font-weight: 700; }
.gm-input {
  display: block; width: 100%; min-height: 50px; padding: 10px 13px;
  border: 3px solid var(--ink); border-radius: 16px; background: #fff; color: var(--ink);
  /* 16 px au moins : en dessous, l'iPhone zoome sur le champ. */
  font: inherit; font-size: 17px; font-weight: 700;
  -webkit-user-select: text; user-select: text; touch-action: manipulation;
}
.gm-input::placeholder { color: #a9aebf; font-weight: 500; }
.gm-input:focus { border-color: #5d4be6; box-shadow: 0 0 0 3px var(--accent); outline: none; }
.gm-input.code { letter-spacing: .06em; text-transform: uppercase; }

/* Une case à cocher : un carré aux coins ronds, qui devient jaune avec une coche en blocs. */
.gm-check { display: flex; align-items: flex-start; gap: 11px; margin: 0 0 12px; font-size: 14.5px; cursor: pointer; }
.gm-check input {
  -webkit-appearance: none; appearance: none; flex: none; width: 28px; height: 28px; margin: 0;
  border: 3px solid var(--ink); border-radius: 9px; background: #fff center / 16px 16px no-repeat; cursor: pointer;
}
.gm-check input:checked {
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath fill='%232a3046' d='M0 4h2v2H0zM2 5h1v2H2zM3 4h1v2H3zM4 3h1v2H4zM5 2h1v2H5zM6 1h2v2H6z'/%3E%3C/svg%3E");
}
.gm-error { margin: -4px 0 12px !important; color: var(--bad); font-size: 14.5px !important; font-weight: 700; }
.gm-code {
  display: block; margin: 0 0 12px; padding: 13px; border-radius: 16px; background: var(--night); color: var(--accent); text-align: center;
  font-size: 21px; font-weight: 700; letter-spacing: .06em; word-break: break-all; -webkit-user-select: all; user-select: all;
}
/* Ce qui se déplie : une pastille sombre, comme celles de l'interface du jeu. */
details.gm-more { margin: 0 0 14px; color: #fff; font-size: 15px; }
details.gm-more summary {
  display: block; min-height: 46px; padding: 11px 16px; border-radius: 16px; background: rgba(26, 28, 48, .72);
  font-weight: 700; cursor: pointer; list-style: none;
}
details.gm-more summary::-webkit-details-marker { display: none; }
details.gm-more summary::after { content: "+"; float: right; font-size: 20px; line-height: 1; color: var(--accent); }
details.gm-more[open] summary::after { content: "–"; }
details.gm-more[open] summary { margin-bottom: 12px; }
details.gm-more > p { margin: 0 6px 10px; font-weight: 500; }

.gm-loading { padding: 30px 0; text-align: center; color: #fff; font-size: 17px; font-weight: 700; }
.gm-loading div { margin-top: 6px; }

/* ---------------------------------------------------------------- Classements */

/* Semaine, toujours, équipes : une pastille sombre, et celle qu'on a choisie en jaune. */
.gm-seg { display: flex; gap: 4px; padding: 5px; margin: 0 0 16px; border-radius: 24px; background: rgba(26, 28, 48, .72); }
.gm-seg button { flex: 1; min-height: 40px; padding: 6px 4px; border: 0; border-radius: 20px; background: none; color: #fff !important; font-size: 15px; font-weight: 700; }
.gm-seg button[aria-pressed="true"] { background: var(--accent); color: var(--ink) !important; box-shadow: 0 3px 0 var(--accent-side); }

.gm-list { list-style: none; margin: 0 0 18px; padding: 6px; background: #fff; border-radius: 22px; box-shadow: 0 7px 0 var(--shadow); }
.gm-list li { display: grid; grid-template-columns: 38px 34px minmax(0, 1fr) auto; align-items: center; column-gap: 8px; min-height: 54px; padding: 6px 10px 6px 6px; border-radius: 16px; }
.gm-list li + li { border-top: 2px solid #eef0f5; }
/* Sa propre ligne : surlignée en jaune. */
.gm-list li.me { background: #fff0bf; border-top-color: transparent; box-shadow: inset 5px 0 0 var(--accent); }
.gm-list li.me + li { border-top-color: transparent; }
.gm-list .rank { display: flex; align-items: center; justify-content: center; color: var(--soft); }
.gm-list .pic { display: flex; align-items: center; justify-content: center; }
.gm-list .who { min-width: 0; }
.gm-list .who b { display: block; font-size: 16.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-list .who small { display: block; font-size: 12.5px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-list .score { display: flex; align-items: center; color: var(--ink); white-space: nowrap; }
.gm-list li.gap { min-height: 0; padding: 2px 8px 6px; text-align: center; display: block; color: var(--soft); font-weight: 700; letter-spacing: .3em; }
.gm-list li.pick { cursor: pointer; }
.gm-list li .act { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 4px 0 2px; }

/* ---------------------------------------------------------------- Badges */

.gm-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 10px; margin: 0 0 18px; padding: 0; list-style: none; }
.gm-badge { position: relative; padding: 12px 10px 12px; border-radius: 22px; background: #fff; text-align: center; box-shadow: 0 7px 0 var(--shadow); }
.gm-badge .pic { display: flex; justify-content: center; margin: 0 0 4px; }
.gm-badge b { display: block; margin: 2px 0; font-size: 15.5px; font-weight: 700; line-height: 1.15; }
.gm-badge small { display: block; font-size: 12.5px; line-height: 1.2; color: var(--soft); }
/* Pas encore gagné : une carte sombre, et l'objet en silhouette pâle. */
.gm-badge.locked { background: rgba(26, 28, 48, .72); color: #fff; box-shadow: 0 7px 0 rgba(8, 8, 20, .3); }
.gm-badge.locked small { color: rgba(255, 255, 255, .7); }
.gm-badge.locked .gi { filter: brightness(0) invert(1); opacity: .22; }
.gm-badge .bar { height: 10px; margin: 9px 6px 3px; border-radius: 5px; background: rgba(0, 0, 0, .35); overflow: hidden; }
.gm-badge .bar i { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.gm-badge .count { display: block; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gm-badge:not(.locked) .count { color: var(--good); }
/* Celui qui s'affiche à côté du pseudo : cerclé de jaune. */
.gm-badge.top { box-shadow: 0 0 0 4px var(--accent), 0 7px 0 4px var(--shadow); }

/* ---------------------------------------------------------------- Compte */

.gm-me { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; align-items: center; }
.gm-me .pic { display: flex; }
.gm-me b { display: block; font-size: 23px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-me small { display: block; font-size: 14px; color: var(--soft); }
.gm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; text-align: center; }
.gm-stats li { padding: 10px 4px 8px; border-radius: 14px; background: #f1f2f7; }
.gm-stats b { display: flex; justify-content: center; min-height: 18px; }
.gm-stats small { display: block; margin-top: 5px; font-size: 12px; color: var(--soft); }

/* ---------------------------------------------------------------- Le sac de goodies */

/* Les vents : la monnaie du distributeur, en gros chiffres blancs comme le score du jeu. */

/* Les cadeaux qui viennent d'arriver. */
.gm-gifts { background: var(--accent); box-shadow: 0 7px 0 var(--accent-side), 0 10px 0 var(--shadow); }
.gm-gifts ul { margin: 0; padding: 0; list-style: none; }
.gm-gifts li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.gm-gifts li + li { border-top: 2px solid rgba(42, 48, 70, .14); }
.gm-gifts small { display: block; font-size: 12.5px; font-weight: 700; color: rgba(42, 48, 70, .7); }
.gm-gifts b { display: block; font-size: 15.5px; line-height: 1.2; }
/* Un cadeau à ouvrir : un gros bouton, tout le paquet se touche. Ouvert, il montre ce qu'il contenait. */
.gm-gifts .gm-presents li { padding: 5px 0; }
.gm-gifts .gm-presents li + li { border-top: 0; }
.gm button.gm-present {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 6px 12px; text-align: left;
  color: var(--ink); background: #fff; border-radius: 14px; box-shadow: 0 5px 0 rgba(42, 48, 70, .22);
  animation: gm-beat 1.9s ease-in-out infinite;
}
.gm button.gm-present:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(42, 48, 70, .22); animation: none; }
.gm-gifts .gm-presents li.opened { animation: gm-open .32s ease-out; }
@keyframes gm-open { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .gm button.gm-present, .gm-gifts .gm-presents li.opened { animation: none; } }

/* Les deux poches : des ronds sombres, comme ceux du jeu. Vide, la poche n'est qu'un contour. */

.gm-goodie { display: flex; align-items: center; gap: 12px; }
.gm-goodie b { display: block; font-size: 16.5px; }
.gm-goodie small { display: block; margin-top: 3px; font-size: 13px; line-height: 1.25; color: var(--soft); }

/* Chaque powerup : son objet en cubes, ce qu'il fait, combien on en a, et ses deux boutons. */
.gm-items { margin: 0 0 18px; padding: 0; list-style: none; }
.gm-item {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 12px; row-gap: 8px; align-items: center;
  margin: 0 0 12px; padding: 12px 14px 6px; border-radius: 22px; background: #fff; box-shadow: 0 7px 0 var(--shadow);
}
.gm-item .what b { display: inline; margin-right: 6px; font-size: 16.5px; font-weight: 700; line-height: 1.15; }
.gm-item .what small { display: block; margin-top: 4px; font-size: 13.5px; line-height: 1.25; color: var(--soft); }
.gm-item .acts { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.gm-item .acts .have { margin-right: auto; padding-left: 4px; display: flex; align-items: center; }
.gm-item .acts .have.none { opacity: .3; }
.gm-item .acts .price { display: flex; align-items: center; gap: 6px; padding: 0 4px 8px; }
.gm-item.none .pic .gi { opacity: .55; }
.gm-rarity {
  display: inline-block; padding: 1px 8px 2px; border-radius: 9px; font-size: 11.5px; font-weight: 700; vertical-align: 2px;
  background: #e3e5ee; color: var(--ink);
}
.gm-rarity.peu_courant { background: #cfe6ff; color: #1d4f8c; }
.gm-rarity.rare { background: var(--purple); color: #fff; }

/* Peu de hauteur (téléphone couché) : on serre l'en-tête pour laisser la place au contenu. */
@media (max-height: 430px) {
  .gm-head { padding-top: calc(5px + env(safe-area-inset-top, 0px)); padding-bottom: 5px; }
  .gm-head h2 .gm-blocks { width: auto; height: 20px; }
  .gm-tabs { padding-bottom: 10px; }
  .gm-tab { min-height: 38px; }
  .gm-tab .gi { width: 22px !important; height: 22px !important; }
  .gm-title { display: none; }
}
/* Très étroit : deux badges de front, des sous-onglets et des lignes plus serrés. */
@media (max-width: 360px) {
  .gm-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gm-head h2 { gap: 9px; }
  .gm-head h2 .gm-blocks { width: auto; height: 22px; }
  .gm-tabs { gap: 5px; padding-left: calc(8px + env(safe-area-inset-left, 0px)); padding-right: calc(8px + env(safe-area-inset-right, 0px)); }
  .gm button.gm-tab { font-size: 13.5px; }
  .gm-tab .gi { width: 22px !important; height: 22px !important; }
  .gm-body { padding-left: calc(10px + env(safe-area-inset-left, 0px)); padding-right: calc(10px + env(safe-area-inset-right, 0px)); }
  .gm-list li { grid-template-columns: 30px 30px minmax(0, 1fr) auto; column-gap: 6px; padding-right: 8px; }
  .gm-card { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  #gm-sheet, #gm-sheet::before, .gm-dialog, .gi.bob, .gm-nav-item.gm-new .gm-nav-icon { animation: none; }
  #gm-bar, #gm-toast, .gm-status { transition: none; }
}
