/* ==========================================================================
   KzDuels — design tokens
   Палитра построена вокруг самой темы дуэли: золото ранга (победитель)
   против багрового угля (вызов/поражение), на фоне почти чёрной арены.
   ========================================================================== */
:root {
  --void: #08090c;
  --panel: #12151b;
  --panel-2: #171b23;
  --line: #232833;
  --line-soft: #1a1e26;

  --text: #edeff3;
  --text-muted: #8b93a3;
  --text-faint: #565d6b;

  --gold: #e8b84b;
  --gold-soft: #f0cd7c;
  --gold-dim: #6b5427;

  --crimson: #d2432b;
  --crimson-soft: #e46a53;
  --crimson-dim: #4a1f16;

  --win: #4caf7d;
  --lose: #d2432b;

  --radius: 14px;
  --radius-sm: 8px;

  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Атмосфера арены: тихий дрейфующий узор радара + виньетка.
   Дешёвый в CPU способ дать фону "живость" без частиц/канваса. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(232, 184, 75, 0.08), transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(210, 67, 43, 0.06), transparent 60%),
    var(--void);
}

body::after {
  content: '';
  position: fixed;
  inset: -50%;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  animation: drift 60s linear infinite;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 20%, black, transparent 75%);
}

@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(64px, 64px); }
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(140%);
  background: rgba(8, 9, 12, 0.72);
  border-bottom: 1px solid var(--line-soft);
}

.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: baseline;
  gap: 2px;
  white-space: nowrap;
}

.brand .kz { color: var(--gold); }

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: block;
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.nav-links a:hover { color: var(--text); background: var(--panel); }
.nav-links a.active { color: var(--void); background: var(--gold); }

.nav-search {
  position: relative;
  width: 220px;
}

.nav-search input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 100px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-family: var(--font-body);
  transition: border-color 0.2s var(--ease);
}

.nav-search input:focus {
  outline: none;
  border-color: var(--gold-dim);
}

.nav-search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: none;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.nav-search-results.open { display: block; }

.nav-search-results a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line-soft);
}

.nav-search-results a:last-child { border-bottom: none; }
.nav-search-results a:hover { background: var(--panel); }
.nav-search-results img { width: 22px; height: 22px; border-radius: 4px; image-rendering: pixelated; }
.nav-search-empty { padding: 14px 12px; font-size: 13px; color: var(--text-faint); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-gold {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #1a1305;
  box-shadow: 0 0 0 0 rgba(232, 184, 75, 0.4);
}

.btn-gold:hover {
  box-shadow: 0 6px 24px rgba(232, 184, 75, 0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover { border-color: var(--gold-dim); background: var(--panel); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 96px 0 80px;
  overflow: hidden;
}

/* Диагональный "шов" — фирменный элемент: разделяет арену на два угла,
   как линия между дуэлянтами. Повторяется как мотив по всему сайту. */
.seam {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.seam::before {
  content: '';
  position: absolute;
  top: -10%;
  left: 62%;
  width: 2px;
  height: 130%;
  background: linear-gradient(180deg, transparent, var(--gold) 30%, var(--crimson) 70%, transparent);
  opacity: 0.55;
  transform: rotate(14deg);
  box-shadow: 0 0 40px 2px rgba(232, 184, 75, 0.25);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 20px;
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--win);
  box-shadow: 0 0 8px var(--win);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(38px, 5vw, 60px);
  margin-bottom: 20px;
}

.hero h1 .accent { color: var(--gold); }

.hero p.lede {
  color: var(--text-muted);
  font-size: 17px;
  max-width: 48ch;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}

.ip-copy {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
  padding: 10px 16px;
  border: 1px dashed var(--line);
  border-radius: 100px;
  cursor: pointer;
  background: transparent;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.ip-copy:hover { border-color: var(--gold-dim); color: var(--text); }

.hero-stats {
  display: flex;
  gap: 32px;
}

.stat .num {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat .label {
  font-size: 12.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* Дуэльный виджет: два аватара по разные стороны кольца матчмейкинга */
.duel-widget {
  position: relative;
  aspect-ratio: 1;
  max-width: 380px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.duel-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--gold) 0deg, transparent 90deg, var(--crimson) 180deg, transparent 270deg, var(--gold) 360deg);
  animation: spin 12s linear infinite;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  opacity: 0.8;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.duel-faceoff {
  display: flex;
  align-items: center;
  gap: 18px;
  z-index: 1;
}

.duel-avatar {
  width: 92px;
  height: 92px;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid var(--panel-2);
  background: var(--panel);
  image-rendering: pixelated;
  animation: float 4s ease-in-out infinite;
}

.duel-avatar.right { animation-delay: -2s; }
.duel-avatar img { width: 100%; height: 100%; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.duel-vs {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--crimson-soft);
  letter-spacing: 0.05em;
}

/* ---------- Sections ---------- */
.section {
  padding: 72px 0;
  border-top: 1px solid var(--line-soft);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: clamp(26px, 3vw, 34px);
}

.section-head p {
  color: var(--text-muted);
  margin-top: 8px;
  max-width: 52ch;
}

.section-link {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s var(--ease);
}

.section-link:hover { gap: 10px; }

/* Реальная последовательность (очередь → матч → бой → рейтинг) —
   нумерация тут оправдана содержанием, а не декоративна. */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.step {
  background: var(--panel);
  padding: 28px 24px;
  position: relative;
}

.step .n {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gold);
  margin-bottom: 16px;
}

.step h3 {
  font-size: 17px;
  margin-bottom: 8px;
}

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

/* ---------- Cards / Tables shared ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

.rank-row {
  display: grid;
  grid-template-columns: 44px 44px 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.2s var(--ease);
}

.rank-row:hover { background: var(--panel-2); }
.rank-row:last-child { border-bottom: none; }
.rank-row.link { cursor: pointer; }

.rank-pos {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-faint);
  text-align: center;
}

.rank-row:nth-child(1) .rank-pos { color: var(--gold); }
.rank-row:nth-child(2) .rank-pos { color: #c9ccd3; }
.rank-row:nth-child(3) .rank-pos { color: #c98a4b; }

.rank-avatar {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  image-rendering: pixelated;
  background: var(--panel-2);
}

.rank-name {
  font-weight: 700;
  font-size: 15px;
}

.rank-sub {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 2px;
}

.rank-elo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--gold);
  text-align: right;
}

.rank-wl {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
}

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line-soft);
  padding: 48px 0;
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 20px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links a {
  font-size: 13.5px;
  color: var(--text-muted);
  transition: color 0.2s var(--ease);
}

.footer-links a:hover { color: var(--gold); }

.footer-copy {
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ---------- Utilities ---------- */
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.center-text { text-align: center; }
.loading-row { padding: 40px; text-align: center; color: var(--text-faint); font-family: var(--font-mono); font-size: 13px; }

.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .duel-widget { max-width: 260px; margin-top: 24px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .rank-row { grid-template-columns: 32px 36px 1fr auto; }
  .rank-wl { display: none; }
}

@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .nav-search { display: none; }
}
