/* === Same Game — page défi du jour === */
*, *::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, #1e1b4b, #2e1065, #1e1b4b);
  color: #e0e0e0;
  padding: 16px;
  padding-top: 60px;
  touch-action: manipulation;
}

#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 24px 28px;
  max-width: 700px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.back-link {
  display: inline-block; margin-bottom: 16px; text-align: left;
  color: var(--color-light, #a78bfa); text-decoration: none; font-size: 0.85rem; font-weight: 600;
  align-self: flex-start;
}
.back-link:hover { color: var(--color-accent, #c4b5fd); }

.header { text-align: center; margin-bottom: 28px; }
.header h1 {
  font-size: 2rem; font-weight: 800;
  background: linear-gradient(90deg, #a78bfa, #8b5cf6, #7c3aed);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 8px;
}
.header .date-jour { font-size: 1rem; color: #94a3b8; }

.defis-grille { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; margin-bottom: 28px; }
.defi-carte {
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px; padding: 22px 18px; text-align: center; width: 180px;
  transition: all 0.3s ease; cursor: pointer;
}
.defi-carte:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(139, 92, 246, 0.4); transform: translateY(-3px); }
.defi-carte.active { border-color: rgba(139, 92, 246, 0.7); background: rgba(139, 92, 246, 0.15); }
.defi-carte.joue { cursor: default; }
.defi-carte.joue:hover { transform: none; background: rgba(255, 255, 255, 0.07); border-color: rgba(139, 92, 246, 0.5); }
.defi-carte-icone { font-size: 2rem; margin-bottom: 8px; }
.defi-carte h3 { font-size: 1rem; font-weight: 700; color: var(--color-accent, #c4b5fd); margin-bottom: 4px; }
.defi-carte .dims { font-size: 0.74rem; color: #64748b; margin-bottom: 8px; }
.defi-carte .defi-statut { font-size: 0.82rem; font-weight: 600; padding: 4px 12px; border-radius: 8px; display: inline-block; }
.defi-statut.non-tente { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
.defi-statut.en-cours { background: rgba(234, 179, 8, 0.2); color: #fbbf24; }
.defi-statut.joue { background: rgba(16, 185, 129, 0.2); color: #34d399; }

.non-connecte { text-align: center; padding: 40px 20px; background: rgba(255, 255, 255, 0.06); border-radius: 16px; margin-bottom: 28px; }
.non-connecte p { color: #94a3b8; margin-bottom: 16px; font-size: 0.95rem; }

.btn {
  font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 700;
  padding: 10px 24px; border: none; border-radius: 10px; cursor: pointer;
  color: #fff; text-decoration: none; display: inline-block;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, #8b5cf6, #7c3aed); box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4); }

#zone-jeu { display: none; margin-bottom: 28px; }
.jeu-header { display: flex; justify-content: center; align-items: center; gap: 18px; margin-bottom: 12px; flex-wrap: wrap; }
.jeu-info { font-size: 0.85rem; color: #94a3b8; }
.jeu-timer { font-size: 1.1rem; font-weight: 700; color: var(--color-light, #a78bfa); font-variant-numeric: tabular-nums; }
.score-defi { font-size: 1rem; font-weight: 800; color: #34d399; }

.grid-wrap { display: inline-block; background: rgba(0, 0, 0, 0.25); border-radius: 12px; padding: 6px; margin-bottom: 12px; max-width: 100%; }
.grid { display: grid; gap: 2px; margin: 0 auto; cursor: pointer; }
.cell { border-radius: 5px; cursor: pointer; transition: transform 0.08s ease, filter 0.12s ease, opacity 0.18s ease; position: relative; }
.cell.empty { background: transparent; cursor: default; pointer-events: none; }
.cell.c1 { background: linear-gradient(145deg, #f87171, #dc2626); }
.cell.c2 { background: linear-gradient(145deg, #60a5fa, #2563eb); }
.cell.c3 { background: linear-gradient(145deg, #4ade80, #16a34a); }
.cell.c4 { background: linear-gradient(145deg, #fde047, #ca8a04); }
.cell.c5 { background: linear-gradient(145deg, #c084fc, #9333ea); }
.cell:not(.empty)::after { content: ''; position: absolute; inset: 0; border-radius: 5px; background: linear-gradient(160deg, rgba(255,255,255,0.30), rgba(255,255,255,0) 55%); pointer-events: none; }
.cell.surligne { filter: brightness(1.35) saturate(1.2); transform: scale(0.9); z-index: 2; box-shadow: 0 0 0 2px rgba(255,255,255,0.65), 0 0 10px rgba(255,255,255,0.4); }
.cell.dispar { transform: scale(0.2); opacity: 0; }

.hint-text { color: #94a3b8; font-size: 0.8rem; margin-bottom: 8px; }

.msg-fin { text-align: center; padding: 18px; margin-top: 14px; border-radius: 12px; font-size: 1.05rem; font-weight: 700; display: none; }
.msg-fin.termine { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }

/* Classement */
.classement-section { margin-top: 28px; }
.classement-section h2 { font-size: 1.2rem; font-weight: 700; color: var(--color-accent, #c4b5fd); text-align: center; margin-bottom: 16px; }
.onglets-diff { display: flex; justify-content: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.onglet-diff { font-family: 'Inter', sans-serif; font-size: 0.82rem; font-weight: 600; padding: 8px 16px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px; cursor: pointer; background: rgba(255, 255, 255, 0.06); color: #cbd5e1; transition: all 0.2s; }
.onglet-diff:hover { background: rgba(255, 255, 255, 0.12); }
.onglet-diff.active { background: rgba(139, 92, 246, 0.3); border-color: rgba(139, 92, 246, 0.6); color: #c4b5fd; }

.podium { display: flex; justify-content: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.podium-item { text-align: center; padding: 16px; background: rgba(255, 255, 255, 0.06); border-radius: 12px; min-width: 110px; }
.podium-rang { font-size: 1.5rem; margin-bottom: 4px; }
.podium-pseudo { font-size: 0.85rem; font-weight: 700; color: var(--color-accent, #c4b5fd); }
.podium-score { font-size: 0.78rem; color: #94a3b8; margin-top: 2px; }

.classement-liste { max-width: 500px; margin: 0 auto; }
.classement-ligne { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-size: 0.85rem; }
.classement-rang { color: #64748b; width: 34px; }
.classement-pseudo { flex: 1; color: #e0e0e0; font-weight: 600; text-align: left; }
.classement-score-val { color: #34d399; font-weight: 700; font-variant-numeric: tabular-nums; }
.classement-vide { text-align: center; color: #64748b; font-style: italic; padding: 20px; font-size: 0.85rem; }

.lien-classement { display: block; text-align: center; margin-top: 16px; color: var(--color-light, #a78bfa); text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.lien-classement:hover { color: var(--color-accent, #c4b5fd); }

.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: #64748b; margin-top: 28px; text-align: center; }
footer a { color: var(--color-light, #a78bfa); text-decoration: none; }
footer a:hover { color: var(--color-accent, #c4b5fd); }

@media (max-width: 480px) {
  #app { padding: 24px 12px 20px; border-radius: 18px; }
  .header h1 { font-size: 1.5rem; }
  .defi-carte { width: 100%; }
  .podium { flex-direction: column; align-items: center; }
}
