:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-hero: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-footer: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-hero: #ffffff;
  --hero-tagline: rgba(255, 255, 255, 0.95);
  --border-color: rgba(99, 102, 241, 0.12);
  --border-hover: rgba(99, 102, 241, 0.35);
  --card-shadow: 0 4px 15px rgba(79, 70, 229, 0.1);
  --card-shadow-hover: 0 20px 40px rgba(79, 70, 229, 0.18);
  --stat-bg: rgba(255, 255, 255, 0.15);
  --stat-border: rgba(255, 255, 255, 0.3);
  --stat-label: rgba(255, 255, 255, 0.85);
  --stat-number-gradient: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
  --about-bg: #ffffff;
  --section-title-color: #ffffff;
  --btn-secondary-bg: rgba(255, 255, 255, 0.2);
  --btn-secondary-text: #ffffff;
  --btn-secondary-border: rgba(255, 255, 255, 0.4);
  --btn-secondary-hover: rgba(255, 255, 255, 0.3);
  --badge-text: #ffffff;
}

/* Theme toggle button */
.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.3s ease;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-hero: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    --bg-card: linear-gradient(
      145deg,
      rgba(30, 41, 59, 0.8) 0%,
      rgba(15, 23, 42, 0.9) 100%
    );
    --bg-card-hover: rgba(30, 41, 59, 1);
    --bg-footer: linear-gradient(180deg, #0f172a 0%, #020617 100%);
    --text-primary: #f8fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-hero: #ffffff;
    --hero-tagline: #94a3b8;
    --border-color: rgba(99, 102, 241, 0.15);
    --border-hover: rgba(99, 102, 241, 0.4);
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    --card-shadow-hover:
      0 20px 40px rgba(0, 0, 0, 0.3), 0 0 60px rgba(99, 102, 241, 0.15);
    --stat-bg: linear-gradient(
      135deg,
      rgba(99, 102, 241, 0.2) 0%,
      rgba(168, 85, 247, 0.2) 100%
    );
    --stat-border: rgba(99, 102, 241, 0.3);
    --stat-label: rgba(255, 255, 255, 0.8);
    --stat-number-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --about-bg: linear-gradient(
      145deg,
      rgba(30, 41, 59, 0.6) 0%,
      rgba(15, 23, 42, 0.8) 100%
    );
    --section-title-color: #f8fafc;
    --btn-secondary-bg: rgba(255, 255, 255, 0.1);
    --btn-secondary-text: #e2e8f0;
    --btn-secondary-border: rgba(255, 255, 255, 0.2);
    --btn-secondary-hover: rgba(255, 255, 255, 0.15);
    --badge-text: #ffffff;
  }

  .theme-toggle .sun-icon {
    display: block;
  }

  .theme-toggle .moon-icon {
    display: none;
  }
}

/* Explicit dark theme */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-hero: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  --bg-card: linear-gradient(
    145deg,
    rgba(30, 41, 59, 0.8) 0%,
    rgba(15, 23, 42, 0.9) 100%
  );
  --bg-card-hover: rgba(30, 41, 59, 1);
  --bg-footer: linear-gradient(180deg, #0f172a 0%, #020617 100%);
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-hero: #ffffff;
  --hero-tagline: #94a3b8;
  --border-color: rgba(99, 102, 241, 0.15);
  --border-hover: rgba(99, 102, 241, 0.4);
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  --card-shadow-hover:
    0 20px 40px rgba(0, 0, 0, 0.3), 0 0 60px rgba(99, 102, 241, 0.15);
  --stat-bg: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.2) 0%,
    rgba(168, 85, 247, 0.2) 100%
  );
  --stat-border: rgba(99, 102, 241, 0.3);
  --stat-label: rgba(255, 255, 255, 0.8);
  --stat-number-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --about-bg: linear-gradient(
    145deg,
    rgba(30, 41, 59, 0.6) 0%,
    rgba(15, 23, 42, 0.8) 100%
  );
  --section-title-color: #f8fafc;
  --btn-secondary-bg: rgba(255, 255, 255, 0.1);
  --btn-secondary-text: #e2e8f0;
  --btn-secondary-border: rgba(255, 255, 255, 0.2);
  --btn-secondary-hover: rgba(255, 255, 255, 0.15);
  --badge-text: #ffffff;
}

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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

/* Hero Section */
.hero {
  background: var(--bg-hero);
  padding: 80px 20px 120px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(
      circle at 20% 50%,
      rgba(255, 255, 255, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 50%,
      rgba(255, 255, 255, 0.1) 0%,
      transparent 50%
    );
}

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

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text-hero);
  letter-spacing: -1px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.hero .tagline {
  font-size: 1.35rem;
  color: var(--hero-tagline);
  margin-bottom: 48px;
  font-weight: 400;
}

/* Stats Section */
.stats-container {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.stat-card {
  background: var(--stat-bg);
  border: 1px solid var(--stat-border);
  border-radius: 20px;
  padding: 32px 48px;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.2);
}

.stat-link {
  text-decoration: none;
  cursor: pointer;
}

.stat-number {
  font-size: 4rem;
  font-weight: 800;
  background: var(--stat-number-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 1rem;
  color: var(--stat-label);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}

/* CTA Buttons */
.cta-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.cta-btn.primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.cta-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}

.cta-btn.secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--btn-secondary-border);
}

.cta-btn.secondary:hover {
  background: var(--btn-secondary-hover);
  border-color: var(--btn-secondary-border);
}

/* Main Content */
main {
  max-width: 1400px;
  margin: -60px auto 0;
  padding: 0 20px 80px;
  position: relative;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--section-title-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title .count-badge {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: var(--badge-text);
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: 30px;
  font-weight: 600;
}

/* App Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.app {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--card-shadow);
}

.app::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1 0%, #a855f7 50%, #6366f1 100%);
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.app:hover {
  transform: translateY(-8px);
  border-color: var(--border-hover);
  box-shadow: var(--card-shadow-hover);
}

.app:hover::before {
  transform: scaleX(1);
}

.app img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  transition: transform 0.4s ease;
}

.app:hover img {
  transform: scale(1.1) rotate(3deg);
}

.app h2 {
  font-size: 1rem;
  margin: 0 0 8px;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.4;
}

.app p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
  flex-grow: 1;
}

.app a {
  padding: 10px 24px;
  text-decoration: none;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.app a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* About Section */
.about-section {
  margin-top: 80px;
  background: var(--about-bg);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 48px;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.about-section h2 {
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-bottom: 16px;
  font-weight: 700;
}

.about-section p {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.8;
  max-width: 700px;
  margin: 0 auto;
}

/* Footer */
footer {
  text-align: center;
  padding: 48px 20px;
  background: var(--bg-footer);
  border-top: 1px solid var(--border-color);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: #6366f1;
}

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

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app {
  animation: fadeInUp 0.5s ease backwards;
}

.app:nth-child(1) {
  animation-delay: 0.02s;
}
.app:nth-child(2) {
  animation-delay: 0.04s;
}
.app:nth-child(3) {
  animation-delay: 0.06s;
}
.app:nth-child(4) {
  animation-delay: 0.08s;
}
.app:nth-child(5) {
  animation-delay: 0.1s;
}
.app:nth-child(6) {
  animation-delay: 0.12s;
}
.app:nth-child(7) {
  animation-delay: 0.14s;
}
.app:nth-child(8) {
  animation-delay: 0.16s;
}

/* Responsive */
@media (max-width: 768px) {
  .hero {
    padding: 60px 20px 100px;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero .tagline {
    font-size: 1.1rem;
  }

  .stat-card {
    padding: 24px 36px;
  }

  .stat-number {
    font-size: 3rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }

  .about-section {
    padding: 32px 24px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 2rem;
  }

  .stat-card {
    padding: 20px 28px;
    width: 100%;
    max-width: 200px;
  }

  .stat-number {
    font-size: 2.5rem;
  }

  .cta-btn {
    width: 100%;
    justify-content: center;
  }

  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .app {
    padding: 16px 12px;
  }

  .app img {
    width: 56px;
    height: 56px;
  }

  .app h2 {
    font-size: 0.85rem;
  }

  .app p {
    font-size: 0.75rem;
    display: none;
  }
}
