:root {
  --bg: #15111c;
  --bg-2: #1f1928;
  --card: #261f31;
  --line: #3a3048;
  --text: #f1eaf7;
  --muted: #a99bb8;
  --accent: #8fd14f; /* vert grenouille */
  --accent-ink: #0f1a06;
  --bad: #ff7a7a;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #3a2550 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2 { line-height: 1.2; margin: 0; }
a { color: var(--accent); }

.brand {
  font-size: clamp(28px, 6vw, 38px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent);
}
.brand.small { font-size: 20px; }

/* Le logo est noir sur blanc : inversé puis fondu en mode « screen », il devient blanc sur le fond sombre */
.logo { margin: 0 auto 8px; width: min(220px, 70%); }
.logo img { display: block; width: 100%; height: auto; filter: invert(1); mix-blend-mode: screen; }
.brand-mark { display: flex; align-items: center; gap: 10px; margin-right: auto; text-decoration: none; }
.logo-mark {
  width: 40px;
  height: 29px; /* le cadre de la grenouille, sans le mot PUNKFROG du bas */
  background: url(/punkfrog.svg) top center / 100% auto no-repeat;
  filter: invert(1);
  mix-blend-mode: screen;
}
.login-card .lead { text-align: center; }
.lead { color: var(--muted); margin: 8px 0 24px; }

button, .primary, .ghost {
  font: inherit;
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  font-weight: 700;
}
.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: 0.6; cursor: wait; }
.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.ghost:hover { color: var(--text); border-color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Connexion ---------- */

.login-page {
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.45);
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.tabs button {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 9px 8px;
}
.tabs button[aria-selected="true"] { background: var(--card); color: var(--text); font-weight: 600; }

form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input {
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  width: 100%;
}
input:focus { border-color: var(--accent); outline: none; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.error { color: var(--bad); margin: 0; font-size: 14px; }
form .primary { margin-top: 6px; width: 100%; }

/* ---------- Ludothèque ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgb(21 17 28 / 0.8);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
}

.who { color: var(--muted); font-size: 14px; }
.who b { color: var(--text); }

.library { max-width: 1040px; margin: 0 auto; padding: 32px 16px 64px; }
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.game-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* Les jaquettes gardent leurs proportions (portrait ou carrées) : on les montre entières dans un cadre carré */
.cover { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #0d0d0f; }
.game-card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tagline { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.description { margin: 4px 0 0; color: var(--muted); }
.saved { margin: 6px 0 10px; font-size: 13px; color: var(--muted); }
.actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 10px; }
.actions > a, .actions > button { flex: 1 1 auto; white-space: nowrap; }

@media (max-width: 520px) {
  .who { display: none; }
}

/* ---------- Accueil public ---------- */

.home { max-width: 1040px; margin: 0 auto; padding: 32px 16px 64px; }
.hero {
  display: grid;
  grid-template-columns: minmax(180px, 300px) 1fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 56px;
}
.hero-logo { width: 100%; margin: 0; }
.hero-text p { margin: 0 0 14px; color: var(--muted); }
.hero-text .slogan {
  color: var(--accent);
  font-size: clamp(20px, 3.4vw, 28px);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 18px;
}
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 12px; }
.catalog h2 { font-size: 26px; margin-bottom: 18px; }
.game-card h3 { margin: 0; font-size: 22px; }
.demo-info { margin: 6px 0 10px; font-size: 13px; color: var(--muted); }
.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.back-home { display: block; text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }

@media (max-width: 700px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .hero-logo { width: min(220px, 60%); margin: 0 auto; }
}

/* ---------- Connexion : vues du code et du mot de passe oublié ---------- */

.view h2 { font-size: 20px; margin: 0; }
.view .hint b { color: var(--text); overflow-wrap: anywhere; }
.link {
  background: none;
  border: 0;
  padding: 2px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  justify-self: center;
}
.link:hover { color: var(--text); }
.link:disabled { opacity: 0.5; cursor: default; }
.notice { color: var(--accent); margin: 0; font-size: 14px; }
input.code { font: 700 26px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.4em; text-align: center; }

/* Jeu en cours de développement : bandeau « chantier » en travers du coin de la carte */
.game-card { position: relative; }
.wip-ribbon {
  position: absolute;
  top: 34px;
  right: -40px;
  z-index: 1;
  transform: rotate(40deg);
  padding: 4px 44px;
  background: #f5c518;
  border-top: 3px dashed #1b1b1b;
  border-bottom: 3px dashed #1b1b1b;
  color: #1b1b1b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
