/* Écrans Pays et Défi : cartes et panneaux cohérents avec Plus près. */
.setup{max-height:calc(100dvh - 86px);overflow-y:auto}.setup>p{margin-bottom:8px}.setup label{margin-top:8px}.setup select{padding:9px}.setup button{margin-top:12px}
.checkrow{display:flex;gap:10px;flex-wrap:wrap;margin:8px 0 13px}.checkrow label{display:flex;gap:7px;align-items:center;padding:10px;background:#eff6ff;border:1px solid #bfdbfe;border-radius:11px;font-size:13px;margin:0;cursor:pointer}.checkrow input{width:18px;height:18px}
#answerBox{margin:8px 0}#answer{width:100%;padding:11px;border:1px solid #94a3b8;border-radius:10px;font:inherit;font-size:16px}
.country-options{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:7px 0}.country-options button{padding:10px 7px;border:1px solid #93a9be;border-radius:10px;background:#f8fafc;color:#0f172a;font-size:13px;min-height:42px;font-weight:750}
#share{width:100%;border:1px solid #93c5fd;border-radius:12px;padding:12px;background:#dbeafe;color:#1e40af;font-size:13px;font-weight:750;margin-top:14px}.share-msg{font-size:11px;color:#64748b;margin:7px 0}.result-row{align-items:center}.result-row strong{font-weight:850}
.leaflet-container{touch-action:pan-x pan-y}
@media(max-width:650px){.country-options{gap:5px}.country-options button{padding:8px 4px;font-size:12px}.setup{max-height:calc(100dvh - 75px)}}

/* Défis France : catégories distinctes, panneaux compatibles mobile */
.category-group{margin:10px 0 5px}
.category-heading{font-size:13px;font-weight:850;color:#334155;margin-bottom:7px}
.category-group .checkrow{margin:0 0 6px}
.category-group .checkrow label{flex:1 1 175px;line-height:1.25;min-height:45px}
.setup{width:min(470px,calc(100% - 26px));max-height:min(76dvh,calc(100dvh - 95px));overflow-y:auto;scrollbar-width:thin}
@media(max-width:650px){.setup{max-height:70dvh;bottom:max(8px,env(safe-area-inset-bottom))}.category-group .checkrow label{padding:8px;min-height:40px}}

.preset-title{font-size:12px;font-weight:800;color:#64748b;margin-top:12px;margin-bottom:6px}
.preset-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.preset-row button{margin:0!important;padding:9px 5px;min-height:39px;border-radius:10px;border:1px solid #bfd1eb;background:#eef6ff;color:#1e40af;font-size:12px;font-weight:800}
.preset-row button:hover,.preset-row button:focus-visible{background:#dbeafe;border-color:#60a5fa}
@media(max-width:400px){.preset-row button{font-size:11px}}

/* Défi simplifié : une seule catégorie, filtres contextuels */
.simple-setup{width:min(460px,calc(100% - 28px));padding:19px 20px 15px;max-height:calc(100dvh - 100px);overflow-y:auto;scrollbar-width:thin}
.simple-setup h1{font-size:25px;margin-bottom:5px}
.simple-setup .setup-intro{font-size:13px;color:#64748b;margin:0 0 14px}
.mode-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.simple-setup .mode-card{position:relative;min-width:0;min-height:89px;display:flex;gap:10px;align-items:center;margin:0;padding:12px 11px;background:#f8fafc;border:2px solid #e2e8f0;border-radius:14px;cursor:pointer;transition:background .13s,border-color .13s,box-shadow .13s}
.mode-card:has(input:checked){background:#eef5ff;border-color:#2563eb;box-shadow:0 0 0 2px #2563eb10}
.mode-card:has(input:focus-visible){outline:3px solid #93c5fd;outline-offset:3px}
.mode-card:hover{border-color:#93c5fd}
.mode-card input{position:absolute;opacity:0;width:1px;height:1px;pointer-events:none}
.mode-emoji{font-size:25px;line-height:1;flex:0 0 auto}
.mode-copy{display:flex;min-width:0;flex-direction:column;gap:3px}
.mode-copy strong{font-size:14px;line-height:1.15;color:#0f172a}
.mode-copy small{font-size:11px;line-height:1.3;color:#64748b;font-weight:500}
.setup-controls{display:grid;grid-template-columns:1fr 1fr;gap:11px;margin-top:14px}
.setup-controls label{display:block;margin:0 0 5px;font-size:12px;color:#334155}
.simple-setup .setup-controls select{padding:10px;font-size:13px;min-height:43px;margin:0}
.simple-setup #start{margin-top:14px;min-height:47px}
.simple-setup .status{margin-top:8px;text-align:center;font-size:11px;color:#64748b}
@media(max-width:650px){.simple-setup{bottom:max(8px,env(safe-area-inset-bottom));padding:14px 15px 12px;max-height:calc(100dvh - 79px)}.simple-setup h1{font-size:21px}.simple-setup .setup-intro{margin-bottom:10px}.simple-setup .mode-card{min-height:78px;padding:10px 8px;gap:6px}.mode-emoji{font-size:23px}.mode-copy strong{font-size:13px}.mode-copy small{font-size:10px}.setup-controls{gap:8px;margin-top:10px}.simple-setup #start{margin-top:11px}}
@media(max-width:350px){.mode-card{flex-direction:column;align-items:flex-start;gap:4px}.mode-copy small{display:none}}

/* Défis partagés : entrée sans compte et classement compact */
.style-switch{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin:12px 0 5px;background:#eaf0fa;padding:4px;border-radius:12px}
.simple-setup .style-switch button{margin:0;padding:9px;min-height:38px;background:transparent;color:#475569;border:0;border-radius:9px;font-size:13px;font-weight:800}
.simple-setup .style-switch button.active{background:white;color:#1d4ed8;box-shadow:0 1px 6px #0001}
#friendsActions>label{display:block;margin:9px 0 4px;font-weight:800;font-size:12px}
#friendsActions input{min-width:0;width:100%;min-height:42px;padding:10px;border-radius:10px;border:1px solid #bdd0e4;font-size:15px;background:#fff;color:#0f172a}
#roomCreate{margin:10px 0 4px!important;min-height:45px}
.room-separator{text-align:center;color:#64748b;font-size:12px;margin:9px}
.join-controls{display:grid;grid-template-columns:1fr auto;gap:7px;align-items:center}
.simple-setup .join-controls button{margin:0;background:#e4edff;color:#1d4ed8;padding:10px 13px;border:1px solid #bfdbfe;border-radius:10px}
.room-lobby{width:min(420px,calc(100% - 28px));max-height:75dvh;overflow-y:auto;padding:20px;}
.room-lobby h2{margin:0 0 5px;font-size:33px;letter-spacing:.18em;text-align:center;color:#1d4ed8}
.lobby-eyebrow{text-transform:uppercase;font-weight:800;font-size:11px;color:#64748b;text-align:center;letter-spacing:.1em}
.lobby-hint,.lobby-state{text-align:center;color:#64748b;font-size:13px;margin:8px 0}
.room-lobby button{width:100%;margin:8px 0 0;min-height:42px}
.room-lobby .room-leave{background:transparent;border:1px solid #cbd5e1;color:#64748b}
.room-players{margin:10px 0;max-height:28vh;overflow:auto}
.leader-row{display:flex;align-items:center;gap:9px;padding:8px 6px;border-bottom:1px solid #e2e8f0;font-size:13px}
.leader-rank{width:19px;color:#64748b;font-weight:800}.leader-row strong{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.leader-detail{font-variant-numeric:tabular-nums;color:#475569;font-size:11px;flex-shrink:0}
.room-board{margin-top:9px;padding:6px 9px;border-radius:10px;border:1px solid #bcd4fb;background:#f1f7ff;max-height:27vh;overflow-y:auto}
.room-board summary{font-size:12px;font-weight:800;color:#1d4ed8;cursor:pointer;padding:4px}
#finalRoomBoard{margin:14px 0;max-height:30vh}
@media(max-width:650px){.simple-setup{max-height:calc(100dvh - 75px)}.room-lobby{bottom:max(8px,env(safe-area-inset-bottom));max-height:75dvh}.room-board{max-height:17vh}}

.friend-challenge-link{display:block;text-align:center;text-decoration:none;border:1px solid #93c5fd;border-radius:10px;padding:11px 10px;color:#1d4ed8;background:#eff6ff;font-size:13px;font-weight:800;margin:10px 0}

/* Actions salle — cohérentes avec le bouton principal */
.room-lobby #hostStart{background:#2563eb;border:1px solid #2563eb;border-radius:12px;color:white;font-size:14px;font-weight:850;cursor:pointer;box-shadow:0 5px 15px #2563eb27}
.room-lobby #copyRoom{background:#eaf2ff;border:1px solid #93c5fd;border-radius:12px;color:#1d4ed8;font-size:13px;font-weight:800;cursor:pointer}
.room-lobby #leaveRoom{background:#fff;border-radius:12px;cursor:pointer;font-weight:750}
.room-lobby button:disabled,.simple-setup button:disabled{opacity:.55;cursor:wait}

/* UX salle d'abord : pas de mode solo redondant */
.room-home,.join-panel{width:min(410px,calc(100% - 26px));padding:24px 24px 20px;max-height:calc(100dvh - 88px);overflow-y:auto;text-align:center}
.room-home-icon{font-size:37px;margin-bottom:8px}
.room-home h1,.join-panel h1{font-size:27px;line-height:1.15;margin:0 0 8px;color:#0f172a}
.room-home>p,.join-panel>p{font-size:13px;line-height:1.55;color:#64748b;margin:0 0 18px}
.room-home-actions{display:grid;gap:10px}
.room-home-actions button{display:flex;justify-content:center;align-items:center;gap:12px;width:100%;border:1px solid #b8d0fd;border-radius:14px;padding:14px 12px;min-height:53px;margin:0;background:#eef5ff;color:#1d4ed8;font-weight:850;font-size:15px;cursor:pointer}
.room-home-actions button:first-child{background:#2563eb;color:white;border-color:#2563eb;box-shadow:0 8px 18px #2563eb26}
.room-home-actions button span:first-child{font-size:20px;line-height:1}
.room-home .room-home-caption{font-size:11px;margin:17px 0 9px;color:#64748b}
.training-link{display:inline-block;color:#64748b;font-size:12px;text-decoration:underline;text-underline-offset:3px;margin-top:2px}
.room-back{border:0!important;box-shadow:none!important;background:transparent!important;color:#475569!important;padding:2px!important;margin:0 0 10px!important;min-height:28px!important;font-size:12px!important;float:left;text-align:left}
.room-back+h1{clear:both}
.simple-setup .room-create-form>label,.join-panel>label{display:block;margin:13px 0 5px;font-size:12px;text-align:left;font-weight:750;color:#334155}
.simple-setup .room-create-form input,.join-panel>input{display:block;width:100%;border-radius:10px;border:1px solid #bdcde2;min-height:43px;padding:10px;font-size:16px;color:#0f172a;background:white}
.simple-setup .room-create-form #roomCreate,.join-panel #roomJoin{width:100%;margin:14px 0 2px!important;background:#2563eb;color:white;min-height:47px;font-weight:850;border-radius:12px}
.join-panel{text-align:left}
.join-panel h1,.join-panel>p{text-align:left}
.join-panel .join-code{font-family:ui-monospace,Consolas,monospace;letter-spacing:.19em;font-size:25px;text-transform:uppercase;text-align:center;font-weight:900}
.room-code-display{background:#eef5ff;border:1px dashed #93c5fd;border-radius:17px;padding:15px 11px 11px;margin:13px 0}
.room-code-display h2{font-size:clamp(28px,7vw,42px);letter-spacing:.16em;margin:1px 0 0;color:#1d4ed8;font-family:ui-monospace,Consolas,monospace;user-select:all}
.room-code-kicker{font-weight:750;font-size:11px;letter-spacing:.09em;text-transform:uppercase;color:#64748b}
.lobby-buttons{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.lobby-buttons button{min-height:43px!important;padding:7px!important;font-size:12px!important;margin:0!important}
.room-players-title{text-align:left;font-weight:850;font-size:12px;margin:16px 0 3px;color:#334155}
@media(max-width:650px){.room-home,.join-panel{bottom:max(8px,env(safe-area-inset-bottom));padding:17px;max-height:calc(100dvh - 75px)}.room-home h1,.join-panel h1{font-size:23px}.room-home-actions button{min-height:49px}.room-code-display{margin:10px 0}}


/* Correctif visuel room-first : la carte reste plein écran, les panneaux flottent au-dessus */
.room-home,
.join-panel,
.simple-setup,
.room-lobby{
  position:absolute;
  z-index:620;
  top:84px;
  left:14px;
  bottom:auto;
  transform:none;
}
.room-home,
.join-panel,
.room-lobby{width:min(410px,calc(100% - 28px))}
.room-home,
.join-panel,
.simple-setup,
.room-lobby,
.hud,
.finish{
  background:rgba(255,255,255,.93);
  border:1px solid rgba(255,255,255,.78);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}
.room-home{
  padding:22px 22px 18px;
  box-shadow:0 18px 44px rgba(15,23,42,.18);
}
.room-home::after,
.join-panel::after,
.simple-setup::after,
.room-lobby::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius:18px;
  pointer-events:none;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.45);
}
.room-home-actions button{min-height:50px}
.room-home .training-link{margin-top:4px}
.join-panel,
.simple-setup,
.room-lobby{box-shadow:0 18px 44px rgba(15,23,42,.18)}
.room-lobby .room-code-display{background:rgba(239,245,255,.92)}
#map{min-height:0;height:100%}
@media (min-width: 900px){
  .room-home,
  .join-panel,
  .simple-setup,
  .room-lobby{max-width:390px}
}
@media (max-width: 650px){
  .room-home,
  .join-panel,
  .simple-setup,
  .room-lobby{
    top:66px;
    left:8px;
    width:min(360px,calc(100% - 16px));
    max-height:calc(100dvh - 82px);
  }
  .room-home{padding:16px 16px 14px}
  .room-home h1,.join-panel h1{font-size:22px}
}
