* {
  box-sizing: border-box;
}

html {
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: #ff1a1a #0b0b0d;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Montserrat', sans-serif;
  background: #000;
  overflow-x: hidden;
}

/* ========================= */
/* PARTICLES */
/* ========================= */

#particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* ========================= */
/* ANIMATION */
/* ========================= */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================= */
/* SCROLLBAR */
/* ========================= */

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #0b0b0d;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ff1a1a, #ff4d4d);
  border-radius: 999px;
  border: 2px solid #0b0b0d;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ff0000, #ff3333);
  box-shadow: 0 0 15px rgba(255,0,0,.7);
}

/* ========================= */
/* STATS SECTION LAYOUT */
/* ========================= */

#stats-section {
  flex: 1;
  padding: 40px 40px 120px;
  width: 100%;
  max-width: 1700px;
  margin: 120px auto 0 auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 3rem;
}

/* ========================= */
/* SIDEBAR FILTER */
/* ========================= */

.stats-top {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 140px;
  height: fit-content;
}

/* ========================= */
/* SEARCH PLAYER INPUT */
/* ========================= */

.stats-top input {
  background: linear-gradient(145deg, #0f0f14, #14141c);
  border: 1px solid rgba(225,6,0,.25);
  color: #fff;

  padding: 12px 14px 12px 42px;
  border-radius: 12px;

  font-family: 'Montserrat';
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: .5px;

  transition: .25s ease;

  background-image: url("data:image/svg+xml;utf8,<svg fill='none' stroke='%23ff1a1a' stroke-width='2.5' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><circle cx='11' cy='11' r='7'/><line x1='16.65' y1='16.65' x2='21' y2='21'/></svg>");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 18px;

  box-shadow: 0 0 15px rgba(225,6,0,.08);
  border-bottom: 2px solid rgba(225,6,0,.35); /* oddělovač */
}

.stats-top input::placeholder {
  color: rgba(255,255,255,.35);
}

.stats-top input:hover {
  border-color: rgba(225,6,0,.5);
  box-shadow: 0 0 20px rgba(225,6,0,.2);
}

.stats-top input:focus {
  outline: none;
  border-color: #ff1a1a;
  box-shadow: 0 0 25px rgba(255,0,0,.35);
  transform: translateY(-1px);
}

/* ========================= */
/* DROPDOWN STYLE */
/* ========================= */

.stats-top select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background-color: #0d0d0d;
  border: 1px solid #ff1a1a;
  color: #fff;

  padding: 12px 45px 12px 16px;
  border-radius: 12px;

  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;

  cursor: pointer;

  transition: all .25s ease;
  box-shadow: 0 0 15px rgba(255,0,0,0.1);

  position: relative;
}

/* Hover */
.stats-top select:hover {
  border-color: #ff2a2a;
  box-shadow: 0 0 25px rgba(225,6,0,.35);
}

/* Focus */
.stats-top select:focus {
  outline: none;
  border-color: #ff3333;
  box-shadow: 0 0 25px rgba(255,0,0,.4);
}

.stats-top select option {
  background: #0d0d0d;
  color: #fff;
}

/* ========================= */
/* LEADERBOARD GRID */
/* ========================= */

#leaderboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, 360px);
  gap: 2rem;
  justify-content: flex-start;   /* 🔥 důležité */
  align-content: flex-start;     /* 🔥 důležité */
}

/* ========================= */
/* PLAYER CARD */
/* ========================= */

.player-card {
  background: linear-gradient(145deg, #0f0f14, #14141c);
  border-radius: 16px;
  padding: 1.6rem;
  border: 1px solid rgba(255,255,255,.05);
  transition: .25s ease;
  position: relative;
  width: 100%;
  max-width: 360px;
  animation: fadeUp .5s ease forwards;
}

.player-card:hover {
  border-color: rgba(225,6,0,.4);
  box-shadow: 0 15px 40px rgba(225,6,0,.25);
  transform: translateY(-4px);
}

/* POSITION BADGE */

.player-position {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: .75rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.6);
  color: #ff2a2a;
  border: 1px solid rgba(225,6,0,.4);
  backdrop-filter: blur(8px);
}

.player-position.top-1 {
  color: #ffd700;
  border-color: #ffd700;
  background: rgba(255,215,0,.08);
}

.player-position.top-2 {
  color: #e5e5e5;
  border-color: #cfcfcf;
  background: rgba(220,220,220,.08);
}

.player-position.top-3 {
  color: #cd7f32;
  border-color: #cd7f32;
  background: rgba(205,127,50,.08);
}

/* HEADER */

.player-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 1.2rem;
}

.player-header img {
  width: 55px;
  height: 55px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid rgba(225,6,0,.4);
}

.player-header a {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  text-decoration: none;
}

.player-header a:hover {
  color: #e10600;
}

/* ========================= */
/* STATS GRID */
/* ========================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px,1fr));
  gap: 10px;
}

.stat-box {
  background: #14141b;
  padding: 14px 10px;
  border-radius: 12px;
  text-align: center;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  font-size: .65rem;
  color: rgba(255,255,255,.45);
  letter-spacing: .6px;
  text-transform: uppercase;
}

.stat-box span {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.stat-box:hover {
  transform: translateY(-4px);
  background: rgba(225,6,0,.15);
  box-shadow: 0 8px 20px rgba(225,6,0,.2);
}

.stat-box:hover span {
  color: #ff2a2a;
}

/* ========================= */
/* RESPONSIVE */
/* ========================= */

@media (max-width: 1200px) {
  #stats-section {
    grid-template-columns: 1fr;
  }

  .stats-top {
    position: relative;
    top: unset;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* ========================= */
/* DROPDOWN MENU DESIGN */
/* ========================= */

/* Chrome / Edge */
select {
  color-scheme: dark;
}

/* OPTION STYLING */
.stats-top select option {
  background: #0f0f14;
  color: #fff;
  padding: 12px;
  font-weight: 600;
}

/* Hover (funguje v některých prohlížečích) */
.stats-top select option:hover {
  background: #1a1a22;
}

/* Selected option */
.stats-top select option:checked {
  background: linear-gradient(90deg, #e10600, #ff2a2a);
  color: #fff;
  font-weight: 700;
}

/* Firefox fix */
@-moz-document url-prefix() {
  .stats-top select option {
    background-color: #0f0f14;
  }
}

/* ========================= */
/* CUSTOM SELECT (HEADER STYLE) */
/* ========================= */

.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select-wrapper select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background: #0d0d0d;
  border: 1px solid #ff1a1a;
  border-radius: 10px;

  padding: 12px 40px 12px 16px;

  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;

  color: #fff;
  cursor: pointer;

  box-shadow: 0 15px 35px rgba(0,0,0,0.6),
              0 0 20px rgba(255,0,0,0.15);

  transition: 0.2s ease;
}

.custom-select-wrapper select:hover {
  background: #111;
  color: #fff;
}

.custom-select-wrapper select:focus {
  outline: none;
  border-color: #ff2a2a;
  color: #fff;
  box-shadow: 0 0 25px rgba(255,0,0,.35);
}

/* Arrow */
.custom-select-wrapper::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #ff1a1a;
  border-bottom: 2px solid #ff1a1a;
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
  transition: .2s ease;
}

.custom-select-wrapper select:focus + .custom-select-wrapper::after {
  border-color: #ff2a2a;
}

/* ========================= */
/* CUSTOM DROPDOWN (HEADER STYLE) */
/* ========================= */

.custom-dropdown {
  position: relative;
  width: 100%;
}

.dropdown-current {
  background: #0d0d0d;
  border: 1px solid #ff1a1a;
  border-radius: 10px;
  padding: 12px 16px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 15px 35px rgba(0,0,0,0.6),
              0 0 20px rgba(255,0,0,0.15);
  transition: 0.2s ease;
}

.dropdown-current:hover {
  background: #111;
}

.dropdown-current::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #ff1a1a;
  border-bottom: 2px solid #ff1a1a;
  transform: translateY(-50%) rotate(45deg);
  transition: 0.2s ease;
}

.custom-dropdown.active .dropdown-current::after {
  transform: translateY(-50%) rotate(-135deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;

  background: #0d0d0d;
  border: 1px solid #ff1a1a;
  border-radius: 10px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.6),
              0 0 20px rgba(255,0,0,0.15);

  overflow: hidden;
  z-index: 3000;

  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);

  pointer-events: none; /* 🔥 důležité */

  transition: 0.2s ease;
}

.custom-dropdown.active .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);

  pointer-events: auto; /* 🔥 zapne klikání jen když je otevřený */
}

.dropdown-menu div {
  padding: 10px 14px;
  color: #aaa;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.2s ease;
}

.dropdown-menu div:hover {
  background: #111;
  color: #fff;
}