/* ===========================
   RESET & BASE
   =========================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3250;
  --text: #e8eaf6;
  --text-muted: #7b82b0;
  --accent: #6c63ff;
  --accent2: #a78bfa;
  --success: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;

  /* Thème Histoire */
  --histoire-color: #c0932b;
  --histoire-bg: #2d2206;
  --histoire-border: #7a5c10;

  /* Thème Science */
  --science-color: #38bdf8;
  --science-bg: #061928;
  --science-border: #0e5b8a;

  /* Thème Géo */
  --geographie-color: #4ade80;
  --geographie-bg: #062010;
  --geographie-border: #156839;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===========================
   SCREENS
   =========================== */
.screen {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.35s ease;
}
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===========================
   HOME SCREEN
   =========================== */
.home-container {
  max-width: 780px;
  margin: 0 auto;
  padding: 60px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
}

.logo {
  text-align: center;
}

.logo-icon {
  font-size: 56px;
  display: block;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 18px rgba(108,99,255,0.6));
}

.logo-title {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #6c63ff, #a78bfa, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.logo-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-top: 8px;
}

/* ── Quick join ──────────────────────────────────────────── */
.quick-join-section {
  width: 100%;
  text-align: center;
}

.quick-join-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.quick-join-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.quick-join-input {
  padding: .6rem .9rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
  width: 12rem;
}

.quick-join-input::placeholder { color: var(--text-muted); }

/* ── Themes ──────────────────────────────────────────────── */
.theme-section {
  width: 100%;
  text-align: center;
}

.theme-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 24px;
}

.theme-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 600px) {
  .theme-cards { grid-template-columns: 1fr; }
  .logo-title { font-size: 2.2rem; }
}

.theme-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), background var(--transition);
  position: relative;
  overflow: hidden;
}

.theme-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.theme-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.theme-card[data-theme="histoire"]:hover,
.theme-card[data-theme="histoire"].selected {
  border-color: var(--histoire-color);
  background: var(--histoire-bg);
  box-shadow: 0 0 0 3px rgba(192,147,43,0.2), var(--shadow);
}

.theme-card[data-theme="science"]:hover,
.theme-card[data-theme="science"].selected {
  border-color: var(--science-color);
  background: var(--science-bg);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.2), var(--shadow);
}

.theme-card[data-theme="geographie"]:hover,
.theme-card[data-theme="geographie"].selected {
  border-color: var(--geographie-color);
  background: var(--geographie-bg);
  box-shadow: 0 0 0 3px rgba(74,222,128,0.2), var(--shadow);
}

.theme-emoji {
  font-size: 2.4rem;
  line-height: 1;
}

.theme-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.theme-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* ===========================
   SELECTED THEME INFO
   =========================== */
.selected-theme-info p {
  color: var(--text-muted);
  font-size: 1rem;
}

.selected-theme-info strong {
  color: var(--text);
}

.hidden { display: none !important; }

/* ===========================
   BUTTONS
   =========================== */
.btn-play {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 40px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  box-shadow: 0 4px 20px rgba(108,99,255,0.4);
  letter-spacing: 0.3px;
}

.btn-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(108,99,255,0.55);
}

.btn-play:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 13px 32px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--accent);
}

/* ===========================
   GAME SCREEN
   =========================== */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.btn-back {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.btn-back:hover { color: var(--text); border-color: var(--accent); }

.header-center {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-theme-icon { font-size: 1.3rem; }

.header-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  text-transform: uppercase;
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-theme-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.score-display {
  display: none;
}

/* ===========================
   GAME MAIN
   =========================== */
.game-main {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===========================
   LAST GUESS BANNER
   =========================== */
.last-guess-banner {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  animation: slideDown 0.3s ease;
  border-left: 4px solid transparent;
}

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

.last-guess-banner.cold {
  background: rgba(239,68,68,0.12);
  border-color: var(--danger);
  color: #fca5a5;
}
.last-guess-banner.warm {
  background: rgba(245,158,11,0.12);
  border-color: var(--warn);
  color: #fcd34d;
}
.last-guess-banner.hot {
  background: rgba(34,197,94,0.12);
  border-color: var(--success);
  color: #86efac;
}

/* ===========================
   ARTICLE CARD
   =========================== */
.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  overflow: visible;
}

@media (max-width: 600px) {
  .article-card { padding: 18px 16px; }
}

/* ── Mot à trouver (en haut de l'article) ── */
.target-word-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.target-word-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.target-word-display {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
}

.target-word-display.found {
  font-size: 1.5rem;
  font-weight: 800;
  color: #4ade80;
  font-family: 'Playfair Display', serif;
  letter-spacing: 2px;
}

.target-letter {
  display: inline-block;
  width: 18px;
  height: 28px;
  background: var(--surface2);
  border-bottom: 2px solid var(--accent);
  border-radius: 2px 2px 0 0;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: transparent;
  line-height: 28px;
}

.target-sep {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 1px;
}

.article-text {
  font-size: 1.02rem;
  line-height: 1.9;
  color: var(--text);
  word-spacing: 2px;
}

/* Mots masqués */
.word-hidden {
  display: inline-block;
  background: var(--surface2);
  border-radius: 4px;
  color: transparent;
  user-select: none;
  vertical-align: middle;
  height: 1em;
  min-width: 2ch;
  margin: 0 1px;
  position: relative;
  transition: background var(--transition);
  cursor: pointer;
}

.word-hidden:hover {
  background: var(--border);
}

/* Badge nombre de lettres au clic */
.word-hidden.word-hidden-revealed {
  background: rgba(108,99,255,0.25);
  border: 1px solid rgba(108,99,255,0.5);
}

.word-hidden.word-hidden-revealed::after {
  content: attr(data-count-label);
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--accent);
  color: var(--accent2);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* Mots révélés partiellement selon proximité */
.word-revealed {
  display: inline-block;
  border-radius: 4px;
  padding: 0 2px;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
}

/* Dégradé dynamique : couleur appliquée via style inline en JS */
.word-revealed.word-gradient {
  /* fallback si JS n'a pas pu appliquer la couleur */
  background: rgba(136,136,136,0.18);
  color: #ffffff;
}

.word-revealed.cold {}
.word-revealed.warm {}
.word-revealed.hot {}
.word-revealed.exact {
  color: #ffffff;
  font-weight: 800;
  animation: pulse 0.5s ease;
}

@keyframes pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ===========================
   GUESS SECTION
   =========================== */
.guess-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.guess-form {
  display: flex;
  gap: 10px;
}

.guess-form input {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.guess-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.2);
}

.guess-form input::placeholder { color: var(--text-muted); }

.btn-guess {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn-guess:hover { background: #7c74ff; }
.btn-guess:active { transform: scale(0.97); }

.hint-text {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 10px;
}

/* ===========================
   ATTEMPTS SECTION
   =========================== */
.attempts-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.attempts-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
}

.attempts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.attempt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.93rem;
  animation: fadeIn 0.2s ease;
}

.attempt-word {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
}

.attempt-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.attempt-score {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 90px;
  text-align: right;
}

.attempt-bar-wrap {
  width: 80px;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}

.attempt-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.attempt-bar.cold { background: var(--danger); }
.attempt-bar.warm { background: var(--warn); }
.attempt-bar.hot  { background: var(--success); }
.attempt-bar.exact{ background: var(--accent2); }

.attempt-number {
  min-width: 22px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* ===========================
   MODAL
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.3s ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: modalPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-emoji {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: bounce 0.6s ease 0.2s both;
}

@keyframes bounce {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-message {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 20px;
}

.modal-message strong { color: var(--text); }

.modal-word-reveal {
  background: var(--surface2);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 28px;
  color: var(--accent2);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===========================
   THEME COLORS ON GAME
   =========================== */
body[data-theme="histoire"] {
  --accent: var(--histoire-color);
  --accent2: #e5b96a;
}
body[data-theme="science"] {
  --accent: var(--science-color);
  --accent2: #7dd3fc;
}
body[data-theme="geographie"] {
  --accent: var(--geographie-color);
  --accent2: #86efac;
}

/* ===========================
   MODE SELECTION (accueil)
   =========================== */
.mode-section {
  margin-top: 28px;
  text-align: center;
}

.mode-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 520px;
  margin: 0 auto;
}

@media (max-width: 500px) {
  .mode-cards { grid-template-columns: 1fr; }
}

.mode-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.mode-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15), var(--shadow);
}

.mode-card.selected {
  border-color: var(--accent);
  background: rgba(108,99,255,0.08);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.2);
}

.mode-emoji { font-size: 2rem; }

.mode-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.mode-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Noms joueurs duel */
.duel-names {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px auto 0;
  max-width: 360px;
  width: 100%;
}

.duel-name-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.duel-name-row label {
  font-weight: 600;
  min-width: 110px;
  font-size: 0.95rem;
  color: var(--text);
}

.duel-name-row input {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.duel-name-row input:focus { border-color: var(--accent); }

.selected-theme-info {
  text-align: center;
  animation: fadeIn 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.selected-theme-info > p { margin-bottom: 0; }
.selected-theme-info .btn-play { margin-top: 24px; }

/* ===========================
   BARRE 1VS1 (en jeu)
   =========================== */
:root {
  --p1-color: #60a5fa;   /* bleu */
  --p2-color: #f87171;   /* rouge */
}

.duel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  gap: 12px;
}

.duel-player-tab {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: border-color var(--transition), background var(--transition);
  min-width: 0;
}

.duel-player-tab.active-tab {
  border-color: var(--border);
  background: var(--surface2);
}

#tab-p1.active-tab { border-color: var(--p1-color); background: rgba(96,165,250,0.08); }
#tab-p2.active-tab { border-color: var(--p2-color); background: rgba(248,113,113,0.08); }

.duel-player-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-p1 { background: var(--p1-color); }
.dot-p2 { background: var(--p2-color); }

.duel-player-tab span:nth-child(2) {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duel-player-tries {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.duel-vs {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ===========================
   BANDEAU DE TOUR
   =========================== */
.turn-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  animation: slideDown 0.3s ease;
}

.turn-banner.p1-turn {
  background: rgba(96,165,250,0.1);
  color: var(--p1-color);
}

.turn-banner.p2-turn {
  background: rgba(248,113,113,0.1);
  color: var(--p2-color);
}

.turn-hint {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0.7;
  min-width: 5ch;
  text-align: right;
}

/* Barre de compte à rebours */
#turn-timer-bar {
  width: 100%;
  height: 4px;
  background: rgba(128,128,128,0.18);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
  flex-basis: 100%;
}

#turn-timer-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #f97316, #22c55e);
  transition: width 0.25s linear;
}

.p1-turn #turn-timer-bar-fill { background: linear-gradient(90deg, #f97316, #60a5fa); }
.p2-turn #turn-timer-bar-fill { background: linear-gradient(90deg, #f97316, #f87171); }

/* ===========================
   TENTATIVES PAR JOUEUR
   =========================== */
.attempt-item.p1 { border-left: 3px solid var(--p1-color); }
.attempt-item.p2 { border-left: 3px solid var(--p2-color); }

.attempt-player-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

.attempt-player-badge.p1 { background: rgba(96,165,250,0.15); color: var(--p1-color); }
.attempt-player-badge.p2 { background: rgba(248,113,113,0.15); color: var(--p2-color); }

/* ===========================
   MODAL PASSAGE DE TOUR
   =========================== */
.modal-pass {
  max-width: 380px;
}

/* ===========================
   RÉCAP DUEL
   =========================== */
.duel-recap {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  text-align: left;
}

.duel-recap-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.duel-recap-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.duel-recap-score {
  margin-left: auto;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.duel-recap-row.winner .duel-recap-score {
  color: var(--success);
}

/* input focus couleur joueur actif */
.p1-active #guess-input:focus {
  border-color: var(--p1-color);
  box-shadow: 0 0 0 3px rgba(96,165,250,0.2);
}
.p2-active #guess-input:focus {
  border-color: var(--p2-color);
  box-shadow: 0 0 0 3px rgba(248,113,113,0.2);
}
.p1-active .btn-guess { background: var(--p1-color); }
.p2-active .btn-guess { background: var(--p2-color); }


/* ════════════════════════════════════════════════
   MODE EN LIGNE – Accueil
   ════════════════════════════════════════════════ */
.online-section {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.online-name-row {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.online-name-row label {
  font-size: .85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.online-name-row input {
  flex: 1;
  padding: .55rem .9rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
}

.online-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  flex-wrap: wrap;
}

.btn-online-create {
  padding: .65rem 1.3rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-online-create:hover { opacity: .85; }

.online-or {
  color: var(--text-muted);
  font-size: .85rem;
  padding: 0 .2rem;
}

.online-join-row {
  display: flex;
  gap: .5rem;
}

.input-code {
  width: 5rem;
  padding: .6rem .7rem;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-align: center;
  text-transform: uppercase;
}

.btn-online-join {
  padding: .6rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-online-join:hover { background: var(--surface); }

.online-error {
  color: #f87171;
  font-size: .85rem;
  margin-top: .2rem;
}

/* ════════════════════════════════════════════════
   ÉCRAN D'ATTENTE
   ════════════════════════════════════════════════ */
#screen-waiting.active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.waiting-container {
  width: 100%;
  max-width: 480px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.waiting-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.waiting-header h2 {
  font-size: 1.5rem;
  color: var(--text);
}

.waiting-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.waiting-label {
  color: var(--text-muted);
  font-size: .95rem;
}

.waiting-code-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.waiting-code-text {
  font-family: 'Courier New', monospace;
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: .3em;
  color: var(--accent);
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: .3rem 1rem;
}

.btn-copy {
  padding: .55rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-copy:hover { background: var(--surface); }

.waiting-status {
  color: var(--text-muted);
  font-size: .9rem;
}

/* Spinner */
.waiting-spinner {
  margin-top: .5rem;
}
.spinner-ring {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════
   BARRE EN LIGNE (conn-dot)
   ════════════════════════════════════════════════ */
.conn-dot {
  font-size: .9rem;
  line-height: 1;
}

/* ════════════════════════════════════════════════
   MODE BLITZ (Course)
   ════════════════════════════════════════════════ */

/* --- Salle d'attente blitz --- */
.blitz-waiting-players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}
.blitz-waiting-player {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .95rem;
  font-weight: 600;
}
.blitz-waiting-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* --- Barre joueurs blitz (screen-game) --- */
.blitz-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.blitz-player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 14px;
  border-radius: 10px;
  background: var(--bg);
  border: 2px solid var(--border);
  min-width: 80px;
  font-size: .82rem;
  transition: border-color .3s, background .3s;
}
.blitz-player-card.blitz-me {
  border-color: var(--accent);
  background: rgba(99,102,241,.08);
}
.blitz-player-card.blitz-winner {
  border-color: #f59e0b;
  background: rgba(245,158,11,.12);
  animation: blitz-winner-pulse 1s ease-in-out 3;
}
.blitz-player-name {
  font-weight: 700;
  font-size: .85rem;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.blitz-player-tries {
  font-size: .75rem;
  opacity: .65;
}

/* --- Barre de progression révélation --- */
.blitz-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 8px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  opacity: .75;
}
.blitz-progress-track {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.blitz-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #6366f1, #22c55e);
  transition: width .5s ease;
}

/* --- Mot nouvellement révélé (animation) --- */
@keyframes blitz-appear {
  from { opacity: 0; transform: translateY(-4px) scale(.9); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.word-new {
  animation: blitz-appear .35s ease-out;
  color: var(--accent);
}

/* --- Animation victoire blitz --- */
@keyframes blitz-winner-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.06); }
}

/* --- Badge joueur dans tentatives blitz --- */
.attempt-player-badge.blitz-badge {
  background: rgba(99,102,241,.18);
  color: var(--accent);
}

