/* L'écran : 192 × 360 pixels sur téléphone, 384 × 216 sur ordinateur, agrandis sans flou sur une
   page noire. jeu.js choisit la mise en page, règle la taille de la borne et `--e`, le nombre de
   pixels de la page par pixel du jeu, et place les vrais boutons et champs sur ceux qu'il dessine. */

:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: #000;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.borne {
  --e: 2;
  position: relative;
  /* Avant que jeu.js ne la mesure : la mise en page téléphone, aussi grande que possible. */
  height: min(100dvh, calc(100vw * 360 / 192));
  aspect-ratio: 192 / 360;
}

#ecran {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

/* Les vrais boutons, invisibles, posés exactement sur les boutons dessinés dans l'écran. */
.bouton-cache {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  opacity: 0;
  cursor: pointer;
}

.bouton-cache:disabled {
  cursor: default;
}

.bouton-cache:focus-visible {
  opacity: 1;
  color: transparent;
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* ---------- La page d'arrivée ---------- */

#inscription {
  display: contents;
}

#inscription[hidden] {
  display: none;
}

#adresse {
  position: absolute;
  margin: 0;
  padding: 0 calc(var(--e) * 5px);
  border: calc(var(--e) * 1px) solid #fff;
  border-radius: 0;
  background: #000;
  color: #fff;
  caret-color: #ff3232;
  /* 16 px au moins : en dessous, l'iPhone zoome sur le champ. */
  font: 700 max(16px, calc(var(--e) * 8px)) / 1 ui-monospace, Menlo, monospace;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: text;
  user-select: text;
}

#adresse::placeholder {
  color: #6a6a6a;
}

#adresse:focus {
  border-color: #ff3232;
}

#adresse:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px #000 inset;
  -webkit-text-fill-color: #fff;
}

/* Centrée sur la colonne du jeu : dans une petite fenêtre, son texte garde une taille lisible. */
#nouvelles {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--e) * 3px);
  color: #9c9c9c;
  font: 700 max(11px, calc(var(--e) * 5.5px)) / 1 ui-monospace, Menlo, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

#nouvelles input {
  flex: none;
  width: max(14px, calc(var(--e) * 7px));
  height: max(14px, calc(var(--e) * 7px));
  margin: 0;
  accent-color: #e70000;
  cursor: pointer;
}

/* Juste dessous : la page qui dit ce que devient l'adresse. */
#infos {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  padding: 0 calc(var(--e) * 3px);
  color: #8a8a8a;
  font: 700 max(10px, calc(var(--e) * 4.5px)) / 1 ui-monospace, Menlo, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  white-space: nowrap;
}

#infos:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.lecteur-ecran {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Dans le coin, pour ne pas cacher le titre. */
.barre-essai {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid #ffdd00;
  background: rgba(0, 0, 0, 0.85);
  color: #ffdd00;
  font: 700 10px/1 ui-monospace, Menlo, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.barre-essai[hidden] {
  display: none;
}

.barre-essai span {
  padding: 0 6px;
}

.barre-essai button {
  padding: 6px 8px;
  border: 0;
  background: none;
  color: #c2c2c2;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.barre-essai button[aria-pressed="true"] {
  background: #ffdd00;
  color: #000;
}

.sans-js {
  color: #fff;
  font: 14px/1.4 ui-monospace, Menlo, monospace;
  text-align: center;
}
