/* ══════════════════════════════════════════════════════════════
   CONTEST SECTION — Design System
   Premium SaaS Dashboard + Marketing UI
   Inspired by Stripe, Linear, Revolut
   ══════════════════════════════════════════════════════════════ */

:root {
  --blue: #6FA8DC;
  --blue-dark: #4A8CC4;
  --blue-deeper: #3A78AE;
  --blue-light: #8FBDE6;
  --blue-pale: #B8D7F0;
  --blue-soft: rgba(111, 168, 220, 0.08);
  --blue-glow: rgba(111, 168, 220, 0.15);

  --green: #8BCF9B;
  --green-dark: #6BBB80;
  --green-deeper: #55A76B;
  --green-light: #A8DEB4;
  --green-soft: rgba(139, 207, 155, 0.1);

  --ink: #2E3A45;
  --ink-2: #536270;
  --ink-3: #8695A1;
  --bg: #F7F9FB;
  --bg-warm: #EEF2F6;
  --white: #FFFFFF;
  --dark: #1C2630;

  --bg-primary: var(--bg);
  --bg-surface: var(--white);
  --bg-card: var(--white);
  --bg-card-hover: #F2F5F8;

  --border-subtle: rgba(46, 58, 69, 0.06);
  --border-default: rgba(46, 58, 69, 0.1);
  --border-accent: rgba(111, 168, 220, 0.3);

  --text-primary: var(--ink);
  --text-secondary: var(--ink-2);
  --text-tertiary: var(--ink-3);
  --text-inverse: #FFFFFF;

  --font-display: 'Plus Jakarta Sans', 'Heebo', -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Heebo', -apple-system, sans-serif;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(46, 58, 69, 0.04);
  --shadow-sm: 0 1px 3px rgba(46, 58, 69, 0.06);
  --shadow-md: 0 4px 16px rgba(46, 58, 69, 0.07);
  --shadow-lg: 0 8px 32px rgba(46, 58, 69, 0.09);
  --shadow-glow: 0 0 60px rgba(111, 168, 220, 0.1);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
}

[dir="rtl"] {
  --font-display: 'Heebo', -apple-system, sans-serif;
  --font-body: 'Heebo', -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Subtle noise texture overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ══════════════════════════════════════════
   TOP NAVBAR — Glass effect
   ══════════════════════════════════════════ */
.contest-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid var(--border-subtle);
  transition: box-shadow var(--duration-normal) var(--ease-out);
}
.contest-topbar.scrolled {
  box-shadow: 0 1px 8px rgba(46, 58, 69, 0.06);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--text-primary);
}
.topbar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(111, 168, 220, 0.25);
}
.topbar-brand-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.topbar-brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--blue-soft);
  color: var(--blue-dark);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-accent);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Language selector */
.lang-selector {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 5px 24px 5px 10px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23536270' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}
.lang-selector:hover {
  border-color: var(--blue-pale);
  color: var(--text-primary);
}
.lang-selector:focus {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--blue-pale), var(--green-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue-deeper);
  border: 2px solid var(--white);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

/* ══════════════════════════════════════════
   SUB NAVIGATION — Horizontal tabs
   ══════════════════════════════════════════ */
.contest-subnav {
  position: fixed;
  top: 64px;
  left: 0; right: 0;
  z-index: 99;
  background: rgba(247, 249, 251, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.subnav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.subnav-inner::-webkit-scrollbar { display: none; }

.subnav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px var(--space-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
  border-bottom: 2px solid transparent;
}
.subnav-link:hover {
  color: var(--text-primary);
}
.subnav-link.active {
  color: var(--blue-dark);
  border-bottom-color: var(--blue);
  font-weight: 600;
}
.subnav-link-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ══════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════ */
.contest-page {
  padding-top: 128px; /* topbar 64 + subnav ~48 + gap */
  min-height: 100vh;
}

.contest-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-4xl);
}

.contest-container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-4xl);
}

/* Page header */
.page-header {
  margin-bottom: var(--space-2xl);
}
.page-header-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-dark);
  margin-bottom: var(--space-sm);
}
.page-header-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
}
.page-header-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
  max-width: 540px;
  line-height: 1.6;
}

/* ══════════════════════════════════════════
   STAT CARDS — Dashboard
   ══════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.stat-card:hover::before {
  opacity: 1;
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  margin-bottom: var(--space-md);
}
.stat-card-icon.blue {
  background: var(--blue-soft);
}
.stat-card-icon.green {
  background: var(--green-soft);
}
.stat-card-icon.purple {
  background: rgba(139, 159, 212, 0.1);
}
.stat-card-icon.amber {
  background: rgba(111, 196, 168, 0.1);
}

.stat-card-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-xs);
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-card-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: var(--space-sm);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.stat-card-change.positive {
  background: var(--green-soft);
  color: var(--green-deeper);
}
.stat-card-change.pending {
  background: rgba(111, 168, 220, 0.08);
  color: var(--blue-dark);
}

/* ══════════════════════════════════════════
   DASHBOARD PANELS
   ══════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
}
.panel-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.panel-action {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--blue-dark);
  text-decoration: none;
  transition: color var(--duration-fast);
}
.panel-action:hover {
  color: var(--blue-deeper);
}
.panel-body {
  padding: 0 var(--space-lg) var(--space-lg);
}

/* Referral code panel */
.referral-code-box {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg);
  border: 1.5px dashed var(--border-accent);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
}
.referral-code-value {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--blue-dark);
}
.referral-code-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.referral-code-copy:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}
.referral-code-copy.copied {
  background: var(--green-dark);
}

/* Prize tier mini */
.current-tier-badge {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: linear-gradient(135deg, rgba(111, 168, 220, 0.06), rgba(139, 207, 155, 0.06));
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}
.current-tier-icon {
  font-size: 2.5rem;
  line-height: 1;
}
.current-tier-info {
  flex: 1;
}
.current-tier-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}
.current-tier-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Progress bar */
.progress-container {
  margin-top: var(--space-lg);
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}
.progress-bar {
  height: 10px;
  background: var(--bg-warm);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: var(--radius-full);
  transition: width 1.2s var(--ease-out);
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 20px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
  border-radius: var(--radius-full);
}

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(111, 168, 220, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(111, 168, 220, 0.4);
  transform: translateY(-1px);
}

.btn-gradient {
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: var(--text-inverse);
  box-shadow: 0 2px 12px rgba(111, 168, 220, 0.3);
}
.btn-gradient:hover {
  box-shadow: 0 6px 24px rgba(111, 168, 220, 0.4);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--white);
  color: var(--text-primary);
  border: 1.5px solid var(--border-default);
}
.btn-secondary:hover {
  border-color: var(--blue-pale);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
}
.btn-ghost:hover {
  background: rgba(46, 58, 69, 0.04);
  color: var(--text-primary);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 0.95rem;
}
.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

/* ══════════════════════════════════════════
   SHARE BUTTONS
   ══════════════════════════════════════════ */
.share-buttons {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.share-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  color: white;
  flex: 1;
  min-width: 160px;
  justify-content: center;
}
.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.share-btn-whatsapp {
  background: #25D366;
}
.share-btn-sms {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
}
.share-btn-copy {
  background: var(--white);
  color: var(--text-primary);
  border: 1.5px solid var(--border-default);
}
.share-btn-copy:hover {
  border-color: var(--blue-pale);
  box-shadow: var(--shadow-md);
}

.share-btn-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* Referral link display */
.referral-link-display {
  background: var(--bg);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}
.referral-link-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}
.referral-link-url {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9rem;
  color: var(--blue-dark);
  word-break: break-all;
  line-height: 1.5;
}

/* ══════════════════════════════════════════
   TABLES — Modern design
   ══════════════════════════════════════════ */
.modern-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
}

.modern-table thead th {
  padding: var(--space-md) var(--space-lg);
  text-align: start;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
}

.modern-table tbody td {
  padding: var(--space-md) var(--space-lg);
  font-size: 0.9rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration-fast);
}
.modern-table tbody tr:last-child td {
  border-bottom: none;
}
.modern-table tbody tr:hover td {
  background: var(--bg-card-hover);
}

/* Leaderboard row highlights */
.modern-table tbody tr.rank-1 td {
  background: rgba(111, 168, 220, 0.04);
}
.modern-table tbody tr.rank-2 td {
  background: rgba(139, 207, 155, 0.03);
}
.modern-table tbody tr.current-user td {
  background: linear-gradient(90deg, rgba(111, 168, 220, 0.08), rgba(139, 207, 155, 0.06));
  font-weight: 600;
}
.modern-table tbody tr.current-user td:first-child {
  position: relative;
}
.modern-table tbody tr.current-user td:first-child::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--blue), var(--green));
}

/* Rank badges */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
}
.rank-badge.gold {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}
.rank-badge.silver {
  background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
  color: white;
  box-shadow: 0 2px 8px rgba(192, 192, 192, 0.3);
}
.rank-badge.bronze {
  background: linear-gradient(135deg, #CD7F32, #B8700E);
  color: white;
  box-shadow: 0 2px 8px rgba(205, 127, 50, 0.3);
}
.rank-badge.default {
  background: var(--bg-warm);
  color: var(--text-secondary);
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.status-badge.valid {
  background: var(--green-soft);
  color: var(--green-deeper);
}
.status-badge.pending {
  background: rgba(111, 168, 220, 0.1);
  color: var(--blue-dark);
}
.status-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-badge.valid .status-badge-dot {
  background: var(--green);
}
.status-badge.pending .status-badge-dot {
  background: var(--blue);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Points display in table */
.points-display {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.points-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.points-pending {
  font-size: 0.75rem;
  color: var(--blue-dark);
  background: rgba(111, 168, 220, 0.08);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* User avatar in table */
.table-avatar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.table-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--blue-pale), var(--green-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--blue-deeper);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════
   PRIZE TIER CARDS
   ══════════════════════════════════════════ */
.tiers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-lg);
}

.tier-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  transition: all var(--duration-normal) var(--ease-out);
  overflow: hidden;
}
.tier-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blue-pale), var(--green-light));
  opacity: 0.5;
}
.tier-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.tier-card.featured {
  border-color: var(--border-accent);
  background: linear-gradient(180deg, rgba(111, 168, 220, 0.04) 0%, var(--white) 100%);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.tier-card.featured::before {
  height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  opacity: 1;
}
.tier-card.current {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft), var(--shadow-md);
}
.tier-card.current::after {
  content: attr(data-current-label);
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green-deeper);
  background: var(--green-soft);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.tier-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  line-height: 1;
}
.tier-rank {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}
.tier-amount {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}
.tier-condition {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.tier-progress {
  margin-top: var(--space-md);
}
.tier-progress-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}
.tier-progress-bar {
  height: 6px;
  background: var(--bg-warm);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.tier-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: var(--radius-full);
  transition: width 1s var(--ease-out);
}

/* ══════════════════════════════════════════
   RULES PAGE — Typography
   ══════════════════════════════════════════ */
.rules-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.rules-section {
  padding: var(--space-xl) var(--space-2xl);
  border-bottom: 1px solid var(--border-subtle);
}
.rules-section:last-child {
  border-bottom: none;
}

.rules-section-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.rules-section-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: var(--blue-soft);
}

.rules-list {
  list-style: none;
  counter-reset: rules;
}
.rules-list li {
  counter-increment: rules;
  padding: var(--space-sm) 0;
  padding-inline-start: var(--space-xl);
  position: relative;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.rules-list li::before {
  content: counter(rules) ".";
  position: absolute;
  inset-inline-start: 0;
  font-weight: 700;
  color: var(--blue);
  font-size: 0.85rem;
}

.legal-text {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  line-height: 1.8;
}
.legal-text p {
  margin-bottom: var(--space-md);
}
.legal-text strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Rules subsection titles */
.rules-subsection-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: var(--space-lg) 0 var(--space-sm);
}
.rules-note {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  font-style: italic;
  margin: var(--space-sm) 0 var(--space-lg);
}

/* Rules tables */
.rules-table-wrap {
  overflow-x: auto;
  margin: var(--space-sm) 0;
}
.rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.rules-table th,
.rules-table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
[dir="rtl"] .rules-table th,
[dir="rtl"] .rules-table td {
  text-align: right;
}
.rules-table th {
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-raised);
}
.rules-table td {
  color: var(--text-primary);
}

/* ══════════════════════════════════════════
   FULL-WIDTH INVITE SECTION
   ══════════════════════════════════════════ */
.invite-hero {
  text-align: center;
  padding: var(--space-3xl) 0;
  background: linear-gradient(180deg, rgba(111, 168, 220, 0.04) 0%, transparent 100%);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-2xl);
}
.invite-hero-icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
  line-height: 1;
}
.invite-hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}
.invite-hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 460px;
  margin: 0 auto;
}

/* Code display card */
.code-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  text-align: center;
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-sm);
}
.code-card-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}
.code-card-value {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, var(--blue), var(--green));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--space-lg);
}
.code-card-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

/* ══════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════ */
.contest-footer {
  background: var(--white);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
}
.contest-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.contest-footer-links {
  display: flex;
  gap: var(--space-lg);
}
.contest-footer-link {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--duration-fast);
}
.contest-footer-link:hover {
  color: var(--text-primary);
}
.contest-footer-copy {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

/* ══════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════ */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

.animate-in {
  animation: fade-in-up 0.6s var(--ease-out) both;
}
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.35s; }
.animate-delay-5 { animation-delay: 0.4s; }

/* ══════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.6;
}
.empty-state-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}
.empty-state-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 360px;
  margin: 0 auto var(--space-lg);
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .topbar-inner {
    padding: 0 var(--space-md);
    height: 56px;
  }
  .topbar-brand-badge {
    display: none;
  }

  .contest-subnav {
    top: 56px;
  }
  .subnav-inner {
    padding: 0 var(--space-md);
  }
  .subnav-link {
    padding: 12px var(--space-sm);
    font-size: 0.8rem;
  }
  .subnav-link-icon {
    display: none;
  }

  .contest-page {
    padding-top: 112px;
  }

  .contest-container,
  .contest-container-narrow {
    padding: var(--space-lg) var(--space-md) var(--space-3xl);
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }
  .stat-card {
    padding: var(--space-md);
  }
  .stat-card-value {
    font-size: 1.35rem;
  }

  .share-buttons {
    flex-direction: column;
  }

  .tiers-grid {
    grid-template-columns: 1fr;
  }

  .rules-section {
    padding: var(--space-lg);
  }

  .modern-table thead th,
  .modern-table tbody td {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.82rem;
  }

  .code-card {
    padding: var(--space-xl) var(--space-md);
  }

  .contest-footer-inner {
    flex-direction: column;
    gap: var(--space-md);
  }

  .invite-hero {
    padding: var(--space-2xl) var(--space-md);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .referral-code-box {
    flex-direction: column;
    text-align: center;
  }
  .referral-code-copy {
    width: 100%;
  }
  .code-card-actions {
    flex-direction: column;
  }
  .code-card-actions .btn {
    width: 100%;
  }
  .progress-label {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }
  .page-header-subtitle {
    max-width: 100%;
  }
  .subnav-link {
    padding: 10px 4px;
    font-size: 0.75rem;
  }
  /* Responsive tier grids generated by JS */
  .prizes-tier-grid {
    grid-template-columns: 1fr !important;
  }
  .tier-medals-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm);
  }
  .tier-header-row {
    flex-direction: column;
    text-align: center;
    gap: var(--space-xs);
  }
}

/* Responsive tier grids for prizes page */
.prizes-tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
@media (max-width: 768px) {
  .prizes-tier-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
}
