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

:root {
  --bg-main:      #0f172a;
  --bg-card:      #1e293b;
  --bg-hover:     #263448;
  --border:       #334155;
  --border-light: #475569;
  --text-primary: #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:   #64748b;
  --accent:       #B6D8F2;
}

html { font-size: clamp(13px, 1.1vw, 19px); }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; }

/* ---- TOP BAR ---- */
.top-bar {
  flex-shrink: 0;
}

.top-bar-center p {
  margin-top: 0.1rem;
}

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

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

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

/* ---- MAIN / SCREENS ---- */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.screen.hidden { display: none; }

.imp-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 32rem;
  width: 100%;
  text-align: center;
}

.imp-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}
.imp-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: -0.5rem;
}

/* ---- SÉLECTION NOMBRE DE JOUEURS ---- */
.player-count-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
}
.player-count-card {
  background: rgba(10, 22, 40, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(170, 190, 215, 0.18);
  border-radius: 1rem;
  padding: 1.5rem 1rem;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.player-count-card:hover {
  transform: translateY(-3px);
  background: rgba(15, 31, 52, 0.65);
  border-color: rgba(236, 172, 74, 0.5);
}
.player-count-card.active {
  border-color: var(--accent);
  background: rgba(182, 216, 242, 0.12);
  box-shadow: 0 0 0 2px rgba(182, 216, 242, 0.25);
}

/* ---- NOMS DES JOUEURS ---- */
.imp-names-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}
.imp-names-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.imp-names-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.imp-name-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.65rem 1rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
.imp-name-input:focus { border-color: var(--accent); }

/* ---- SOURCE DES MOTS ---- */
.word-source-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.word-source-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.word-source-card:hover { border-color: var(--border-light); }
.word-source-card.active {
  border-color: var(--accent);
  background: rgba(182, 216, 242, 0.12);
  color: var(--text-primary);
}

/* ---- SAISIE MAÎTRE DU JEU ---- */
.gm-words-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.gm-words-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
  margin-top: 0.3rem;
}
.gm-words-label span {
  font-weight: 400;
  color: var(--text-muted);
}
.gm-words-label:first-child { margin-top: 0; }
.gm-words-error {
  font-size: 0.85rem;
  color: #fca5a5;
}

.imp-start-btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.85rem 2.5rem;
  background: var(--accent);
  color: var(--bg-main);
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.imp-start-btn:hover { background: #9dc8e8; transform: translateY(-2px); }

/* ---- TRANSITION ---- */
.imp-transition-name {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
}

/* ---- RÉVÉLATION ---- */
.imp-turn-label {
  font-size: 1rem;
  color: var(--text-secondary);
}
.imp-turn-label strong { color: var(--text-primary); }

.imp-word-card {
  width: 100%;
  min-height: 10rem;
  background: rgba(30, 41, 59, 0.5);
  border: 2px dashed var(--border-light);
  border-radius: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.imp-word-card:hover { border-color: var(--accent); }

.imp-word-hidden {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.imp-word-shown {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  padding: 0 1.5rem;
  animation: impPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes impPop {
  0%   { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}

/* === MODAL === */
.modal-overlay {
  z-index: 2000;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
.modal-box {
  border-radius: 1.25rem;
  padding: 2rem;
  max-width: 520px;
  max-height: 82vh;
  overflow-y: auto;
}
.modal-box h3 {
  font-weight: 800;
  margin-bottom: 0.75rem;
}
.modal-box p {
  font-size: 0.87rem;
  line-height: 1.7;
  margin-bottom: 0.4rem;
}
.modal-box strong { color: var(--text-primary); }
.modal-close {
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: 0.25rem;
  line-height: 1;
}

@media (max-width: 520px) {
  .player-count-grid { grid-template-columns: 1fr; }
  .top-bar-center p { display: none; }
  .top-bar-center h1 { font-size: 1.1rem; }
}

/* ---- FIN DE PARTIE : RÉVÉLATION DE L'IMPOSTEUR ---- */
.imp-replay-btn { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.imp-replay-btn:hover { background: rgba(182, 216, 242, 0.1); }
.imp-impostor-reveal {
  width: 100%;
  background: rgba(30, 41, 59, 0.6);
  border: 2px solid #ef4444;
  border-radius: 1.25rem;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: impPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.imp-reveal-label { font-size: 0.9rem; color: var(--text-secondary); }
.imp-impostor-reveal .imp-transition-name { color: #f87171; }
.imp-reveal-words { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; width: 100%; margin-top: 0.5rem; }
.imp-reveal-words > div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.6rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 0.75rem;
}
.imp-reveal-words span { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.imp-reveal-words strong { font-size: 1.1rem; color: var(--text-primary); overflow-wrap: anywhere; }
