*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f1117;
  color: #e5e7eb;
  min-height: 100vh;
}

.screen { display: none; }
.screen.active { display: flex; flex-direction: column; min-height: 100vh; }

/* Auth */
#auth-screen { align-items: center; justify-content: center; }
#auth-screen .card { width: 100%; max-width: 400px; }

.card {
  background: #1a1d27;
  border: 1px solid #2d3148;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

h1 { font-size: 2rem; text-align: center; margin-bottom: 24px; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; margin-bottom: 12px; }
h4 { font-size: 0.95rem; margin-bottom: 10px; color: #a0aec0; }

input, select {
  width: 100%;
  padding: 10px 14px;
  margin: 8px 0;
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 8px;
  color: #e5e7eb;
  font-size: 0.95rem;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}
.btn-primary:hover { background: #4f46e5; }
.btn-primary:disabled { background: #374151; cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: #374151;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
}

.btn-small {
  padding: 6px 12px;
  background: #2d3148;
  color: #e5e7eb;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab { flex: 1; padding: 8px; background: #0f1117; border: 1px solid #2d3148; color: #a0aec0; border-radius: 6px; cursor: pointer; }
.tab.active { background: #6366f1; color: white; border-color: #6366f1; }

.error { color: #f87171; font-size: 0.85rem; margin-top: 8px; }

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #1a1d27;
  border-bottom: 1px solid #2d3148;
}

.user-info { display: flex; align-items: center; gap: 12px; }

/* Lobby */
.lobby-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #0f1117;
  border-radius: 8px;
  margin-top: 8px;
}

/* Room */
.room-content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  padding: 24px;
  flex: 1;
}

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

/* TicTacToe */
.game-board { text-align: center; padding: 20px; }
.board-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 280px;
  margin: 20px auto;
}
.cell {
  aspect-ratio: 1;
  background: #0f1117;
  border: 2px solid #2d3148;
  border-radius: 8px;
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.cell:hover { background: #2d3148; }
#game-status { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; color: #6366f1; }

/* Joueurs */
.player-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  background: #0f1117;
}
.player-item.ready { border-left: 3px solid #10b981; }

/* Chat */
.chat-card { display: flex; flex-direction: column; }
#chat-messages {
  height: 200px;
  overflow-y: auto;
  background: #0f1117;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
}
.chat-msg { padding: 4px 0; font-size: 0.85rem; border-bottom: 1px solid #1a1d27; }
.chat-input { display: flex; gap: 6px; }
.chat-input input { margin: 0; }
.chat-input button { white-space: nowrap; padding: 8px 14px; background: #6366f1; color: white; border: none; border-radius: 6px; cursor: pointer; }

/* Voix */
.btn-voice {
  width: 100%;
  padding: 10px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 10px;
}
.btn-voice.connected { background: #ef4444; }
.voice-participant { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.voice-indicator { font-size: 1.2rem; }

/* Notification invitation */
.notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a1d27;
  border: 1px solid #6366f1;
  border-radius: 12px;
  padding: 20px;
  z-index: 100;
  max-width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.notification.hidden { display: none; }
.room-code-display { font-size: 0.85rem; display: flex; align-items: center; gap: 8px; }

/* Responsive */
@media (max-width: 768px) {
  .lobby-content { grid-template-columns: 1fr; }
  .room-content { grid-template-columns: 1fr; }
  header { flex-direction: column; gap: 8px; }
}
