:root {
  --bg: #0E0F1A; --surface: #171828; --surface-2: #1B1D33; --surface-3: #22243C;
  --line: #262842; --line-2: #2E3150; --line-3: #3A3D60;
  --text: #F2F2F7; --soft: #C4C6DE; --muted: #A9ACC7;
  --accent: #C6F432; --accent-hover: #E2FF8A; --on-accent: #0E0F1A;
  --warn: #FFC93C; --danger: #FF8A73;
  --radius: 16px;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 Inter, system-ui, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; outline: none; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
.display { font-family: var(--display); font-weight: 800; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* en-tête */
.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-top: 14px; padding-bottom: 14px; }
.logo { font-family: var(--display); font-weight: 800; font-size: 28px; color: var(--text); text-decoration: none; }
.logo span { color: var(--accent); }
.logo:hover { color: var(--text); }
.top-nav { display: flex; gap: 18px; }
.top-nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.top-nav a[aria-current="page"], .top-nav a:hover { color: var(--text); }
.search { flex: 1 1 240px; display: flex; }
[hidden] { display: none !important; }
.search input { flex: 1; }
.search input, .field input, .field textarea, .field select, .input { min-width: 0; width: 100%; height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; }
.field textarea { height: auto; padding: 12px 16px; resize: vertical; line-height: 1.5; }
.compte { display: flex; align-items: center; gap: 8px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 999px; color: var(--on-accent); font-weight: 700; text-decoration: none; flex: 0 0 auto; }
.avatar.lg { width: 72px; height: 72px; font-size: 28px; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
@media (max-width: 720px) {
  .top-nav { order: 3; width: 100%; }
  .search { order: 4; flex-basis: 100%; }
  .top .btn-accent span { display: none; }
  .logo { margin-right: auto; }
  .compte .btn-ghost { display: none; }   /* la modération reste accessible depuis le profil */
}

/* boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--line-3); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-outline-accent { background: transparent; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 17px; border-radius: 14px; }
.btn[aria-pressed="true"].like { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.chip:hover { color: var(--text); border-color: var(--line-3); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tag { display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--surface-3); font-size: 13px; color: var(--text); text-decoration: none; }
.tag:hover { color: var(--accent); }

/* mise en page */
.page { padding: 32px 0 64px; display: flex; flex-direction: column; gap: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.h2 { font-family: var(--display); font-weight: 800; font-size: 30px; }
.h1 { font-family: var(--display); font-weight: 800; font-size: clamp(32px, 5vw, 44px); }
.card { padding: 24px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.split { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.split > .main { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.split > .side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.prose { max-width: 760px; line-height: 1.65; color: var(--soft); }
.prose h1, .prose h2 { color: var(--text); margin: 28px 0 10px; }
.prose code, code { background: var(--surface-3); padding: 2px 6px; border-radius: 6px; font-size: .92em; }
pre { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.55; color: var(--soft); }
pre code { background: none; padding: 0; }

/* défi */
.hero { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; padding: 40px; border-radius: 24px; background: var(--surface-2); border: 1px solid var(--line-2); }
.hero .txt { flex: 999 1 420px; display: flex; flex-direction: column; gap: 14px; }
.hero h1 { font-family: var(--display); font-weight: 800; font-size: clamp(36px, 6vw, 52px); line-height: 1.02; }
.hero p { margin: 0; color: var(--soft); font-size: 18px; max-width: 540px; }
.kicker { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.mosaic { flex: 1 1 260px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mosaic div { aspect-ratio: 1; border-radius: 16px; }
@media (max-width: 600px) { .hero { padding: 24px; } .mosaic { display: none; } }

/* cartes de jeux */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.game { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text); }
.game:hover { color: var(--text); }
.game:hover .thumb { transform: translateY(-3px); }
.thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; display: flex; align-items: center; justify-content: center; transition: transform .15s; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .glyph { font-family: var(--display); font-weight: 800; font-size: 64px; color: #0E0F1A; opacity: .85; }
.badge { position: absolute; top: 10px; padding: 4px 10px; border-radius: 999px; background: #0E0F1AE6; color: var(--text); font-size: 12px; font-weight: 600; }
.badge.l { left: 10px; } .badge.r { right: 10px; color: var(--accent); }
.badge.etat { right: 10px; top: auto; bottom: 10px; color: var(--warn); }
.game .t { font-weight: 600; }
.game .by, .game .st { color: var(--muted); font-size: 14px; }
.game .st { font-size: 13px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } .thumb .glyph { font-size: 44px; } }

/* page de jeu */
.stage { position: relative; aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; }
.stage:fullscreen { border-radius: 0; border: 0; aspect-ratio: auto; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.stage .launch { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; padding: 24px; }
.stage .launch .thumb { width: 160px; aspect-ratio: 1; border-radius: 32px; }
@media (max-width: 720px) { .stage { aspect-ratio: 3 / 4; } }
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.board li { display: flex; gap: 8px; padding: 8px 10px; border-radius: 10px; font-size: 14px; }
.board li.me { background: #2A2F12; color: var(--accent); }
.board .r { width: 28px; font-weight: 600; color: var(--muted); }
.board .p { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.board .s { font-weight: 600; font-variant-numeric: tabular-nums; }
.comment { display: flex; gap: 12px; }
.comment .b { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.comment .body { color: var(--soft); overflow-wrap: anywhere; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }

/* formulaires */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .legend { font-weight: 600; }
.hint { color: var(--muted); font-size: 14px; font-weight: 400; }
fieldset { margin: 0; padding: 0; border: 0; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; color: var(--soft); font-size: 15px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: 0 0 auto; }
.drop { display: flex; align-items: center; gap: 16px; padding: 22px; border-radius: 16px; border: 2px dashed var(--line-3); background: var(--surface); cursor: pointer; }
.drop.over { border-color: var(--accent); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.checks li { display: flex; gap: 10px; }
.checks .lv { font-weight: 700; min-width: 64px; }
.lv.ok { color: var(--accent); } .lv.warn { color: var(--warn); } .lv.pending { color: var(--warn); } .lv.block { color: var(--danger); }
.error { color: var(--danger); font-weight: 500; }
.notice { padding: 14px 16px; border-radius: 12px; background: var(--surface-3); color: var(--soft); }
.notice.warn { border-left: 0; background: #3A3012; color: #FFE7A3; }

/* bandeau créateurs, pied de page */
.cta { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: space-between; padding: 40px; border-radius: 24px; background: var(--accent); color: var(--on-accent); }
.cta h2 { font-family: var(--display); font-weight: 800; font-size: 34px; }
.cta p { margin: 8px 0 0; max-width: 460px; }
.cta .btn { background: var(--bg); color: var(--text); border-color: var(--bg); }
.foot { border-top: 1px solid var(--line); margin-top: 32px; }
.foot-in { display: flex; flex-wrap: wrap; gap: 10px 24px; padding-top: 24px; padding-bottom: 32px; color: var(--muted); font-size: 14px; }
.foot a { color: var(--muted); }

/* dialogue, notifications */
dialog { border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); color: var(--text); padding: 24px; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: #0008; }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 20; width: min(440px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-3); box-shadow: 0 8px 30px #0006; }
.toast.err { border-color: var(--danger); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table td, .table th { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll { overflow-x: auto; }
