:root {
  --navy: #06091c;
  --navy-mid: #0f1640;
  --purple: #7c3aed;
  --purple-light: #a78bfa;
  --gold: #fbbf24;
  --gold-light: #fde68a;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: #94a3b8;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --header-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --container: min(1120px, 100% - 32px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body.web-landing {
  font-family: var(--font);
  background: var(--navy);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(24px + var(--safe-bottom));
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body.web-landing input,
body.web-landing textarea {
  -webkit-user-select: text;
  user-select: text;
  touch-action: auto;
}

a { color: var(--purple-light); text-decoration: none; }
a:hover { color: var(--gold-light); }

.container {
  width: var(--container);
  margin-inline: auto;
}

.hidden { display: none !important; }

/* Background */
.web-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.web-bg-mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124, 58, 237, 0.28), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(251, 191, 36, 0.08), transparent 50%),
    linear-gradient(180deg, #06091c 0%, #0a1030 50%, #06091c 100%);
}

.web-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: orbFloat 18s ease-in-out infinite;
}

.web-bg-orb-1 {
  width: 320px;
  height: 320px;
  background: #7c3aed;
  top: 10%;
  left: -8%;
}

.web-bg-orb-2 {
  width: 280px;
  height: 280px;
  background: #d97706;
  bottom: 20%;
  right: -6%;
  animation-delay: -6s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(24px, -16px) scale(1.06); }
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: var(--safe-top);
  background: rgba(6, 9, 28, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
}

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), #9333ea);
  font-size: 1rem;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.45);
}

.logo-text em {
  font-style: normal;
  color: var(--gold);
}

#nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.nav a:not(.btn) {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.nav a:not(.btn):hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--glass);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 90;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
  white-space: nowrap;
}

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

.btn,
.tab,
.nav-toggle,
.nav a,
.fab-download {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.45);
}

.btn-primary:hover {
  color: #fff;
  box-shadow: 0 6px 28px rgba(124, 58, 237, 0.55);
}

.btn-play-store {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.btn-play-store:hover {
  color: #fff;
  background: linear-gradient(135deg, #1e293b, #334155);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
}

.play-store-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35em;
  height: 1.35em;
  border-radius: 4px;
  background: linear-gradient(135deg, #34a853, #4285f4 50%, #ea4335);
  font-size: 0.72em;
  line-height: 1;
  margin-right: 2px;
}

.btn-ghost {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--text); background: var(--glass-strong); }

.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: 14px; }

.btn-nav-play { margin-left: 4px; padding: 8px 16px; font-size: 0.85rem; }

/* Hero */
.hero {
  padding: clamp(48px, 10vw, 88px) 0 clamp(48px, 8vw, 72px);
  text-align: center;
}

.hero-inner {
  max-width: 720px;
  margin-inline: auto;
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(167, 139, 250, 0.35);
  color: var(--purple-light);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.2rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero-gradient {
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.12rem);
  max-width: 560px;
  margin: 0 auto 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 36px;
  justify-content: center;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(16px, 4vw, 32px);
  justify-content: center;
}

.hero-stat {
  min-width: 80px;
}

.hero-stat strong {
  display: block;
  font-size: clamp(1.6rem, 4vw, 2rem);
  color: var(--gold);
  line-height: 1.1;
}

.hero-stat span {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hero-stat.skeleton strong { opacity: 0.4; }

/* Sections */
.section {
  padding: clamp(40px, 7vw, 64px) 0;
  scroll-margin-top: calc(var(--header-h) + var(--safe-top) + 12px);
}

.section-alt {
  background: rgba(0, 0, 0, 0.18);
  border-block: 1px solid rgba(255, 255, 255, 0.04);
}

.section-head {
  margin-bottom: 28px;
}

.section-head h2 {
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  margin-bottom: 6px;
}

.section-head p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Features */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.feature-card {
  padding: 22px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s;
}

.feature-card:hover {
  border-color: rgba(124, 58, 237, 0.4);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* Cards */
.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: border-color 0.2s;
}

.card:hover { border-color: rgba(167, 139, 250, 0.35); }

.card .type {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.card .type-news { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.card .type-update { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.card .type-event { background: rgba(251, 191, 36, 0.2); color: var(--gold-light); }

.card h3 { font-size: 1.05rem; margin-bottom: 8px; line-height: 1.35; }
.card p { color: var(--muted); font-size: 0.9rem; margin-bottom: 12px; }
.card time, .card .meta { font-size: 0.8rem; color: var(--muted); }

.card-tournament .prize {
  color: var(--gold);
  font-weight: 800;
  font-size: 1.1rem;
  margin: 8px 0;
}

.card-tournament .status {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(124, 58, 237, 0.25);
  color: var(--purple-light);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 16px;
}

.loading-shimmer:empty {
  min-height: 120px;
  border-radius: 16px;
  background: linear-gradient(90deg, var(--glass) 25%, var(--glass-strong) 50%, var(--glass) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

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

/* Glass panel */
.glass-panel {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(12px, 3vw, 24px);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  padding: 10px 18px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.15s;
}

.tab:hover { color: var(--text); background: var(--glass); }
.tab.active {
  background: linear-gradient(135deg, var(--purple), #9333ea);
  color: #fff;
  border-color: transparent;
}

/* Leaderboard */
.lb-desktop { display: block; overflow-x: auto; }
.lb-mobile { display: none; }

table { width: 100%; border-collapse: collapse; min-width: 480px; }

th, td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.85rem;
}

.rank-1 { background: linear-gradient(135deg, #fbbf24, #d97706); color: #1a1028; }
.rank-2 { background: linear-gradient(135deg, #94a3b8, #64748b); color: #0f172a; }
.rank-3 { background: linear-gradient(135deg, #cd7f32, #92400e); color: #fff; }

.lb-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lb-card:last-child { border-bottom: none; }

.lb-card-info { flex: 1; min-width: 0; }
.lb-card-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-card-info small { color: var(--muted); font-size: 0.8rem; }
.lb-card-score { font-weight: 800; color: var(--gold); font-size: 1.1rem; }

.player-link {
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.player-link:hover { color: var(--purple-light); }

/* Search & profile */
.search-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.search-box input {
  flex: 1;
  min-width: min(100%, 200px);
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 1rem;
}

.search-box input:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

.profile-card {
  padding: 24px;
}

.profile-card h3 {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.profile-stat {
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
}

.profile-stat strong {
  display: block;
  font-size: 1.2rem;
  color: var(--gold);
}

.profile-stat span {
  font-size: 0.78rem;
  color: var(--muted);
}

/* FAQ */
.faq details {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 10px;
}

.faq summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: '+';
  color: var(--purple-light);
  font-size: 1.2rem;
  font-weight: 400;
}

.faq details[open] summary::after { content: '−'; }

.faq p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 calc(32px + var(--safe-bottom));
  margin-top: 24px;
  background: rgba(0, 0, 0, 0.25);
}

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

.footer-brand strong { color: var(--gold); font-size: 1.1rem; }
.footer-brand p { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a { color: var(--muted); font-size: 0.9rem; }
.footer-links a:hover { color: var(--text); }

.footer-copy {
  width: 100%;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 8px;
}

/* FAB download (mobile) */
.fab-download {
  display: none;
  position: fixed;
  right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 80;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #34a853, #4285f4);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 900;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(52, 168, 83, 0.45);
  text-decoration: none;
}

/* Mobile nav & layout */
@media (max-width: 900px) {
  body.web-landing {
    padding-bottom: calc(88px + var(--safe-bottom));
  }

  .logo { font-size: 1rem; }

  .hero {
    padding-top: clamp(32px, 8vw, 56px);
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 420px;
    margin-inline: auto;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }

  .search-box {
    flex-direction: column;
  }

  .search-box .btn {
    width: 100%;
    min-height: 48px;
  }

  .search-box input {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  .profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .faq details summary {
    padding: 14px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-toggle { display: flex; }

  .nav {
    position: fixed;
    top: 0;
    right: 0;
    width: min(300px, 88vw);
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: calc(var(--safe-top) + 72px) 20px 24px;
    background: rgba(10, 14, 40, 0.98);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 95;
    overflow-y: auto;
  }

  #nav-links {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 4px;
  }

  .nav.open { transform: translateX(0); }

  .nav a:not(.btn) {
    padding: 14px 16px;
    font-size: 1rem;
  }

  .btn-nav-play {
    margin: 12px 0 0;
    width: 100%;
    padding: 14px;
  }

  .lb-desktop { display: none; }
  .lb-mobile { display: block; }

  .fab-download { display: flex; }
}

@media (max-width: 480px) {
  :root {
    --container: min(1120px, 100% - 20px);
    --header-h: 56px;
  }

  .hero h1 {
    font-size: clamp(1.75rem, 8vw, 2.25rem);
  }

  .hero-lead {
    font-size: 0.95rem;
  }

  .hero-stats {
    gap: 12px;
  }

  .hero-stat {
    flex: 1 1 calc(33% - 12px);
    min-width: 0;
  }

  .hero-stat strong {
    font-size: 1.35rem;
  }

  .feature-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }

  .section-head h2 { font-size: 1.25rem; }

  .tabs .tab {
    flex: 1 1 calc(50% - 4px);
    min-width: calc(50% - 4px);
    text-align: center;
    padding: 12px 8px;
    min-height: 44px;
  }

  .glass-panel {
    padding: 12px;
    border-radius: 14px;
  }

  .btn-lg {
    padding: 14px 18px;
    font-size: 0.95rem;
  }

  .footer {
    padding-top: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .web-bg-orb { animation: none; }
  html { scroll-behavior: auto; }
}
