/* ============================================================
 * Feralia Online
 * Thème unique sombre "carte tactique" (choix assumé : écran de jeu).
 * Portrait, une main, cibles tactiles ≥ 48px.
 * ============================================================ */

:root {
  --bg: #14181d;
  --panel: #1d232b;
  --panel-2: #242c36;
  --ink: #e8ecf1;
  --dim: #8b96a5;
  --gold: #e8b23f;
  --hp: #d15757;
  --pa: #4a9fd8;
  --ok: #58b368;
  --line: rgba(232, 236, 241, 0.08);
  --t0: #6f7a87; --t1: #9aa5b1; --t2: #58b368; --t3: #4a9fd8; --t4: #a86fd1; --t5: #e8a33f; --t6: #d66a4a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: #0d1014;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  max-width: 520px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
  user-select: none;
  -webkit-user-select: none;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#splash {
  position: absolute;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 18%, rgba(243, 203, 113, 0.2), transparent 22%),
    radial-gradient(circle at 20% 82%, rgba(80, 126, 92, 0.22), transparent 30%),
    radial-gradient(circle at 82% 78%, rgba(38, 98, 115, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(16, 26, 24, 0.98), rgba(11, 16, 18, 0.985));
  transition: opacity 0.45s ease, visibility 0.45s ease;
  overflow: hidden;
}
#splash::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.03) 0 8%, transparent 8% 100%),
    linear-gradient(225deg, rgba(255,255,255,0.02) 0 6%, transparent 6% 100%);
  opacity: 0.34;
  pointer-events: none;
}
#splash::after {
  content: '';
  position: absolute;
  inset: 16px;
  border-radius: 28px;
  border: 1px solid rgba(214, 178, 102, 0.14);
  box-shadow:
    inset 0 0 0 1px rgba(255, 235, 188, 0.04),
    inset 0 0 80px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
#splash.hidden {
  display: flex !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-inner {
  position: relative;
  z-index: 1;
  width: min(88vw, 520px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: splashRise 0.85s ease-out;
}
.splash-inner::before {
  content: '';
  position: absolute;
  inset: -30px -24px;
  border-radius: 34px;
  background:
    radial-gradient(circle at center, rgba(255, 224, 151, 0.14), rgba(42, 86, 72, 0.08) 42%, transparent 70%);
  filter: blur(8px);
  pointer-events: none;
}
.splash-logo {
  position: relative;
  z-index: 1;
  width: min(100%, 500px);
  height: auto;
  filter:
    drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42))
    drop-shadow(0 0 22px rgba(244, 205, 110, 0.18));
}

@keyframes splashRise {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hidden { display: none !important; }

/* ---------- Cuisine : Marmite, consommables, badge de buff ---------- */
.cook-item .upg-head b { color: #33240f; }
.cook-tiers { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.cook-btn { flex: 1; min-width: 44px; min-height: 40px; padding: 6px 4px; font-weight: 800; }
.inv-card-emoji { font-size: 34px; line-height: 1.2; display: block; }
.inv-consumable { cursor: pointer; font: inherit; text-align: inherit; }
.inv-card-use {
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a5410;
}
#buffBadge {
  position: absolute;
  left: 12px;
  bottom: 152px;
  z-index: 22;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(70, 48, 26, 0.94), rgba(42, 28, 18, 0.92));
  border: 1px solid rgba(214, 178, 102, 0.5);
  color: #efdbb0;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

/* ---------- Bannière d'installation PWA (haut du HUD) ---------- */
#installBanner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(69, 48, 28, 0.96), rgba(38, 28, 18, 0.94));
  border: 1px solid rgba(214, 178, 102, 0.38);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 236, 196, 0.14);
  pointer-events: auto;
}
#installBannerIcon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.install-banner-copy { flex: 1; min-width: 0; }
.install-banner-title {
  color: #f2e5c2;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.25;
  text-shadow: 0 1px 0 rgba(39, 22, 8, 0.75);
}
.install-banner-text {
  color: #d8c9a3;
  font-size: 11px;
  line-height: 1.32;
  margin-top: 1px;
}
#installBannerAction {
  flex: none;
  min-height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
}
#installBannerClose {
  flex: none;
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #efdbb0;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- % de victoire (popups + bannière de lobby) ---------- */
.chance-good { color: #3e9a4e; }
.chance-mid { color: #c9871a; }
.chance-bad { color: #c94b3d; }
.chance-badge {
  align-self: center;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: rgba(10, 12, 16, 0.35);
  border: 1px solid currentColor;
}
#lobbyBanner .chance-badge.chance-good { color: #7ed88b; }
#lobbyBanner .chance-badge.chance-mid { color: #f0b95c; }
#lobbyBanner .chance-badge.chance-bad { color: #ff8d7e; }

/* ---------- Or (monnaie du compte) ---------- */
.gold-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(233, 195, 99, 0.32), rgba(200, 154, 58, 0.22));
  border: 1px solid rgba(122, 86, 30, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 240, 200, 0.35);
}
.gold-coin { display: inline-flex; align-items: center; line-height: 1; }
.currency-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: -5px;
  filter: drop-shadow(0 3px 4px rgba(57, 35, 12, 0.2));
}
.currency-icon.small {
  width: 16px;
  height: 16px;
  vertical-align: -4px;
}
.currency-icon.large {
  width: 30px;
  height: 30px;
  vertical-align: middle;
}
.gold-label {
  color: #33240f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.gold-amount {
  margin-left: auto;
  color: #7a5410;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.gold-c { color: #b8860b; font-variant-numeric: tabular-nums; }
.legendary-loot {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 12px 0 4px;
  padding: 8px 12px 8px 5px;
  border: 1px solid rgba(121, 208, 211, 0.42);
  border-radius: 15px;
  background: radial-gradient(circle at 18% 50%, rgba(72, 205, 211, 0.2), transparent 38%), rgba(73, 28, 52, 0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.34), 0 8px 18px rgba(62, 24, 45, 0.11);
}
.legendary-loot img { width: 108px; height: 82px; object-fit: contain; filter: drop-shadow(0 7px 8px rgba(44, 18, 35, 0.24)); }
.legendary-loot span { min-width: 0; }
.legendary-loot small,
.legendary-loot b,
.legendary-loot em { display: block; }
.legendary-loot small { color: #438f91; font-size: 9px; font-weight: 900; letter-spacing: 0.13em; }
.legendary-loot b { margin-top: 3px; color: #59243e; font: 700 16px Georgia, "Times New Roman", serif; }
.legendary-loot em { margin-top: 4px; color: #80664e; font-size: 10px; font-style: normal; }

/* ---------- Profil : fiche d'aventurier (sections plates, ornements) ---------- */
.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 0 4px;
  text-align: center;
}
.avatar.sprite.hero {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid rgba(200, 154, 58, 0.8);
  box-shadow:
    0 0 0 3px rgba(122, 86, 30, 0.22),
    0 10px 22px rgba(70, 45, 15, 0.22);
  background-color: rgba(255, 244, 214, 0.55);
}
.avatar.skin-avatar {
  --skin-scale: 0.84;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  background: radial-gradient(circle at 50% 38%, rgba(255, 244, 214, 0.72), rgba(236, 213, 167, 0.28) 68%, transparent 72%);
}
.avatar.skin-avatar .avatar-skin-main {
  position: relative;
  z-index: 1;
  width: calc(100% * var(--skin-scale));
  height: calc(100% * var(--skin-scale));
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.18));
}
.avatar.skin-avatar .avatar-accessory-back {
  position: absolute;
  left: 50%;
  bottom: 7%;
  z-index: 0;
  width: 138%;
  height: 112%;
  max-width: none;
  transform: translateX(-50%);
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 7px 10px rgba(49, 20, 38, 0.24));
}
.avatar.skin-avatar.hero {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 3px solid rgba(200, 154, 58, 0.8);
  box-shadow:
    0 0 0 3px rgba(122, 86, 30, 0.22),
    0 10px 22px rgba(70, 45, 15, 0.22);
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 244, 214, 0.88), rgba(236, 213, 167, 0.44) 62%, rgba(160, 119, 53, 0.12) 100%);
}
.hero-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 700;
  color: #33240f;
  letter-spacing: 0.02em;
}
.hero-class { color: #7a6244; font-weight: 700; font-size: 13.5px; }
.hero-bonus {
  font-style: italic;
  color: #7a6244;
  font-size: 12.5px;
  line-height: 1.5;
  max-width: 36ch;
  text-wrap: balance;
}

/* Séparateur ornemental : filets + losange doré */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 12px;
  color: rgba(200, 154, 58, 0.85);
  font-size: 11px;
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(122, 86, 30, 0.4));
}
.section-divider::after {
  background: linear-gradient(90deg, rgba(122, 86, 30, 0.4), transparent);
}

/* Stats en ligne, sans boîtes */
.stat-line {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
  color: #7a6244;
  font-size: 13px;
}
.stat-line b {
  color: #33240f;
  font-size: 16px;
  margin-left: 3px;
  font-variant-numeric: tabular-nums;
}

/* Titres de section (serif, encre) */
.profile-sec-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 700;
  color: #33240f;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.profile-sec-title .sec-count { color: #7a6244; font-size: 12px; font-family: system-ui, sans-serif; }

/* Équipement : lignes légères, pas de cartes */
.gear-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  color: #33240f;
  font-weight: 700;
}
.gear-art {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(72, 42, 17, 0.22));
}
.gear-line .gear-name { flex: 1; }
.profile-hint { color: #7a6244; }

/* Outils de test repliés : discrets tant qu'on n'en a pas besoin */
.profile-admin summary {
  cursor: pointer;
  color: #7a6244;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 0;
}
.profile-admin[open] summary { margin-bottom: 8px; }

.logout-btn { margin-top: 14px; }

/* ---------- Personnages multiples (formes) ---------- */
.chars-section { margin-top: 0; }
.chars-section > .dim { color: #7a6244; }
.char-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.char-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(122, 86, 30, 0.07);
  border: none;
  box-shadow: inset 0 0 0 1px rgba(122, 86, 30, 0.12);
  color: #4a3520;
  text-align: left;
  font: inherit;
}
.char-card b { color: #33240f; }
.char-card.active {
  background: rgba(232, 178, 63, 0.16);
  box-shadow:
    inset 0 0 0 2px rgba(200, 154, 58, 0.75),
    0 4px 12px rgba(200, 154, 58, 0.18);
}
.char-card.empty, .char-card.locked {
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  box-shadow: none;
  border: 1px dashed rgba(122, 86, 30, 0.35);
  font-weight: 700;
  color: #7a6244;
}
.char-card.empty small, .char-card.locked small { color: #9a8464; }
.char-plus {
  color: #c89a3a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 700;
  vertical-align: -1px;
}
.char-card.empty { cursor: pointer; }
.char-card.empty small, .char-card.locked small { font-weight: 400; opacity: 0.7; }
.char-card.locked { opacity: 0.6; }
.char-info { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.char-info small { opacity: 0.75; font-size: 11.5px; line-height: 1.35; }
.char-active-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--gold);
  color: #14181d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.char-switch { min-height: 38px; padding: 8px 14px; white-space: nowrap; }

/* ---------- Hauts faits ---------- */
.ach-cat {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12.5px;
  font-weight: 700;
  color: #7a6244;
  letter-spacing: 0.04em;
  margin: 10px 0 4px;
}
.ach-cat:first-child { margin-top: 0; }
.ach-list { display: flex; flex-direction: column; gap: 4px; }
.ach-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(122, 86, 30, 0.05);
  box-shadow: inset 0 0 0 1px rgba(122, 86, 30, 0.1);
  color: #7a6244;
}
.ach-item.unlocked {
  background: rgba(232, 178, 63, 0.14);
  box-shadow: inset 0 0 0 1px rgba(200, 154, 58, 0.4);
  color: #33240f;
}
.ach-status {
  flex: 0 0 16px;
  text-align: center;
  font-weight: 800;
  color: #9a8464;
}
.ach-item.unlocked .ach-status { color: #c89a3a; }
.ach-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ach-copy b { font-size: 13px; }
.ach-copy small { opacity: 0.75; font-size: 11.5px; }
.ach-progress-track {
  height: 5px;
  border-radius: 999px;
  margin: 3px 0 1px;
  background: linear-gradient(180deg, rgba(115, 87, 50, 0.18), rgba(145, 116, 73, 0.08));
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.12);
}
.ach-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #c89a3a, #e9c363);
}
.ach-progress-label { opacity: 0.7; font-size: 11px; }
.ach-details summary {
  cursor: pointer;
  color: #7a6244;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 0;
}
.ach-details[open] summary { margin-bottom: 8px; }

.title-picker { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.title-chip {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 999px;
}
.title-chip.active {
  background: linear-gradient(180deg, #e9c363, #c89a3a);
  color: #14181d;
  font-weight: 700;
}

/* Titre + guilde affichés sous un pseudo (fiche, profil bureau, aperçu joueur) —
 * volontairement plus petits que le pseudo, et la guilde plus discrète que le titre. */
.hero-title, .hero-guild {
  font-family: Georgia, "Times New Roman", serif;
  white-space: nowrap;
}
.hero-title {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
}
.hero-guild {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.6;
}

/* Badge de rôle de groupe (Tank / Soin / Soutien / Dégâts / Butin).
 * Or plein + encre sombre : lisible sur parchemin comme sur fond sombre. */
.role-chip {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 7px 2px;
  border-radius: 999px;
  border: 1px solid rgba(90, 61, 18, 0.55);
  background: linear-gradient(180deg, #e9c363, #c89a3a);
  color: #33240f;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
  text-shadow: none;
}
.dim { color: var(--dim); }
.small { font-size: 12px; }
.ok-c { color: var(--ok); }
.hp-c { color: var(--hp); }

/* ---------- Badges de tier (code couleur global T1→T5) ---------- */
.tier {
  display: inline-block;
  min-width: 26px;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: #14181d;
}
.t0 { background: var(--t0); } .t1 { background: var(--t1); } .t2 { background: var(--t2); }
.t3 { background: var(--t3); } .t4 { background: var(--t4); }
.t5 { background: var(--t5); } .t6 { background: var(--t6); }

/* ---------- HUD supérieur ---------- */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(rgba(14, 18, 14, 0.6), rgba(14, 18, 14, 0.16) 72%, transparent);
  pointer-events: none;
}
.hud-panel {
  position: relative;
  padding: 8px 10px 10px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(70, 48, 26, 0.92), rgba(42, 28, 18, 0.9)),
    radial-gradient(circle at top, rgba(255, 233, 184, 0.14), transparent 62%);
  border: 1px solid rgba(214, 178, 102, 0.42);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 236, 196, 0.18),
    inset 0 -1px 0 rgba(41, 22, 9, 0.5);
  overflow: hidden;
}
.hud-panel::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 12px;
  border: 1px solid rgba(230, 203, 145, 0.12);
  pointer-events: none;
}
.hud-panel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 234, 190, 0.48), transparent);
  pointer-events: none;
}
.hud-panel-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.hud-label {
  position: relative;
  padding-left: 14px;
  color: #efdbb0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(38, 22, 8, 0.8);
}
.hud-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  transform: rotate(45deg);
  border-radius: 2px;
  background: linear-gradient(180deg, #f0d18d, #a16a22);
  box-shadow: 0 0 0 1px rgba(58, 32, 10, 0.6);
}
.hud-meta {
  max-width: 58%;
  padding: 4px 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(24, 18, 12, 0.72), rgba(56, 39, 24, 0.78));
  border: 1px solid rgba(214, 178, 102, 0.24);
  color: #d8c39b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255, 240, 211, 0.08);
}
.bar {
  position: relative;
  flex: 1;
  height: 24px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(19, 14, 10, 0.95), rgba(54, 38, 25, 0.92));
  border: 1px solid rgba(224, 192, 135, 0.25);
  overflow: hidden;
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.34),
    inset 0 -1px 0 rgba(255, 232, 188, 0.06);
}
.bar::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  border: 1px solid rgba(255, 239, 211, 0.08);
  pointer-events: none;
}
.bar-fill {
  position: relative;
  height: 100%;
  transition: width 0.25s;
}
.bar-fill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0) 46%);
  pointer-events: none;
}
.bar-fill::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background:
    repeating-linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.07) 0 10px,
      rgba(255, 255, 255, 0) 10px 18px
    );
  mix-blend-mode: screen;
  opacity: 0.42;
  pointer-events: none;
}
.hp .bar-fill {
  background:
    linear-gradient(90deg, #7a1f1a, #bc4031 40%, #e46d54 78%, #f2a07b);
}
.pa .bar-fill {
  background:
    linear-gradient(90deg, #1f4360, #3177aa 38%, #48a9d2 76%, #8fe2f3);
}
.bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff2cf;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 1px 0 rgba(62, 36, 13, 0.95),
    0 2px 4px rgba(0, 0, 0, 0.5);
}
.pos, .pa-next {
  min-width: 76px;
}
.pos { color: #f1e6ca; }
.hp-panel {
  background:
    linear-gradient(180deg, rgba(84, 35, 30, 0.94), rgba(54, 23, 18, 0.92)),
    radial-gradient(circle at top, rgba(255, 220, 198, 0.14), transparent 62%);
}
.pa-panel {
  background:
    linear-gradient(180deg, rgba(57, 43, 26, 0.94), rgba(38, 28, 18, 0.92)),
    radial-gradient(circle at top, rgba(196, 226, 255, 0.1), transparent 62%);
}

#dungeonBanner {
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  max-width: 400px;
  margin: 0 auto;
  padding: 11px 13px 12px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(65, 45, 35, 0.97), rgba(33, 22, 18, 0.95)),
    radial-gradient(circle at top, rgba(205, 175, 113, 0.12), transparent 62%);
  border: 1px solid rgba(189, 154, 92, 0.34);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 234, 197, 0.12),
    inset 0 -1px 0 rgba(30, 17, 9, 0.42);
  z-index: 22;
  pointer-events: none;
  overflow: hidden;
}
#dungeonBanner::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 15px;
  border: 1px solid rgba(236, 215, 173, 0.09);
}
#dungeonBanner::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(249, 224, 178, 0.4), transparent);
}
#dungeonBanner.boss-ready {
  background:
    linear-gradient(180deg, rgba(93, 55, 26, 0.98), rgba(54, 27, 12, 0.96)),
    radial-gradient(circle at top, rgba(239, 188, 91, 0.15), transparent 62%);
  border-color: rgba(232, 169, 63, 0.44);
}
.dungeon-banner-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dungeon-banner-boss {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 231, 181, 0.16), transparent 45%),
    linear-gradient(180deg, rgba(47, 33, 24, 0.95), rgba(24, 17, 13, 0.95));
  border: 1px solid rgba(205, 174, 116, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 233, 194, 0.12),
    0 6px 14px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#dungeonBanner.boss-ready .dungeon-banner-boss {
  border-color: rgba(236, 181, 82, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 204, 0.15),
    0 0 16px rgba(222, 156, 58, 0.18);
}
.dungeon-banner-boss-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.34));
}
.dungeon-banner-copy {
  min-width: 0;
  flex: 1;
}
.dungeon-banner-kicker {
  position: relative;
  z-index: 1;
  color: #d8c291;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(39, 23, 10, 0.72);
}
#dungeonBanner.boss-ready .dungeon-banner-kicker {
  color: #f1c97b;
}
.dungeon-banner-title {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  color: #f6e8c8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(24, 12, 6, 0.85);
}
.dungeon-banner-progress-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.dungeon-banner-track {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(24, 17, 13, 0.96), rgba(47, 33, 24, 0.92));
  border: 1px solid rgba(214, 186, 136, 0.12);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.35);
}
.dungeon-banner-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #496574, #7198a6 54%, #c6dbe2);
  transition: width 0.25s ease;
}
#dungeonBanner.boss-ready .dungeon-banner-fill {
  background: linear-gradient(90deg, #9b4b1f, #db8f37 50%, #f4cf7a);
}
.dungeon-banner-count {
  min-width: 52px;
  text-align: right;
  color: #ead9b6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 rgba(32, 18, 8, 0.75);
}
#dungeonBanner.boss-ready .dungeon-banner-count {
  color: #fff0c7;
}
.dungeon-banner-hint {
  position: relative;
  z-index: 1;
  margin-top: 7px;
  color: #d9ccb1;
  font-size: 11px;
  line-height: 1.35;
  text-shadow: 0 1px 0 rgba(22, 13, 7, 0.68);
}
#dungeonBanner.boss-ready .dungeon-banner-hint {
  color: #f1dcc0;
}

/* ---------- Bannière lobby & toasts ---------- */
#lobbyBanner {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  max-width: 420px;
  margin: 0 auto;
  padding: 10px 12px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(69, 48, 28, 0.96), rgba(38, 28, 18, 0.94));
  border: 1px solid rgba(214, 178, 102, 0.38);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 236, 196, 0.16);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 24;
  pointer-events: auto;
}
#lobbyBanner::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 14px;
  border: 1px solid rgba(234, 214, 169, 0.1);
  pointer-events: none;
}
#lobbyText {
  position: relative;
  z-index: 1;
  color: #f2e5c2;
  line-height: 1.35;
  text-shadow: 0 1px 0 rgba(39, 22, 8, 0.75);
}
#lobbyStart {
  align-self: center;
  min-width: min(260px, 100%);
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(133, 86, 22, 0.85);
  border-radius: 999px;
  background:
    linear-gradient(180deg, #f4c55d, #dd9224 52%, #b56b14);
  color: #4f2808;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 0 rgba(255, 236, 188, 0.72);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 247, 219, 0.66),
    inset 0 -2px 0 rgba(110, 60, 10, 0.34);
  cursor: pointer;
}
#lobbyStart:active {
  transform: translateY(1px);
}
#lobbyDeployEngine {
  align-self: center;
  min-width: min(260px, 100%);
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(133, 86, 22, 0.5);
  border-radius: 999px;
  background: rgba(69, 48, 28, 0.55);
  color: #efdbb0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
#lobbyDeployEngine:active {
  transform: translateY(1px);
}
#toasts {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  z-index: 9999;
}
.toast {
  max-width: 82%;
  padding: 11px 20px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(40, 30, 17, 0.95), rgba(19, 14, 8, 0.97));
  border: 1px solid rgba(232, 178, 63, 0.5);
  border-top: 2px solid #e8b23f;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #f4e6c8;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: opacity 0.4s, transform 0.4s;
}
.toast.out { opacity: 0; transform: translateY(-6px); }

/* ---------- Action contextuelle (Capitale) ---------- */
#ctxAction {
  position: absolute;
  bottom: 86px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border: 1px solid var(--gold);
  border-radius: 24px;
  background: rgba(232, 178, 63, 0.14);
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

#recenterBtn {
  position: absolute;
  bottom: 86px;
  right: 14px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: rgba(20, 24, 29, 0.82);
  color: var(--gold);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  z-index: 25;
}

#helpBtn {
  position: absolute;
  bottom: 86px;
  left: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: rgba(20, 24, 29, 0.82);
  color: var(--gold);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  z-index: 25;
}

.guide-scroll {
  max-height: min(56vh, 480px);
  overflow-y: auto;
  padding-right: 4px;
}
.guide-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  margin-bottom: 14px;
}
.guide-step-icon { flex: 0 0 auto; font-size: 22px; line-height: 1.3; }
.guide-step-copy b { display: block; margin-bottom: 2px; }
.guide-step-copy p { margin: 0; }
.guide-section-title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.65;
  margin: 16px 0 8px;
}
.guide-section-title:first-child { margin-top: 0; }

/* ---------- Navigation inférieure ---------- */
#nav {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  border-top: 1px solid var(--line);
  background: rgba(19, 23, 28, 0.96);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}
#nav button {
  position: relative;
  flex: 1;
  min-height: 68px;
  border: none;
  background: none;
  color: var(--dim);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
}
.nav-badge {
  position: absolute;
  top: 10px;
  left: 50%;
  margin-left: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e0483a;
  box-shadow: 0 0 0 2px rgba(19, 23, 28, 0.96);
}
.nav-badge.hidden { display: none; }
#nav button .ico { font-size: 20px; }
#nav button .nav-ico {
  width: 30px;
  height: 30px;
  display: block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.3)) saturate(0.75) brightness(0.9);
  transition: transform 0.18s ease, filter 0.18s ease;
}
#nav button.active .nav-ico {
  transform: translateY(-1px) scale(1.06);
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.38)) saturate(1) brightness(1.02);
}
.nav-ico-inventory { background-image: var(--nav-icon-inventory-url); }
.nav-ico-shop { background-image: var(--nav-icon-shop-url); }
.nav-ico-profile { background-image: var(--nav-icon-profile-url); }
.nav-ico-map { background-image: var(--nav-icon-map-url); }
.nav-ico-social { background-image: var(--nav-icon-social-url); }
#nav button.active { color: var(--ink); background: var(--panel); }

/* ---------- Bottom sheet ---------- */
#sheet {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(62px + env(safe-area-inset-bottom));
  max-height: 62%;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(247, 234, 202, 0.92), rgba(232, 213, 172, 0.9));
  border-top: none;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.4);
  z-index: 25;
  overflow: hidden;
}
#sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, rgba(247, 234, 202, 0.76), rgba(232, 213, 172, 0.72));
  pointer-events: none;
}
#sheet::after {
  content: '';
  position: absolute;
  inset: 10px 10px 0;
  border-radius: 18px 18px 0 0;
  border: 1px solid rgba(199, 158, 90, 0.26);
  pointer-events: none;
}
#sheetHead {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
}
#sheetHead h2 {
  font-size: 18px;
  letter-spacing: 0.02em;
  color: #5a3215;
  text-shadow: 0 1px 0 rgba(255,240,211,0.22);
  font-family: Georgia, "Times New Roman", serif;
}
#sheetClose {
  width: 34px; height: 34px;
  border: 1px solid rgba(164, 118, 55, 0.42);
  border-radius: 50%;
  background: rgba(95, 70, 40, 0.14);
  color: #7e5b33;
  font-size: 14px;
  cursor: pointer;
}
#sheetBody {
  position: relative;
  z-index: 1;
  padding: 4px 18px 18px;
  overflow-y: auto;
}
#sheetBody p { margin: 6px 0; line-height: 1.45; color: #5a4230; }
#sheetBody h3,
#sheetBody h4,
#sheetBody .upg-head > b {
  color: #4f2c12;
  font-family: Georgia, "Times New Roman", serif;
  text-shadow: 0 1px 0 rgba(255, 247, 222, 0.55);
}
#sheetBody h3 { font-size: 18px; }
#sheetBody h4 { font-size: 15px; }
#sheetBody .upg-head > .dim { color: #826744; }

/* Inventaire */
.sortbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.sortbar-label {
  color: var(--dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sortbar-actions {
  display: flex;
  gap: 8px;
}
.sort-btn {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
}
.sort-btn.active {
  background:
    linear-gradient(180deg, rgba(243, 219, 162, 0.92), rgba(225, 184, 104, 0.84));
  border-color: rgba(201, 156, 82, 0.5);
  color: #4f2c12;
}
.inv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.inv-card {
  padding: 10px 10px 12px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(244, 232, 205, 0.88), rgba(226, 206, 164, 0.84));
  border: 1px solid rgba(171, 129, 70, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 228, 0.35),
    0 8px 16px rgba(0,0,0,0.08);
  text-align: center;
}
.inv-card-art-wrap {
  position: relative;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.inv-card-art {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.16));
}
.inv-card-emoji {
  font-size: 42px;
  line-height: 1;
}
.inv-card-tier {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 32px;
}
.inv-card-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  color: #4f2c12;
}
.inv-card-meta {
  margin-top: 3px;
  font-size: 11px;
  color: #7a6651;
  font-weight: 700;
}
.inv-card-qty {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 800;
  color: #5a3215;
  font-variant-numeric: tabular-nums;
}
.stacks { display: flex; flex-direction: column; gap: 6px; }
.stack {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.stack-name { flex: 1; font-size: 13.5px; }
.stack-qty { font-weight: 700; font-variant-numeric: tabular-nums; }
.empty { color: var(--dim); text-align: center; padding: 22px 10px; }

@media (max-width: 380px) {
  .inv-grid {
    grid-template-columns: 1fr;
  }
}

/* Profil */
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(251, 240, 215, 0.96), rgba(231, 208, 165, 0.9));
  border: 1px solid rgba(176, 129, 58, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 249, 231, 0.6),
    inset 0 -10px 18px rgba(180, 138, 78, 0.08),
    0 10px 18px rgba(0,0,0,0.1);
}
.profile-name {
  display: inline-block;
  margin-bottom: 2px;
  color: #5a3215;
  font-size: 18px;
  line-height: 1.1;
  text-shadow: 0 1px 0 rgba(255, 247, 228, 0.7);
}
.profile-class {
  color: #7f8ead;
  font-size: 15px;
}
.avatar {
  width: 44px; height: 44px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #14181d;
  flex-shrink: 0;
}
/* Avatar découpé dans assets/personnages_small.png (grille 3x2) */
.avatar.sprite {
  background-image: var(--sprite-url);
  background-size: 300% 200%;
  background-repeat: no-repeat;
  background-color: rgba(74, 56, 33, 0.18);
  border: 1px solid rgba(171, 129, 70, 0.24);
}
.avatar.sprite.small { width: 38px; height: 38px; border-radius: 8px; }
.avatar.sprite.big { width: 56px; height: 56px; }
.avatar.skin-avatar.small { width: 38px; height: 38px; }
.avatar.skin-avatar.big { width: 56px; height: 56px; }
.accessory-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}
.accessory-card,
.accessory-none {
  border: 1px solid rgba(171, 129, 70, 0.3);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(247, 236, 209, 0.88), rgba(226, 205, 162, 0.82));
  color: #4f2c12;
  cursor: pointer;
}
.accessory-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 92px;
  padding: 7px 10px 7px 5px;
  text-align: left;
}
.accessory-card.active,
.accessory-none.active {
  border-color: rgba(191, 132, 32, 0.78);
  box-shadow: inset 0 0 0 2px rgba(244, 205, 110, 0.28), 0 7px 16px rgba(84, 48, 17, 0.12);
}
.accessory-card-art {
  display: grid;
  width: 82px;
  height: 78px;
  place-items: center;
}
.accessory-card-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 8px rgba(49, 20, 38, 0.22));
}
.accessory-card-copy b,
.accessory-card-copy small { display: block; }
.accessory-card-copy b { font: 700 14px Georgia, "Times New Roman", serif; }
.accessory-card-copy small { margin-top: 5px; color: #8a6d4a; font-size: 10px; }
.accessory-none {
  min-height: 42px;
  padding: 8px 12px;
  font: 700 13px Georgia, "Times New Roman", serif;
}
.mount-card {
  grid-column: 1 / -1;
  grid-template-columns: 118px minmax(0, 1fr);
}
.mount-card-art {
  width: 118px;
  height: 82px;
}
.mount-loot img {
  width: 118px;
  height: 88px;
}
@media (max-width: 390px) {
  .accessory-picker { grid-template-columns: 1fr; }
}
.bonus {
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(218, 232, 193, 0.68), rgba(194, 213, 167, 0.58));
  border: 1px solid rgba(123, 150, 82, 0.28);
  font-size: 12.5px;
  color: #6b5a44;
  box-shadow: inset 0 1px 0 rgba(245, 252, 232, 0.45);
}
.statgrid { display: flex; gap: 8px; margin: 10px 0; }
.statgrid > div {
  flex: 1;
  padding: 10px 12px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(251, 240, 215, 0.96), rgba(231, 208, 165, 0.9));
  border: 1px solid rgba(176, 129, 58, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 249, 231, 0.58),
    inset 0 -10px 18px rgba(180, 138, 78, 0.08),
    0 10px 18px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: #7a6651;
}
.statgrid b {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: #4f2c12;
}
.xp { margin: 10px 0; }
.xp-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 5px;
  color: #6f5b45;
}
.xp-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(115, 87, 50, 0.18), rgba(145, 116, 73, 0.08));
  overflow: hidden;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.1),
    inset 0 1px 0 rgba(255, 248, 228, 0.16);
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #c89a3a, #e9c363);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 10px rgba(200, 154, 58, 0.25);
}
.gear { display: flex; gap: 8px; margin-top: 10px; }
.gear-card {
  flex: 1;
  padding: 12px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(251, 240, 215, 0.96), rgba(231, 208, 165, 0.9));
  border: 1px solid rgba(176, 129, 58, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 249, 231, 0.58),
    inset 0 -10px 18px rgba(180, 138, 78, 0.08),
    0 10px 18px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  align-items: flex-start;
  color: #7a6651;
}
.gear-card b {
  color: #4f2c12;
}

/* Carte */
#minimap {
  display: block;
  width: min(100%, 320px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  image-rendering: pixelated;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--dim);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.legend-mark {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 1.5px solid rgba(20, 24, 29, 0.9);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.legend-capital {
  background: #f4cd6e;
  transform: rotate(45deg);
  border-radius: 2px;
}
.legend-village {
  background: #f1e1ad;
  border-radius: 50%;
}
.legend-dungeon {
  background: #b8d8e6;
  border-radius: 2px;
}
.legend-me {
  background: #ffffff;
  transform: rotate(45deg);
  border-radius: 2px;
}
.legend-worldboss {
  background: #9a5fd1;
  border-radius: 50%;
}

/* Social : canaux de discussion, guilde, amis */
.chat-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.chat-tab {
  flex: 1;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(171, 129, 70, 0.34);
  background: rgba(122, 86, 30, 0.07);
  color: #7a6244;
  font-size: 12.5px;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
  cursor: pointer;
}
.chat-tab.active {
  background: linear-gradient(180deg, #e9c363, #c89a3a);
  color: #33240f;
  border-color: rgba(90, 61, 18, 0.5);
}
.chat-tab-badge {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 5px;
  border-radius: 50%;
  background: #e0483a;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(122, 86, 30, 0.2);
}
.chat-tab-badge.hidden { display: none; }
.chat-whisper-bar { margin-bottom: 8px; }
.chat-whisper-bar select { width: 100%; }
.chat-whisper-hint { text-align: center; margin-bottom: 8px; }
.feed {
  height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(122, 86, 30, 0.07);
  box-shadow: inset 0 0 0 1px rgba(122, 86, 30, 0.12);
}
.msg { font-size: 12.5px; line-height: 1.4; color: #4a3520; }
.msg b { color: #7a6244; }
.msg.me b { color: #a3781f; }
.msg.sys { color: #9a8464; font-style: italic; }
.chat-row { display: flex; gap: 8px; margin-top: 10px; }
.chat-row input {
  flex: 1;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid rgba(171, 129, 70, 0.34);
  background: rgba(249, 240, 224, 0.9);
  color: #4a3520;
  font-size: 13.5px;
}
.chat-row .btn { min-height: 38px; padding: 8px 16px; font-size: 13px; }

/* Guilde / amis : cartes d'invitation et lignes de liste */
.invite-card {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(232, 178, 63, 0.12);
  box-shadow: inset 0 0 0 1px rgba(200, 154, 58, 0.3);
}
.invite-card p { margin: 0 0 6px; color: #4a3520; font-size: 13px; }
.friend-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.friend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(122, 86, 30, 0.07);
}
.friend-name { color: #33240f; font-weight: 700; font-size: 13px; }
.friend-class { flex: 1; text-align: right; }
.btn-small { min-height: 32px; padding: 6px 10px; font-size: 11.5px; }
.guild-name { text-align: left; font-size: 16px; margin: 2px 0 4px; }

/* Capitale / améliorations */
.upg {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(251, 240, 215, 0.96), rgba(231, 208, 165, 0.9));
  border: 1px solid rgba(176, 129, 58, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 249, 231, 0.58),
    inset 0 -10px 18px rgba(180, 138, 78, 0.08),
    0 10px 18px rgba(0,0,0,0.1);
}
.admin-card {
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(249, 232, 211, 0.96), rgba(236, 211, 180, 0.9));
  border: 1px solid rgba(194, 142, 117, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 249, 231, 0.58),
    inset 0 -10px 18px rgba(186, 143, 96, 0.08),
    0 10px 18px rgba(0,0,0,0.1);
}
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.admin-grid .btn {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 12px;
}
.upg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.upg-needs { list-style: none; margin: 0 0 10px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.equipment-upgrade-card {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.equipment-art {
  width: 116px;
  height: 116px;
  object-fit: contain;
  filter: drop-shadow(0 9px 9px rgba(74, 43, 18, 0.2));
}
.equipment-copy { min-width: 0; }
.siege-engine-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.siege-engine-art {
  width: 104px;
  height: 104px;
  object-fit: contain;
  filter: drop-shadow(0 8px 9px rgba(74, 43, 18, 0.2));
}
.siege-engine-copy { min-width: 0; }
.siege-engine-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.siege-engine-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px;
  border-radius: 12px;
  border: 1px solid rgba(176, 129, 58, 0.28);
  background: rgba(255, 248, 226, 0.48);
  color: #4f2c12;
  text-align: center;
}
.siege-engine-pick img { width: 82px; height: 82px; object-fit: contain; }
.siege-engine-pick span { display: flex; flex-direction: column; gap: 2px; }
.siege-engine-pick b { font-size: 11px; line-height: 1.1; }
.siege-engine-pick small { color: #976b2e; font-weight: 800; }
@media (max-width: 480px) {
  .equipment-upgrade-card { grid-template-columns: 88px minmax(0, 1fr); gap: 9px; }
  .equipment-art { width: 88px; height: 88px; }
  .siege-engine-card { grid-template-columns: 82px minmax(0, 1fr); gap: 9px; }
  .siege-engine-art { width: 82px; height: 82px; }
}
.castle-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.castle-owned-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.castle-owned-row { padding: 8px 10px; border-radius: 10px; background: rgba(122, 86, 30, 0.07); }
.castle-owned-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.castle-owned-name { color: #33240f; font-weight: 700; font-size: 13px; }
.castle-owned-row .xp-track { height: 6px; margin-bottom: 4px; }
.shop-wallets {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0 2px 14px;
  padding: 2px 6px 12px;
  border-bottom: 1px solid rgba(139, 93, 35, 0.22);
}
.shop-section {
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(251, 240, 215, 0.96), rgba(231, 208, 165, 0.9));
  border: 1px solid rgba(176, 129, 58, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 249, 231, 0.58),
    inset 0 -10px 18px rgba(180, 138, 78, 0.08),
    0 10px 18px rgba(0,0,0,0.1);
}
.shop-section.premium {
  background:
    linear-gradient(180deg, rgba(246, 235, 255, 0.96), rgba(223, 203, 243, 0.9));
  border-color: rgba(140, 111, 184, 0.34);
}
.shop-wallet {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #5a3215;
}
.shop-wallet.premium {
  margin-left: auto;
  padding-left: 18px;
  border-left: 1px solid rgba(139, 93, 35, 0.2);
}
.shop-wallet > span { min-width: 0; }
.shop-wallet b {
  display: block;
  color: #5a3215;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.shop-wallet .currency-icon.large {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}
.shop-wallet-label {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8f6334;
  font-weight: 700;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
  gap: 10px;
}
.shop-packs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.shop-pack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 13px 7px 9px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 42%, rgba(207, 235, 255, 0.72), transparent 42%),
    linear-gradient(180deg, rgba(255, 252, 241, 0.9), rgba(232, 222, 201, 0.76));
  border: 1px solid rgba(115, 132, 181, 0.26);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.62), 0 5px 12px rgba(62, 49, 83, 0.08);
  text-align: center;
}
.shop-pack.pack-large {
  border-color: rgba(179, 128, 40, 0.44);
  background:
    radial-gradient(circle at 50% 40%, rgba(221, 241, 255, 0.9), transparent 45%),
    linear-gradient(180deg, rgba(255, 247, 211, 0.96), rgba(235, 211, 162, 0.84));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 7px 16px rgba(105, 73, 23, 0.14);
}
.gold-exchange-section {
  background: linear-gradient(180deg, rgba(255, 242, 205, 0.96), rgba(232, 204, 145, 0.9));
}
.gold-pack {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 224, 119, 0.5), transparent 43%),
    linear-gradient(180deg, rgba(255, 251, 231, 0.94), rgba(235, 214, 169, 0.82));
  border-color: rgba(181, 127, 36, 0.3);
}
.gold-pack-hoard {
  border-color: rgba(160, 99, 19, 0.52);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 7px 16px rgba(112, 69, 13, 0.16);
}
.gold-pack .shop-pack-art .pack-currency {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 6px 8px rgba(117, 72, 8, 0.25));
}
.gold-pack-chest .shop-pack-art .pack-currency { width: 50px; height: 50px; }
.gold-pack-hoard .shop-pack-art .pack-currency { width: 54px; height: 54px; }
.gold-pack .shop-btn .currency-icon { margin-left: 3px; }
.shop-pack-bonus {
  position: absolute;
  top: -8px;
  right: -6px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: #14181d;
  background: linear-gradient(135deg, #e8b23f, #f4cd6e);
  box-shadow: 0 2px 6px rgba(0,0,0,0.22);
}
.shop-pack-name {
  font-size: 12px;
  font-weight: 700;
  color: #8f6334;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.shop-pack-art {
  display: grid;
  height: 46px;
  place-items: center;
}
.shop-pack-art .pack-currency {
  width: 44px;
  height: 44px;
  vertical-align: middle;
  filter: drop-shadow(0 6px 8px rgba(49, 69, 124, 0.24));
}
.pack-medium .shop-pack-art .pack-currency { width: 48px; height: 48px; }
.pack-large .shop-pack-art .pack-currency { width: 52px; height: 52px; }
.shop-pack-amount {
  color: #5a3215;
  line-height: 1;
}
.shop-pack-amount b { display: block; font-size: 18px; font-weight: 900; }
.shop-pack-amount span { display: block; margin-top: 3px; color: #8a6d4a; font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.shop-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 249, 238, 0.72);
  border: 1px solid rgba(176, 129, 58, 0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.38);
}
.shop-card.owned {
  border-color: rgba(96, 153, 104, 0.38);
}
.shop-card.equipped {
  box-shadow:
    inset 0 0 0 1px rgba(220, 176, 86, 0.48),
    inset 0 1px 0 rgba(255,255,255,0.38);
}
.shop-card-art {
  --skin-scale: 0.84;
  height: 124px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 246, 223, 0.92), rgba(234, 214, 176, 0.4) 58%, rgba(171, 129, 70, 0.06) 100%);
}
.shop-card-art img {
  width: calc(100% * var(--skin-scale));
  height: calc(100% * var(--skin-scale));
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,0.18));
}
.shop-card-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.shop-card-top {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #4f2c12;
}
.shop-card-meta,
.shop-card-state {
  font-size: 12px;
  color: #7a6651;
}
.shop-card-price {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #4f2c12;
  background: rgba(225, 184, 104, 0.25);
}
.shop-card-price.premium {
  background: rgba(154, 111, 209, 0.16);
  color: #5c3d7f;
}
.shop-card-actions .shop-btn {
  width: 100%;
  min-height: 40px;
}
.wardrobe-grid {
  margin-top: 8px;
}
.wardrobe-card {
  text-align: left;
  cursor: pointer;
  min-height: 0;
  gap: 8px;
}
.wardrobe-card .shop-card-actions .btn {
  pointer-events: none;
}
.wardrobe-art {
  height: 142px;
  padding: 8px 10px 6px;
  align-items: center;
}
.wardrobe-preview {
  --skin-scale: 0.84;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wardrobe-preview .avatar.skin-avatar,
.wardrobe-preview .avatar.sprite {
  flex: 0 0 auto;
}
.wardrobe-base-sprite {
  width: 110px;
  height: 110px;
  display: block;
  flex: 0 0 auto;
  background-image: var(--sprite-url);
  background-size: 300% 200%;
  background-repeat: no-repeat;
  background-color: transparent;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,0.18));
}
.wardrobe-preview-img {
  width: auto;
  height: calc(78% * var(--skin-scale));
  max-width: calc(74% * var(--skin-scale));
  object-fit: contain;
  object-position: center center;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,0.18));
}
.wardrobe-card .shop-card-copy {
  gap: 6px;
}
.wardrobe-card .shop-card-state {
  min-height: 0;
}
.wardrobe-card .shop-card-actions {
  margin-top: 2px;
}
.wardrobe-card .shop-card-actions .shop-btn {
  min-height: 34px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.wardrobe-card .shop-card-top b {
  font-size: 14px;
  line-height: 1.15;
}
.wardrobe-card .role-chip {
  align-self: flex-start;
}
.wardrobe-card .shop-card-state,
.wardrobe-card .shop-card-copy {
  line-height: 1.25;
}
/* ---------- Boutons ---------- */
.btn {
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid rgba(171, 129, 70, 0.34);
  background:
    linear-gradient(180deg, rgba(244, 232, 205, 0.86), rgba(226, 206, 164, 0.82));
  color: #5a3215;
  font-size: 14px;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 228, 0.35),
    0 6px 14px rgba(0,0,0,0.08);
  cursor: pointer;
}
.btn.primary {
  background:
    linear-gradient(180deg, rgba(243, 219, 162, 0.92), rgba(225, 184, 104, 0.84));
  border-color: rgba(201, 156, 82, 0.5);
  color: #4f2c12;
}
.btn.danger {
  background:
    linear-gradient(180deg, rgba(241, 201, 196, 0.82), rgba(218, 157, 149, 0.78));
  border-color: rgba(181, 89, 89, 0.34);
  color: #6f251f;
}
.btn.wide { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Pop-ups ---------- */
#popup {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at center, rgba(232,178,63,0.08), rgba(13,16,20,0) 46%),
    rgba(13, 16, 20, 0.78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.popup-card {
  width: 100%;
  max-width: 420px;
  max-height: min(92dvh, 860px);
  padding: 28px 28px 26px;
  border-radius: 26px;
  background: transparent;
  border: none;
  box-shadow: none;
  position: relative;
  overflow: visible;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.popup-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(247, 234, 202, 0.9), rgba(232, 213, 172, 0.88));
  border: 2px solid rgba(164, 118, 55, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 228, 0.5),
    0 18px 38px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: none;
}
.popup-card::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1px solid rgba(199, 158, 90, 0.35);
  pointer-events: none;
}
.popup-copy {
  position: relative;
  z-index: 1;
  padding: 4px 10px 6px;
}
.popup-card h3 {
  font-size: 22px;
  margin-bottom: 10px;
  text-wrap: balance;
  color: #5a3215;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 0 rgba(255,240,211,0.22);
  font-family: Georgia, "Times New Roman", serif;
}
.popup-kicker {
  margin-bottom: 7px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8f6334;
  font-weight: 700;
}
.popup-body { font-size: 14px; line-height: 1.58; color: #5a4230; }
.popup-body p { margin: 6px 0; }
.action-popup .popup-body {
  padding: 10px 0 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.popup-actions { display: flex; gap: 10px; margin-top: 18px; position: relative; z-index: 1; }
.popup-actions .btn {
  --popup-btn-url: var(--modal-button-secondary-url);
  flex: 1;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px 12px;
  border-radius: 18px;
  border: none;
  background: transparent;
  background-color: transparent;
  color: #f6e4bf;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;   /* le texte ne doit jamais déborder de la planche */
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 rgba(0,0,0,0.45);
  box-shadow: none;
  position: relative;
  overflow: visible;
  isolation: isolate;
  z-index: 0;
}
.popup-actions .btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--popup-btn-url) center / 100% 100% no-repeat;
  pointer-events: none;
  z-index: -1;
}
.popup-actions .btn:hover,
.popup-actions .btn:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.04);
}
.popup-actions .btn:active {
  transform: translateY(1px);
  filter: brightness(0.97);
}
.popup-actions .btn.primary {
  --popup-btn-url: var(--modal-button-primary-url);
  color: #4d2508;
  text-shadow: 0 1px 0 rgba(255,236,195,0.3);
}
.popup-actions .btn > * {
  position: relative;
  z-index: 1;
}
.travel-choice {
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(171, 129, 70, 0.34);
  background:
    linear-gradient(180deg, rgba(244, 232, 205, 0.86), rgba(226, 206, 164, 0.82));
  color: #5a3215;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 228, 0.35),
    0 10px 20px rgba(0,0,0,0.12);
  cursor: pointer;
}
.travel-choice:hover,
.travel-choice:focus-visible {
  transform: translateY(-1px);
  background:
    linear-gradient(180deg, rgba(248, 236, 212, 0.92), rgba(232, 213, 172, 0.88));
}
.travel-choice.capital {
  border-color: rgba(201, 156, 82, 0.5);
  background:
    linear-gradient(180deg, rgba(243, 219, 162, 0.92), rgba(225, 184, 104, 0.84));
}
.travel-choice-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  color: #4f2c12;
}
.travel-choice-meta {
  font-size: 11px;
  font-weight: 700;
  color: #7a6651;
}
.player-peek {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(251, 240, 215, 0.88), rgba(231, 208, 165, 0.82));
  border: 1px solid rgba(176, 129, 58, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 249, 231, 0.5);
}
.player-peek-copy { min-width: 0; flex: 1; }
.player-peek-name {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
  font-size: 18px;
  color: #4f2c12;
}
.player-peek-class {
  margin-top: 2px;
  font-size: 13px;
  color: #7c6953;
}
.player-peek-gear {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #6a573f;
}
.player-choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.popup-actions-wrap { flex-wrap: wrap; }
.trade-popup { width: min(94vw, 720px); }
.trade-head { margin-bottom: 10px; }
.trade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.trade-side {
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(251, 240, 215, 0.82), rgba(231, 208, 165, 0.76));
  border: 1px solid rgba(176, 129, 58, 0.26);
}
.trade-side-title {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  color: #4f2c12;
}
.trade-gold-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #6a573f;
}
.trade-gold-input,
.trade-qty-input {
  width: 84px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid rgba(167, 127, 66, 0.28);
  background: rgba(255, 248, 231, 0.92);
  color: #3a2615;
  font-weight: 700;
}
.trade-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.trade-filter-btn {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 12px;
}
.trade-filter-btn.active {
  background:
    linear-gradient(180deg, rgba(243, 219, 162, 0.92), rgba(225, 184, 104, 0.84));
  border-color: rgba(201, 156, 82, 0.5);
  color: #4f2c12;
}
.trade-list {
  margin-top: 10px;
  max-height: min(34vh, 260px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}
.trade-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 250, 239, 0.72);
  border: 1px solid rgba(176, 129, 58, 0.2);
}
.trade-row-art {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(244, 232, 205, 0.92), rgba(226, 206, 164, 0.84));
  border: 1px solid rgba(171, 129, 70, 0.22);
}
.trade-row-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.16));
}
.trade-row-fallback {
  font-size: 24px;
  line-height: 1;
}
.trade-row-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.trade-row-name {
  font-size: 13px;
  color: #4f2c12;
  font-weight: 700;
}
.trade-row-kind {
  font-size: 10px;
  font-weight: 800;
  color: #8a7457;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.trade-row-have {
  font-size: 12px;
  color: #7c6953;
  font-weight: 700;
}
.trade-summary-box {
  min-height: 120px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 250, 239, 0.72);
  border: 1px solid rgba(176, 129, 58, 0.2);
  color: #4f2c12;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .trade-grid { grid-template-columns: 1fr; }
}
.popup-card-ornament {
  display: none;
}
.action-popup {
  padding-top: 6px;
}
.popup-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 6px;
  min-height: 136px;
}
.popup-hero-glow {
  position: absolute;
  width: 176px;
  height: 176px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(255,224,143,0.12), rgba(255,224,143,0) 72%);
  filter: blur(10px);
}
.popup-hero-frame {
  position: relative;
  width: 164px;
  height: 164px;
  border-radius: 30px;
  border: none;
  background: transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.popup-hero-art {
  position: relative;
  z-index: 1;
  width: 124px;
  height: 124px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.42));
}
.popup-hero-frame.resource .popup-hero-art,
.popup-hero-frame.monster .popup-hero-art {
  width: 142px;
  height: 142px;
}
.popup-hero-frame.resource .popup-hero-art {
  width: 154px;
  height: 154px;
}
.popup-hero-frame.resource .popup-hero-art {
  width: 164px;
  height: 164px;
}
.popup-hero-frame.monster .popup-hero-art {
  width: 156px;
  height: 156px;
}
.popup-hero-frame.terrain .popup-hero-art {
  width: 160px;
  height: 160px;
  object-fit: cover;
}
.popup-hero-frame.structure .popup-hero-art {
  width: 136px;
  height: 136px;
}
.popup-hero-badge {
  position: absolute;
  right: 6px;
  bottom: -4px;
  max-width: 76%;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(170,126,68,0.28);
  background: linear-gradient(180deg, rgba(45,33,22,0.96), rgba(23,18,14,0.98));
  color: #f5deb0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}
.popup-card > * {
  position: relative;
  z-index: 1;
}
.popup-hero-emblem {
  position: relative;
  z-index: 1;
  font-size: 54px;
  color: #f4dfb0;
  text-shadow: 0 3px 12px rgba(0,0,0,0.4);
}
.action-popup.tone-harvest .popup-hero-glow { background: radial-gradient(circle at center, rgba(109,180,91,0.2), rgba(109,180,91,0) 72%); }
.action-popup.tone-combat .popup-hero-glow,
.action-popup.tone-danger .popup-hero-glow { background: radial-gradient(circle at center, rgba(209,87,87,0.2), rgba(209,87,87,0) 72%); }
.action-popup.tone-travel .popup-hero-glow { background: radial-gradient(circle at center, rgba(74,159,216,0.18), rgba(74,159,216,0) 72%); }
#combatFx {
  position: absolute;
  inset: 0;
  z-index: 55;
  pointer-events: none;
}
#harvestFx {
  position: absolute;
  inset: 0;
  z-index: 54;
  pointer-events: none;
}
.combat-fx-backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 14, 0.18);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  animation: combatBackdrop 0.9s ease;
}
.combat-fx-center {
  width: min(76vw, 320px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.combat-fx-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0,0,0,0.45);
}
.combat-fx-subtitle {
  margin-top: 6px;
  color: rgba(232,236,241,0.8);
  font-size: 13px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.45);
}
.combat-fx-swords {
  position: relative;
  width: 220px;
  height: 164px;
  margin: 12px 0 8px;
}
.combat-fx-sword {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118px;
  height: auto;
  transform-origin: 24% 78%;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,0.55));
  user-select: none;
  -webkit-user-drag: none;
}
.combat-fx-sword.sword-left {
  transform: translate(-108px, -40px) rotate(-36deg) scale(0.9);
}
.combat-fx-sword.sword-right {
  transform: translate(-10px, -40px) scaleX(-1) rotate(-36deg) scale(0.9);
}
.combat-fx-flash {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0);
  transform: translate(-50%, -50%) scale(0.25);
  box-shadow: 0 0 0 rgba(255,255,255,0);
}
.combat-fx-status {
  color: rgba(232,236,241,0.72);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px rgba(0,0,0,0.45);
}
.combat-fx-center.phase-impact {
  animation: combatCardShake 0.24s ease-in-out 2;
}
.combat-fx-backdrop.phase-impact .combat-fx-sword.sword-left {
  animation: swordClashLeft 0.34s ease forwards;
}
.combat-fx-backdrop.phase-impact .combat-fx-sword.sword-right {
  animation: swordClashRight 0.34s ease forwards;
}
.combat-fx-backdrop.phase-impact .combat-fx-flash {
  animation: clashFlash 0.34s ease forwards;
}
.combat-fx-backdrop.victory.phase-resolve .combat-fx-status { color: #f4cd6e; }
.combat-fx-backdrop.defeat.phase-resolve .combat-fx-status { color: #ff9b9b; }

.harvest-fx-backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--harvest-tier) 10%, transparent 90%), rgba(8,10,14,0) 44%),
    rgba(8, 10, 14, 0.12);
}
.harvest-fx-center {
  position: relative;
  width: min(82vw, 330px);
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.harvest-fx-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 220px;
  height: 180px;
  transform: translate(-50%, -56%);
}
.harvest-fx-shadow {
  position: absolute;
  left: 50%;
  bottom: 26px;
  width: 110px;
  height: 30px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.46), rgba(0,0,0,0) 72%);
  filter: blur(1.5px);
}
.harvest-fx-target {
  position: absolute;
  left: 50%;
  bottom: 30px;
  width: 96px;
  height: 96px;
  object-fit: contain;
  transform: translateX(-50%);
  filter: drop-shadow(0 12px 18px rgba(0,0,0,0.42));
  animation: harvestTargetBump var(--harvest-cycle, 640ms) ease-in-out infinite;
}
.harvest-fx-target.mineral {
  width: 116px;
  height: 116px;
  bottom: 18px;
}
.harvest-fx-target.wood {
  width: 110px;
  height: 110px;
  bottom: 18px;
}
.harvest-fx-target.plant {
  width: 94px;
  height: 94px;
  bottom: 22px;
}
.harvest-fx-target.ingredient {
  width: 92px;
  height: 92px;
  bottom: 22px;
}
.harvest-fx-tool {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 136px;
  height: auto;
  transform-origin: 78% 78%;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,0.5));
  user-select: none;
  -webkit-user-drag: none;
}
.harvest-fx-tool.tool-mineral {
  transform: translate(14px, -88px) rotate(24deg) scale(0.9);
  animation: harvestPickaxe var(--harvest-cycle, 640ms) ease-in-out infinite;
}
.harvest-fx-tool.tool-wood {
  transform-origin: 78% 90%;
  transform: translate(6px, -76px) scaleX(-1) rotate(8deg) scale(1);
  animation: harvestAxe var(--harvest-cycle, 640ms) ease-in-out infinite;
}
.harvest-fx-tool.tool-plant {
  width: 126px;
  transform: translate(6px, -56px) rotate(18deg) scale(0.94);
  animation: harvestSickle var(--harvest-cycle, 640ms) ease-in-out infinite;
}
.harvest-fx-tool.tool-ingredient {
  width: 118px;
  transform-origin: 78% 84%;
  transform: translate(16px, -48px) rotate(20deg) scale(0.94);
  animation: harvestKnife var(--harvest-cycle, 640ms) ease-in-out infinite;
}
.harvest-fx-impact {
  position: absolute;
  left: 50%;
  bottom: 62px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transform: translateX(-50%) scale(0.2);
  background: rgba(255, 243, 190, 0);
  box-shadow: 0 0 0 rgba(255, 213, 120, 0);
  animation: harvestImpact var(--harvest-cycle, 640ms) ease-in-out infinite;
}
.harvest-fx-impact.impact-wood {
  animation: harvestImpactWood var(--harvest-cycle, 640ms) ease-in-out infinite;
}
.harvest-fx-impact.impact-ingredient {
  width: 34px;
  height: 34px;
  bottom: 58px;
  border-radius: 0;
  background: none;
  box-shadow: none;
  animation: harvestImpactIngredient var(--harvest-cycle, 640ms) ease-in-out infinite;
}
.harvest-fx-impact.impact-ingredient::before,
.harvest-fx-impact.impact-ingredient::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,247,207,0), rgba(255,247,207,0.96), rgba(255,247,207,0));
  transform-origin: center;
  box-shadow: 0 0 12px rgba(182, 237, 210, 0.52);
}
.harvest-fx-impact.impact-ingredient::before {
  transform: translate(-50%, -50%) rotate(34deg);
}
.harvest-fx-impact.impact-ingredient::after {
  transform: translate(-50%, -50%) rotate(-34deg);
}
.harvest-fx-title {
  position: relative;
  margin-top: 176px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0,0,0,0.45);
}
.harvest-fx-subtitle {
  position: relative;
  margin-top: 4px;
  color: rgba(232,236,241,0.8);
  font-size: 12px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.45);
}

@keyframes swordClashLeft {
  0% { transform: translate(-108px, -40px) rotate(-36deg) scale(0.9); }
  65% { transform: translate(-52px, -26px) rotate(-7deg) scale(1); }
  100% { transform: translate(-70px, -30px) rotate(-16deg) scale(0.96); }
}

@keyframes swordClashRight {
  0% { transform: translate(-10px, -40px) scaleX(-1) rotate(-36deg) scale(0.9); }
  65% { transform: translate(-62px, -26px) scaleX(-1) rotate(-7deg) scale(1); }
  100% { transform: translate(-44px, -30px) scaleX(-1) rotate(-16deg) scale(0.96); }
}

@keyframes clashFlash {
  0% {
    background: rgba(255,255,255,0);
    transform: translate(-50%, -50%) scale(0.2);
    box-shadow: 0 0 0 rgba(255,255,255,0);
  }
  45% {
    background: rgba(255,245,220,0.95);
    transform: translate(-50%, -50%) scale(1.7);
    box-shadow: 0 0 24px rgba(255,214,130,0.7);
  }
  100% {
    background: rgba(255,245,220,0);
    transform: translate(-50%, -50%) scale(2.4);
    box-shadow: 0 0 0 rgba(255,214,130,0);
  }
}

@keyframes combatCardShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
}

@keyframes combatBackdrop {
  0% { background: rgba(13, 16, 20, 0.72); }
  40% { background: rgba(22, 18, 20, 0.88); }
  100% { background: rgba(13, 16, 20, 0.72); }
}

@keyframes harvestPulse {
  0% { transform: scale(0.88); opacity: 0.05; }
  35% { opacity: 0.45; }
  100% { transform: scale(1.08); opacity: 0; }
}

@keyframes harvestFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

@keyframes harvestPickaxe {
  0%, 100% { transform: translate(14px, -88px) rotate(24deg) scale(0.9); }
  46% { transform: translate(-18px, -30px) rotate(-18deg) scale(1); }
  58% { transform: translate(-6px, -42px) rotate(-8deg) scale(0.98); }
}

@keyframes harvestAxe {
  0%, 100% { transform: translate(6px, -76px) scaleX(-1) rotate(8deg) scale(1); }
  14% { transform: translate(7px, -77px) scaleX(-1) rotate(22deg) scale(0.98); }
  46% { transform: translate(8px, -78px) scaleX(-1) rotate(92deg) scale(0.92); }
  58% { transform: translate(8px, -78px) scaleX(-1) rotate(96deg) scale(0.94); }
}

@keyframes harvestSickle {
  0%, 100% { transform: translate(6px, -56px) rotate(18deg) scale(0.94); }
  48% { transform: translate(-28px, -16px) rotate(-38deg) scale(1); }
  60% { transform: translate(-6px, -22px) rotate(-12deg) scale(0.98); }
}

@keyframes harvestKnife {
  0%, 100% { transform: translate(16px, -48px) rotate(20deg) scale(0.94); }
  18% { transform: translate(18px, -54px) rotate(34deg) scale(0.96); }
  48% { transform: translate(-18px, -10px) rotate(-46deg) scale(1); }
  60% { transform: translate(-8px, -18px) rotate(-22deg) scale(0.98); }
}

@keyframes harvestImpact {
  0%, 34%, 100% {
    opacity: 0;
    transform: translateX(-50%) scale(0.2);
    background: rgba(255, 243, 190, 0);
    box-shadow: 0 0 0 rgba(255, 213, 120, 0);
  }
  46% {
    opacity: 1;
    transform: translateX(-50%) scale(1.7);
    background: rgba(255, 243, 190, 0.92);
    box-shadow: 0 0 22px rgba(255, 213, 120, 0.58);
  }
  64% {
    opacity: 0;
    transform: translateX(-50%) scale(2.3);
    background: rgba(255, 243, 190, 0);
    box-shadow: 0 0 0 rgba(255, 213, 120, 0);
  }
}

@keyframes harvestImpactWood {
  0%, 36%, 100% {
    opacity: 0;
    transform: translateX(-50%) scale(0.2);
    background: rgba(255, 243, 190, 0);
    box-shadow: 0 0 0 rgba(255, 213, 120, 0);
  }
  49% {
    opacity: 1;
    transform: translateX(-50%) scale(1.75);
    background: rgba(255, 243, 190, 0.94);
    box-shadow: 0 0 22px rgba(255, 213, 120, 0.62);
  }
  58% {
    opacity: 0;
    transform: translateX(-50%) scale(2.35);
    background: rgba(255, 243, 190, 0);
    box-shadow: 0 0 0 rgba(255, 213, 120, 0);
  }
}

@keyframes harvestImpactIngredient {
  0%, 40%, 100% {
    opacity: 0;
    transform: translateX(-50%) scale(0.4);
    filter: drop-shadow(0 0 0 rgba(196, 255, 220, 0));
  }
  48% {
    opacity: 1;
    transform: translateX(-50%) scale(1.15);
    filter: drop-shadow(0 0 14px rgba(196, 255, 220, 0.85));
  }
  62% {
    opacity: 0.18;
    transform: translateX(-50%) scale(1.42);
    filter: drop-shadow(0 0 6px rgba(196, 255, 220, 0.28));
  }
}

@keyframes harvestTargetBump {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
  46% { transform: translateX(-50%) translateY(2px) scale(0.96); }
  58% { transform: translateX(-50%) translateY(-2px) scale(1.03); }
}
.vs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: var(--panel-2);
  font-variant-numeric: tabular-nums;
}
.vs-x { color: var(--dim); font-size: 11px; text-transform: uppercase; }
.result-popup .popup-copy {
  padding-top: 0;
}
.result-popup .popup-hero {
  min-height: 120px;
  margin-bottom: 2px;
}
.result-popup .popup-hero-frame.monster .popup-hero-art {
  width: 132px;
  height: 132px;
}
.battle-vs {
  margin: 6px 0 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(67, 55, 39, 0.92);
  color: #eadbb9;
  box-shadow: inset 0 1px 0 rgba(255, 245, 220, 0.08);
}
.battle-vs .vs-x {
  color: rgba(234, 219, 185, 0.7);
  font-size: 10px;
  letter-spacing: 0.12em;
}
.result-popup .popup-body p {
  margin: 10px 0;
}
.battle-label {
  display: inline-block;
  min-width: 96px;
  color: #8f6334;
  font-weight: 700;
}
.battle-empty {
  margin-top: 12px;
}

/* ---------- Création de personnage ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(22px, env(safe-area-inset-top)) 16px calc(22px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 178, 63, 0.16), transparent 46%),
    radial-gradient(circle at 12% 88%, rgba(80, 126, 92, 0.2), transparent 42%),
    radial-gradient(circle at 90% 82%, rgba(38, 98, 115, 0.18), transparent 40%),
    repeating-linear-gradient(120deg, rgba(232, 236, 241, 0.035) 0px, rgba(232, 236, 241, 0.035) 1.5px, transparent 1.5px, transparent 46px),
    repeating-linear-gradient(60deg, rgba(232, 236, 241, 0.03) 0px, rgba(232, 236, 241, 0.03) 1.5px, transparent 1.5px, transparent 46px),
    linear-gradient(160deg, #141b24 0%, #0c1017 45%, #05070a 100%);
}
.creation-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 26px 22px calc(24px + env(safe-area-inset-bottom));
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(36, 44, 54, 0.94), rgba(18, 22, 27, 0.96));
  border: 1px solid rgba(214, 178, 102, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 220, 0.06),
    inset 0 0 60px rgba(0, 0, 0, 0.32),
    0 28px 54px rgba(0, 0, 0, 0.5);
  animation: splashRise 0.55s ease-out;
}
.creation-card::before {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 17px;
  border: 1px solid rgba(214, 178, 102, 0.14);
  pointer-events: none;
}
.auth-logo {
  display: block;
  position: relative;
  z-index: 1;
  width: min(84%, 300px);
  height: auto;
  margin: 2px auto 12px;
  filter:
    drop-shadow(0 14px 18px rgba(0, 0, 0, 0.45))
    drop-shadow(0 0 16px rgba(244, 205, 110, 0.18));
}
.auth-tabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 18px;
  padding: 5px;
  border-radius: 12px;
  background: rgba(7, 9, 12, 0.5);
  border: 1px solid rgba(214, 178, 102, 0.2);
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.4);
}
.auth-tab {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  background: none;
  color: rgba(232, 236, 241, 0.55);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.auth-tab.active {
  background: linear-gradient(180deg, rgba(243, 219, 162, 0.92), rgba(225, 184, 104, 0.84));
  color: #4f2c12;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.creation-card > p { margin-bottom: 16px; font-size: 13px; }
.creation-card h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 700;
  color: #f4cd6e;
  text-align: center;
}
.otp-dev-code { color: #f4cd6e; }
.link-btn {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: none;
  background: none;
  color: rgba(232, 236, 241, 0.6);
  font-size: 12.5px;
  text-align: center;
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: rgba(232, 236, 241, 0.9); }
.creation-card input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid rgba(214, 178, 102, 0.2);
  background: rgba(7, 9, 12, 0.5);
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 14px;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.creation-card input::placeholder { color: rgba(139, 150, 165, 0.75); }
.creation-card input:focus {
  outline: none;
  border-color: rgba(232, 178, 63, 0.55);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(232, 178, 63, 0.14);
}
.class-grid { display: flex; flex-direction: column; gap: 8px; }
.class-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.class-card.selected { border-color: var(--pa); background: rgba(74, 159, 216, 0.12); }
.class-card .avatar { width: 38px; height: 38px; }
.class-info { display: flex; flex-direction: column; gap: 2px; }
.class-info small { color: var(--dim); font-size: 11.5px; line-height: 1.35; }

/* ---------- Panneau DEV ---------- */
#devBtn {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top));
  right: 10px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(29, 35, 43, 0.85);
  color: var(--dim);
  font-size: 16px;
  cursor: pointer;
  z-index: 35;
}
#devPanel {
  position: absolute;
  top: calc(106px + env(safe-area-inset-top));
  right: 10px;
  width: 168px;
  padding: 10px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  z-index: 35;
}
.dev-row { display: flex; gap: 5px; }
#devPanel button {
  flex: 1;
  min-height: 34px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}
#devPanel button.active { background: var(--pa); color: #0d1014; border-color: var(--pa); }
#devPanel button.danger { color: var(--hp); }

@media (prefers-reduced-motion: reduce) {
  .bar-fill, .toast { transition: none; }
}
.cook-item-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  vertical-align: -7px;
  margin-right: 6px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.14));
}

/* ---------- Habillage desktop ----------
 * Le cadre mobile (#app) garde toujours exactement la même taille et reste
 * centré (margin:0 auto) — sur un écran plus large que 520px, cet arrière-
 * plan habille l'espace qui reste visible de part et d'autre, quelle que
 * soit la largeur, plutôt qu'un noir plat. Losanges croisés en écho à la
 * grille isométrique du jeu + lueurs or/bleu (couleurs d'accent du thème). */
html, body {
  background:
    radial-gradient(ellipse 65% 55% at 50% 0%, rgba(74, 159, 216, 0.30), transparent 62%),
    radial-gradient(ellipse 80% 65% at 50% 100%, rgba(232, 178, 63, 0.22), transparent 68%),
    repeating-linear-gradient(120deg, rgba(232, 236, 241, 0.06) 0px, rgba(232, 236, 241, 0.06) 1.5px, transparent 1.5px, transparent 46px),
    repeating-linear-gradient(60deg, rgba(232, 236, 241, 0.045) 0px, rgba(232, 236, 241, 0.045) 1.5px, transparent 1.5px, transparent 46px),
    linear-gradient(160deg, #141b24 0%, #0c1017 45%, #05070a 100%);
  background-color: #05070a;
}

/* ---------- Poste de jeu desktop ---------- */
#desktopLayout {
  width: 100%;
  height: 100dvh;
}
.desktop-rail { display: none; }

@media (min-width: 1600px) {
  body { overflow: hidden; }
  #desktopLayout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 520px minmax(0, 1fr);
    gap: 16px;
    width: min(100%, 1600px);
    margin: 0 auto;
  }
  #app {
    width: 520px;
    margin: 0;
    box-shadow: 0 0 42px rgba(0, 0, 0, 0.58);
  }
  .desktop-rail {
    display: flex;
    min-width: 0;
    height: calc(100dvh - 24px);
    margin: 12px 0;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s ease;
  }
  .desktop-rail-left { transform: translateX(14px); }
  .desktop-rail-right { transform: translateX(-14px); }
  .desktop-panels-ready .desktop-rail {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
  }
  .desktop-panel {
    position: relative;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(212, 171, 95, 0.62);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(247, 235, 203, 0.97), rgba(226, 207, 167, 0.96));
    color: #4a3520;
    box-shadow: inset 0 0 0 5px rgba(113, 73, 29, 0.07), inset 0 1px 0 rgba(255, 250, 229, 0.78), 0 18px 42px rgba(0, 0, 0, 0.34);
  }
  .desktop-panel::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(133, 91, 35, 0.18);
    border-radius: 16px;
    pointer-events: none;
  }
  .desktop-panel-head {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 14px 20px 10px;
    border-bottom: 1px solid rgba(133, 91, 35, 0.16);
    background: linear-gradient(180deg, rgba(255, 248, 224, 0.38), transparent);
  }
  .desktop-panel-head h2 {
    margin-top: 1px;
    color: #4d2d16;
    font: 700 22px/1 Georgia, "Times New Roman", serif;
  }
  .desktop-panel-kicker {
    color: #9a7034;
    font-size: 9.5px;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
  }
  .desktop-panel-link {
    min-height: 32px;
    padding: 6px 13px;
    border: 1px solid rgba(139, 93, 35, 0.3);
    border-radius: 999px;
    background: rgba(255, 246, 216, 0.55);
    color: #785020;
    font: 700 12px Georgia, "Times New Roman", serif;
    cursor: pointer;
  }
  .desktop-panel-link:hover { background: rgba(232, 195, 99, 0.38); }
  .desktop-profile-panel { flex: 0 0 auto; }
  .desktop-map-panel { flex: 1 1 auto; }
  .desktop-social-panel { display: flex; flex: 1; flex-direction: column; }
  .desktop-profile-body { position: relative; z-index: 1; padding: 12px 18px 16px; }
  .desktop-hero-summary { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .desktop-hero-summary .avatar.skin-avatar.hero,
  .desktop-hero-summary .avatar.sprite.hero {
    width: 82px;
    height: 82px;
    flex: 0 0 82px;
    border-width: 2px;
  }
  .desktop-hero-copy { min-width: 0; }
  .desktop-hero-copy .hero-name { overflow: hidden; font-size: 23px; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-skin-name { margin-top: 3px; overflow: hidden; color: #9a7c55; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
  .desktop-stat-grid > div {
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid rgba(142, 99, 43, 0.16);
    border-radius: 10px;
    background: rgba(255, 248, 224, 0.42);
  }
  .desktop-stat-grid span,
  .desktop-equipment-item small,
  .desktop-buff small {
    display: block;
    color: #9a7c55;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .desktop-stat-grid b { display: block; overflow: hidden; margin-top: 2px; color: #4d2d16; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-equipment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
  .desktop-equipment-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 5px 7px 5px 3px;
    border-radius: 11px;
    background: rgba(91, 63, 31, 0.07);
  }
  .desktop-equipment-item img { width: 48px; height: 48px; object-fit: contain; filter: drop-shadow(0 5px 5px rgba(72, 42, 17, 0.2)); }
  .desktop-equipment-item span { min-width: 0; }
  .desktop-equipment-item b { display: block; overflow: hidden; color: #4d2d16; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-equipment-item .tier { font-style: normal; }
  .desktop-mastery-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: #7a6244; font-size: 11px; }
  .desktop-mastery-row b { color: #4d2d16; }
  .desktop-buff { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 7px 10px; border-radius: 11px; background: rgba(122, 86, 30, 0.06); }
  .desktop-buff.active { background: rgba(94, 131, 62, 0.13); }
  .desktop-buff img { width: 36px; height: 36px; object-fit: contain; }
  .desktop-buff > span:last-child { min-width: 0; flex: 1; }
  .desktop-buff b { display: block; color: #4d2d16; font-size: 11.5px; }
  .desktop-buff em { color: #718251; font-size: 10px; font-style: normal; }
  .desktop-buff-empty { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: #b59970; background: rgba(255,255,255,0.3); }
  .desktop-minimap-wrap { position: relative; z-index: 1; display: grid; padding: 10px 18px 4px; place-items: center; }
  #desktopMinimap {
    display: block;
    width: min(100%, 350px);
    aspect-ratio: 1;
    border: 1px solid rgba(115, 78, 35, 0.35);
    border-radius: 14px;
    background: #18201c;
    image-rendering: pixelated;
    box-shadow: inset 0 0 0 3px rgba(255, 240, 202, 0.22), 0 8px 18px rgba(64, 42, 19, 0.18);
  }
  .desktop-map-legend { position: relative; z-index: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px 16px; padding: 7px 16px 14px; color: #7a6244; font-size: 10.5px; }
  .desktop-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
  .desktop-map-legend .legend-mark { width: 9px; height: 9px; }
  .desktop-social-body {
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: 0;
    padding: 12px 18px 20px;
    overflow-y: auto;
    scrollbar-color: rgba(121, 83, 38, 0.55) transparent;
    scrollbar-width: thin;
  }
  .desktop-social-body p { margin: 6px 0; line-height: 1.45; color: #5a4230; }
  .desktop-social-body .feed { height: min(25vh, 220px); }
  .desktop-live-dot { width: 11px; height: 11px; margin-right: 5px; border-radius: 50%; background: #65a85b; box-shadow: 0 0 0 4px rgba(101, 168, 91, 0.13), 0 0 12px rgba(101, 168, 91, 0.48); }
  .desktop-panel-emphasis .desktop-panel { animation: desktop-panel-pulse 0.65s ease; }
}

@keyframes desktop-panel-pulse {
  0%, 100% { filter: brightness(1); }
  45% { filter: brightness(1.08); box-shadow: inset 0 0 0 5px rgba(113, 73, 29, 0.07), 0 0 0 2px rgba(232, 178, 63, 0.42), 0 18px 42px rgba(0,0,0,0.34); }
}
