/* css/sheet.css — systeme de tiroirs/pop-ins (.sheet, .overlay) et tout leur contenu : sac, pause,
   PNJ, marchand, evenements, recompenses de carte/relique, codex, journal, glossaire, options/reglages,
   ecran de personnalisation (avatar, classe), defi du jour, classements et autres fiches de detail.
   Issu du decoupage de l'ancien style.css (reorganisation pure, V13.12). */

/* ================================================================ Boutons */
.panel-title { color: var(--muted); }
.sticky-top { position: sticky; top: -12px; z-index: 2; margin: -12px -12px 0; padding: 12px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
.stat-bar { height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; margin-top: 6px; }
.stat-bar > div { height: 100%; background: var(--accent); }
/* Bilan de combat */
/* V13 (retour d'Alexandre) : posé en absolute, cette pop-in (bilan, événement, PNJ, relique, passage —
   toutes ajoutées comme enfant brut de #app, une grille) restait un élément de mise en page tant qu'on
   n'était pas sur ordinateur (seul un style plus bas la passait en fixed) : elle pouvait alors influencer
   la taille de ce qu'il y a derrière, notamment la carte, qui se redimensionnait visiblement à l'ouverture
   et à chaque clic dedans. Toujours hors du flux désormais, comme les fiches (.sheet-root). */
.overlay { position: fixed; inset: 0; z-index: var(--z-overlay); display: grid; place-items: center; overflow-y: auto; background: rgba(8, 7, 10, .62); backdrop-filter: blur(3px); padding: 16px; animation: fadeIn .2s ease-out; }
/* ================================================================ Tiroir (bottom sheet) */
/* V13 (retour d'Alexandre) : le conteneur de la fiche est lui-même hors du flux normal (et non plus
   seulement ses enfants .sheet-back/.sheet) : ajouté comme enfant brut de #app (une grille), il pouvait
   être placé dans une rangée implicite et perturber la taille du contenu derrière (la carte notamment,
   qui se redimensionnait visiblement à l'ouverture). Ainsi, il ne fait plus jamais partie du calcul de
   mise en page de #app, quoi qu'il arrive. */
.sheet-root { position: fixed; inset: 0; z-index: var(--z-sheet); pointer-events: none; }
.sheet-root > * { pointer-events: auto; }
.sheet-back { position: fixed; inset: 0; z-index: var(--z-sheet); background: rgba(8, 7, 10, .55); animation: fadeIn .18s ease-out; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-sheet) + 1); max-height: 82dvh; display: flex; flex-direction: column;
  background: var(--panel); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(0,0,0,.4);
  padding-bottom: var(--safe-b); animation: sheetUp .22s ease-out;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 2px; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 6px 14px 8px; }
.sheet-head h3 { flex: 1; font-size: var(--fs-lg); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.log { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); }
.log div { color: var(--muted); }
.log div.new { color: var(--text); }
.log div.sep { color: var(--accent-ink); font-weight: 800; margin-bottom: 6px; }
/* V12.65 : détail d'un monstre du bestiaire, image bien plus grande que la tuile de la liste. */
.beast-detail { display: flex; justify-content: center; padding: 8px 0; }
.beast-detail-img { width: min(52vw, 220px); height: auto; aspect-ratio: 1; image-rendering: pixelated; }
/* ================================================================ Toasts */
.toasts { position: fixed; top: calc(var(--top-h) + var(--safe-t) + 8px); left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { background: var(--panel); border: 1px solid var(--accent); padding: 8px 14px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 700; font-size: var(--fs-md); animation: toastIn .25s ease-out; text-align: center; }
.toast.level { border-color: var(--gold); color: var(--gold-ink); }
.toast.error, .toast.danger { border-color: var(--danger); color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
/* ================================================================ Ordinateur (plein écran) */
@media (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) {
  :root { --sprite: clamp(112px, 22vh, 288px); }
  body { font-size: clamp(14px, calc(.4vw + .5vh + 4px), 19px); }
  .only-desk { display: revert !important; }
  .only-mobile { display: none !important; }

  /* La barre d'onglets remonte dans la barre du haut (à droite) */
.tabbar button { flex-direction: row; font-size: var(--fs-lg); }
  
  .tabbar button.active { background: color-mix(in srgb, var(--accent) 16%, transparent); }
  .topbar { padding-left: var(--edge); }
  .topbar h2 { font-size: var(--fs-2xl); }
  
  
  .bar { height: 22px; }
  .bar > span { line-height: 22px; font-size: var(--fs-sm); }
  
  .actbar > .btn { flex: 0 0 auto !important; min-width: clamp(160px, 14vw, 280px); }

  /* Titre et donjons */
/* Sanctuaire : pleine largeur */
.sanct { padding: var(--gap) calc(var(--gap) * 2); gap: var(--gap); }
  
  
  
  
  .hero-card img { justify-self: center; width: clamp(160px, 36vh, 448px); }
  .hero-card h3 { font-size: var(--fs-3xl); }
  .grid-list { grid-template-columns: repeat(auto-fill, minmax(clamp(280px, 22vw, 440px), 1fr)); gap: var(--gap); }
  .bestiary { grid-template-columns: repeat(6, 1fr); }
  .beast img { width: clamp(64px, 10vh, 128px); height: auto; aspect-ratio: 1; }
  .sticky-top { top: calc(var(--gap) * -1); margin: calc(var(--gap) * -1) calc(var(--gap) * -2) 0; padding: var(--gap) calc(var(--gap) * 2); }

  /* V13 (retour d'Alexandre) : même système sur ordinateur et mobile — la carte occupe toute la colonne. */
.explore { padding: var(--gap); }
  .map-area { padding: 0; }

  /* Combat : infos | arène | journal, main + bouton en bas */
.combat {
    padding: var(--gap); gap: var(--gap);
    grid-template-columns: minmax(220px, 18vw) minmax(0, 1fr) minmax(260px, 21vw);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "intel arena log" "intel hand act";
  }
  .c-intel, .c-log { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; }
  .c-log .panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .c-log .log { overflow-y: auto; flex: 1; min-height: 0; }
  .arena { padding: calc(var(--gap) * 2.5) var(--gap) var(--gap); }
  .arena-log { display: none; }
  .fighter .name { font-size: clamp(1rem, 2.4vh, 1.6rem); }
  .fighter .bar { width: min(260px, 100%); }
  .chip { font-size: var(--fs-sm); }
  .st { font-size: var(--fs-xs); }
  .intent { font-size: var(--fs-sm); }
  
  
  
  .act { flex-direction: column; align-items: stretch; justify-content: center; width: clamp(170px, 13vw, 260px); gap: 8px; }
  .act .btn { min-height: calc(var(--card-sm) * .75); font-size: var(--fs-lg); white-space: normal; }
  .act .preview { flex: 0; text-align: center; font-size: var(--fs-sm); }

  /* Choix de carte : cartes au centre, deck à droite */
.choose { grid-template-columns: minmax(0, 1fr) minmax(280px, 22vw); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "head deck" "body deck" "foot deck"; padding: var(--gap) calc(var(--gap) * 2); gap: var(--gap); }
  .choose-head { grid-area: head; }
  .choose-body { grid-area: body; }
  .choose-deck { grid-area: deck; display: flex; flex-direction: column; min-height: 0; }
  .choose-deck .deck-list { overflow-y: auto; }
  .choices { gap: 2vw; }


  /* Résumé */
.summary { grid-template-columns: minmax(280px, 30vw) minmax(0, 1fr); grid-template-rows: none; align-items: center; padding: 4vh 5vw; gap: 4vw; }
  .summary-head { flex-direction: column; text-align: center; }
  .summary-grid { grid-template-columns: repeat(4, 1fr); gap: var(--gap); }

  /* Tiroir : panneau latéral droit */
.sheet { left: auto; top: 0; width: min(460px, 34vw); max-height: none; border-radius: 0; border-top: 0; border-left: 1px solid var(--line); animation: sheetSide .22s ease-out; }
  .sheet-grip { display: none; }
  @keyframes sheetSide { from { transform: translateX(40px); opacity: 0; } }
  .card-detail { flex-direction: row; align-items: flex-start; gap: 18px; }
  .card-detail-desc { flex: 1 1 auto; padding-top: 10px; }

  .toasts { top: auto; bottom: 3vh; left: auto; right: 2vw; transform: none; align-items: flex-end; }
}
.budget { display: inline-block; font-weight: 800; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 1px 7px; margin-right: 4px; }
.budget.full { border-color: var(--gold); color: var(--gold-ink); }
.sac-hp { display: flex; flex-direction: column; align-items: center; gap: 4px; width: min(420px, 100%); cursor: pointer; text-align: center; }
.sac-hp.chosen { box-shadow: 0 0 0 3px var(--danger); }
.sac-hp:disabled { opacity: .4; cursor: not-allowed; }
.offer { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.offer .btn { min-width: 0; width: 100%; }
.icon-btn img.pxi { width: 24px; height: 24px; vertical-align: middle; }
.no-flee { font-size: var(--fs-xs); color: var(--muted); text-align: center; }
.abandon-warn { font-size: var(--fs-sm); margin: 0; }
.abandon-warn.danger { color: var(--danger); }
/* V6.6 : journal, message le plus récent en haut, séparés par un trait discret */
.log > div { border-bottom: 1px solid color-mix(in srgb, var(--text) 12%, transparent); }
.log > div:last-child { border-bottom: 0; }
/* V6.7 : fragments de lore */
.lore-list { display: grid; gap: 6px; }
.lore-item { display: flex; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; }
.lore-item:hover { border-color: var(--accent); }
.lore-page { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 4px 16px; }
.lore-page p, .lore-quote { font-family: var(--font-title); font-size: var(--fs-lg); line-height: 1.6; text-align: center; max-width: 34em; margin: 0; color: var(--text); font-style: italic; }
.lore-quote { font-size: var(--fs-md); color: var(--muted); margin-top: 8px; }
.log > div.new { animation: logIn .35s ease-out; }
/* V6.9 : Ascension */
.asc-row .stepper button { width: 36px; height: 36px; background: transparent; color: var(--text); font-weight: 800; }
.asc-row .stepper button:not(:disabled):hover { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.asc-row .stepper .asc-val { min-width: 28px; }
/* V6.9 : pas de débordement sur l'écran Jouer */
.hero-card > .stack { min-width: 0; }
/* ===== V8 : atelier de personnage ===== */
