/* Habillage. Tout ce qui se voit DANS le plateau est dessiné au canevas (rendu.js) ; cette
   feuille ne s'occupe que de ce qui l'entoure — l'en-tête, les voiles de menu, les compteurs.

   Aucune police n'est chargée depuis un tiers : une police Google coûterait une résolution DNS,
   une connexion TLS et une entrée dans la politique de sécurité du site pour un gain esthétique
   qui, sur un jeu monospace, est à peu près nul. */

:root {
  --fond: #0d0a1c;
  --fond-clair: #171232;
  --bord: #4a3f7a;
  --texte: #e8e4ff;
  --doux: #9a92cf;
  --accent: #ffd666;
  --danger: #ff5d7a;
  --police: "Courier New", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: radial-gradient(circle at 50% 0%, #1d1740 0%, var(--fond) 60%);
  color: var(--texte);
  font-family: var(--police);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

#cadre {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
}

#entete {
  width: 100%; max-width: 900px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
#entete h1 {
  margin: 0; font-size: 20px; letter-spacing: 3px; font-weight: bold;
  text-shadow: 0 0 12px rgba(167,113,224,0.7);
}
#entete h1 span { color: var(--accent); }

#outils { display: flex; gap: 6px; flex-wrap: wrap; }
.outil {
  font-family: var(--police); font-size: 12px;
  background: var(--fond-clair); color: var(--doux);
  border: 1px solid var(--bord); border-radius: 6px;
  padding: 5px 9px; cursor: pointer;
}
.outil:hover { color: var(--texte); border-color: var(--accent); }
.outil[aria-pressed="false"] { opacity: 0.45; text-decoration: line-through; }

#scene { display: flex; justify-content: center; width: 100%; }
canvas { display: block; touch-action: none; image-rendering: auto; }

#tactile { display: none; }
#btn-pousser {
  font-family: var(--police); font-size: 15px; letter-spacing: 2px;
  background: var(--fond-clair); color: var(--texte);
  border: 2px solid var(--bord); border-radius: 10px; padding: 14px 40px;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
#btn-pousser:active { background: var(--bord); }

#commandes {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
  font-size: 11px; color: var(--doux);
}
#commandes b { color: var(--texte); }
#commandes .tact { display: none; }

/* --------------------------------------------------------------------------- voiles */
.voile {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(6, 4, 16, 0.92);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
}
.voile.cache { display: none; }

.panneau {
  width: 100%; max-width: 460px;
  background: linear-gradient(180deg, #1a1440, #120e2b);
  border: 2px solid var(--bord); border-radius: 12px;
  padding: 20px; box-shadow: 0 0 40px rgba(90, 60, 180, 0.35);
}
.panneau.court { max-width: 340px; text-align: center; }
.panneau h2 {
  margin: 0 0 6px; font-size: 22px; letter-spacing: 4px; text-align: center;
  text-shadow: 0 0 14px rgba(167,113,224,0.8);
}
.panneau h3 { margin: 18px 0 8px; font-size: 12px; letter-spacing: 2px; color: var(--doux); }
.panneau h3 b { color: var(--accent); }
.sous-titre { margin: 0 0 4px; font-size: 12px; line-height: 1.5; color: var(--doux); text-align: center; }
.note { font-size: 11px; color: var(--doux); margin: 6px 0 0; }

.choix { display: flex; flex-direction: column; gap: 6px; }
#choix-difficulte { flex-direction: row; }
#choix-difficulte button { flex: 1; text-align: center; }
.choix button {
  font-family: var(--police); font-size: 14px; text-align: left;
  background: #221a4a; color: var(--texte);
  border: 1px solid var(--bord); border-radius: 8px; padding: 9px 12px; cursor: pointer;
}
.choix button small { display: block; font-size: 11px; color: var(--doux); margin-top: 2px; }
.choix button.actif { border-color: var(--accent); background: #33256b; box-shadow: 0 0 12px rgba(255,214,102,0.25); }

input[type=range] { width: 100%; accent-color: var(--accent); }

.principal, .secondaire {
  font-family: var(--police); width: 100%; margin-top: 14px; cursor: pointer;
  border-radius: 8px; padding: 12px; letter-spacing: 3px; font-size: 15px;
}
.principal { background: var(--accent); color: #2a1d00; border: none; font-weight: bold; }
.principal:hover { background: #ffe28f; }
.secondaire { background: transparent; color: var(--doux); border: 1px solid var(--bord); font-size: 12px; }
.secondaire:hover { color: var(--texte); }

#records { margin-top: 14px; font-size: 12px; color: var(--doux); }
#records div { display: flex; justify-content: space-between; padding: 2px 0; }
#records b { color: var(--accent); }

details { margin-top: 16px; font-size: 12px; color: var(--doux); }
summary { cursor: pointer; color: var(--texte); }
details ul { padding-left: 18px; line-height: 1.6; }
details b { color: var(--texte); }

#bilan { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; margin: 14px 0 0; }
#bilan dt { color: var(--doux); text-align: left; }
#bilan dd { margin: 0; text-align: right; color: var(--texte); }
#record { color: var(--accent); font-size: 13px; margin: 10px 0 0; }
#titre-fin.victoire { color: #7dffa8; }
#titre-fin.defaite { color: var(--danger); }

/* Écrans tactiles : le bouton « pousser » n'a pas d'équivalent au doigt, contrairement à
   l'échange qui se fait par glissement. */
@media (pointer: coarse) {
  #tactile { display: flex; justify-content: center; }
  #commandes .tact { display: inline; }
  #commandes span:not(.tact) { display: none; }
}
