/* ==========================================================
   PVP EMPIRE — THEME
   Design language: flat game-UI (inventory slots, hard pixel
   shadows, small radii) instead of glass panels / neon glow.
   Palette pulls from ore & block colors: obsidian, gold, emerald,
   redstone — not a generic dark-mode gradient.
   ========================================================== */

@font-face {
  font-family: "MultiCraftFont";
  src: url("assets/MultiCraftFont.ttf") format("truetype");
  font-display: swap;
}

:root {
  /* --- palette: dark blue / steel / emerald / redstone --- */
  --bg: #0a1120;
  --bg-2: #0e1729;
  --panel: #131f38;
  --panel-2: #17253f;
  --slot: #17233d;
  --slot-hover: #1e2d4d;

  --border: #28395c;
  --border-light: #3c5382;
  --bevel-light: rgba(255, 255, 255, 0.08);
  --bevel-dark: rgba(0, 0, 0, 0.55);

  --gold: #5b9dff;
  --gold-dim: #3d6fc4;
  --emerald: #4fd18b;
  --redstone: #ff5c5c;

  --text: #e3ebfa;
  --text-dim: #93a5c4;
  --text-faint: #5c6c8c;

  --font-mc: "MultiCraftFont", "Courier New", monospace;

  --radius: 3px;
  --radius-lg: 4px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mc);
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0.3px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
button, input { font-family: var(--font-mc); cursor: pointer; }
h1, h2, h3, h4, p, code { font-family: var(--font-mc); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- ambient background: static pixel-grid texture, no moving blobs ---------- */
.bg-field {
  position: fixed; inset: 0; z-index: -1;
  background:
    linear-gradient(var(--bg-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-2) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  opacity: 0.6;
}
.bg-stars {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
}
.star {
  position: absolute;
  background: var(--text);
  border-radius: 50%;
}
.star--twinkle { animation: twinkle ease-in-out infinite; }
@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 1; }
}

.bg-vignette {
  position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, transparent 40%, var(--bg) 95%);
}

/* ---------- shared: inventory-slot bevel ---------- */
.slot {
  background: var(--slot);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    inset 1px 1px 0 var(--bevel-light),
    inset -1px -1px 0 var(--bevel-dark);
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg-2);
  border-bottom: 2px solid var(--border);
}
.header-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 30px; height: 30px;
  image-rendering: pixelated;
  border-radius: var(--radius);
}
.brand-name {
  font-size: 17px; letter-spacing: 1px; color: var(--text);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}
.brand-name em { font-style: normal; color: var(--gold); }

.site-nav { display: flex; gap: 4px; }
.site-nav a {
  position: relative;
  font-size: 13px; letter-spacing: 0.5px; color: var(--text-dim);
  padding: 8px 12px; border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.site-nav a:hover { color: var(--text); background: var(--slot); }
.site-nav a.is-active { color: var(--gold); }
.site-nav a.is-active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 3px; height: 2px;
  background: var(--gold);
}

/* ---------- reveal-on-scroll animation ---------- */
.reveal {
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}
.anim-drop { animation: dropIn 0.5s ease both; }
.anim-drop-1 { animation-delay: 0.05s; }
.anim-drop-2 { animation-delay: 0.15s; }
.anim-drop-3 { animation-delay: 0.25s; }

/* ---------- hero (home) ---------- */
.hero { padding: 64px 24px 48px; text-align: center; }
.page-section { display: none; }
.page-section.is-active { display: block; }
.hero-inner { max-width: 640px; margin: 0 auto; }
.hero-title {
  font-size: clamp(36px, 8vw, 58px);
  margin: 0 0 10px; letter-spacing: 2px; line-height: 1.15;
  color: var(--text);
  text-shadow: 3px 3px 0 rgba(0,0,0,0.5);
}
.hero-title em { font-style: normal; color: var(--gold); }
.hero-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 28px; }

.hero-status {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 14px 22px; margin-bottom: 30px;
}
.status-dot {
  width: 10px; height: 10px; flex-shrink: 0; background: var(--text-faint);
  border-radius: 1px;
}
.status-dot.is-online { background: var(--emerald); animation: blink 2.2s steps(1) infinite; }
.status-dot.is-offline { background: var(--redstone); }
@keyframes blink { 0%, 60% { opacity: 1; } 30% { opacity: 0.4; } }

.hero-status-text { font-size: 14px; letter-spacing: 0.5px; }
.hero-status-text .count { color: var(--gold); }
.hero-status-divider { width: 1px; height: 18px; background: var(--border); }
#hero-server-code {
  font-size: 13px; color: var(--text-dim); letter-spacing: 1.5px;
}

/* ---------- server showcase image (home) ---------- */
.hero-showcase {
  max-width: 720px; margin: 0 auto; padding: 6px;
  transition: transform 0.2s ease;
}
.hero-showcase-img {
  width: 100%; display: block;
  border-radius: 2px;
  image-rendering: pixelated;
}
.hero-showcase:hover { transform: translateY(-3px); }

/* ---------- portal cards (home nav) ---------- */
.portals {
  max-width: 900px; margin: 0 auto; padding: 0 24px 64px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.portal-card {
  padding: 22px 18px;
  transition: transform 0.15s, background 0.15s;
}
.portal-card:hover { background: var(--slot-hover); transform: translateY(-2px); }
.portal-card:active { transform: translateY(0); }
.portal-mark { font-size: 22px; color: var(--gold); margin-bottom: 10px; }
.portal-title { font-size: 15px; margin-bottom: 6px; }
.portal-desc { font-size: 12.5px; color: var(--text-faint); line-height: 1.6; }

/* ---------- sections / page header ---------- */
.section { max-width: 900px; margin: 0 auto; padding: 44px 24px 64px; scroll-margin-top: 70px; }
.page-title {
  font-size: 26px; letter-spacing: 1px; margin: 0 0 6px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}
.page-title em { font-style: normal; color: var(--gold); }
.page-sub { color: var(--text-faint); font-size: 13px; margin: 0 0 30px; }

/* ---------- server card ---------- */
.server-card { padding: 24px; }
.server-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 18px;
  padding-bottom: 18px; border-bottom: 1px solid var(--border);
}
.server-card-id .label { font-size: 10.5px; letter-spacing: 1.5px; color: var(--text-faint); }
.code-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
#server-code {
  font-size: 16px; letter-spacing: 2px; color: var(--gold);
  background: var(--bg-2); border: 1px solid var(--border);
  padding: 6px 10px; border-radius: var(--radius);
}
.copy-btn {
  width: 32px; height: 32px; border-radius: var(--radius);
  background: var(--slot); border: 1px solid var(--border); color: var(--text-dim);
  font-size: 13px; transition: color 0.15s;
}
.copy-btn:hover { color: var(--gold); }
.copy-btn:active { transform: translateY(1px); }

/* status pill — only state now is online / offline */
.pill {
  font-size: 11.5px; font-weight: 400; padding: 6px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 6px; letter-spacing: 0.5px;
}
.pill--online { color: var(--emerald); border-color: var(--emerald); }
.pill--offline { color: var(--redstone); border-color: var(--redstone); }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.server-name { font-size: 21px; margin: 4px 0 18px; letter-spacing: 0.5px; }

.server-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin-bottom: 20px;
}
.stat { padding: 12px 14px; }
.stat-label { display: block; font-size: 10.5px; letter-spacing: 1px; color: var(--text-faint); margin-bottom: 6px; }
.stat-value { font-size: 15px; color: var(--text); }
.stat-bar { margin-top: 9px; height: 6px; border-radius: var(--radius); background: var(--bg-2); overflow: hidden; border: 1px solid var(--border); }
.stat-bar-fill { height: 100%; width: 0%; background: var(--gold-dim); transition: width 0.5s ease; }

.server-desc { color: var(--text-dim); white-space: pre-line; font-size: 13.5px; margin: 0 0 22px; }

.server-card-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius); font-size: 13px; letter-spacing: 0.5px;
  border: 1px solid var(--border);
  transition: transform 0.1s, background 0.15s;
}
.btn-icon { width: 15px; height: 15px; }
.btn--primary {
  background: var(--gold-dim); color: #0a1120; border-color: var(--gold-dim);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.25), inset -1px -1px 0 rgba(0,0,0,0.3);
}
.btn--primary:hover { background: var(--gold); }
.btn--ghost { background: var(--slot); color: var(--text-dim); }
.btn--ghost:hover { color: var(--text); background: var(--slot-hover); }
.btn:active { transform: translateY(1px); box-shadow: none; }

/* ---------- staff grid ---------- */
.staff-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px;
}
.staff-loading, .players-loading, .players-empty, .players-error {
  color: var(--text-faint); font-size: 13px; padding: 20px 4px; grid-column: 1 / -1;
}
.staff-card {
  display: block;
  padding: 16px; text-align: center; transition: transform 0.15s, background 0.15s;
}
.staff-card:hover { transform: translateY(-2px); background: var(--slot-hover); }
.staff-skin {
  width: 96px; height: 96px; margin: 0 auto 14px; border-radius: var(--radius);
  object-fit: contain; background: var(--bg-2); border: 1px solid var(--border);
  image-rendering: pixelated;
}
.staff-name { font-size: 13.5px; margin-bottom: 6px; }
.staff-rank {
  display: inline-block; font-size: 10.5px; letter-spacing: 0.5px;
  color: var(--gold); background: var(--bg-2); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 3px 9px;
}

/* ---------- credits ---------- */
.credits-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; margin-bottom: 8px;
  font-size: 13.5px;
}
.credits-role { color: var(--text-faint); font-size: 11px; letter-spacing: 1px; }
.credits-name { color: var(--text); }

/* ---------- footer ---------- */
.site-footer {
  text-align: center; padding: 36px 24px 56px; color: var(--text-faint); font-size: 11.5px;
  border-top: 1px solid var(--border); margin-top: 20px;
}

/* ==========================================================
   PLAYER LIST MODAL
   ========================================================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 8, 5, 0.75);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }

.players-panel {
  width: 100%; max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.45);
  overflow: hidden;
  animation: panelIn 0.16s ease-out;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.players-panel-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 14px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.players-panel-icon { width: 22px; height: 22px; }
.players-panel-title { font-size: 14px; flex: 1; }
.players-panel-count { font-size: 13.5px; }
#players-count-online { color: var(--emerald); }
.count-sep { color: var(--text-faint); margin: 0 2px; }
#players-count-max { color: var(--text); }
.players-panel-close {
  width: 28px; height: 28px; border-radius: var(--radius); margin-left: 4px;
  background: var(--slot); border: 1px solid var(--border);
  color: var(--redstone); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.players-panel-close:hover { background: var(--slot-hover); }
.players-panel-close:active { transform: translateY(1px); }

.players-panel-body {
  max-height: 60vh; overflow-y: auto;
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.players-panel-body::-webkit-scrollbar { width: 8px; }
.players-panel-body::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 999px; }

.player-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--slot);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  transition: background 0.15s;
}
.player-row:hover { background: var(--slot-hover); }
.player-gender-icon { width: 18px; height: 18px; flex-shrink: 0; image-rendering: pixelated; }
.player-tag-wrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-premium-icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.player-name-plain { color: var(--text); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .server-stats { grid-template-columns: 1fr; }
  .portals { grid-template-columns: 1fr; }
  .server-card-top { flex-direction: column; }
  .site-nav { gap: 0; }
  .hero-status { flex-direction: column; gap: 8px; }
  .hero-status-divider { display: none; }
}

/* ---------- leaderboard grid / rows ---------- */
.leaderboard-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 700px;
  margin: 0 auto;
}
.leaderboard-loading {
  color: var(--text-faint);
  font-size: 13px;
  padding: 20px 4px;
}
.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  transition: transform 0.15s, background 0.15s;
  cursor: pointer;
}
.leaderboard-row:hover {
  transform: translateX(4px);
  background: var(--slot-hover);
}
.leaderboard-row:active {
  transform: translateX(2px);
}
.leaderboard-rank {
  font-size: 15px;
  font-weight: bold;
  color: var(--text-dim);
  width: 70px;
}
.leaderboard-name {
  font-size: 16px;
  color: var(--text);
  flex: 1;
}
.leaderboard-action {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  transition: color 0.15s;
}
.leaderboard-row:hover .leaderboard-action {
  color: var(--gold);
}

/* Custom top 3 styling */
.leaderboard-row.rank-first {
  border-color: var(--gold);
}
.leaderboard-row.rank-first .leaderboard-rank {
  color: #ffd700; /* gold trophy color */
}
.leaderboard-row.rank-first .leaderboard-name {
  color: #ffd700;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.6);
}
.leaderboard-row.rank-second {
  border-color: var(--text-dim);
}
.leaderboard-row.rank-second .leaderboard-rank {
  color: #c0c0c0; /* silver trophy color */
}
.leaderboard-row.rank-third {
  border-color: var(--gold-dim);
}
.leaderboard-row.rank-third .leaderboard-rank {
  color: #cd7f32; /* bronze trophy color */
}

/* ---------- staff profile page ---------- */
.profile-header-back {
  margin-bottom: 24px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  font-size: 13.5px;
  color: var(--text-dim);
  transition: color 0.15s;
}
.back-link:hover {
  color: var(--gold);
}

.profile-card {
  padding: 30px;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 24px;
}

.profile-skin {
  width: 120px;
  height: 120px;
  border-radius: var(--radius);
  object-fit: contain;
  background: var(--bg-2);
  border: 1px solid var(--border);
  image-rendering: pixelated;
  box-shadow: inset 1px 1px 0 var(--bevel-light), inset -1px -1px 0 var(--bevel-dark);
}

.profile-identity {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.profile-name {
  font-size: 28px;
  margin: 0;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  color: var(--text);
}

.profile-rank-badge {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--gold);
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 4px 12px;
}

.profile-info-box {
  padding: 20px;
  background: var(--panel-2); /* slightly darker/contrasting panel for the description */
}

.info-box-title {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  margin: 0 0 12px;
  text-transform: uppercase;
}

.info-box-content {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
}

.placeholder-text {
  margin: 0;
  font-style: italic;
}

.profile-loading, .profile-error {
  color: var(--text-faint);
  font-size: 14px;
  padding: 40px 0;
  text-align: center;
}

.profile-error h3 {
  color: var(--redstone);
  font-size: 18px;
  margin: 0 0 10px;
}

.profile-error p {
  color: var(--text-dim);
  margin: 0 0 20px;
}

@media (max-width: 640px) {
  .profile-hero {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
  .profile-identity {
    align-items: center;
  }
  .profile-card {
    padding: 20px;
  }
}

.profile-tier {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile-tier-link {
  color: var(--gold);
  text-decoration: underline;
  transition: color 0.15s;
}
.profile-tier-link:hover {
  color: var(--text);
}

/* ---------- hall of fame grid / cards ---------- */
.halloffame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}
.halloffame-loading {
  color: var(--text-faint);
  font-size: 13px;
  padding: 40px 0;
  text-align: center;
  grid-column: 1 / -1;
}
.hall-card {
  border-color: var(--gold-dim);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.hall-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 4px 15px rgba(91, 157, 255, 0.2), 
              inset 1px 1px 0 var(--bevel-light), 
              inset -1px -1px 0 var(--bevel-dark);
}
.hall-card-inner {
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hall-skin {
  width: 90px;
  height: 90px;
  object-fit: contain;
  margin-bottom: 16px;
  image-rendering: pixelated;
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: 4px;
  border-radius: var(--radius);
}
.hall-name {
  font-size: 18px;
  margin: 0 0 10px;
  color: var(--gold);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.6);
}
.hall-desc {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0;
  font-style: italic;
}