:root {
  --bg: #120a24;
  --bg-2: #1a1033;
  --surface: #221641;
  --surface-2: #2c1d54;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4efff;
  --muted: #a99cc9;
  --gold: #f5c542;
  --gold-2: #ffde7a;
  --green: #3ddc84;
  --yellow: #f5c542;
  --red: #ff5d5d;
  --orange: #ff9f43;
  --grey: #8a80a8;
  --radius: 14px;
  --pixel: "Silkscreen", ui-monospace, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(140, 82, 255, 0.25), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(245, 197, 66, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img[src$="server-icon.png"] { image-rendering: pixelated; border-radius: 8px; }

a { color: inherit; }

code {
  font-family: var(--pixel);
  font-size: 0.95em;
  background: rgba(245, 197, 66, 0.1);
  color: var(--gold-2);
  padding: 0.1em 0.45em;
  border-radius: 6px;
}

h1, h2, h3 { font-family: var(--pixel); font-weight: 700; line-height: 1.15; margin: 0; }

.muted { color: var(--muted); }

/* --- Barre du haut --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px max(16px, calc((100vw - 1180px) / 2));
  background: rgba(18, 10, 36, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--pixel); font-size: 1.15rem; color: var(--gold); }
.topbar nav { display: flex; gap: 20px; margin-left: auto; }
.topbar nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
.topbar nav a:hover { color: var(--text); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  white-space: nowrap;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--grey); }
[data-state="online"] .dot { background: var(--green); box-shadow: 0 0 0 4px rgba(61, 220, 132, 0.18); animation: pulse 2s infinite; }
[data-state="starting"] .dot { background: var(--yellow); }
[data-state="offline"] .dot { background: var(--red); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(61, 220, 132, 0); } }

/* --- Hero --- */
main { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 72px 0 56px;
}
.eyebrow { font-family: var(--pixel); color: var(--gold); letter-spacing: 0.08em; margin: 0 0 12px; font-size: 0.85rem; text-transform: uppercase; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
.hero h1 span { color: var(--gold); }
.lead { color: var(--muted); font-size: 1.1rem; max-width: 52ch; margin: 20px 0 28px; }

.ip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 18px;
  background: var(--surface);
  border: 1px solid rgba(245, 197, 66, 0.35);
  border-radius: var(--radius);
}
.ip code { background: none; padding: 0; font-size: 1.1rem; }

.btn {
  font: 600 0.95rem var(--sans);
  color: #241500;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: 0 3px 0 #b88a12;
  transition: transform 0.08s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #b88a12; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0;
}
.stats div {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stats dt { color: var(--muted); font-size: 0.85rem; }
.stats dd { margin: 4px 0 0; font-family: var(--pixel); font-size: 1.5rem; }

/* --- Sections --- */
.section { padding: 48px 0; border-top: 1px solid var(--line); }
.section h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head p { margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip {
  font: 500 0.9rem var(--sans);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}
.chip[aria-selected="true"] { color: #241500; background: var(--gold); border-color: var(--gold); }

/* --- Cartes de jeux --- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }

.card {
  display: flex;
  flex-direction: column;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.card:hover, .card:focus-visible { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--accent) 50%, transparent); outline: none; }
.card[data-maintenance] { opacity: 0.7; }

.cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: center / cover no-repeat;
}
.cover.placeholder {
  display: grid;
  place-items: center;
  font-size: 3.2rem;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 55%, #120a24), #120a24 85%),
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(255, 255, 255, 0.03) 14px 28px);
  background-blend-mode: overlay;
}
.cover .count { position: absolute; right: 10px; bottom: 10px; font-size: 0.75rem; background: rgba(0, 0, 0, 0.6); padding: 2px 8px; border-radius: 999px; }

.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.card h3 { font-size: 1.05rem; color: var(--accent); }
.tagline { margin: 0; color: var(--text); font-size: 0.93rem; flex: 1; }
.meta { margin: 0; color: var(--muted); font-size: 0.82rem; }

.badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}
.badge.available { background: rgba(61, 220, 132, 0.15); color: var(--green); }
.badge.waiting { background: rgba(61, 220, 132, 0.15); color: var(--green); }
.badge.starting { background: rgba(245, 197, 66, 0.15); color: var(--yellow); }
.badge.playing { background: rgba(255, 93, 93, 0.15); color: var(--red); }
.badge.ending { background: rgba(255, 159, 67, 0.15); color: var(--orange); }
.badge.maintenance { background: rgba(138, 128, 168, 0.2); color: #d2c9ef; }

.empty { color: var(--muted); grid-column: 1 / -1; padding: 24px; text-align: center; background: var(--surface); border-radius: var(--radius); }

/* --- Joueurs --- */
.players { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.players li { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px 6px 6px; }
.players img { width: 32px; height: 32px; border-radius: 6px; image-rendering: pixelated; background: var(--surface-2); }

/* --- Etapes --- */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.steps li::before { content: counter(step); font-family: var(--pixel); color: var(--gold); font-size: 1.6rem; }
.steps span { color: var(--muted); font-size: 0.93rem; }

/* --- Fenetre de detail --- */
.modal {
  width: min(860px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  padding: 0;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal::backdrop { background: rgba(8, 4, 18, 0.75); backdrop-filter: blur(4px); }
.modal .close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 1rem; cursor: pointer; }

.gallery { position: relative; aspect-ratio: 16 / 9; background: #000; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .cover { height: 100%; aspect-ratio: auto; font-size: 5rem; }
.gallery .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 1.2rem; cursor: pointer; }
.gallery .prev { left: 12px; }
.gallery .next { right: 12px; }
.gallery .thumbs { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.gallery .thumbs span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.4); }
.gallery .thumbs span.on { background: #fff; }

.detail { padding: 24px 28px 28px; display: grid; gap: 18px; }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail h2 { color: var(--accent); font-size: 1.6rem; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.facts li { background: var(--surface); border-radius: 8px; padding: 4px 10px; font-size: 0.85rem; color: var(--muted); }
.facts b { color: var(--text); font-weight: 600; }
.detail h4 { font-family: var(--pixel); margin: 0 0 8px; color: var(--gold); font-size: 0.95rem; }
.detail p { margin: 0; }
.detail ul.rules { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.detail ul.rules li::marker { color: var(--accent); }
.tips { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 16px; }
.tips ul { margin: 0; padding-left: 18px; }
.maintenance-note { background: rgba(138, 128, 168, 0.15); border-radius: 10px; padding: 10px 14px; color: #d2c9ef; }

/* --- Pied de page --- */
.footer { max-width: 1180px; margin: 40px auto 0; padding: 28px 16px 40px; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 0.9rem; }
.footer .muted { margin-left: auto; }

/* --- Mobile --- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; gap: 28px; }
  .topbar nav { display: none; }
  .topbar .pill { margin-left: auto; }
  .ip { flex-wrap: wrap; }
  .detail { padding: 20px; }
  .footer .muted { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Sans capture, le visuel de remplacement de la fiche est moins haut. */
.gallery:has(.placeholder) { aspect-ratio: 21 / 6; }
