/* Police pixel hébergée sur le site (OFL), sans appel à Google Fonts */
@font-face {
  font-family: "Press Start 2P";
  src: url("fonts/PressStart2P-latin.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Press Start 2P";
  src: url("fonts/PressStart2P-latin-ext.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+A720-A7FF;
}

:root {
  --fond: #14152a;
  --fond-2: #1d1f3d;
  --cadre: #2c2f5c;
  --bleu: #3b5dc9;
  --rouge: #c23b4a;
  --texte: #e9ecf5;
  --doux: #a9afcf;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at top, var(--fond-2), var(--fond) 70%);
  background-color: var(--fond);
  color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

.console {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 100%;
}

.titre {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  letter-spacing: 1px;
  color: #8fd3ff;
  text-shadow: 2px 2px 0 var(--rouge);
  text-align: center;
}
.titre span {
  display: block;
  margin-top: 8px;
  font-size: 9px;
  color: var(--doux);
  text-shadow: none;
}

.ecran-cadre {
  padding: 10px;
  background: #0b0b14;
  border-radius: 14px;
  box-shadow: 0 0 0 2px var(--cadre), 0 24px 60px rgba(0, 0, 0, .55);
  max-width: 100%;
}

canvas {
  display: block;
  width: 480px;
  height: 320px;
  max-width: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 4px;
  touch-action: none;
}

.aide {
  margin: 0;
  font-size: 13px;
  line-height: 2;
  color: var(--doux);
  text-align: center;
}
kbd {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--cadre);
  color: var(--texte);
  font: 12px/1.6 ui-monospace, monospace;
}
.son {
  font: inherit;
  color: var(--texte);
  background: var(--cadre);
  border: 0;
  border-radius: 6px;
  padding: 2px 10px;
  cursor: pointer;
}
.son:hover { background: var(--bleu); }

/* Poster plein écran (capture d'un site) */
.affiche {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 9, 20, .88);
}
.affiche[hidden] { display: none; }
.affiche figure {
  margin: 0;
  width: min(1000px, 100%);
  padding: 12px;
  border-radius: 14px;
  background: var(--fond-2);
  box-shadow: 0 0 0 2px var(--cadre), 0 30px 80px rgba(0, 0, 0, .6);
  text-align: center;
}
.affiche img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
.affiche figcaption {
  margin: 12px 0 10px;
  font-size: 15px;
  line-height: 1.5;
}
.affiche a { color: #8fd3ff; }
.affiche button {
  font: 12px "Press Start 2P", monospace;
  color: var(--texte);
  background: var(--rouge);
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
}

/* Manette tactile */
.manette {
  display: none;
  width: 100%;
  max-width: 420px;
  justify-content: space-between;
  align-items: center;
  padding: 0 6px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.manette button {
  font-family: "Press Start 2P", monospace;
  color: var(--texte);
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.croix {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 52px);
}
.croix button {
  background: var(--cadre);
  font-size: 14px;
}
.croix button.actif, .actions button.actif { filter: brightness(1.5); }
.haut { grid-column: 2; grid-row: 1; border-radius: 10px 10px 0 0; }
.gauche { grid-column: 1; grid-row: 2; border-radius: 10px 0 0 10px; }
.droite { grid-column: 3; grid-row: 2; border-radius: 0 10px 10px 0; }
.bas { grid-column: 2; grid-row: 3; border-radius: 0 0 10px 10px; }

.actions {
  display: flex;
  gap: 16px;
  transform: rotate(-18deg);
}
.actions button {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 16px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .35);
}
.bouton-a { background: var(--rouge); margin-top: -24px; }
.bouton-b { background: var(--bleu); }

/* Intégré dans une page (iframe ?embed) : pas de grand titre, fond transparent */
.embed body { min-height: 0; padding: 8px; background: transparent; }
.embed .titre { display: none; }
.embed .console { gap: 10px; }

@media (pointer: coarse) {
  .manette { display: flex; }
  .clavier { display: none; }
}

.credit { margin: 0; font-size: 13px; color: var(--doux); text-align: center; }
.credit a { color: #8fd3ff; }
.embed .credit { display: none; }
.manette button:focus-visible, .son:focus-visible, .affiche button:focus-visible {
  outline: 3px solid #8fd3ff;
  outline-offset: 3px;
}
