@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== HERO ===== */

.hero {
  height: 100vh;
  min-height: 700px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 5%;
  position: relative;
  margin-top: var(--header-height);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Базовый фон для KantMarket (тёмный) */
body.theme-kant .hero {
  background:
    linear-gradient(rgba(15, 15, 19, 0.7), rgba(15, 15, 19, 0.9)),
    url('https://images.unsplash.com/photo-1600369672771-985a7adf0b8a?auto=format&fit=crop&w=2070&q=80') center / cover no-repeat fixed;
}

body.theme-kant .hero::before {
  background: radial-gradient(circle at center, transparent 0%, var(--bg-dark) 150%);
}

/* Светлый фон для ПарЭкспресс */
body.theme-par .hero {
  background:
    linear-gradient(180deg, #f7f5ff, #f2edff);
}

body.theme-par .hero::before {
  background: radial-gradient(circle at center, transparent 0%, rgba(247, 245, 255, 1) 120%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  animation: fadeInUp 0.8s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: 1.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
  font-weight: 800;
}

.hero p {
  font-size: clamp(1rem, 2vw, 1.3rem);
  max-width: 700px;
  margin: 0 auto 2.5rem;
  color: var(--text-secondary);
  opacity: 0.9;
  line-height: 1.7;
}

.hero-actions {
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.hero-actions .go-to-catalog {
  width: 100%;
  justify-content: center;
}

/* ===== HERO RATING ===== */
.hero-rating {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.8rem 1.05rem;
  margin: 0;
  border-radius: 18px;
  border: 1px solid var(--accent-neon-transparent);
  background: rgba(20, 23, 34, 0.65);
  box-shadow:
    0 16px 50px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 240, 255, 0.10) inset;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero-rating-label-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}

.hero-rating-label {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: rgba(207, 213, 230, 0.92);
}

.hero-rating-period {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(152, 160, 179, 0.9);
}

.hero-rating-faq-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(152, 160, 179, 0.95);
  text-decoration: none;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.hero-rating-faq-link:hover {
  color: rgba(0, 240, 255, 0.95);
  text-decoration: underline;
}

.hero-rating-main {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.85rem;
}

.hero-rating-score {
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.25);
}

.hero-rating-max {
  font-size: 0.95rem;
  font-weight: 800;
  opacity: 0.85;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: rgba(207, 213, 230, 0.92);
  -webkit-text-fill-color: rgba(207, 213, 230, 0.92);
}

.hero-rating-stars {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 1.05rem;
  color: #ffd45a;
  filter: drop-shadow(0 6px 16px rgba(255, 212, 90, 0.18));
}

.hero-rating-stars .fa-star-half-stroke {
  color: #ffd45a;
}

.hero-rating-stars .fa-star {
  color: #ffd45a;
}

.hero-rating-stars .fa-star,
.hero-rating-stars .fa-star-half-stroke {
  text-shadow: 0 0 12px rgba(255, 212, 90, 0.20);
}

.hero-rating-stars .fa-star,
.hero-rating-stars .fa-star-half-stroke,
.hero-rating-stars .fa-star {
  transform: translateZ(0);
}

.hero-rating-stars .fa-star,
.hero-rating-stars .fa-star-half-stroke {
  will-change: transform;
}

.hero-rating-stars .fa-star,
.hero-rating-stars .fa-star-half-stroke {
  transition: transform 0.2s ease;
}

.hero-rating:hover .hero-rating-stars .fa-star,
.hero-rating:hover .hero-rating-stars .fa-star-half-stroke {
  transform: translateY(-1px);
}

.hero-rating-stars .fa-star,
.hero-rating-stars .fa-star-half-stroke,
.hero-rating-stars .fa-star {
  -webkit-font-smoothing: antialiased;
}

.hero-rating-stars .fa-star,
.hero-rating-stars .fa-star-half-stroke {
  opacity: 0.98;
}

.hero-rating-stars .fa-star,
.hero-rating-stars .fa-star-half-stroke {
  display: inline-block;
}

.hero-rating-stars .fa-star,
.hero-rating-stars .fa-star-half-stroke {
  line-height: 1;
}

.hero-rating-stars .fa-star,
.hero-rating-stars .fa-star-half-stroke,
.hero-rating-stars .fa-star {
  pointer-events: none;
}

.hero-rating-stars .fa-star,
.hero-rating-stars .fa-star-half-stroke {
  vertical-align: middle;
}

.hero-rating-meta {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(152, 160, 179, 0.95);
}

/* ===== CATEGORIES ===== */

.categories {
  padding: 6rem 5%;
  background: var(--bg-darker);
  position: relative;
  overflow: hidden;
}

.categories::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(0, 240, 255, 0.03) 0%, transparent 30%),
    radial-gradient(circle at 80% 70%, rgba(0, 132, 255, 0.03) 0%, transparent 30%);
  pointer-events: none;
}

.categories .section-title-wrapper {
  text-align: center;
  margin-bottom: 3.5rem;
}

.categories .section-title {
  display: inline-block;
}

.category-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.category-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 2rem 1.5rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--box-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: var(--transition);
}

.category-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: var(--transition);
  z-index: 0;
}

.category-card:hover {
  transform: translateY(-0.5rem);
  box-shadow: 0 20px 40px rgba(0, 240, 255, 0.1);
  border-color: var(--accent-neon);
}

.category-card:hover::before {
  opacity: 0.1;
}

.category-icon {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  color: var(--accent-neon);
  position: relative;
  z-index: 1;
  transition: var(--transition);
}

.category-card:hover .category-icon {
  transform: scale(1.1) translateY(-0.5rem);
}

.category-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}

/* ===== SPACE / PLANET BG ===== */

#space-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at center, #0a0a10 0%, #050507 100%),
    linear-gradient(135deg, #050507 25%, #0f0f1a 100%);
  z-index: -2;
}

.planet-container {
  position: absolute;
  top: 50vh;
  left: 50vw;
  transform: translate(-50%, -50%);
  z-index: -1;
  width: min(52vw, 800px);
  height: min(52vw, 800px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  animation: planet-fade 2.5s ease-out forwards;
}

.planet-container svg {
  width: 100%;
  height: 100%;
  max-width: none;
  pointer-events: none;
}

@keyframes planet-fade {
  to {
    opacity: 1;
  }
}

/* ===== MEDIA ===== */

@media (max-width: 1024px) {
  .category-list {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  .hero {
    min-height: 600px;
    padding: 0 1.5rem;
    background-attachment: scroll;
  }

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

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

  .planet-container {
    top: 50vh;
    width: min(85vw, 380px);
    height: min(85vw, 380px);
  }
}

@media (max-width: 480px) {
  .hero {
    min-height: 500px;
  }

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

  .hero p {
    font-size: 1rem;
  }

  .hero-actions {
    width: min(420px, 100%);
    gap: 12px;
  }

  .hero-rating {
    padding: 0.75rem 1rem;
    border-radius: 16px;
  }

  .hero-rating-main {
    gap: 0.65rem;
  }

  .hero-rating-score {
    font-size: 1.35rem;
  }

  .hero-rating-stars {
    font-size: 1rem;
  }

  .hero-rating-label,
  .hero-rating-meta {
    font-size: 0.85rem;
  }

  .go-to-catalog {
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
  }

  .category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-card {
    padding: 1.5rem 1rem;
  }
}

/* Telegram mobile: match desktop layer order without fixing planet to viewport */
html.tg-webapp-mobile body .tg-app-content {
  background: transparent;
}

html.tg-webapp-mobile #space-bg {
  z-index: 0;
  pointer-events: none;
}

html.tg-webapp-mobile .planet-container {
  z-index: 1;
  pointer-events: none;
}

html.tg-webapp-mobile .hero::before {
  z-index: 2;
  background:
    radial-gradient(circle at center, rgba(10, 12, 20, 0.08) 0%, rgba(10, 12, 20, 0.74) 100%),
    linear-gradient(rgba(10, 12, 20, 0.34), rgba(10, 12, 20, 0.62));
}

html.tg-webapp-mobile .hero-content {
  z-index: 3;
}
