
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif; min-height: 100vh;
  display: flex; justify-content: center; align-items: flex-start;
  background: linear-gradient(135deg, #1a0a2e, #2d1b4e, #1a0a2e);
  color: #e0e0e0; padding: 16px; padding-top: 60px;
}
#app {
  position: relative; z-index: 1;
  background: rgba(20, 20, 35, 0.55);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 24px;
  padding: 32px 28px 28px; max-width: 900px; width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4); text-align: center;
}
.header h1 {
  font-size: 2rem; font-weight: 800;
  background: linear-gradient(90deg, #f0abfc, #d946ef, #a21caf);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 8px;
}
.header .date-jour { font-size: 1rem; color: #cbd5e1; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 12px; padding: 0 6px; color: #f0abfc; text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.back-link:hover { color: #d946ef; }
.non-connecte { text-align: center; padding: 40px 20px; background: rgba(255,255,255,0.06); border-radius: 16px; margin: 20px 0 32px; }
.non-connecte p { color: #cbd5e1; margin-bottom: 16px; }

.btn { font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 700; padding: 10px 22px; min-height: 44px; border: none; border-radius: 10px; cursor: pointer; color: #fff; transition: transform 0.2s; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; line-height: 1.1; }
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:disabled { cursor: not-allowed; transform: none; box-shadow: none; background: rgba(148,163,184,0.18); color: #94a3b8; border: 1px dashed rgba(148,163,184,0.5); }
.btn-petit { padding: 8px 14px; font-size: 0.84rem; }
.btn-primary { background: #a21caf; box-shadow: none; }
.btn-secondary { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); }
.btn-passe { background: rgba(100,116,139,0.55); }
.btn-enchere { background: #7c3aed; }
.btn:focus-visible, .defi-niveau:focus-visible, .onglet-niveau:focus-visible, .back-link:focus-visible, .lien-encart:focus-visible, .lien-classement-fin:focus-visible {
  outline: 3px solid #fbbf24; outline-offset: 2px;
}


.defis-niveaux { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 20px 0 8px; }
.defi-niveau {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 10px; border-radius: 14px; cursor: pointer;
  font-family: 'Inter', sans-serif; color: #e0e0e0; text-align: center;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(217,70,239,0.35);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.defi-niveau:hover:not(:disabled) { transform: translateY(-2px); border-color: #d946ef; background: rgba(217,70,239,0.12); }
.defi-niveau:disabled { cursor: default; }
.defi-niveau-nom { font-size: 1.1rem; font-weight: 800; color: #f0abfc; }
.defi-niveau-desc { font-size: 0.75rem; color: #cbd5e1; line-height: 1.35; }
.defi-niveau-statut { margin-top: 4px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: rgba(217,70,239,0.2); color: #f0abfc; }
.defi-niveau.joue { border-color: rgba(74,222,128,0.35); }
.defi-niveau.joue .defi-niveau-statut { background: rgba(74,222,128,0.15); color: #4ade80; }
.defi-niveau.abandonne { opacity: 0.6; border-color: rgba(255,255,255,0.1); }
.defi-niveau.abandonne .defi-niveau-statut { background: rgba(148,163,184,0.15); color: #cbd5e1; }
.defi-message { font-size: 0.85rem; color: #cbd5e1; margin-bottom: 16px; min-height: 1.2em; }


.defi-historique { margin: 4px auto 20px; max-width: 520px; text-align: left; }
.defi-historique h2 { font-size: 1rem; color: #f0abfc; margin-bottom: 6px; text-align: center; }
.defi-serie { font-size: 0.86rem; color: #fde68a; font-weight: 700; text-align: center; margin-bottom: 8px; }
.table-historique { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.table-historique caption { font-size: 0.75rem; color: #94a3b8; padding-bottom: 4px; text-align: left; }
.table-historique th { color: #94a3b8; font-weight: 600; font-size: 0.75rem; padding: 4px 6px; text-align: right; }
.table-historique th:first-child, .table-historique td:first-child { text-align: left; }
.table-historique td { padding: 4px 6px; text-align: right; border-top: 1px solid rgba(255,255,255,0.06); font-variant-numeric: tabular-nums; }

.encheres-consigne { color: #cbd5e1; margin-bottom: 8px; }
.encheres-zone { margin: 4px 0 8px; }
.encheres-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 8px 0; }


.jeu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.jeu-timer { font-size: 1.2rem; font-weight: 700; color: #f0abfc; font-variant-numeric: tabular-nums; }
.jeu-info { font-size: 0.85rem; color: #cbd5e1; }
.main-defi { padding: 4px; background: rgba(255,255,255,0.04); border-radius: 12px; min-height: calc(var(--carte-h) + 16px); }
.zone-message-defi { text-align: center; font-size: 0.95rem; font-weight: 700; color: #f0abfc; margin: 8px 0; min-height: 2.6em; display: flex; align-items: center; justify-content: center; }


.chien-zone-defi { text-align: center; margin-bottom: 12px; }
.titre-zone { font-size: 0.95rem; color: #fbbf24; margin-bottom: 8px; }
.chien-cartes-defi { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.chien-consigne-defi { font-size: 0.82rem; color: #cbd5e1; margin-bottom: 8px; }
.ecart-cartes-defi { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; min-height: calc(var(--carte-h) + 18px); background: rgba(255,255,255,0.04); border-radius: 10px; padding: 6px; border: 2px dashed rgba(255,255,255,0.15); margin-bottom: 8px; }


.overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 100; justify-content: center; align-items: center; padding: 60px 12px 12px; }
.overlay.visible { display: flex; }
.overlay-content { background: linear-gradient(135deg, #1e1b4b, #312e81); border: 1px solid rgba(255,255,255,0.15); border-radius: 20px; padding: 24px 22px; max-width: 520px; width: 100%; text-align: center; max-height: calc(100vh - 72px); overflow-y: auto; }
.overlay-content h2 { font-size: 1.5rem; margin-bottom: 12px; background: linear-gradient(90deg, #f0abfc, #d946ef, #a21caf); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.partage-score { margin-top: 10px; }
.resultat-actions { margin-top: 16px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }


.encart-jour { margin: 32px auto 0; max-width: 800px; }
.encart-jour h2 { font-size: 1.2rem; font-weight: 700; color: #f0abfc; margin-bottom: 16px; }
.onglets-niveau { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.onglet-niveau {
  font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 700;
  padding: 7px 16px; min-height: 44px; border-radius: 999px; cursor: pointer; color: #cbd5e1;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
}
.onglet-niveau.actif { color: #fff; background: #a21caf; border-color: transparent; }
.lien-encart { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; color: #f0abfc; font-size: 0.85rem; font-weight: 600; text-decoration: none; }
.lien-encart:hover { color: #d946ef; }


.confetti { position: fixed; top: -10px; z-index: 200; pointer-events: none; font-size: 1.2rem; animation: confetti-fall 3s ease-in forwards; }
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }

footer { font-size: 0.78rem; color: #94a3b8; margin-top: 32px; text-align: center; }
footer a { color: #f0abfc; text-decoration: none; }

@media (max-width: 480px) {
  
  body { padding: 16px 6px; padding-top: 60px; }
  #app { padding: 24px 24px 20px; }
  .header h1 { font-size: 1.5rem; }
  .defis-niveaux { grid-template-columns: 1fr; gap: 8px; }
  .defi-niveau { padding: 12px 10px; }
  .overlay-content { padding: 18px 14px; }
}
