/* ─── Stats Page (mimics ingame /stats UI from buba_stats) ───────────────────── */

.stats-window {
  background:
    linear-gradient(165deg,
      rgba(90, 174, 255, 0.18) 0%,
      rgba(8, 14, 26, 0.85) 42%,
      rgba(5, 12, 22, 0.95) 100%);
  border: 1px solid rgba(90, 174, 255, 0.45);
  border-radius: var(--radius-md);
  box-shadow:
    0 16px 56px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.2) inset,
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: statsWinIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes statsWinIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stats-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: clamp(14px, 1.4vw, 22px) clamp(16px, 1.6vw, 26px);
  background: linear-gradient(180deg, rgba(90, 174, 255, 0.2) 0%, rgba(5, 10, 20, 0.6) 100%);
  border-bottom: 1px solid rgba(90, 174, 255, 0.32);
}
.stats-title-wrap h1 {
  font-family: var(--font-primary);
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  font-weight: 800;
  color: #fff;
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 16px var(--accent-glow);
  line-height: 1.05;
}
.stats-title-wrap p {
  font-family: var(--font-primary);
  font-size: 0.78rem;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0.25em 0 0;
  letter-spacing: 0.28em;
  font-weight: 600;
}
.stats-player-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.stats-player-name {
  font-family: var(--font-primary);
  font-size: clamp(0.95rem, 1.4vw, 1.2rem);
  font-weight: 700;
  color: #eef3ff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}
.stats-level-pill {
  font-family: var(--font-primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(90, 174, 255, 0.2);
  border: 1px solid rgba(90, 174, 255, 0.4);
  border-radius: 4px;
  padding: 5px 12px;
}

.stats-xp-wrap {
  padding: clamp(14px, 1.2vw, 20px) clamp(18px, 1.5vw, 26px);
  background: rgba(4, 8, 16, 0.45);
  border-bottom: 1px solid rgba(90, 174, 255, 0.22);
}
.stats-xp-row {
  display: flex;
  margin-bottom: var(--space-3);
}
.stats-xp-block {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, rgba(90, 174, 255, 0.14) 0%, rgba(6, 12, 24, 0.7) 100%);
  border: 1px solid rgba(90, 174, 255, 0.32);
  border-radius: var(--radius-sm);
}
.stats-xp-label {
  font-family: var(--font-primary);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 0.5em;
  white-space: nowrap;
}
.stats-xp-label i { color: var(--accent); font-size: 1em; }
.stats-xp-nums {
  font-family: var(--font-primary);
  font-size: clamp(1.1rem, 1.4vw, 1.55rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
  text-shadow: 0 0 14px var(--accent-glow);
  white-space: nowrap;
}
.stats-xp-sep {
  margin: 0 0.2em;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 700;
}
.stats-xp-track {
  width: 100%;
  height: 9px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(90, 174, 255, 0.18);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.35);
}
.stats-xp-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  box-shadow: 0 0 14px var(--accent-glow);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(10px, 1vw, 16px);
  padding: clamp(14px, 1.2vw, 20px);
}

.stats-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
}
.stats-column:hover {
  transform: translateY(-3px);
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.45));
}

.stats-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(90, 174, 255, 0.28);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.stats-col-head i {
  font-size: 1rem;
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
}
.stats-col-head h3 {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  color: #f4f7ff;
  font-weight: 800;
  text-transform: uppercase;
}

.stats-col-body {
  flex: 1;
  background: linear-gradient(180deg, rgba(90, 174, 255, 0.10) 0%, rgba(5, 12, 24, 0.7) 100%);
  border: 1px solid rgba(90, 174, 255, 0.28);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 200px;
}

.stats-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: linear-gradient(90deg, rgba(90, 174, 255, 0.08) 0%, rgba(5, 12, 24, 0.4) 100%);
  border: 1px solid rgba(90, 174, 255, 0.14);
  border-radius: var(--radius-sm);
  transition: background 0.2s, border-color 0.2s;
}
.stats-item:hover {
  background: linear-gradient(90deg, rgba(90, 174, 255, 0.18) 0%, rgba(5, 12, 24, 0.5) 100%);
  border-color: rgba(90, 174, 255, 0.4);
}
.stats-item-skill {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.stats-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}
.stats-item-label {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 0.78rem;
  color: #eef2ff;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 0;
}
.stats-item-label i {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
  width: 1.2em;
  text-align: center;
  flex-shrink: 0;
}
.stats-item:hover .stats-item-label i { color: var(--accent); }
.stats-item-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.stats-item-value {
  font-family: var(--font-primary);
  font-weight: 800;
  color: #fff;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-shadow: 0 0 10px var(--accent-glow);
  flex-shrink: 0;
}

.stats-skill-track {
  height: 5px;
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(90, 174, 255, 0.12);
}
.stats-skill-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-foot {
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(90, 174, 255, 0.18);
  background: rgba(4, 8, 16, 0.42);
  text-align: center;
  font-family: var(--font-primary);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stats-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: rgba(90, 174, 255, 0.06);
  border: 1px dashed rgba(90, 174, 255, 0.25);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.stats-hint i { color: var(--accent); }

/* Empty / skeleton states */
.stats-skeleton { }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; padding: var(--space-3); gap: var(--space-3); }
  .stats-titlebar { padding: var(--space-4); }
  .stats-title-wrap h1 { font-size: 1.1rem; }
  .stats-title-wrap p { font-size: 0.65rem; letter-spacing: 0.22em; }
  .stats-xp-wrap { padding: var(--space-4); }
  .stats-xp-block { flex-direction: column; align-items: flex-start; gap: 6px; }
  .stats-col-body { min-height: 0; }
}
