* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f5f7fb;
  --card-bg: #ffffff;
  --text: #1e2a3a;
  --text-muted: #6b7f99;
  --text-soft: #3a4d62;
  --primary: #2d7df6;
  --primary-dark: #1a63d6;
  --primary-soft: #eaf1fe;
  --primary-border: #d9e6ff;
  --border: #eef2f6;
  --border-soft: #f0f4fa;
  --win: #0e8a5e;
  --win-bg: #e5f6ee;
  --loss: #c44536;
  --loss-bg: #fdecea;
  --gold: #f5b342;
  --silver: #b0c4de;
  --bronze: #cd7f32;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

html, body { height: 100%; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.brand img {
  width: 24px;
  height: 24px;
  vertical-align: -4px;
  margin-right: 4px;
}

/* ---------- Шапка ---------- */
.top-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}
.brand i {
  color: var(--primary);
  font-size: 1.3rem;
  background: var(--primary-soft);
  padding: 8px;
  border-radius: 12px;
}
.top-nav { display: flex; align-items: center; gap: 18px; }
.top-nav-link {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.top-nav-link:hover { color: var(--primary); }
.top-nav-user {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Основной контент ---------- */
.page-main {
  flex: 1;
  padding: 24px 16px;
}

/* ---------- Футер ---------- */
.site-footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

/* ---------- Общие карточки ---------- */
.container { max-width: 1280px; margin: 0 auto; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 20, 40, 0.04);
  border: 1px solid var(--border);
}
.card + .card { margin-top: 20px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.card-header h2 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0b1a2b;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h2 i { color: var(--primary); font-size: 1.2rem; }
.card-header a {
  font-size: 0.9rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-header a:hover { color: var(--primary-dark); text-decoration: underline; }

/* ---------- Кнопки ---------- */
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 60px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 16px rgba(45, 125, 246, 0.2);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary-border);
}
.btn-outline:hover { background: var(--primary-soft); border-color: var(--primary); }

/* ---------- Медаль-иконки ---------- */
.medal-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}
.medal-gold { background: linear-gradient(135deg, #f5b342, #e6a020); box-shadow: 0 1px 3px rgba(245,179,66,0.4); }
.medal-silver { background: linear-gradient(135deg, #b0c4de, #8fa8c8); box-shadow: 0 1px 3px rgba(176,196,222,0.4); }
.medal-bronze { background: linear-gradient(135deg, #cd7f32, #b06a28); box-shadow: 0 1px 3px rgba(205,127,50,0.4); }

/* ---------- Badge ---------- */
.badge-place {
  background: var(--primary-soft);
  color: #1e4c9c;
  padding: 4px 10px;
  border-radius: 40px;
  font-weight: 600;
  font-size: 0.75rem;
  display: inline-block;
  white-space: nowrap;
}

/* ---------- Таблицы ---------- */
.table-responsive { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; white-space: nowrap; }
th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 8px 8px 8px;
  border-bottom: 1px solid #e4eaf1;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
.text-win { color: var(--win); font-weight: 600; }
.text-loss { color: var(--loss); font-weight: 600; }

/* ---------- Фильтры ---------- */
.filter-group { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-btn {
  background: var(--primary-soft);
  border: 1px solid transparent;
  border-radius: 40px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e4c9c;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.filter-btn:hover { background: var(--primary-border); }
.filter-btn.active { background: #1e2a3a; color: #fff; border-color: #1e2a3a; }

.top-nav-link { position: relative; }
.top-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 4px;
}
.top-nav-link + .top-nav-link:not(:first-child)::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 14px;
  background: var(--border);
  margin-right: 18px;
  vertical-align: middle;
}

/* ---------- Адаптив ---------- */
@media (max-width: 700px) {
  .page-main { padding: 16px 12px; }
  .card { padding: 18px; border-radius: 20px; }
  .top-bar-inner { padding: 10px 12px; }
  .brand span { display: none; }
}

@media (max-width: 700px) {
  .players-header, .rating-row { grid-template-columns: 1fr; }
}