/* ══════════════════════════════════════════════
   EXILIUM — PLAYER MODAL
   Overlay, card, hero render, stats, XP breakdown.
   ══════════════════════════════════════════════ */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0);
  display: none;
  align-items: center; justify-content: center;
  z-index: 200;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}
.modal-overlay.open {
  display: flex;
  animation: modalOverlayIn 0.45s var(--ease-premium) forwards;
}
.modal-overlay.closing {
  animation: modalOverlayOut 0.3s var(--ease-premium) forwards;
}

.modal {
  background: linear-gradient(180deg, var(--card) 0%, rgba(18,18,31,0.98) 100%);
  border: 1px solid rgba(200,146,42,0.35) !important;
  border-radius: 3px !important;
  width: 90%; max-width: 720px; max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.5s var(--ease-out-expo);
  box-shadow:
    0 0 0 1px rgba(200,146,42,0.08),
    0 40px 100px rgba(0,0,0,0.95),
    0 0 120px rgba(200,146,42,0.08) !important;
}
.modal.closing {
  animation: modalOut 0.3s var(--ease-premium) forwards;
}
.modal::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px !important; z-index: 5;
  background: linear-gradient(90deg,
    transparent, var(--gold-dim), var(--gold), var(--gold-bright),
    var(--gold-pale), var(--gold-bright), var(--gold), var(--gold-dim), transparent) !important;
  animation: goldShimmer 4s linear infinite !important;
  background-size: 300% auto !important;
}
.modal::after {
  content: '';
  position: absolute; inset: 3px;
  border: 1px solid rgba(200,146,42,0.06);
  border-radius: 2px;
  pointer-events: none; z-index: 4;
}

/* ── Modal hero ── */
.modal-hero {
  display: flex; min-height: 220px;
  position: relative; overflow: hidden;
}
.modal-render {
  width: 190px; flex-shrink: 0;
  position: relative;
  background-image: url('img/sanctum.png') !important;
  background-size: cover !important;
  background-position: center !important;
  overflow: hidden;
}
.modal-render img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  display: block;
  transition: transform 0.6s var(--ease-premium);
}
.modal-render:hover img { transform: scale(1.05); }
.modal-render-fallback {
  width: 100%; height: 100%; min-height: 220px;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; opacity: 0.4;
  background: linear-gradient(135deg, var(--deep) 0%, rgba(200,146,42,0.06) 50%, var(--abyss) 100%);
}
.modal-render::after {
  content: '';
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 80px;
  background: linear-gradient(90deg, transparent, var(--card));
}
.modal-glow {
  position: absolute; inset: 0;
  pointer-events: none; opacity: 0.35;
  animation: modalGlowPulse 5s ease-in-out infinite alternate;
}

/* ── Modal info ── */
.modal-info {
  flex: 1;
  padding: 28px 28px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.modal-name {
  font-family: 'Cinzel Decorative', serif;
  font-size: 24px !important; font-weight: 900;
  letter-spacing: 1.5px !important;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-bright) 40%, var(--gold-pale) 60%, var(--gold-bright) 80%, var(--gold) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  animation: goldShimmer 5s linear infinite;
  filter: drop-shadow(0 0 15px rgba(232,184,75,0.2));
}
.modal-sub {
  font-size: 13px; color: var(--text-dim);
  margin-top: 2px; letter-spacing: 0.5px;
}
.modal-rank-display {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.modal-rank-name { font-family: 'Cinzel', serif; font-size: 20px; font-weight: 700; }
.modal-rank-lvl { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; letter-spacing: 1px; }

/* ── Close button ── */
.modal-close {
  position: absolute; top: 16px; right: 16px; z-index: 10;
  backdrop-filter: blur(8px) !important;
  background: rgba(5,5,10,0.7) !important;
  border: 1px solid rgba(200,146,42,0.25) !important;
  border-radius: 2px !important;
  color: var(--text-dim);
  font-size: 14px !important;
  cursor: pointer;
  width: 32px !important; height: 32px !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  padding: 0 !important;
  transition: all 0.35s var(--ease-premium);
}
.modal-close:hover {
  color: var(--gold-pale);
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(200,146,42,0.2);
  transform: scale(1.1) rotate(3deg);
}
.modal-close:active { transform: scale(0.92); }

/* ── Modal body ── */
.modal-body { padding: 24px 28px; }

.modal-stats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 10px; margin-bottom: 20px;
}
.modal-stat {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 2px;
  padding: 14px 8px; text-align: center;
  transition: all 0.4s var(--ease-premium);
  position: relative; overflow: hidden;
}
.modal-stat::before {
  content: '';
  position: absolute; inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 50% 0%, rgba(200,146,42,0.06) 0%, transparent 60%);
  transition: opacity 0.4s;
}
.modal-stat:hover {
  border-color: rgba(200,146,42,0.2);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}
.modal-stat:hover::before { opacity: 1; }
.modal-stat .val {
  font-family: 'Cinzel', serif;
  font-size: 22px !important; font-weight: 700;
  letter-spacing: 0.5px !important;
  color: var(--gold-bright);
  display: block;
  transition: all 0.35s var(--ease-premium);
}
.modal-stat:hover .val {
  text-shadow: 0 0 20px currentColor !important;
  transform: scale(1.06);
}
.modal-stat .lbl {
  font-size: 9px; color: var(--text-muted);
  letter-spacing: 1.5px; text-transform: uppercase;
  margin-top: 3px;
}
.modal-stat .rec { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── XP breakdown ── */
.modal-xp {
  background: var(--surface);
  border-radius: 2px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,0.04);
  position: relative;
}
.modal-xp::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,146,42,0.12), transparent);
}
.modal-xp h4 {
  font-family: 'Cinzel', serif;
  font-size: 10px; color: var(--gold);
  letter-spacing: 3px; text-transform: uppercase;
  margin-bottom: 14px;
}

.xp-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.025);
  transition: all 0.3s var(--ease-premium);
}
.xp-row:hover { background: rgba(200,146,42,0.03); padding-left: 6px; }
.xp-row:last-child { border-bottom: none; }
.xp-row .bracket { color: var(--text-dim); font-size: 14px; transition: color 0.3s; }
.xp-row:hover .bracket { color: var(--text); }
.xp-row .rating { font-weight: 600; font-family: 'Cinzel', serif; }
.xp-row .xp { color: var(--gold); font-weight: 700; font-family: 'Cinzel', serif; transition: text-shadow 0.3s; }
.xp-row:hover .xp { text-shadow: 0 0 8px rgba(200,146,42,0.3); }

.xp-total {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 14px; margin-top: 10px;
  border-top: 1px solid var(--gold-border);
  font-family: 'Cinzel', serif; font-weight: 700;
}
.xp-total .total-label { color: var(--gold-pale); letter-spacing: 2px; font-size: 11px; }
.xp-total .total-value {
  font-size: 28px !important;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-pale), var(--gold-bright));
  background-size: 200% auto;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  animation: goldShimmer 4s linear infinite;
  filter: drop-shadow(0 0 12px rgba(232,184,75,0.25));
}

.modal-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.04);
  font-size: 13px; color: var(--text-muted);
}
