/* css/base.css — socle commun a TOUT le site (jeu + accueil statique) : reset, variables (:root,
   palette claire/sombre, tailles, ombres), typographie generale (h1-h3, p, liens), systeme de boutons
   (.btn et variantes), focus clavier, utilitaires (.muted/.hidden/.only-desk/.only-mobile), petits
   composants partages (.bar barre de progression, .dots, .fx, .px/.pxi images pixel-art), animations
   reutilisees (fadeIn) et le systeme de curseurs personnalises pixel-art (survol souris fine).
   Issu du decoupage de l'ancien style.css (reorganisation pure, V13.12). */

/* LE GOUFFRE : feuille de style V4 (mobile first, app shell plein écran).
   Principe : html/body ne défilent jamais. #app est une grille 100dvh (haut / contenu / bas).
   Seules certaines zones internes (.scroll) défilent : Sanctuaire, Codex, journal, tiroirs.
   Points de rupture : mobile (défaut), paysage bas (max-height 520px), ordinateur (>= 1024px en paysage). */

/* ===================================================================================================
   SYSTEME DE BREAKPOINTS CANONIQUE (V13.13, audit responsive).
   Avant cet audit : 243 blocs @media répartis sur 34 combinaisons de seuils différentes (dispersion
   accidentelle de valeurs "magiques" copiées-collées). Principe retenu : mobile-first, un socle commun
   unique (aucun @media, styles de base valables à toutes les tailles), puis un petit nombre de paliers
   nommés réutilisés PARTOUT. N'ajouter un nouveau palier qu'en cas de vrai besoin de mise en page
   (une disposition qui change réellement), jamais par confort — et alors documenter pourquoi en
   commentaire à l'endroit où il est utilisé.

   Paliers retenus (du plus petit au plus grand écran) :
   - Socle mobile      : aucun @media — c'est la base, valable pour tous les écrans par défaut.
   - --bp-xs  (max-width: 479px)  : très petits téléphones — ajustements mineurs uniquement (padding,
     taille de police). Remplace les anciens seuils ponctuels 420px/430px/479px (fusionnés ici).
   - --bp-phone (max-width: 599px) : téléphone vs reste — LE seuil dominant côté "petit écran" (37
     occurrences avant l'audit). Sert aussi de seuil complémentaire à min-width:600px.
   - --bp-tablet (min-width: 900px) : bascule de certaines grilles (Sanctuaire, boutique) en 2 colonnes
     avant le seuil "ordinateur" complet — nécessaire car ces grilles restent lisibles dès 900px alors
     que la disposition générale de l'app (colonnes, barres) n'a besoin de changer qu'à 1024px.
   - --bp-tablet-max (max-width: 1023px) : complément du palier "ordinateur" ci-dessous — seuil dominant
     côté "pas encore ordinateur" (41 occurrences avant l'audit), utilisé pour les réglages tactiles/
     compacts (boutons pleine largeur, colonnes latérales masquées, etc.).
   - --bp-desktop (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) : LE seuil
     "ordinateur" dominant (65 occurrences avant l'audit) — bascule générale de l'app (plus de tabbar
     mobile, colonnes de jeu, tailles de cartes). Le double critère (paysage dès 1024px OU largeur
     1200px sans condition d'orientation) couvre aussi bien un écran d'ordinateur classique qu'une
     tablette en mode paysage.
   - --bp-wide (min-width: 1600px) : palier supplémentaire pour très grands écrans — laisse grandir
     davantage certains éléments (largeur du titre de la barre du haut, espacement de la tabbar) plutôt
     que de figer une largeur de contenu arbitraire. Conservé car un écran 1600px+ a réellement plus de
     place que le palier "ordinateur" de base ne l'exploite.

   Media features de CAPACITE (pas des breakpoints de taille, donc non fusionnés avec ce qui précède) :
   - (prefers-reduced-motion: reduce) : désactive/réduit les animations, sur toutes tailles d'écran.
   - (hover: hover) and (pointer: fine) : effets de survol réservés à la souris (jamais au tactile).
   - (pointer: coarse) / (hover: none) : réglages tactiles spécifiques (cibles plus grandes, etc).

   Paliers ponctuels CONSERVÉS ailleurs dans css/*.css car ils encodent un vrai changement de mise en
   page (et non un simple réglage cosmétique) — voir le commentaire local à chaque usage :
   - 700px / 1200px (combat.css, sheet.css) : nombre de colonnes d'une grille de cartes à 2 paliers
     distincts du palier "ordinateur" général.
   - 760px / 759px (marketing.css, combat.css) : les pages marketing basculent certaines grilles en
     2 colonnes avant le seuil "ordinateur" du jeu.
   - 899px (marketing.css) : complément exact de --bp-tablet (min-width: 900px).
   - 1280px (explore.css) : palier intermédiaire propre à la mise à l'échelle de la carte d'exploration,
     entre --bp-desktop (1024px) et --bp-wide (1600px).
   - 560px (layout.css, sheet.css) : bascule fonctionnelle de la barre d'action (empilement des boutons),
     pas un simple réglage cosmétique.
   =================================================================================================== */
:root { --gap: 10px; --top-h: 52px; --tab-h: 58px; --sprite: clamp(84px, 18dvh, 150px); --hero-portrait: clamp(72px, 13dvh, 150px); }
html:not(.dark) { --bg: #efe7d6; --bg-2: #e6dcc6; --panel: #fbf6ea; --panel-2: #f1e8d4; --line: #d3c6a8; --text: #231f1a; --shadow: 0 10px 24px rgba(60, 40, 10, .15); --gold-ink: #86610c; --ok-ink: #2c7a30; --accent-ink: color-mix(in srgb, var(--accent) 45%, #1b1712); --danger-ink: #a3212f; --atk-ink: #9e2c27; --def-ink: #28579c; --sta-ink: #6a3a9e; --e-1: 0 2px 0 rgba(60, 40, 10, .18); --e-2: 0 6px 18px rgba(60, 40, 10, .12); --e-3: 0 18px 48px rgba(60, 40, 10, .22); color-scheme: light; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { font-size: var(--fs-md); }
h1, h2, h3 { font-family: var(--font-title); font-weight: 600; letter-spacing: .03em; margin: 0; }
p { margin: 0; }
button { font: inherit; color: inherit; touch-action: manipulation; }
img { -webkit-user-drag: none; }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
/* ===== Boutons : bloc de référence (V12.35, audit U2). 4 variantes (primaire, secondaire, fantôme,
   danger) + doré réservé au pack de soutien ; 2 tailles (48 et 40 px) plus la taille courante (44 px). ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: 0 18px;
  border: 0; border-radius: var(--r-md); cursor: pointer; white-space: nowrap; font-family: var(--font-ui); font-size: var(--fs-md); font-weight: 700; letter-spacing: .01em; color: var(--text);
  --b1: color-mix(in srgb, var(--panel) 85%, #fff); --b2: var(--panel-2); --bs: color-mix(in srgb, var(--line) 85%, #000);
  background: linear-gradient(180deg, var(--b1), var(--b2));
  box-shadow: 0 3px 0 var(--bs), 0 6px 14px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: transform .08s, box-shadow .08s, filter .15s, opacity .15s; }
html.dark .btn { --b1: #3a3744; --b2: #2b2933; --bs: #121117; color: #f1ece3; box-shadow: 0 3px 0 var(--bs), 0 6px 14px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08); }
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--bs), 0 3px 8px rgba(0, 0, 0, .12); }
.btn:disabled { cursor: not-allowed; opacity: .5; filter: grayscale(.4); box-shadow: 0 2px 0 var(--bs); }
.btn-lg { min-height: 52px; padding: 0 24px; font-family: var(--font-title); font-size: var(--fs-lg); letter-spacing: .02em; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: var(--fs-sm); }
.btn-block { width: 100%; }
.btn-primary { --b1: color-mix(in srgb, var(--outfit, var(--accent)) 78%, #fff); --b2: var(--outfit, var(--accent)); --bs: color-mix(in srgb, var(--outfit, var(--accent)) 55%, #000);
  color: var(--outfit-ink, #14110d); font-family: var(--font-title); letter-spacing: .02em;
  box-shadow: 0 3px 0 var(--bs), 0 8px 18px color-mix(in srgb, var(--outfit, var(--accent)) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3); }
html.dark .btn-primary { --b1: color-mix(in srgb, var(--outfit, var(--accent)) 80%, #fff); --b2: var(--outfit, var(--accent)); --bs: color-mix(in srgb, var(--outfit, var(--accent)) 45%, #000); color: var(--outfit-ink, #14110d); }
.btn-primary img.pxi { filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .35)); }
.btn-danger { --b1: color-mix(in srgb, var(--danger) 80%, #fff); --b2: var(--danger); --bs: color-mix(in srgb, var(--danger) 55%, #000); color: #fff; }
html.dark .btn-danger { --b1: #ef6a72; --b2: #c93b45; --bs: #6e1d24; color: #fff; }
.btn-ghost, .btn-danger-ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line), 0 2px 0 color-mix(in srgb, var(--line) 70%, transparent); }
html.dark .btn-ghost { background: transparent; color: #f1ece3; box-shadow: inset 0 0 0 1.5px #55515f, 0 2px 0 rgba(0, 0, 0, .4); }
.btn-danger-ghost, html.dark .btn-danger-ghost { background: transparent; color: var(--danger-ink); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--danger) 55%, transparent), 0 2px 0 color-mix(in srgb, var(--danger) 30%, transparent); }
html.dark .btn-danger-ghost { color: #ff8a90; }
.btn-ghost:active:not(:disabled), .btn-danger-ghost:active:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-fast { animation: fastPulse 1.4s ease-in-out infinite; }
/* Focus clavier commun à tous les contrôles (audit u1) */
:where(button, a, input, select, textarea, summary, [role="tab"], [tabindex]):focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; border-radius: var(--r-sm); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.only-desk { display: none !important; }
.only-mobile { }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 7px; height: 7px; border-radius: 2px; background: var(--line); display: inline-block; }
.dots i.on { background: var(--accent); }
.dots i.boss { outline: 1px solid var(--danger); }
.dots i.boss.on { background: var(--danger); }
.bar { position: relative; height: 18px; border-radius: 9px; background: color-mix(in srgb, var(--line) 80%, transparent); overflow: hidden; min-width: 60px; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 9px; transition: width .35s ease-out; }
.bar > span { position: relative; display: block; text-align: center; font-size: var(--fs-xs); font-weight: 800; line-height: 18px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8); font-variant-numeric: tabular-nums; }
.fx { font-size: .85em; font-weight: 800; padding: .1em .35em; border-radius: 6px; background: rgba(0, 0, 0, .4); color: #fff; white-space: nowrap; display: inline-flex; align-items: center; }
html:not(.dark) .fx { background: rgba(35, 31, 26, .85); }
@keyframes fadeIn { from { opacity: 0; } }
/* ===== V6 : icônes pixel-art et roche façon démineur ===== */
img.pxi { width: 1.15em; height: 1.15em; image-rendering: pixelated; vertical-align: -0.2em; display: inline-block; flex: none; }
img.pxi.big { width: 2.4rem; height: 2.4rem; vertical-align: middle; }
img.pxi.huge { width: 3.2rem; height: 3.2rem; }
.fx img.pxi { width: 1.25em; height: 1.25em; margin-right: 1px; vertical-align: -0.12em; }
.num { pointer-events: none; }
.upg { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
/* ===== V6.8 : marges autour du contenu, révélation des rounds plus lisible ===== */
:root { --edge: 18px; --edge-b: 16px; }
/* ===== V6.9 : plateau de mini-cartes au-dessus du nom ===== */
:root { --mc-w: clamp(30px, 8.5vw, 40px); }
@media (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) { :root { --mc-w: clamp(40px, min(3.6vw, 7.5dvh), 96px); } }
/* ===== V9 : cartes plus petites, espacement égal zone de jeu / main / cartes au repos ===== */
:root { color-scheme: dark; --ink-dark: #1a1920; --weekly: #a58ad6; --text-on-dark: #ece6da; --on-gold: #2a1a00; --on-accent: #0f0e13; --sta-ink: #b88ae6; --def-ink: #7fa8e6; --atk-ink: #e07a74; --danger-ink: var(--danger); --z-screen-fx: 999; --z-coach: 70; --z-toast: 60; --z-sheet: 50; --z-overlay: 40; --z-bar: 30; --z-float: 5; --e-3: 0 18px 48px rgba(0, 0, 0, .5); --e-2: 0 6px 18px rgba(0, 0, 0, .28); --e-1: 0 2px 0 rgba(0, 0, 0, .35); --s-6: 32px; --s-5: 24px; --s-4: 16px; --s-3: 12px; --s-2: 8px; --s-1: 4px; --r-pill: 99px; --r-lg: 16px; --r-md: 12px; --r-sm: 6px; --fs-3xl: 32px; --fs-2xl: 24px; --fs-xl: 20px; --fs-lg: 17px; --fs-md: 15px; --fs-sm: 13px; --fs-xs: 12px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --font-title: "Pixelify Sans", "Courier New", monospace; --radius: 14px; --shadow: 0 10px 30px rgba(0, 0, 0, .45); --sta: #8a4fc4; --def: #3f79c9; --atk: #c9453f; --accent-ink: var(--accent); --ok-ink: var(--ok); --gold-ink: var(--gold); --gold: #e6c065; --ok: #6fbf73; --danger: #e0485a; --muted: #a39d92; --text: #ece6da; --line: #3a3744; --panel-2: #2a2833; --panel: #211f28; --bg-2: #1b1a21; --bg: #121116; --accent: #8FA9B8; }
@media (orientation: landscape) and (max-height: 520px) { :root { --tab-h: 48px; } }
html:not(.dark) { --muted: #5f574a; }
/* Fond : taches et fissures légères, teintées par la couleur du donjon actuel */
html { background: color-mix(in srgb, var(--bg) 93%, var(--dungeon, var(--accent)) 7%); }
body { user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; line-height: 1.4; font-family: var(--font-ui); color: var(--text); background: color-mix(in srgb, var(--bg) 93%, var(--dungeon, var(--accent)) 7%); position: relative; }
body::before, body::after { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; }
body::after {
  background: color-mix(in srgb, var(--dungeon, var(--accent)) 70%, var(--text));
  -webkit-mask: url("../data/ui/stains.png?v=203") repeat 0 0 / 800px 800px; mask: url("../data/ui/stains.png?v=203") repeat 0 0 / 800px 800px;
  opacity: .025;
}
body::before {
  background: color-mix(in srgb, var(--dungeon, var(--accent)) 55%, var(--text));
  -webkit-mask: url("../data/ui/cracks.png?v=203") repeat 0 0 / 520px 520px; mask: url("../data/ui/cracks.png?v=203") repeat 0 0 / 520px 520px;
  opacity: .06;
}
html.dark body::before { opacity: .03; background: color-mix(in srgb, var(--dungeon, var(--accent)) 60%, #fff); }
html.dark body::after { opacity: .015; background: color-mix(in srgb, var(--dungeon, var(--accent)) 70%, #fff); }
/* La lueur vit dans le contexte isolé de .combat : au-dessus de l'arène, SOUS l'overlay de résultat (z 40). */
:root { --z-fx: 35; }
/* ===== V12.3 : chiffres et joueur mieux intégrés à la salle ; en-tête de combat pleine largeur ===== */
.num { font-weight: 800; font-family: var(--font-title); font-variant-numeric: tabular-nums; place-items: center; display: grid; inset: 0; position: absolute; font-size: clamp(9px, calc(var(--tile) * .32), 22px); text-shadow: 1px 1px 0 rgba(0, 0, 0, .75); opacity: .9; }
.num.n1 { color: #3f7fc0; }
.num.n2 { color: #4f9a4c; }
.num.n3 { color: #c24a4a; }
.num.n4 { color: #8a5cc0; }
.num.n5 { color: #c07a2a; }
.num.n6 { color: #2f9a94; }
.num.n7, .num.n8 { color: #cfcfcf; }
html:not(.dark) .key-name { color: color-mix(in srgb, var(--kc) 50%, var(--ink-dark)) !important; }
/* ===== V12.14 : moins de défilement ===== */
/* Barres de défilement personnalisées partout (Chrome 121+ et Firefox utilisent les propriétés
   standard, qui l'emportent sur ::-webkit-scrollbar ; Safari garde les règles -webkit-). */
/* V12.19 : barres encore plus fines. Chrome, Edge et Safari : pseudo-éléments -webkit (4 px), qui ne
   s'appliquent que si scrollbar-width / scrollbar-color ne sont pas posés ; Firefox : « thin » (son minimum). */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 30%, transparent); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text) 50%, transparent); }
@supports (-moz-appearance: none) {
  * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 28%, transparent) transparent; }
}
a { color: var(--accent-ink); }
/* Plus aucune graisse 900 (non chargée) ni italique synthétique (audit M1) */
b, strong { font-weight: 700; }
.btn img.pxi { vertical-align: -.25em; }
/* Boutons désactivés distincts du bouton principal */
.btn:disabled, .btn[disabled] { opacity: .45; box-shadow: none; }
.play-heroes > .btn { align-self: flex-start; }
/* Pause de la descente : bouton secondaire sous les reliques (panneau latéral et tiroir Sac). */
.pause-run .btn { justify-content: center; gap: 6px; }
.pause-run .btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.pulse { animation: ffPulse 1.2s ease-in-out infinite; }
/* V12.43 : bouton principal d'une couleur fixe (or ambré), indépendant de la tenue ; désactivé en pointillé. */
:root { --cta: #E2A93B; --cta-hi: #EDBC5A; --cta-hover: #F0C567; --cta-ink: #1A1206; --cta-edge: #8A6116; }
.btn-primary, html.dark .btn-primary { --b1: var(--cta-hi); --b2: var(--cta); --bs: var(--cta-edge); color: var(--cta-ink);
  box-shadow: 0 3px 0 var(--bs), 0 8px 18px rgba(226, 169, 59, .28), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-primary:hover:not(:disabled), html.dark .btn-primary:hover:not(:disabled) { filter: none; --b1: #F4CD78; --b2: var(--cta-hover); }
.btn-primary img.pxi { filter: none; }
.btn:disabled, .btn[disabled], html.dark .btn:disabled, html.dark .btn[disabled] { opacity: .45; background: transparent; box-shadow: none; filter: none;
  border: 1.5px dashed var(--line); color: var(--text); transform: none; }
html.dark .btn:disabled, html.dark .btn[disabled] { border-color: #6a6577; color: #f1ece3; }
/* V12.43 : contrastes. Rouge plus clair en sombre, encres foncées en clair, sous-titres des combattants. */
html.dark { --danger: #F06070; }
.btn-primary { font-family: var(--font-ui); letter-spacing: .01em; }
.btn-lg.btn-primary { font-family: var(--font-title); letter-spacing: .02em; }
/* V12.43 : taille du texte « Grand » (Options, Affichage). */
html[data-text="large"] { --fs-3xl: 34px; --fs-2xl: 26px; --fs-xl: 22px; --fs-lg: 19px; --fs-md: 17px; --fs-sm: 15px; --fs-xs: 14px; }
html[data-text="large"] body { font-size: max(var(--fs-md), clamp(16px, calc(.4vw + .5vh + 6px), 21px)); }
.fx.fx-has-bonus { display: inline-flex; align-items: center; gap: 1px; }
.fx .fx-bonus { margin-left: 3px; padding: 0 4px; border-radius: 99px; background: rgba(0, 0, 0, .35); color: #E2A93B; font-weight: 800; font-size: .92em; line-height: 1.25; cursor: help; }
html:not(.dark) .fx .fx-bonus { background: rgba(0, 0, 0, .35); color: #E2A93B; }
.num { font-size: clamp(16px, calc(var(--tile) * .38), 22px); }
/* D5 : un seul bouton ambré par écran ; les Défis passent en bouton secondaire teinté. */
.btn-defi { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--gold) 55%, transparent), 0 2px 0 rgba(0, 0, 0, .35); color: var(--text); }
.btn-defi.btn-weekly { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--weekly) 70%, transparent), 0 2px 0 rgba(0, 0, 0, .35); }
.btn-defi img.pxi { width: 16px; height: 16px; }
/* D8 : chiffres des barres de PV lisibles sur le vert (ombre portée d'un pixel plein). */
.bar > span { color: #fff; text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000, 0 -1px 0 #000, 0 2px 2px rgba(0, 0, 0, .6); }
.num.num-out { animation: numOut .2s ease-out forwards; }
@media (prefers-reduced-motion: reduce) { .num.num-out { animation: none; opacity: 0; } }
