/* ==========================================================================
   Panel Raccoon City
   Palette « crépuscule d'ardoise » : le raton laveur sort la nuit,
   la lanterne marque ce qui est vivant et ce qui demande d'agir.
   ========================================================================== */

:root {
  --ink: #1B2028;
  --ink-2: #222935;
  --ink-3: #2B3340;
  --ink-4: #333C4B;
  --line: #364050;
  --line-soft: #2D3542;
  --fur: #E8ECF1;
  --ash: #9AA5B4;
  --ash-2: #717D8D;
  --lantern: #F2B544;
  --lantern-ink: #2A1F08;
  --lantern-soft: rgba(242, 181, 68, 0.13);
  --moss: #5FB37E;
  --moss-soft: rgba(95, 179, 126, 0.14);
  --ember: #E0604F;
  --ember-soft: rgba(224, 96, 79, 0.14);
  --frost: #6FA8DC;
  --frost-soft: rgba(111, 168, 220, 0.14);

  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Menlo, monospace;

  --r-s: 6px;
  --r-m: 10px;
  --r-l: 18px;
  --rail: 236px;
  --top: 60px;
  --shadow-pop: 0 18px 50px rgba(8, 10, 14, 0.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--fur);
  font: 400 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; }
a { color: var(--lantern); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lantern); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--lantern); color: var(--lantern-ink); }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 800; }
h2 { font-size: 19px; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.35; }
p { margin: 0; }
.muted { color: var(--ash); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }

/* ------------------------------ Structure ------------------------------ */

.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--ink-2); border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; padding: 18px 12px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; }
.brand img { width: 36px; height: 36px; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 18px; line-height: 1.05; }
.brand-sub { color: var(--ash); font-size: 12.5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { color: var(--ash-2); font-size: 12.5px; padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-s);
  color: var(--ash); font-weight: 700; font-size: 14.5px; text-decoration: none;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--ink-3); color: var(--fur); }
.nav a.active { background: var(--lantern-soft); color: var(--lantern); }
.nav a .count {
  margin-left: auto; font-size: 12px; background: var(--ink-4); color: var(--fur);
  border-radius: 99px; padding: 0 8px; line-height: 20px;
}
.nav a.active .count { background: var(--lantern); color: var(--lantern-ink); }
.rail-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line-soft); color: var(--ash-2); font-size: 12.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top);
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: rgba(27, 32, 40, 0.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .menu-btn { display: none; }
.page { padding: 28px 28px 60px; max-width: 1320px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .lead { color: var(--ash); margin-top: 4px; max-width: 70ch; }

/* ------------------------------ Pastille d'état ------------------------------ */

.status-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 10px;
  border-radius: 99px; background: var(--ink-3); font-weight: 700; font-size: 13.5px;
}
.status-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ash-2); }
.status-pill[data-state="online"] .dot { background: var(--moss); box-shadow: 0 0 0 4px var(--moss-soft); }
.status-pill[data-state="starting"] .dot,
.status-pill[data-state="restarting"] .dot { background: var(--lantern); animation: pulse 1.2s infinite; }
.status-pill[data-state="offline"] .dot { background: var(--ember); }
@keyframes pulse { 50% { opacity: 0.35; } }

.server-select { background: transparent; border: 0; font-family: var(--font-display); font-weight: 700; font-size: 17px; padding: 4px; }
.server-select option { background: var(--ink-2); }
.server-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.status-pill { white-space: nowrap; flex: none; }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 9px; background: transparent; border: 1px solid transparent;
  border-radius: 99px; padding: 4px 12px 4px 4px; cursor: pointer;
}
.user-btn:hover { border-color: var(--line); }
.initials {
  width: 30px; height: 30px; border-radius: 50%; background: var(--ink-4); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--fur);
}
.popover {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 40;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-m);
  box-shadow: var(--shadow-pop); padding: 6px;
}
.popover .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.popover button, .popover a {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-s);
  background: none; border: 0; cursor: pointer; color: var(--fur); text-align: left; font-weight: 700; font-size: 14px;
}
.popover button:hover, .popover a:hover { background: var(--ink-3); text-decoration: none; }
.popover svg { width: 16px; height: 16px; color: var(--ash); }

/* ------------------------------ Boutons & champs ------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--r-s); border: 1px solid var(--line);
  background: var(--ink-3); color: var(--fur); font-weight: 700; font-size: 14px; cursor: pointer;
  white-space: nowrap; text-decoration: none;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { background: var(--ink-4); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--lantern); border-color: var(--lantern); color: var(--lantern-ink); }
.btn.primary:hover { background: #F6C463; }
.btn.danger { background: transparent; border-color: rgba(224, 96, 79, 0.55); color: #F08A7B; }
.btn.danger:hover { background: var(--ember-soft); }
.btn.danger.solid { background: var(--ember); border-color: var(--ember); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ash); }
.btn.ghost:hover { background: var(--ink-3); color: var(--fur); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13.5px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn.busy { pointer-events: none; opacity: 0.7; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-weight: 700; font-size: 13.5px; }
.field .hint { color: var(--ash); font-size: 13px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-s);
  background: var(--ink); border: 1px solid var(--line); color: var(--fur); font-size: 15px;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--lantern); box-shadow: 0 0 0 3px var(--lantern-soft); }
.input::placeholder, .textarea::placeholder { color: var(--ash-2); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ash-2); }
.search .input { padding-left: 36px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line); background: transparent;
  color: var(--ash); font-weight: 700; font-size: 13.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { color: var(--fur); border-color: var(--ash-2); }
.chip[aria-pressed="true"] { background: var(--fur); border-color: var(--fur); color: var(--ink); }
.chip .n { opacity: 0.7; font-weight: 400; }

.seg { display: inline-flex; background: var(--ink); border: 1px solid var(--line); border-radius: var(--r-s); padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--ash); font-weight: 700; font-size: 13.5px; padding: 5px 12px; border-radius: 4px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink-4); color: var(--fur); }

/* ------------------------------ Surfaces ------------------------------ */

.panel { background: var(--ink-2); border: 1px solid var(--line-soft); border-radius: var(--r-m); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.panel-head .hint { color: var(--ash); font-size: 13px; }
.panel-body { padding: 14px 18px 18px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 4px;
  font-size: 12.5px; font-weight: 700; background: var(--ink-4); color: var(--fur); white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge.lantern { background: var(--lantern-soft); color: var(--lantern); }
.badge.moss { background: var(--moss-soft); color: var(--moss); }
.badge.ember { background: var(--ember-soft); color: #F08A7B; }
.badge.frost { background: var(--frost-soft); color: var(--frost); }

.empty { padding: 34px 20px; text-align: center; color: var(--ash); }
.empty strong { display: block; color: var(--fur); font-family: var(--font-display); font-size: 17px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.skeleton { background: linear-gradient(90deg, var(--ink-3) 0%, var(--ink-4) 50%, var(--ink-3) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-s); }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-page { display: grid; gap: 16px; }
.loading-page .skeleton { height: 120px; }

.error-box { border: 1px solid rgba(224, 96, 79, 0.4); background: var(--ember-soft); border-radius: var(--r-m); padding: 14px 16px; color: #F4B1A7; }
.notice { border-radius: var(--r-m); padding: 12px 16px; background: var(--frost-soft); color: #B9D6F0; display: flex; gap: 10px; align-items: flex-start; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.notice.warn { background: var(--lantern-soft); color: #F6D48D; }

/* ------------------------------ Bande « Sur le serveur » (élément fort) ------------------------------ */

.presence {
  position: relative; overflow: hidden; border-radius: var(--r-l); padding: 26px 28px 28px;
  background:
    radial-gradient(900px 260px at 12% -40%, rgba(242, 181, 68, 0.16), transparent 70%),
    linear-gradient(180deg, #252C38, #20262F);
  border: 1px solid var(--line-soft);
}
.presence-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.presence-count { font-family: var(--font-display); font-weight: 800; font-size: 56px; line-height: 0.9; letter-spacing: -0.03em; }
.presence-count small { font-size: 22px; color: var(--ash); font-weight: 700; letter-spacing: 0; }
.presence-title { font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.presence-sub { color: var(--ash); }
.presence-list { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 24px; }
.presence-player { display: flex; flex-direction: column; align-items: center; gap: 9px; width: 92px; text-decoration: none; color: var(--fur); }
.presence-player:hover { text-decoration: none; }
.presence-player .head {
  width: 68px; height: 68px; border-radius: 14px; image-rendering: pixelated; background: var(--ink-3);
  box-shadow: 0 0 0 3px var(--ink-2), 0 0 0 5px var(--lantern), 0 0 28px 4px rgba(242, 181, 68, 0.38);
  transition: transform 0.15s ease;
}
.presence-player:hover .head { transform: translateY(-3px); }
.presence-player .pname { font-weight: 700; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presence-player .ptime { color: var(--ash); font-size: 12.5px; margin-top: -6px; }
.presence-empty { margin-top: 18px; color: var(--ash); max-width: 60ch; }
.restart-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; padding: 12px 14px;
  border-radius: var(--r-m); background: rgba(27, 32, 40, 0.6); border: 1px solid rgba(242, 181, 68, 0.35);
}
.restart-banner strong { font-family: var(--font-display); font-size: 17px; }

/* Bande de mesures (pas des cartes identiques : une seule rangée d'instruments) */
.vitals { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 18px; background: var(--ink-2); border: 1px solid var(--line-soft); border-radius: var(--r-m); }
.vital { padding: 14px 16px 15px; border-left: 1px solid var(--line-soft); min-width: 0; }
.vital:first-child { border-left: 0; }
.vital .label { color: var(--ash); font-size: 13px; }
.vital .value { font-family: var(--font-display); font-weight: 700; font-size: 23px; line-height: 1.25; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vital .value.good { color: var(--moss); }
.vital .value.warn { color: var(--lantern); }
.vital .value.bad { color: var(--ember); }
.vital .meter { height: 4px; background: var(--ink-4); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.vital .meter i { display: block; height: 100%; background: var(--ash); border-radius: 2px; }
.vital .sub { color: var(--ash-2); font-size: 12.5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.quick { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------ Graphiques ------------------------------ */

.chart { position: relative; height: 180px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis-label { fill: var(--ash-2); font-size: 11px; font-family: var(--font-body); }
.chart .tip {
  position: absolute; pointer-events: none; background: var(--ink); border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 5px 9px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -115%); display: none; z-index: 2;
}
.chart .cursor { stroke: var(--ash-2); stroke-dasharray: 3 3; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--ash); }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.bars { display: flex; align-items: flex-end; gap: 5px; height: 120px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar i { display: block; width: 100%; max-width: 26px; background: var(--lantern); border-radius: 3px 3px 1px 1px; min-height: 2px; opacity: 0.85; }
.bars .bar span { font-size: 11px; color: var(--ash-2); }

/* ------------------------------ Fil d'activité ------------------------------ */

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.feed li:last-child { border-bottom: 0; }
.feed .ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--ink-3); color: var(--ash); }
.feed .ico svg { width: 15px; height: 15px; }
.feed .ico.join { background: var(--moss-soft); color: var(--moss); }
.feed .ico.leave { color: var(--ash-2); }
.feed .ico.death, .feed .ico.ban { background: var(--ember-soft); color: var(--ember); }
.feed .ico.advancement, .feed .ico.announce { background: var(--lantern-soft); color: var(--lantern); }
.feed .ico.server { background: var(--frost-soft); color: var(--frost); }
.feed .text { flex: 1; min-width: 0; }
.feed .when { color: var(--ash-2); font-size: 12.5px; white-space: nowrap; }

/* ------------------------------ Tableaux ------------------------------ */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th { text-align: left; color: var(--ash); font-weight: 700; font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.click { cursor: pointer; }
table.data tbody tr.click:hover td { background: rgba(255, 255, 255, 0.025); }
table.data td.right, table.data th.right { text-align: right; }

.who-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 7px; image-rendering: pixelated; background: var(--ink-3); flex: none; }
.avatar.online { box-shadow: 0 0 0 2px var(--ink-2), 0 0 0 4px var(--lantern); }
.who-cell .nm { font-weight: 700; }
.who-cell .sub { color: var(--ash-2); font-size: 12.5px; }
.flags { display: flex; gap: 5px; flex-wrap: wrap; }

/* ------------------------------ Fiche joueur ------------------------------ */

.player-hero { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; padding: 22px 24px; }
.player-hero .body-render { width: 96px; height: 216px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.45)); }
.player-hero h1 { font-size: 36px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.player-meta { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 12px; }
.player-meta div { min-width: 0; }
.player-meta .k { color: var(--ash); font-size: 13px; }
.player-meta .v { font-weight: 700; }
.uuid { color: var(--ash-2); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: none; border: 0; padding: 0; }
.uuid:hover { color: var(--fur); }
.uuid svg { width: 13px; height: 13px; }

.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.action-group h3 { font-size: 14px; color: var(--ash); font-family: var(--font-body); font-weight: 700; margin-bottom: 8px; }
.action-group .btns { display: flex; flex-wrap: wrap; gap: 6px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 14.5px; }
.kv dt { color: var(--ash); }
.kv dd { margin: 0; font-weight: 700; min-width: 0; }

.place { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.place:last-child { border-bottom: 0; }
.place .pico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--ink-3); }
.place .pico svg { width: 17px; height: 17px; }
.place .pico.home { background: var(--lantern-soft); color: var(--lantern); }
.place .pico.bed { background: var(--frost-soft); color: var(--frost); }
.place .pico.zone { background: var(--moss-soft); color: var(--moss); }
.place .pico.death { background: var(--ember-soft); color: var(--ember); }
.place .coords { font-family: var(--font-mono); font-size: 13px; color: var(--ash); }

.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px 18px; }
.statgrid .k { color: var(--ash); font-size: 13px; }
.statgrid .v { font-family: var(--font-display); font-weight: 700; font-size: 21px; }

.inventory { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; }
.slot {
  aspect-ratio: 1; border-radius: 6px; background: var(--ink); border: 1px solid var(--line-soft);
  position: relative; display: grid; place-items: center; padding: 3px; min-width: 0; overflow: hidden;
}
.slot.filled { background: var(--ink-3); border-color: var(--line); cursor: help; }
.slot .iname { font-size: 10px; line-height: 1.1; text-align: center; color: var(--fur); word-break: break-word; overflow: hidden; max-height: 100%; }
.slot .icount { position: absolute; right: 4px; bottom: 2px; font-size: 11px; font-weight: 700; color: var(--lantern); }
.slot.ench { box-shadow: inset 0 0 0 1px rgba(176, 132, 255, 0.55); }
.slot .mod { position: absolute; left: 4px; top: 2px; font-size: 9px; color: var(--ash-2); }
.inv-label { color: var(--ash); font-size: 13px; margin: 14px 0 6px; }
.inv-label:first-child { margin-top: 0; }

.notes-list { list-style: none; padding: 0; margin: 0; }
.notes-list li { padding: 11px 0; border-bottom: 1px solid var(--line-soft); display: flex; gap: 10px; align-items: flex-start; }
.notes-list li:last-child { border-bottom: 0; }

/* ------------------------------ Carte ------------------------------ */

.map-wrap { position: relative; height: calc(100vh - var(--top) - 190px); min-height: 420px; border-radius: var(--r-m); overflow: hidden; border: 1px solid var(--line-soft); background: #161A21; }
.map-wrap canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.map-wrap canvas.dragging { cursor: grabbing; }
.map-tools { position: absolute; left: 12px; top: 12px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 2; }
.map-tools .seg { background: rgba(27, 32, 40, 0.9); }
.map-zoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.map-legend { position: absolute; left: 12px; bottom: 12px; background: rgba(27, 32, 40, 0.9); border-radius: var(--r-s); padding: 8px 12px; font-size: 12.5px; display: flex; gap: 14px; flex-wrap: wrap; z-index: 2; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--ash); }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.map-coords { position: absolute; right: 12px; bottom: 12px; background: rgba(27, 32, 40, 0.9); border-radius: var(--r-s); padding: 6px 10px; font-family: var(--font-mono); font-size: 12px; color: var(--ash); z-index: 2; }
.map-tip { position: absolute; pointer-events: none; background: var(--ink); border: 1px solid var(--line); border-radius: var(--r-s); padding: 7px 10px; font-size: 13px; z-index: 3; display: none; max-width: 240px; }
.minimap { height: 260px; border-radius: var(--r-s); overflow: hidden; background: #161A21; position: relative; }
.minimap canvas { width: 100%; height: 100%; display: block; }

/* ------------------------------ Chat & console ------------------------------ */

.chat-box { display: flex; flex-direction: column; height: calc(100vh - var(--top) - 170px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.msg { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 5px 0; align-items: baseline; }
.msg .t { color: var(--ash-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.msg .n { font-weight: 700; margin-right: 6px; color: var(--frost); cursor: pointer; }
.msg .n.staff { color: var(--lantern); cursor: default; }
.msg .n:hover { text-decoration: underline; }
.msg .n.staff:hover { text-decoration: none; }
.day-sep { text-align: center; color: var(--ash-2); font-size: 12.5px; margin: 12px 0 6px; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line-soft); }

.terminal {
  background: #12151B; border: 1px solid var(--line-soft); border-radius: var(--r-m);
  display: flex; flex-direction: column; height: calc(100vh - var(--top) - 200px); min-height: 400px;
}
.term-out { flex: 1; overflow-y: auto; padding: 12px 16px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.term-out .l-warn { color: var(--lantern); }
.term-out .l-error { color: #F08A7B; }
.term-out .l-cmd { color: var(--moss); }
.term-out .l-out { color: #C7D0DC; background: rgba(95, 179, 126, 0.06); display: block; }
.term-out .l-dim { color: #7F8A99; }
.term-in { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line-soft); padding: 8px 10px 8px 16px; }
.term-in .prompt { color: var(--lantern); font-family: var(--font-mono); font-weight: 600; }
.term-in input { flex: 1; background: none; border: 0; font-family: var(--font-mono); font-size: 13.5px; height: 34px; color: var(--fur); }
.term-in input:focus { outline: none; }

/* ------------------------------ Sauvegardes ------------------------------ */

.tail-bar { height: 12px; border-radius: 99px; background: var(--ink-4); overflow: hidden; }
.tail-bar i {
  display: block; height: 100%; border-radius: 99px;
  /* anneaux de queue de raton */
  background: repeating-linear-gradient(90deg, var(--fur) 0 14px, var(--ash-2) 14px 22px);
  background-size: 22px 100%;
  animation: tail 0.9s linear infinite;
}
.tail-bar.indeterminate i { width: 40%; }
@keyframes tail { to { background-position: 22px 0; } }
.job { padding: 16px 18px; display: grid; gap: 10px; }

.disk { display: flex; align-items: center; gap: 12px; }
.disk .tail-bar { flex: 1; height: 8px; }
.disk .tail-bar i { animation: none; background: var(--ash); }

/* ------------------------------ Modales & toasts ------------------------------ */

dialog.modal {
  border: 1px solid var(--line); background: var(--ink-2); color: var(--fur); border-radius: var(--r-l);
  padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-pop);
}
dialog.modal::backdrop { background: rgba(10, 12, 16, 0.66); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop 0.16s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } }
.modal-head { padding: 20px 22px 0; display: flex; gap: 12px; align-items: flex-start; }
.modal-head h2 { font-size: 21px; }
.modal-body { padding: 14px 22px 4px; display: grid; gap: 14px; }
.modal-foot { padding: 18px 22px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal .danger-note { color: #F4B1A7; }
.secret-box { font-family: var(--font-mono); font-size: 18px; background: var(--ink); border: 1px dashed var(--lantern); border-radius: var(--r-s); padding: 12px; text-align: center; user-select: all; }

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 36px)); }
.toast {
  background: var(--ink-3); border: 1px solid var(--line); border-left: 4px solid var(--moss); border-radius: var(--r-s);
  padding: 11px 14px; box-shadow: var(--shadow-pop); font-size: 14px; animation: pop 0.18s ease-out;
}
.toast.error { border-left-color: var(--ember); }
.toast.info { border-left-color: var(--frost); }
.toast .out { font-family: var(--font-mono); font-size: 12px; color: var(--ash); margin-top: 4px; white-space: pre-wrap; max-height: 120px; overflow: auto; }

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

.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-art {
  position: relative; overflow: hidden;
  background:
    radial-gradient(600px 400px at 30% 35%, rgba(242, 181, 68, 0.18), transparent 70%),
    linear-gradient(160deg, #262E3A, #1B2028 70%);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 56px;
  border-right: 1px solid var(--line-soft);
}
.login-art .mask { position: absolute; left: 50%; top: 40%; width: min(420px, 70%); transform: translate(-50%, -50%); opacity: 0.95; }
.login-art h1 { font-size: 52px; line-height: 0.98; letter-spacing: -0.03em; max-width: 12ch; }
.login-art p { color: var(--ash); margin-top: 12px; max-width: 42ch; }
.login-form { display: grid; place-items: center; padding: 40px 24px; }
.login-form form { width: min(380px, 100%); display: grid; gap: 16px; }
.login-form h2 { font-size: 26px; }

/* ------------------------------ Divers ------------------------------ */

.kbd { font-family: var(--font-mono); font-size: 12px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--ash); }
.divider { height: 1px; background: var(--line-soft); margin: 4px 0; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; font-size: 13.5px; }
.perm-list span { display: flex; gap: 6px; align-items: center; color: var(--ash); }
.perm-list span.on { color: var(--fur); }
.perm-list svg { width: 14px; height: 14px; }
.qr { background: #fff; border-radius: var(--r-s); padding: 8px; width: 196px; height: 196px; }
.load-more { display: flex; justify-content: center; padding: 12px; }

/* ------------------------------ Responsive ------------------------------ */

@media (max-width: 1180px) {
  .vitals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .vital:nth-child(4) { border-left: 0; }
  .vital:nth-child(n + 4) { border-top: 1px solid var(--line-soft); }
  .grid.side { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 270px;
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-pop);
  }
  .shell.nav-open .rail { transform: none; }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(10, 12, 16, 0.55); z-index: 50; }
  .topbar .menu-btn { display: inline-flex; }
  .server-title, .server-select { font-size: 15.5px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .page { padding: 20px 14px 50px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .presence { padding: 20px; }
  .presence-count { font-size: 44px; }
  .presence-list { gap: 14px; }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 250px; padding: 28px; }
  .login-art .mask { width: 180px; top: 38%; }
  .login-art h1 { font-size: 34px; }
  .player-hero { grid-template-columns: 1fr; }
  .player-hero .body-render { display: none; }
  .hide-sm { display: none !important; }
  table.data { font-size: 14px; }
  table.data th, table.data td { padding: 9px 10px; }
  .user-btn .uname { display: none; }
}
@media (max-width: 560px) {
  .status-pill .muted { display: none; }
  .vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vital:nth-child(odd) { border-left: 0; }
  .vital:nth-child(4) { border-left: 1px solid var(--line-soft); }
  .vital:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
  .inventory { gap: 3px; }
  .slot .iname { font-size: 8.5px; }
  h1 { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
