* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* PAGE DE CONNEXION */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 30px;
  padding: 60px 50px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  max-width: 450px;
  width: 100%;
  text-align: center;
}

.logo {
  font-size: 4em;
  margin-bottom: 20px;
}

.login-card h1 {
  color: #667eea;
  margin-bottom: 15px;
  font-size: 2.2em;
}

.login-card p {
  color: #666;
  margin-bottom: 40px;
  font-size: 1.1em;
}

.input-group {
  margin-bottom: 25px;
  text-align: left;
}

.input-group label {
  display: block;
  color: #333;
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 0.95em;
}

.input-group input {
  width: 100%;
  padding: 15px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 1em;
  transition: all 0.3s;
  outline: none;
}

.input-group input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-btn {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 18px;
  font-size: 1.2em;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.5);
}

/* NAVIGATION */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  padding: 20px 0;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo {
  font-size: 1.8em;
  font-weight: bold;
  color: #667eea;
}

.nav-toggle {
  display: none;
  background: #667eea;
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.3em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.35);
}

.nav-user {
  display: flex;
  gap: 20px;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8f9fa;
  padding: 10px 20px;
  border-radius: 25px;
}

.user-avatar {
  width: 35px;
  height: 35px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.nav-btn {
  background: transparent;
  border: 2px solid #667eea;
  color: #667eea;
  padding: 10px 25px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.nav-btn:hover {
  background: #667eea;
  color: white;
}

.nav-btn.active {
  background: #667eea;
  color: white;
}

.logout-btn {
  background: #ff4757;
  border: none;
  color: white;
  padding: 10px 25px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.logout-btn:hover {
  background: #ff3838;
  transform: translateY(-2px);
}

/* PAGE DE JEU */
.game-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 50px 30px;
}

.game-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 40px;
}

.wheel-section {
  background: white;
  border-radius: 30px;
  padding: 50px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.wheel-header {
  text-align: center;
  margin-bottom: 50px;
}

.wheel-header h1 {
  color: #667eea;
  font-size: 2.5em;
  margin-bottom: 10px;
}

.wheel-header p {
  color: #666;
  font-size: 1.1em;
}

.wheel-container {
  position: relative;
  width: clamp(280px, 60vw, 450px);
  height: clamp(280px, 60vw, 450px);
  margin: 0 auto 50px;
}

.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 15px solid #333;
  position: relative;
  transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  max-width: 450px;
  max-height: 450px;
  display: block;
  margin: 0 auto;
}

.arrow {
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  border-top: 50px solid #ff4757;
  z-index: 10;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.3));
}

.center-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  z-index: 5;
  border: 6px solid white;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.spin-controls {
  text-align: center;
}

.spin-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 20px 60px;
  font-size: 1.3em;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.spin-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

.spin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: translateY(0);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.stats-card {
  background: white;
  border-radius: 25px;
  padding: 30px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.stats-card h2 {
  color: #667eea;
  margin-bottom: 25px;
  font-size: 1.5em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #f8f9fa;
  border-radius: 15px;
  margin-bottom: 12px;
}

.stat-label {
  font-weight: 600;
  color: #333;
}

.stat-value {
  font-size: 1.3em;
  font-weight: bold;
  color: #667eea;
}

.history-card {
  background: white;
  border-radius: 25px;
  padding: 30px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
  max-height: 500px;
  overflow-y: auto;
}

.history-card h2 {
  color: #667eea;
  margin-bottom: 25px;
  font-size: 1.5em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-item {
  padding: 18px 20px;
  margin-bottom: 12px;
  border-radius: 15px;
  transition: transform 0.2s;
}

.history-item:hover {
  transform: translateX(5px);
}

.history-item.win {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  border-left: 5px solid #28a745;
}

.history-item.lose {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  border-left: 5px solid #dc3545;
}

.history-item.retry {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border-left: 5px solid #ffc107;
}

.history-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-prize {
  font-weight: 600;
  font-size: 1em;
}

.history-time {
  font-size: 0.85em;
  color: #666;
}

/* PAGE STATISTIQUES */
.stats-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 50px 30px;
}

.stats-page h1 {
  color: white;
  text-align: center;
  font-size: 3em;
  margin-bottom: 50px;
  text-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
}

.player-card {
  background: white;
  border-radius: 25px;
  padding: 35px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.3s,
    box-shadow 0.3s;
}

.player-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
}

.player-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  padding-bottom: 25px;
  border-bottom: 3px solid #f0f0f0;
}

.player-avatar-large {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 1.8em;
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.player-info h3 {
  color: #333;
  font-size: 1.5em;
  margin-bottom: 5px;
}

.player-info p {
  color: #666;
  font-size: 0.95em;
}

.player-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 25px;
}

.mini-stat {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 12px;
  text-align: center;
}

.mini-stat-label {
  color: #666;
  font-size: 0.85em;
  margin-bottom: 5px;
}

.mini-stat-value {
  color: #667eea;
  font-size: 1.8em;
  font-weight: bold;
}

.player-wins {
  background: #f0f8ff;
  padding: 20px;
  border-radius: 15px;
  border-left: 5px solid #28a745;
}

.player-wins h4 {
  color: #28a745;
  margin-bottom: 15px;
  font-size: 1.1em;
}

.win-item {
  background: white;
  padding: 12px 15px;
  border-radius: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.win-name {
  font-weight: 600;
  color: #333;
}

.win-time {
  font-size: 0.85em;
  color: #666;
}

/* OVERLAY ET POPUP */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
}

.overlay.active {
  display: flex;
}

.result-popup {
  background: white;
  padding: 60px 50px;
  border-radius: 30px;
  text-align: center;
  max-width: 550px;
  width: 90%;
  animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

@keyframes popIn {
  from {
    transform: scale(0.3) rotate(-10deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.result-icon {
  font-size: 5em;
  margin-bottom: 20px;
}

.result-popup h2 {
  font-size: 2.5em;
  margin-bottom: 20px;
}

.result-popup p {
  font-size: 1.4em;
  margin-bottom: 40px;
  color: #666;
}

.close-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 18px 50px;
  font-size: 1.2em;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.close-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

.confetti {
  position: fixed;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: confetti-fall 3s linear;
  z-index: 1000;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.hidden {
  display: none !important;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
  .game-container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
}

@media (max-width: 768px) {
  .wheel-container {
    width: 350px;
    height: 350px;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .players-grid {
    grid-template-columns: 1fr;
  }

  .nav-container {
    flex-direction: column;
    gap: 15px;
  }

  .login-card {
    padding: 40px 30px;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 12px 0;
  }

  .nav-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .nav-user {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .nav-btn,
  .logout-btn {
    padding: 8px 16px;
    font-size: 0.9em;
  }

  .user-info {
    padding: 8px 14px;
  }
}

@media (max-width: 768px) {
  .game-page {
    padding: 20px 15px;
  }

  .game-container {
    grid-template-columns: 1fr;
    gap: 25px;
  }

  .wheel-section {
    padding: 25px 20px;
  }

  .wheel-header h1 {
    font-size: 1.8em;
  }

  .wheel-container {
    width: 280px;
    height: 280px;
    margin-bottom: 30px;
  }

  .spin-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.1em;
  }
}

@media (max-width: 768px) {
  .sidebar {
    flex-direction: column;
    gap: 20px;
  }

  .stats-card,
  .history-card {
    padding: 20px;
  }

  .stat-item {
    padding: 12px 15px;
  }
}

@media (max-width: 480px) {
  .wheel-container {
    width: 240px;
    height: 240px;
  }

  .center-circle {
    width: 60px;
    height: 60px;
  }

  .arrow {
    top: -25px;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 35px solid #ff4757;
  }

  .result-popup {
    padding: 35px 25px;
  }

  .result-popup h2 {
    font-size: 1.8em;
  }

  .result-popup p {
    font-size: 1.1em;
  }
}

button,
input {
  touch-action: manipulation;
}

.history-card {
  overscroll-behavior: contain;
}

@media (min-width: 1024px) and (max-height: 950px) {
  /* Page globale */
  .game-page {
    padding: 25px 30px;
  }

  /* Layout */
  .game-container {
    grid-template-columns: 1fr 360px;
    gap: 30px;
    align-items: start;
  }

  /* Bloc jeu */
  .wheel-section {
    padding: 30px;
  }

  .wheel-header {
    margin-bottom: 25px;
  }

  .wheel-header h1 {
    font-size: 2em;
  }

  .wheel-header p {
    font-size: 1em;
  }

  /* Roue */
  .wheel-container {
    width: 360px;
    height: 360px;
    margin-bottom: 30px;
  }

  #wheelCanvas {
    max-width: 360px;
    max-height: 360px;
  }

  .center-circle {
    width: 65px;
    height: 65px;
  }

  .arrow {
    top: -5px;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 40px solid #ff4757;
  }

  /* Bouton */
  .spin-btn {
    padding: 14px 45px;
    font-size: 1.15em;
  }

  /* Sidebar */
  .stats-card,
  .history-card {
    padding: 22px;
  }

  .stats-card h2,
  .history-card h2 {
    font-size: 1.3em;
    margin-bottom: 18px;
  }

  .stat-item {
    padding: 10px 15px;
    margin-bottom: 8px;
  }

  .history-card {
    max-height: 260px;
  }
}

.nav-toggle {
  display: none;
}

@media (max-width: 768px) {
  .nav-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-user {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 40;
  }

  .nav-user.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-btn,
  .logout-btn {
    width: 100%;
    max-width: 260px;
    text-align: center;
  }

  .user-info {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .nav-logo {
    font-size: 1.2em;
  }
}

@media (max-width: 480px) {
  .nav-logo {
    font-size: 1.05em;
  }
}
