/* === Same Game - page solo === */
*, *::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;
  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: 24px 20px 20px;
  max-width: 95vw;
  width: fit-content;
  min-width: min(340px, 92vw);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.back-link {
  font-size: 0.85rem;
  color: var(--color-light, #a78bfa);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
  white-space: nowrap;
}
.back-link:hover { color: var(--color-accent, #c4b5fd); }

h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(90deg, #a78bfa, #8b5cf6, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.diff-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-light, #a78bfa);
  background: rgba(139,92,246,0.12);
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

/* Blocs latéraux (bandeau Infos + Jeux à la une) : visibles sur l'écran de choix et en
   fin de partie (PC uniquement, gérés par leur propre média ≥1280px), masqués pendant le jeu. */
body.sg-en-jeu .bandeau-infos-wrap,
body.sg-en-jeu .bloc-jeux-une-wrap { display: none !important; }

/* Écran de choix de difficulté (setup, avant la partie) */
.setup-screen { padding: 8px 0 4px; }
.setup-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #c4b5fd;
  margin-bottom: 4px;
}
.setup-sub { font-size: 0.82rem; color: #94a3b8; margin-bottom: 18px; }
.diff-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.diff-card {
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 16px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s;
}
.diff-card:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(139, 92, 246, 0.4); }
.diff-card.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.6);
}
.diff-card .diff-emoji { font-size: 1.6rem; }
.diff-card .diff-nom { font-size: 0.92rem; font-weight: 700; color: #c4b5fd; }
.diff-card .diff-meta { font-size: 0.68rem; color: #94a3b8; }
#btn-commencer { width: 100%; padding: 13px; font-size: 1rem; }

@media (max-width: 380px) {
  .diff-card { padding: 12px 4px; }
  .diff-card .diff-emoji { font-size: 1.3rem; }
  .diff-card .diff-nom { font-size: 0.82rem; }
  .diff-card .diff-meta { font-size: 0.62rem; }
}

.info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  gap: 14px;
  flex-wrap: wrap;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 700;
}
.info-icon { font-size: 1.05rem; }
.score-display { color: #c4b5fd; }
.restants-display { color: #94a3b8; }
.gain-display { color: #34d399; min-width: 56px; text-align: right; transition: opacity 0.2s; }

/* Grille Same Game */
.grid-wrap {
  display: inline-block;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 14px;
  max-width: 100%;
}
.grid {
  display: grid;
  gap: 2px;
  margin: 0 auto;
  cursor: pointer; /* gap inclus : le curseur reste "main" sur tout le plateau */
}
.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: 10px;
}

.actions-bar {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* Overlay fin de partie */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 100;
  justify-content: center;
  align-items: flex-start;   /* la boîte démarre en haut */
  overflow-y: auto;          /* contenu long (CTA inclus) accessible au scroll */
  padding: 24px 16px;
}
.overlay.visible { display: flex; }
.overlay-box { margin: auto; }  /* centré verticalement si ça tient, sinon scroll */
.overlay-box {
  background: rgba(30, 27, 75, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  max-width: 400px;
  width: 100%;
}
.overlay-box h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; color: #c4b5fd; }
.overlay-box .score-final { font-size: 2.2rem; font-weight: 900; color: #34d399; margin: 4px 0; }
.overlay-box p { color: #94a3b8; font-size: 0.9rem; margin-bottom: 16px; }
/* Boutons de l'écran de fin (Rejouer, Changer la difficulté, Accueil) */
.fin-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }

.btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 22px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: #8b5cf6;
  box-shadow: none;
}
.btn-secondary {
  background: #64748b;
  box-shadow: 0 4px 15px rgba(100, 116, 139, 0.3);
}

.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: 12px; }
footer a { color: var(--color-light, #a78bfa); text-decoration: none; }
footer a:hover { color: var(--color-accent, #c4b5fd); }

.cta-connexion {
  margin-top: 12px;
  padding: 12px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 10px;
  font-size: 0.82rem;
  color: #94a3b8;
}
.cta-connexion a { color: var(--color-light, #a78bfa); font-weight: 600; text-decoration: none; }

@media (max-width: 480px) {
  #app { padding: 16px 10px 14px; border-radius: 18px; }
  h1 { font-size: 1.25rem; }
  .info-bar { padding: 8px 12px; gap: 10px; }
  .info-item { font-size: 0.82rem; }
}
