/* 🌌 КОСМІЧНИЙ ШЕДЕВР - АКТИВНИЙ ФОН */
:root {
  --primary: #ffe600;
  --secondary: #667eea;
  --dark: #0a0a0a;
  --space: #001122;
  --neon: #00f3ff;
  --nebula-purple: #8b5cf6;
  --nebula-blue: #3b82f6;
  --nebula-pink: #ec4899;
  --star-glow: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  margin: 0;
  padding: 0;
  font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, sans-serif;
  color: #e0e0e0;
  line-height: 1.6;
  scroll-behavior: smooth;
  overflow-x: hidden;
  min-height: 100%;
  background: transparent;
  height: 100%;
  position: relative;
}

/* 🌌 АКТИВНИЙ КОСМІЧНИЙ ФОН */
.cosmic-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

/* ШАР ЗІРОК */
.stars-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.8) 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.6) 1px, transparent 1px),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,0.7) 1px, transparent 1px),
    radial-gradient(circle at 60% 20%, rgba(255,255,255,0.5) 1px, transparent 1px),
    radial-gradient(circle at 90% 50%, rgba(255,255,255,0.9) 1px, transparent 1px),
    radial-gradient(circle at 10% 90%, rgba(255,255,255,0.4) 1px, transparent 1px);
  background-size: 
    200px 200px,
    300px 300px,
    400px 400px,
    500px 500px,
    600px 600px,
    700px 700px;
  animation: starsMove 100s linear infinite;
}

/* ШАР ТУМАННОСТЕЙ */
.nebula-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(74, 107, 255, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(147, 112, 219, 0.25) 0%, transparent 45%),
    radial-gradient(ellipse at 40% 80%, rgba(220, 20, 60, 0.2) 0%, transparent 35%),
    radial-gradient(ellipse at 60% 20%, rgba(32, 178, 170, 0.25) 0%, transparent 40%);
  animation: nebulaPulse 30s ease-in-out infinite;
  filter: blur(15px);
}

/* ШАР СВІТЛЯЧКІВ */
.glow-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.3;
  animation: orbFloat 25s ease-in-out infinite;
  mix-blend-mode: screen;
}

.orb-1 {
  width: 400px; height: 400px; background: #8b5cf6;
  top: 10%; left: 20%; animation-delay: 0s;
}
.orb-2 {
  width: 300px; height: 300px; background: #3b82f6;
  top: 60%; left: 70%; animation-delay: -8s;
}
.orb-3 {
  width: 500px; height: 500px; background: #ec4899;
  top: 30%; left: 80%; animation-delay: -16s;
}
.orb-4 {
  width: 350px; height: 350px; background: #00f3ff;
  top: 70%; left: 10%; animation-delay: -12s;
}

/* КОМЕТИ */
.comet-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.comet {
  position: absolute;
  width: 3px;
  height: 3px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 15px 3px rgba(255, 255, 255, 0.9);
  animation: cometFly 8s linear infinite;
}

.comet::after {
  content: '';
  position: absolute;
  top: 0;
  right: -80px;
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8));
  border-radius: 50%;
}

.comet-1 {
  top: 15%; left: -5%; animation-delay: 0s; animation-duration: 12s;
}
.comet-2 {
  top: 40%; left: -8%; animation-delay: 4s; animation-duration: 15s;
}
.comet-3 {
  top: 75%; left: -3%; animation-delay: 8s; animation-duration: 10s;
}

/* ПУЛЬСАР */
.pulsar {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  animation: pulsarGlow 4s ease-out infinite;
}

/* АНІМАЦІЇ ФОНУ */
@keyframes starsMove {
  0% {
    background-position: 
      0px 0px,
      0px 0px,
      0px 0px,
      0px 0px,
      0px 0px,
      0px 0px;
  }
  100% {
    background-position: 
      200px 200px,
      300px 300px,
      400px 400px,
      500px 500px,
      600px 600px,
      700px 700px;
  }
}

@keyframes nebulaPulse {
  0%, 100% { 
    opacity: 0.3;
    transform: scale(1);
  }
  50% { 
    opacity: 0.6;
    transform: scale(1.1);
  }
}

@keyframes orbFloat {
  0%, 100% { 
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  25% { 
    transform: translate(100px, -50px) scale(1.1) rotate(90deg);
  }
  50% { 
    transform: translate(-50px, 80px) scale(0.9) rotate(180deg);
  }
  75% { 
    transform: translate(80px, 40px) scale(1.05) rotate(270deg);
  }
}

@keyframes cometFly {
  0% {
    transform: translateX(0) translateY(0) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateX(120vw) translateY(150px) scale(1);
    opacity: 0;
  }
}

@keyframes pulsarGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  }
  70% {
    box-shadow: 0 0 0 50px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

/* 🚀 PARTICLE EFFECT */
#particles-js {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: -9998;
}

/* 📦 КОНТЕЙНЕРИ */
.container {
  max-width: 1200px;
  margin: auto;
  padding: 0 1rem;
  position: relative;
  z-index: 1;
}

/* ✨ FADE-IN АНІМАЦІЇ */
.fade-in {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 🎯 HEADER */
header {
  text-align: center;
  padding: 6rem 1rem;
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: 
    radial-gradient(
      ellipse at center,
      rgba(255, 230, 0, 0.1) 0%,
      transparent 70%
    );
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: center;
  max-width: 1000px;
  margin: 0 auto;
}

.hero-text h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--neon), var(--nebula-purple));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientText 3s ease infinite;
  background-size: 200% 200%;
  text-shadow: 0 0 20px rgba(255, 230, 0, 0.2);
}

@keyframes gradientText {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-text p {
  font-size: 1.5rem;
  margin-bottom: 2rem;
  opacity: 0.9;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-planet {
  position: relative;
  width: 300px;
  height: 300px;
}

.planet {
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(
      circle at 30% 30%,
      var(--primary) 0%,
      var(--secondary) 30%,
      var(--nebula-purple) 70%,
      transparent 100%
    );
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
  box-shadow: 
    0 0 60px var(--primary),
    inset -20px -20px 40px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(139, 92, 246, 0.3);
  position: relative;
  filter: brightness(1.1);
}

.planet::before {
  content: '';
  position: absolute;
  top: 20%;
  left: 10%;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  filter: blur(8px);
  animation: cloudMove 10s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { 
    transform: translateY(0px) rotate(0deg) scale(1);
  }
  50% { 
    transform: translateY(-20px) rotate(5deg) scale(1.02);
  }
}

@keyframes cloudMove {
  0%, 100% { transform: translateX(0) translateY(0); }
  25% { transform: translateX(20px) translateY(-10px); }
  50% { transform: translateX(-10px) translateY(15px); }
  75% { transform: translateX(15px) translateY(5px); }
}

/* 🧭 НАВІГАЦІЯ */
.nav ul {
  display: flex;
  justify-content: center;
  list-style: none;
  margin-bottom: 3rem;
  padding: 0;
  z-index: 2;
}
.nav ul li { margin: 0 1.5rem; }
.nav ul li a {
  text-decoration: none;
  color: #e0e0e0;
  font-weight: 600;
  transition: all 0.3s ease;
  font-size: 1.1rem;
  position: relative;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.05);
}
.nav ul li a:hover, .nav ul li a.active { 
  color: var(--primary); 
  text-shadow: 0 0 10px rgba(255, 230, 0, 0.2);
  transform: translateY(-2px);
  background: rgba(255, 230, 0, 0.08);
  box-shadow: 0 0 15px rgba(255, 230, 0, 0.15);
}

/* 📱 MENU TOGGLE */
.menu-toggle {
  display: none;
  font-size: 2rem;
  background: none;
  border: none;
  color: #e0e0e0;
  cursor: pointer;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  padding: 0.5rem;
  transition: all 0.3s ease;
}
.menu-toggle:hover {
  color: var(--primary);
  transform: scale(1.1);
}

/* 🎯 КНОПКИ */
.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--nebula-purple));
  color: #111;
  padding: 1rem 2rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 
    0 5px 15px rgba(255, 230, 0, 0.2),
    0 0 25px rgba(102, 126, 234, 0.15);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background-size: 200% 200%;
  animation: buttonGlow 3s ease-in-out infinite;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 8px 20px rgba(255, 230, 0, 0.3),
    0 0 35px rgba(102, 126, 234, 0.25);
  animation: none;
}

@keyframes buttonGlow {
  0%, 100% { 
    box-shadow: 
      0 5px 15px rgba(255, 230, 0, 0.2),
      0 0 25px rgba(102, 126, 234, 0.15);
  }
  50% { 
    box-shadow: 
      0 5px 18px rgba(255, 230, 0, 0.25),
      0 0 30px rgba(139, 92, 246, 0.2);
  }
}

/* 📄 СЕКЦІЇ */
section { 
  padding: 5rem 0; 
  position: relative; 
  z-index: 2; 
  background: 
    radial-gradient(
      ellipse at top,
      rgba(255, 255, 255, 0.01) 0%,
      transparent 50%
    );
}

h2 { 
  margin-bottom: 3rem; 
  color: var(--primary);
  font-size: 2.5rem; 
  text-align: center;
  position: relative;
  text-shadow: 0 0 15px rgba(255, 230, 0, 0.15);
}

h2::after {
  content: '';
  position: absolute;
  width: 100px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--neon), var(--nebula-purple));
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(255, 230, 0, 0.3);
}

/* 👨‍🚀 ABOUT SECTION */
#about {
  background: 
    radial-gradient(
      ellipse at center,
      rgba(0, 17, 34, 0.6) 0%,
      transparent 70%
    );
  backdrop-filter: blur(10px);
}

.about-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 4rem;
  align-items: center;
}

.about-text {
  text-align: left;
}

.about-text p {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  line-height: 1.8;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

.about-img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 20px;
  border: 3px solid var(--primary);
  box-shadow: 
    0 8px 25px rgba(255, 230, 0, 0.15),
    0 0 35px rgba(102, 126, 234, 0.2);
  transition: all 0.3s ease;
}

.about-img:hover {
  transform: scale(1.02);
  box-shadow: 
    0 12px 35px rgba(255, 230, 0, 0.2),
    0 0 50px rgba(139, 92, 246, 0.3);
}

/* 🛠️ SKILLS SECTION */
#skills {
  background: 
    radial-gradient(
      ellipse at center,
      rgba(0, 10, 20, 0.6) 0%,
      transparent 70%
    );
  backdrop-filter: blur(10px);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
  margin-top: 1rem;
}

.skill-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  border-radius: 15px;
  text-align: center;
  padding: 2rem 1rem;
  color: #e0e0e0;
  cursor: default;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.skill-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transition: 0.5s;
}

.skill-card:hover::before {
  left: 100%;
}

.skill-card i {
  margin-bottom: 1rem;
  color: var(--primary);
  font-size: 2.5rem;
  text-shadow: 0 0 12px rgba(255, 230, 0, 0.4);
}
.skill-card p {
  margin: 0;
  font-weight: 600;
  font-size: 1.1rem;
}
.skill-card:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 
    0 12px 25px rgba(255, 230, 0, 0.15),
    0 0 30px rgba(102, 126, 234, 0.2);
  border-color: var(--primary);
}

/* 🌌 КОСМІЧНЕ ПОРТФОЛІО */
#space-portfolio {
  position: relative;
  isolation: isolate; /* важливо */
}

#space-portfolio::before {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
  backdrop-filter: none !important;
  z-index: -1;
}

@keyframes spaceGlow {
  0% { 
    opacity: 0.5;
    filter: hue-rotate(0deg);
  }
  100% { 
    opacity: 0.8;
    filter: hue-rotate(45deg);
  }
}

#space-scene {
  width: 95%;
  height: 65vh;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 
    0 0 80px rgba(0, 100, 255, 0.5),
    inset 0 0 60px rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(100, 200, 255, 0.3);
  background: linear-gradient(45deg, #000428, #001933);
}

.space-subtitle {
  text-align: center;
  font-size: 1.2rem;
  margin-bottom: 3rem;
  color: #87CEEB;
  text-shadow: 0 0 8px rgba(135, 206, 235, 0.4);
}

/* 🎯 КОСМІЧНІ КНОПКИ */
.space-controls {
  position: absolute;
  bottom: 15px;
  right: 15px;
  display: flex;
  gap: 0.6rem;
  z-index: 101;
}

.space-control-btn {
  background: rgba(0, 30, 60, 0.9);
  border: 2px solid rgba(100, 200, 255, 0.5);
  color: #87CEEB;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: all;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(100, 200, 255, 0.25);
}

.space-control-btn:hover {
  background: rgba(100, 200, 255, 0.25);
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(100, 200, 255, 0.6);
}

#close-view {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 100, 100, 0.9);
  border: 2px solid rgba(255, 150, 150, 0.5);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: all;
  backdrop-filter: blur(10px);
  display: none;
  z-index: 102;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 0 15px rgba(255, 100, 100, 0.4);
}

#close-view:hover {
  background: rgba(255, 100, 100, 1);
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(255, 100, 100, 0.6);
}

/* 🎯 GOALS SECTION */
#goals {
  background: 
    radial-gradient(
      ellipse at center,
      rgba(0, 17, 34, 0.6) 0%,
      transparent 70%
    );
  backdrop-filter: blur(10px);
}

.goals-content p {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 3rem;
  font-size: 1.1rem;
  line-height: 1.8;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.goal-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  border-radius: 15px;
  padding: 2rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.goal-card:hover {
  transform: translateY(-10px);
  border-color: var(--primary);
  box-shadow: 
    0 12px 25px rgba(255, 230, 0, 0.1),
    0 0 35px rgba(102, 126, 234, 0.15);
}

.goal-card i {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 1rem;
  text-shadow: 0 0 15px rgba(255, 230, 0, 0.4);
}

.goal-card h4 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

/* 📞 CONTACTS SECTION */
#contacts {
  background: 
    radial-gradient(
      ellipse at center,
      rgba(0, 10, 20, 0.6) 0%,
      transparent 70%
    );
  backdrop-filter: blur(10px);
}

.contacts-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  padding: 1.5rem;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.contact-item:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: 
    0 10px 25px rgba(255, 230, 0, 0.08),
    0 0 35px rgba(102, 126, 234, 0.15);
}

.contact-item i {
  font-size: 2rem;
  color: var(--primary);
  text-shadow: 0 0 12px rgba(255, 230, 0, 0.4);
}

.contact-item h4 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.contact-item .btn {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

#contact-form {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  padding: 2rem;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

#contact-form h3 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  text-align: center;
  text-shadow: 0 0 12px rgba(255, 230, 0, 0.4);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: white;
  font-size: 1rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 
    0 0 8px rgba(255, 230, 0, 0.2),
    0 0 15px rgba(102, 126, 234, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* 🐍 SNAKE GAME */
.snake-container {
  padding: 3rem 0;
  background: 
    radial-gradient(
      ellipse at center,
      rgba(0, 17, 34, 0.6) 0%,
      transparent 70%
    );
  backdrop-filter: blur(10px);
}

#snake {
  background: #111;
  border: 3px solid var(--primary);
  display: block;
  margin: 0 auto;
  border-radius: 10px;
  box-shadow: 
    0 0 15px rgba(255, 230, 0, 0.2),
    0 0 30px rgba(102, 126, 234, 0.15);
}

.snake-tip {
  color: #ccc;
  margin-top: 10px;
  font-size: 14px;
  text-align: center;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
}

/* 🦶 FOOTER */
footer {
  position: relative;
  isolation: isolate;
}

footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(16px);
  z-index: -1;
}


.socials {
  margin-top: 1rem;
}

.socials a {
  color: #e0e0e0;
  margin: 0 1rem;
  font-size: 1.5rem;
  transition: all 0.3s ease;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
}

.socials a:hover { 
  color: var(--primary); 
  transform: scale(1.3); 
  text-shadow: 
    0 0 12px var(--primary),
    0 0 25px rgba(255, 230, 0, 0.4);
}

/* ✍️ TYPING EFFECT */
.typing {
  border-right: 2px solid var(--primary);
  padding-right: 2px;
  white-space: nowrap;
  overflow: hidden;
  animation: blink 1s infinite;
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.3);
}

@keyframes blink {
  0%, 50% { 
    border-color: var(--primary);
    text-shadow: 0 0 8px rgba(255, 230, 0, 0.3);
  }
  51%, 100% { 
    border-color: transparent;
    text-shadow: none;
  }
}

/* 📱 MOBILE RESPONSIVE */
@media screen and (max-width: 768px) {
  .nav ul {
    flex-direction: column;
    display: none;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    position: fixed;
    top: 60px;
    right: 1rem;
    width: 200px;
    padding: 1rem;
    border-radius: 15px;
    z-index: 999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
  }
  
  .nav ul.active { 
    display: flex; 
  }
  
  .nav ul li { 
    margin: 1rem 0; 
  }
  
  .nav ul li a {
    display: block;
    padding: 0.5rem;
    font-size: 1.1rem;
  }
  
  .menu-toggle { 
    display: block; 
  }
  
  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .hero-text h1 {
    font-size: 2.5rem;
  }
  
  .hero-planet {
    width: 200px;
    height: 200px;
    margin: 0 auto;
  }

  .about-container {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .contacts-content {
    grid-template-columns: 1fr;
  }
  
  .hero-text h1 {
    font-size: 2rem;
  }
  
  .hero-buttons {
    justify-content: center;
  }
  
  .btn {
    padding: 0.8rem 1.5rem;
  }

  #space-scene {
    height: 50vh;
  }
  
  .space-controls {
    bottom: 10px;
    right: 10px;
  }
  
  .space-control-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  .mobile-projects {
    display: grid;
  }
}

/* 🎨 КОМПАКТНІ СТИЛІ ДЛЯ ІНФОПАНЕЛІ ПЛАНЕТИ */
.planet-info-popup {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: rgba(0, 30, 60, 0.98) !important;
    backdrop-filter: blur(25px) !important;
    color: white !important;
    padding: 1.3rem !important;
    border-radius: 14px !important;
    border: 2px solid #4fc3f7 !important;
    z-index: 1000 !important;
    max-width: 360px !important;
    width: 80% !important;
    max-height: 62vh !important;
    overflow-y: auto !important;
    text-align: center !important;
    box-shadow: 0 0 35px rgba(0, 150, 255, 0.6) !important;
    animation: popupAppear 0.4s ease-out !important;
}

.planet-info-popup h2 {
    color: #4fc3f7 !important;
    margin-bottom: 0.8rem !important;
    font-size: 1.3rem !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
}

.planet-info-popup p {
    margin-bottom: 1.2rem !important;
    line-height: 1.45 !important;
    font-size: 0.92rem !important;
    color: #e0e0e0 !important;
}

.planet-tech-popup {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
    justify-content: center !important;
    margin-bottom: 1.2rem !important;
}

.tech-tag-popup {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
    padding: 0.35rem 0.75rem !important;
    border-radius: 14px !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.close-popup-btn {
    background: #ff6b6b !important;
    color: white !important;
    border: none !important;
    padding: 0.65rem 1.2rem !important;
    border-radius: 18px !important;
    font-size: 0.92rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-weight: 600 !important;
    min-width: 100px !important;
}

.close-popup-btn:hover {
    background: #ff5252 !important;
    transform: scale(1.05) !important;
}

@keyframes popupAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Мобільна версія 3D сцени */
@media (max-width: 768px) {
    #space-scene {
        height: 50vh !important;
        min-height: 300px;
        touch-action: pan-x pan-y;
    }
    
    .space-controls {
        bottom: 12px !important;
        right: 12px !important;
    }
    
    .space-control-btn {
        width: 42px !important;
        height: 42px !important;
        font-size: 1.05rem !important;
        background: rgba(0, 40, 80, 0.9) !important;
        border: 2px solid rgba(100, 200, 255, 0.6) !important;
    }
    
    .planet-info-popup {
        max-width: 88% !important;
        padding: 1rem !important;
        max-height: 65vh !important;
    }
    
    .planet-info-popup h2 {
        font-size: 1.2rem !important;
    }
    
    .planet-info-popup p {
        font-size: 0.85rem !important;
    }
}

/* Запобігаємо виділенню тексту при тачах */
#space-scene {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Для дуже малих екранів */
@media (max-width: 480px) {
    .planet-info-popup {
        max-width: 92% !important;
        padding: 0.9rem !important;
        max-height: 60vh !important;
    }
    
    .planet-info-popup h2 {
        font-size: 1.1rem !important;
        margin-bottom: 0.7rem !important;
    }
    
    .planet-info-popup p {
        font-size: 0.8rem !important;
        margin-bottom: 1rem !important;
    }
    
    .tech-tag-popup {
        font-size: 0.75rem !important;
        padding: 0.3rem 0.6rem !important;
    }
    
    .close-popup-btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.85rem !important;
        min-width: 90px !important;
    }
}

/* Для найменших екранів */
@media (max-width: 360px) {
    .planet-info-popup {
        max-width: 94% !important;
        padding: 0.8rem !important;
    }
    
    .planet-info-popup h2 {
        font-size: 1.05rem !important;
    }
    
    .planet-info-popup p {
        font-size: 0.78rem !important;
    }
}

/* 🌠 МОБІЛЬНІ ПРОЕКТИ */
.mobile-projects {
  display: none;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}

.mobile-project-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  border-radius: 15px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.mobile-project-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: 
    0 10px 25px rgba(255, 230, 0, 0.1),
    0 0 35px rgba(102, 126, 234, 0.15);
}

.mobile-project-card h3 {
  color: var(--primary);
  margin-bottom: 1rem;
  text-shadow: 0 0 12px rgba(255, 230, 0, 0.4);
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tech-tag {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(102, 126, 234, 0.25);
}

.tech-tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

section, header, footer {
  background: rgba(0, 0, 0, 0.15) !important;
  backdrop-filter: none !important;
}


.main-content, .container, header, section, footer {
  position: relative;
  z-index: 10;
}

section, header, footer {
  background: rgba(0, 0, 0, 0,06) !important; /* темний, але прозорий */
  backdrop-filter: none !important;           /* без матового ефекту */
}

/* ====== ОСНОВНІ ЗМІННІ ====== */
:root {
  --primary: #ffe600;
  --neon: #00f3ff;
  --purple: #8b5cf6;
  --blue: #3b82f6;
  --pink: #ec4899;
  --text: #e0e0e0;
}

/* ====== БАЗА ====== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  background: #000;   /* чорний фон знизу */
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  overflow-x: hidden;
}

/* -------------------------------------------------------------------
   ███ 1) ЧОРНИЙ ФОН З БЛЮРОМ — ПІД КОСМОСОМ
------------------------------------------------------------------- */
#background-blur {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.65);     /* темний */
  backdrop-filter: blur(18px);      /* статичний блюр */
  z-index: 1;
  pointer-events: none;
}

/* -------------------------------------------------------------------
   ███ 2) КОСМІЧНИЙ ФОН (СТАРС + НЕБУЛА + КОМЕТИ)
------------------------------------------------------------------- */
.cosmic-background {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  overflow: hidden;
  z-index: 2;  /* поверх блюру */
  pointer-events: none;
}

/* ЗІРКИ */
.stars-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.8) 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.6) 1px, transparent 1px),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,0.7) 1px, transparent 1px),
    radial-gradient(circle at 60% 20%, rgba(255,255,255,0.5) 1px, transparent 1px),
    radial-gradient(circle at 90% 50%, rgba(255,255,255,0.9) 1px, transparent 1px),
    radial-gradient(circle at 10% 90%, rgba(255,255,255,0.4) 1px, transparent 1px);
  background-size: 200px 200px, 300px 300px, 400px 400px,
                   500px 500px, 600px 600px, 700px 700px;
  animation: starsMove 90s linear infinite;
}

/* ТУМАННІСТЬ */
.nebula-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(74,107,255,0.25), transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(147,112,219,0.25), transparent 60%),
    radial-gradient(ellipse at 40% 80%, rgba(220,20,60,0.2), transparent 60%),
    radial-gradient(ellipse at 60% 20%, rgba(32,178,170,0.25), transparent 60%);
  filter: blur(15px);
  animation: nebulaPulse 25s ease-in-out infinite;
}

/* СВІТЯЧІ КУЛІ */
.glow-layer .glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(65px);
  opacity: 0.25;
  animation: orbFloat 22s ease-in-out infinite;
  mix-blend-mode: screen;
}

.orb-1 { width: 400px; height: 400px; background: var(--purple); top: 15%; left: 25%; }
.orb-2 { width: 350px; height: 350px; background: var(--blue);   top: 60%; left: 65%; }
.orb-3 { width: 500px; height: 500px; background: var(--pink);   top: 35%; left: 80%; }
.orb-4 { width: 300px; height: 300px; background: var(--neon);   top: 75%; left: 10%; }

/* КОМЕТИ */
.comet {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 10px #fff;
  animation: cometFly 10s linear infinite;
}

.comet::after {
  content: "";
  position: absolute;
  width: 80px;
  height: 2px;
  right: -80px;
  top: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7));
}

/* 3 комети */
.comet-1 { top: 15%; left: -10%; animation-duration: 12s; }
.comet-2 { top: 50%; left: -15%; animation-duration: 14s; }
.comet-3 { top: 80%; left: -8%;  animation-duration: 10s; }

/* -------------------------------------------------------------------
   ███ 3) КОНТЕНТ ПОВЕРХ ВСЬОГО
------------------------------------------------------------------- */
header, section, footer, .main-content, .container {
  position: relative;
  z-index: 10;
  background: transparent !important; /* блоки повністю прозорі */
}


/* -------------------------------------------------------------------
   ███ АНІМАЦІЇ
------------------------------------------------------------------- */

@keyframes starsMove {
  0% { background-position: 0 0; }
  100% {
    background-position:
      200px 200px,
      300px 300px,
      400px 400px,
      500px 500px,
      600px 600px,
      700px 700px;
  }
}

@keyframes nebulaPulse {
  0%,100% { opacity: 0.3; transform: scale(1); }
  50%     { opacity: 0.6; transform: scale(1.08); }
}

@keyframes orbFloat {
  0%,100% { transform: translate(0,0); }
  50%     { transform: translate(60px,-40px); }
}

@keyframes cometFly {
  0%   { transform: translateX(0); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateX(120vw); opacity: 0; }
}

#noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1.5; /* між блюром і космосом */
  opacity: 0.12; /* мінімальна видимість, але достатньо */
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNgYAAAAAMAASsJTYQAAAAASUVORK5CYII=");
  /* це 1×1 noise-піксель */
  image-rendering: pixelated;
}

/* 🌌 LIGHT GLOBAL BLUR FOR BETTER READABILITY */
.main-content {
    backdrop-filter: blur(4px);
}

/* 🌌 OPTIMIZED ANIMATIONS */
/* Вимкнути анімації для користувачів, які вказали зменшення руху */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Оптимізація шарів фону */
.cosmic-background {
  will-change: transform;
  transform: translateZ(0);
}

/* Зменшення кількості зірок для мобільних */
@media (max-width: 768px) {
  .stars-layer {
    background: 
      radial-gradient(circle at 20% 30%, rgba(255,255,255,0.8) 1px, transparent 1px),
      radial-gradient(circle at 80% 70%, rgba(255,255,255,0.6) 1px, transparent 1px),
      radial-gradient(circle at 40% 80%, rgba(255,255,255,0.7) 1px, transparent 1px);
    background-size: 300px 300px, 400px 400px, 500px 500px;
  }
}

/* Спільна оптимізація анімацій */
.stars-layer,
.nebula-layer,
.glow-orb,
.comet,
.planet {
  will-change: transform;
  backface-visibility: hidden;
}

/* Зменшення частоти оновлення повільних анімацій */
.stars-layer {
  animation: starsMove 120s linear infinite; /* збільшив час */
}

.nebula-layer {
  animation: nebulaPulse 40s ease-in-out infinite; /* повільніше */
}

.glow-orb {
  animation: orbFloat 30s ease-in-out infinite; /* повільніше */
}

/* Використання transform замість інших властивостей */
@keyframes float {
  0%, 100% { 
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
  50% { 
    transform: translate3d(0, -20px, 0) rotate(5deg) scale(1.02);
  }
}

/* Hardware acceleration для критичних елементів */
.hero-planet,
.planet,
.btn,
.skill-card,
.goal-card {
  transform: translate3d(0, 0, 0);
}

/* Вимкнути анімації при низькому заряді батареї */
@media (prefers-reduced-motion: reduce) or (update: slow) {
  .stars-layer,
  .nebula-layer,
  .glow-orb,
  .comet,
  .planet {
    animation: none !important;
  }
}

/* 🌌 PROGRESSIVE LOADING FOR ANIMATIONS */
.cosmic-background > * {
    opacity: 0;
    animation: fadeInLayer 0.5s ease-out forwards;
}

/* Поступове завантаження шарів з затримками */
.stars-layer {
    animation-delay: 0.1s;
}

.nebula-layer {
    animation-delay: 0.3s;
}

.glow-layer {
    animation-delay: 0.5s;
}

.comet-layer {
    animation-delay: 0.8s;
}

@keyframes fadeInLayer {
    to {
        opacity: 1;
    }
}

/* 🎮 GAMES SELECTION STYLES */
.games-selection {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  padding: 4rem 0;
  position: relative;
  z-index: 10;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.game-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
}

.game-card:hover {
  transform: translateY(-10px);
  border-color: var(--primary);
  box-shadow: 0 15px 30px rgba(255, 230, 0, 0.1);
}

.game-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.game-card h3 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.game-card p {
  color: #ccc;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.play-btn {
  width: 100%;
  margin-top: 1rem;
}

/* 🚀 METEOR GAME STYLES */
.meteor-game-container {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  padding: 2rem 0;
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.game-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 1.5rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 1rem 2rem;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat {
  color: var(--primary);
  font-weight: 600;
  font-size: 1.2rem;
}

#meteor-game {
  background: linear-gradient(45deg, #000428, #001933);
  border: 3px solid var(--primary);
  border-radius: 15px;
  display: block;
  margin: 0 auto;
  box-shadow: 0 0 30px rgba(255, 230, 0, 0.2);
}

.game-controls {
  text-align: center;
  margin-top: 1rem;
  color: #ccc;
}

.game-controls p {
  margin: 0.5rem 0;
}

/* Показувати змійку тільки коли вона активна */
.snake-container {
  display: none;
}

.snake-container.active {
  display: block;
}

/* Мобільна версія ігор */
@media (max-width: 768px) {
  .games-grid {
    grid-template-columns: 1fr;
  }
  
  .game-header {
    flex-direction: column;
    text-align: center;
  }
  
  .game-stats {
    gap: 1.5rem;
    padding: 0.8rem 1rem;
  }
  
  .stat {
    font-size: 1rem;
  }
  
  #meteor-game {
    width: 95%;
    height: auto;
    max-width: 400px;
  }
}

/* 🎮 MOBILE GAMES STYLES */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .game-card {
        padding: 1.5rem;
    }
    
    .game-icon {
        font-size: 3rem;
    }
    
    .meteor-game-container .container {
        padding: 0 1rem;
    }
    
    #meteor-game {
        width: 100%;
        max-width: 100%;
        height: 400px;
    }
    
    .game-stats {
        gap: 1.5rem;
        padding: 0.8rem 1rem;
        flex-wrap: wrap;
    }
    
    .stat {
        font-size: 1rem;
    }
    
    .game-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .game-header .btn {
        width: 100%;
    }
    
    /* Адаптація змійки */
    .snake-container .container {
        padding: 0 1rem;
    }
    
    #snake {
        width: 100%;
        max-width: 100%;
        height: auto;
    }
}

/* Для дуже малих екранів */
@media (max-width: 480px) {
    #meteor-game {
        height: 300px;
    }
    
    .game-stats {
        gap: 1rem;
    }
    
    .stat {
        font-size: 0.9rem;
    }
}

/* 🎮 GAMES MOBILE STYLES */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .game-card {
        padding: 1.5rem;
    }
    
    .game-icon {
        font-size: 3rem;
    }
    
    /* Метеоритна гра */
    .meteor-game-container .container {
        padding: 0 1rem;
    }
    
    #meteor-game {
        width: 100%;
        max-width: 100%;
        height: 400px;
    }
    
    .game-stats {
        gap: 1.5rem;
        padding: 0.8rem 1rem;
        flex-wrap: wrap;
    }
    
    .stat {
        font-size: 1rem;
    }
    
    .game-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .game-header .btn {
        width: 100%;
    }
    
    /* Змійка */
    .snake-container .container {
        padding: 0 1rem;
    }
    
    #snake {
        width: 100%;
        max-width: 100%;
        height: auto;
    }
    
    /* Мобільне керування */
    .mobile-controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 1rem;
        gap: 0.5rem;
    }
    
    .control-row {
        display: flex;
        gap: 1rem;
    }
    
    .mobile-btn {
        width: 60px;
        height: 60px;
        background: rgba(255, 255, 255, 0.1);
        border: 2px solid var(--primary);
        border-radius: 50%;
        color: var(--primary);
        font-size: 1.5rem;
        cursor: pointer;
        backdrop-filter: blur(10px);
        display: flex;
        align-items: center;
        justify-content: center;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mobile-btn:active {
        background: rgba(255, 230, 0, 0.2);
        transform: scale(0.95);
    }
}

/* Для дуже малих екранів */
@media (max-width: 480px) {
    #meteor-game {
        height: 300px;
    }
    
    .game-stats {
        gap: 1rem;
    }
    
    .stat {
        font-size: 0.9rem;
    }
    
    .mobile-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* Приховуємо мобільне керування на десктопі */
@media (min-width: 769px) {
    .mobile-controls {
        display: none !important;
    }
}

/* 🌌 PERFORMANCE OPTIMIZATION */
.cosmic-background > * {
    will-change: transform;
    transform: translateZ(0);
}

/* Вимкнути анімації при зменшенні руху */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Оптимізація для мобільних */
@media (max-width: 768px) {
    .stars-layer {
        animation-duration: 200s !important;
    }
    
    .nebula-layer {
        animation-duration: 60s !important;
    }
    
    .glow-orb {
        animation-duration: 40s !important;
        filter: blur(20px) !important;
        opacity: 0.15 !important;
    }
    
    .comet {
        display: none !important;
    }
}

/* Hardware acceleration */
.hero-planet,
.planet,
.btn,
.skill-card,
.goal-card {
    transform: translateZ(0);
}

/* 🌌 SCROLL-BASED ANIMATION CONTROL */
.cosmic-background > * {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Класи для контролю анімацій */
.animation-paused {
    animation-play-state: paused !important;
}

.animation-slow {
    animation-duration: 200s !important;
}

.layer-hidden {
    opacity: 0.3 !important;
    transform: scale(0.95) !important;
}

.layer-minimal {
    opacity: 0.1 !important;
    filter: blur(5px) !important;
}

/* 🚀 PERFORMANCE OPTIMIZATION STYLES */
.performance-slow {
    animation-duration: 200s !important;
}

.performance-paused {
    animation-play-state: paused !important;
}

.performance-hidden {
    opacity: 0.1 !important;
    filter: blur(3px) !important;
}

/* Оптимізація для мобільних за замовчуванням */
@media (max-width: 768px) {
    .comet-layer,
    .glow-layer {
        display: none !important;
    }
    
    .stars-layer {
        animation-duration: 300s !important;
    }
    
    .nebula-layer {
        animation-duration: 100s !important;
        opacity: 0.7 !important;
    }
}

/* Вимкнути анімації для користувачів, які вказали зменшення руху */
@media (prefers-reduced-motion: reduce) {
    .cosmic-background > * {
        animation: none !important;
    }
}

/* Hardware acceleration */
.cosmic-background > * {
    transform: translateZ(0);
    will-change: transform;
}

/* 🎯 SKILLS TOOLTIPS */
.skill-card {
    position: relative;
    cursor: pointer;
}

.skill-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.skill-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #667eea;
}

.skill-card:hover .skill-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-15px);
}

/* Анімація для іконок */
.skill-card:hover i {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

/* Для мобільних пристроїв */
@media (max-width: 768px) {
    .skill-tooltip {
        font-size: 0.8rem;
        padding: 10px 14px;
        white-space: normal;
        width: 160px;
        text-align: center;
    }
}

/* Специфічні стилі для різних типів навичок */
.skill-card[data-skill="html"] .skill-tooltip {
    background: linear-gradient(135deg, #e34f26, #f06529);
}
.skill-card[data-skill="html"] .skill-tooltip::after {
    border-top-color: #e34f26;
}

.skill-card[data-skill="css"] .skill-tooltip {
    background: linear-gradient(135deg, #1572b6, #3399ff);
}
.skill-card[data-skill="css"] .skill-tooltip::after {
    border-top-color: #1572b6;
}

.skill-card[data-skill="javascript"] .skill-tooltip {
    background: linear-gradient(135deg, #f7df1e, #f5de1a);
    color: #000;
}
.skill-card[data-skill="javascript"] .skill-tooltip::after {
    border-top-color: #f7df1e;
}

.skill-card[data-skill="react"] .skill-tooltip {
    background: linear-gradient(135deg, #61dafb, #21a9c7);
}
.skill-card[data-skill="react"] .skill-tooltip::after {
    border-top-color: #61dafb;
}

.skill-card[data-skill="nodejs"] .skill-tooltip {
    background: linear-gradient(135deg, #339933, #66cc33);
}
.skill-card[data-skill="nodejs"] .skill-tooltip::after {
    border-top-color: #339933;
}

.skill-card[data-skill="threejs"] .skill-tooltip {
    background: linear-gradient(135deg, #000000, #333333);
}
.skill-card[data-skill="threejs"] .skill-tooltip::after {
    border-top-color: #000000;
}

/* Soft Skills */
.skill-card[data-skill="sales"] .skill-tooltip {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
}
.skill-card[data-skill="sales"] .skill-tooltip::after {
    border-top-color: #ff6b6b;
}

.skill-card[data-skill="communication"] .skill-tooltip {
    background: linear-gradient(135deg, #4ecdc4, #67e6dc);
}
.skill-card[data-skill="communication"] .skill-tooltip::after {
    border-top-color: #4ecdc4;
}

.skill-card[data-skill="architecture"] .skill-tooltip {
    background: linear-gradient(135deg, #45b7d1, #67c8e6);
}
.skill-card[data-skill="architecture"] .skill-tooltip::after {
    border-top-color: #45b7d1;
}

.skill-card[data-skill="leadership"] .skill-tooltip {
    background: linear-gradient(135deg, #96ceb4, #b8e6a8);
    color: #000;
}
.skill-card[data-skill="leadership"] .skill-tooltip::after {
    border-top-color: #96ceb4;
}

/* 🌌 SPACE PORTFOLIO INSTRUCTIONS */
.space-instruction {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: pulseInstruction 2s ease-in-out infinite;
}

.space-instruction p {
    color: #87CEEB;
    font-size: 1.1rem;
    margin: 0;
    font-weight: 500;
    text-shadow: 0 0 10px rgba(135, 206, 235, 0.5);
}

@keyframes pulseInstruction {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* Для мобільних пристроїв */
@media (max-width: 768px) {
    .space-instruction {
        margin-top: 1rem;
        padding: 0.8rem;
    }
    
    .space-instruction p {
        font-size: 1rem;
    }
}

/* Для дуже малих екранів */
@media (max-width: 480px) {
    .space-instruction p {
        font-size: 0.9rem;
    }
}

/* Case Studies Link */
.case-studies-link {
    text-align: center;
    margin: 3rem 0;
}

.case-studies-btn {
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    color: white;
    padding: 1.2rem 2.5rem;
    font-size: 1.1rem;
    border: none;
    box-shadow: 0 5px 20px rgba(139, 92, 246, 0.4);
}

.case-studies-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

/* Вирівнювання навігації */
.nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    margin-bottom: 3rem;
    padding: 0;
    z-index: 2;
    align-items: center; /* Додаємо вирівнювання по центру */
}

.nav ul li { 
    margin: 0 1.5rem; 
    display: flex;
    align-items: center; /* Вирівнюємо по центру вертикально */
}

.nav ul li a {
    text-decoration: none;
    color: #e0e0e0;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    position: relative;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center; /* Вирівнюємо текст по центру */
    height: 100%; /* Займає всю висоту */
}

/* 🔧 FIXES FOR CASE STUDIES LINK AND NAVIGATION */

/* Case Studies link in navigation */
.case-studies-link {
    position: relative;
}

/* Prevent horizontal scroll */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Mobile menu fixes */
@media screen and (max-width: 768px) {
    .nav ul {
        flex-direction: column;
        display: none;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        padding: 4rem 1rem 2rem;
        border-radius: 0;
        z-index: 999;
        box-shadow: none;
        border: none;
        justify-content: center;
        align-items: center;
        gap: 1.5rem;
    }
    
    .nav ul.active { 
        display: flex; 
    }
    
    .nav ul li { 
        margin: 0; 
        width: 100%;
        max-width: 300px;
    }
    
    .nav ul li a {
        display: block;
        padding: 1rem 1.5rem;
        font-size: 1.2rem;
        text-align: center;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 15px;
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(10px);
    }

    .menu-toggle {
        display: block;
        position: fixed;
        top: 1rem;
        right: 1rem;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 10px;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Close button for mobile menu */
    .menu-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: rgba(255, 100, 100, 0.9);
        border: none;
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        z-index: 1001;
    }
}

/* Prevent content from going outside rounded corners */
section, header, footer {
    position: relative;
}

section::before, header::before, footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
}

/* 🔧 COMPLETE SCROLL FIXES */

/* Ensure no horizontal scroll */
* {
    box-sizing: border-box;
}

body {
    position: relative;
}

/* Fix for cosmic background overflow */
.cosmic-background {
    position: fixed;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Ensure all sections stay within viewport */
section .container {
    position: relative;
    z-index: 2;
}

/* Specific fix for case studies page */
.case-studies-content .container {
    overflow: visible;
}

/* Mobile menu scroll prevention */
body.menu-open {
    overflow: hidden;
}

/* Smooth scrolling for all pages */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Focus styles for accessibility */
a:focus, button:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Skip to main content for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary);
    color: #000;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    z-index: 10000;
}

.skip-link:focus {
    top: 6px;
}

/* 🔧 MOBILE MENU FIXES */

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
    cursor: pointer;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    padding: 0.5rem;
    width: 50px;
    height: 50px;
    border-radius: 10px;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    color: var(--primary);
    transform: scale(1.1);
}

/* Mobile navigation */
@media screen and (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .nav ul {
        flex-direction: column;
        display: none;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        padding: 5rem 1rem 2rem;
        z-index: 999;
        justify-content: flex-start;
        align-items: center;
        gap: 1rem;
        margin: 0;
    }
    
    .nav ul.active {
        display: flex;
    }
    
    .nav ul li {
        margin: 0;
        width: 100%;
        max-width: 300px;
    }
    
    .nav ul li a {
        display: block;
        padding: 1rem 1.5rem;
        font-size: 1.2rem;
        text-align: center;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 15px;
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(10px);
        transition: all 0.3s ease;
    }
    
    .nav ul li a:hover,
    .nav ul li a.active {
        background: rgba(255, 230, 0, 0.1);
        border-color: var(--primary);
        transform: translateY(-2px);
    }
    
    /* Close button style when menu is open */
    .nav ul.active ~ .menu-toggle {
        background: rgba(255, 100, 100, 0.9);
    }
}

/* Body scroll lock when menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Ensure content is visible on mobile */
@media (max-width: 768px) {
    .main-content {
        position: relative;
        z-index: 1;
    }
    
    header {
        position: relative;
        z-index: 10;
    }
}

/* 🔧 FIX FOR BODY SCROLL WHEN MENU OPEN */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* 🔧 FIX MENU TOGGLE Z-INDEX */
.menu-toggle {
    z-index: 1001 !important;
}

/* 🔧 ENSURE MOBILE MENU APPEARS ABOVE CONTENT */
@media screen and (max-width: 768px) {
    .nav ul {
        z-index: 1000 !important;
    }
    
    .nav ul.active {
        display: flex !important;
    }
}

/* 🔧 FIX MOBILE MENU ALIGNMENT */
@media screen and (max-width: 768px) {
    .nav ul {
        flex-direction: column;
        display: none;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        padding: 5rem 1rem 2rem;
        z-index: 999;
        justify-content: center; /* 🔧 ЦЕНТРУВАННЯ ПО ВЕРТИКАЛІ */
        align-items: center;     /* 🔧 ЦЕНТРУВАННЯ ПО ГОРИЗОНТАЛІ */
        gap: 1.5rem;
        margin: 0;
    }
    
    .nav ul.active { 
        display: flex; 
    }
    
    .nav ul li { 
        margin: 0;
        width: 100%;
        max-width: 280px;        /* 🔧 ФІКСОВАНА ШИРИНА */
    }
    
    .nav ul li a {
        display: block;
        padding: 1.2rem 1.5rem;  /* 🔧 БІЛЬШІ ПАДДІНГИ */
        font-size: 1.2rem;
        text-align: center;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 15px;
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(10px);
        transition: all 0.3s ease;
        width: 100%;             /* 🔧 ЗАЙМАЄ ВСЮ ШИРИНУ */
    }
}

/* 🔧 SPECIAL FIX FOR CASE STUDIES MOBILE MENU */
@media screen and (max-width: 768px) {
    .case-nav ul {
        justify-content: center !important;
        align-items: center !important;
    }
    
    .case-nav ul li {
        display: flex;
        justify-content: center;
    }
    
    .back-home-link {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* 🔧 REMOVE PULSAR ON MOBILE */
@media (max-width: 768px) {
  .pulsar {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
}

/* 🌌 FORM NOTIFICATION STYLES */
.form-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: linear-gradient(135deg, rgba(0, 30, 60, 0.95), rgba(0, 20, 40, 0.98));
    backdrop-filter: blur(25px);
    color: white;
    padding: 2rem 2.5rem;
    border-radius: 20px;
    border: 2px solid var(--primary);
    z-index: 10000;
    text-align: center;
    box-shadow: 
        0 0 50px rgba(255, 230, 0, 0.3),
        0 20px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: notificationAppear 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    max-width: 400px;
    width: 90%;
}

.form-notification-success {
    border-color: #4CAF50;
    box-shadow: 
        0 0 50px rgba(76, 175, 80, 0.3),
        0 20px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.form-notification-error {
    border-color: #f44336;
    box-shadow: 
        0 0 50px rgba(244, 67, 54, 0.3),
        0 20px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.notification-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.notification-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 10px currentColor);
    animation: iconPulse 2s ease-in-out infinite;
}

.notification-text {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    color: #e0e0e0;
}

.notification-subtext {
    font-size: 0.9rem;
    color: #87CEEB;
    margin-top: 0.5rem;
    opacity: 0.9;
}

/* Анімації */
@keyframes notificationAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }
    70% {
        transform: translate(-50%, -50%) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px currentColor);
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 15px currentColor);
    }
}

@keyframes notificationExit {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

.form-notification.exiting {
    animation: notificationExit 0.3s ease-in forwards;
}

/* Overlay для фону */
.notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 9999;
    animation: overlayAppear 0.3s ease-out forwards;
}

@keyframes overlayAppear {
    from { opacity: 0; }
    to { opacity: 1; }
}

.notification-overlay.exiting {
    animation: overlayExit 0.3s ease-in forwards;
}

@keyframes overlayExit {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Кнопка закриття */
.notification-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.notification-close:hover {
    background: rgba(255, 100, 100, 0.8);
    transform: scale(1.1);
    color: white;
}

/* Мобільна версія */
@media (max-width: 768px) {
    .form-notification {
        padding: 1.5rem;
        max-width: 85%;
    }
    
    .notification-icon {
        font-size: 2.5rem;
    }
    
    .notification-text {
        font-size: 1.1rem;
    }
    
    .notification-subtext {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .form-notification {
        padding: 1.2rem;
        max-width: 90%;
    }
    
    .notification-icon {
        font-size: 2rem;
    }
    
    .notification-text {
        font-size: 1rem;
    }
}