
:root {
  /* الألوان الأساسية للوضع الليلي الملكي */
  --royal-dark: #0a0a1a;
  --royal-darker: #050510;
  --royal-card: rgba(20, 20, 40, 0.9);
  --royal-card-hover: rgba(25, 25, 45, 0.95);
  --royal-border: rgba(120, 119, 198, 0.3);
  --royal-border-light: rgba(120, 119, 198, 0.15);

  /* الألوان الملكية */
  --royal-gold: #ffd700;
  --royal-gold-light: #fff8dc;
  --royal-purple: #9370db;
  --royal-purple-dark: #7b68ee;
  --royal-blue: #4169e1;
  --royal-red: #dc143c;
  --royal-emerald: #50c878;

  /* درجات الذهب */
  --gold-primary: #ffd700;
  --gold-secondary: #daa520;
  --gold-dark: #b8860b;

  /* درجات الأرجواني */
  --purple-primary: #9370db;
  --purple-secondary: #8a2be2;
  --purple-dark: #4b0082;

  /* النصوص */
  --text-royal: #f8f8ff;
  --text-royal-light: #e6e6fa;
  --text-royal-muted: #b0b0d0;

  /* التأثيرات */
  --royal-shadow: rgba(0, 0, 0, 0.4);
  --royal-glow: rgba(255, 215, 0, 0.3);
  --royal-glow-purple: rgba(147, 112, 219, 0.3);

  /* الزوايا والانتقالات */
  --radius-lg: 20px;
  --radius-md: 15px;
  --radius-sm: 10px;
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========= Base Styles ========= */
* {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Cairo", "El Messiri", sans-serif;
  background: var(--royal-dark);
  color: var(--text-royal);
  direction: rtl;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  transition: var(--transition);
  background-image:
    radial-gradient(
      circle at 20% 80%,
      rgba(147, 112, 219, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(255, 215, 0, 0.1) 0%,
      transparent 50%
    );
}

/* ========= Header الملكي (غير ثابت) ========= */
.king-header {
  position: relative;
  z-index: 1000;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(15px);
  border-bottom: 2px solid var(--royal-border);
  box-shadow: 0 5px 20px var(--royal-shadow);
  transition: var(--transition);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 5%;
  max-width: 1400px;
  margin: 0 auto;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.crown-icon {
  background: linear-gradient(135deg, var(--royal-gold), var(--gold-secondary));
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--royal-dark);
  box-shadow: 0 0 20px var(--royal-glow);
  animation: crownGlow 3s infinite;
}

.logo-content {
  display: flex;
  flex-direction: column;
}

.logo-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-main {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--royal-gold), var(--royal-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-sub {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--royal-gold);
  text-shadow: 0 0 10px var(--royal-glow);
}

.logo-tagline {
  font-size: 0.85rem;
  color: var(--text-royal-light);
  margin-top: 0.3rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.stats-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(147, 112, 219, 0.15);
  border-radius: var(--radius-md);
  border: 1px solid var(--royal-border);
  font-size: 0.9rem;
  color: var(--text-royal-light);
}

.stats-badge i {
  color: var(--royal-gold);
}

.stats-badge strong {
  color: var(--royal-gold);
  font-weight: 800;
}

/* ========= Navigation الملكي ========= */
.king-nav {
  background: rgba(20, 20, 40, 0.8);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--royal-border-light);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 5%;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
  padding: 1rem 0;
  overflow-x: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--text-royal-light);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: var(--transition);
  white-space: nowrap;
  font-weight: 600;
}

.nav-link:hover {
  background: rgba(147, 112, 219, 0.15);
  color: var(--royal-purple);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--royal-purple), var(--royal-blue));
  color: white;
  box-shadow: 0 5px 15px var(--royal-glow-purple);
}

/* ========= Hero Section الملكي مع صورة المنصة ========= */
.king-hero {
  position: relative;
  padding: 3rem 5% 3rem;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    rgba(10, 10, 26, 0.95) 0%,
    rgba(20, 20, 40, 0.9) 100%
  );
  border-bottom: 2px solid var(--royal-border);
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(
      circle at 30% 30%,
      rgba(255, 215, 0, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 70% 70%,
      rgba(147, 112, 219, 0.1) 0%,
      transparent 50%
    );
  z-index: 1;
}

/* صورة المنصة */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

.platform-image {
  position: relative;
  max-width: 900px;
  margin: 0 auto 3rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 40px var(--royal-shadow);
  border: 3px solid var(--royal-gold);
}

.platform-image img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.platform-image:hover img {
  transform: scale(1.05);
}

.platform-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(10, 10, 26, 0.9), transparent);
  padding: 2rem;
  text-align: center;
}

.platform-title {
  font-size: 2rem;
  font-weight: 900;
  color: var(--royal-gold);
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.platform-desc {
  font-size: 1.1rem;
  color: var(--text-royal-light);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-crown {
  font-size: 4rem;
  color: var(--royal-gold);
  margin-bottom: 1.5rem;
  animation: float 6s ease-in-out infinite;
  text-shadow: 0 0 30px var(--royal-glow);
}

.hero-title {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 1rem;
  line-height: 1.3;
  color: var(--text-royal);
}

.hero-highlight {
  display: block;
  font-size: 3.5rem;
  background: linear-gradient(
    90deg,
    var(--royal-gold),
    var(--royal-purple),
    var(--royal-blue)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  margin-top: 0.5rem;
}

.hero-subtitle {
  font-size: 1.4rem;
  color: var(--text-royal-light);
  margin-bottom: 3rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  border: 1px solid var(--royal-border);
  backdrop-filter: blur(10px);
  transition: var(--transition);
  min-width: 160px;
}

.stat-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px var(--royal-shadow);
  border-color: var(--royal-gold);
}

.stat-item i {
  font-size: 2.2rem;
  color: var(--royal-gold);
}

.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--royal-gold);
  line-height: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-royal-light);
  display: block;
  margin-top: 0.3rem;
}

/* ========= مميزات المنصة ========= */
.platform-features {
  padding: 4rem 5%;
  background: rgba(20, 20, 40, 0.5);
  margin: 2rem 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.feature-card {
  padding: 2rem;
  background: var(--royal-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--royal-border);
  transition: var(--transition);
  text-align: center;
}

.feature-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px var(--royal-shadow);
  border-color: var(--royal-gold);
}

.feature-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, var(--royal-purple), var(--royal-blue));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
}

.feature-card h3 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-royal);
}

.feature-card p {
  color: var(--text-royal-light);
  line-height: 1.6;
}

/* ========= Main Container ========= */
.king-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 5% 4rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ========= Quick Actions ========= */
.quick-actions-section {
  margin-bottom: 4rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 1.5rem;
  color: var(--royal-gold);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title i {
  color: var(--royal-purple);
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.quick-action {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: var(--transition);
  gap: 1.5rem;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.quick-action::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.1) 0%,
    rgba(147, 112, 219, 0.1) 100%
  );
  opacity: 0;
  transition: var(--transition);
}

.quick-action:hover::before {
  opacity: 1;
}

.quick-action.royal {
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.15),
    rgba(147, 112, 219, 0.15)
  );
  border-color: var(--royal-gold);
}

.quick-action.elite {
  background: linear-gradient(
    135deg,
    rgba(147, 112, 219, 0.15),
    rgba(65, 105, 225, 0.15)
  );
  border-color: var(--royal-purple);
}

.quick-action.noble {
  background: linear-gradient(
    135deg,
    rgba(65, 105, 225, 0.15),
    rgba(80, 200, 120, 0.15)
  );
  border-color: var(--royal-blue);
}

.quick-action:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px var(--royal-shadow);
}

.action-icon {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.quick-action.royal .action-icon {
  background: linear-gradient(135deg, var(--royal-gold), var(--gold-secondary));
  color: var(--royal-dark);
}

.quick-action.elite .action-icon {
  background: linear-gradient(
    135deg,
    var(--royal-purple),
    var(--purple-secondary)
  );
  color: white;
}

.quick-action.noble .action-icon {
  background: linear-gradient(135deg, var(--royal-blue), #6495ed);
  color: white;
}

.action-content {
  flex: 1;
  text-align: right;
}

.action-content h3 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-royal);
}

.action-content p {
  color: var(--text-royal-light);
  font-size: 0.9rem;
}

.action-arrow {
  color: var(--text-royal-light);
  font-size: 1.2rem;
  transition: var(--transition);
}

.quick-action:hover .action-arrow {
  transform: translateX(-5px);
  color: var(--royal-gold);
}

/* ========= Ranking Section - التصميم المحسن ========= */
.ranking-section {
  margin-bottom: 4rem;
  position: relative;
}

.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section-title-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
}

.crown-decoration {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--royal-gold), var(--gold-secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--royal-dark);
  box-shadow: 0 5px 20px var(--royal-glow);
  animation: crownGlow 3s infinite;
}

.title-text {
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--royal-gold), var(--royal-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.2;
}

.title-sub {
  font-size: 1.2rem;
  color: var(--text-royal-light);
  font-weight: 500;
}

.section-subtitle {
  text-align: center;
  font-size: 1.2rem;
  color: var(--text-royal-light);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* Tabs */
.ranking-tabs {
  background: var(--royal-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--royal-border);
  box-shadow: 0 5px 20px var(--royal-shadow);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.tabs-container {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--royal-border);
  border-radius: var(--radius-md);
  color: var(--text-royal-light);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
}

.tab-btn:hover {
  background: rgba(147, 112, 219, 0.15);
  transform: translateY(-2px);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--royal-purple), var(--royal-blue));
  color: white;
  border-color: var(--royal-purple);
  box-shadow: 0 5px 15px var(--royal-glow-purple);
}

.tab-btn i {
  font-size: 1rem;
}

/* Stats Overview */
.stats-overview {
  margin-bottom: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--royal-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--royal-border);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px var(--royal-shadow);
  border-color: var(--royal-gold);
}

.stat-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--royal-purple), var(--royal-blue));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-number {
  font-size: 2rem;
  font-weight: 900;
  color: var(--royal-gold);
  line-height: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-royal-light);
}

/* Enhanced Table */
.ranking-container {
  background: var(--royal-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--royal-border);
  box-shadow: 0 10px 40px var(--royal-shadow);
  margin-bottom: 2rem;
}

.table-wrapper {
  overflow-x: auto;
}

.enhanced-header {
  display: grid;
  grid-template-columns: 80px 2fr 1fr;
  background: linear-gradient(90deg, var(--royal-purple), var(--royal-blue));
  padding: 1.2rem 1.5rem;
  font-weight: 700;
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-cell {
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-content i {
  font-size: 1.1rem;
}

.enhanced-body {
  max-height: 600px;
  overflow-y: auto;
}

/* Loading State */
.loading-state {
  padding: 3rem;
  text-align: center;
  color: var(--text-royal-light);
}

.spinner {
  font-size: 3rem;
  color: var(--royal-gold);
  margin-bottom: 1rem;
}

.spinner i {
  animation: crownGlow 2s infinite;
}

/* Enhanced Coach Row */
.coach-row-enhanced {
  display: grid;
  grid-template-columns: 80px 2fr 1fr;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--royal-border);
  align-items: center;
  transition: var(--transition);
  position: relative;
}

.coach-row-enhanced:hover {
  background: rgba(255, 255, 255, 0.05);
}

.coach-row-enhanced::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
  transition: var(--transition);
}

.coach-row-enhanced.king::before {
  background: linear-gradient(
    to bottom,
    var(--royal-gold),
    var(--gold-secondary)
  );
}

.coach-row-enhanced.prince::before {
  background: linear-gradient(
    to bottom,
    var(--royal-purple),
    var(--purple-secondary)
  );
}

.coach-row-enhanced.noble::before {
  background: linear-gradient(to bottom, var(--royal-blue), #6495ed);
}

.rank-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-royal-light);
}

.rank-display.king {
  color: var(--royal-gold);
}

.rank-display.prince {
  color: var(--royal-purple);
}

.rank-display.noble {
  color: var(--royal-blue);
}

.rank-display i {
  font-size: 1.2rem;
}

.coach-info-enhanced {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.coach-avatar-enhanced {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid transparent;
  transition: var(--transition);
}

.coach-row-enhanced.king .coach-avatar-enhanced {
  border-color: var(--royal-gold);
  box-shadow: 0 0 20px var(--royal-glow);
}

.coach-row-enhanced.prince .coach-avatar-enhanced {
  border-color: var(--royal-purple);
}

.coach-avatar-enhanced img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--royal-purple), var(--royal-blue));
  color: white;
  font-weight: 700;
  font-size: 1.5rem;
}

.coach-details-enhanced {
  flex: 1;
}

.coach-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-royal);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.coach-title {
  font-size: 0.9rem;
  color: var(--text-royal-light);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.7rem;
  border-radius: 12px;
  display: inline-block;
}

.coach-level {
  font-size: 0.85rem;
  color: var(--royal-gold);
  font-weight: 600;
}

.stats-display-enhanced {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-badge-enhanced {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  border: 1px solid var(--royal-border);
  min-width: 70px;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--royal-gold);
  line-height: 1;
}

.stat-label-small {
  font-size: 0.75rem;
  color: var(--text-royal-light);
  margin-top: 0.2rem;
}

/* Pagination */
.ranking-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  border: 1px solid var(--royal-border);
  margin-bottom: 2rem;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--royal-border);
  border-radius: var(--radius-md);
  color: var(--text-royal-light);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-btn:not(:disabled):hover {
  background: rgba(147, 112, 219, 0.15);
  transform: translateY(-2px);
}

.page-numbers {
  display: flex;
  gap: 0.5rem;
}

.page-number {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--royal-border);
  border-radius: var(--radius-md);
  color: var(--text-royal-light);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-weight: 600;
}

.page-number:hover {
  background: rgba(147, 112, 219, 0.15);
}

.page-number.active {
  background: linear-gradient(135deg, var(--royal-purple), var(--royal-blue));
  color: white;
  border-color: var(--royal-purple);
}

.page-dots {
  color: var(--text-royal-light);
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
}

.items-per-page {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-royal-light);
}

.page-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--royal-border);
  border-radius: var(--radius-md);
  color: var(--text-royal);
  padding: 0.4rem 0.8rem;
  font-family: inherit;
  cursor: pointer;
}

/* Ranking Info */
.ranking-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.legend-container {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--royal-border);
}

.legend-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--royal-gold);
  margin-bottom: 1.5rem;
}

.legend-title i {
  font-size: 1.1rem;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  transition: var(--transition);
}

.legend-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px var(--royal-shadow);
}

.legend-item.elite {
  border-color: var(--royal-gold);
}

.legend-item.royal {
  border-color: var(--royal-purple);
}

.legend-item.noble {
  border-color: var(--royal-blue);
}

.legend-item.knight {
  border-color: var(--text-royal-light);
}

.legend-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.legend-item.elite .legend-icon {
  background: linear-gradient(135deg, var(--royal-gold), var(--gold-secondary));
  color: var(--royal-dark);
}

.legend-item.royal .legend-icon {
  background: linear-gradient(
    135deg,
    var(--royal-purple),
    var(--purple-secondary)
  );
  color: white;
}

.legend-item.noble .legend-icon {
  background: linear-gradient(135deg, var(--royal-blue), #6495ed);
  color: white;
}

.legend-item.knight .legend-icon {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-royal-light);
}

.legend-content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.legend-rank {
  font-size: 0.85rem;
  color: var(--text-royal-light);
}

.legend-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-royal);
}

.legend-desc {
  font-size: 0.8rem;
  color: var(--text-royal-muted);
}

/* ========= Rules Section ========= */
.rules-section {
  margin-bottom: 4rem;
}

.rules-card {
  background: linear-gradient(
    135deg,
    rgba(20, 20, 40, 0.9),
    rgba(30, 30, 60, 0.9)
  );
  border: 2px solid var(--royal-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 40px var(--royal-shadow);
}

.rules-header {
  background: linear-gradient(90deg, var(--royal-purple), var(--royal-blue));
  padding: 2rem;
  text-align: center;
  color: white;
}

.rules-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--royal-gold);
}

.rules-content {
  padding: 2rem;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.rule-item {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  transition: var(--transition);
  align-items: flex-start;
}

.rule-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px var(--royal-shadow);
}

.rule-item.critical {
  background: linear-gradient(
    135deg,
    rgba(220, 20, 60, 0.1),
    rgba(178, 34, 34, 0.1)
  );
  border: 1px solid rgba(220, 20, 60, 0.3);
}

.rule-item.warning {
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.1),
    rgba(218, 165, 32, 0.1)
  );
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.rule-item.success {
  background: linear-gradient(
    135deg,
    rgba(80, 200, 120, 0.1),
    rgba(60, 179, 113, 0.1)
  );
  border: 1px solid rgba(80, 200, 120, 0.3);
}

.rule-item.info {
  background: linear-gradient(
    135deg,
    rgba(65, 105, 225, 0.1),
    rgba(30, 144, 255, 0.1)
  );
  border: 1px solid rgba(65, 105, 225, 0.3);
}

.rule-icon {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.rule-item.critical .rule-icon {
  background: rgba(220, 20, 60, 0.2);
  color: #dc143c;
}

.rule-item.warning .rule-icon {
  background: rgba(255, 215, 0, 0.2);
  color: var(--royal-gold);
}

.rule-item.success .rule-icon {
  background: rgba(80, 200, 120, 0.2);
  color: var(--royal-emerald);
}

.rule-item.info .rule-icon {
  background: rgba(65, 105, 225, 0.2);
  color: var(--royal-blue);
}

.rule-content h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-royal);
}

.rule-content p {
  color: var(--text-royal-light);
  line-height: 1.6;
}

.rules-footer {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--royal-border);
}

.kingdom-motto {
  max-width: 600px;
  margin: 0 auto;
  padding: 1.5rem;
  background: rgba(255, 215, 0, 0.1);
  border-radius: var(--radius-lg);
  border: 1px solid var(--royal-gold);
}

.kingdom-motto i {
  font-size: 2rem;
  color: var(--royal-gold);
  margin-bottom: 1rem;
  display: block;
}

.kingdom-motto p {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--royal-gold);
  line-height: 1.5;
}

/* ========= Footer المحسن ========= */
.site-footer {
  background: linear-gradient(
    135deg,
    rgba(20, 20, 40, 0.95) 0%,
    rgba(10, 10, 26, 1) 100%
  );
  border-top: 2px solid var(--royal-border);
  position: relative;
  overflow: hidden;
  margin-top: 4rem;
}

.footer-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

.footer-gradient-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to top,
    rgba(10, 10, 26, 0.9) 0%,
    transparent 100%
  );
}

.footer-effect {
  position: absolute;
  border-radius: 50%;
  opacity: 0.1;
  filter: blur(40px);
}

.footer-effect-1 {
  top: 10%;
  left: 20%;
  width: 200px;
  height: 200px;
  background: var(--royal-gold);
  animation: float 8s ease-in-out infinite;
}

.footer-effect-2 {
  bottom: 10%;
  right: 20%;
  width: 250px;
  height: 250px;
  background: var(--royal-purple);
  animation: float 10s ease-in-out infinite reverse;
}

.footer-content {
  position: relative;
  z-index: 2;
  padding: 3rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Social Links Footer */
.social-links-footer {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 20px;
  font-size: 1.5rem;
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.social-link::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 18px;
  padding: 2px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.social-link.whatsapp {
  background: linear-gradient(135deg, var(--royal-emerald), #128c7e);
}

.social-link.telegram {
  background: linear-gradient(135deg, var(--royal-blue), #005580);
}

.social-link.instagram {
  background: linear-gradient(135deg, #e4405f, var(--royal-purple));
}

.social-link.game {
  background: linear-gradient(135deg, var(--royal-gold), var(--gold-secondary));
}

.social-link:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.social-link:hover i {
  transform: scale(1.2);
}

.social-link i {
  transition: transform 0.3s ease;
}

/* Footer Copyright المحسن */
.footer-copyright {
  border-top: 1px solid var(--royal-border-light);
  padding-top: 2rem;
}

.copyright-content {
  text-align: center;
}

.developer-text {
  color: var(--text-royal-light);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.gradient-text {
  background: linear-gradient(90deg, var(--royal-gold), var(--royal-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 600;
}

.developer-link {
  background: linear-gradient(135deg, var(--royal-purple), var(--royal-blue));
  color: white;
  padding: 0.5rem 1.2rem;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(147, 112, 219, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0 0.5rem;
}

.developer-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(147, 112, 219, 0.4);
  background: linear-gradient(135deg, var(--royal-purple-dark), #4b0082);
}

.footer-tagline {
  color: var(--text-royal-muted);
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* ========= Animations الملكية ========= */
@keyframes crownGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.7));
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.9));
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-15px) rotate(5deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

@media (min-width: 1440px) {
  .container {
    max-width: 1400px;
  }
  
  .hero-title {
    font-size: 3.5rem;
  }
  
  .hero-highlight {
    font-size: 4rem;
  }
}

/* ========= للشاشات المتوسطة الكبيرة (1200px - 1439px) ========= */
@media (max-width: 1439px) {
  .header-container,
  .nav-container,
  .container {
    padding-left: 3%;
    padding-right: 3%;
  }
}

/* ========= للأجهزة اللوحية الكبيرة (1024px - 1199px) ========= */
@media (max-width: 1199px) {
  /* Header */
  .logo-main {
    font-size: 1.2rem;
  }
  
  .logo-sub {
    font-size: 1.5rem;
  }
  
  /* Hero */
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-highlight {
    font-size: 2.8rem;
  }
  
  .hero-subtitle {
    font-size: 1.2rem;
  }
  
  /* Platform Image */
  .platform-image img {
    height: 250px;
  }
  
  .platform-title {
    font-size: 1.7rem;
  }
  
  /* Features Grid */
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Stats Grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Table */
  .enhanced-header,
  .coach-row-enhanced {
    grid-template-columns: 70px 2fr 1fr;
    padding: 1rem 1.2rem;
  }
  
  .coach-avatar-enhanced {
    width: 55px;
    height: 55px;
  }
}

/* ========= للأجهزة اللوحية (768px - 1023px) ========= */
@media (max-width: 1023px) {
  /* Header Layout */
  .header-container {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 4%;
  }
  
  .header-actions {
    width: 100%;
    justify-content: center;
  }
  
  .stats-badge {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
  }
  
  /* Navigation */
  .nav-links {
    justify-content: flex-start;
    gap: 1rem;
    padding: 0.8rem 0;
  }
  
  .nav-link {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
  }
  
  .nav-link i {
    font-size: 0.9rem;
  }
  
  /* Hero Section */
  .king-hero {
    padding: 2rem 4%;
  }
  
  .hero-crown {
    font-size: 3rem;
  }
  
  .hero-stats {
    gap: 1rem;
  }
  
  .stat-item {
    min-width: 150px;
    padding: 1rem;
  }
  
  .stat-item i {
    font-size: 1.8rem;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
  
  .stat-label {
    font-size: 0.85rem;
  }
  
  /* Platform Image */
  .platform-image {
    margin-bottom: 2rem;
  }
  
  .platform-image img {
    height: 220px;
  }
  
  .platform-overlay {
    padding: 1.5rem;
  }
  
  .platform-title {
    font-size: 1.5rem;
  }
  
  .platform-desc {
    font-size: 1rem;
  }
  
  /* Quick Actions */
  .quick-actions-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  /* Rules Grid */
  .rules-grid {
    grid-template-columns: 1fr;
  }
  
  /* Legend Grid */
  .legend-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Table */
  .enhanced-header,
  .coach-row-enhanced {
    grid-template-columns: 60px 2fr 1fr;
    padding: 0.9rem 1rem;
  }
  
  .rank-display {
    font-size: 1.3rem;
  }
  
  .coach-name {
    font-size: 1.1rem;
  }
  
  /* Pagination */
  .ranking-pagination {
    padding: 1rem;
  }
  
  .page-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  /* Footer */
  .social-link {
    width: 55px;
    height: 55px;
    font-size: 1.4rem;
  }
}

/* ========= للهواتف الكبيرة والأجهزة اللوحية الصغيرة (576px - 767px) ========= */
@media (max-width: 767px) {
  /* Base */
  .container,
  .king-main {
    padding-left: 4%;
    padding-right: 4%;
  }
  
  /* Header */
  .crown-icon {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }
  
  .logo-main {
    font-size: 1.1rem;
  }
  
  .logo-sub {
    font-size: 1.4rem;
  }
  
  .logo-tagline {
    font-size: 0.75rem;
  }
  
  /* Navigation */
  .nav-links {
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .nav-link {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    flex: 0 0 auto;
  }
  
  /* Hero */
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-highlight {
    font-size: 2.2rem;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
    margin-bottom: 2rem;
  }
  
  .hero-crown {
    font-size: 2.5rem;
    margin-bottom: 1rem;
  }
  
  /* Platform Image */
  .platform-image img {
    height: 180px;
  }
  
  .platform-title {
    font-size: 1.3rem;
  }
  
  .platform-desc {
    font-size: 0.9rem;
  }
  
  /* Hero Stats */
  .hero-stats {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }
  
  .stat-item {
    width: 100%;
    min-width: auto;
    justify-content: flex-start;
  }
  
  /* Section Titles */
  .section-title {
    font-size: 1.6rem;
  }
  
  .title-text {
    font-size: 1.8rem;
  }
  
  /* Features */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .feature-icon {
    width: 60px;
    height: 60px;
    font-size: 1.7rem;
  }
  
  .feature-card h3 {
    font-size: 1.2rem;
  }
  
  /* Stats Overview */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-icon {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
  }
  
  /* Tabs */
  .ranking-tabs {
    padding: 1rem;
  }
  
  .tabs-container {
    flex-direction: column;
    width: 100%;
  }
  
  .tab-btn {
    width: 100%;
    justify-content: center;
    padding: 0.7rem 1rem;
  }
  
  /* Table */
  .enhanced-header,
  .coach-row-enhanced {
    grid-template-columns: 50px 2fr 1fr;
    padding: 0.8rem;
    gap: 0.5rem;
  }
  
  .rank-display {
    font-size: 1.2rem;
  }
  
  .rank-display i {
    font-size: 1rem;
  }
  
  .coach-avatar-enhanced {
    width: 50px;
    height: 50px;
  }
  
  .avatar-placeholder {
    font-size: 1.3rem;
  }
  
  .coach-name {
    font-size: 1rem;
  }
  
  .coach-title {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
  }
  
  .stat-badge-enhanced {
    padding: 0.4rem 0.6rem;
    min-width: 60px;
  }
  
  .stat-value {
    font-size: 1rem;
  }
  
  .stat-label-small {
    font-size: 0.7rem;
  }
  
  /* Pagination */
  .ranking-pagination {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .pagination-controls {
    justify-content: center;
  }
  
  .items-per-page {
    justify-content: center;
  }
  
  /* Legend */
  .legend-grid {
    grid-template-columns: 1fr;
  }
  
  /* Crown Decoration - مخفي في الشاشات الصغيرة */
  .crown-decoration {
    width: 45px;
    height: 45px;
    font-size: 1.4rem;
  }
  
  /* Footer */
  .footer-content {
    padding: 2rem 1.5rem;
  }
  
  .social-links-footer {
    gap: 1rem;
  }
  
  .social-link {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
  }
  
  .developer-text {
    font-size: 1rem;
  }
  
  .developer-link {
    padding: 0.4rem 1rem;
    font-size: 0.95rem;
  }
}

/* ========= للهواتف المتوسطة (480px - 575px) ========= */
@media (max-width: 575px) {
  /* Hero */
  .hero-title {
    font-size: 1.7rem;
  }
  
  .hero-highlight {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  /* Platform Image */
  .platform-image img {
    height: 160px;
  }
  
  .platform-title {
    font-size: 1.2rem;
  }
  
  .platform-desc {
    font-size: 0.85rem;
  }
  
  /* Table */
  .enhanced-header,
  .coach-row-enhanced {
    grid-template-columns: 45px 2fr 1fr;
    padding: 0.7rem 0.5rem;
  }
  
  .rank-display {
    font-size: 1.1rem;
  }
  
  .coach-avatar-enhanced {
    width: 45px;
    height: 45px;
  }
  
  .avatar-placeholder {
    font-size: 1.2rem;
  }
  
  .coach-name {
    font-size: 0.95rem;
  }
  
  .stats-display-enhanced {
    flex-direction: column;
    gap: 0.4rem;
  }
  
  .stat-badge-enhanced {
    padding: 0.3rem 0.5rem;
    min-width: 55px;
  }
  
  .stat-value {
    font-size: 0.95rem;
  }
  
  /* Stats Grid */
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ========= للهواتف الصغيرة (0 - 479px) ========= */
@media (max-width: 479px) {
  /* Base Spacing */
  .king-main {
    padding: 1.5rem 3%;
  }
  
  /* Header */
  .header-container {
    padding: 0.8rem 3%;
  }
  
  .logo-wrapper {
    gap: 0.7rem;
  }
  
  .crown-icon {
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
  }
  
  .logo-main {
    font-size: 1rem;
  }
  
  .logo-sub {
    font-size: 1.2rem;
  }
  
  .logo-tagline {
    font-size: 0.7rem;
  }
  
  .stats-badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }
  
  /* Navigation */
  .nav-links {
    gap: 0.4rem;
  }
  
  .nav-link {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
  }
  
  .nav-link i {
    font-size: 0.85rem;
  }
  
  /* Hero */
  .king-hero {
    padding: 1.5rem 3%;
  }
  
  .hero-crown {
    font-size: 2rem;
  }
  
  .hero-title {
    font-size: 1.5rem;
  }
  
  .hero-highlight {
    font-size: 1.7rem;
  }
  
  .hero-subtitle {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
  }
  
  /* Platform Image */
  .platform-image {
    margin-bottom: 1.5rem;
  }
  
  .platform-image img {
    height: 140px;
  }
  
  .platform-overlay {
    padding: 1rem;
  }
  
  .platform-title {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
  }
  
  .platform-desc {
    font-size: 0.8rem;
  }
  
  /* Stats Items */
  .stat-item {
    padding: 0.8rem;
  }
  
  .stat-item i {
    font-size: 1.5rem;
  }
  
  .stat-number {
    font-size: 1.3rem;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
  
  /* Section Titles */
  .section-title {
    font-size: 1.4rem;
  }
  
  .title-text {
    font-size: 1.5rem;
  }
  
  .section-subtitle {
    font-size: 0.95rem;
  }
  
  /* Crown Decoration - Hidden on very small screens */
  .crown-decoration {
    display: none;
  }
  
  /* Features */
  .platform-features {
    padding: 3rem 3%;
  }
  
  .feature-icon {
    width: 55px;
    height: 55px;
    font-size: 1.5rem;
  }
  
  .feature-card h3 {
    font-size: 1.1rem;
  }
  
  .feature-card p {
    font-size: 0.9rem;
  }
  
  /* Quick Actions */
  .action-icon {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }
  
  .action-content h3 {
    font-size: 1.1rem;
  }
  
  .action-content p {
    font-size: 0.85rem;
  }
  
  /* Stats Cards */
  .stat-card {
    padding: 0.8rem;
  }
  
  .stat-icon {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
  
  /* Table */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .enhanced-header {
    min-width: 100%;
  }
  
  .enhanced-header,
  .coach-row-enhanced {
    grid-template-columns: 40px minmax(150px, 2fr) minmax(80px, 1fr);
    padding: 0.6rem 0.4rem;
  }
  
  .rank-display {
    font-size: 1rem;
  }
  
  .rank-display i {
    font-size: 0.9rem;
  }
  
  .coach-info-enhanced {
    gap: 0.6rem;
  }
  
  .coach-avatar-enhanced {
    width: 40px;
    height: 40px;
  }
  
  .avatar-placeholder {
    font-size: 1.1rem;
  }
  
  .coach-name {
    font-size: 0.9rem;
  }
  
  .coach-title {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
  }
  
  .stat-badge-enhanced {
    padding: 0.25rem 0.4rem;
    min-width: 50px;
  }
  
  .stat-value {
    font-size: 0.9rem;
  }
  
  .stat-label-small {
    font-size: 0.65rem;
  }
  
  /* Pagination */
  .page-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
  
  .page-number {
    width: 35px;
    height: 35px;
    font-size: 0.9rem;
  }
  
  .page-select {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
  }
  
  /* Rules */
  .rules-card {
    border-width: 1px;
  }
  
  .rules-header {
    padding: 1.5rem 1rem;
  }
  
  .rules-icon {
    font-size: 2rem;
  }
  
  .rules-content {
    padding: 1.5rem 1rem;
  }
  
  .rule-item {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
    padding: 1rem;
  }
  
  .rule-icon {
    margin: 0 auto;
  }
  
  .rule-content h3 {
    font-size: 1.1rem;
  }
  
  .rule-content p {
    font-size: 0.9rem;
  }
  
  .kingdom-motto {
    padding: 1rem;
  }
  
  .kingdom-motto i {
    font-size: 1.5rem;
  }
  
  .kingdom-motto p {
    font-size: 1.1rem;
  }
  
  /* Legend */
  .legend-container {
    padding: 1rem;
  }
  
  .legend-title {
    font-size: 1.1rem;
  }
  
  .legend-item {
    flex-direction: column;
    text-align: center;
    gap: 0.7rem;
    padding: 0.8rem;
  }
  
  .legend-icon {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    margin: 0 auto;
  }
  
  .legend-rank {
    font-size: 0.8rem;
  }
  
  .legend-title {
    font-size: 0.95rem;
  }
  
  .legend-desc {
    font-size: 0.75rem;
  }
  
  /* Footer */
  .footer-content {
    padding: 1.5rem 1rem;
  }
  
  .social-links-footer {
    gap: 0.8rem;
  }
  
  .social-link {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
  }
  
  .developer-text {
    font-size: 0.9rem;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .gradient-text {
    font-size: 0.85rem;
  }
  
  .developer-link {
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
  }
  
  .footer-tagline {
    font-size: 0.85rem;
  }
}

/* ========= للوضع الأفقي على الهواتف ========= */
@media (max-width: 767px) and (orientation: landscape) {
  .king-hero {
    padding: 1.5rem 4% 1rem;
  }
  
  .hero-title {
    font-size: 1.6rem;
  }
  
  .hero-highlight {
    font-size: 1.8rem;
  }
  
  .hero-stats {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .stat-item {
    min-width: 140px;
    flex: 0 0 auto;
  }
  
  .platform-image img {
    height: 200px;
  }
}

/* ========= تحسينات للشاشات شديدة الصغر (320px) ========= */
@media (max-width: 359px) {
  .hero-title {
    font-size: 1.3rem;
  }
  
  .hero-highlight {
    font-size: 1.5rem;
  }
  
  .platform-image img {
    height: 120px;
  }
  
  .platform-title {
    font-size: 1rem;
  }
  
  .section-title {
    font-size: 1.2rem;
  }
  
  .title-text {
    font-size: 1.3rem;
  }
  
  .enhanced-header,
  .coach-row-enhanced {
    grid-template-columns: 35px minmax(120px, 2fr) minmax(70px, 1fr);
  }
  
  .coach-avatar-enhanced {
    width: 35px;
    height: 35px;
  }
  
  .rank-display {
    font-size: 0.95rem;
  }
  
  .coach-name {
    font-size: 0.85rem;
  }
}

/* ========= تحسينات إمكانية الوصول ========= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========= تحسينات للطباعة ========= */
@media print {
  .king-header,
  .king-nav,
  .quick-actions-section,
  .site-footer,
  .back-to-top,
  .scroll-progress {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .ranking-section {
    page-break-inside: avoid;
  }
}

/* ========= تحسينات Touch للأجهزة اللمسية ========= */
@media (hover: none) and (pointer: coarse) {
  /* زيادة مساحة النقر للأزرار */
  .nav-link,
  .tab-btn,
  .page-btn,
  .page-number {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* تحسين التمرير الأفقي */
  .nav-links,
  .table-wrapper {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  
  /* إزالة تأثيرات Hover على الأجهزة اللمسية */
  .coach-row-enhanced:hover {
    background: transparent;
  }
  
  .quick-action:hover {
    transform: none;
  }
}

/* ========= إصلاح مشاكل Safari على iOS ========= */
@supports (-webkit-touch-callout: none) {
  /* إصلاح مشكلة 100vh في Safari iOS */
  .king-hero {
    min-height: -webkit-fill-available;
  }
  
  /* إصلاح مشكلة الحدود المنحنية */
  .coach-avatar-enhanced,
  .crown-icon,
  .action-icon {
    -webkit-mask-image: -webkit-radial-gradient(white, black);
  }
}

/* ========= تحسينات خاصة بـ Firefox ========= */
@-moz-document url-prefix() {
  .table-wrapper {
    scrollbar-width: thin;
    scrollbar-color: var(--royal-purple) rgba(255, 255, 255, 0.1);
  }
}

/* ========= Scrollbar للمتصفحات الحديثة ========= */
.table-wrapper::-webkit-scrollbar,
.nav-links::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.table-wrapper::-webkit-scrollbar-track,
.nav-links::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.table-wrapper::-webkit-scrollbar-thumb,
.nav-links::-webkit-scrollbar-thumb {
  background: var(--royal-purple);
  border-radius: 10px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover,
.nav-links::-webkit-scrollbar-thumb:hover {
  background: var(--royal-purple-dark);
}

/* ========= تحسينات الأداء للأجهزة الضعيفة ========= */
@media (max-width: 768px) {
  /* تقليل تأثيرات الظل والتمويه */
  .king-header,
  .king-nav,
  .ranking-container,
  .rules-card {
    box-shadow: 0 2px 10px var(--royal-shadow);
  }
  
  /* تعطيل backdrop-filter للأداء الأفضل */
  .king-header,
  .king-nav,
  .stat-item {
    backdrop-filter: none;
  }
  
  /* تبسيط الرسوم المتحركة */
  .footer-effect-1,
  .footer-effect-2 {
    display: none;
  }
}