

.esc-jeu {
  width: 100%;
  
  max-width: min(520px, calc((100vh - 64px - var(--esc-reserve, 0px) - var(--esc-tactile, 0px)) * 3 / 4));
  margin: 0 auto;
  font-family: 'Inter', sans-serif;
  color: #e6edf5;
}
@supports (height: 100dvh) {
  .esc-jeu { max-width: min(520px, calc((100dvh - 64px - var(--esc-reserve, 0px) - var(--esc-tactile, 0px)) * 3 / 4)); }
}


.esc-barre {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
}
.esc-barre-titre { font-weight: 800; color: #f2c14e; letter-spacing: 0.03em; }
.esc-barre-outils { display: flex; gap: 8px; align-items: center; }
.esc-outil {
  min-width: 38px;
  min-height: 34px;
  padding: 2px 10px;
  background: none;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  color: #dbe4ee;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.esc-outil:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.45); }
.esc-outil[hidden] { display: none; }
.esc-outil-arret { border-color: rgba(242, 182, 50, 0.6); color: #f7d27a; }
@media (pointer: coarse) {
  .esc-outil { min-width: 46px; min-height: 42px; font-size: 1.05rem; }
}


.esc-cadre {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #2a4a66;
  background: #8ec5d0;
}
#ecran {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  image-rendering: pixelated;
  user-select: none;
  -webkit-user-select: none;
}


.esc-tactile {
  display: none;
  gap: 12px;
  justify-content: space-between;
  margin-top: 10px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.esc-tactile-btn {
  flex: 1;
  min-height: 58px;
  border-radius: 14px;
  border: 2px solid #7fd3f0;
  background: #143049;
  color: #bfeaff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.esc-tactile-btn.radio { border-color: #f2b632; color: #ffe2a0; background: #3a2c10; }
.esc-tactile-btn.actif { filter: brightness(1.6); }

.esc-tactile-btn.j2 { display: none; }
.esc-jeu.mode-duo .esc-tactile-btn.j2 { display: block; }
.esc-jeu.mode-duo .esc-tactile-btn { font-size: 0.9rem; }
@media (pointer: coarse) {
  .esc-tactile { display: flex; }
  .esc-jeu { --esc-tactile: 70px; }
}
.esc-jeu.mode-tactile { --esc-tactile: 70px; }
.esc-jeu.mode-tactile .esc-tactile { display: flex; }


.esc-voile {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: rgba(10, 22, 36, 0.9);
  overflow: auto;
}
.esc-voile[hidden] { display: none; }
.esc-carte {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 100%;
  overflow-y: auto;
  padding: 16px 18px;
  text-align: center;
  background: #12273b;
  border: 1px solid rgba(242, 182, 50, 0.45);
  border-radius: 12px;
}
.esc-carte h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 800;
  color: #f2c14e;
}
.esc-carte p { margin: 0 0 6px; color: #d3dde8; line-height: 1.45; font-size: 0.9rem; }
.esc-carte p.esc-discret { color: #9fb1c4; font-size: 0.84rem; }
.esc-carte kbd {
  display: inline-block;
  padding: 0 5px;
  margin: 0 1px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.82em;
  background: rgba(255, 255, 255, 0.06);
}
.esc-record strong, .esc-statut strong { color: #ffe08a; }
.esc-message { min-height: 1.2em; color: #ffd36b; font-size: 0.85rem; }
.esc-message:empty { display: none; }


.esc-avions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 8px 0 10px;
  padding: 0;
  border: 0;
}
.esc-avions legend { padding: 0; margin: 0 auto 6px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #9fb1c4; }
.esc-avion {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.esc-avion input { position: absolute; opacity: 0; pointer-events: none; }
.esc-avion:has(input:checked) { border-color: #f2b632; background: rgba(242, 182, 50, 0.16); }
.esc-avion:has(input:focus-visible) { outline: 2px solid #7fd3f0; outline-offset: 2px; }
.esc-avion-image {
  width: 64px;
  height: 64px;
  background: url('../images/avions.png') no-repeat;
  background-size: 256px 384px;
  image-rendering: pixelated;
}
.esc-avion-image.av-0 { background-position: 0 -64px; }
.esc-avion-image.av-1 { background-position: -64px -64px; }
.esc-avion-image.av-2 { background-position: -192px -64px; }
.esc-avion-nom { font-weight: 800; font-size: 0.9rem; color: #fff; }
.esc-avion-stats { font-size: 0.72rem; color: #bcd0e2; line-height: 1.3; }
.esc-avion-desc { display: none; }
@media (min-width: 900px) and (pointer: fine) {
  .esc-avion-desc { display: block; font-size: 0.7rem; color: #8ea3b8; line-height: 1.3; margin-top: 2px; }
}

.esc-score-final {
  margin: 6px 0 2px !important;
  font-size: 2rem !important;
  font-weight: 900;
  color: #f2c14e !important;
  font-variant-numeric: tabular-nums;
}
.esc-score-final small { font-size: 0.9rem; font-weight: 600; color: #9fb1c4; }


.esc-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin: 4px 0 8px !important; }
.esc-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.78rem;
  color: #c9d6e3;
  white-space: nowrap;
}


.esc-etoiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 0 8px !important; font-size: 0.82rem; color: #9fb1c4; }
.esc-etoiles[hidden] { display: none; }
.esc-etoile { color: #6f7f91; font-size: 1rem; }
.esc-etoile.ok { color: #ffd23f; }
.esc-objectifs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin: 0 0 8px; font-size: 0.78rem; color: #9fb1c4; }
.esc-objectifs-total { flex-basis: 100%; }
.esc-objectifs-total strong { color: #ffe08a; }
.esc-objectifs-mission { white-space: nowrap; }
.esc-carte p.esc-avertissement { font-size: 0.76rem; color: #f2c47a; margin: 0 0 6px; }


.esc-mission-seule { margin-top: 10px; font-size: 0.85rem; color: #c9d6e3; }
.esc-mission-seule > label { display: block; margin-bottom: 4px; font-weight: 700; color: #ffe2a0; font-size: 0.8rem; }
.esc-mission-seule-choix { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; align-items: center; }
.esc-statut { min-height: 1.4em; font-size: 0.9rem !important; }
.esc-statut:empty { display: none; }
.esc-statut.attente { color: #9fb1c4; }
.esc-statut.ok { color: #c4f5c4; }
.esc-statut.erreur { color: #ffb0a0; }
.esc-statut a, .esc-lien-compte { color: #8fdcff; font-weight: 700; }

.esc-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.esc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid #f2b632;
  border-radius: 10px;
  background: #d9961a;
  color: #1a1206;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.esc-btn:hover { background: #eaa92a; }
.esc-btn:disabled { opacity: 0.55; cursor: wait; }
.esc-btn.secondaire { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.22); color: #e6edf5; }
.esc-btn.secondaire:hover { background: rgba(255, 255, 255, 0.14); }
.esc-btn[hidden] { display: none; }

.esc-fermer {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: #9fb1c4;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.esc-fermer:hover { color: #fff; }
.esc-retour-resultat {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 8;
  transform: translateX(-50%);
}


.esc-entrainement {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.esc-entrainement summary {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #8fdcff;
  cursor: pointer;
}
.esc-entrainement[open] summary { margin-bottom: 6px; }
.esc-entrainement > .esc-btn { margin-top: 8px; }
.esc-entrainement-choix, .esc-entrainement-duo { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: 0.85rem; color: #c9d6e3; }
.esc-entrainement-choix label, .esc-entrainement-duo label { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: 0.74rem; color: #9fb1c4; }
.esc-entrainement-duo { margin-top: 6px; flex-direction: column; }
.esc-entrainement-duo[hidden] { display: none; }
.esc-entrainement-duo p { margin: 0 !important; font-size: 0.76rem !important; }
.esc-entrainement-choix select, .esc-entrainement-duo select, .esc-mission-seule select {
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: #0b1a28;
  color: #e6edf5;
  font-family: inherit;
  font-size: 0.88rem;
}
.esc-case { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; cursor: pointer; font-size: 0.88rem; color: #d3dde8; }
.esc-case input { width: 18px; height: 18px; }


.esc-tactile-seul { display: none; }
@media (pointer: coarse) {
  .esc-clavier-seul { display: none !important; }
  .esc-tactile-seul { display: block; }
}
.esc-jeu.mode-tactile .esc-clavier-seul { display: none !important; }
.esc-jeu.mode-tactile .esc-tactile-seul { display: block; }


.esc-carte #cta-defi-du-jour { margin: 8px 0; padding: 10px; }
.esc-carte .cta-ddj-btn { border-radius: 8px; font-weight: 700; }
.esc-carte .partage-score { margin-top: 6px; }


@media (max-width: 720px), (pointer: coarse) {
  .esc-voile {
    position: fixed;
    z-index: 1000;
    padding: 10px;
  }
  .esc-carte {
    max-width: 420px;
    max-height: calc(100vh - 20px);
    padding: 14px 14px;
  }
  .esc-carte h2 { font-size: 1.2rem; }
  .esc-score-final { font-size: 1.6rem !important; }
}
@supports (height: 100dvh) {
  @media (max-width: 720px), (pointer: coarse) {
    .esc-carte { max-height: calc(100dvh - 20px); }
  }
}


@media (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {
  html body.page-escadrille { --esc-reserve: 0px; }
  .esc-jeu, .esc-jeu.mode-tactile { --esc-tactile: 0px; }
  .esc-jeu { max-width: min(520px, calc((100vh - 56px) * 3 / 4)); }
  .esc-barre { padding: 2px; }
  .esc-tactile {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 14px;
    z-index: 20;
    margin: 0;
    padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    pointer-events: none;
  }
  .esc-tactile-btn { flex: 0 0 auto; width: min(22vw, 150px); min-height: 110px; pointer-events: auto; }
  .esc-jeu.mode-duo .esc-tactile-btn { width: min(11vw, 90px); }
  body.esc-en-partie .auth-nav { display: none !important; }
  .esc-voile { padding-top: 66px; }
  .esc-carte { max-height: calc(100vh - 76px); }
}
@supports (height: 100dvh) {
  @media (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {
    .esc-jeu { max-width: min(520px, calc((100dvh - 56px) * 3 / 4)); }
    .esc-carte { max-height: calc(100dvh - 76px); }
  }
}


.esc-jeu:fullscreen {
  max-width: none;
  width: 100vw;
  height: 100vh;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #0b1a28;
}
.esc-jeu:fullscreen .esc-barre,
.esc-jeu:fullscreen .esc-cadre,
.esc-jeu:fullscreen .esc-tactile {
  width: 100%;
  max-width: calc((100vh - 60px - var(--esc-tactile, 0px)) * 3 / 4);
}
.esc-jeu:fullscreen .esc-voile { position: absolute; }
