:root {
  --bg: #111216;
  --surface: #1b1d23;
  --surface-2: #24272f;
  --line: #2f333d;
  --text: #f2f3f5;
  --muted: #a3a8b4;
  --play: #00b06f;
  --play-hover: #00c97f;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
  padding: 0 24px;
  background: #191b20;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .5px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
  font-weight: 900;
  transform: rotate(-12deg);
}

.search {
  flex: 1;
  max-width: 420px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.search:focus-within { border-color: var(--muted); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

/* ---------- Accueil ---------- */
.hello h1 { margin: 0 0 4px; font-size: 30px; }
.hello p { margin: 0 0 28px; color: var(--muted); }

.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 20px;
}
.section-title small { color: var(--muted); font-weight: 500; font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}

.card {
  display: block;
  border-radius: var(--radius);
  transition: transform .15s ease;
}
.card:hover { transform: translateY(-4px); }
.card:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }

.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card:hover .thumb { box-shadow: 0 8px 24px rgba(0,0,0,.45); }

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0,0,0,.7);
  font-size: 12px;
  font-weight: 700;
}

.card-name {
  margin: 8px 0 2px;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}
.card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.card-meta svg { width: 14px; height: 14px; fill: currentColor; }

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

/* ---------- Page d'un jeu ---------- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  color: var(--muted);
  font-weight: 600;
}
.back:hover { color: var(--text); }

.game-top {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 28px;
  align-items: start;
}

.viewer {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.viewer img { width: 100%; height: 100%; object-fit: contain; background: #0b0c0f; }

.nav-btn {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}
.nav-btn:hover { background: rgba(0,0,0,.8); }
.nav-btn.prev { left: 10px; }
.nav-btn.next { right: 10px; }

.thumbs {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.thumbs button {
  flex: none;
  width: 110px;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #0b0c0f;
  cursor: pointer;
  opacity: .6;
}
.thumbs button.active, .thumbs button:hover { opacity: 1; }
.thumbs button.active { border-color: var(--text); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

.side h1 { margin: 0; font-size: 32px; line-height: 1.15; }
.side .tagline { margin: 6px 0 20px; color: var(--muted); }

.play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 60px;
  border-radius: 10px;
  background: var(--play);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  transition: background .15s ease;
}
.play:hover { background: var(--play-hover); }
.play svg { width: 26px; height: 26px; fill: currentColor; }
.play.disabled { background: var(--surface-2); color: var(--muted); pointer-events: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
}
.stats div { padding: 12px; background: var(--surface); text-align: center; }
.stats dt { color: var(--muted); font-size: 12px; }
.stats dd { margin: 2px 0 0; font-weight: 700; font-size: 14px; }

.about {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  max-width: 800px;
}
.about h2 { margin: 0 0 10px; font-size: 22px; }
.about p { margin: 0 0 12px; color: #d4d7de; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding: 0; list-style: none; }
.chips li {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .game-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .topbar { padding: 0 16px; gap: 10px; }
  .brand span:last-child { display: none; }
  main { padding: 20px 16px 48px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .hello h1 { font-size: 24px; }
  .thumbs button { width: 84px; }
}
