/* Deux thèmes, choisis par data-theme sur <html> (bouton en pied de page).
   Nuit : le thème d'origine. Béton : brutaliste, d'après STRAFTAT. */

@font-face {
  font-family: "Barlow";
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url("/static/barlow-600-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-style: italic;
  font-weight: 800;
  font-display: swap;
  src: url("/static/barlow-800-italic.woff2") format("woff2");
}

:root {
  --bg: #0f1115;
  --surface: #161920;
  --border: #262b36;
  --text: #e4e6eb;
  --muted: #8b919e;
  --accent: #7aa2f7;
  --link: var(--accent);
  --r-lg: 8px;
  --r: 6px;
  --r-sm: 4px;
  --line: 1px;
}

:root[data-theme="beton"] {
  --bg: #1c201d;
  --surface: #252a26;
  --border: #3a413b;
  --text: #e2e6df;
  --muted: #8f998e;
  --accent: #9dff8a;
  --link: var(--text);
  --r-lg: 0;
  --r: 0;
  --r-sm: 0;
  --line: 2px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

header.site {
  border-bottom: var(--line) solid var(--border);
  background: var(--surface);
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 56px;
  gap: 0.5rem 1.5rem;
}

.brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

nav.site { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
nav.site a { color: var(--muted); font-size: 0.9375rem; }
nav.site a:hover { color: var(--text); text-decoration: none; }

main { padding: 3rem 0; }

footer.site {
  border-top: var(--line) solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
  padding: 1.5rem 0;
}
footer.site .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.theme-toggle {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }
.t-beton, [data-theme="beton"] .t-nuit { display: none; }
[data-theme="beton"] .t-beton { display: inline; }

h1 { font-size: 1.75rem; margin: 0 0 0.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.125rem; margin: 0 0 0.5rem; }
h3 { font-size: 1rem; margin: 0; }
p.lead { color: var(--muted); margin: 0 0 2rem; }
.muted { color: var(--muted); }

.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  border: var(--line) solid var(--border);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 1.25rem;
}

.card p { margin: 0; color: var(--muted); font-size: 0.9375rem; }

.btn {
  display: inline-block;
  border: var(--line) solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r);
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
button.btn { font: inherit; font-size: 0.9375rem; cursor: pointer; }

.profile { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.profile img { border-radius: var(--r-sm); }
.profile h1 { margin: 0; }

nav.site form { margin: 0; }
nav.site button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  font-size: 0.9375rem;
  color: var(--muted);
  cursor: pointer;
}
nav.site button:hover { color: var(--text); }

/* Listes de jeux : tags et filtres */
.tags { display: flex; flex-wrap: wrap; gap: 0.375rem; font-size: 0.8125rem; color: var(--muted); }
.tags span + span::before { content: "· "; }
.tags .badge + span::before { content: none; }
.badge { color: var(--accent); border: 1px solid currentColor; border-radius: var(--r-sm); padding: 0 0.375rem; }

p.filters { display: flex; gap: 1rem; }
p.filters a { color: var(--muted); }
p.filters a.on { color: var(--text); font-weight: 600; }

p.cta { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
form.inline, form.leave { margin: 0; }
form.leave { margin-top: 2rem; }

ul.members { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1rem; }
ul.members li { display: flex; align-items: center; gap: 0.5rem; }
ul.members img { border-radius: var(--r-sm); }

/* Formulaires */
input.invite, input.search, form.chat input, form.compare textarea, form.searchbar input[type="search"] {
  width: 100%;
  padding: 0.5rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: var(--line) solid var(--border);
  border-radius: var(--r);
}
input.invite { max-width: 28rem; margin-top: 0.5rem; }
form.compare { display: grid; gap: 0.75rem; justify-items: start; margin-bottom: 1.5rem; }
form.compare textarea { max-width: 40rem; resize: vertical; }
ul.problems { color: #e0af68; padding-left: 1.25rem; }
label.check { display: inline-flex; align-items: center; gap: 0.375rem; color: var(--muted); white-space: nowrap; cursor: pointer; }
label.check input { accent-color: var(--accent); }

/* Salon */
.room { display: grid; gap: 2rem; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); margin-top: 1.5rem; align-items: start; }
@media (max-width: 800px) { .room { grid-template-columns: 1fr; } }
.room h2 { margin-top: 1.5rem; }
.room h2:first-child { margin-top: 0; }

button.vote, button.remove {
  font: inherit;
  font-size: 0.875rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.125rem 0.5rem;
  cursor: pointer;
  white-space: nowrap;
}
button.vote.on { color: var(--accent); border-color: var(--accent); }
button.remove { border-color: transparent; }
button.vote:hover, button.remove:hover { color: var(--text); }

form.chat { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
ul.messages { list-style: none; margin: 0; padding: 0; max-height: 28rem; overflow-y: auto; }
ul.messages li { display: flex; gap: 0.5rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
ul.messages img { flex: none; border-radius: var(--r-sm); }
ul.messages time { color: var(--muted); font-size: 0.8125rem; margin-left: 0.5rem; }
ul.messages p { margin: 0; overflow-wrap: anywhere; }

/* Recherche compacte du salon : liste déroulante sous le champ */
.searchbox { position: relative; }
#search-results:empty { display: none; }
.dropdown {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 2px;
  background: var(--bg);
  border: var(--line) solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.dropdown > p { margin: 0; padding: 0.5rem 0.75rem; }
.dropdown ul { list-style: none; margin: 0; padding: 0; }
.dropdown li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.dropdown li:hover { background: var(--surface); }
.dropdown img { flex: none; width: 80px; height: 30px; object-fit: cover; }
.dropdown .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown form { margin: 0; }
.dropdown .price { font-size: 0.875rem; white-space: nowrap; }
.dropdown .in-room { width: 2rem; text-align: center; color: var(--accent); }
.dropdown .all { display: block; padding: 0.5rem 0.75rem; font-size: 0.875rem; }
button.add {
  width: 2rem;
  height: 2rem;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
}
button.add:hover { border-color: var(--accent); color: var(--accent); }

/* Page de recherche : grille de cards */
form.searchbar { display: flex; gap: 1rem; align-items: center; margin-bottom: 2rem; }
form.searchbar input[type="search"] { font-size: 1.125rem; padding: 0.625rem 0.75rem; }
.card-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.game-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: var(--line) solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.game-card:hover { border-color: var(--accent); }
.game-card img { display: block; width: 100%; height: auto; aspect-ratio: 460 / 215; object-fit: cover; background: var(--bg); }
.game-card-body { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; padding: 0.875rem 1rem 1rem; }
.game-card h3 a { color: var(--text); }
/* Dans les cards, les tags passent à la ligne : des pastilles plutôt que des « · ». */
.game-card .tags span + span::before { content: none; }
.game-card .tags span:not(.badge) { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 0.375rem; }
.game-card .desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; margin-top: auto; padding-top: 0.25rem; }
.game-card-foot form { margin: 0 0 0 auto; }
.price s { color: var(--muted); font-size: 0.8125rem; margin-right: 0.375rem; }
.owned { font-size: 0.8125rem; color: var(--muted); }
.in-room { color: var(--accent); font-size: 0.875rem; }
.time, .owners { font-size: 0.875rem; color: var(--muted); }
.card-actions { display: flex; gap: 0.25rem; margin-left: auto; }

@media (max-width: 560px) {
  form.searchbar { flex-direction: column; align-items: stretch; }
  .wrap { padding: 0 1rem; }
}

/* ---- Thème Béton : uniquement ce qui ne passe pas par les variables ---- */

[data-theme="beton"] h1,
[data-theme="beton"] h2,
[data-theme="beton"] .brand {
  font-family: "Barlow", system-ui, sans-serif;
  font-style: italic;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
[data-theme="beton"] h1 { font-size: 2.5rem; line-height: 1.05; }
[data-theme="beton"] h2 { font-size: 1.375rem; }
[data-theme="beton"] .brand { font-size: 1.25rem; }

/* L'élément marquant : les chiffres façon HUD, vert phosphore. */
[data-theme="beton"] .num {
  font-family: "Barlow", system-ui, sans-serif;
  font-style: italic;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  text-shadow: 0 0 6px rgb(157 255 138 / 0.45);
}
[data-theme="beton"] .time.num { color: var(--accent); }

[data-theme="beton"] a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
[data-theme="beton"] nav.site a,
[data-theme="beton"] .brand,
[data-theme="beton"] .btn,
[data-theme="beton"] .game-card h3 a { text-decoration: none; }
[data-theme="beton"] nav.site a:hover,
[data-theme="beton"] .game-card h3 a:hover { text-decoration: underline; }

[data-theme="beton"] .btn,
[data-theme="beton"] nav.site,
[data-theme="beton"] .theme-toggle {
  font-family: "Barlow", system-ui, sans-serif;
  font-style: italic;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
[data-theme="beton"] .btn:hover,
[data-theme="beton"] button.add:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #10140f;
}
[data-theme="beton"] button.vote.on { background: var(--accent); color: #10140f; }
[data-theme="beton"] button.vote.on .num { color: inherit; text-shadow: none; }
[data-theme="beton"] .badge { color: var(--text); border-color: var(--text); }
[data-theme="beton"] .game-card img { filter: saturate(0.85); }
[data-theme="beton"] .game-card:hover img { filter: none; }

/* Pages de texte (confidentialité) */
.prose { max-width: 40rem; }
.prose h2 { margin-top: 2rem; }
footer.site small { font-size: 0.8125rem; }

/* Onglets du salon */
nav.tabs { display: flex; gap: 1.5rem; margin-bottom: 1rem; border-bottom: var(--line) solid var(--border); }
nav.tabs a { padding: 0 0 0.5rem; margin-bottom: calc(-1 * var(--line)); color: var(--muted); font-weight: 600; text-decoration: none; border-bottom: var(--line) solid transparent; }
nav.tabs a:hover { color: var(--text); }
nav.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
[data-theme="beton"] nav.tabs a { font-family: "Barlow", system-ui, sans-serif; font-style: italic; font-weight: 800; text-transform: uppercase; font-size: 1.125rem; }
ul.private-list { list-style: none; margin: 0; padding: 0; }

/* Mes salons, renommage */
form.new-room { margin: 0 0 1.5rem; }
.room-card .game-card-body { gap: 0.625rem; }
.room-card h3 { font-size: 1.125rem; }
ul.avatars { display: flex; flex-wrap: wrap; gap: 0.25rem; list-style: none; margin: 0; padding: 0; align-items: center; }
ul.avatars img { display: block; border-radius: var(--r-sm); }
.room-meta { margin: 0; font-size: 0.875rem; }
details.rename { margin: -0.25rem 0 1rem; color: var(--muted); font-size: 0.875rem; }
details.rename summary { cursor: pointer; width: fit-content; }
details.rename form { display: flex; gap: 0.5rem; margin-top: 0.5rem; max-width: 28rem; }
details.rename input {
  flex: 1;
  padding: 0.5rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: var(--line) solid var(--border);
  border-radius: var(--r);
}
[data-theme="beton"] .room-card h3 a {
  font-family: "Barlow", system-ui, sans-serif;
  font-style: italic;
  font-weight: 800;
  text-transform: uppercase;
}

/* Jeux en commun : invités, presque en commun */
ul.compared-list li form { margin: 0; }
form.add-guest { display: flex; gap: 0.5rem; margin: 0 0 1.5rem; }
form.add-guest input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: var(--line) solid var(--border);
  border-radius: var(--r);
}
p.problems { color: #e0af68; }
h2.near-title { margin-top: 2.5rem; }
.missing { font-size: 0.875rem; color: #e0af68; }

/* Tirage au sort */
.draw { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.draw p { margin: 0; }
.draw-result a { font-weight: 700; }
[data-theme="beton"] .draw-result a { color: var(--accent); text-shadow: 0 0 6px rgb(157 255 138 / 0.45); }
@media (max-width: 560px) { form.add-guest { flex-direction: column; } }

/* Pagination des grilles */
nav.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2rem; }
nav.pager .disabled { opacity: 0.4; pointer-events: none; }
.pager-pos { color: var(--muted); font-size: 0.9375rem; }
p.filters a .num { font-size: 0.875rem; color: var(--muted); }
p.filters a.on .num { color: inherit; }

/* Suggestions */
.suggest-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.suggest-head p { margin: 0; }
h2.suggest-cat { margin-top: 1.5rem; }
.game-card-foot .reason { flex-basis: 100%; margin: 0; font-size: 0.875rem; line-height: 1.45; }
.wishers { flex-basis: 100%; font-size: 0.875rem; color: var(--accent); }
.game-card-foot .owners { flex-basis: 100%; }

/* Session et bouton Lancer */
.session { margin: -0.25rem 0 1rem; }
.session p { margin: 0 0 0.25rem; }
details.session-edit { color: var(--muted); font-size: 0.875rem; }
details.session-edit summary { cursor: pointer; width: fit-content; }
details.session-edit form { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
details.session-edit input {
  padding: 0.5rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: var(--line) solid var(--border);
  border-radius: var(--r);
  color-scheme: dark;
}
.btn.launch { padding: 0.25rem 0.625rem; font-size: 0.875rem; }
.game-card-foot .btn.launch { margin-left: auto; }
.game-card-foot .btn.launch + .card-actions { margin-left: 0; }
