/* ==========================================
   HEARO - CREATE ROOM CSS
   Optimisé avec navigation identique à Join
   ========================================== */

/* ==========================================
   1. VARIABLES & RESET
   ========================================== */
:root {
  --primary-color: #45d67f;
  --secondary-color: #3bb76f;
  --tertiary-color: #2e9c5e;
  --accent-color: #7beaa7;
  --neon-glow: 0 0 5px var(--primary-color), 0 0 15px var(--primary-color);
  --text-color: #ffffff;
  --bg-color: #0a0a12;
  --panel-bg: #12121f;
  --home-bg: #b5e7a0;
  --nav-height: 100px;
}

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

html {
  height: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================
   2. BODY - Layout principal
   ========================================== */
body {
  background-color: var(--home-bg);
  color: var(--text-color);
  font-family: 'Montserrat', 'Segoe UI', sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 15px 15px calc(var(--nav-height) + 15px);
  overflow-x: hidden;
  position: relative;
}

/* ==========================================
   3. PANEL HEADER - Conteneur principal
   ========================================== */
.panel-header {
  background: rgba(23, 25, 35, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 20px 25px;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - var(--nav-height) - 40px);
  max-height: calc(100dvh - var(--nav-height) - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 15px;
  animation: panelSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  margin: auto;
}

.panel-header::-webkit-scrollbar {
  width: 6px;
}

.panel-header::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.panel-header::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.panel-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
  opacity: 0.6;
}

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

/* ==========================================
   4. HEADER & TITLE
   ========================================== */
.header h1,
.panel-header h1 {
  font-size: clamp(1.4rem, 5vw, 1.8rem);
  font-weight: 600;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--tertiary-color), var(--accent-color));
  background-size: 300%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
  width: 100%;
  animation: gradientShift 6s ease infinite;
  user-select: none;
  margin-bottom: 5px;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ==========================================
   5. STEP INDICATOR
   ========================================== */
.step-indicator {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  margin-bottom: 8px;
}

.step {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.step.active {
  background: var(--primary-color);
  transform: scale(1.3);
  box-shadow: var(--neon-glow);
}

/* ==========================================
   6. FORM STEPS
   ========================================== */
.form-step {
  display: none;
}

.form-step.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s ease;
}

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

.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-color);
}

/* ==========================================
   7. INPUTS
   ========================================== */
input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: white;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

input[type="text"]:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 12px rgba(69, 214, 127, 0.4);
  background: rgba(255, 255, 255, 0.12);
}

#player-name {
  border-color: var(--primary-color);
}

/* ==========================================
   8. AVATAR DISPLAY
   ========================================== */
#avatarDisplay {
  font-size: 60px;
  cursor: pointer;
  margin: 8px auto;
  width: 85px;
  height: 85px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 3px solid var(--primary-color);
  transition: all 0.3s ease;
}

#avatarDisplay:hover {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(69, 214, 127, 0.6);
  border-color: var(--accent-color);
}

#avatarDisplay:active {
  transform: scale(1.02);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}

.modal-content {
  background: rgba(26, 26, 46, 0.95);
  border-radius: 20px;
  padding: 25px;
  width: 100%;
  max-width: 450px;
  max-height: 85vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  position: relative;
  animation: modalPop 0.3s ease-out;
}

@keyframes modalPop {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-content h2 {
  font-size: 1.6rem;
  font-weight: 600;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--tertiary-color), var(--accent-color));
  background-size: 300%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
  width: 100%;
  margin-bottom: 20px;
  animation: gradientShift 6s ease infinite;
}

/* Inputs dans les modales */
.modal-content input.input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: white;
  font-size: 0.95rem;
  outline: none;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.modal-content input.input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.modal-content input.input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 15px rgba(94, 155, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
}

/* ==========================================
   09. AVATAR MODAL GRID
   ========================================== */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* ← Changé de 6 à 5 colonnes par défaut pour mobile */
  gap: 10px; /* ← Réduit de 12px à 10px */
  width: 100%;
  margin: 15px 0;
  padding: 0 5px; /* ← Ajouté pour éviter le débordement */
}

.avatar-option {
  font-size: 32px; /* ← Réduit de 36px */
  width: 50px; /* ← Réduit de 55px */
  height: 50px; /* ← Réduit de 55px */
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.avatar-option:hover {
  transform: scale(1.15);
  background: rgba(94, 155, 255, 0.2);
  border-color: var(--primary-color);
  box-shadow: 0 0 15px rgba(94, 155, 255, 0.4);
}

.avatar-option.selected {
  background: rgba(94, 155, 255, 0.3);
  border-color: var(--primary-color);
  box-shadow: 0 0 12px rgba(94, 155, 255, 0.5);
}

/* Modal Avatar - Affichage plein écran */
#avatarModal.modal {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

#avatarModal.modal.active,
#avatarModal.modal[style*="display: block"] {
  display: flex !important;
}

/* ==========================================
   09. AVATAR MODAL - Plein écran optimisé
   ========================================== */

/* Modal overlay - plein écran */
#avatarModal.modal {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Quand le modal est actif */
#avatarModal.modal.active,
#avatarModal.modal[style*="display: flex"],
#avatarModal.modal[style*="display: block"] {
  display: flex !important;
}

/* Contenu du modal - fond sombre */
#avatarModal .modal-content {
  background: rgba(26, 26, 46, 0.98) !important;
  border-radius: 20px;
  padding: 30px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
  position: relative;
}

/* Grille des avatars */
#avatarModal .avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  width: 100%;
  margin: 15px 0;
  padding: 0;
}

/* Chaque avatar */
#avatarModal .avatar-option {
  font-size: 36px;
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

#avatarModal .avatar-option:hover {
  transform: scale(1.15);
  background: rgba(69, 214, 127, 0.2);
  border-color: var(--primary-color);
  box-shadow: 0 0 15px rgba(69, 214, 127, 0.4);
}

#avatarModal .avatar-option.selected {
  background: rgba(69, 214, 127, 0.3);
  border-color: var(--primary-color);
  box-shadow: 0 0 12px rgba(69, 214, 127, 0.5);
}

/* Mobile responsive */
@media (max-width: 480px) {
  #avatarModal .modal-content {
    padding: 20px;
    max-width: 95vw;
  }
  
  #avatarModal .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
  
  #avatarModal .avatar-option {
    font-size: 32px;
    width: 50px;
    height: 50px;
  }
}



/* ==========================================
   09b. OPTION CARDS
   ========================================== */
.option-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.option-card {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(0, 0, 0, 0.2);
}

.option-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 0 10px rgba(69, 214, 127, 0.2);
  transform: translateY(-2px);
}

.option-card.selected {
  border-color: var(--primary-color);
  background: rgba(69, 214, 127, 0.15);
  box-shadow: var(--neon-glow);
}

.option-card h3 {
  font-size: 1rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-card p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
}

.option-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  position: relative;
}

.coming-soon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: bold;
  pointer-events: none;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==========================================
   11. TOGGLE SWITCH
   ========================================== */
.toggle-setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  transition: all 0.3s ease;
  margin-bottom: 15px;
}

.toggle-setting:hover {
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 15px rgba(69, 214, 127, 0.1);
}

.setting-info {
  flex: 1;
}

.setting-title {
  font-size: 1rem;
  font-weight: 600;
}

.setting-description {
  font-size: 0.85rem;
  opacity: 0.7;
  line-height: 1.3;
}

.toggle-switch {
  position: relative;
  width: 56px;
  height: 28px;
  flex-shrink: 0;
  margin-left: 15px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 28px;
  transition: 0.3s;
  cursor: pointer;
}

.toggle-slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .toggle-slider {
  background: var(--primary-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(28px);
}

/* ==========================================
   12. NUMBER SELECTOR
   ========================================== */
.number-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 10px;
}

.number-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-color);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.number-btn:hover {
  border-color: var(--primary-color);
  background: rgba(69, 214, 127, 0.1);
  transform: scale(1.05);
}

.number-display {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  min-width: 50px;
  text-align: center;
}

/* ==========================================
   13. NAVIGATION BUTTONS (Back/Next)
   ========================================== */
.nav-buttons {
  display: flex;
  gap: 12px;
  margin-top: 15px;
}

.nav-buttons .btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  color: white;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3), 0 10px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  user-select: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-buttons .btn-primary {
  background: linear-gradient(145deg, var(--primary-color), var(--secondary-color));
}

.nav-buttons .btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 0 var(--tertiary-color), 0 8px 16px rgba(0, 0, 0, 0.3);
  transform: translateY(2px);
}

.nav-buttons .btn-primary:active:not(:disabled) {
  box-shadow: 0 2px 0 var(--tertiary-color), 0 4px 8px rgba(0, 0, 0, 0.3);
  transform: translateY(4px);
}

.nav-buttons .btn-secondary {
  background: linear-gradient(145deg, #5a6478, #4a5568);
}

.nav-buttons .btn-secondary:hover:not(:disabled) {
  box-shadow: 0 4px 0 #3a4555, 0 8px 16px rgba(0, 0, 0, 0.3);
  transform: translateY(2px);
}

.nav-buttons .btn-secondary:active:not(:disabled) {
  box-shadow: 0 2px 0 #3a4555, 0 4px 8px rgba(0, 0, 0, 0.3);
  transform: translateY(4px);
}

.nav-buttons .btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  background: linear-gradient(145deg, #666, #555);
  box-shadow: 0 4px 0 #333, 0 8px 16px rgba(0, 0, 0, 0.2);
  transform: none;
}

.nav-buttons .btn:disabled:hover {
  transform: none;
}

/* ==========================================
   14. BOTTOM NAVIGATION (Identique à Join)
   ========================================== */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--nav-height);
  background: #0d0d1c;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 5px);
  z-index: 999;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.nav-group {
  display: flex;
  gap: 40px;
  align-items: center;
}

.nav-item {
  text-decoration: none;
  text-align: center;
  font-size: 13px;
  color: #cdd2ff;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.nav-item:active {
  transform: scale(0.95);
}

.buzzer {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  box-shadow: 
    0 6px 0 rgba(0, 0, 0, 0.4),
    0 8px 16px rgba(0, 0, 0, 0.6),
    inset 0 3px 8px rgba(255, 255, 255, 0.3);
  transition: all 0.1s ease;
  border: 3px solid rgba(255, 255, 255, 0.5);
}

.buzzer:active {
  transform: translateY(4px);
  box-shadow: 
    0 2px 0 rgba(0, 0, 0, 0.4),
    0 4px 10px rgba(0, 0, 0, 0.6),
    inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.buzzer-logout { background: linear-gradient(145deg, #ff5c8a, #e04670); }
.buzzer-join { background: linear-gradient(145deg, #ffbe4d, #e6a927); }
.buzzer-create { background: linear-gradient(145deg, #45d67f, #3bc06b); }
.buzzer-prof { background: linear-gradient(145deg, #5e9bff, #4a87eb); }

.nav-item.active {
  color: #FFD700;
}

.nav-item.active .buzzer {
  border-color: #FFD700;
  box-shadow: 
    0 6px 0 rgba(0, 0, 0, 0.4),
    0 8px 20px rgba(255, 215, 0, 0.4),
    inset 0 3px 8px rgba(255, 255, 255, 0.4);
}

/* ==========================================
   15. UTILITIES
   ========================================== */
.hidden {
  display: none !important;
}

.summary-preview {
  padding: 12px 16px;
  background: rgba(69, 214, 127, 0.1);
  border-left: 3px solid var(--primary-color);
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-color);
}

/* ==========================================
   16. MEDIA QUERIES - RESPONSIVE
   ========================================== */

/* Galaxy S3 360x640 - ULTRA COMPACT */
@media (max-width: 360px) {
  :root {
    --nav-height: 95px;
  }
  
  body {
    padding: 5px 10px calc(var(--nav-height) + 5px);
    justify-content: flex-start;
  }
  
  .panel-header {
    padding: 15px 18px;
    border-radius: 18px;
    gap: 8px;
    max-height: calc(100vh - var(--nav-height) - 15px);
    max-height: calc(100dvh - var(--nav-height) - 15px);
    margin-top: 0;
  }
  
  .panel-header h1 {
    font-size: 1.35rem;
    margin-bottom: 2px;
  }
  
  .form-group {
    margin-bottom: 12px;
  }
  
  label {
    font-size: 0.85rem;
    margin-bottom: 6px;
  }
  
  input[type="text"] {
    padding: 9px 11px;
    font-size: 0.9rem;
  }
  
  #avatarDisplay {
    width: 70px;
    height: 70px;
    font-size: 48px;
    margin: 5px auto;
  }
  
  .option-card {
    padding: 10px 12px;
  }
  
  .option-card h3 {
    font-size: 0.9rem;
  }
  
  .option-card p {
    font-size: 0.8rem;
  }
  
  .nav-buttons .btn {
    padding: 10px 15px;
    font-size: 0.9rem;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3), 0 8px 16px rgba(0, 0, 0, 0.3);
  }
  
  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 9px;
    padding: 0 4px;
  }
  
  .avatar-option {
    width: 42px;
    height: 42px;
    font-size: 26px;
  }
  
  .nav-group {
    gap: 22px;
  }
  
  .buzzer {
    width: 48px;
    height: 48px;
    font-size: 17px;
  }
  
  .nav-item {
    font-size: 11px;
  }
  
  .step-indicator {
    padding: 10px;
    gap: 6px;
  }
  
  .step {
    width: 8px;
    height: 8px;
  }
}

/* iPhone SE 320px */
@media (max-width: 320px) {
  :root {
    --nav-height: 90px;
  }
  
  body {
    padding: 3px 8px calc(var(--nav-height) + 3px);
  }
  
  .panel-header {
    padding: 12px 15px;
    gap: 6px;
  }
  
  .panel-header h1 {
    font-size: 1.25rem;
  }
  
  input[type="text"] {
    padding: 8px 10px;
    font-size: 0.85rem;
  }
  
  #avatarDisplay {
    width: 65px;
    height: 65px;
    font-size: 42px;
  }
  
  .nav-buttons .btn {
    padding: 9px 14px;
    font-size: 0.85rem;
  }
  
  .nav-group {
    gap: 18px;
  }
  
  .buzzer {
    width: 45px;
    height: 45px;
    font-size: 16px;
  }
  
  .nav-item {
    font-size: 10px;
  }
    .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0 3px;
  }
  
  .avatar-option {
    width: 38px;
    height: 38px;
    font-size: 24px;
  }
}

/* Petits mobiles 361-428px */
@media (min-width: 361px) and (max-width: 428px) {
  .panel-header {
    max-width: 92%;
  }
  
  .avatar-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 0 5px;
  }
  
  .avatar-option {
    width: 48px;
    height: 48px;
    font-size: 30px;
  }
}

/* Écrans bas */
@media (max-height: 700px) {
  body {
    padding-top: 12px;
  }
  
  .panel-header {
    padding: 18px 22px;
    gap: 12px;
  }
  
  #avatarDisplay {
    margin: 6px auto;
  }
}

/* Paysage mobile */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --nav-height: 85px;
  }
  
  body {
    padding: 8px 15px calc(var(--nav-height) + 8px);
  }
  
  .panel-header {
    padding: 12px 18px;
    gap: 8px;
    max-height: calc(100vh - var(--nav-height) - 20px);
  }
  
  #avatarDisplay {
    width: 65px;
    height: 65px;
    font-size: 40px;
    margin: 4px auto;
  }
  
  .avatar-grid {
    grid-template-columns: repeat(8, 1fr); /* Plus de colonnes en mode paysage */
    gap: 8px;
    padding: 0 5px;
  }
  
  .avatar-option {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }
  
  .nav-group {
    gap: 30px;
  }
  
  .buzzer {
    width: 45px;
    height: 45px;
    font-size: 16px;
  }
  
  .nav-item {
    font-size: 10px;
  }
  
  .nav-buttons .btn {
    padding: 9px 14px;
    font-size: 0.85rem;
  }
}

/* Tablettes et grands écrans */
@media (min-width: 768px) {
  body {
    padding: 30px 30px calc(var(--nav-height) + 30px);
  }
  
  .panel-header {
    max-width: 480px;
    padding: 30px 35px;
    gap: 18px;
  }
  
  #avatarDisplay {
    width: 100px;
    height: 100px;
    font-size: 70px;
  }
  
  input[type="text"] {
    padding: 12px 15px;
    font-size: 1rem;
  }
  
  .nav-buttons .btn {
    padding: 14px 20px;
    font-size: 1rem;
  }
  
  .modal-content {
    max-width: 540px; /* ← Sur desktop, on limite à 540px comme profile */
  }
  
  .avatar-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    padding: 0;
  }
  
  .avatar-option {
    width: 60px;
    height: 60px;
    font-size: 38px;
  }
  
  .option-card {
    padding: 16px 18px;
  }
}

/* Grands écrans Desktop */
@media (min-width: 1024px) {
  .panel-header {
    max-width: 540px;
  }
}

/* Fallback pour backdrop-filter */
@supports not (backdrop-filter: blur(10px)) {
  .panel-header {
    background: rgba(23, 25, 35, 0.98);
  }
  
  .modal {
    background: rgba(0, 0, 0, 0.9);
  }
}

/* Mode PWA standalone/fullscreen */
@media (display-mode: fullscreen), (display-mode: standalone) {
  body {
    padding-top: max(15px, env(safe-area-inset-top));
  }
  
  .bottom-nav {
    padding-bottom: max(5px, env(safe-area-inset-bottom));
  }
}

