:root {
  color-scheme: dark;
  --bg: #0d1016;
  --panel: rgba(22, 26, 34, 0.92);
  --panel-soft: rgba(22, 26, 34, 0.75);
  --border: rgba(255, 255, 255, 0.08);
  --accent: #4f8cff;
  --text: #e8eef8;
  --muted: #94a0b5;
  --shadow: 0 24px 48px -32px rgba(0, 0, 0, 0.65);
  font-family: "Inter", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(1200px 600px at 12% -10%, rgba(79, 140, 255, 0.12), transparent 65%),
    radial-gradient(800px 400px at 80% 0%, rgba(255, 99, 71, 0.08), transparent 70%),
    var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(var(--panel), rgba(13, 16, 22, 0.6));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.navbar {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px clamp(18px, 5vw, 36px);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-title {
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.nav-links {
  display: inline-flex;
  gap: 12px;
}

.nav-link {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
  border-color: rgba(79, 140, 255, 0.45);
}

.nav-link.active {
  color: #fff;
  background: rgba(79, 140, 255, 0.2);
  border-color: rgba(79, 140, 255, 0.6);
}

main {
  flex: 1;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: clamp(24px, 6vw, 48px) clamp(16px, 6vw, 36px) 80px;
  display: grid;
  gap: clamp(28px, 6vw, 48px);
}

.stats-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 28px);
  display: grid;
  gap: 18px;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

.section-header h2 {
  margin: 0 0 6px;
  font-size: clamp(20px, 2.4vw, 26px);
  letter-spacing: -0.01em;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.section-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.section-controls input[type="search"] {
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
  min-width: 220px;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.section-controls input[type="search"]:focus {
  outline: none;
  border-color: rgba(79, 140, 255, 0.6);
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.25);
}

.section-status {
  font-size: 13px;
  color: var(--muted);
}

.table-surface {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(12, 15, 22, 0.65);
  overflow-x: auto;
  scrollbar-width: thin;
}

.table-surface::-webkit-scrollbar {
  height: 8px;
}

.table-surface::-webkit-scrollbar-thumb {
  background: rgba(148, 160, 181, 0.45);
  border-radius: 999px;
}

.table-surface table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-surface thead th {
  position: sticky;
  top: 0;
  background: rgba(13, 17, 24, 0.95);
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  white-space: pre-line;
}

.table-surface tbody td {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px 14px;
  white-space: nowrap;
  vertical-align: middle;
}

.table-surface tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.table-placeholder {
  padding: 36px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.table-placeholder.error {
  color: #ff9393;
}

.value-with-rank {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.value-with-rank .rank {
  min-width: 1.4em;
  text-align: center;
  opacity: 0.9;
}

.nickname {
  font-weight: 600;
  letter-spacing: 0.01em;
}

footer {
  margin: 0 auto;
  width: 100%;
  max-width: 1500px;
  padding: 32px clamp(16px, 6vw, 36px) 48px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

@media (max-width: 900px) {
  .section-controls {
    width: 100%;
    justify-content: space-between;
  }

  .section-controls input[type="search"] {
    flex: 1;
  }
}

@media (max-width: 640px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    width: 100%;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .section-controls input[type="search"] {
    width: 100%;
  }

  footer {
    text-align: left;
  }
}
