.toplist-wrapper {
  width: 90%;
  max-width: 700px;
  margin: 2em auto;
  font-family: "Comfortaa", sans-serif;
}

.toplist-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
}

.toplist-title {
  text-align: center;
  margin: 0;
  color: var(--text);
  font-size: 1.8rem;
}

.toplist-subscribe-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.35);
  color: #ffc107;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.toplist-subscribe-btn:hover {
  background: rgba(255, 193, 7, 0.22);
  border-color: rgba(255, 193, 7, 0.5);
}

.toplist-subscribe-btn i {
  font-size: 0.9rem;
}

.toplist-your-rating {
  text-align: center;
  color: var(--text);
  font-size: 1.1em;
  margin-bottom: 20px;
  padding: 12px 20px;
  background: var(--cloud-bg2);
  border-radius: 10px;
  display: inline-block;
  margin-left: 50%;
  transform: translateX(-50%);
}

.toplist-your-rating strong {
  color: #06a77d;
  font-size: 1.3em;
}

.toplist-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toplist-tab {
  padding: 10px 20px;
  border: none;
  background: var(--cloud-bg2);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95em;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.toplist-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.toplist-tab.active {
  background: linear-gradient(135deg, #06a77d 0%, #04d9a1 100%);
  color: white;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(6, 167, 125, 0.4);
}

.toplist-description {
  text-align: center;
  color: var(--text);
  opacity: 0.7;
  font-size: 0.9em;
  margin-bottom: 25px;
}

.toplist-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--cloud-bg2);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.toplist-table thead {
  background: rgba(0, 0, 0, 0.2);
}

.toplist-table th {
  color: var(--text);
  font-weight: bold;
  padding: 15px 12px;
  text-align: left;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toplist-table td {
  color: var(--text);
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.toplist-table tbody tr:last-child td {
  border-bottom: none;
}

.toplist-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.toplist-row.top-1 {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, transparent 100%);
}

.toplist-row.top-2 {
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.1) 0%, transparent 100%);
}

.toplist-row.top-3 {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.1) 0%, transparent 100%);
}

.toplist-rank {
  width: 50px;
  text-align: center !important;
  font-weight: bold;
}

.toplist-player {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.toplist-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #28a745;
  box-shadow: 0 0 4px rgba(40, 167, 69, 0.5);
  flex-shrink: 0;
  display: inline-block;
}

.toplist-rating {
  width: 80px;
  text-align: center !important;
  font-weight: bold;
  color: #06a77d;
}

.toplist-change {
  width: 80px;
  text-align: center !important;
  font-weight: bold;
}

.toplist-change.positive {
  color: #4caf50;
}

.toplist-change.negative {
  color: #f44336;
}

.toplist-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text);
  background: var(--cloud-bg2);
  border-radius: 12px;
}

.toplist-empty i {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 20px;
  display: block;
}

.toplist-empty p {
  margin: 10px 0;
  font-size: 1.1em;
}

.toplist-empty-hint {
  opacity: 0.6;
  font-size: 0.9em !important;
}

.toplist-player-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}

.toplist-player-link:hover {
  color: #06a77d;
  text-decoration: underline;
}

.toplist-row.is-player {
  background: linear-gradient(90deg, rgba(6, 167, 125, 0.18) 0%, transparent 80%);
  box-shadow: inset 3px 0 0 #06a77d;
}

.toplist-row.is-player:hover {
  background: linear-gradient(90deg, rgba(6, 167, 125, 0.26) 0%, rgba(255, 255, 255, 0.04) 80%);
}

.toplist-you-badge {
  background: #06a77d;
  color: white;
  font-size: 0.62em;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.toplist-separator-row td {
  text-align: center;
  padding: 6px 12px;
  color: var(--text);
  opacity: 0.35;
  font-size: 1.1em;
  letter-spacing: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.toplist-separator-unranked {
  font-size: 0.8em !important;
  letter-spacing: 1px !important;
  font-style: italic;
}

/* Guild Section */
.guild-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.guild-section-title {
  font-family: "Cinzel", serif;
  font-size: 1.4rem;
  color: #5865f2;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px 0;
}

.guild-section-desc {
  font-size: 0.85rem;
  color: var(--text);
  opacity: 0.5;
  margin: 0 0 18px 0;
}

.guild-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guild-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  transition: background 0.2s, border-color 0.2s;
}

.guild-card:hover {
  background: rgba(88, 101, 242, 0.08);
  border-color: rgba(88, 101, 242, 0.2);
}

.guild-rank {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  opacity: 0.4;
  min-width: 24px;
  text-align: center;
}

.guild-icon-wrap {
  flex-shrink: 0;
}

.guild-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.guild-icon-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(88, 101, 242, 0.15);
  color: #5865f2;
  font-size: 1.1rem;
}

.guild-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.guild-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guild-members {
  font-size: 0.78rem;
  color: var(--text);
  opacity: 0.45;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Admin dropdown menu */
.admin-menu-wrap {
  position: relative;
  margin-left: auto;
}

.admin-menu-guild {
  margin-left: auto;
  align-self: center;
  flex-shrink: 0;
}

.admin-menu-trigger {
  background: none;
  border: 1px solid transparent;
  color: var(--text);
  opacity: 0.3;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: opacity 0.15s, background 0.15s;
}

.admin-menu-trigger:hover {
  opacity: 0.7;
  background: rgba(255, 255, 255, 0.08);
}

.admin-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 100;
  min-width: 170px;
  background: #1e2030;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 4px 0;
  margin-top: 4px;
}

.admin-menu-dropdown.open {
  display: flex;
  flex-direction: column;
}

.admin-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  white-space: nowrap;
}

.admin-menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.admin-menu-item i {
  width: 14px;
  text-align: center;
  opacity: 0.6;
}

.admin-menu-danger {
  color: #e05555;
}

.admin-menu-danger:hover {
  background: rgba(224, 85, 85, 0.12);
}

.admin-menu-warn {
  color: #e0a030;
}

.admin-menu-warn:hover {
  background: rgba(224, 160, 48, 0.12);
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .toplist-wrapper {
    width: 95%;
    margin: 1em auto;
  }

  .toplist-title {
    font-size: 1.4rem;
  }

  .toplist-title-row {
    gap: 8px;
    margin: 15px 0;
  }

  .toplist-subscribe-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }

  .toplist-subscribe-btn span {
    display: none;
  }

  .toplist-online-dot {
    width: 6px;
    height: 6px;
  }

  .toplist-tabs {
    gap: 6px;
  }

  .toplist-tab {
    padding: 8px 14px;
    font-size: 0.85em;
  }

  .toplist-table th,
  .toplist-table td {
    padding: 10px 8px;
    font-size: 0.85em;
  }

  .toplist-rank {
    width: 40px;
  }

  .toplist-rating,
  .toplist-change {
    width: 60px;
  }

  .toplist-your-rating {
    font-size: 0.95em;
    padding: 10px 16px;
  }

  .guild-section-title {
    font-size: 1.2rem;
  }

  .guild-card {
    padding: 10px 12px;
    gap: 10px;
  }

  .guild-icon {
    width: 32px;
    height: 32px;
  }

  .guild-name {
    font-size: 0.85rem;
  }
}
