:root{--bg:#f8fafc;--card:#ffffff;--muted:#667085;--accent:#0ea5a3}
*{box-sizing:border-box}
body{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,'Helvetica Neue',Arial; background:var(--bg); color:#0f172a; margin:0}

/* Preloader styles */
.preloader-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.3s, visibility 0.3s;
}

.preloader-wrapper.hidden {
  opacity: 0;
  visibility: hidden;
}

/* 3D tower loader made by: csozi | Website: www.csozi.hu */
.loader {
  scale: 2;
  height: 50px;
  width: 40px;
}

.box {
  position: relative;
  opacity: 0;
  left: 10px;
}

.side-left {
  position: absolute;
  background-color: #0ea5e9;
  width: 19px;
  height: 5px;
  transform: skew(0deg, -25deg);
  top: 14px;
  left: 10px;
}

.side-right {
  position: absolute;
  background-color: #38bdf8;
  width: 19px;
  height: 5px;
  transform: skew(0deg, 25deg);
  top: 14px;
  left: -9px;
}

.side-top {
  position: absolute;
  background-color: #7dd3fc;
  width: 20px;
  height: 20px;
  rotate: 45deg;
  transform: skew(-20deg, -20deg);
}

.box-1 {
  animation: from-left 4s infinite;
}

.box-2 {
  animation: from-right 4s infinite;
  animation-delay: 1s;
}

.box-3 {
  animation: from-left 4s infinite;
  animation-delay: 2s;
}

.box-4 {
  animation: from-right 4s infinite;
  animation-delay: 3s;
}

@keyframes from-left {
  0% {
    z-index: 20;
    opacity: 0;
    translate: -20px -6px;
  }
  20% {
    z-index: 10;
    opacity: 1;
    translate: 0px 0px;
  }
  40% {
    z-index: 9;
    translate: 0px 4px;
  }
  60% {
    z-index: 8;
    translate: 0px 8px;
  }
  80% {
    z-index: 7;
    opacity: 1;
    translate: 0px 12px;
  }
  100% {
    z-index: 5;
    translate: 0px 30px;
    opacity: 0;
  }
}

@keyframes from-right {
  0% {
    z-index: 20;
    opacity: 0;
    translate: 20px -6px;
  }
  20% {
    z-index: 10;
    opacity: 1;
    translate: 0px 0px;
  }
  40% {
    z-index: 9;
    translate: 0px 4px;
  }
  60% {
    z-index: 8;
    translate: 0px 8px;
  }
  80% {
    z-index: 7;
    opacity: 1;
    translate: 0px 12px;
  }
  100% {
    z-index: 5;
    translate: 0px 30px;
    opacity: 0;
  }
}
.site-header{background:linear-gradient(90deg,#06b6d4, #3b82f6); color:white; padding:20px}
.site-header h1{margin:0;font-size:1.4rem}
.subtitle{opacity:0.95;margin-top:6px;font-size:0.95rem}
.container{max-width:980px;margin:18px auto;padding:0 16px}
.card{background:var(--card); padding:14px; border-radius:10px; box-shadow:0 2px 8px rgba(2,6,23,0.06); margin-bottom:14px}
.controls{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px}
.controls label{font-size:0.9rem}
.buttons button{margin-left:8px}
table{width:100%;border-collapse:collapse}
th,td{padding:8px 6px;text-align:left;border-bottom:1px solid #eef2f7}
th{font-size:0.85rem;color:var(--muted)}
#matches{list-style:none;padding:0;margin:0}
.match-item{padding:10px;border-radius:8px;border:1px solid #eef2f7;margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}
.match-meta{font-size:0.85rem;color:var(--muted)}
.site-footer{text-align:center;padding:12px;color:var(--muted);font-size:0.9rem}
.player-cards, .team-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 24px;
}
.player-card, .team-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  padding: 18px 22px;
  margin-bottom: 0;
  position: relative;
  overflow: visible;
  transition: box-shadow 0.18s, background 0.18s, border-color 0.18s;
  border: 1.5px solid #e0e7ef;
}
.player-card:hover, .team-card:hover {
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 8px 24px rgba(14,165,163,0.13), 0 2px 12px rgba(0,0,0,0.09);
  border-color: #0ea5a3;
}
.player-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 0;
}
.player-rank {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0ea5a3;
  margin-bottom: 0;
  flex-shrink: 0;
}
.player-name, .team-name {
  font-size: 1.18rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #0f172a;
  text-align: left;
  width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
}
.player-meta, .team-meta {
  font-size: 0.98rem;
  color: #64748b;
  margin-bottom: 4px;
}
.player-points, .team-points {
  font-size: 1.05rem;
  font-weight: 600;
  color: #2563eb;
  margin-bottom: 2px;
}
.player-win, .team-win {
  font-size: 0.97rem;
  color: #0ea5a3;
}
.player-card {
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 48px;
  max-height: 60px;
  transition: max-height 0.25s cubic-bezier(.4,2,.6,1), box-shadow 0.18s;
}
.player-card.expanded {
  max-height: 1000px;
  overflow: visible;
  box-shadow: 0 12px 32px rgba(14,165,163,0.18), 0 2px 12px rgba(0,0,0,0.13);
  border-color: #2563eb;
  background: linear-gradient(100deg,#f0f9ff 60%,#e0f2fe 100%);
}
.player-card .player-details {
  width: 100%;
  margin-top: 10px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.98rem;
  color: #334155;
  box-shadow: 0 1px 4px rgba(2,6,23,0.06);
  transition: max-height 0.25s cubic-bezier(.4,2,.6,1), opacity 0.18s;
  box-sizing: border-box;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}
.player-card.expanded .player-details {
  max-height: 400px;
  opacity: 1;
  pointer-events: auto;
  overflow: visible;
}
.player-card:after {
  content: '\25BC';
  position: absolute;
  right: 18px;
  top: 18px;
  font-size: 1.1em;
  color: #94a3b8;
  transition: transform 0.2s;
}
.player-card.expanded:after {
  transform: rotate(180deg);
  color: #2563eb;
}
.form-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 1.05rem;
  font-weight: 700;
  margin-right: 4px;
  border: 2.2px solid #e5e7eb;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.18s, color 0.18s;
}
.form-win {
  border-color: #22c55e;
  color: #22c55e;
  background: #f0fdf4;
}
.form-loss {
  border-color: #ef4444;
  color: #ef4444;
  background: #fef2f2;
}
.form-td {
  display: flex;
  align-items: center;
  gap: 2px;
}
.main-navbar {
  width: 100%;
  background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 50%, #38bdf8 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.navbar-container {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 clamp(12px, 3vw, 16px);
  height: clamp(48px, 8vh, 56px);
}
.navbar-logo {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  padding: 4px 0;
  min-width: fit-content;
}
.navbar-logo:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: #fff;
  transition: width 0.2s ease;
}
.navbar-logo:hover:after {
  width: 100%;
}
.navbar-links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
  flex: 1;
  justify-content: space-evenly;
  margin-left: clamp(12px, 3vw, 32px);
}
.navbar-links li {
  flex: 1;
  display: flex;
  justify-content: center;
}
.navbar-links li a {
  color: #fff;
  text-decoration: none;
  font-size: clamp(0.85rem, 2.5vw, 1.05rem);
  font-weight: 600;
  padding: 6px 0;
  border-radius: 6px;
  transition: all 0.2s ease;
  position: relative;
  letter-spacing: 0.3px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.navbar-links li a:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}
.navbar-links li a.active {
  background: rgba(255, 255, 255, 0.2);
}
@media (max-width:640px){.controls{flex-direction:column;align-items:stretch}.controls .buttons{display:flex;justify-content:flex-end}}
@media (max-width: 700px) {
  .player-cards, .team-cards {
    flex-direction: column;
    gap: 12px;
  }
  .player-card, .team-card {
    max-width: 100%;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 8px;
    margin-bottom: 0;
  }
  .player-card-header {
    gap: 8px;
  }
  .player-card.expanded {
    overflow: visible;
  }
  .player-card .player-details, .team-card .team-details {
    padding: 10px 6px;
    font-size: 1rem;
    word-break: break-word;
  }
  .player-card.expanded .player-details {
    max-height: 400px;
    overflow: visible;
  }
  .player-card .player-details-content {
    gap: 6px;
  }
  .container {
    padding: 0 2px;
  }
  .leaderboard-table-wrapper {
    width: 100vw;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -8px;
    margin-right: -8px;
  }
  #leaderboardTable {
    min-width: 600px;
    width: max-content;
    font-size: 0.98rem;
  }
  #leaderboardTable th, #leaderboardTable td {
    white-space: nowrap;
    padding: 8px 8px;
    position: relative;
    z-index: 1;
  }
  #leaderboardTable th.sticky-col, #leaderboardTable td.sticky-col {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 2;
    box-shadow: 2px 0 6px -2px #e0e7ef;
  }
  #leaderboardTable th.sticky-col-2, #leaderboardTable td.sticky-col-2 {
    position: sticky;
    left: 48px;
    background: #fff;
    z-index: 2;
    box-shadow: 2px 0 6px -2px #e0e7ef;
  }
  .form-td {
    min-width: 110px;
  }
  @media (max-width: 700px) {
    #leaderboardTable th.sticky-col, #leaderboardTable td.sticky-col {
      left: 0;
      min-width: 44px;
    }
    #leaderboardTable th.sticky-col-2, #leaderboardTable td.sticky-col-2 {
      left: 44px;
      min-width: 110px;
    }
  }
}
@media (max-width: 800px) {
  .navbar-container {
    padding: 0 6px;
  }
}
@media (max-width: 700px) {
  .navbar-container {
    height: 48px;
    padding: 0 8px;
    width: 100%;
  }
  .navbar-logo {
    font-size: 1.1rem;
  }
  .navbar-logo span {
    display: none;
  }
  .navbar-links {
    margin-left: 8px;
  }
  .navbar-links li a {
    padding: 4px 2px;
  }
}