:root {
  --bg: #0f0d0a;
  --bg-2: #1a1611;
  --card: #1f1a14;
  --card-border: #3a3024;
  --text: #ece3d0;
  --muted: #a8997d;
  --gold: #e6c36a;
  --xp: #8a5cd6;
  --xp-2: #b48cff;
  --horde: #b3261e;
  --alliance: #2a5db0;
  --green: #4caf50;
  --yellow: #e0b030;
  --grey: #777;
  --red: #c0504d;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at top, var(--bg-2), var(--bg) 70%) fixed;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; width: min(1200px, 100% - 2rem); margin: 0 auto; }

.page-header { text-align: center; padding: 2.5rem 1rem 1.5rem; }
.page-header h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px rgba(230, 195, 106, 0.25);
}
.subtitle { color: var(--muted); margin: 0.5rem 0 0; }

.message { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  padding-bottom: 2rem;
}

/* ---------- card ---------- */

.card {
  --class-color: #b8a273;
  background: linear-gradient(180deg, color-mix(in srgb, var(--class-color) 10%, var(--card)), var(--card) 40%);
  border: 1px solid var(--card-border);
  border-top: 3px solid var(--class-color);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.card-missing { opacity: 0.75; }

.card-top { display: flex; gap: 1rem; align-items: center; }

.avatar {
  position: relative;
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 2px solid var(--class-color);
  background: #000;
}
.avatar img, .avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
}
.avatar-fallback { font-size: 2rem; font-family: Georgia, serif; color: var(--class-color); }
.level-badge {
  position: absolute;
  bottom: -6px;
  right: -6px;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 14px;
  background: var(--bg);
  border: 2px solid var(--gold);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
}

.identity { min-width: 0; }
.name {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  color: var(--class-color);
  overflow-wrap: anywhere;
}
.surname { color: var(--text); font-weight: 400; font-size: 1.1rem; }
.class-line { margin: 0.15rem 0 0; color: var(--muted); }
.tags { margin: 0.4rem 0 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  color: var(--muted);
}
.faction-horde { background: color-mix(in srgb, var(--horde) 30%, transparent); border-color: var(--horde); color: #ffd7d3; }
.faction-alliance { background: color-mix(in srgb, var(--alliance) 30%, transparent); border-color: var(--alliance); color: #d6e4ff; }

/* ---------- status ---------- */

.status { display: flex; align-items: center; gap: 0.45rem; font-size: 0.92rem; flex-wrap: wrap; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grey); flex: none; }
.status-label { font-weight: 600; }
.status-when { color: var(--muted); cursor: help; }
.status-recent .status-dot { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.status-recent .status-label { color: #8fdc92; }
.status-today .status-dot { background: var(--yellow); }
.status-today .status-label { color: #f0d080; }
.status-week .status-dot { background: #b08a3a; }
.status-missing .status-dot { background: var(--red); }
.status-missing .status-label { color: #f09a97; }

@keyframes pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .status-recent .status-dot { animation: none; } }

.card-note {
  margin: 0;
  font-size: 0.85rem;
  color: #f09a97;
  background: rgba(192, 80, 77, 0.12);
  border-left: 3px solid var(--red);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
}
.card-note.stale { color: #f0d080; background: rgba(224, 176, 48, 0.1); border-color: var(--yellow); }

/* ---------- bars ---------- */

.bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #0b0a08;
  border: 1px solid #2d261d;
  overflow: hidden;
}
.bar-fill { height: 100%; border-radius: inherit; transition: width 0.6s ease; }

.xp-head, .prof-head { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; margin-bottom: 0.3rem; }
.xp-level { color: var(--muted); }
.xp-numbers { font-variant-numeric: tabular-nums; }
.xp-bar { height: 18px; }
.xp-bar .bar-fill { background: linear-gradient(90deg, var(--xp), var(--xp-2)); box-shadow: 0 0 10px rgba(180, 140, 255, 0.4); }
.xp-percent {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-shadow: 0 1px 2px #000;
}
.xp-max { margin: 0; color: var(--gold); font-weight: 600; text-align: center; }

/* ---------- stats & professions ---------- */

.stats { display: flex; gap: 0.75rem; margin: 0; }
.stat {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}
.stat dt { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat dd { margin: 0.1rem 0 0; font-size: 1.15rem; font-weight: 700; color: var(--gold); }

.professions h3 { margin: 0 0 0.5rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.professions ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.prof-skill { color: var(--muted); font-variant-numeric: tabular-nums; }
.prof-bar .bar-fill { background: linear-gradient(90deg, #3c8d40, #6cc070); }
.professions li.secondary .prof-bar .bar-fill { background: linear-gradient(90deg, #8d6a2c, #c49a4a); }
.professions li.secondary .prof-name::after { content: " · secondaire"; color: var(--muted); font-size: 0.75rem; }

/* ---------- footer ---------- */

.page-footer { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 1.5rem 1rem 2rem; }
.page-footer p { margin: 0.25rem 0; }
#updated { cursor: help; }
#updated.outdated { color: var(--yellow); }
#updated.outdated::after { content: " — API Blizzard injoignable ou mise à jour automatique bloquée"; }
.legal { opacity: 0.6; font-size: 0.75rem; }
