@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;800&display=swap");

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  /* Red-Green Split VS Landscape */
  background:
    radial-gradient(circle at 20% 50%, #16653499 0%, transparent 40%),
    /* Green Player side */
    radial-gradient(circle at 80% 50%, #7f1d1ddd 0%, #1a0101 60%),
    /* Deep Red Boss side */ #020617; /* Deep base color */
  color: #f8fafc;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 0;
  overflow: hidden;
}

/* Heavy blur overlay */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  z-index: -2;
}

/* Floating minor red particle effects near the robot */
body::after {
  content: "";
  position: absolute;
  top: 60%;
  right: 15%;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, #ff0000 0%, transparent 70%);
  border-radius: 50%;
  animation: pulse-red 3s infinite ease-in-out;
  opacity: 0.3;
  pointer-events: none;
  z-index: -1;
}

@keyframes pulse-red {
  0% {
    transform: scale(0.8);
    opacity: 0.1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.4;
  }
  100% {
    transform: scale(0.8);
    opacity: 0.1;
  }
}

/* Floating Characters */
.side-char {
  position: absolute;
  bottom: 0;
  z-index: -1;
  pointer-events: none;
}

.char-left {
  left: -2vw;
  height: 85vh;
  filter: drop-shadow(
    0 10px 30px rgba(34, 197, 94, 0.3)
  ); /* Green shadow for player */
}

.boss-right {
  right: -2vw;
  height: 95vh;
  filter: drop-shadow(
    0 0 30px rgba(239, 68, 68, 0.4)
  ); /* Red shadow for the boss */
}

/* The Main Fixed Container */
.content-box {
  position: relative;
  z-index: 10;
  width: 90%;
  max-width: 800px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(25px) saturate(150%);
  -webkit-backdrop-filter: blur(25px) saturate(150%);
  border-radius: 24px;
  /* Updated to vibrant green edge highlights */
  border: 1px solid rgba(34, 197, 94, 0.3);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(34, 197, 94, 0.05);
  overflow: hidden;
}

/* Header Area (Static) */
.box-header {
  padding: 40px 40px 20px 40px;
  flex-shrink: 0;
}

.leaderboard-logo {
  display: block;
  width: 100%;
  max-width: 450px;
  margin: 0 auto 30px auto;
  filter: drop-shadow(0 0 15px rgba(34, 197, 94, 0.4)); /* Green logo glow */
}

.controls-panel {
  display: flex;
  gap: 15px;
}

.styled-input {
  flex: 1;
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 15px;
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
  outline: none;
  transition: 0.3s ease;
}

.styled-input:focus {
  background: rgba(34, 197, 94, 0.05);
  border-color: #22c55e; /* Green focus border */
}

.diff-select {
  cursor: pointer;
  appearance: none;
}

/* Dark red options to match the boss side */
.diff-select option {
  background: #110101;
}

/* Scrollable Table Container */
.table-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 40px 40px 40px;
}

/* Custom Scrollbar */
.table-scroll-container::-webkit-scrollbar {
  width: 8px;
}
.table-scroll-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}
.table-scroll-container::-webkit-scrollbar-thumb {
  background: rgba(34, 197, 94, 0.3); /* Green scrollbar */
  border-radius: 10px;
}
.table-scroll-container::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 197, 94, 0.6);
}

/* Table Settings */
.glass-table {
  width: 100%;
  border-collapse: collapse;
}

th {
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  text-align: left;
  padding: 15px 10px;
  color: #94a3b8;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  z-index: 2;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tr {
  transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  animation: fadeIn 0.4s ease backwards;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* VS Split Hover Effect: Green to Red */
tr:hover {
  background: linear-gradient(
    90deg,
    rgba(34, 197, 94, 0.1) 0%,
    rgba(239, 68, 68, 0.1) 100%
  );
  transform: translateX(8px);
}

td {
  padding: 20px 10px;
}

/* Top 3 Medal Colors */
.rank-gold {
  color: #fbbf24 !important;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}
.rank-silver {
  color: #cbd5e1 !important;
  text-shadow: 0 0 10px rgba(203, 213, 225, 0.4);
}
.rank-bronze {
  color: #d97706 !important;
  text-shadow: 0 0 10px rgba(217, 119, 6, 0.4);
}

.rank-num {
  font-weight: 800;
  color: #475569;
  width: 50px;
}

.player-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.score-col,
.score-data {
  text-align: right;
}

.score-data {
  font-family: "monospace";
  color: #22c55e; /* Bright Green for time */
  font-weight: 700;
  font-size: 1.1rem;
}

.empty-msg {
  text-align: center;
  color: #64748b;
  padding: 40px !important;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- RESPONSIVE OPTIMIZATIONS --- */

/* Tablet & Mobile: Adjust Character Sizes */
@media (max-width: 1200px) {
  .char-left,
  .boss-right {
    height: 60vh; /* Shrink characters so they don't dominate */
    opacity: 0.5; /* Fade them back slightly */
  }
}

/* Smartphone: Full-screen layout */
@media (max-width: 768px) {
  body {
    overflow: auto; /* Allow the whole page to scroll if needed */
    padding: 20px 0;
    align-items: flex-start; /* Start from top on mobile */
  }

  /* Hide background characters to prevent clutter/overlap */
  .side-char,
  body::after {
    display: none;
  }

  .content-box {
    width: 95%;
    height: auto; /* Let it grow with content */
    min-height: 90vh;
    margin: 10px auto;
    border-radius: 16px;
  }

  .box-header {
    padding: 25px 20px 15px 20px;
  }

  .leaderboard-logo {
    max-width: 280px; /* Smaller logo for mobile */
    margin-bottom: 20px;
  }

  .controls-panel {
    flex-direction: column; /* Stack search and dropdown */
    gap: 10px;
  }

  .table-scroll-container {
    padding: 0 15px 20px 15px;
    overflow-x: auto; /* Handle horizontal overflow if table is wide */
  }

  /* Adjust Table for small screens */
  td {
    padding: 15px 8px;
    font-size: 0.9rem;
  }

  .rank-num {
    width: 30px;
  }

  .score-data {
    font-size: 1rem;
  }

  /* Disable hover transform on mobile to prevent "sticky" hover states */
  tr:hover {
    transform: none;
  }
}
