:root {
  --bg-color: #050505;
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --accent-color: #3b82f6;
  /* Blue-500 */

  /* Glassmorphism Variables */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 20px;

  /* Gradient Borders */
  --card-border-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
  --hover-border-gradient: linear-gradient(135deg, rgba(59, 130, 246, 0.5) 0%, rgba(147, 51, 234, 0.5) 100%);

  /* Shadows */
  --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);

  /* Animation */
  --transition-smooth: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  /* Smooth scrolling */
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

/* Background Container - Deep Space/Premium Vibe */
.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  background: radial-gradient(circle at 50% 10%, #1a1a2e 0%, #000000 100%);
}

/* Gradients for "Active" feel */
.gradients-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  filter: blur(80px);
  /* Heavy blur for soft light */
  z-index: -1;
  opacity: 0.6;
}

.blob {
  position: absolute;
  border-radius: 50%;
  animation: float 20s infinite ease-in-out alternate;
}

.g1 {
  background: #4f46e5;
  width: 600px;
  height: 600px;
  top: -100px;
  left: -100px;
  opacity: 0.4;
}

.g2 {
  background: #9333ea;
  width: 500px;
  height: 500px;
  bottom: -100px;
  right: -100px;
  animation-delay: -5s;
  opacity: 0.3;
}

.g3 {
  background: #06b6d4;
  width: 400px;
  height: 400px;
  top: 40%;
  left: 60%;
  animation-delay: -10s;
  opacity: 0.2;
}

@keyframes float {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(50px, 50px);
  }
}

/* Header / Hero Section */
header {
  text-align: center;
  padding: 120px 20px 60px;
  /* Big top padding for "No gap" feeling but clear separation */
  position: relative;
  z-index: 10;
}

header h1 {
  font-size: 5rem;
  /* HUGE Title */
  font-weight: 800;
  margin-bottom: 16px;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.04em;
  line-height: 1.1;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  /* Lift off background */
}

header p {
  font-size: 1.5rem;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* App Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 40px;
  /* Dig breathing space */
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px 100px;
  position: relative;
  z-index: 10;
}

/* Glassmorphic Cards */
.card {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-radius: 24px;
  padding: 32px;
  transition: var(--transition-smooth);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Float Animation Entry */
  opacity: 0;
  animation: fadeUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Stagger animations for cards (up to 20 items) */
.card:nth-child(1) {
  animation-delay: 0.1s;
}

.card:nth-child(2) {
  animation-delay: 0.2s;
}

.card:nth-child(3) {
  animation-delay: 0.3s;
}

.card:nth-child(4) {
  animation-delay: 0.4s;
}

.card:nth-child(5) {
  animation-delay: 0.5s;
}

.card:nth-child(6) {
  animation-delay: 0.6s;
}

.card:nth-child(7) {
  animation-delay: 0.7s;
}

.card:nth-child(8) {
  animation-delay: 0.8s;
}

/* Gradient Border Hover Effect */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 1px;
  /* Border width */
  background: var(--card-border-gradient);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: var(--transition-smooth);
  opacity: 0.5;
}

.card:hover {
  transform: translateY(-12px) scale(1.02);
  /* Float */
  background: rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  /* Glow */
}

.card:hover::before {
  background: var(--hover-border-gradient);
  opacity: 1;
}

/* Card Content */
.card-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

/* Icon - Circle Container */
.card-header img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  /* Circle */
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: var(--transition-smooth);
}

.card:hover .card-header img {
  transform: scale(1.1) rotate(5deg);
  /* Playful motion */
  border-color: rgba(255, 255, 255, 0.3);
}

.card h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.rating {
  font-size: 0.875rem;
  color: #fbbf24;
  /* Amber-400 */
  display: flex;
  align-items: center;
  gap: 4px;
}

.desc {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: auto;
  /* Push actions to bottom */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Actions */
.actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.play-btn,
.details-btn {
  padding: 10px 20px;
  border-radius: 9999px;
  /* Pill shape */
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition-smooth);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.details-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.details-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.playstore-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.playstore-btn:hover {
  background: #2563eb;
  /* Blue-600 */
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

/* Modal */
/* Modal */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  /* Allow scrolling of the modal container itself if needed, though we center flex usually */
  background-color: rgba(0, 0, 0, 0.85);
  /* Slightly darker */
  backdrop-filter: blur(16px);
  display: none;
  align-items: center;
  /* Center vertically */
  justify-content: center;
  /* Center horizontally */
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
  /* Prevent touching edges on small screens */
}

.modal.show {
  display: flex;
  /* Flex to center */
  opacity: 1;
}

.modal-content {
  background: rgba(15, 15, 20, 0.95);
  /* Nearly opaque premium dark */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 32px;
  padding: 40px;
  width: 100%;
  max-width: 600px;
  /* Slightly wider */
  max-height: 85vh;
  /* Prevent it from being taller than screen */
  overflow-y: auto;
  /* Scroll INSIDE the modal if content is long */
  position: relative;
  box-shadow: 0 40px 80px -12px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: left;
  /* Align text left for better readability */
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal.show .modal-content {
  transform: scale(1);
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.close {
  position: absolute;
  top: 20px;
  right: 25px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 32px;
  font-weight: 300;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  transition: 0.2s;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

/* Modal Internal Layout */
.modal-header-section {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-icon {
  width: 96px;
  /* Fixed size */
  height: 96px;
  /* Fixed size */
  min-width: 96px;
  /* Don't shrink */
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title-group h2 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  line-height: 1.1;
  color: #fff;
}

.modal-meta-row {
  display: flex;
  gap: 16px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.modal-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 8px;
}

/* Description area */
.modal-content #modalDescription {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #d1d5db;
  /* Gray-300 */
  overflow-x: hidden;
  /* Prevent horizontal scroll */
  max-width: 100%;
}

.modal-content img {
  max-width: 100%;
  /* Ensure images inside description don't overflow */
  border-radius: 12px;
  height: auto;
}

/* Responsive Modal */
@media (max-width: 640px) {
  .modal-content {
    padding: 24px;
    max-height: 90vh;
    border-radius: 24px;
  }

  .modal-header-section {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .modal-icon {
    width: 80px;
    height: 80px;
    min-width: 80px;
  }

  .modal-title-group h2 {
    font-size: 1.75rem;
  }

  .modal-meta-row {
    justify-content: center;
  }

  .close {
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    font-size: 24px;
  }
}


/* Responsive */
@media (max-width: 768px) {
  header {
    padding-top: 80px;
  }

  header h1 {
    font-size: 3rem;
  }

  .grid {
    grid-template-columns: 1fr;
    padding: 0 20px 80px;
  }
}

/* Keyframes */
@keyframes fadeUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Store Badge (Play Store Logo) */
/* Store Badge (Play Store Logo) - Premium Polish */
.store-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* Space between text and logo */
  text-decoration: none;
  outline: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  /* Subtle glass background */
  padding: 10px 20px;
  margin: 0;
  cursor: pointer;
  border-radius: 9999px;
  /* Pill shape */
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  -webkit-tap-highlight-color: transparent;
  color: var(--text-primary);
  /* Ensure text is visible */
  font-weight: 600;
  font-size: 0.95rem;
}

.store-badge:focus {
  outline: none;
}

.store-badge:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 4px;
}

.store-badge img {
  height: 24px;
  /* Smaller logo to fit in button */
  width: auto;
  border-radius: 4px;
  display: block;
  box-shadow: none;
  /* Remove shadow from small icon inside button */
}

.store-badge span {
  line-height: 1;
}

.store-badge:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
  /* Brighter glass on hover */
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.store-badge:active {
  transform: translateY(0) scale(0.98);
}

/* Ensure no conflict in actions container */
.actions .store-badge {
  box-shadow: none;
  /* We want the background/border defined above to apply */
}