/* Style « console 16 bits » : polices pixel auto-hébergées, aucune ressource externe. */

@font-face {
  font-family: "Press Start 2P";
  src: url("fonts/PressStart2P-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "VT323";
  src: url("fonts/VT323-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #12102a;
  --panel: #1b1840;
  --ink: #f4f1e8;
  --ink-dim: #bcb8e0;
  --black: #07061a;
  --line: #9a95d6;
  --gold: #ffd23f;
  --pink: #ff5c8a;
  --green: #4ade80;
  --red: #ff5c5c;
  --grey: #b4b0d6;
  --pixel: "Press Start 2P", ui-monospace, "Courier New", monospace;
  --text: "VT323", ui-monospace, "Courier New", monospace;
  --stars: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27160%27 height=%27160%27 shape-rendering=%27crispEdges%27%3E%3Crect x=%2714%27 y=%2722%27 width=%272%27 height=%272%27 fill=%27%236a65b8%27/%3E%3Crect x=%2770%27 y=%278%27 width=%272%27 height=%272%27 fill=%27%233d3a7a%27/%3E%3Crect x=%27122%27 y=%2740%27 width=%272%27 height=%272%27 fill=%27%236a65b8%27/%3E%3Crect x=%27150%27 y=%2796%27 width=%272%27 height=%272%27 fill=%27%233d3a7a%27/%3E%3Crect x=%2736%27 y=%2770%27 width=%272%27 height=%272%27 fill=%27%233d3a7a%27/%3E%3Crect x=%2796%27 y=%2784%27 width=%272%27 height=%272%27 fill=%27%23f4f1e8%27/%3E%3Crect x=%2760%27 y=%27130%27 width=%272%27 height=%272%27 fill=%27%236a65b8%27/%3E%3Crect x=%27130%27 y=%27140%27 width=%272%27 height=%272%27 fill=%27%233d3a7a%27/%3E%3Crect x=%2710%27 y=%27118%27 width=%272%27 height=%272%27 fill=%27%23f4f1e8%27/%3E%3Crect x=%27104%27 y=%2714%27 width=%272%27 height=%272%27 fill=%27%23f4f1e8%27/%3E%3Crect x=%2730%27 y=%27150%27 width=%272%27 height=%272%27 fill=%27%233d3a7a%27/%3E%3Crect x=%2780%27 y=%2752%27 width=%272%27 height=%272%27 fill=%27%236a65b8%27/%3E%3C/svg%3E");
  --arrow: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 4 8%27 shape-rendering=%27crispEdges%27%3E%3Cpath d=%27M0 0h1v8H0zM1 1h1v6H1zM2 2h1v4H2zM3 3h1v2H3z%27/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 22px/1.15 var(--text);
  color: var(--ink);
  background:
    var(--stars) 0 0 / 160px 160px,
    var(--bg);
}

/* Scanlines CRT, légères pour ne pas gêner la lecture. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgba(0, 0, 0, 0.12) 2px 4px
  );
}

:focus-visible {
  outline: 4px dashed var(--gold);
  outline-offset: 4px;
}

.top,
main,
.bottom {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Écran titre */
.top {
  padding-top: 20px;
  padding-bottom: 12px;
  text-align: center;
}

.pad {
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  image-rendering: pixelated;
  filter: drop-shadow(4px 4px 0 var(--black));
}

.logo {
  margin: 0;
  font: 400 18px/1.3 var(--pixel);
  text-transform: uppercase;
  text-shadow: 4px 4px 0 var(--black);
}

.logo span:last-child {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  color: var(--gold);
  text-shadow:
    4px 4px 0 var(--pink),
    8px 8px 0 var(--black);
}

.press {
  margin: 12px auto 0;
  max-width: 28em;
  font: 11px/1.6 var(--pixel);
  text-transform: uppercase;
  text-wrap: balance;
  animation: blink 1.2s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Liste des jeux */
main {
  flex: 1;
  padding-top: 4px;
  padding-bottom: 8px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 4px double var(--line);
}

.section-head h2 {
  margin: 0;
  font: 13px/1.4 var(--pixel);
  text-transform: uppercase;
}

.count {
  color: var(--ink-dim);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 28px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  --accent: #8b5cf6;
  --accent-dark: color-mix(in srgb, var(--accent) 45%, #000);
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  /* Bordure pixel de 4px, coins crantés, puis ombre portée dure. */
  box-shadow:
    0 -4px 0 0 var(--line),
    0 4px 0 0 var(--line),
    -4px 0 0 0 var(--line),
    4px 0 0 0 var(--line);
  filter: drop-shadow(8px 8px 0 var(--black));
}

.card:not(.is-soon) {
  cursor: pointer;
}

/* Carte « sélectionnée » façon menu : cadre qui clignote et curseur ▶. */
.card:not(.is-soon):hover,
.card:not(.is-soon):has(.title:focus-visible) {
  --line: var(--accent);
  animation: frame 0.8s steps(1) infinite;
}

@keyframes frame {
  50% {
    --line: var(--ink);
  }
}

.cover {
  display: grid;
  place-items: center;
  height: 80px;
  border-bottom: 4px solid var(--black);
  background:
    conic-gradient(
        rgba(255, 255, 255, 0.07) 25%,
        transparent 0 50%,
        rgba(255, 255, 255, 0.07) 0 75%,
        transparent 0
      )
      0 0 / 16px 16px,
    color-mix(in srgb, var(--accent) 32%, #0d0b22);
}

.thumb {
  display: block;
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.55));
}

.icon {
  font-size: 48px;
  line-height: 1;
}

.card:not(.is-soon):hover .thumb,
.card:not(.is-soon):hover .icon {
  transform: translateY(-4px);
}

.is-soon .cover {
  filter: grayscale(1) brightness(0.85);
}

.body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 18px;
}

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h3 {
  margin: 0;
  font: 14px/1.4 var(--pixel);
  text-transform: uppercase;
}

.title {
  color: var(--ink);
  text-decoration: none;
}

/* Le lien du titre couvre toute la carte. */
.title::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.title:focus-visible {
  outline: none;
}

.title:focus-visible::after {
  outline: 4px dashed var(--gold);
  outline-offset: 8px;
}

.title::before,
.card:not(.is-soon) .play::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 16px;
  background: currentcolor;
  -webkit-mask: var(--arrow) center / 100% 100% no-repeat;
  mask: var(--arrow) center / 100% 100% no-repeat;
}

.title::before {
  margin: 0 8px 0 -16px;
  vertical-align: -2px;
  color: var(--gold);
  visibility: hidden;
}

.card:not(.is-soon):hover .title::before,
.card:not(.is-soon):has(.title:focus-visible) .title::before {
  visibility: visible;
  animation: blink 0.8s steps(1) infinite;
}

.desc {
  margin: 0;
  color: var(--ink);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 2px 8px 3px;
  font-size: 18px;
  line-height: 1;
  color: var(--ink);
  background: #2a2660;
  border: 2px solid #5a54a6;
}

/* Joueurs connectés (renseigné d'après la réponse du point de santé) */
.players {
  margin: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
}

.players::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  background: var(--accent);
}

.players[data-empty="true"] {
  opacity: 0.6;
}

/* Pastille d'état : carré pixel */
.status {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font: 8px/1 var(--pixel);
  text-transform: uppercase;
  color: var(--black);
  background: var(--grey);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.3);
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentcolor;
}

.status[data-state="online"] {
  background: var(--green);
}

.status[data-state="offline"] {
  background: var(--red);
}

.status[data-state="checking"] {
  color: var(--ink-dim);
  background: transparent;
  box-shadow: inset 0 0 0 2px #5a54a6;
}

.status[data-state="checking"]::before {
  animation: blink 0.8s steps(1) infinite;
}

/* Bouton JOUER : s'enfonce au survol et au clic. */
.play {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 12px;
  margin-top: auto;
  padding: 10px 14px;
  font: 13px/1 var(--pixel);
  text-transform: uppercase;
  color: var(--black);
  background: var(--accent);
  border: 4px solid var(--black);
  box-shadow:
    inset -4px -4px 0 rgba(0, 0, 0, 0.28),
    inset 4px 4px 0 rgba(255, 255, 255, 0.4),
    4px 4px 0 var(--accent-dark);
}

.card:not(.is-soon):hover .play {
  transform: translate(2px, 2px);
  box-shadow:
    inset -4px -4px 0 rgba(0, 0, 0, 0.28),
    inset 4px 4px 0 rgba(255, 255, 255, 0.4),
    2px 2px 0 var(--accent-dark);
}

.card:not(.is-soon):active .play {
  transform: translate(4px, 4px);
  box-shadow:
    inset 4px 4px 0 rgba(0, 0, 0, 0.28),
    inset -4px -4px 0 rgba(255, 255, 255, 0.2),
    0 0 0 var(--accent-dark);
}

.is-soon .play {
  color: var(--ink-dim);
  background: #3a3670;
  box-shadow: none;
}

.empty {
  margin: 0;
  padding: 16px;
  color: var(--ink-dim);
  background: var(--panel);
  border: 4px dashed var(--line);
}

.bottom {
  padding-top: 4px;
  padding-bottom: 10px;
  text-align: center;
  color: var(--ink-dim);
}

.bottom p {
  margin: 0;
  padding-top: 10px;
  border-top: 4px double #5a54a6;
}

@media (min-width: 640px) {
  .top {
    padding-top: 14px;
    padding-bottom: 8px;
  }

  .logo {
    font-size: 22px;
  }

  .logo span:last-child {
    font-size: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
  }
}

/* Compte Discord */
.account-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-bottom: 8px;
  min-height: 34px;
}

.account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 10px;
  max-width: 100%;
}

.account .who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 14em;
}

.account .who span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account .who img {
  flex: none;
  display: block;
  width: 28px;
  height: 28px;
  object-fit: cover;
  background: var(--black);
  box-shadow: 0 0 0 2px var(--line);
}

.btn {
  flex: none;
  display: inline-block;
  padding: 8px 10px;
  font: 10px/1.2 var(--pixel);
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink);
  background: var(--panel);
  border: 0;
  cursor: pointer;
  box-shadow:
    0 -3px 0 0 var(--line),
    0 3px 0 0 var(--line),
    -3px 0 0 0 var(--line),
    3px 0 0 0 var(--line);
}

.btn:hover {
  color: var(--gold);
}

.btn.discord {
  background: #5865f2;
  color: #fff;
}

.account-note {
  margin: 0;
  color: var(--pink);
}

@media (max-width: 479px) {
  .account-bar,
  .account {
    align-items: center;
    justify-content: center;
  }
}
