:root {
  --bg: #0f1217;
  --fg: #e9eef5;
  --muted: #9aa7b5;
  --primary: #f59f00;
  --secondary: #1e66f5;
  --shop: #00b894;
  --danger: #e03131;
  --surface: #171a21;
  --border: #2a2f3a;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, Inter, sans-serif;
  -ms-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  height: 100%;
}



html {
  touch-action: none;
}

/* Bloquer le scroll de la page quand un modal est ouvert */
body.modal-open {
  overflow: hidden;
}

/* Bouton dev caché mais cliquable */
#devTrigger {
  position: fixed;
  top: 100;
  left: 0;
  width: 10px;
  height: 10px;
  background: transparent;
  color: transparent;
  border: none;
  cursor: pointer;
  z-index: 1001;
}

/* Conteneur principal */
.game-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
  padding-bottom: 96px; /* espace pour footer */
}

/* Stats */
.stats-header {
  text-align: center;
  margin-bottom: 2rem;
}

.title {
  font-size: 2.2rem;
  margin: 0 0 8px;
  font-weight: 800;
}

.subtitle {
  font-size: 1.1rem;
  margin: 0 0 24px;
  color: var(--muted);
}

/* Boutons génériques */
.btn {
  display: inline-block;
  padding: 14px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .05s ease, background .2s ease, box-shadow .2s ease;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}


.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #000;
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-warning {
  background: var(--danger);
  color: #fff;
}

.btn-shop {
  background: var(--shop);
  color: #fff;
}

/* Hover desktop */
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    box-shadow: 0 6px 16px rgba(245,159,0,0.25);
  }
  .btn-secondary:hover {
    box-shadow: 0 6px 16px rgba(30,102,245,0.25);
  }
  .btn-warning:hover {
    box-shadow: 0 6px 16px rgba(224,49,49,0.25);
  }
  .btn-shop:hover {
    box-shadow: 0 6px 16px rgba(0,184,148,0.25);
  }
}

/* Bouton de clic principal centré */
.big-btn {
  font-size: 1.5rem;
  padding: 1rem 2rem;
  width: min(90%, 420px);
  margin: 0 auto;
  text-align: center;
}

/* Zone d’actions */
.action-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}

/* Séparateur interne */
.action-divider {
  width: clamp(200px, 60%, 400px);
  margin: 0;
  border: none;
  border-top: 1px solid var(--border);
}

/* Grille des actions secondaires */
.actions-grid {
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 12px;
  justify-items: stretch;
}

/* Footer fixé */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.25);
  padding: 10px 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

/* Bouton reset dans footer */
.footer-reset {
  background: transparent;
  color: #fff;
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
}

@media (hover: hover) and (pointer: fine) {
  .footer-reset:hover {
    background: #10141b;
  }
}

/* Modales, listes, inputs… */
.modal,
.modal-second {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  overflow: hidden;
  padding: 16px;
}

.modal[aria-hidden="false"],
.modal-second[aria-hidden="false"] {
  display: flex;
}

.modal {
  z-index: 1001;
}

.modal-second {
  z-index: 2000; /* au-dessus de .modal */
  background: rgba(0,0,0,0.6);
}

/* Contenu des modales */
.modal-content,
.modal-second .modal-content {
  width: 100%;
  max-width: 760px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0; /* padding géré par header/body/footer */
}

.modal-second .modal-content {
  max-width: 720px;
}

/* En-tête */
.modal-header,
.modal-second .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

/* Corps */
.modal-body,
.modal-second .modal-body {
  padding: 16px;
  max-height: 80vh;
  overflow: auto;
}

/* Pied de page (secondaire uniquement) */
.modal-second .modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

/* Bouton de fermeture */
.close-btn {
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 20px;
  cursor: pointer;
}

/* Sections et éléments */
.section {
  margin-bottom: 16px;
}

.section-title {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--muted);
}

.item-title {
  font-weight: 600;
}

.item-meta {
  color: var(--muted);
  font-size: .95rem;
}

.item-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}


/* Adaptation fluide des items */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #0e1117;
  border: 1px solid var(--border);
  width: 100%;
  transition: box-shadow 0.2s ease;
}

/* Halo vert si achetable */
.item-available {
  box-shadow: 0 0 0 2px rgba(0, 255, 120, 0.2);
}

.item-available:hover {
  box-shadow: 0 0 0 2px rgba(0, 255, 120, 0.4);
}

/* Boutons inline comme avant */
.item-btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #10141b;
  color: var(--fg);
  cursor: pointer;
}

.item-btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}


.stat {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
}

input[type="number"],
input[type="password"],
input[type="text"] {
  background: #0d0f14;
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  width: 200px;
}

/* Responsive */
@media (max-width: 520px) {
  .actions-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

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

/* ─── Animation du "+N" actif ─── */
@keyframes floatUp {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  50%  { opacity: 1; transform: translateY(-20px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-40px) scale(1.4); }
}

.click-burst {
  position: fixed;
  pointer-events: none;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--primary);
  animation: floatUp 0.8s ease-out forwards;
  will-change: transform, opacity;
  z-index: 1001;
}

/* ─── Animation gains passifs ─── */
@keyframes passiveBurst {
  0%   { transform: translateY(0) scale(1);    opacity: 1; }
  50%  { transform: translateY(-10px) scale(1.1); opacity: 0.8; }
  100% { transform: translateY(-40px) scale(1);   opacity: 0; }
}

.click-burst-passive {
  position: fixed;
  color: #9b59b6;
  font-weight: bold;
  opacity: 1;
  pointer-events: none;
  z-index: 900;
  will-change: transform, opacity;
  font-size: 1.1em;
}

.click-burst-passive.animate {
  animation: passiveBurst 0.8s ease-out forwards;
}

/* Effet pulse sur le bouton */
@keyframes pulseAnim {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.pulse {
  animation: pulseAnim 0.3s ease-out;
}

/* Quick stats sous les boutons */
.quick-stats {
  font-size: 0.9em;
  color: #ccc;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.quick-stats div {
  display: flex;
  justify-content: space-between;
}

.quick-stats h3 {
  color: #fff;
  font-weight: bold;
}
/* Contenu interne du menu Améliorations */
#upgradesBody {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 12px;
}

.gallery { display: flex; flex-direction: column; gap: 1rem; }
.shop-tile {
  background: #0e1117;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}
.shop-tile .emoji { font-size: 2rem; }
.shop-tile h3 { margin: 0.5rem 0; }

/* ————— Bouton Paramètres ————— */
#settingsBtn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  font-size: 1.75rem;
  color: var(--fg);
  cursor: pointer;
  outline: none;
  box-shadow: none;
  -ms-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}


#settingsBtn:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

#settingsBtn:active {
  background-color: rgba(255, 255, 255, 0.15);
}

#settingsBtn:focus {
  outline: none;
}
/* ———————————————————————————— */


.coin-drop:hover {
  transform: scale(1.2);
}


