:root {
  --sky-top: #0b1330; --sky-low: #16306b; --ink: #eef2ff; --muted: #a9b6dc;
  --gold: #f2c14e; --bleu: #3d7bff; --rouge: #ff4d4d; --vert: #7ee08a;
  --card: rgba(8, 14, 36, 0.72); --line: rgba(169, 182, 220, 0.18);
  --display: "Pixelify Sans", "Courier New", monospace;
  --body: "Rubik", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--sky-top);
  background-image: linear-gradient(180deg, var(--sky-top) 0%, #101f4c 55%, var(--sky-low) 100%);
  background-attachment: fixed;
  color: var(--ink); font: 400 16px/1.6 var(--body);
  padding-inline: 16px; overflow-x: hidden;
}
#stars { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.wrap { position: relative; z-index: 1; width: 100%; max-width: 1040px; margin: 0 auto; flex: 1; }
nav.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 20px 0 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 24px/1 var(--display); letter-spacing: 0.03em; }
.brand img { width: 34px; height: 34px; image-rendering: pixelated; border-radius: 6px; }
.brand .b { color: var(--bleu); } .brand .w { color: #fff; } .brand .r { color: var(--rouge); }
.links { display: flex; gap: 6px; flex-wrap: wrap; }
.links a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 8px 12px; border-radius: 6px; }
.links a:hover { color: var(--ink); background: rgba(255,255,255,0.06); }
.links a[aria-current="page"] { color: #1a1300; background: var(--gold); }

h1 { font: 700 clamp(32px, 5.5vw, 54px)/1.05 var(--display); margin: 10px 0 10px; letter-spacing: 0.02em; text-shadow: 0 4px 0 rgba(0,0,0,0.35); overflow-wrap: break-word; }
h1 .g, .gold { color: var(--gold); }
h2 { font: 700 22px/1.15 var(--display); margin: 0 0 10px; letter-spacing: 0.02em; color: var(--gold); }
code { font-family: var(--mono); font-size: 0.92em; background: rgba(255,255,255,0.07); padding: 1px 5px; border-radius: 3px; color: var(--ink); }
.muted { color: var(--muted); }
.center { text-align: center; }
a { color: var(--gold); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin: 0 0 16px; min-width: 0; }
.btn, button { display: inline-block; border: 0; border-radius: 6px; cursor: pointer; text-decoration: none; text-align: center;
  font: 700 15px/1.2 var(--display); letter-spacing: 0.04em; padding: 12px 14px; color: #1a1300; background: var(--gold);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25); }
.btn:hover, button:hover { filter: brightness(1.08); }
.btn:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
button:disabled { opacity: .6; cursor: wait; }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; font: 600 14px/1 var(--body); padding: 10px 14px; }
.ghost:hover { background: rgba(255,255,255,0.06); filter: none; }

/* connexion */
.login { max-width: 460px; margin: 30px auto 40px; text-align: center; }
.login .sub { color: var(--muted); margin: 0 0 22px; }
.login .sub b { color: var(--ink); font-weight: 500; }
.form { display: grid; gap: 6px; text-align: left; }
.form label { font-weight: 600; font-size: 14px; margin-top: 6px; }
.form input { width: 100%; font: 500 17px/1.2 var(--mono); color: var(--ink); background: rgba(0,0,0,0.35); border: 2px solid var(--line); border-radius: 8px; padding: 11px 12px; }
.form input:focus { border-color: var(--gold); outline: none; }
.form button { margin-top: 12px; width: 100%; }
.err { margin: 6px 0 0; color: #ffb3b3; background: rgba(255,77,77,0.1); border: 1px solid rgba(255,77,77,0.45); border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.help { text-align: left; margin-top: 18px; }
.help h2 { font-size: 18px; }
.help ol { margin: 0 0 10px; padding-left: 20px; color: var(--ink); }
.help li { margin: 4px 0; }
.help .muted { font-size: 14px; }

/* profil */
.phead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 22px 0 18px; }
.phead > div { flex: 1; min-width: 0; }
.phead h1 { margin: 0 0 6px; }
.head { width: 72px; height: 72px; image-rendering: pixelated; border-radius: 8px; background: rgba(255,255,255,0.06); box-shadow: 0 8px 20px rgba(0,0,0,0.35); }
.tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag { --c: #aaa; font: 700 14px/1 var(--display); letter-spacing: 0.04em; padding: 6px 10px; border-radius: 4px; color: #0b0f1e; background: var(--c); }
.status { font-size: 14px; color: var(--muted); }
.status.on { color: var(--vert); }
.status.on::before { content: "● "; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: center; min-width: 0; }
.stat .k { display: block; font: 600 12px/1 var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.stat .v { display: block; font: 700 24px/1.1 var(--body); overflow-wrap: anywhere; }
#s-sync { font-size: 13px; margin: 0 0 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ranks { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.ranks li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.ranks b { color: var(--gold); font-family: var(--display); font-size: 18px; }
.votes { display: flex; gap: 10px; flex-wrap: wrap; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font: 600 12px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
td.ok { color: var(--vert); }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

/* classements */
.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 20px 0 30px; }
.board ol { list-style: none; padding: 0; margin: 0; counter-reset: r; }
.board li { counter-increment: r; display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.board li::before { content: counter(r); width: 26px; flex: 0 0 auto; text-align: center; font: 700 16px/1 var(--display); color: var(--muted); }
.board li:nth-child(1)::before { color: #ffd54a; } .board li:nth-child(2)::before { color: #d6dde8; } .board li:nth-child(3)::before { color: #e09b5a; }
.board li.me { background: rgba(242,193,78,0.1); border-radius: 6px; }
.board img { width: 24px; height: 24px; image-rendering: pixelated; border-radius: 3px; flex: 0 0 auto; }
.board .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .n small { color: var(--muted); }
.board .val { font-weight: 600; white-space: nowrap; }
.board .empty { color: var(--muted); font-size: 14px; }
.board .empty::before { content: none; }

footer { position: relative; z-index: 1; text-align: center; color: var(--muted); font-size: 13px; padding: 10px 0 30px; }
footer code { background: none; }

@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid2, .boards { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .phead h1 { font-size: clamp(24px, 7.5vw, 40px); }
  .phead .ghost { width: 100%; }
}
@media (max-width: 420px) { .stat .v { font-size: 20px; } }
