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

:root {
  --bg:        #0f0f1a;
  --surface:   #1a1a2e;
  --surface2:  #22223a;
  --border:    rgba(255, 255, 255, 0.07);
  --gold:      #f5c518;
  --gold-dim:  #d4a000;
  --red:       #ef4444;
  --green:     #4ade80;
  --purple:    #c084fc;
  --text:      #e8e8f0;
  --muted:     #6b7280;
  --nav-h:     64px;
}

html {
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: 100dvh;
  overflow: hidden;
}

#app {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────── */
header {
  padding: 14px 16px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

h1 {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(245, 197, 24, 0.4);
}

/* ── Boutons Header (Compte + Paramètres) ──────── */
.header-btns {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.header-btns button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 9px;
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.header-btns button:hover  { color: var(--text); background: rgba(255,255,255,0.07); }
.header-btns button:active { background: rgba(255,255,255,0.12); }

/* ── Vue Paramètres ──────────────────────────── */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
}

.settings-section-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--muted);
  font-weight: 700;
  padding: 14px 16px 8px;
}

.lang-options-list { display: flex; flex-direction: column; }

.lang-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  width: 100%;
}
.lang-option:first-child { border-top: none; }
.lang-option:hover       { background: rgba(255,255,255,0.04); }

.lang-option.is-active {
  background: rgba(245,197,24,0.05);
}

.lang-option-flag {
  font-size: 1.45rem;
  line-height: 1;
  flex-shrink: 0;
}

.lang-option-name {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.lang-option.is-active .lang-option-name { color: var(--gold); }

.lang-option-check {
  font-size: 1rem;
  font-weight: 800;
  color: var(--gold);
  opacity: 0;
  transition: opacity 0.15s;
}
.lang-option.is-active .lang-option-check { opacity: 1; }

.settings-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 15px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.settings-back-btn:hover  { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.16); }
.settings-back-btn:active { background: rgba(255,255,255,0.12); }

/* ── Stats ──────────────────────────────────── */
#stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 14px 16px 0;
  flex-shrink: 0;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.stat .label {
  font-size: 0.57rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  white-space: nowrap;
}

.stat span:last-child {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--gold);
}

#stat-gems   { color: var(--purple); }
#stat-damage { color: #f87171; }
#stat-relics { color: #22d3ee; }

/* ── Boost banner ───────────────────────────── */
#boost-banner {
  margin: 10px 16px 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(245, 197, 24, 0.07);
  border: 1px solid rgba(245, 197, 24, 0.28);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  animation: boost-banner-pulse 2s ease-in-out infinite;
}
#boost-banner[hidden] { display: none; }
#boost-timer { color: var(--muted); font-size: 0.72rem; font-weight: 600; }

@keyframes boost-banner-pulse {
  0%, 100% { border-color: rgba(245, 197, 24, 0.22); }
  50%       { border-color: rgba(245, 197, 24, 0.55); }
}

/* ── Views ──────────────────────────────────── */
.view {
  flex: 1;
  min-height: 0;           /* critical : permet au flex item de rétrécir + scroller */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.10) transparent;
}
.view.hidden { display: none; }

/* ── Titre de vue ───────────────────────────── */
.view-title-bar {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  padding-bottom: 14px;
}

/* ── Vue Dig ────────────────────────────────── */
#view-dig {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 16px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 20px);
}

#block-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

#block-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 1.4em;
}

#block-name {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--muted);
  font-weight: 600;
}

/* ── Rareté ─────────────────────────────────── */
.rarity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

.rarity-commun     { background: rgba(107,114,128,0.2); color: #9ca3af; }
.rarity-peu-commun { background: rgba(34,197,94,0.15);  color: #4ade80; }
.rarity-rare       { background: rgba(59,130,246,0.18); color: #60a5fa; }
.rarity-epique     { background: rgba(168,85,247,0.2);  color: var(--purple); }
.rarity-legendaire { background: rgba(245,197,24,0.18); color: var(--gold); }

/* ── Bloc ───────────────────────────────────── */
#block {
  width: 170px;
  height: 170px;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  box-shadow: 0 12px 40px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.16);
  /* will-change applied only during active animations to avoid GPU layer caching
     the empty state (emoji not yet painted) on first load */
  transition: border-color 0.3s, box-shadow 0.3s;
  touch-action: manipulation;
}
/* Promote to GPU layer only when actually animating */
#block.anim-spawn,
#block.anim-hit,
#block.anim-break,
#block.hp-critical {
  will-change: transform;
}

#block-icon {
  font-size: 4rem;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
  position: relative;
  z-index: 1;
}

/* Skins de pioche (priorité sur les glows de rareté) */
#block.skin-golden {
  border-color: rgba(245, 197, 24, 0.8) !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.65), 0 0 32px rgba(245,197,24,0.5) !important;
}
#block.skin-diamond {
  border-color: rgba(125, 211, 252, 0.8) !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.65), 0 0 32px rgba(125,211,252,0.5) !important;
}

/* Glows de rareté */
#block.rarity-rare {
  border-color: rgba(59,130,246,0.5);
  box-shadow: 0 12px 40px rgba(0,0,0,0.65), 0 0 22px rgba(59,130,246,0.25),
              inset 0 1px 0 rgba(255,255,255,0.16);
}
#block.rarity-epique {
  border-color: rgba(168,85,247,0.55);
  box-shadow: 0 12px 40px rgba(0,0,0,0.65), 0 0 28px rgba(168,85,247,0.32),
              inset 0 1px 0 rgba(255,255,255,0.16);
}
#block.rarity-legendaire {
  border-color: rgba(245,197,24,0.65);
  box-shadow: 0 12px 40px rgba(0,0,0,0.65), 0 0 34px rgba(245,197,24,0.38),
              inset 0 1px 0 rgba(255,255,255,0.16);
}

/* Overlay cracks */
#block::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  transition: background 0.12s;
  pointer-events: none;
}
#block.crack-1::after { background: rgba(0,0,0,0.13); }
#block.crack-2::after { background: rgba(0,0,0,0.32); }
#block.crack-3::after { background: rgba(0,0,0,0.52); }

/* HP critique — défini avant anim-hit pour que hit prime */
#block.hp-critical {
  border-color: rgba(239, 68, 68, 0.7) !important;
  animation: hp-critical-pulse 0.85s ease-in-out infinite;
}

@keyframes hp-critical-pulse {
  0%, 100% { box-shadow: 0 12px 40px rgba(0,0,0,0.65), 0 0 18px rgba(239,68,68,0.25); }
  50%       { box-shadow: 0 12px 40px rgba(0,0,0,0.65), 0 0 36px rgba(239,68,68,0.55); }
}

/* ── Animations bloc ────────────────────────── */
@keyframes hit-anim {
  0%   { transform: scale(1)    rotate(0deg)    translate(0px,  0px); }
  12%  { transform: scale(0.86) rotate(-5.5deg) translate(-3px, 2px); }
  28%  { transform: scale(0.92) rotate(3.5deg)  translate(3px, -2px); }
  50%  { transform: scale(1.06) rotate(-1.5deg) translate(-1px,-2px); }
  72%  { transform: scale(1.08) rotate(1deg)    translate(1px,  1px); }
  90%  { transform: scale(0.98) rotate(-0.3deg) translate(0px,  0px); }
  100% { transform: scale(1)    rotate(0deg)    translate(0px,  0px); }
}

@keyframes break-anim {
  0%   { transform: scale(1);    opacity: 1;   filter: brightness(1);   }
  35%  { transform: scale(1.22); opacity: 0.8; filter: brightness(2.4); }
  100% { transform: scale(0.04); opacity: 0; }
}

@keyframes spawn-anim {
  0%   { transform: scale(0.65) rotate(-12deg); }
  60%  { transform: scale(1.1)  rotate(4deg);   }
  100% { transform: scale(1)    rotate(0deg);   }
}

/* Ordre CSS : anim-hit et anim-break priment sur hp-critical */
#block.anim-hit   { animation: hit-anim   0.22s ease-out forwards; }
#block.anim-break { animation: break-anim 0.35s ease-out forwards; pointer-events: none; }
#block.anim-spawn { animation: spawn-anim 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards; }

/* ── Flash écran ────────────────────────────── */
.screen-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 997;
  animation: screen-flash 0.32s ease-out forwards;
}

@keyframes screen-flash {
  0%   { opacity: 0.18; }
  100% { opacity: 0; }
}

/* ── HP bar ─────────────────────────────────── */
#hp-bar-wrap {
  width: 170px;
  height: 10px;
  background: rgba(255,255,255,0.07);
  border-radius: 5px;
  overflow: hidden;
}

#hp-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #16a34a, #4ade80);
  border-radius: 5px;
  transition: width 0.1s ease, background 0.25s;
}
#hp-bar.low      { background: linear-gradient(90deg, #d97706, #fbbf24); }
#hp-bar.critical { background: linear-gradient(90deg, #dc2626, #f87171); }

#hp-text { font-size: 0.73rem; color: var(--muted); min-height: 1em; }

/* ── Récompense bloc ────────────────────────── */
#block-reward { font-size: 0.75rem; color: var(--muted); min-height: 1em; }
#block-reward .reward-value     { color: var(--gold); font-weight: 700; }
#block-reward .reward-base      { color: var(--muted); }
#block-reward .reward-boost-sep { color: #fbbf24; font-weight: 600; }
#block-reward .reward-final     { color: var(--gold); font-weight: 700; }
#block-reward .reward-chest     { color: var(--text); font-style: italic; }

/* ── Bouton pub récompensée ─────────────────── */
#ad-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
}

.ad-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: rgba(74, 222, 128, 0.07);
  border: 1px solid rgba(74, 222, 128, 0.22);
  border-radius: 24px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  white-space: nowrap;
}

.ad-btn:not(:disabled):hover  {
  background: rgba(74, 222, 128, 0.13);
  border-color: rgba(74, 222, 128, 0.4);
  transform: scale(1.03);
}
.ad-btn:not(:disabled):active { transform: scale(0.97); }
.ad-btn:disabled { opacity: 0.38; cursor: not-allowed; }

.ad-btn-icon { font-size: 1rem; }
.ad-btn-text { }

#ad-timer {
  font-size: 0.63rem;
  color: var(--muted);
  min-height: 1em;
  text-align: center;
}

/* ── Modale pub ─────────────────────────────── */
#ad-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 24px;
}
#ad-modal[hidden] { display: none; }

#ad-modal-inner {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 300px;
  overflow: hidden;
}

#ad-mock-content {
  padding: 36px 24px 28px;
  text-align: center;
  background: linear-gradient(145deg, #1a1a2e, #2d1b69);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#ad-mock-logo {
  font-size: 3.5rem;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,0.5));
}

#ad-mock-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 3px;
}

#ad-mock-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
}

#ad-bar-wrap {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}

#ad-bar-fill {
  height: 100%;
  background: var(--gold);
  width: 0%;
  border-radius: 2px;
}

#ad-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

#ad-countdown {
  min-width: 28px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gold);
  text-align: center;
}

#btn-close-ad {
  flex: 1;
  padding: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #111;
  border: none;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.1s;
  touch-action: manipulation;
}
#btn-close-ad:hover { filter: brightness(1.1); }

#btn-skip-ad {
  padding: 10px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
  transition: color 0.15s;
  touch-action: manipulation;
}
#btn-skip-ad:hover { color: var(--text); }

/* ── Modale gains offline ───────────────────── */
#offline-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 520;
  padding: 24px;
}
#offline-modal[hidden] { display: none; }

#offline-modal-inner {
  background: var(--surface2);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 24px;
  width: 100%;
  max-width: 300px;
  padding: 34px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  animation: chest-modal-in 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#offline-modal-icon {
  font-size: 3rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

#offline-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.3px;
}

#offline-modal-duration {
  font-size: 0.72rem;
  color: var(--muted);
}

#offline-modal-reward {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(245, 197, 24, 0.4);
  padding: 12px 22px;
  background: rgba(245, 197, 24, 0.06);
  border: 1px solid rgba(245, 197, 24, 0.2);
  border-radius: 14px;
  min-width: 180px;
}

#btn-collect-offline {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #111;
  border: none;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: transform 0.1s, filter 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  margin-top: 4px;
}
#btn-collect-offline:hover  { filter: brightness(1.1); transform: scale(1.02); }
#btn-collect-offline:active { transform: scale(0.96); }

/* ── Modale coffre ──────────────────────────── */
#chest-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 510;
  padding: 24px;
}
#chest-modal[hidden] { display: none; }

#chest-modal-inner {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 100%;
  max-width: 300px;
  padding: 32px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  text-align: center;
  animation: chest-modal-in 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes chest-modal-in {
  0%   { transform: scale(0.65); opacity: 0; }
  100% { transform: scale(1);    opacity: 1; }
}

#chest-icon-wrap {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.07);
  border: 2px solid rgba(34, 211, 238, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: chest-ring-pulse 2s ease-in-out infinite;
}

@keyframes chest-ring-pulse {
  0%, 100% { box-shadow: 0 0 0   0 rgba(34, 211, 238, 0); }
  50%       { box-shadow: 0 0 20px 4px rgba(34, 211, 238, 0.18); }
}

#chest-modal-icon {
  font-size: 3.2rem;
  line-height: 1;
  display: block;
  animation: chest-icon-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes chest-icon-appear {
  0%   { transform: scale(0.3) rotate(-18deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(6deg);   opacity: 1; }
  100% { transform: scale(1)   rotate(0deg);   opacity: 1; }
}

#chest-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
}

#chest-modal-reward-label {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-weight: 600;
  margin-bottom: -4px;
}

#chest-modal-reward {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(245, 197, 24, 0.4);
  padding: 10px 20px;
  background: rgba(245, 197, 24, 0.06);
  border: 1px solid rgba(245, 197, 24, 0.2);
  border-radius: 14px;
  min-width: 180px;
}

#btn-collect-chest {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #111;
  border: none;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: transform 0.1s, filter 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  margin-top: 4px;
}
#btn-collect-chest:hover  { filter: brightness(1.1); transform: scale(1.02); }
#btn-collect-chest:active { transform: scale(0.96); }

/* ── Textes flottants ───────────────────────── */
.float-text {
  position: fixed;
  pointer-events: none;
  font-weight: 800;
  font-size: 1.05rem;
  z-index: 999;
  animation: float-up 0.8s ease-out forwards;
}

.float-text.dmg   { color: #f87171; font-size: 0.95rem; }
.float-text.coin  { color: var(--gold); font-size: 1.15rem; }
.float-text.gem   { color: var(--purple); font-size: 1.3rem; }
.float-text.chest { color: #fb923c; font-size: 1.2rem; }

.float-text.achievement {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 900;
  text-shadow: 0 2px 12px rgba(0,0,0,0.9);
  white-space: nowrap;
  transform: translateX(-50%);
  animation: float-up-slow 2.4s ease-out forwards;
}

@keyframes float-up {
  0%   { opacity: 1; transform: translateY(0)     scale(1);    }
  20%  { opacity: 1; transform: translateY(-14px) scale(1.1);  }
  100% { opacity: 0; transform: translateY(-65px) scale(0.75); }
}

@keyframes float-up-slow {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0)     scale(0.85); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.12); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-75px) scale(0.88); }
}

/* ── Particules ─────────────────────────────── */
.particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 998;
  transform: translate(-50%, -50%);
  animation: particle-fly 0.6s ease-out forwards;
}

@keyframes particle-fly {
  0%   { transform: translate(-50%,-50%) translate(0,0)                  scale(1.4); opacity: 1; }
  100% { transform: translate(-50%,-50%) translate(var(--dx),var(--dy))  scale(0);   opacity: 0; }
}

/* ── Section divider ────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 12px;
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Upgrades ───────────────────────────────── */
#upgrades-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrade-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.upgrade-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.upgrade-icon {
  font-size: 1.55rem;
  width: 30px;
  text-align: center;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

.upgrade-info { flex: 1; min-width: 0; }

.upgrade-name {
  font-size: 0.87rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
}

.upgrade-level  { font-size: 0.7rem; font-weight: 600; color: var(--gold); }

.maxed-tag {
  font-size: 0.58rem;
  background: rgba(245,197,24,0.15);
  color: var(--gold);
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 700;
}

.upgrade-desc {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upgrade-btn {
  flex-shrink: 0;
  min-width: 82px;
  padding: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #111;
  border: none;
  border-radius: 11px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.1s, filter 0.1s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.upgrade-btn:not(:disabled):hover  { filter: brightness(1.1); transform: scale(1.04); }
.upgrade-btn:not(:disabled):active { transform: scale(0.94); }
.upgrade-btn:disabled:not(.is-maxed) { opacity: 0.28; cursor: not-allowed; filter: grayscale(0.7); }
.upgrade-btn.is-maxed {
  background: rgba(107,114,128,0.12);
  color: var(--muted);
  cursor: default;
  font-size: 0.68rem;
  letter-spacing: 1.2px;
}

.btn-cost { display: block; font-size: 0.67rem; font-weight: 600; opacity: 0.88; }

/* ── Objectifs ───────────────────────────────── */
#quests-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quest-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  transition: border-color 0.2s;
}
.quest-card.completed { border-color: rgba(74,222,128,0.18); opacity: 0.6; }

.quest-icon  { font-size: 1.3rem; width: 26px; text-align: center; flex-shrink: 0; }
.quest-info  { flex: 1; min-width: 0; }
.quest-name  { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.quest-desc  { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.quest-reward {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
  text-align: right;
  white-space: nowrap;
}
.quest-card.completed .quest-reward { color: var(--green); }

/* ── Boutique de saison (coffres achetables) ─── */
#shop-chests-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}

.shop-chest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.shop-chest-card.can-afford {
  border-color: rgba(234,179,8,.40);
  box-shadow: 0 0 8px rgba(234,179,8,.10);
}
.shop-chest-card.maxed {
  opacity: 0.55;
}

.shop-chest-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.shop-chest-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  width: 30px;
  text-align: center;
}
.shop-chest-info {
  flex: 1;
  min-width: 0;
}
.shop-chest-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}
.shop-chest-desc {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.35;
}
.shop-chest-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.shop-chest-limit {
  font-size: 0.6rem;
  color: var(--muted);
  white-space: nowrap;
}
.shop-chest-cost {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.shop-chest-cost.can-afford { color: var(--gold); }

.shop-chest-btn {
  align-self: stretch;
  padding: 7px 0;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s, transform .1s;
  letter-spacing: 0.04em;
}
.shop-chest-card.can-afford .shop-chest-btn {
  background: linear-gradient(135deg, #d97706, #fbbf24);
  color: #1a1a1a;
}
.shop-chest-btn:not(:disabled):hover  { filter: brightness(1.12); transform: scale(1.02); }
.shop-chest-btn:not(:disabled):active { transform: scale(0.97); }
.shop-chest-btn:disabled { opacity: 0.28; cursor: not-allowed; filter: grayscale(0.5); }

/* ── Reset ──────────────────────────────────── */
#btn-reset {
  display: block;
  margin: 20px auto 4px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 6px 10px;
  -webkit-tap-highlight-color: transparent;
}
#btn-reset:hover { color: var(--red); }

/* ── Collection ──────────────────────────────── */
#collection-header {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

#collection-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.find-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  transition: border-color 0.2s, transform 0.15s;
}
.find-card.found { border-color: rgba(245,197,24,0.22); }
.find-card.found:hover { transform: scale(1.05); }
.find-card:not(.found) { opacity: 0.32; filter: grayscale(1); }

.find-icon { font-size: 1.75rem; line-height: 1; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }
.find-card:not(.found) .find-icon { font-size: 1.2rem; color: var(--muted); }
.find-name { font-size: 0.57rem; font-weight: 600; color: var(--muted); line-height: 1.2; }
.find-card.found .find-name { color: var(--text); }

/* ── Daily ───────────────────────────────────── */
.daily-title {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 18px;
  font-weight: 600;
}

.streak-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.streak-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }

.streak-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  transition: all 0.2s;
}

.streak-icon { font-size: 0.72rem; line-height: 1; }

.streak-day.done .streak-circle {
  background: rgba(74,222,128,0.12);
  border-color: rgba(74,222,128,0.38);
  color: var(--green);
  font-size: 0.9rem;
}

.streak-day.claimed-today .streak-circle {
  background: rgba(74,222,128,0.22);
  border-color: rgba(74,222,128,0.65);
  color: var(--green);
  box-shadow: 0 0 12px rgba(74,222,128,0.3);
  font-size: 0.9rem;
}

.streak-day.available .streak-circle {
  background: rgba(245,197,24,0.12);
  border-color: rgba(245,197,24,0.55);
  color: var(--gold);
  animation: pulse-gold 1.6s ease-in-out infinite;
}

.streak-day.upcoming .streak-circle,
.streak-day.upcoming .streak-icon { opacity: 0.25; }

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 6px rgba(245,197,24,0.12); }
  50%       { box-shadow: 0 0 18px rgba(245,197,24,0.42); }
}

.daily-reward-box {
  background: rgba(245,197,24,0.06);
  border: 1px solid rgba(245,197,24,0.2);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  margin-bottom: 12px;
}

.daily-reward-day {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 7px;
}

.daily-reward-items { font-size: 1.05rem; font-weight: 700; color: var(--gold); }

.claim-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #111;
  border: none;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: transform 0.1s, filter 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.claim-btn:hover  { filter: brightness(1.1); transform: scale(1.02); }
.claim-btn:active { transform: scale(0.96); }

.daily-claimed-msg {
  text-align: center;
  padding: 20px 14px 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--green);
}
.claimed-check { margin-right: 5px; }
.daily-next-msg { text-align: center; font-size: 0.7rem; color: var(--muted); margin-top: 6px; }

/* ── Reliques ────────────────────────────────── */
#relics-info {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}

#relics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding-bottom: 8px;
}

.relic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  position: relative;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.relic-card.relic-affordable {
  border-color: rgba(34, 211, 238, 0.38);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.12);
  animation: relic-affordable-pulse 2.2s ease-in-out infinite;
}

@keyframes relic-affordable-pulse {
  0%, 100% { border-color: rgba(34, 211, 238, 0.28); }
  50%       { border-color: rgba(34, 211, 238, 0.58); }
}

.relic-card.relic-unlocked {
  border-color: rgba(245, 197, 24, 0.38);
  box-shadow: 0 0 18px rgba(245, 197, 24, 0.14);
}

.relic-icon {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
  transition: filter 0.25s;
}

/* Icônes grisées pour les reliques verrouillées non abordables */
.relic-card:not(.relic-unlocked):not(.relic-affordable) .relic-icon {
  filter: grayscale(0.75) opacity(0.45);
}

.relic-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.relic-bonus {
  font-size: 0.63rem;
  color: #22d3ee;
  font-weight: 600;
  min-height: 1.2em;
}

.relic-card.relic-unlocked .relic-bonus { color: var(--green); }
.relic-card:not(.relic-unlocked):not(.relic-affordable) .relic-bonus { color: var(--muted); }

.relic-cost {
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.relic-cost.can-afford { color: #22d3ee; font-weight: 700; }

.relic-shortfall {
  font-size: 0.58rem;
  color: var(--muted);
  opacity: 0.7;
}

.relic-unlock-btn {
  width: 100%;
  margin-top: 4px;
  padding: 8px 6px;
  background: linear-gradient(135deg, #22d3ee, #0891b2);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, filter 0.1s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.relic-unlock-btn:not(:disabled):hover  { filter: brightness(1.15); transform: scale(1.04); }
.relic-unlock-btn:not(:disabled):active { transform: scale(0.95); }
.relic-unlock-btn:disabled { opacity: 0.22; cursor: not-allowed; filter: grayscale(0.6); }

.relic-unlocked-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold);
  margin-top: 2px;
}

.relic-level {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(234,179,8,.18);
  border: 1px solid rgba(234,179,8,.45);
  border-radius: 8px;
  padding: 1px 5px;
  line-height: 1.4;
  white-space: nowrap;
}

.relic-upgrade-btn {
  margin-top: 4px;
  padding: 5px 12px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #1a1a1a;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s, transform .1s;
}
.relic-upgrade-btn:not(:disabled):hover  { filter: brightness(1.15); transform: scale(1.04); }
.relic-upgrade-btn:not(:disabled):active { transform: scale(0.95); }
.relic-upgrade-btn:disabled { opacity: 0.22; cursor: not-allowed; filter: grayscale(0.6); }

.relic-max-badge {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-top: 4px;
}

/* ── Missions quotidiennes ───────────────────── */
#daily-missions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mission-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: border-color 0.2s;
}

.mission-card.mission-done    { border-color: rgba(74,222,128,0.22); }
.mission-card.mission-claimed { opacity: 0.52; }

.mission-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mission-icon {
  font-size: 1.4rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

.mission-info { flex: 1; min-width: 0; }

.mission-name {
  font-size: 0.87rem;
  font-weight: 700;
  color: var(--text);
}

.mission-desc {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
}

.mission-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
}

.mission-card.mission-claimed .mission-count { color: var(--green); }

.mission-progress-wrap {
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}

.mission-progress-bar {
  height: 100%;
  background: linear-gradient(90deg,#3b82f6,#60a5fa);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.mission-card.mission-done    .mission-progress-bar,
.mission-card.mission-claimed .mission-progress-bar {
  background: linear-gradient(90deg,#16a34a,#4ade80);
}

.mission-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mission-reward-text {
  font-size: 0.68rem;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}

.mission-reward-text span {
  color: var(--gold);
  font-weight: 700;
}

.mission-claim-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #111;
  border: none;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s, filter 0.1s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mission-claim-btn:not(:disabled):hover  { filter: brightness(1.1); transform: scale(1.04); }
.mission-claim-btn:not(:disabled):active { transform: scale(0.94); }
.mission-claim-btn:disabled              { opacity: 0.28; cursor: not-allowed; filter: grayscale(0.5); }

.mission-claim-btn.mission-claimed-btn {
  background: rgba(74,222,128,0.1);
  color: var(--green);
  border: 1px solid rgba(74,222,128,0.2);
  cursor: default;
  font-size: 0.72rem;
}

/* ── Boutique ────────────────────────────────── */
.shop-header {
  text-align: center;
  margin-bottom: 4px;
}

.shop-balance {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--purple);
}

.shop-balance-sub {
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 2px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.shop-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.shop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
  text-align: center;
  transition: border-color 0.2s;
}

.shop-card:has(.shop-btn:not(:disabled)):hover {
  border-color: rgba(245,197,24,0.2);
}

.shop-item-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.shop-item-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.shop-item-label {
  font-size: 0.6rem;
  color: var(--muted);
  line-height: 1.3;
}

/* Badge "Populaire" / "Meilleure valeur" */
.shop-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--gold);
  color: #111;
  font-size: 0.5rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 0 13px 0 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.shop-btn {
  margin-top: 4px;
  width: 100%;
  padding: 8px 6px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #111;
  border: none;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, filter 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  line-height: 1.2;
}

.shop-btn:not(:disabled):hover  { filter: brightness(1.1); transform: scale(1.02); }
.shop-btn:not(:disabled):active { transform: scale(0.96); }

.shop-btn.owned {
  background: rgba(74,222,128,0.1);
  color: var(--green);
  cursor: default;
  border: 1px solid rgba(74,222,128,0.2);
  font-size: 0.72rem;
}

.shop-disclaimer {
  text-align: center;
  font-size: 0.6rem;
  color: var(--muted);
  margin-top: 24px;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--border);
  font-style: italic;
  opacity: 0.65;
}

/* ── Navigation bas ─────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: rgba(22, 22, 38, 0.97);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 2px 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.nav-btn.active { color: var(--gold); }
.nav-btn:not(.active):hover { color: var(--text); }

.nav-btn.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--gold);
  border-radius: 0 0 2px 2px;
}

.nav-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon {
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 0.15s;
}

.nav-btn.active .nav-icon { transform: scale(1.12); }

.nav-label {
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.1px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52px;
}

.nav-badge {
  position: absolute;
  top: -2px;
  right: -5px;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid rgba(22, 22, 38, 0.97);
}

/* ── Toast ──────────────────────────────────── */
#save-toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.28);
  color: #4ade80;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
  transition: opacity 0.22s ease, transform 0.22s ease;
  white-space: nowrap;
}
#save-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Écran sélection langue (premier lancement) ── */
#lang-pick-screen {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease;
}
#lang-pick-screen[hidden] { display: none; }
#lang-pick-screen.lang-pick-out {
  opacity: 0;
  pointer-events: none;
}

#lang-pick-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 28px 20px;
  max-width: 340px;
  width: 100%;
}

#lang-pick-logo {
  font-size: 3.2rem;
  line-height: 1;
  filter: drop-shadow(0 4px 14px rgba(245,197,24,0.35));
}

#lang-pick-title {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(245,197,24,0.3);
  margin-top: -8px;
}

#lang-pick-subtitle {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
  letter-spacing: 0.3px;
}

#lang-pick-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lang-pick-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.lang-pick-btn:hover,
.lang-pick-btn:focus-visible {
  background: rgba(245,197,24,0.06);
  border-color: rgba(245,197,24,0.28);
  outline: none;
}
.lang-pick-btn:active { transform: scale(0.97); }

.lang-pick-flag {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Section compte (dans Paramètres) ────────── */
.account-logged {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
}
.account-username {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.account-logout-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.account-logout-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }

.account-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.account-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
  letter-spacing: 0.3px;
  -webkit-tap-highlight-color: transparent;
}
.account-tab.is-active { color: var(--gold); border-bottom: 2px solid var(--gold); margin-bottom: -1px; }
.account-tab:hover:not(.is-active) { color: var(--text); }

.account-form {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.88rem;
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.15s;
}
.account-input:focus { border-color: rgba(245,197,24,0.4); }
.account-hint {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.4;
  margin-top: -2px;
}
.account-submit-btn {
  width: 100%;
  padding: 11px;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 11px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  margin-top: 2px;
  -webkit-tap-highlight-color: transparent;
}
.account-submit-btn:hover   { opacity: 0.9; }
.account-submit-btn:active  { transform: scale(0.98); }
.account-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.account-error {
  font-size: 0.73rem;
  color: var(--red);
  min-height: 1em;
  text-align: center;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 380px) {
  #stats { grid-template-columns: repeat(3, 1fr); } /* 2 lignes de 3 avec 6 stats */
  .stat .label          { font-size: 0.54rem; }
  .stat span:last-child { font-size: 0.88rem; }
  .upgrade-desc         { display: none; }
  #collection-grid      { grid-template-columns: repeat(3, 1fr); }
  .streak-circle        { width: 28px; height: 28px; font-size: 0.68rem; }
  #block                { width: 152px; height: 152px; }
  #block-icon           { font-size: 3.6rem; }
  #hp-bar-wrap          { width: 152px; }
  .shop-grid            { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 320px) {
  h1          { font-size: 1.9rem; }
  #block      { width: 138px; height: 138px; }
  #block-icon { font-size: 3.2rem; }
  #hp-bar-wrap { width: 138px; }
  .nav-label  { font-size: 0.5rem; }
}

@media (min-height: 700px) {
  #view-dig { padding-top: 38px; }
}

@media (min-width: 440px) {
  #block      { width: 180px; height: 180px; }
  #block-icon { font-size: 4.2rem; }
  #hp-bar-wrap { width: 180px; }
}

/* ── Desktop : encadrement ──────────────────── */
@media (min-width: 500px) {
  body {
    align-items: center;      /* centre verticalement l'app-card */
    background: #08080f;      /* fond légèrement plus sombre hors carte */
  }

  #app {
    border-left:  1px solid rgba(255,255,255,0.09);
    border-right: 1px solid rgba(255,255,255,0.09);
    box-shadow:
      -12px 0 48px rgba(0,0,0,0.55),
       12px 0 48px rgba(0,0,0,0.55);
  }

  /* La nav reste fixée en bas du viewport, mais déjà limitée à max-width: 440px */
}

/* ── Vue Saison ──────────────────────────────────────────────────────────── */

#view-season {
  /* Le padding .view est déjà appliqué ; on ne surcharge pas pour rester cohérent */
}

.season-ends-in {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin: 4px 0 12px;
}

.season-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  margin: 0 0 12px;
}

.season-loading, .season-empty {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  font-size: 0.85rem;
}

/* ── Carte joueur ── */
.season-player-card {
  background: linear-gradient(135deg, rgba(251,191,36,0.12), rgba(251,191,36,0.04));
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.season-player-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.season-player-rank {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

.season-league-badge {
  display: inline-block;
  font-size: 0.78rem;
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
}
.season-league-badge.muted { color: var(--muted); }

.season-player-stats {
  display: flex;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--muted);
  flex-wrap: wrap;   /* important : wrap sur petits écrans */
}
.season-player-stats span { white-space: nowrap; }
.season-player-stats strong { color: var(--text); }

/* ── Info saison (collapsible) ── */
.season-info-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.season-info-card summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.season-info-card summary::-webkit-details-marker { display: none; }
.season-info-card summary::after {
  content: '›';
  margin-left: auto;
  font-size: 1rem;
  transition: transform 0.2s;
  line-height: 1;
}
.season-info-card[open] summary::after { transform: rotate(90deg); }
.season-info-card[open] summary { color: var(--text); border-bottom: 1px solid var(--border); }

.season-info-body {
  padding: 10px 14px 12px;
}

.season-info-intro {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 10px;
  line-height: 1.5;
}

.season-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.season-info-col {
  border-radius: 8px;
  padding: 8px 10px;
}
.season-info-col-reset { background: rgba(239,68,68,0.07); border: 1px solid rgba(239,68,68,0.18); }
.season-info-col-kept  { background: rgba(74,222,128,0.07); border: 1px solid rgba(74,222,128,0.18); }

.season-info-col-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.season-info-col-reset .season-info-col-title { color: #f87171; }
.season-info-col-kept  .season-info-col-title { color: #4ade80; }

.season-info-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.season-info-list li {
  font-size: 0.77rem;
  color: var(--text);
  opacity: 0.85;
}

/* ── Leaderboard ── */
.season-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 6px;
}

.season-leaderboard {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Rang | Nom  | Profondeur | Blocs */
.lb-row {
  display: grid;
  grid-template-columns: 2rem 1fr minmax(3rem, auto) minmax(2.8rem, auto);
  align-items: center;
  gap: 4px;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  font-size: 0.82rem;
  transition: background 0.15s;
  min-width: 0;          /* permet aux enfants de tronquer */
}
.lb-row-me { background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.2); }

.lb-rank   { font-weight: 700; color: var(--muted); text-align: center; font-size: 0.78rem; }
.lb-name   { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lb-depth  { text-align: right; color: var(--gold); font-weight: 600; font-size: 0.78rem; white-space: nowrap; }
.lb-blocks { text-align: right; color: var(--muted); font-size: 0.74rem; white-space: nowrap; }
.lb-league { margin-right: 3px; font-size: 0.88em; }

/* ── Responsive saison ── */
@media (max-width: 360px) {
  .lb-row {
    grid-template-columns: 1.6rem 1fr minmax(2.8rem, auto) minmax(2.4rem, auto);
    font-size: 0.78rem;
    padding: 6px 6px;
    gap: 3px;
  }
  .lb-rank   { font-size: 0.72rem; }
  .lb-depth  { font-size: 0.72rem; }
  .lb-blocks { font-size: 0.68rem; }
  .season-player-stats { gap: 8px; font-size: 0.78rem; }
}

@media (max-width: 320px) {
  /* Sur les très petits écrans, cacher la colonne blocs */
  .lb-blocks { display: none; }
  .lb-row    { grid-template-columns: 1.6rem 1fr minmax(2.8rem, auto); }
}
