:root {
  --bg: #0c0e12;
  --surface: #14171e;
  --surface2: #1a1e28;
  --surface3: #21252f;
  --border: #2a2f3c;
  --gold: #b44adb;
  --gold-dim: #8a2fb5;
  --gold-glow: rgba(180,74,219,0.15);
  --gold-shadow: rgba(180,74,219,0.3);
  --gold-hover-border: rgba(180,74,219,0.3);
  --yellow: #d4c443;
  --yellow-bg: #2a2815;
  --red: #c94040;
  --red-bg: #2a1515;
  --green: #4caf50;
  --green-bg: #152a17;
  --text: #dfe1e6;
  --text-dim: #7a8090;
  --text-muted: #505668;
  --accent: #4a9fd5;
  --hard: #b44adb;
  --hard-shadow: rgba(180,74,219,0.3);
  --hard-glow: rgba(180,74,219,0.12);
  --true: #a8e02c;
  --true-shadow: rgba(168,224,44,0.3);
  --true-glow: rgba(168,224,44,0.12);
  --light: #42c6f5;
  --light-shadow: rgba(66,198,245,0.3);
  --light-glow: rgba(66,198,245,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  padding-top: 60px;
  opacity: 1;
}
body.fonts-loaded { opacity: 1; }

/* ══════════ BACKGROUND ══════════ */
.bg-atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 15% -10%, rgba(180,74,219,0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 20%, rgba(74,159,213,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 110%, rgba(180,74,219,0.04) 0%, transparent 40%);
}

.grid-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.025;
  background-image:
    linear-gradient(var(--text-muted) 1px, transparent 1px),
    linear-gradient(90deg, var(--text-muted) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ══════════ NAV ══════════ */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(12,14,18,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(42,47,60,0.6);
}

.nav-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 60px; min-width: 0;
}

.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold), #d07af0);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
  color: var(--bg);
  letter-spacing: -0.5px;
  box-shadow: 0 2px 12px var(--gold-shadow);
}

.logo-text {
  font-weight: 800; font-size: 20px; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--text);
  line-height: 36px; min-width: 0;
}
.logo-text span { color: var(--gold); }

.nav-links { display: flex; gap: 8px; align-items: center; }

.nav-link {
  color: var(--text-dim); text-decoration: none;
  font-size: 14px; font-weight: 600; letter-spacing: 0.5px;
  padding: 8px 16px; border-radius: 6px;
  transition: all 0.2s;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--gold); }

.nav-cta {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--bg); font-weight: 700; font-size: 14px;
  padding: 8px 20px; border-radius: 6px; text-decoration: none;
  letter-spacing: 1px; text-transform: uppercase;
  transition: all 0.25s;
  box-shadow: 0 2px 12px var(--gold-glow);
}
.nav-cta:hover {
  box-shadow: 0 4px 20px var(--gold-shadow);
  transform: translateY(-1px);
}

/* ══════════ MOBILE MENU ══════════ */
.nav-burger {
  display: none; background: none; border: none;
  color: var(--text); font-size: 22px; cursor: pointer;
  padding: 6px;
  width: 40px; height: 40px;
  border-radius: 8px;
  transition: all 0.2s;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-burger:hover { background: var(--surface2); }

.mobile-overlay { 
  position: fixed; inset: 0; z-index: 1001;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  opacity: 1;
  visibility: hidden;
  transition: all 0.3s;
}
.mobile-overlay.open { opacity: 1; visibility: visible; }

.mobile-menu {
  position: fixed; top: 0; right: 0; z-index: 1002;
  width: 240px; max-width: 70vw; height: 100vh; height: 100dvh; min-height: -webkit-fill-available;
  background: var(--surface);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column;
  overflow-y: auto;
  transform-origin: top right;
}
.mobile-menu.open { transform: translateX(0); }

.mobile-menu-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; height: 60px; box-sizing: border-box;
  border-bottom: 1px solid var(--border);
}

.mobile-menu-header .nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}

.mobile-menu-close {
  background: none; border: none;
  color: var(--text-dim); font-size: 20px;
  cursor: pointer; padding: 6px;
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.mobile-menu-close:hover { background: var(--surface2); color: var(--text); }

.mobile-menu-nav {
  padding: 12px;
  display: flex; flex-direction: column; gap: 2px;
  flex: 1;
}

.mobile-menu-link {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 15px; font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.2s;
}
.mobile-menu-link:hover { color: var(--text); background: var(--surface2); }
.mobile-menu-link.active { color: var(--gold); background: var(--gold-glow); }

.mobile-menu-link .mm-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.2s;
}
.mobile-menu-link.active .mm-icon {
  background: var(--gold-glow);
  border-color: var(--gold-dim);
}

.mobile-menu-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.mobile-menu-cta {
  display: flex; position: relative; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 11px 20px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--bg);
  font-weight: 700; font-size: 15px;
  letter-spacing: 0.3px; text-transform: none;
  text-decoration: none;
  transition: all 0.25s;
  box-shadow: 0 2px 12px var(--gold-glow);
}
.mobile-menu-cta:hover {
  box-shadow: 0 4px 20px var(--gold-shadow);
  transform: translateY(-1px);
}

/* ══════════ FOOTER ══════════ */
footer, .site-footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--border);
  padding: 32px 16px;
}

.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center; text-align: center;
  flex-wrap: wrap; gap: 16px;
}

.footer-copy {
  font-size: 14px; color: var(--text-muted);
  letter-spacing: 0.5px;
}

.footer-links { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.footer-link {
  font-size: 14px; color: var(--text-dim);
  text-decoration: none; transition: color 0.2s;
}
.footer-link:hover { color: var(--gold); }

/* ══════════ ANIMATIONS ══════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.reveal {
  opacity: 1;
  transition: opacity 0.7s ease;
}
.reveal.visible {
  opacity: 1;
}

/* ══════════ MOBILE RESPONSIVE ══════════ */
@media (max-width: 900px) {
  .nav-links { display: none !important; }
  .nav-burger { display: flex !important; }
  .logo-icon { width: 30px !important; height: 30px !important; font-size: 13px !important; }
  .logo-text { font-size: 16px !important; line-height: 30px !important; }
}

/* ══════════ GLOBAL SEARCH ══════════ */
.nav-search-btn {
  background: none; border: none;
  color: var(--text-dim); cursor: pointer;
  padding: 6px; width: 40px; height: 40px;
  border-radius: 8px; display: flex;
  align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
}
.nav-search-btn:hover { color: var(--text); background: var(--surface2); }
.nav-search-btn svg { width: 20px; height: 20px; }

.search-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden;
  transition: all 0.25s;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: min(20vh, 140px);
}
.search-overlay.open { opacity: 1; visibility: visible; }

.search-modal {
  width: 520px; max-width: 92vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px var(--gold-glow);
  transform: translateY(-20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
  overflow: hidden;
}
.search-overlay.open .search-modal {
  transform: translateY(0) scale(1);
}

.search-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.search-input-wrap svg { width: 20px; height: 20px; color: var(--gold); flex-shrink: 0; }

.search-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 16px; font-family: 'Inter', sans-serif;
  color: var(--text); font-weight: 500;
}
.search-input::placeholder { color: var(--text-muted); }

.search-kbd {
  font-size: 11px; font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted); background: var(--surface2);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 6px; flex-shrink: 0;
}

.search-results {
  max-height: 360px; overflow-y: auto;
  padding: 8px;
}
.search-results:empty { display: none; }

.search-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  padding: 8px 12px 4px;
}

.search-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  text-decoration: none; color: var(--text);
  transition: all 0.15s; cursor: pointer;
}
.search-item:hover, .search-item.active {
  background: var(--surface2);
}

.search-item-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--surface3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.search-item-icon.player { color: var(--gold); }
.search-item-icon.team { color: var(--accent); }

.search-item-info { flex: 1; min-width: 0; }
.search-item-name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-item-meta {
  font-size: 12px; color: var(--text-dim); margin-top: 1px;
}

.search-item-rating {
  font-size: 13px; font-weight: 600; color: var(--gold);
  font-family: 'JetBrains Mono', monospace;
}

.search-empty {
  text-align: center; padding: 32px 16px;
  color: var(--text-muted); font-size: 14px;
}

.search-hint {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; color: var(--text-muted);
}

/* Mobile: search btn before burger */
@media (max-width: 900px) {
  .nav-search-btn.desktop-only { display: none !important; }
  .nav-mobile-actions {
    display: flex; align-items: center; gap: 2px;
    margin-left: auto;
  }
}
@media (min-width: 901px) {
  .nav-search-btn.mobile-only { display: none !important; }
  .nav-mobile-actions { display: contents; }
}
