/* ═══════════════════════════════════════════════════════════════════════════
   Haroun Fortune — la coque du site autour des jeux.

   Ce fichier n'habille PAS la machine à sous (elle a le sien, machine.css, repris
   de l'atelier) : il gère seulement ce qui appartient au site — la place laissée au
   jeu, la sortie, et le hub.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── en jeu ────────────────────────────────────────────────────────────────
   La scène du jeu fait 1920 × 1080 et se met à l'échelle d'un bloc. On lui donne
   la fenêtre entière : topbar, drawer et fond du site s'effacent. */
body.ft-enjeu {
  overflow: hidden;
  background: #0a0a1a;
  overscroll-behavior: none;
}
body.ft-enjeu .topbar,
body.ft-enjeu .drawer,
body.ft-enjeu .drawer-backdrop { display: none !important; }

/* `inset: 0` seul retombe sur le viewport de mise en page, plus haut que la zone
   réellement visible quand la barre d'adresse du mobile est déployée : le bas du HUD
   passait alors dessous. `100dvh` suit la hauteur vraiment visible. */
.ft-machine {
  position: fixed; inset: 0; z-index: 1;
  height: 100vh;
  height: 100dvh;
}

/* Le ✕ vit hors de la scène pour rester lisible quel que soit le facteur
   d'échelle — à 0,42 d'échelle, un bouton dessiné dans la scène ferait 12 px. */
.ft-sortie {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 60;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-size: 17px; line-height: 1;
  color: #e8d9b5;
  border: 1px solid rgba(212, 168, 67, .45);
  border-radius: 999px;
  background: rgba(10, 10, 26, .72);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .18s;
}
.ft-sortie:hover { background: rgba(90, 20, 35, .8); border-color: rgba(212, 168, 67, .8); }
.ft-sortie:active { transform: scale(.94); }

/* ── le jeton ──────────────────────────────────────────────────────────────
   L'icône des pyramides, partout où un montant s'affiche. Son URL vient du réglage
   admin (`fortune_jeton_icone_url`), posée en variable CSS par core/money.js — on
   ne code donc aucun chemin en dur ici.

   L'EFFET est ici et non cuit dans l'image, à dessein : une lueur peinte dans le
   PNG serait figée et écraserait le dessin dès qu'on descend sous trente pixels,
   alors qu'une ombre portée CSS se calcule à la taille réellement affichée. Elle
   suit donc le texte, du petit compteur du HUD au grand titre de jackpot. */
.jeton {
  display: inline-block;
  width: 1.2em;
  height: .9em;
  vertical-align: -.08em;
  background: var(--ft-jeton-img, none) center / contain no-repeat;
  filter: drop-shadow(0 0 .22em rgba(232, 178, 74, .5));
  animation: ft-jeton-souffle 3.6s ease-in-out infinite;
}
/* Repli quand aucune icône n'est configurée : le glyphe, avec la même lueur. */
.jeton--texte {
  width: auto; height: auto;
  background: none;
  color: #e8be5a;
}

@keyframes ft-jeton-souffle {
  0%, 100% { filter: drop-shadow(0 0 .18em rgba(232, 178, 74, .42)); }
  50%      { filter: drop-shadow(0 0 .40em rgba(255, 214, 130, .78)); }
}

/* La respiration est un ornement : on la coupe pour qui l'a demandé. */
@media (prefers-reduced-motion: reduce) {
  .jeton { animation: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LE TEMPLE (/fortune)

   Le site fournit la palette (or sur bordeaux sombre) et la police de texte ;
   la page apporte Playfair Display, déjà chargée pour la machine, pour ses titres.
   Elles appartiennent au même lieu.
   ═══════════════════════════════════════════════════════════════════════════ */

.ft-hub {
  max-width: 560px; margin: 0 auto; padding: 16px 14px 64px;
  position: relative;
}
.ft-hub::before {
  /* Le temple derrière TOUTE la page, fixe : on reste dans la même pièce pendant
     qu'on fait défiler. Le flou et l'assombrissement sont CUITS dans l'image (sharp,
     `dev/`), pas faits en `filter: blur()` — un filtre sur un élément plein écran se
     recalcule à chaque repaint et ça se sent sur un téléphone.
     Le voile par-dessus garde le texte lisible : sans lui, les halos de torche
     passent sous les chiffres du classement. */
  content: ''; position: fixed; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(16, 7, 8, .34) 0%, rgba(16, 7, 8, .6) 46%, rgba(16, 7, 8, .84) 100%),
    #100708 url('/assets/fortune/fond-temple.webp') center / cover no-repeat;
  pointer-events: none;
}
@media (max-width: 700px) {
  .ft-hub::before { background-image:
    linear-gradient(180deg, rgba(16, 7, 8, .34) 0%, rgba(16, 7, 8, .6) 46%, rgba(16, 7, 8, .84) 100%),
    url('/assets/fortune/fond-temple-800w.webp'); }
}
.ft-attente, .ft-vide {
  text-align: center; color: var(--text-muted); padding: 26px 10px;
  font-size: 13.5px; font-style: italic;
}

.ft-tete { text-align: center; padding: 10px 0 22px; }

/* ── l'en-tête : deux lignes, et on passe à ce qu'on vient faire ──────────── */
.ft-entete { padding: 18px 0 20px; }
.ft-entete .ft-titre { font-size: clamp(26px, 7.5vw, 34px); margin-bottom: 6px; }
.ft-entete .ft-accroche { font-size: 13.5px; max-width: 44ch; }

}
.ft-titre {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 900; font-size: clamp(30px, 9vw, 42px); line-height: 1.05;
  margin: 0 0 10px;
  background: linear-gradient(180deg, #f5d98a, #c78f3c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ft-accroche { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.55; }

.ft-section {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 19px; font-weight: 700; color: var(--gold);
  margin: 30px 0 12px; letter-spacing: .01em;
}

/* ── la jauge-pyramide ─────────────────────────────────────────────────────
   Trois étages remplis du bas vers le haut, découpés par le masque du SVG. Elle
   garde la silhouette du jeton : la jauge et la monnaie sont le même objet. */
.ft-jauge__vide {
  fill: rgba(255, 247, 232, .055);
  stroke: rgba(212, 165, 116, .22); stroke-width: 1.5;
}
.ft-jauge__plein { fill: url(#ft-or); }
.ft-jauge g { animation: ft-souffle 4s ease-in-out infinite; transform-origin: center; }
@keyframes ft-souffle { 0%, 100% { opacity: .93; } 50% { opacity: 1; } }

/* ── les boutons ───────────────────────────────────────────────────────────
   Un seul bouton plein par écran : celui qu'on veut voir cliqué. Les autres sont
   des liens (.ft-lien) — un bouton secondaire plein entre en concurrence avec le
   principal et on ne sait plus où regarder. */
.ft-bouton {
  display: inline-block; border: none; cursor: pointer;
  padding: 9px 20px; border-radius: 999px;
  background: linear-gradient(180deg, #f0d9a8, #d4a574);
  color: #2a1418; text-decoration: none;
  font: 700 13px/1.2 Inter, system-ui, sans-serif;
  box-shadow: 0 2px 12px rgba(212, 165, 116, .22);
  transition: filter .18s, transform .12s, box-shadow .18s;
}
.ft-bouton:hover { filter: brightness(1.07); box-shadow: 0 3px 16px rgba(212, 165, 116, .32); }
.ft-bouton:active { transform: scale(.97); }
.ft-bouton--calme {
  background: none; color: var(--gold-light);
  border: 1px solid rgba(212, 165, 116, .38); box-shadow: none;
}
/* Éteint mais CLIQUABLE : un bouton désactivé ne dit rien, celui-ci explique. */
.ft-bouton--eteint {
  background: rgba(255, 247, 232, .07); color: var(--text-muted); box-shadow: none;
}
.ft-bouton--petit { padding: 6px 14px; font-size: 12px; }

/* ── le filet de secours ───────────────────────────────────────────────────── */
.ft-filet {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 9px; padding: 9px 13px;
  border: 1px dashed rgba(212, 165, 116, .26); border-radius: 11px;
  color: var(--text-dim); font-size: 12.5px;
}

/* ── le pupitre : ton état et LA chose à faire, dans un seul bloc ──────────
   La pyramide reste la jauge — elle dit d'un coup d'œil où on en est — et le texte
   à côté donne le chiffre exact, qu'elle ne dit pas. Deux rôles, pas de doublon. */
.ft-pupitre {
  display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: center;
  padding: 15px 16px;
  border: 1px solid rgba(212, 165, 116, .2); border-radius: 14px;
  background: linear-gradient(165deg, rgba(90, 20, 35, .5), rgba(16, 7, 8, .82));
  backdrop-filter: blur(3px);
}
.ft-pupitre--ouvert { border-color: rgba(212, 165, 116, .42); }
.ft-pupitre .ft-jauge { width: 72px; height: auto; display: block; }
.ft-pupitre__dire { min-width: 0; }
.ft-pupitre__solde {
  margin: 0 0 3px; display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 900; font-size: clamp(25px, 7vw, 31px); color: var(--gold-light);
  line-height: 1; font-variant-numeric: tabular-nums;
}
.ft-pupitre__rang {
  font-family: Inter, system-ui, sans-serif; font-weight: 500;
  font-size: 11.5px; color: var(--text-muted); letter-spacing: .02em;
}
.ft-pupitre__note { margin: 0 0 11px; color: var(--text-dim); font-size: 12.5px; line-height: 1.5; }
.ft-pupitre__note b { color: var(--gold-light); }
.ft-pupitre__actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* Le lien discret : les actions secondaires ne doivent pas concurrencer la principale. */
.ft-lien {
  border: none; background: none; padding: 0; cursor: pointer;
  font: 600 12.5px/1.2 Inter, system-ui, sans-serif; color: var(--gold);
  text-decoration: underline; text-underline-offset: 3px;
}
.ft-lien:hover { color: var(--gold-light); }
.ft-lien--eteint { color: var(--text-muted); }
.ft-filet--vide {
  margin: 10px 0 0; text-align: center; color: var(--text-muted);
  font-size: 12.5px; font-style: italic;
}

/* ── la porte du hall ──────────────────────────────────────────────────────
   Une seule chose à faire sur cette page : entrer. La carte du jeu prend donc
   toute la largeur, porte une vraie image et non une vignette, et son nom se pose
   dessus comme une enseigne au-dessus d'un seuil. */
/* ── la porte : une vraie tuile de jeu, mais qui ne mange pas l'écran ──────
   L'image en fond plein cadre (la porte dorée est au centre, les sphinx aux bords),
   le texte posé dessus sur un dégradé. 152 px : assez pour donner envie, dix fois
   moins qu'une bannière 16/10 qui repoussait tout le reste sous la ligne. */
.ft-porte {
  position: relative; display: block; overflow: hidden;
  margin-top: 12px; height: 172px;
  border: 1px solid rgba(212, 165, 116, .22); border-radius: 14px;
  text-decoration: none; color: inherit;
  transition: border-color .2s, transform .2s;
}
.ft-porte:hover { border-color: rgba(212, 165, 116, .55); }
.ft-porte:hover .ft-porte__image { transform: scale(1.05); }
.ft-porte:active { transform: scale(.995); }
.ft-porte__image {
  position: absolute; inset: 0;
  background: #100708 url('/assets/fortune/porte-machine.webp') center right / cover no-repeat;
  transition: transform .5s ease-out;
}
/* Le voile vient de la GAUCHE, parce que l'image a été composée pour ça : la machine
   flamboie à droite, la salle s'enfonce dans le noir à gauche. Sans lui, le titre doré
   se perdrait dans l'or de la machine. */
.ft-porte::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(16, 7, 8, .93) 0%, rgba(16, 7, 8, .72) 34%, rgba(16, 7, 8, .12) 66%, transparent 100%),
    linear-gradient(0deg, rgba(16, 7, 8, .5) 0%, transparent 45%);
}
.ft-porte__dedans {
  position: absolute; left: 17px; top: 22px; right: 48%; z-index: 1;
}
.ft-porte__nom {
  display: block; font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700; font-size: clamp(18px, 5vw, 22px); color: #ffeec8;
  line-height: 1.1; text-shadow: 0 2px 10px rgba(0, 0, 0, .85);
}
.ft-porte__dire {
  display: block; margin-top: 5px; color: #e4d3bb; font-size: 12.5px; line-height: 1.4;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .9);
}
@media (max-width: 700px) {
  .ft-porte__image { background-image: url('/assets/fortune/porte-machine-800w.webp'); }
  .ft-porte__dedans { right: 42%; }
}
/* Le bouton passe à GAUCHE avec le titre : posé sur la machine, un jeton doré sur
   de l'or ne se voit plus. */
.ft-porte__cta {
  position: absolute; left: 17px; bottom: 18px; z-index: 1;
  padding: 9px 20px; border-radius: 999px;
  background: linear-gradient(180deg, #f0d9a8, #d4a574); color: #2a1418;
  font-weight: 700; font-size: 13px; white-space: nowrap;
  box-shadow: 0 3px 14px rgba(0, 0, 0, .5);
}

.ft-cags { margin-top: 22px; }
.ft-etiquette {
  margin: 0 0 8px; font-family: Inter, system-ui, sans-serif;
  font-size: 11px; font-weight: 600; letter-spacing: .15em; text-transform: uppercase;
  color: var(--text-muted);
}
.ft-cags__liste {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px;
}
.ft-cag {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 8px 11px 8px 12px;
  border: 1px solid rgba(212, 165, 116, .14); border-left: 3px solid var(--teinte);
  border-radius: 9px; background: rgba(16, 7, 8, .72); backdrop-filter: blur(3px);
}
/* La couleur du palier suffit à faire le lien avec le jeu — un filet, pas une enseigne. */
.ft-cag--mini  { --teinte: #2f9e78; }
.ft-cag--minor { --teinte: #4a6ede; }
.ft-cag--major { --teinte: #a066d8; }
.ft-cag--grand { --teinte: #d1495b; }
.ft-cag__nom { font-size: 11.5px; color: var(--text-muted); }
.ft-cag__val {
  display: inline-flex; align-items: baseline; gap: 5px;
  font-weight: 700; font-size: 14.5px; color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}
/* Quatre de front seulement quand la place existe : sous 560 px, la puce tombe à
   ~92 px et « Grand 25 699 ▲ » n'y tient pas. Deux par deux, tout respire. */
@media (min-width: 560px) { .ft-cags__liste { grid-template-columns: repeat(4, 1fr); } }

/* ── les périodes du classement ────────────────────────────────────────────── */
.ft-tableau__dire {
  margin: 0 0 12px; color: var(--text-muted); font-size: 12.5px; line-height: 1.55;
}
.ft-periodes { display: flex; gap: 6px; margin: 0 0 10px; flex-wrap: wrap; }
.ft-periode {
  border: 1px solid rgba(212, 165, 116, .22); background: none; cursor: pointer;
  padding: 6px 12px; border-radius: 999px;
  font: 600 11.5px/1.2 Inter, system-ui, sans-serif; color: var(--text-muted);
  transition: background .18s, color .18s, border-color .18s;
}
.ft-periode:hover { color: var(--text); border-color: rgba(212, 165, 116, .5); }
.ft-periode.is-actif {
  background: var(--bordeaux); color: var(--gold-light); border-color: transparent;
}
.ft-rang em {
  font-style: normal; color: var(--text-muted); font-size: 12px;
  min-width: 62px; text-align: right; font-variant-numeric: tabular-nums;
}
.ft-monrang {
  margin: 12px 0 0; padding-top: 11px; border-top: 1px solid rgba(212, 165, 116, .14);
  text-align: center; color: var(--text-dim); font-size: 12.5px;
}
.ft-monrang b { color: var(--gold-light); }

/* ── les classements : trois onglets, un seul bloc ─────────────────────────
   Les plus riches (solde vivant), les gros coups (4 périodes) et les derniers
   gains sont la même question — « qui gagne ici ? » — posée à trois échelles.
   Trois sections séparées, c'était trois fois le même titre. */
.ft-tableaux { margin-top: 26px; }
.ft-onglets {
  display: flex; gap: 6px; padding: 4px;
  background: rgba(16, 7, 8, .72); backdrop-filter: blur(3px);
  border-radius: 999px; margin-bottom: 12px;
}
.ft-onglet {
  flex: 1; border: none; background: none; cursor: pointer;
  padding: 8px 10px; border-radius: 999px;
  font: 600 12.5px/1.2 Inter, system-ui, sans-serif; color: var(--text-muted);
  transition: background .18s, color .18s;
}
.ft-onglet:hover { color: var(--text); }
.ft-onglet.is-actif { background: var(--bordeaux); color: var(--gold-light); }
.ft-onglet:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.ft-liste {
  list-style: none; margin: 0; padding: 2px 4px;
  background: rgba(16, 7, 8, .68); backdrop-filter: blur(3px);
  border-radius: 12px;
}
.ft-rang {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-bottom: 1px solid rgba(212, 165, 116, .1);
  font-size: 13.5px;
}
.ft-rang:last-child { border-bottom: none; }
.ft-rang i {
  flex-shrink: 0; width: 22px; font-style: normal; font-weight: 700;
  color: var(--text-muted); font-size: 12px; text-align: right;
}
/* Les trois premiers portent l'or : le classement se lit d'un coup d'œil. */
.ft-rang:nth-child(1) i, .ft-rang:nth-child(2) i, .ft-rang:nth-child(3) i { color: var(--gold); }
.ft-rang span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-rang b { color: var(--gold-light); font-variant-numeric: tabular-nums; }
.ft-rang em {
  font-style: normal; color: var(--text-muted); font-size: 12px;
  min-width: 62px; text-align: right; font-variant-numeric: tabular-nums;
}
.ft-rang--moi { background: rgba(122, 58, 93, .3); border-radius: 8px; }

.ft-tableau { min-height: 60px; }
.ft-tableau__dire { margin: 0 0 10px; color: var(--text-muted); font-size: 12.5px; line-height: 1.55; }
.ft-monrang {
  margin: 10px 0 0; text-align: center; color: var(--text-dim); font-size: 12.5px;
}
.ft-monrang b { color: var(--gold-light); }

/* ── les modales ───────────────────────────────────────────────────────────
   Deux moments seulement : quand l'échange est impossible (dire ce qui manque)
   et juste avant d'échanger (dire ce que ça coûte au classement). */
.ft-modale {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 18px;
  background: rgba(8, 4, 5, .82); backdrop-filter: blur(4px);
  animation: ft-apparait .16s ease-out;
}
@keyframes ft-apparait { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ft-modale { animation: none; } }
.ft-modale__boite {
  width: 100%; max-width: 420px; padding: 22px;
  border: 1px solid rgba(212, 165, 116, .3); border-radius: 16px;
  background: linear-gradient(165deg, rgba(48, 16, 24, .97), rgba(16, 7, 8, .98));
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
}
.ft-modale__titre {
  margin: 0 0 12px; font-family: 'Playfair Display', Georgia, serif;
  font-size: 21px; font-weight: 700; color: var(--gold-light);
}
.ft-modale__corps p { margin: 0 0 10px; color: var(--text-dim); font-size: 13.5px; line-height: 1.6; }
.ft-modale__corps b { color: var(--gold-light); }
.ft-modale__alerte { color: #e0a96d !important; }
.ft-modale__note { color: var(--text-muted) !important; font-size: 12.5px !important; }
.ft-modale__pied { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ── les annonces (récupération, échange) ──────────────────────────────────── */
.ft-annonce {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 10px;
  background: rgba(46, 125, 90, .22); border: 1px solid rgba(46, 125, 90, .45);
  color: #b8e6cd; font-size: 13px; text-align: center;
}
.ft-annonce--erreur {
  background: rgba(125, 46, 46, .22); border-color: rgba(180, 70, 70, .45); color: #f0bcbc;
}

/* ── la FAQ ────────────────────────────────────────────────────────────────
   Repliée par défaut : quatorze questions ouvertes noieraient la page. Le chevron
   est en CSS pur — pas de JS pour un comportement que <details> sait déjà faire. */
.ft-faq { margin-top: 26px; }
.ft-q {
  border-bottom: 1px solid rgba(212, 165, 116, .12);
}
.ft-q:first-of-type { border-top: 1px solid rgba(212, 165, 116, .12); }
.ft-q__titre {
  list-style: none; cursor: pointer;
  padding: 11px 28px 11px 2px; position: relative;
  font-weight: 600; font-size: 13.5px; color: var(--text);
  transition: color .18s;
}
.ft-q__titre::-webkit-details-marker { display: none; }
.ft-q__titre::after {
  content: ''; position: absolute; right: 6px; top: 50%;
  width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold);
  transform: rotate(45deg); transition: transform .22s;
}
.ft-q[open] .ft-q__titre { color: var(--gold-light); }
.ft-q[open] .ft-q__titre::after { transform: rotate(-135deg); margin-top: -2px; }
.ft-q__titre:hover { color: var(--gold-light); }
.ft-q__corps p {
  margin: 0; padding: 0 30px 16px 2px;
  color: var(--text-dim); font-size: 13.5px; line-height: 1.65;
}
.ft-q__corps b { color: var(--gold-light); font-weight: 600; }


/* ── le pied du hub : une porte vers la FAQ, qui vit sur sa propre page ────── */
.ft-pied { margin: 22px 0 0; text-align: center; }

/* ── la page des questions (/fortune/questions) ────────────────────────────── */
.ft-questions .ft-entete { padding-top: 22px; }
.ft-questions .ft-etiquette { margin-bottom: 7px; }
.ft-questions .ft-faq { margin-top: 18px; }
.ft-retour { margin: 26px 0 0; text-align: center; }


/* ── la jauge d'echange (dans la modale) ───────────────────────────────────
   Par pas d'un diamant. Tout convertir d'un coup viderait la reserve — donc la
   place au classement — alors que le joueur ne veut souvent en prendre qu'une part. */
.ft-jauge-echange { margin: 0 0 12px; }
.ft-jauge-echange input[type=range] {
  width: 100%; margin: 4px 0 10px;
  accent-color: #d4a574; cursor: pointer;
}
.ft-jauge-echange__lecture {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 0 !important; font-size: 16px !important; color: var(--text) !important;
}
.ft-jauge-echange__lecture b { color: var(--gold-light); font-variant-numeric: tabular-nums; }
.ft-jauge-echange__fleche { color: var(--text-muted); }
