@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ===  VARIABLES === */
:root {
  --bg-main:         #0f172a;
  --bg-card:         #1e293b;
  --bg-card-hover:   #263448;
  --bg-input:        #1e293b;
  --border:          #334155;
  --border-light:    #475569;

  --text-primary:    #f1f5f9;
  --text-secondary:  #94a3b8;
  --text-muted:      #64748b;

  --accent:          #B6D8F2;
  --accent-hover:    #9dc8e8;
  --accent-dim:      rgba(182, 216, 242, 0.15);

  --tile-match:      #14532d;
  --tile-match-brd:  #22c55e;
  --tile-nomatch:    #7f1d1d;
  --tile-nomatch-brd:#ef4444;
  --tile-high:       #78350f;
  --tile-high-brd:   #f59e0b;
  --tile-low:        #78350f;
  --tile-low-brd:    #f59e0b;

  /* hauteur de la top-bar (logo 3rem + padding 2×0.625rem) */
  --topbar-h: 4.25rem;
}

/* === RESET === */

/* === BASE ===
   clamp(12px, 1.1vw, 19px) :
   - 1.1vw = 16px à ~1450px  → taille de référence (inchangée)
   - continue de grossir linéairement au-delà, jusqu'à 19px vers ~1730px
     (pour bien remplir les grands écrans 16:9 au lieu de plafonner à 16px)
   - minimum 12px en-dessous de 1090px
*/
html {
  font-size: clamp(12px, 1.1vw, 19px);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
}

a { text-decoration: none; }

/* =============================================
   TOP BAR
   ============================================= */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 200;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.char-counter {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1.4;
}

.char-counter strong {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

.top-bar-center h1 {
  line-height: 1.2;
}

.top-bar-center p {
  margin-top: 0.125rem;
  font-weight: 400;
}

.help-btn {
  border: 1px solid var(--border-light);
}

.top-bar-right {
  gap: 0.5rem;
}

.diff-control {
  display: flex;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.175rem;
  gap: 0.175rem;
}

.diff-opt {
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.diff-opt:hover:not(.active) { color: var(--text-primary); }
.diff-opt.active[data-val="tous"]      { background: var(--bg-card);  color: var(--text-primary); }
.diff-opt.active[data-val="facile"]    { background: var(--tile-match); color: var(--tile-match-brd); }
.diff-opt.active[data-val="difficile"] { background: var(--tile-high);  color: var(--tile-high-brd); }

.back-button {
  display: inline-block;
}

/* =============================================
   ZONE DE JEU
   ============================================= */
.game-area {
  max-width: 82.5rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 5rem;
}

/* =============================================
   BARRE DE RECHERCHE
   ============================================= */
.search-wrapper {
  position: relative;
  margin-bottom: 1.75rem;
}

#searchInput {
  width: 100%;
  padding: 0.9rem 1.375rem;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 0.875rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

#searchInput::placeholder { color: var(--text-muted); }

#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

/* =============================================
   DROPDOWN PERSONNAGES
   ============================================= */
.characters-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  max-height: 23.75rem;
  overflow-y: auto;
  z-index: 150;
  padding: 0.375rem;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
}

.characters-dropdown.hidden { display: none; }

.characters-dropdown::-webkit-scrollbar { width: 6px; }
.characters-dropdown::-webkit-scrollbar-track { background: transparent; }
.characters-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.character-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  cursor: pointer;
  transition: background 0.15s;
}

.character-item:hover,
.character-item.highlighted {
  background: var(--bg-card-hover);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 0.625rem;
}

.character-img {
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 0.5rem;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}

.character-info h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.character-info p {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin: 0.125rem 0 0;
}

/* =============================================
   EN-TÊTES DES CATÉGORIES
   ============================================= */
.category-headers {
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  margin-bottom: 0.125rem;
  padding: 0.25rem 0.375rem 0.375rem;
  position: sticky;
  top: var(--topbar-h);
  z-index: 100;
  background: var(--bg-main);
  overflow-x: auto;
}

.category-headers.hidden { display: none; }
.category-headers::-webkit-scrollbar { display: none; }

.cat-header-char {
  width: 12rem;
  min-width: 12rem;
  flex-shrink: 0;
}

.cat-header-tile {
  width: 5.75rem;
  min-width: 5.75rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.cat-header-tile img {
  width: 4.375rem;
  height: 4.375rem;
  border-radius: 0.5rem;
  object-fit: cover;
  border: 1px solid var(--border);
}

.cat-header-tile span {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* =============================================
   LIGNE DE TENTATIVE
   ============================================= */
#guessesContainer {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.guess-row {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 0.1875rem;
  overflow-x: auto;
  animation: slideDown 0.25s ease;
}

.guess-row::-webkit-scrollbar { height: 4px; }
.guess-row::-webkit-scrollbar-track { background: transparent; }
.guess-row::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Cellule personnage */
.char-cell {
  width: 12rem;
  min-width: 12rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border-right: 1px solid var(--border);
}

.char-cell img {
  width: 4.95rem;
  height: 4.95rem;
  border-radius: 0.5rem;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}

.char-cell span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

/* Animation de révélation des tuiles */
@keyframes tile-reveal {
  from { opacity: 0; transform: translateY(10px) scale(0.82); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.tile-anim {
  opacity: 0;
  animation: tile-reveal 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Tuile d'attribut */
.attr-tile {
  width: 5.75rem;
  min-width: 5.75rem;
  height: 5.25rem;
  border-radius: 0.625rem;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem 0.375rem;
  flex-shrink: 0;
  text-align: center;
}

.tile-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-indicator {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

/* Couleurs des tuiles */
.tile-match   { background: var(--tile-match);   border-color: var(--tile-match-brd); }
.tile-nomatch { background: var(--tile-nomatch); border-color: var(--tile-nomatch-brd); }
.tile-high    { background: var(--tile-high);    border-color: var(--tile-high-brd); }
.tile-low     { background: var(--tile-low);     border-color: var(--tile-low-brd); }
.tile-neutral { background: var(--bg-card);      border-color: var(--border); }

/* Haki — 3 icônes dans la tuile */
.haki-mini-row {
  display: flex;
  gap: 0.15rem;
  align-items: center;
  justify-content: center;
}

.haki-mini-icon {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 0.2rem;
  object-fit: cover;
  opacity: 0.92;
}

/* Ligne gagnante */
.guess-row-win {
  border-color: var(--tile-match-brd);
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.2);
}

/* =============================================
   FOOTER DE VICTOIRE (inline)
   ============================================= */
#foundContainer {
  margin-top: 1.25rem;
  animation: slideDown 0.3s ease;
}




#resetButton {
  padding: 0.8rem 2.25rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 0.625rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

#resetButton:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* =============================================
   CARTE DE RÉVÉLATION (victoire)
   ============================================= */
.reveal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  padding: 2rem 1.5rem 1.75rem;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-main) 100%);
  border: 1px solid var(--tile-match-brd);
  border-radius: 1.25rem;
  box-shadow: 0 0 32px rgba(34, 197, 94, 0.18), 0 20px 45px rgba(0, 0, 0, 0.35);
  animation: revealPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes revealPop {
  0%   { opacity: 0; transform: scale(0.8) translateY(16px); }
  60%  { opacity: 1; transform: scale(1.03) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.reveal-badge {
  font-size: 0.9rem;
  font-weight: 700;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid var(--tile-match-brd);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.reveal-img-wrap {
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--tile-match-brd);
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.35);
  background: var(--border);
  margin-bottom: 0.35rem;
  animation: revealGlow 2.4s ease-in-out infinite;
}

@keyframes revealGlow {
  0%, 100% { box-shadow: 0 0 18px rgba(34, 197, 94, 0.3); }
  50%      { box-shadow: 0 0 32px rgba(34, 197, 94, 0.55); }
}

.reveal-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reveal-name {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
}

.reveal-alias {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 0.25rem;
}

.reveal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #22c55e;
  margin-bottom: 0.75rem;
}

.reveal-card#resetButton,
.reveal-card #resetButton {
  margin-top: 0.25rem;
}

/* Nuance de couleur selon la performance */
.reveal-legendary .reveal-title { color: #f59e0b; }
.reveal-legendary .reveal-badge { color: #f59e0b; background: rgba(245, 158, 11, 0.12); border-color: #f59e0b; }

/* =============================================
   CONFETTIS
   ============================================= */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 900;
}

/* =============================================
   MODALE "COMMENT ÇA MARCHE"
   ============================================= */
.modal-overlay {
  z-index: 500;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-box {
  border-radius: 1rem;
  padding: 2rem 1.75rem 1.75rem;
  max-width: 28.75rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.modal-box h3 {
  font-weight: 700;
  margin-bottom: 1rem;
}

.modal-box p {
  font-size: 0.92rem;
  line-height: 1.65;
  margin-bottom: 0.625rem;
}

.modal-haki {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.modal-haki-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 0.25rem !important;
}

.modal-haki-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-haki-row img {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.375rem;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-haki-row span {
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* Légende des indicateurs : mini-cases aux couleurs et symboles des vraies cases du jeu */
.modal-haki-row .legend-tile {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-width: 1px;
  border-style: solid; /* la couleur vient de .tile-match / .tile-low… */
  border-radius: 0.375rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.modal-close {
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.25rem 0.375rem;
  border-radius: 0.25rem;
}

/* =============================================
   SECTION INDICES
   ============================================= */
.hints-section {
  margin-bottom: 1rem;
  background: var(--bg-card);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: 0.875rem;
  padding: 0.5rem 1rem;
}

.hints-section.collapsed {
  padding: 0.35rem 1rem;
}

.hints-section.collapsed .hints-header {
  margin-bottom: 0;
}

.hints-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 0.5rem;
}

.hints-title {
  grid-column: 2;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.hints-toggle {
  grid-column: 3;
  justify-self: end;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.hints-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.hints-cards {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---- Carte indice (flip) ---- */
.hint-card {
  width: 8rem;
  height: 4.5rem;
  perspective: 800px;
  cursor: default;
  flex-shrink: 0;
}

.hint-card.unlocked { cursor: pointer; }

.hint-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}

.hint-card.flipped .hint-card-inner {
  transform: rotateY(180deg);
}

.hint-card-front,
.hint-card-back {
  position: absolute;
  inset: 0;
  border-radius: 0.625rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.5rem;
  text-align: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.hint-card-front {
  background: var(--bg-main);
  border: 1px solid var(--border);
}

.hint-card.unlocked .hint-card-front {
  background: var(--accent-dim);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.hint-card-back {
  background: rgba(45, 80, 65, 0.97);
  border: 1px solid var(--accent);
  transform: rotateY(180deg);
}

.hint-icon   { font-size: 1.1rem; line-height: 1; }

.hint-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.hint-countdown {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.2;
}

.hint-click {
  font-size: 0.6rem;
  color: var(--accent);
  font-weight: 500;
}

.hint-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  word-break: break-word;
  line-height: 1.3;
}

/* =============================================
   ÉTAPE SUIVANTE
   ============================================= */
.step2-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding-top: 1rem;
}

.step2-card {
  width: 14rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 0.875rem;
  overflow: hidden;
  transition: border-color 0.35s, box-shadow 0.35s;
}

.step2-card.step2-found {
  border-color: var(--tile-match-brd);
  animation: revealGlow 2.4s ease-in-out infinite;
}

.step2-img-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.step2-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) brightness(0.65);
  transition: filter 0.45s ease;
}

.step2-card.step2-found .step2-img-wrapper img {
  filter: none;
}

.step2-found-name {
  padding: 0.45rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  background: var(--tile-match);
  border-top: 1px solid var(--tile-match-brd);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: slideDown 0.3s ease;
}

.step2-input {
  display: block;
  width: 100%;
  padding: 0.45rem 0.5rem;
  background: var(--bg-main);
  border: none;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
}

.step2-input::placeholder { color: var(--text-muted); }
.step2-input:focus { background: var(--bg-card-hover); border-color: var(--accent); }


.step3-bonus {
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: slideDown 0.3s ease;
}
.step3-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

/* =============================================
   ÉTAPE 4 — DUEL PERSONNALISÉ
   Reprend telles quelles les classes du mode Duel 2 joueurs
   (duel/css/style.css) pour un rendu identique, en plus grand.
   ============================================= */
#step4Container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h, 4.25rem) - 6.75rem);
  overflow: hidden;
}
#step4Container.hidden { display: none; }

.cd-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

/* === ARENA === */
.arena {
  flex: 1 1 auto;
  display: flex;
  gap: 1.25rem;
  min-height: 0;
}

/* === DRAW ZONE === */
.draw-zone {
  flex: 0 0 16.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(30, 41, 59, 0.3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid #334155;
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  gap: 0.6rem;
  overflow: hidden;
}
.drawn-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  animation: fadeIn 0.25s ease;
}
.drawn-img-wrap {
  width: 9rem;
  height: 9rem;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 3px solid #475569;
  background: #0f172a;
  flex-shrink: 0;
}
.drawn-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.drawn-name {
  font-size: 1rem;
  font-weight: 800;
  color: #f1f5f9;
  text-align: center;
  line-height: 1.2;
}
.drawn-prompt {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: center;
}
.drawn-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
}
.cat-btn {
  background: #0f172a;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 0.98rem;
  font-weight: 600;
  border-radius: 0.5rem;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cat-btn:hover { background: #1e293b; border-color: #60a5fa; color: #f1f5f9; }
.cat-btn .cat-icon { width: 2rem; height: 2rem; border-radius: 5px; }

/* === PLAYER BOARDS === */
.boards {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16.25rem, 1fr));
  gap: 1rem;
  min-height: 0;
}

.board {
  background: rgba(30, 41, 59, 0.3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid #334155;
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board-header {
  padding: 0.75rem 1.25rem;
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.9rem;
}
.p0 { color: #60a5fa; border-bottom: 2px solid #2563eb; }
.p1 { color: #f87171; border-bottom: 2px solid #dc2626; }

.board-name { line-height: 1.2; }
.board-score {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  white-space: nowrap;
}

.slots {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.slot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #0f172a;
  flex: 1 1 0;
  min-height: 0;
}
.slot:last-child { border-bottom: none; }
.slot.filled { background: rgba(15, 23, 42, 0.3); }
.slot.empty  { background: rgba(30, 41, 59, 0.3); }

.cat-icon {
  width: 2.8125rem;
  height: 2.8125rem;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  vertical-align: middle;
}

.slot-cat {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: 12.5rem;
  flex-shrink: 0;
}
.slot-char {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 1;
  padding-left: 1.25rem;
  animation: fadeIn 0.2s ease;
}
.slot-img {
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 0.5rem;
  object-fit: cover;
  object-position: top center;
  border: 2px solid #334155;
  flex-shrink: 0;
}
.slot-char-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.2;
}
.slot-empty {
  color: #334155;
  font-size: 0.9rem;
}
.slot-score {
  margin-left: auto;
  font-size: 0.85rem;
  color: #cbd5e1;
  white-space: nowrap;
  flex-shrink: 0;
}
.slot-score strong {
  color: #fbbf24;
  font-size: 1rem;
  font-weight: 800;
}

/* === VERDICT (révélation) === */
.cd-verdict-wrap {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.result-verdict {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: -0.02em;
  text-shadow: 0 0 40px rgba(251,191,36,0.35);
  line-height: 1.2;
}
.result-verdict.draw { color: #94a3b8; text-shadow: none; }
.result-diff {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0.4rem;
  color: #f1f5f9;
}

.cd-actions { display: flex; justify-content: center; }
.cd-continue-btn, .cd-retry-btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.7rem 2rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.cd-continue-btn { background: var(--accent); color: var(--bg-main); }
.cd-continue-btn:hover { background: #9dc8e8; transform: translateY(-2px); }
.cd-retry-btn { background: #dc2626; color: #fff; }
.cd-retry-btn:hover { background: #ef4444; transform: translateY(-2px); }

@media (max-width: 700px) {
  .arena { flex-direction: column; overflow-y: auto; }
  .draw-zone { flex: none; width: 100%; }
  .boards, .boards[data-count] { grid-template-columns: 1fr; flex: none; }
}


/* Prochain quotidien : compte à rebours + perso d'hier */
.next-daily {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 0.75rem;
  margin: 0.25rem 0 0.5rem;
}
.next-daily-countdown,
.next-daily-yesterday {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  text-align: left;
}
.next-daily-countdown { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0.2rem; }
.next-daily-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.next-daily-time { font-size: 1.35rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.next-daily-yesterday img {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.6rem;
  object-fit: cover;
  object-position: top center;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.next-daily-name { display: block; font-size: 1.05rem; font-weight: 800; color: var(--text-primary); margin-top: 0.15rem; }
.next-daily-play {
  font-family: inherit;
  margin-top: 0.3rem;
  padding: 0.45rem 1.2rem;
  background: var(--accent);
  color: var(--bg-main);
  font-weight: 700;
  border: none;
  border-radius: 0.6rem;
  cursor: pointer;
}
.next-daily-play:hover { background: var(--accent-hover); }

/* Conclusion de la journée : dans la carte de victoire (étape 1) ou dans une carte au même style (étapes 2 à 4) */
.reveal-divider {
  width: 100%;
  max-width: 26rem;
  height: 1px;
  margin: 0.5rem 0 1rem;
  background: linear-gradient(90deg, transparent, var(--border-light), transparent);
}
.day-end { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; width: 100%; }
.day-end-title { font-size: 1.15rem; font-weight: 800; color: var(--text-primary); }
.day-end .next-daily { margin: 0.35rem 0 0.25rem; }
.day-end .final-actions { margin: 0.35rem 0 0; }
.day-end-hint { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.4rem; }
.day-end-hint a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.day-end-hint a:hover { color: var(--accent-hover); }

.day-end-card {
  margin-top: 1.25rem;
  padding: 1.75rem 1.5rem;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-main) 100%);
  border: 1px solid var(--tile-match-brd);
  border-radius: 1.25rem;
  box-shadow: 0 0 32px rgba(34, 197, 94, 0.18), 0 20px 45px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: slideDown 0.3s ease;
}

/* Boutons de fin (étape 1 et bloc final) : action principale + « Statistiques » */
.reveal-actions,
.final-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.25rem;
}
.final-actions { margin-bottom: 1rem; }
.final-actions .share-btn { margin-bottom: 0; }
.stats-open-btn {
  font-family: inherit;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0.625rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.stats-open-btn:hover { background: rgba(182, 216, 242, 0.12); transform: translateY(-1px); }

/* Popup des statistiques */
.stats-modal-box { max-width: 30rem; }
.daily-stats { width: 100%; text-align: left; }
.daily-stats-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.85rem; padding-right: 1.75rem; /* place de la croix */ }
.daily-stats-title { font-size: 1rem; font-weight: 800; color: var(--text-primary); }
.daily-stats-tabs { display: flex; gap: 0.25rem; background: var(--bg-main); border: 1px solid var(--border); border-radius: 0.6rem; padding: 0.2rem; }
.daily-stats-tab {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border: none;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.daily-stats-tab.active { background: var(--accent); color: var(--bg-main); }
.daily-stats-tab:not(.active):hover { color: var(--text-primary); }
.daily-stats-empty { font-size: 0.88rem; color: var(--text-muted); }

.daily-stats-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-bottom: 1rem; }
.stats-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.15rem; }
.stats-tile strong { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats-tile span { font-size: 0.68rem; color: var(--text-muted); line-height: 1.25; }

.daily-stats-subtitle { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.45rem; }
.stats-bars { display: flex; flex-direction: column; gap: 2px; }
.stats-bar-row { display: grid; grid-template-columns: 1.6rem 1fr 4.5rem; align-items: center; gap: 0.4rem; min-height: 1.35rem; }
.stats-bar-label { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); text-align: right; font-variant-numeric: tabular-nums; }
.stats-bar-track { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.stats-bar { height: 1.1rem; background: var(--accent); border-radius: 0 4px 4px 0; transition: width 0.4s ease; }
.stats-bar-row.today .stats-bar { background: var(--tile-match-brd); }
.stats-bar-count { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.stats-bar-row.today .stats-bar-count,
.stats-bar-row.today .stats-bar-label { color: var(--text-primary); }
.stats-bar-tag { font-size: 0.68rem; font-weight: 600; color: var(--tile-match-brd); }
.daily-stats-extras { margin-top: 0.85rem; font-size: 0.8rem; line-height: 1.7; color: var(--text-secondary); }
.daily-stats-extras strong { color: var(--text-primary); }

@media (max-width: 700px) {
  .stats-tile strong { font-size: 1.25rem; }
  .stats-bar-row { grid-template-columns: 1.5rem 1fr 3.8rem; }
}




.step2-card.step2-abandoned { border-color: #ef4444; }
.step2-card.step2-abandoned .step2-img-wrapper img { filter: none; }
.step2-card.step2-abandoned .step2-found-name {
  background: #dc2626;
  border-top-color: #ef4444;
}

.step2-abandon-btn {
  font-family: inherit;
  padding: 0.55rem 1.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid #ef4444;
  border-radius: 0.6rem;
  background: #dc2626;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.step2-abandon-btn:hover {
  background: #ef4444;
  transform: translateY(-1px);
}

.step-next-btn {
  font-family: inherit;
  margin-top: 0.5rem;
  padding: 0.85rem 2.25rem;
  background: var(--accent);
  color: var(--bg-main);
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(182, 216, 242, 0.25);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  animation: slideDown 0.3s ease;
}
.step-next-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(182, 216, 242, 0.35);
}

/* =============================================
   UTILITAIRES
   ============================================= */

/* =============================================
   RESPONSIVE — breakpoints en largeur viewport
   (le clamp sur html gère déjà le scaling,
    ces règles gèrent les changements de layout)
   ============================================= */
@media (max-width: 768px) {
  .top-bar { padding: 0.5rem 0.875rem; }
  .site-logo { height: 2.375rem; }
  .top-bar-center h1 { font-size: 1.2rem; }
  .back-button { font-size: 0.75rem; padding: 0.375rem 0.625rem; }
  .game-area { padding: 1rem 0.625rem 3rem; }
  .help-btn { display: none; }
}

@media (max-width: 480px) {
  .top-bar-center p { display: none; }
  .top-bar-center h1 { font-size: 1rem; }
  .game-area { padding: 0.75rem 0.5rem 2.5rem; }
}

.share-btn {
  font-family: inherit;
  padding: 0.75rem 1.75rem;
  background: var(--accent);
  color: var(--bg-main);
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: background 0.2s, transform 0.15s;
}
.share-btn:hover { background: var(--accent-hover); transform: translateY(-2px); }

#guessesContainer.restored .tile-anim { animation: none; opacity: 1; }

/* Frise des étapes du daily terminé */
.daily-timeline {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin: -1.25rem 0 0.4rem;
}
.tl-node {
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-primary);
}
.tl-img {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.tl-img img { width: 100%; height: 100%; object-fit: cover; }
.tl-node:hover .tl-img { transform: translateY(-2px); border-color: var(--border-light); }
.tl-node.active .tl-img { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim); }
.tl-label { font-size: 0.8rem; font-weight: 700; }
.tl-node.active .tl-label { color: var(--accent); }
.tl-line {
  flex: 0 0 4rem;
  height: 3px;
  margin-top: 1.75rem;
  background: var(--border);
  border-radius: 2px;
}

/* Nom de catégorie dans les tuiles : uniquement sur téléphone */
.tile-cat { display: none; }

/* =============================================
   TABLETTE ET TÉLÉPHONE : essais sur deux niveaux
   (personnage en bandeau, puis les 10 tuiles avec leur catégorie ;
    10 sur une ligne sur tablette, 5 × 2 sur téléphone)
   ============================================= */
@media (max-width: 920px) {
  .category-headers { display: none; }
  .guess-row {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 0.25rem;
    padding: 0.3rem;
    overflow: visible;
  }
  .char-cell {
    grid-column: 1 / -1;
    width: auto;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.15rem 0.25rem 0.35rem;
  }
  .char-cell img { width: 2.6rem; height: 2.6rem; }
  .char-cell span { font-size: 0.95rem; }
  .attr-tile {
    width: auto;
    min-width: 0;
    height: 4.5rem;
    padding: 0.3rem 0.2rem;
    gap: 0.15rem;
  }
  .tile-cat {
    display: block;
    max-width: 100%;
    font-size: 0.56rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .haki-mini-row { gap: 0.1rem; }
}

/* =============================================
   TÉLÉPHONE
   ============================================= */
@media (max-width: 700px) {
  .game-area { padding: 0.75rem 0.6rem 3rem; }

  /* Frise des étapes : tient sur la largeur de l'écran */
  .daily-timeline { margin: 0 0 0.75rem; }
  .tl-img { width: 2.9rem; height: 2.9rem; border-width: 2px; }
  .tl-label { font-size: 0.72rem; }
  .tl-line { flex: 1 1 1rem; min-width: 0.5rem; max-width: 3rem; margin-top: 1.45rem; }

  #searchInput { font-size: 1rem; }

  /* Indices : 3 cartes sur une ligne */
  .hints-cards { gap: 0.4rem; flex-wrap: nowrap; }
  .hint-card { flex: 1 1 0; width: auto; min-width: 0; height: 4.25rem; }
  .hint-card-front, .hint-card-back { padding: 0.35rem; }
  .hint-value { font-size: 0.9rem; }

  /* Essais : 10 tuiles en 5 × 2 */
  .guess-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .attr-tile { height: 4.1rem; }
  .tile-value { font-size: 0.74rem; }
  .tile-indicator { font-size: 0.95rem; }
  .haki-mini-icon { width: 1.1rem; height: 1.1rem; }
}

/* Téléphone — duel du jour : carte tirée compacte, les deux compos côte à côte */
@media (max-width: 700px) {
  #step4Container { height: auto; overflow: visible; }
  .arena { gap: 0.75rem; }
  .draw-zone { padding: 0.75rem; }
  .drawn-card {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    grid-template-areas: "img name" "img prompt" "act act";
    column-gap: 0.75rem;
    row-gap: 0.2rem;
    align-items: center;
  }
  .drawn-img-wrap { grid-area: img; width: 5.5rem; height: 5.5rem; }
  .drawn-name { grid-area: name; text-align: left; align-self: end; font-size: 1.1rem; }
  .drawn-prompt { grid-area: prompt; text-align: left; align-self: start; font-size: 0.8rem; }
  .drawn-actions { grid-area: act; display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; margin-top: 0.5rem; }
  .cat-btn { font-size: 0.85rem; padding: 0.5rem 0.55rem; gap: 0.4rem; }
  .cat-btn .cat-icon { width: 1.6rem; height: 1.6rem; }

  .boards, .boards[data-count] { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .board-header { padding: 0.5rem 0.4rem; font-size: 0.85rem; min-height: 0; flex-wrap: wrap; gap: 0.25rem; }
  .board-score { font-size: 0.75rem; padding: 0.1rem 0.5rem; }
  .slots { flex: none; }
  .slot { flex: none; flex-wrap: wrap; gap: 0.35rem; padding: 0.45rem 0.4rem; min-height: 3.4rem; }
  .slot-cat { width: auto; font-size: 0; gap: 0; }
  .slot-cat .cat-icon { width: 1.5rem; height: 1.5rem; }
  .slot-char { flex: 1 1 0; min-width: 0; padding-left: 0; gap: 0.35rem; }
  .slot-img { width: 2.2rem; height: 2.2rem; }
  .slot-char-name { font-size: 0.78rem; min-width: 0; overflow-wrap: break-word; }
  .slot-empty { font-size: 0.8rem; }
  .slot-score { flex-basis: 100%; text-align: right; font-size: 0.7rem; }
  .slot-score strong { font-size: 0.85rem; }
  .result-verdict { font-size: 1.3rem; }
}
