/* Cartogether — cohérence PC V1
   Un seul gabarit de 1128px : en-tête clair, zone de jeu arrondie,
   panneau à gauche et carte à droite. Les règles sont DESKTOP ONLY.
   Ne modifie ni Leaflet, ni le gameplay, ni les styles mobiles. */
.ct-desktop-nav { display:none; }

@media (min-width: 900px) and (min-height: 560px) {
  :root { --ct-navy:#102840; --ct-blue:#2563eb; --ct-mint:#62e1c5; }
  body.ct-screen { background:#f5f8fc; color:#172b45; }

  /* Accueil : même hauteur et dimensions de zone de jeu que les pages carte. */
  .ct-screen-home .site-shell { max-width:1200px; padding:0 36px; }
  .ct-screen-home .site-header { height:76px;flex-basis:76px; }
  .ct-screen-home .site-shell>main { padding:12px 0 0; }
  .ct-screen-home .hero {
    min-height:0; height:min(740px,calc(100dvh - 104px)); max-height:none;
    border-radius:24px; grid-template-columns:46% 54%;
    box-shadow:0 20px 55px rgba(20,45,70,.15);
  }
  .ct-screen-home .hero-copy { padding:32px 12px 32px 40px; }
  .ct-screen-home .hero h1 { font-size:clamp(35px,3.7vw,52px); }
  .ct-screen-home .hero-description { max-width:380px; }
  .ct-screen-home .hero-visual { min-height:0; height:100%; }
  .ct-screen-home .world-map { width:850px; top:50%; left:48%; transform:translate(-50%,-50%); }
  .ct-screen-home .note-bottom { left:34px; bottom:46px; }
  .ct-screen-home .site-footer { display:none; }

  /* Socle partagé pour Défi du jour / Entre amis. */
  .ct-screen-daily, .ct-screen-friends {
    --ct-frame-width:min(1128px,calc(100vw - 72px));
    --ct-frame-left:calc((100vw - var(--ct-frame-width)) / 2);
    --ct-frame-top:88px;
    --ct-frame-height:min(740px,calc(100dvh - 104px));
    --ct-sidebar-width:clamp(370px,38vw,450px);
  }
  .ct-screen-daily .daily-app, .ct-screen-friends .game {
    height:100dvh; min-height:0; position:relative; overflow:hidden;
    display:block; background:#f5f8fc;
  }
  .ct-screen-daily .daily-app::before, .ct-screen-friends .game::before {
    content:""; position:absolute; top:var(--ct-frame-top); left:var(--ct-frame-left);
    width:var(--ct-frame-width);height:var(--ct-frame-height);border-radius:24px;
    background:linear-gradient(145deg,#10283f 0%,#143958 100%);
    box-shadow:0 22px 55px rgba(20,45,70,.16);
    pointer-events:none; z-index:0;
  }
  /* Un même en-tête clair, logo à gauche et liens alignés à droite. */
  .ct-screen-daily .daily-topbar, .ct-screen-friends .topbar {
    position:relative;z-index:720;height:76px;min-height:76px;padding:0 max(36px,calc((100vw - 1128px)/2));
    display:flex;align-items:center;gap:14px;
    background:#f5f8fc;color:#172b45;box-shadow:none;
  }
  .ct-screen-daily .daily-home, .ct-screen-friends .home-link {
    display:inline-flex;align-items:center;gap:10px;padding:0;
    font-size:17px;font-weight:800;color:#14283f;text-decoration:none;
    background:transparent;border:0;white-space:nowrap;
  }
  .ct-screen-daily .daily-home img, .ct-screen-friends .home-link .ct-logo {
    width:43px;height:43px;max-width:none;border-radius:11px;box-shadow:0 5px 13px rgba(17,44,67,.13);
  }
  .ct-screen-daily .daily-top-title, .ct-screen-friends .title {
    min-width:0;flex:1;display:flex;flex-direction:column;gap:1px;
    margin:0;padding:0 0 0 16px;border-left:1px solid #dce6f0;
  }
  .ct-screen-daily .daily-top-title strong, .ct-screen-friends .title strong {font-size:13px;line-height:1.3;color:#304e71;font-weight:800}
  .ct-screen-daily .daily-top-title small, .ct-screen-friends .title small {font-size:11px;color:#8b9aae;margin-top:0}
  .ct-screen-daily .ct-desktop-nav, .ct-screen-friends .ct-desktop-nav {display:flex;align-items:center;gap:6px;flex:0 0 auto}
  .ct-desktop-nav a {color:#36587f;text-decoration:none;font-weight:800;font-size:12px;border-radius:11px;padding:10px 12px;white-space:nowrap}
  .ct-desktop-nav a:hover {background:#e5eef8;color:#153a68}
  .ct-screen-daily #lang, .ct-screen-friends #lang {
    box-sizing:border-box;min-width:80px;width:80px;max-width:80px;flex:0 0 80px;
    background:#fff;color:#365371;border:1px solid #dce5f0;
    border-radius:12px;padding:11px 6px;font-size:11px;font-weight:800;
  }
  /* Cartes vivantes : cadre fixe à droite, sans masque sur les contrôles Leaflet. */
  .ct-screen-daily .daily-map, .ct-screen-friends #map {
    display:block;position:absolute;flex:none;z-index:1;
    top:var(--ct-frame-top);left:calc(var(--ct-frame-left) + var(--ct-sidebar-width));
    width:calc(var(--ct-frame-width) - var(--ct-sidebar-width));
    height:var(--ct-frame-height);min-height:0;max-height:none;
    border-radius:0 24px 24px 0;overflow:hidden;
    box-shadow:inset 1px 0 0 rgba(255,255,255,.08);
  }
  .ct-screen-daily .daily-map .leaflet-control-container, .ct-screen-friends #map .leaflet-control-container {z-index:400}

  /* Colonne de commandes : carte claire sur fond marine, même espacement. */
  .ct-screen-daily .daily-panel,
  .ct-screen-friends .room-home, .ct-screen-friends .join-panel,
  .ct-screen-friends .simple-setup, .ct-screen-friends .room-lobby,
  .ct-screen-friends .hud, .ct-screen-friends .finish {
    box-sizing:border-box;position:absolute;z-index:630;
    left:calc(var(--ct-frame-left) + 16px);top:calc(var(--ct-frame-top) + 16px);
    bottom:auto;right:auto;transform:none;
    width:calc(var(--ct-sidebar-width) - 32px);max-width:none;
    height:auto;max-height:calc(var(--ct-frame-height) - 32px);
    padding:20px 19px;border-radius:18px;
    border:1px solid rgba(230,238,245,.95);background:#fffffffa;
    box-shadow:0 16px 34px rgba(5,18,38,.23);
    overflow-x:hidden;overflow-y:auto;scrollbar-width:thin;
    backdrop-filter:none;-webkit-backdrop-filter:none;
  }
  .ct-screen-daily #dailyPanel {width:calc(var(--ct-sidebar-width) - 32px);max-width:none;left:calc(var(--ct-frame-left) + 16px);top:calc(var(--ct-frame-top) + 16px)}
  .ct-screen-daily .daily-panel {font-size:14px}
  .ct-screen-daily .dash-board .dash-heading h1 {font-size:24px}
  .ct-screen-daily .dash-board .dash-heading p {font-size:12px}
  .ct-screen-daily .dash-board .dash-summary {padding:14px 15px}
  .ct-screen-daily .dash-board .dash-score strong {font-size:28px}
  .ct-screen-daily .dash-board .dash-grid {gap:9px}
  .ct-screen-daily .dash-board .dash-card {min-height:132px;padding:11px}
  .ct-screen-daily .dash-board .dash-card-score {font-size:14px}

  /* Sur la page de résultat, aligner également le bilan à gauche. */
  .ct-screen-daily .daily-finish.daily-finish-simple {
    top:calc(var(--ct-frame-top) + 16px);left:calc(var(--ct-frame-left) + 16px);
    right:auto;bottom:auto;transform:none;
    width:calc(var(--ct-sidebar-width) - 32px);max-height:calc(var(--ct-frame-height) - 32px);
    border-radius:18px;padding:24px 19px;
  }
  /* L'accueil entre amis suit la hiérarchie de notre tableau de bord. */
  .ct-screen-friends .room-home {text-align:left;padding:26px 24px 24px}
  .ct-screen-friends .room-home-icon {display:grid;place-items:center;width:51px;height:51px;margin:0 0 16px;background:#e5f6f2;border-radius:15px;font-size:27px}
  .ct-screen-friends .room-home h1 {font-size:26px;letter-spacing:-.035em;line-height:1.13;margin:0 0 11px}
  .ct-screen-friends .room-home>p {font-size:13px;line-height:1.55;text-align:left}
  .ct-screen-friends .room-home-actions {gap:10px;margin-top:21px}
  .ct-screen-friends .room-home-actions button {justify-content:center;min-height:51px;border-radius:12px}
  .ct-screen-friends .room-home .training-link {margin-top:12px}
  .ct-screen-friends .join-panel,.ct-screen-friends .simple-setup,.ct-screen-friends .room-lobby {padding:21px 19px}
  .ct-screen-friends .finish {overflow-y:auto}
  .ct-screen-friends .room-home::after,.ct-screen-friends .join-panel::after,.ct-screen-friends .simple-setup::after,.ct-screen-friends .room-lobby::after {display:none}
  .ct-screen-friends .setup {bottom:auto}

  .ct-screen a:focus-visible,.ct-screen button:focus-visible,.ct-screen select:focus-visible {
    outline:3px solid #48c9b1;outline-offset:3px;
  }
}
/* Laisser l'ancienne version inchangée sur tablettes et téléphones. */
@media (min-width:900px) and (min-height:560px) and (max-height:600px) {
  .ct-screen-daily, .ct-screen-friends {--ct-frame-top:81px;--ct-frame-height:calc(100dvh - 96px)}
  .ct-screen-home .hero {height:calc(100dvh - 96px)}
}
@media (min-width:900px) and (max-width:1070px) {
  .ct-screen-daily .daily-top-title,.ct-screen-friends .title {padding-left:10px}
  .ct-screen-daily .daily-topbar,.ct-screen-friends .topbar {padding:0 36px}
  .ct-desktop-nav a {padding:9px 7px;font-size:11px}
}


/* V1.1 — Une fois la partie lancée, la carte retrouve toute la fenêtre PC.
   L'accueil et le choix des défis gardent le cadre unifié ; mobile inchangé.
   La classe est activée uniquement pendant la partie et sur le résultat. */
@media (min-width: 900px) and (min-height: 560px) {
  .ct-screen-daily.ct-daily-immersive .daily-app::before {
    display: none;
  }
  .ct-screen-daily.ct-daily-immersive .daily-map {
    top: 76px;
    left: 0;
    width: 100vw;
    height: calc(100dvh - 76px);
    border-radius: 0;
    box-shadow: none;
  }
  .ct-screen-daily.ct-daily-immersive #dailyPanel {
    left: clamp(18px, 2.7vw, 52px);
    top: 98px;
    width: min(405px, calc(100vw - 36px));
    max-height: calc(100dvh - 116px);
    border-radius: 19px;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
  }
  .ct-screen-daily.ct-daily-immersive .daily-finish.daily-finish-simple {
    left: clamp(18px, 2.7vw, 52px);
    top: 98px;
    bottom: auto;
    right: auto;
    transform: none;
    width: min(405px, calc(100vw - 36px));
    max-height: calc(100dvh - 116px);
    border-radius: 19px;
    background: rgba(255, 255, 255, .97);
    padding: 24px 20px 20px;
  }
}


/* V1.2 — Défi multijoueur : immersion PC dès le début d'une partie.
   Les menus de création / connexion et le salon restent dans le gabarit centré.
   La carte prend tout l'écran sous l'entête pendant le jeu et au résultat.
   Version mobile inchangée. */
@media (min-width: 900px) and (min-height: 560px) {
  .ct-screen-friends.ct-friends-immersive .game::before {
    display: none;
  }
  .ct-screen-friends.ct-friends-immersive #map {
    top: 76px;
    left: 0;
    right: 0;
    width: 100vw;
    height: calc(100dvh - 76px);
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
  .ct-screen-friends.ct-friends-immersive #hud,
  .ct-screen-friends.ct-friends-immersive #finish {
    left: clamp(18px, 2.7vw, 52px);
    top: 98px;
    right: auto;
    bottom: auto;
    transform: none;
    width: min(405px, calc(100vw - 36px));
    height: auto;
    max-height: calc(100dvh - 116px);
    padding: 20px;
    border-radius: 19px;
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    overflow-y: auto;
  }
}
