:root {
  --sol: #0e1116;
  --coque: #1a1f27;
  --ecran: #0b0d11;
  --carte: #171c24;
  --carte-haut: #202733;
  --trait: #2a3240;
  --texte: #e6e9ef;
  --doux: #8b95a7;
  --accent: #f2a33a;
  --accent-texte: #1a1205;
  --vert: #5fd38d;
  --rouge: #ff6b6b;
  --calme: #4a5466;
  --ombre-carte: 0 4px 12px rgba(0, 0, 0, 0.4);
  --ombre-grosse: 0 8px 24px rgba(0, 0, 0, 0.45);
  --ombre-touche: 0 3px 0 #0a0d12;
  --ombre-touche-bas: 0 1px 0 #0a0d12;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --titre: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--sol);
  color: var(--texte);
  font-family: var(--titre);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, p { margin: 0; }
button { font: inherit; }
[hidden] { display: none !important; }

.vue { display: flex; flex-direction: column; height: 100%; }

/* Écran 1 : accès */
#v-acces {
  justify-content: center;
  gap: 16px;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}
#v-acces h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; text-align: center; margin-bottom: 8px; }
button.principal {
  min-height: 50px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-texte);
  font: 800 16px var(--titre);
  box-shadow: var(--ombre-grosse);
  cursor: pointer;
}
button.principal:active { transform: translateY(1px); }
#inscription {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: 14px;
  padding: 4px 14px 14px;
  box-shadow: var(--ombre-carte);
}
#inscription summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--doux);
  font-weight: 600;
  cursor: pointer;
}
#inscription label { display: block; margin: 8px 0 6px; color: var(--doux); font-size: 12px; line-height: 1.4; }
#inscription label code { font-family: var(--mono); color: var(--texte); }
#inscription input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--trait);
  border-radius: 10px;
  background: var(--ecran);
  color: var(--texte);
  /* 16px minimum : en dessous, Safari iOS zoome la page au focus et le zoom reste collé. */
  font: 16px var(--mono);
}
#inscription input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#b-inscrire {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px solid var(--trait);
  border-radius: 10px;
  background: var(--carte-haut);
  color: var(--texte);
  font-weight: 700;
  cursor: pointer;
}
#acces-message { min-height: 1.2em; color: var(--doux); font-size: 13px; text-align: center; }

/* Écran 2 : liste des sessions */
.entete {
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--trait);
  background: var(--sol);
}
.entete h2 { font-size: 24px; font-weight: 800; }
.entete p#resume { margin-top: 2px; color: var(--doux); font-size: 12px; font-weight: 500; }
.liste {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.groupe {
  padding: 8px 4px 0;
  color: var(--doux);
  font: 700 10.5px var(--titre);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
button.sess {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--trait);
  border-radius: 14px;
  background: var(--carte);
  box-shadow: var(--ombre-carte);
  color: var(--texte);
  text-align: left;
  cursor: pointer;
}
button.sess:active { transform: scale(0.98); }
.pt { width: 10px; height: 10px; border-radius: 50%; background: var(--calme); }
.pt.travaille { background: var(--vert); }
.pt.calme { background: var(--calme); }
.corps { min-width: 0; display: flex; flex-direction: column; }
.corps .nom {
  font: 600 14px var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.corps .titre {
  margin-top: 2px;
  color: var(--doux);
  font: 500 12px var(--titre);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quand { color: var(--doux); font: 500 11px var(--titre); white-space: nowrap; text-align: right; }

/* Écran 2b : terminal */
#v-terminal { background: var(--ecran); }
.bandeau {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: calc(6px + env(safe-area-inset-top)) 8px 6px;
  border-bottom: 1px solid var(--trait);
  background: var(--coque);
}
.retour {
  min-height: 44px;
  padding: 0 8px;
  border: none;
  background: none;
  color: var(--accent);
  font: 600 15px var(--titre);
  cursor: pointer;
}
.bandeau .nom {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 13px var(--mono);
}
#v-terminal .term { flex: 1; min-height: 0; overflow: hidden; background: var(--ecran); }
.term .xterm { height: 100%; padding: 4px 6px; }
.term-message {
  margin: 0;
  padding: 6px 12px;
  border-top: 1px solid var(--trait);
  background: var(--coque);
  color: var(--doux);
  font: 500 12px var(--titre);
}
.saisie {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--trait);
  background: var(--coque);
}
.saisie textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 96px;
  resize: none;
  padding: 10px 12px;
  border: 1px solid var(--trait);
  border-radius: 12px;
  background: var(--ecran);
  color: var(--texte);
  /* 16px minimum : en dessous, Safari iOS zoome la page au focus et le zoom reste collé. */
  font: 16px var(--mono);
  line-height: 1.3;
}
.saisie textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.envoyer {
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-texte);
  font: 800 13px var(--titre);
  cursor: pointer;
}
.envoyer:active { transform: translateY(1px); }
.touches {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: var(--coque);
}
.touches button {
  min-height: 44px;
  border: 1px solid var(--trait);
  border-radius: 9px;
  background: var(--carte-haut);
  color: var(--texte);
  font: 600 13px var(--mono);
  box-shadow: var(--ombre-touche);
  cursor: pointer;
}
.touches button:active { transform: translateY(2px); box-shadow: var(--ombre-touche-bas); }
.touches .chiffre { color: var(--accent); }
.touches .danger { color: var(--rouge); }
