:root {
  /* Arriyadiyah brand */
  --arr-red: #CB0016;
  --arr-red-bright: #FF1E36;
  --arr-red-deep: #8C000F;

  /* Cup identity */
  --gold-deep: #8C6B2F;
  --gold-cup: #D4A574;
  --gold-bright: #FFD66B;
  --gold-shine: #FFE69A;

  /* Saudi accent */
  --green-saudi: #006C35;
  --green-glow: #00D96A;

  /* Surfaces */
  --bg-black: #050505;
  --bg-darker: #020202;
  --surface: #0E0E10;
  --surface-lift: #16161A;
  --surface-hi: #1F1F24;

  /* Borders & text */
  --border-dim: rgba(255, 255, 255, 0.06);
  --border-mid: rgba(255, 214, 107, 0.18);
  --border-red: rgba(255, 30, 54, 0.25);
  --text-primary: #FAFAF5;
  --text-muted: #98989E;
  --text-dim: #5A5A60;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html { scroll-behavior: smooth; }

body {
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  background: var(--bg-black);
  color: var(--text-primary);
  direction: rtl;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(203, 0, 22, 0.22), transparent 70%),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(255, 214, 107, 0.08), transparent 60%),
    radial-gradient(ellipse 50% 40% at 10% 60%, rgba(203, 0, 22, 0.10), transparent 60%);
}

.font-display { font-family: 'Tajawal', system-ui, sans-serif; font-weight: 900; letter-spacing: -0.02em; }
.font-num { font-family: 'Space Grotesk', monospace; font-feature-settings: 'tnum'; letter-spacing: -0.02em; }

/* Stadium grid bg */
.stadium-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.4;
  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;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 80%);
}

.noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Orbs */
.orb { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; z-index: 0; }
.orb-red { background: var(--arr-red); opacity: 0.18; animation: float-orb 18s ease-in-out infinite; }
.orb-gold { background: var(--gold-bright); opacity: 0.10; animation: float-orb 22s ease-in-out infinite reverse; }
@keyframes float-orb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.1); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}

/* Text effects */
.text-glow-red { text-shadow: 0 0 40px rgba(255, 30, 54, 0.4), 0 0 80px rgba(255, 30, 54, 0.2); }
.text-glow-gold { text-shadow: 0 0 40px rgba(255, 214, 107, 0.4), 0 0 80px rgba(255, 214, 107, 0.2); }

.text-gradient-gold {
  background: linear-gradient(135deg, var(--gold-shine) 0%, var(--gold-cup) 50%, var(--gold-deep) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.text-gradient-red {
  background: linear-gradient(135deg, #FF4B5F 0%, var(--arr-red) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* Glass surfaces */
.glass {
  background: linear-gradient(135deg, rgba(22, 22, 26, 0.6) 0%, rgba(10, 10, 12, 0.4) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-dim);
}

/* Buttons */
.btn-gold {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--gold-shine) 0%, var(--gold-cup) 50%, var(--gold-deep) 100%);
  color: var(--bg-black); font-weight: 800; border-radius: 14px;
  padding: 1.05rem 2.4rem;
  box-shadow:
    0 10px 30px -10px rgba(255, 214, 107, 0.5),
    0 0 0 1px rgba(255, 230, 154, 0.4) inset,
    0 -2px 0 0 rgba(140, 107, 47, 0.4) inset;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-gold::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: translateX(100%); transition: transform 0.6s;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -10px rgba(255, 214, 107, 0.7), 0 0 0 1px rgba(255, 230, 154, 0.5) inset, 0 -2px 0 0 rgba(140, 107, 47, 0.4) inset; }
.btn-gold:hover::before { transform: translateX(-100%); }
.btn-gold:active { transform: translateY(0); }

.btn-red {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--arr-red-bright) 0%, var(--arr-red) 60%, var(--arr-red-deep) 100%);
  color: white; font-weight: 800; border-radius: 14px;
  padding: 1.05rem 2.4rem;
  box-shadow:
    0 10px 30px -10px rgba(203, 0, 22, 0.7),
    0 0 0 1px rgba(255, 30, 54, 0.4) inset;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-red:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -10px rgba(255, 30, 54, 0.8), 0 0 0 1px rgba(255, 30, 54, 0.5) inset; }

.btn-ghost {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border-mid); border-radius: 14px;
  padding: 1.05rem 2.4rem; font-weight: 700; transition: all 0.3s;
}
.btn-ghost:hover { background: rgba(255, 214, 107, 0.06); border-color: var(--gold-cup); }

/* Countdown */
.cd-box {
  position: relative;
  background: linear-gradient(180deg, var(--surface-hi) 0%, var(--surface) 100%);
  border: 1px solid var(--border-mid);
  border-radius: 16px;
  padding: 1.25rem 0.5rem 0.85rem;
  min-width: 88px;
  box-shadow: 0 1px 0 rgba(255, 214, 107, 0.1) inset, 0 20px 40px -20px rgba(0, 0, 0, 0.5);
}
.cd-box::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-mid), transparent); opacity: 0.4;
}
.cd-num {
  font-family: 'Space Grotesk', monospace; font-weight: 700; font-size: 3rem; line-height: 1;
  background: linear-gradient(180deg, var(--gold-shine) 0%, var(--gold-cup) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}
.cd-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem; font-weight: 500; }

/* Cards */
.step-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--surface-lift) 0%, var(--surface) 100%);
  border: 1px solid var(--border-dim); border-radius: 24px; padding: 2rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.step-card::before {
  content: ''; position: absolute; top: -1px; right: -1px; width: 60%; height: 60%;
  background: radial-gradient(circle at top right, rgba(255, 30, 54, 0.18), transparent 70%);
  opacity: 0; transition: opacity 0.4s;
}
.step-card:hover { border-color: var(--border-red); transform: translateY(-4px); }
.step-card:hover::before { opacity: 1; }
.step-num {
  position: absolute; top: 1.25rem; left: 1.5rem;
  font-family: 'Space Grotesk', monospace; font-size: 5rem; font-weight: 800; line-height: 1;
  color: var(--surface-hi); opacity: 0.7;
}

.prize-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--surface-lift) 0%, var(--surface) 100%);
  border: 1px solid var(--border-dim); border-radius: 24px; padding: 2rem;
  transition: all 0.4s;
}
.prize-card:hover { border-color: var(--border-mid); transform: translateY(-4px); }
.prize-card.featured {
  background:
    linear-gradient(135deg, rgba(140, 107, 47, 0.18) 0%, transparent 60%),
    linear-gradient(135deg, var(--surface-lift) 0%, var(--surface) 100%);
  border-color: var(--gold-deep);
}

.match-card {
  background: linear-gradient(135deg, var(--surface-lift) 0%, var(--surface) 100%);
  border: 1px solid var(--border-dim); border-radius: 20px; padding: 1.5rem;
  transition: all 0.3s;
}
.match-card:hover { border-color: var(--border-mid); transform: translateY(-2px); }

.flag-circle {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; background: var(--surface-hi); border: 1px solid var(--border-dim); flex-shrink: 0;
}

.score-input {
  width: 56px; height: 56px;
  background: var(--bg-darker); border: 1px solid var(--border-mid); border-radius: 12px;
  color: var(--gold-bright);
  font-family: 'Space Grotesk', monospace; font-size: 1.75rem; font-weight: 700; text-align: center;
  transition: all 0.2s;
}
.score-input:focus {
  outline: none; border-color: var(--gold-cup); background: rgba(255, 214, 107, 0.05);
  box-shadow: 0 0 0 4px rgba(255, 214, 107, 0.1);
}

/* Pulse */
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--arr-red-bright); position: relative;
}
.pulse-dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: var(--arr-red-bright); animation: pulse-ring 1.8s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(3); opacity: 0; }
}

/* Leaderboard */
.lb-row {
  display: grid; grid-template-columns: 56px 1fr auto;
  align-items: center; gap: 1rem; padding: 1rem 1.25rem;
  background: linear-gradient(90deg, transparent, var(--surface-lift) 50%, transparent);
  border-radius: 16px; transition: all 0.2s;
}
.lb-row:hover { background: linear-gradient(90deg, transparent, var(--surface-hi) 50%, transparent); }
.lb-rank { font-family: 'Space Grotesk', monospace; font-size: 1.25rem; font-weight: 700; color: var(--text-dim); text-align: center; }
.lb-rank.gold { color: var(--gold-bright); }
.lb-rank.silver { color: #C0C8C2; }
.lb-rank.bronze { color: #C68B5C; }

/* Inputs */
.input-field {
  width: 100%; background: var(--bg-darker); border: 1px solid var(--border-mid);
  border-radius: 14px; padding: 1rem 1.25rem; color: var(--text-primary); font-size: 1.05rem;
  transition: all 0.2s;
}
.input-field::placeholder { color: var(--text-dim); }
.input-field:focus {
  outline: none; border-color: var(--gold-cup);
  background: rgba(255, 214, 107, 0.03); box-shadow: 0 0 0 4px rgba(255, 214, 107, 0.08);
}

/* Section tag */
.section-tag {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgba(203, 0, 22, 0.12); border: 1px solid rgba(255, 30, 54, 0.25);
  color: #FF6B7E; padding: 0.45rem 1rem; border-radius: 999px;
  font-size: 0.82rem; font-weight: 700;
}
.section-tag.gold { background: rgba(255, 214, 107, 0.1); border-color: rgba(255, 214, 107, 0.25); color: var(--gold-bright); }

/* Profile */
.stat-card {
  background: linear-gradient(135deg, var(--surface-lift) 0%, var(--surface) 100%);
  border: 1px solid var(--border-dim); border-radius: 20px; padding: 1.25rem 1.5rem;
}
.tab-btn {
  padding: 0.75rem 1.25rem; color: var(--text-muted); font-weight: 600;
  border-bottom: 2px solid transparent; transition: all 0.2s; cursor: pointer;
}
.tab-btn.active { color: var(--gold-bright); border-bottom-color: var(--gold-cup); }
.tab-btn:hover:not(.active) { color: var(--text-primary); }

/* Reveal */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.8s, transform 0.8s; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* Trophy shine */
@keyframes shine {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(255, 214, 107, 0.3)) drop-shadow(0 0 40px rgba(255, 214, 107, 0.2)); }
  50% { filter: drop-shadow(0 0 30px rgba(255, 214, 107, 0.5)) drop-shadow(0 0 60px rgba(255, 214, 107, 0.3)); }
}
.trophy-shine { animation: shine 4s ease-in-out infinite; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(180deg, rgba(5, 5, 5, 0.85) 0%, rgba(5, 5, 5, 0.6) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-dim);
}
.brand-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.75rem 0.35rem 0.55rem;
  background: rgba(203, 0, 22, 0.12); border: 1px solid var(--border-red);
  border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  color: #FF6B7E;
}
.brand-badge span:not(.pulse-dot) { letter-spacing: 0.04em; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-dim);
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.02));
  margin-top: 6rem;
}

/* Mobile */
@media (max-width: 768px) {
  .cd-num { font-size: 2rem; }
  .cd-box { min-width: 64px; padding: 0.9rem 0.4rem 0.6rem; }
  .step-num { font-size: 3.5rem; top: 1rem; left: 1rem; }
}
