/* =========================================
   RANKING PAGE
   ========================================= */

.hero-ranking {
  padding: 40px 20px 20px 20px;
  text-align: center;
  background: radial-gradient(circle at 50% 0%, rgba(48, 159, 106, 0.2) 0%, transparent 60%);
  position: relative;
}
.ranking-hero-title {
  font-size: 2.5rem;
  margin-bottom: 5px;
  color: #fff;
  text-shadow: 0 0 20px var(--dart-green);
}
.ranking-hero-sub {
  color: #aaa;
  font-size: 1.1rem;
  margin-top: 5px;
}
.ranking-hero-actions {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 15px;
}

.ranking-container {
  max-width: 800px;
  margin: 0 auto 50px auto;
  padding: 0 15px;
}

.player-row {
  display: flex;
  align-items: center;
  background: #1a1a2e;
  border: 1px solid #2a3555;
  border-radius: 12px;
  margin-bottom: 12px;
  padding: 15px 20px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
  text-decoration: none;
  color: inherit;
}
.player-row:hover {
  transform: translateX(5px);
  box-shadow: -5px 5px 20px rgba(0,0,0,0.5);
  border-color: #445588;
  background: #22223b;
}

.rank-box {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: #000;
  border: 2px solid #333;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  font-weight: 900;
  margin-right: 20px;
  flex-shrink: 0;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}
.rank-1 {
  border-color: #FFD700;
  color: #FFD700;
  box-shadow: 0 0 15px rgba(255,215,0,0.4), inset 0 0 10px rgba(0,0,0,0.8);
  font-size: 1.5rem;
}
.rank-2 {
  border-color: #C0C0C0;
  color: #C0C0C0;
  box-shadow: 0 0 10px rgba(192,192,192,0.3), inset 0 0 10px rgba(0,0,0,0.8);
  font-size: 1.4rem;
}
.rank-3 {
  border-color: #CD7F32;
  color: #CD7F32;
  box-shadow: 0 0 10px rgba(205,127,50,0.3), inset 0 0 10px rgba(0,0,0,0.8);
  font-size: 1.3rem;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #333;
  margin-right: 15px;
  background: #000;
  flex-shrink: 0;
}

.player-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.player-name {
  font-size: 1.3rem;
  font-weight: 900;
  text-transform: uppercase;
  color: #fff;
  letter-spacing: 1px;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-stats {
  font-size: .85rem;
  color: #888;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.stat-badge {
  background: rgba(0,0,0,0.4);
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid #333;
}
.stat-badge strong { color: #ddd; }
.stat-games { color: #ccc; }
.stat-best { border-color: #f59e0b; }
.stat-best strong { color: #f59e0b; }

.elo-box {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.elo-value {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -1px;
}
.elo-positive {
  color: var(--dart-green);
  text-shadow: 0 0 10px rgba(48, 159, 106, 0.4);
}
.elo-negative {
  color: var(--dart-red);
  text-shadow: 0 0 10px rgba(227, 41, 46, 0.4);
}
.elo-neutral { color: #aaa; }
.elo-label {
  font-size: .7rem;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 2px;
  margin-top: -2px;
}

.profile-arrow {
  color: #444;
  font-size: 1.5rem;
  margin-left: 15px;
  transition: color .3s;
  flex-shrink: 0;
}
.player-row:hover .profile-arrow { color: var(--dart-green); }

.inactive-row {
  opacity: .6;
  filter: grayscale(100%);
  cursor: not-allowed;
}
.inactive-row .rank-box {
  border-color: #222;
  color: #555;
}

.inactive-title {
  color: #666;
  border-bottom: 1px solid #333;
  padding-bottom: 10px;
  margin-top: 40px;
  margin-bottom: 20px;
}

/* Hero action buttons */
.info-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.2);
  color: #ddd;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: .9rem;
  cursor: pointer;
  transition: all .3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.info-btn:hover {
  background: rgba(48,159,106,0.2);
  border-color: var(--dart-green);
  color: #fff;
  transform: translateY(-1px);
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(5px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal-box {
  background: #1a1a2e;
  border: 2px solid var(--dart-green);
  border-radius: 15px;
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  animation: modalFadeIn .3s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  transition: .3s;
}
.modal-close:hover { color: var(--dart-red); }

.modal-content {
  padding: 30px;
  line-height: 1.6;
  color: #ccc;
  text-align: left;
}
.modal-content h3 {
  color: var(--dart-green);
  margin-top: 0;
  font-size: 1.5rem;
  text-align: center;
  border-bottom: 1px solid #333;
  padding-bottom: 15px;
}
.modal-content h4 {
  color: #fff;
  margin: 25px 0 10px 0;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.modal-content ul {
  padding-left: 20px;
  margin-top: 10px;
}
.modal-content li { margin-bottom: 8px; }

.ranking-note {
  background: rgba(245, 158, 11, 0.08);
  border-left: 4px solid #f59e0b;
  padding: 10px;
  margin-top: 12px;
  font-size: .92rem;
}

/* =========================================
   LIGHT MODE OVERRIDES
   ========================================= */
html[data-theme="light"] .hero-ranking {
  background: radial-gradient(circle at 50% 0%, rgba(48,159,106,0.12) 0%, transparent 60%), #f6f9ff;
}
html[data-theme="light"] .ranking-hero-title {
  color: #0f172a;
  text-shadow: none;
}
html[data-theme="light"] .ranking-hero-sub { color: #64748b; }

html[data-theme="light"] .player-row {
  background: #ffffff;
  border: 1px solid #d6e1ef;
}
html[data-theme="light"] .player-row:hover {
  background: #f8fbff;
  border-color: #b8cbe3;
  box-shadow: -5px 5px 20px rgba(15,23,42,0.12);
}
html[data-theme="light"] .rank-box {
  background: #f8fbff;
  border-color: #cfdced;
  box-shadow: inset 0 0 8px rgba(15,23,42,0.08);
}
html[data-theme="light"] .avatar {
  border-color: #cfdced;
  background: #fff;
}
html[data-theme="light"] .player-name { color: #0f172a; }
html[data-theme="light"] .player-stats { color: #64748b; }
html[data-theme="light"] .stat-badge {
  background: #f8fbff;
  border-color: #d6e1ef;
}
html[data-theme="light"] .stat-badge strong { color: #0f172a; }

html[data-theme="light"] .elo-neutral { color: #64748b; }
html[data-theme="light"] .elo-label { color: #64748b; }

html[data-theme="light"] .profile-arrow { color: #94a3b8; }
html[data-theme="light"] .player-row:hover .profile-arrow { color: #15803d; }

html[data-theme="light"] .inactive-title {
  color: #64748b;
  border-bottom-color: #d6e1ef;
}
html[data-theme="light"] .inactive-row .rank-box {
  border-color: #d6e1ef;
  color: #94a3b8;
}

html[data-theme="light"] .info-btn {
  background: #eef3fb;
  border-color: #bfd0e6;
  color: #0f172a;
}
html[data-theme="light"] .info-btn:hover {
  background: #e3ecf9;
  border-color: #8ac6a6;
  color: #0f172a;
}

html[data-theme="light"] .modal-overlay {
  background: rgba(15,23,42,0.55);
}
html[data-theme="light"] .modal-box {
  background: #ffffff;
  border-color: #8ac6a6;
  box-shadow: 0 10px 35px rgba(15,23,42,0.18);
}
html[data-theme="light"] .modal-close { color: #64748b; }

html[data-theme="light"] .modal-content { color: #334155; }
html[data-theme="light"] .modal-content h3 {
  color: #15803d;
  border-bottom-color: #d6e1ef;
}
html[data-theme="light"] .modal-content h4 { color: #0f172a; }

html[data-theme="light"] .ranking-note {
  background: rgba(245,158,11,0.12);
  border-left-color: #f59e0b;
  color: #7c2d12;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 600px) {
  .player-row { padding: 12px 15px; }
  .rank-box { width: 35px; height: 35px; font-size: 1rem; margin-right: 15px; }
  .player-name { font-size: 1.1rem; }
  .elo-value { font-size: 1.5rem; }
  .profile-arrow { display: none; }
  .player-stats { gap: 6px; font-size: .75rem; }
  .stat-badge { padding: 2px 5px; }

  .modal-content { padding: 20px; font-size: .95rem; }

  .ranking-hero-actions {
    display: flex;
  }
}