/* Site du serveur Skyblock — thème sombre façon Minecraft (ardoise des abîmes, boutons et cases pixelisés).
   Mise en page : barre du haut + colonne centrale ; le panel de l'équipe ajoute un menu à gauche. */
:root {
  --bg: #121418;          /* ardoise des abîmes */
  --bg-2: #181b21;
  --panel: #1e2229;       /* case d'inventaire */
  --panel-2: #262b34;
  --line: #07080a;        /* bord noir des pixels */
  --hi: #3b424e;          /* reflet du haut des boutons */
  --fg: #ebe7dc;
  --muted: #9aa1ad;
  --grass: #6fbf4a;       /* herbe : couleur principale */
  --grass-dark: #3f7d2a;
  --gold: #f3c14b;
  --diamond: #5fe0e6;
  --redstone: #e5484d;
  --amethyst: #b98cf0;
  --display: "Pixelify Sans", "Courier New", monospace;
  --body: "Rubik", "Segoe UI", system-ui, -apple-system, sans-serif;
  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.125rem;
  --step-2: 1.5rem;
  --step-3: 2.25rem;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--step-0)/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg-2);
}
a { color: var(--diamond); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: 0.01em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.green { color: var(--grass); }
.red { color: var(--redstone); }
.diamond { color: var(--diamond); }

/* ---------- Barre du haut ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--bg-2);
  border-bottom: 3px solid var(--line);
  box-shadow: 0 2px 0 var(--hi) inset;
}
.top-in {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--fg); }
.logo:hover { text-decoration: none; }
.logo-block {
  width: 30px; height: 30px; flex: none;
  background: linear-gradient(var(--grass) 0 40%, #7a5532 40% 100%);
  border: 3px solid var(--line);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.18), inset -3px -3px 0 rgba(0,0,0,.25);
}
.logo-text { font-family: var(--display); font-size: 1.35rem; font-weight: 700; letter-spacing: .04em; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.nav a {
  color: var(--muted); padding: 6px 10px; font-weight: 500;
  border: 2px solid transparent;
}
.nav a:hover { color: var(--fg); text-decoration: none; background: var(--panel); }
.nav a.on { color: var(--fg); background: var(--panel-2); border-color: var(--line); box-shadow: inset 0 2px 0 var(--hi); }
.nav a.staff { color: var(--gold); }
.who { display: flex; align-items: center; gap: 10px; }

/* ---------- Pages ---------- */
main {
  max-width: 1240px; margin: 0 auto;
  padding-block: 28px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 24px;
}
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); max-width: 65ch; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .tiles { grid-template-columns: 1fr; } }
.grid > *, .row > * { min-width: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; gap: 12px; }

/* Case d'inventaire */
.slot {
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 rgba(0,0,0,.35);
  padding: 18px;
  display: grid; gap: 14px; align-content: start;
}
.slot-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.slot-title h2, .slot-title h3 { font-size: var(--step-1); }
.label { font-size: var(--step--1); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; }

/* Chiffres */
.stat { display: grid; gap: 2px; }
.stat b { font-family: var(--display); font-size: clamp(1.25rem, 2.1vw, 1.9rem); overflow-wrap: anywhere; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }

/* Boutons façon Minecraft */
.btn {
  font: 500 var(--step-0) var(--body); color: var(--fg); cursor: pointer;
  background: #4a505b; padding: 8px 14px;
  border: 2px solid var(--line);
  box-shadow: inset 0 2px 0 #6c737f, inset 0 -3px 0 #2e323a;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
}
.btn:hover { background: #586070; text-decoration: none; }
.btn:active { box-shadow: inset 0 3px 0 #2e323a; }
.btn.primary { background: var(--grass-dark); box-shadow: inset 0 2px 0 #63a845, inset 0 -3px 0 #24501a; }
.btn.primary:hover { background: #4c9533; }
.btn.danger { background: #8e2b2e; box-shadow: inset 0 2px 0 #c2484b, inset 0 -3px 0 #5a1517; }
.btn.danger:hover { background: #a63236; }
.btn.small { padding: 4px 10px; font-size: var(--step--1); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Champs */
input, select, textarea {
  font: 400 var(--step-0) var(--body); color: var(--fg);
  background: #0d0f12; border: 2px solid var(--line);
  box-shadow: inset 0 0 0 1px #2b313b;
  padding: 8px 10px; min-width: 0; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--diamond); outline-offset: 0; }
label.field { display: grid; gap: 4px; font-size: var(--step--1); color: var(--muted); }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
form.inline label.field { flex: 1 1 140px; }
form.inline .btn { flex: none; }

/* Tableaux */
.table-wrap { overflow-x: auto; border: 2px solid var(--line); background: var(--bg-2); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid #262b33; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 240px; }
th { font-size: var(--step--1); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; background: var(--panel); position: sticky; top: 0; }
tbody tr:hover { background: #1c2027; }
tr.click { cursor: pointer; }
td.r, th.r { text-align: right; }

/* Pastilles */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; font-size: var(--step--1); border: 2px solid var(--line); background: var(--panel-2); white-space: nowrap; }
.pill.on::before { content: ""; width: 8px; height: 8px; background: var(--grass); box-shadow: 0 0 6px var(--grass); }
.pill.off::before { content: ""; width: 8px; height: 8px; background: #555b66; }
.pill.warn { color: var(--gold); }
.pill.bad { color: var(--redstone); }
.grade { font-weight: 600; }

/* Barres de progression (XP) */
.bar { height: 12px; background: #0b0d10; border: 2px solid var(--line); position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#9be36b, var(--grass)); }
.bar.gold > i { background: linear-gradient(#ffe08a, var(--gold)); }
.bar.diamond > i { background: linear-gradient(#a9f6f8, var(--diamond)); }

/* Têtes de joueurs */
.head { width: 32px; height: 32px; image-rendering: pixelated; border: 2px solid var(--line); background: var(--panel-2); flex: none; }
.head.big { width: 72px; height: 72px; }
.letter { display: inline-grid; place-items: center; font-family: var(--display); font-weight: 700; color: var(--bg); background: var(--grass); }
.player { display: inline-flex; align-items: center; gap: 8px; }

/* Héros de l'accueil */
.hero {
  position: relative; overflow: hidden;
  border: 3px solid var(--line);
  background:
    linear-gradient(180deg, rgba(18,20,24,0) 55%, var(--bg) 100%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 2px, transparent 2px 32px),
    linear-gradient(180deg, #1b2b3d 0%, #24405a 55%, #1c3324 100%);
  padding: 40px 28px;
  display: grid; gap: 14px;
}
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.hero p { color: #c8d1db; max-width: 60ch; }
.island-pixel {
  position: absolute; right: 6%; bottom: 18px; width: 180px; height: 120px; opacity: .9;
  background:
    linear-gradient(var(--grass) 0 0) 20px 30px / 140px 16px no-repeat,
    linear-gradient(#7a5532 0 0) 30px 46px / 120px 22px no-repeat,
    linear-gradient(#5e6064 0 0) 50px 68px / 80px 18px no-repeat,
    linear-gradient(#45474b 0 0) 70px 86px / 40px 14px no-repeat,
    linear-gradient(#5b8d32 0 0) 60px 0 / 36px 30px no-repeat,
    linear-gradient(#6b4a2a 0 0) 72px 0 / 12px 30px no-repeat;
}
@media (max-width: 720px) { .island-pixel { display: none; } }

/* Onglets */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 3px solid var(--line); }
.tabs button {
  font: 500 var(--step-0) var(--body); color: var(--muted); background: transparent; cursor: pointer;
  border: 2px solid transparent; border-bottom: none; padding: 8px 14px;
}
.tabs button:hover { color: var(--fg); }
.tabs button.on { color: var(--fg); background: var(--panel); border-color: var(--line); box-shadow: inset 0 2px 0 var(--hi); }

/* Panel de l'équipe */
.staff-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.staff-nav { display: grid; gap: 4px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 80px); }
.staff-nav a { color: var(--muted); padding: 8px 12px; border: 2px solid transparent; font-weight: 500; }
.staff-nav a:hover { color: var(--fg); background: var(--panel); text-decoration: none; }
.staff-nav a.on { color: var(--gold); background: var(--panel); border-color: var(--line); box-shadow: inset 0 2px 0 var(--hi); }
@media (max-width: 860px) {
  .staff-layout { grid-template-columns: 1fr; }
  .staff-nav { position: static; display: flex; flex-wrap: wrap; }
}

/* Événement en direct */
.live { border-left: 6px solid var(--gold); }
.live.question { border-left-color: var(--amethyst); }
.choices { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.choices span { background: var(--panel-2); border: 2px solid var(--line); padding: 6px 10px; }

/* Journal */
.log { display: grid; gap: 0; max-height: 460px; overflow-y: auto; border: 2px solid var(--line); background: var(--bg-2); }
.log div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 6px 12px; border-bottom: 1px solid #22262d; font-size: var(--step--1); }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .log div { grid-template-columns: 1fr; gap: 0; } }

/* Messages, fenêtres */
.toasts { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel-2); border: 3px solid var(--line); box-shadow: inset 0 2px 0 var(--hi); padding: 10px 14px; border-left: 6px solid var(--grass); }
.toast.err { border-left-color: var(--redstone); }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { width: min(480px, 100%); }
.banner { background: #3a2f12; border: 3px solid var(--line); color: var(--gold); padding: 10px 14px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 2px dashed #2b313b; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--panel-2); border: 2px solid var(--line); padding: 2px 8px; font-size: var(--step--1); }
details > summary { cursor: pointer; color: var(--diamond); }
.footer { color: var(--muted); font-size: var(--step--1); text-align: center; padding-block: 24px; border-top: 3px solid var(--line); }
.loading { color: var(--muted); padding: 40px; text-align: center; font-family: var(--display); }
.split { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.cat-list { display: grid; gap: 4px; max-height: 70vh; overflow-y: auto; }
.cat-list button { text-align: left; font: 500 var(--step-0) var(--body); color: var(--muted); background: var(--panel); border: 2px solid var(--line); padding: 8px 10px; cursor: pointer; }
.cat-list button.on, .cat-list button:hover { color: var(--fg); background: var(--panel-2); box-shadow: inset 0 2px 0 var(--hi); }

@media (prefers-reduced-motion: no-preference) {
  .slot, .hero { animation: rise .25s ease-out both; }
  @keyframes rise { from { transform: translateY(4px); opacity: .6; } to { transform: none; opacity: 1; } }
}

/* Petits écrans : le menu devient une ligne qu'on fait défiler, la barre du haut ne reste plus collée. */
@media (max-width: 760px) {
  .top { position: static; }
  .nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav a { white-space: nowrap; }
  .who { margin-left: auto; }
  .who .player span:last-child { display: none; }
}
/* Formulaires dans un tableau (paliers d'une île) : sur une ligne. */
td form.inline { flex-wrap: nowrap; align-items: center; }
td form.inline label.field { flex: 0 0 76px; font-size: 0; gap: 0; }
td form.inline label.field input { font-size: var(--step-0); padding: 4px 8px; }

/* Version 4.1 : messages du chat (signalements, chat de l'équipe) */
.chatlog { background: #0d0f13; border: 2px solid #2b313b; padding: 10px 12px; max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.chatlog p { margin: 0; overflow-wrap: anywhere; }
.stat.click { cursor: pointer; }
.stat.click:hover { border-color: var(--gold); }
.cols-week { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
/* 4.2 : un onglet de plus dans le menu du haut, on resserre pour rester sur une ligne */
.top-in { gap: 12px; }
.nav a { padding: 6px 8px; }
.staff-btn { color: var(--gold); }
.staff-btn.on { border-color: var(--gold); }

/* ---------- Wiki ---------- */
.wiki-h { font-family: var(--display); font-size: var(--step-1); margin: 0; }
.wiki-card { display: flex; flex-direction: column; gap: 6px; color: var(--fg); text-decoration: none; }
.wiki-card:hover { text-decoration: none; background: var(--panel-2); }
.wiki-card b { color: var(--gold); }
.wiki-card.ref b { color: var(--diamond); }
.wiki-hit { display: flex; flex-direction: column; gap: 4px; color: var(--fg); padding: 12px 16px; }
.wiki-hit:hover { text-decoration: none; background: var(--panel-2); }
.wiki-nav .label { padding: 12px 12px 2px; }
.md { line-height: 1.6; max-width: 76ch; }
.md h2 { font-family: var(--display); font-size: var(--step-2); margin: 0 0 12px; }
.md h3 { font-family: var(--display); font-size: var(--step-1); margin: 22px 0 8px; color: var(--gold); }
.md h4 { margin: 16px 0 6px; }
.md p, .md ul, .md ol { margin: 0 0 12px; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 4px 0; }
.md code, .slot code { background: var(--bg); border: 1px solid var(--line); padding: 1px 6px; font-size: .92em; overflow-wrap: anywhere; }
.md .note { border-left: 4px solid var(--diamond); background: var(--bg-2); padding: 10px 14px; margin: 0 0 12px; }
.wiki-edit textarea { width: 100%; font-family: ui-monospace, "Courier New", monospace; font-size: var(--step--1); resize: vertical; }
@media (max-width: 860px) { .wiki-nav { display: none; } }
