:root {
  --bg-gradient-start: #0f172a;
  --bg-gradient-end: #020617;
  --card-bg: #0b1220;
  --card-border: #1f2937;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.1);
  --accent-strong: #4f46e5;
  --accent-danger: #ef4444;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --text-soft: #6b7280;
  --badge-bg: #111827;
  --input-bg: #020617;
  --input-border: #1f2937;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.7);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-full: 999px;
}

/* Reset simple */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1f2937 0, var(--bg-gradient-start) 35%, var(--bg-gradient-end) 100%);
  color: var(--text-main);
}

/* Layout principal */

.app {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px 32px;
}

.app-header {
  text-align: center;
  margin-bottom: 24px;
}

.logo {
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 0.04em;
}

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

/* Cartes */

.card {
  background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.08), transparent 55%),
    radial-gradient(circle at bottom right, rgba(129, 140, 248, 0.12), transparent 50%),
    var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-soft);
  padding: 20px 22px;
}

/* Auth */

.auth-card {
  max-width: 700px;
  margin: 0 auto;
}

.auth-card h2 {
  margin-top: 0;
  margin-bottom: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field-group label {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.field-group input[type="text"],
.field-group input[type="email"],
.room-input {
  border-radius: var(--radius-md);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field-group input:focus,
.room-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.7);
  background: #020617;
}

.inline {
  flex-direction: row;
  align-items: center;
}

.inline input {
  flex: 1;
  margin-right: 10px;
}

/* Avatar preview */

.avatar-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.avatar-label {
  font-size: 0.85rem;
  color: var(--text-soft);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: #020617;
}

.avatar-large {
  width: 52px;
  height: 52px;
}

/* Boutons */

.btn {
  border-radius: var(--radius-full);
  border: none;
  padding: 9px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f9fafb;
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.45);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(79, 70, 229, 0.6);
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.btn-secondary:hover {
  background: rgba(15, 23, 42, 1);
  border-color: rgba(129, 140, 248, 0.9);
}

.btn-ghost {
  background: transparent;
  border-radius: var(--radius-full);
  border: none;
  color: var(--text-soft);
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-main);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
}

.btn-voted {
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.7);
  background: rgba(79, 70, 229, 0.12);
}

.vote-list button:disabled {
  opacity: 0.7;
  cursor: default;
}

/* Checkbox custom */

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-soft);
  cursor: pointer;
  margin-bottom: 12px;
}

.checkbox input {
  accent-color: var(--accent);
}

/* Auth layout */

.auth-actions {
  display: grid;
  grid-template-columns: 1.4fr auto 1.4fr;
  gap: 18px;
  align-items: center;
}

.auth-block h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  font-size: 0.85rem;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  width: 26px;
  background: rgba(148, 163, 184, 0.4);
  margin: 0 8px;
}

/* Messages */

.message {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--accent-danger);
  min-height: 1.2em;
}

/* Game layout */

#game {
  display: none;
}

.game-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  margin-top: 26px;
}

/* Sidebar / joueurs */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.room-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.room-code-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
}

.room-code-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.4rem;
  font-weight: 700;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.info-label {
  font-size: 0.85rem;
  color: var(--text-soft);
}

.badge {
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.8rem;
  background: var(--badge-bg);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.badge-role {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge-word {
  max-width: 160px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.players-section {
  margin-top: 10px;
}

.section-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.players-list {
  margin-bottom: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Carte joueur */

.player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.player-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-info-text {
  display: flex;
  flex-direction: column;
}

.player-name {
  font-size: 0.92rem;
}

.player-meta {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.player-status {
  font-size: 0.8rem;
}

.player.alive .player-status {
  color: #22c55e;
}

.player.dead {
  opacity: 0.55;
}

.player.dead .player-status {
  color: var(--accent-danger);
}

.host-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(129, 140, 248, 0.6);
}

.sidebar-info {
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* Panel principal */

.main-panel {
  min-height: 380px;
  display: flex;
  flex-direction: column;
}

.panel-section {
  display: none;
}

.panel-section h2 {
  margin-top: 0;
}

.hint {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-bottom: 14px;
}

/* Clues */

.clues-list {
  margin-top: 12px;
  border-top: 1px solid rgba(31, 41, 55, 0.9);
  padding-top: 10px;
  max-height: 260px;
  overflow-y: auto;
}

.clue-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
}

.clue-content {
  display: flex;
  flex-direction: column;
}

.clue-name {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.clue-text {
  font-size: 0.95rem;
}

/* Votes */

.vote-list button {
  margin-bottom: 6px;
  width: 100%;
  justify-content: flex-start;
}

/* Fin de partie */

.winner-text {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 12px 0;
}


.scores-container {
  margin-top: 12px;
  border-top: 1px solid rgba(31, 41, 55, 0.9);
  padding-top: 10px;
  font-size: 0.9rem;
}

.scores-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.scores-table th,
.scores-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.8);
  text-align: left;
}

.scores-table th {
  font-weight: 600;
  color: var(--text-soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}


/* Responsive */

@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }

  .main-panel {
    order: 1;
  }
}

@media (max-width: 680px) {
  .auth-actions {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .divider {
    justify-content: flex-start;
  }

  .divider::before,
  .divider::after {
    display: none;
  }
}