/* ═══════════════════════════════════════════════════════════════
   Braises & Brume — DA du dashboard Enshrouded
   Palette : nuit #0b0a08 · flamme #e8a33d · braise #f5d9a0
             brume #5b7a8c · bleu profond #2a3540 · danger #c94f2e
   ═══════════════════════════════════════════════════════════════ */

:root {
  --night: #0b0a08;
  --night-2: #14110c;
  --card: #171310;
  --border: #2e2517;
  --iron: #3d3020;
  --flame: #e8a33d;
  --ember: #f5d9a0;
  --mist: #5b7a8c;
  --deep: #2a3540;
  --danger: #c94f2e;
  --ink: #ece4d4;
  --ink-2: #a89a80;
  --ink-3: #6d6250;
  --font-display: "Cinzel", "Georgia", serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Bandeau données figées ─────────────────────────────────── */
#stale-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--danger);
  color: #fff;
  text-align: center;
  padding: 0.45rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ═══ HÉRO ═══════════════════════════════════════════════════ */
.hero {
  text-align: center;
  padding: 3.5rem 1rem 2.5rem;
  position: relative;
  background:
    radial-gradient(ellipse 60% 45% at 50% 30%, rgba(232, 163, 61, 0.09), transparent 70%),
    linear-gradient(180deg, #0d0c09 0%, var(--night) 100%);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 7vw, 4rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ember);
  text-shadow: 0 0 40px rgba(232, 163, 61, 0.35);
  margin-top: 1.4rem;
}

.subtitle {
  color: var(--ink-2);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin-top: 0.6rem;
}

/* ── La Flamme de l'Autel (élément signature, CSS pur) ──────── */
.altar {
  width: 130px;
  height: 150px;
  margin: 0 auto;
  position: relative;
}

/* logo du jeu, auréolé selon l'état du serveur */
.hero-logo {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 128px;
  height: 128px;
  border-radius: 18px;
  filter: drop-shadow(0 0 26px rgba(232, 163, 61, 0.45));
  animation: breathe 4.5s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(232, 163, 61, 0.35)); }
  50%      { filter: drop-shadow(0 0 34px rgba(232, 163, 61, 0.6)); }
}

/* brume au pied de l'autel */
.altar .mist {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 34px;
  background: radial-gradient(ellipse at center, rgba(91, 122, 140, 0.28), transparent 70%);
  filter: blur(6px);
  animation: drift 7s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translateX(-58%) scaleX(1); opacity: 0.7; }
  to   { transform: translateX(-42%) scaleX(1.25); opacity: 1; }
}

/* ── états du logo selon le serveur ─────────────────────────── */
body[data-state="offline"] .hero-logo {
  animation: none;
  filter: grayscale(0.75) brightness(0.65) drop-shadow(0 0 22px rgba(91, 122, 140, 0.45));
}
body[data-state="offline"] .altar .mist { opacity: 1; height: 60px; width: 190px; }
body[data-state="offline"] .hero h1 { color: var(--mist); text-shadow: 0 0 30px rgba(91, 122, 140, 0.3); }

/* vive (joueurs présents) : halo plus intense */
body[data-state="lively"] .hero-logo { animation-duration: 2.2s; }

body[data-state="loading"] .hero-logo { opacity: 0.5; }

/* ── stats du héro ──────────────────────────────────────────── */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.hero-stat {
  background: var(--card);
  border: 1px solid var(--border);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  padding: 0.8rem 1.5rem;
  min-width: 130px;
}

.hero-stat .label {
  display: block;
  color: var(--ink-3);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 0.3rem;
}

.hero-stat .value { font-size: 1.15rem; font-weight: 600; }
.hero-stat .value.mono { font-family: var(--font-mono); }
.hero-stat .dim { color: var(--ink-3); }

#status-text.on { color: var(--flame); }
#status-text.off { color: var(--mist); }

/* ═══ SECTIONS ═══════════════════════════════════════════════ */
main {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 1.2rem 3rem;
}

section { margin-top: 3.2rem; }

h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ember);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.3rem;
}

/* filet fer forgé après chaque titre */
h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--iron) 0%, var(--border) 60%, transparent 100%);
  position: relative;
}

h3 {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 0.8rem;
}

h3 .unit { font-weight: 400; color: var(--ink-3); font-size: 0.8rem; }

.empty { color: var(--ink-3); font-style: italic; padding: 0.6rem 0; }

/* ── cartes joueurs en ligne ────────────────────────────────── */
.cards-row { display: flex; flex-wrap: wrap; gap: 0.9rem; }

.player-live {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: linear-gradient(135deg, #1d1710, var(--card));
  border: 1px solid var(--iron);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  padding: 0.7rem 1.2rem 0.7rem 0.8rem;
}

.player-live .avatar { box-shadow: 0 0 12px rgba(232, 163, 61, 0.35); }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: var(--deep);
  object-fit: cover;
  flex-shrink: 0;
}

.avatar.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  color: var(--mist);
  font-size: 1.3rem;
}

.player-live .p-name { font-weight: 600; }
.player-live .p-since { font-family: var(--font-mono); font-size: 0.78rem; color: var(--flame); }

/* ── Panthéon ───────────────────────────────────────────────── */
.pantheon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.board {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--iron);
  padding: 1.1rem 1.3rem;
}

.board ol { list-style: none; counter-reset: rank; }

.board li {
  counter-increment: rank;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid #201a12;
}

.board li:last-child { border-bottom: none; }

.board li::before {
  content: counter(rank);
  font-family: var(--font-display);
  color: var(--ink-3);
  font-size: 0.85rem;
  width: 1.1rem;
  text-align: right;
}

.board li:first-child::before { color: var(--flame); }
.board li:first-child .b-name { color: var(--ember); }

.board .b-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .b-val { font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-2); }

/* ── tuiles records ─────────────────────────────────────────── */
.records-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.record-tile {
  background: linear-gradient(160deg, #1b1610, var(--card));
  border: 1px solid var(--border);
  padding: 1rem 1.2rem;
  text-align: center;
}

.record-tile .r-label {
  color: var(--ink-3);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.record-tile .r-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--ember);
  margin-top: 0.25rem;
}

.record-tile .r-sub { color: var(--ink-2); font-size: 0.78rem; margin-top: 0.15rem; }

/* ── graphiques ─────────────────────────────────────────────── */
.chart-block {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1.1rem 1.3rem 0.9rem;
  margin-bottom: 1rem;
}

.chart svg { display: block; width: 100%; height: auto; }

.chart .bar { fill: var(--flame); }
.chart .bar:hover { fill: var(--ember); }
.chart .bar.zero { fill: #241d12; }
.chart .axis-label {
  fill: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
}
.chart .grid-line { stroke: #221c12; stroke-width: 1; }
.chart .cell:hover { stroke: var(--ember); stroke-width: 1.5; }

#tooltip {
  position: fixed;
  z-index: 100;
  background: #1f1811;
  border: 1px solid var(--iron);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.4rem 0.6rem;
  pointer-events: none;
  white-space: pre-line;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

/* ── grille des profils ─────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.9rem;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s;
}

.player-card:hover, .player-card:focus-visible { border-color: var(--flame); }
.player-card:focus-visible { outline: 2px solid var(--flame); outline-offset: 2px; }

.player-card .pc-name { font-weight: 600; display: block; }
.player-card .pc-sub { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-2); }

#player-detail {
  margin-top: 1rem;
  background: linear-gradient(135deg, #1d1710, var(--card));
  border: 1px solid var(--iron);
  padding: 1.2rem 1.4rem;
}

#player-detail .pd-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.9rem; }
#player-detail .pd-head .avatar { width: 56px; height: 56px; }
#player-detail h3 { font-family: var(--font-display); font-size: 1.15rem; color: var(--ember); margin: 0; }
#player-detail .pd-close {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-2);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font: inherit;
}
#player-detail .pd-close:hover { border-color: var(--flame); color: var(--ink); }

.pd-stats { display: flex; flex-wrap: wrap; gap: 1.6rem; margin-bottom: 1rem; }
.pd-stats div .label { color: var(--ink-3); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; display: block; }
.pd-stats div .value { font-family: var(--font-mono); color: var(--ink); font-size: 0.95rem; }

.pd-sessions { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.pd-sessions th { text-align: left; color: var(--ink-3); font-weight: 400; padding: 0.3rem 0.6rem 0.3rem 0; }
.pd-sessions td { font-family: var(--font-mono); padding: 0.28rem 0.6rem 0.28rem 0; border-top: 1px solid #201a12; color: var(--ink-2); }

/* ── timeline chroniques ────────────────────────────────────── */
.timeline { list-style: none; border-left: 1px solid var(--iron); padding-left: 1.3rem; }

.timeline li { position: relative; padding: 0.32rem 0; }

.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-1.3rem - 4px);
  top: 0.85rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}

.timeline li.ev-login::before { background: var(--flame); box-shadow: 0 0 6px rgba(232, 163, 61, 0.6); }
.timeline li.ev-logout::before { background: var(--mist); }
.timeline li.ev-server_start::before { background: var(--ember); }
.timeline li.ev-server_stop::before { background: var(--danger); }

.timeline .t-date { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3); margin-right: 0.7rem; }
.timeline .t-name { color: var(--ember); font-weight: 600; }

/* ── Codex ──────────────────────────────────────────────────── */
.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.7rem;
}

.codex-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 2px solid var(--iron);
  padding: 0.55rem 0.9rem;
  font-size: 0.83rem;
}

.codex-item .c-key { color: var(--ink-2); }
.codex-item .c-val { font-family: var(--font-mono); color: var(--ember); white-space: nowrap; }
.codex-item.modified { border-left-color: var(--flame); }

/* ═══ FOOTER + brume du Shroud ═══════════════════════════════ */
footer {
  position: relative;
  text-align: center;
  padding: 4.5rem 1rem 2rem;
  color: var(--ink-3);
  font-size: 0.78rem;
  overflow: hidden;
}

.shroud {
  position: absolute;
  inset: auto 0 0 0;
  height: 110px;
  background:
    radial-gradient(ellipse 55% 90% at 18% 100%, rgba(91, 122, 140, 0.16), transparent 70%),
    radial-gradient(ellipse 65% 100% at 55% 100%, rgba(42, 53, 64, 0.35), transparent 75%),
    radial-gradient(ellipse 50% 80% at 88% 100%, rgba(91, 122, 140, 0.13), transparent 70%);
  animation: shroud-drift 14s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes shroud-drift {
  from { transform: translateX(-2.5%) scaleY(1); }
  to   { transform: translateX(2.5%) scaleY(1.15); }
}

footer p { position: relative; }

/* ═══ Accessibilité & responsive ═════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

@media (max-width: 640px) {
  .hero { padding-top: 2.2rem; }
  .hero-stats { gap: 0.6rem; }
  .hero-stat { min-width: calc(50% - 0.6rem); padding: 0.65rem 1rem; }
  h2 { font-size: 1.15rem; }
  .pd-sessions th:nth-child(4), .pd-sessions td:nth-child(4) { display: none; }
}
