/* ═══════════════════════════════════════════════════════════════════════════
   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 {
  content: ''; position: absolute; inset: -60px -40px auto; height: 340px; z-index: -1;
  background:
    radial-gradient(60% 70% at 50% 0%, rgba(212, 165, 116, .13), transparent 70%),
    radial-gradient(90% 60% at 50% 10%, rgba(90, 20, 35, .3), transparent 72%);
  pointer-events: none;
}
.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; }
.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;
}

/* ── le coffre : la pyramide sert de jauge ─────────────────────────────────
   Le jeton du site EST une pyramide à trois étages. La réserve la remplit donc
   du socle au sommet, et le sommet s'allume au seuil d'échange : la jauge dit du
   même coup où on en est ET de quoi on parle. */
.ft-coffre {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(150deg, #1d0f10, #150a0c 60%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 18px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
}
.ft-coffre--ouvert { border-color: rgba(212, 165, 116, .5); }

.ft-jauge { flex-shrink: 0; width: 104px; height: 81px; overflow: visible; }
.ft-jauge__vide { fill: rgba(255, 247, 232, .07); stroke: rgba(212, 165, 116, .3); stroke-width: 1; }
.ft-jauge__plein { fill: url(#ft-or); }
.ft-coffre--ouvert .ft-jauge { filter: drop-shadow(0 0 9px rgba(232, 178, 74, .55)); }
/* Le remplissage monte une fois, au chargement : un seul mouvement, pas une agitation. */
.ft-jauge g { animation: ft-monter .9s cubic-bezier(.22, 1, .36, 1) both; transform-origin: 50% 100%; }
@keyframes ft-monter { from { transform: scaleY(0); opacity: .2; } to { transform: scaleY(1); opacity: 1; } }

.ft-coffre__dire { flex: 1; min-width: 0; }
.ft-coffre__etiquette {
  margin: 0 0 2px; font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-muted);
}
.ft-coffre__solde {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 30px; font-weight: 900; color: var(--gold-light);
  margin: 0 0 4px; line-height: 1.1;
  display: flex; align-items: center; gap: .3em;
}
.ft-coffre__ligne { margin: 0 0 12px; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.ft-coffre__ligne b { color: var(--gold-light); }
.ft-coffre__note { margin: 10px 0 0; font-size: 11.5px; color: var(--text-muted); }
.ft-coffre__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Le filet de secours : une ligne discrète sous le coffre, qui n'apparaît qu'à sec.
   Elle ne doit jamais avoir l'air d'une offre — c'est un dépannage. */
.ft-filet {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 10px; padding: 11px 14px;
  border: 1px dashed rgba(212, 165, 116, .3); border-radius: 14px;
  background: rgba(255, 247, 232, .03);
  font-size: 12.5px; color: var(--text-dim); line-height: 1.45;
}
.ft-filet span { flex: 1; min-width: 200px; }
.ft-filet b { color: var(--gold-light); }
.ft-filet--vide { border-style: solid; opacity: .72; font-style: italic; }

.ft-bouton {
  display: inline-block; border: none; cursor: pointer;
  padding: 10px 20px; border-radius: 999px;
  font: 700 13.5px/1 Inter, system-ui, sans-serif;
  color: #2a1206; background: linear-gradient(180deg, #f1d3a7, #d4a574);
  text-decoration: none;
  transition: transform .16s, box-shadow .16s, filter .16s;
}
.ft-bouton:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(212, 165, 116, .3); }
.ft-bouton:active { transform: translateY(0); }
.ft-bouton:focus-visible,
.ft-onglet:focus-visible,
.ft-porte:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 3px; }
.ft-bouton:disabled { filter: grayscale(.6) brightness(.7); cursor: not-allowed; transform: none; box-shadow: none; }
/* Action secondaire : présente, mais elle ne dispute pas la vedette à l'action du jour. */
.ft-bouton--calme {
  color: var(--gold-light); background: none;
  border: 1px solid rgba(212, 165, 116, .45);
}
.ft-bouton--calme:hover { background: rgba(212, 165, 116, .1); box-shadow: none; }
.ft-bouton--petit { padding: 7px 15px; font-size: 12.5px; }
/* Éteint, mais PAS désactivé : le clic doit répondre. Un bouton `disabled` ne dit
   rien du tout ; celui-ci ouvre la modale qui explique ce qui manque. */
.ft-bouton--eteint {
  background: rgba(255, 247, 232, .1); color: var(--text-muted);
  box-shadow: none;
}
.ft-bouton--eteint:hover { background: rgba(255, 247, 232, .16); transform: none; box-shadow: none; }

/* ── 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. */
.ft-porte {
  position: relative; display: block; overflow: hidden;
  text-decoration: none; color: var(--text);
  border-radius: 20px;
  border: 1px solid rgba(212, 165, 116, .28);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
  aspect-ratio: 16 / 10;
  transition: border-color .22s, transform .22s, box-shadow .22s;
}
.ft-porte:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 22px 54px rgba(0, 0, 0, .62); }

.ft-porte__image {
  position: absolute; inset: 0;
  background: url('/assets/fortune/hall.webp?v=2') center top / cover no-repeat, #241014;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1);
}
.ft-porte:hover .ft-porte__image { transform: scale(1.045); }

/* Le voile sert la LISIBILITÉ, pas la décoration : le texte s'assoit dessus. */
.ft-porte__voile {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(16, 7, 8, 0) 42%, rgba(16, 7, 8, .78) 74%, rgba(16, 7, 8, .96) 100%);
}
.ft-porte__dedans { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 18px 18px; }
.ft-porte__nom {
  display: block; font-family: 'Playfair Display', Georgia, serif;
  font-weight: 900; font-size: clamp(21px, 6vw, 27px); line-height: 1.1;
  color: var(--gold-light); margin-bottom: 6px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .8);
}
.ft-porte__dire {
  display: block; color: #f0e2cd; font-size: 13px; line-height: 1.5;
  max-width: 44ch; margin-bottom: 12px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .95), 0 0 22px rgba(0, 0, 0, .7);
}
.ft-porte__cta {
  display: inline-block; padding: 9px 24px; border-radius: 999px;
  font-size: 13.5px; font-weight: 700; color: #2a1206;
  background: linear-gradient(180deg, #f1d3a7, #d4a574);
  box-shadow: 0 6px 18px rgba(212, 165, 116, .34);
}

/* ── les classements ───────────────────────────────────────────────────── */
.ft-tableaux { margin-top: 30px; }
.ft-onglets {
  display: flex; gap: 6px; padding: 4px;
  background: rgba(255, 247, 232, .04); 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.is-actif { background: var(--bordeaux); color: var(--gold-light); }

.ft-liste { list-style: none; margin: 0; padding: 0; }
.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;
}
.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--moi { background: rgba(122, 58, 93, .22); border-radius: 8px; }
/* Les trois premiers portent l'or : le classement se lit d'un coup d'oeil. */
.ft-rang:nth-child(1) i, .ft-rang:nth-child(2) i, .ft-rang:nth-child(3) i { color: var(--gold); }

/* ── les règles ────────────────────────────────────────────────────────── */
.ft-regle ul { margin: 0; padding-left: 18px; }
.ft-regle li { color: var(--text-dim); font-size: 13px; line-height: 1.6; margin-bottom: 9px; }
.ft-regle b { color: var(--gold-light); }

/* ── annonces ──────────────────────────────────────────────────────────── */
.ft-annonce {
  margin: 0 0 12px; padding: 11px 14px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600;
  color: #0f2b16; background: linear-gradient(180deg, #7fe0a1, #46b76e);
}
.ft-annonce--erreur { color: #3a0d0d; background: linear-gradient(180deg, #f3b0a6, #d9705f); }

@media (prefers-reduced-motion: reduce) {
  .ft-jauge g { animation: none; }
  .ft-porte, .ft-porte__image, .ft-bouton { transition: none; }
}

[hidden] { display: none !important; }


/* ── 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). Ailleurs, le
   joueur n'a pas à cliquer pour comprendre. */
.ft-modale {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 18px;
  background: rgba(8, 4, 5, .78);
  backdrop-filter: blur(4px);
  animation: ft-modale-entree .2s ease-out;
}
@keyframes ft-modale-entree { from { opacity: 0; } to { opacity: 1; } }

.ft-modale__boite {
  width: 100%; max-width: 400px;
  padding: 22px 20px 18px;
  border: 1px solid rgba(212, 165, 116, .42);
  border-radius: 18px;
  background: linear-gradient(150deg, #22110f, #160b0c 65%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .66);
}
.ft-modale__titre {
  margin: 0 0 12px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px; font-weight: 900; color: var(--gold-light);
}
.ft-modale__corps p { margin: 0 0 10px; font-size: 14px; line-height: 1.55; color: var(--text-dim); }
.ft-modale__corps b { color: var(--gold-light); }
.ft-modale__note { font-size: 12.5px !important; color: var(--text-muted) !important; }
.ft-modale__alerte {
  padding: 10px 12px; border-radius: 11px;
  border: 1px solid rgba(212, 165, 116, .26);
  background: rgba(212, 165, 116, .08);
  font-size: 13px !important;
}
.ft-modale__pied { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }

@media (prefers-reduced-motion: reduce) { .ft-modale { animation: none; } }


/* ── La jauge d'échange ────────────────────────────────────────────────────
   Par pas d'un diamant. Tout convertir d'un coup viderait la réserve — donc la
   place au classement — alors que le joueur veut souvent n'en prendre qu'une part. */
.ft-jauge-echange { margin: 0 0 12px; }
.ft-jauge-echange input[type=range] {
  width: 100%; margin: 4px 0 8px;
  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); }
