:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #ec4899;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --dark: #1f2937;
  --light: #f8fafc;
  --gray: #6b7280;
  --white: #ffffff;
  --black: #000000;
  --shadow: 0 10px 25px rgba(0,0,0,0.1);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.15);
  --border-radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-primary: 'Inter', sans-serif;
  --font-horror: 'Creepster', cursive;
}

[data-theme="dark"] {
  --primary: #818cf8;
  --secondary: #f472b6;
  --dark: #f9fafb;
  --light: #111827;
  --gray: #9ca3af;
  --white: #1f2937;
  --black: #f9fafb;
}

[data-theme="legacy"] {
  --primary: #dc2626;
  --secondary: #7c2d12;
  --accent: #991b1b;
  --dark: #fef2f2;
  --light: #0f0f0f;
  --gray: #ef4444;
  --white: #1a1a1a;
  --black: #fee2e2;
  --font-primary: var(--font-horror);
}

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

body { 
  font-family: var(--font-primary); 
  line-height: 1.6; 
  color: var(--dark); 
  background: var(--white);
  overflow-x: hidden;
}

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

/* Flashlight Effect for Legacy Theme */
.torch-lights {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.5s;
}

[data-theme="legacy"] .torch-lights { opacity: 1; }

.torch {
  position: absolute;
  width: 60px;
  height: 120px;
  transition: all 0.3s ease;
}

.torch-body {
  width: 20px;
  height: 80px;
  background: linear-gradient(180deg, #2c1810 0%, #1a0f08 100%);
  border-radius: 10px;
  position: relative;
  margin: 0 auto;
  box-shadow: inset 2px 0 4px rgba(0,0,0,0.3);
}

.torch-head {
  width: 30px;
  height: 25px;
  background: linear-gradient(180deg, #4a3728 0%, #2c1810 100%);
  border-radius: 15px 15px 5px 5px;
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.torch-flame {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  opacity: 0;
  transition: all 0.3s ease;
}

.torch.active .torch-flame {
  opacity: 1;
  animation: flicker 0.5s ease-in-out infinite alternate;
}

.flame-core {
  width: 12px;
  height: 30px;
  background: radial-gradient(ellipse at center bottom, #ff6b35 0%, #f7931e 30%, #ffff00 70%, transparent 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  position: relative;
}

.flame-outer {
  position: absolute;
  top: 2px;
  left: -3px;
  width: 18px;
  height: 35px;
  background: radial-gradient(ellipse at center bottom, rgba(255,107,53,0.8) 0%, rgba(247,147,30,0.6) 40%, transparent 70%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}

@keyframes flicker {
  0% { transform: translateX(-50%) scale(1) rotate(-1deg); }
  100% { transform: translateX(-50%) scale(1.1) rotate(1deg); }
}

.torch-light {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  opacity: 0;
  transition: all 0.4s ease;
  pointer-events: none;
}

.torch.active .torch-light {
  opacity: 1;
  width: 400px;
  height: 400px;
  background: radial-gradient(
    ellipse at center,
    rgba(255,255,200,0.4) 0%,
    rgba(255,255,150,0.3) 20%,
    rgba(255,200,100,0.2) 40%,
    rgba(255,150,50,0.1) 60%,
    transparent 80%
  );
  border-radius: 50%;
  filter: blur(2px);
}

.torch-switch {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.8);
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
  z-index: 10000;
  opacity: 0;
}

[data-theme="legacy"] .torch-switch { opacity: 1; }

.torch-switch:hover {
  background: var(--primary);
  color: var(--white);
  transform: scale(1.05);
}

.torch-switch.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 0 20px rgba(220,38,38,0.5);
}

#torch1 { top: 50px; left: 20%; }
#torch2 { top: 50px; left: 50%; }
#torch3 { top: 50px; right: 20%; }

.horror-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.5s;
}

[data-theme="legacy"] .horror-overlay { opacity: 1; }

/* Header */
.header { 
  position: fixed; 
  top: 0; 
  width: 100%; 
  background: rgba(255,255,255,0.95); 
  backdrop-filter: blur(20px); 
  z-index: 1000; 
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

[data-theme="dark"] .header { background: rgba(31,41,55,0.95); }
[data-theme="legacy"] .header { background: rgba(26,26,26,0.95); border-bottom-color: var(--primary); }

.nav { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  padding: 1rem 2rem; 
  gap: 2rem;
}

.logo { 
  font-size: 1.5rem; 
  font-weight: 800; 
  background: linear-gradient(135deg, var(--primary), var(--secondary)); 
  -webkit-background-clip: text; 
  -webkit-text-fill-color: transparent; 
}

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

.theme-switcher, .language-switcher { display: flex; gap: 0.5rem; }

.theme-btn, .lang-btn { 
  background: var(--light); 
  border: 2px solid transparent; 
  padding: 0.5rem; 
  border-radius: 8px; 
  cursor: pointer; 
  transition: var(--transition);
  font-size: 0.9rem;
  font-weight: 600;
}

.theme-btn:hover, .lang-btn:hover, .lang-btn.active { 
  background: var(--primary); 
  color: var(--white); 
}

.nav-menu { 
  display: flex; 
  list-style: none; 
  gap: 2rem; 
}

.nav-menu a { 
  text-decoration: none; 
  color: var(--dark); 
  font-weight: 500; 
  transition: var(--transition); 
  position: relative;
}

.nav-menu a:hover { color: var(--primary); }

.nav-menu a::after { 
  content: ''; 
  position: absolute; 
  bottom: -5px; 
  left: 0; 
  width: 0; 
  height: 2px; 
  background: var(--primary); 
  transition: var(--transition); 
}

.nav-menu a:hover::after { width: 100%; }

/* Hero Section */
.hero { 
  min-height: 100vh; 
  display: flex; 
  align-items: center; 
  position: relative; 
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  z-index: -2;
}

.hero-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="25" cy="25" r="0.5" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="0.3" fill="white" opacity="0.1"/></svg>');
  animation: float 20s linear infinite;
}

@keyframes float { 0% { transform: translateY(0); } 100% { transform: translateY(-100px); } }

.hero-content { 
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 4rem; 
  padding: 2rem; 
  color: var(--white); 
  z-index: 1;
}

.hero-title { 
  font-size: clamp(2.5rem, 5vw, 4rem); 
  font-weight: 800; 
  margin-bottom: 1rem; 
  line-height: 1.2;
}

.hero-subtitle { 
  font-size: clamp(1.2rem, 2.5vw, 1.5rem); 
  margin-bottom: 1.5rem; 
  opacity: 0.9; 
}

.hero-description { 
  font-size: 1.1rem; 
  margin-bottom: 2rem; 
  opacity: 0.8; 
  line-height: 1.8; 
}

.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn { 
  display: inline-block; 
  padding: 1rem 2rem; 
  border-radius: var(--border-radius); 
  text-decoration: none; 
  font-weight: 600; 
  transition: var(--transition); 
  border: none; 
  cursor: pointer;
  font-size: 1rem;
}

.btn-primary { 
  background: var(--white); 
  color: var(--primary); 
}

.btn-secondary { 
  background: transparent; 
  color: var(--white); 
  border: 2px solid var(--white); 
}

.btn:hover { 
  transform: translateY(-2px); 
  box-shadow: var(--shadow-lg); 
}

/* Hero Visual */
.hero-visual { display: flex; justify-content: center; align-items: center; }

.floating-elements { position: relative; }

.floating-card { 
  background: rgba(255,255,255,0.1); 
  border-radius: var(--border-radius); 
  padding: 2rem; 
  backdrop-filter: blur(20px); 
  border: 1px solid rgba(255,255,255,0.2); 
  animation: floatCard 6s ease-in-out infinite; 
}

@keyframes floatCard { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-20px) rotate(2deg); } }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

.dots { display: flex; gap: 0.5rem; }

.dots span { 
  width: 12px; 
  height: 12px; 
  border-radius: 50%; 
}

.dots span:nth-child(1) { background: #ff5f56; }
.dots span:nth-child(2) { background: #ffbd2e; }
.dots span:nth-child(3) { background: #27ca3f; }

.code-line { 
  height: 8px; 
  background: rgba(255,255,255,0.3); 
  border-radius: 4px; 
  margin-bottom: 0.5rem; 
  animation: pulse 2s ease-in-out infinite;
}

.code-line.short { width: 60%; }
.code-line.medium { width: 80%; }

@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.8; } }

.tech-icons { 
  position: absolute; 
  top: -50px; 
  right: -50px; 
  display: flex; 
  flex-direction: column; 
  gap: 1rem;
}

.tech-icon { 
  font-size: 2rem; 
  animation: bounce 2s ease-in-out infinite; 
}

.tech-icon:nth-child(2) { animation-delay: 0.5s; }
.tech-icon:nth-child(3) { animation-delay: 1s; }
.tech-icon:nth-child(4) { animation-delay: 1.5s; }

@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* Sections */
.features, .testimonials { padding: 5rem 0; }

.features { background: var(--light); }

.section-title { 
  text-align: center; 
  font-size: 2.5rem; 
  font-weight: 700; 
  margin-bottom: 3rem; 
  background: linear-gradient(135deg, var(--primary), var(--secondary)); 
  -webkit-background-clip: text; 
  -webkit-text-fill-color: transparent; 
}

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

.feature-card { 
  background: var(--white); 
  padding: 2rem; 
  border-radius: var(--border-radius); 
  text-align: center; 
  box-shadow: var(--shadow); 
  transition: var(--transition); 
  border: 2px solid transparent;
}

.feature-card:hover { 
  transform: translateY(-5px); 
  box-shadow: var(--shadow-lg); 
  border-color: var(--primary);
}

.feature-icon { font-size: 3rem; margin-bottom: 1rem; }

.feature-card h3 { 
  font-size: 1.25rem; 
  font-weight: 600; 
  margin-bottom: 1rem; 
  color: var(--dark); 
}

.feature-card p { color: var(--gray); }

/* Stats */
.stats { 
  padding: 4rem 0; 
  background: var(--dark); 
  color: var(--white); 
}

[data-theme="dark"] .stats { background: var(--light); color: var(--dark); }
[data-theme="legacy"] .stats { background: var(--light); color: var(--primary); }

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

.stat-number { 
  font-size: 3rem; 
  font-weight: 800; 
  background: linear-gradient(135deg, var(--secondary), var(--accent)); 
  -webkit-background-clip: text; 
  -webkit-text-fill-color: transparent; 
}

.stat-label { font-size: 1.1rem; margin-top: 0.5rem; opacity: 0.8; }

/* Testimonials */
.testimonials-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
  gap: 2rem; 
}

.testimonial-card { 
  background: var(--white); 
  padding: 2rem; 
  border-radius: var(--border-radius); 
  box-shadow: var(--shadow); 
  transition: var(--transition);
}

.testimonial-card:hover { 
  transform: translateY(-3px); 
  box-shadow: var(--shadow-lg); 
}

.testimonial-content { margin-bottom: 1.5rem; }

.testimonial-content p { 
  font-style: italic; 
  color: var(--gray); 
  line-height: 1.6; 
}

.testimonial-author { display: flex; align-items: center; gap: 1rem; }

.author-avatar { 
  font-size: 2rem; 
  width: 50px; 
  height: 50px; 
  border-radius: 50%; 
  background: var(--light); 
  display: flex; 
  align-items: center; 
  justify-content: center;
}

.testimonial-author h4 { color: var(--dark); margin-bottom: 0.25rem; }

.testimonial-author span { color: var(--gray); font-size: 0.9rem; }

/* Footer */
.footer { 
  background: var(--dark); 
  color: var(--white); 
  padding: 3rem 0 1rem; 
}

[data-theme="dark"] .footer { background: var(--light); color: var(--dark); }
[data-theme="legacy"] .footer { background: var(--light); color: var(--primary); }

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

.footer-section h3, .footer-section h4 { 
  margin-bottom: 1rem; 
  font-weight: 600;
}

.footer-section ul { list-style: none; }

.footer-section ul li { margin-bottom: 0.5rem; }

.footer-section a { 
  color: inherit; 
  text-decoration: none; 
  opacity: 0.8; 
  transition: var(--transition);
}

.footer-section a:hover { opacity: 1; color: var(--primary); }

.social-links { display: flex; gap: 1rem; margin-top: 1rem; }

.social-link { 
  width: 40px; 
  height: 40px; 
  border-radius: 50%; 
  background: var(--light); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  text-decoration: none; 
  transition: var(--transition);
  opacity: 0.8;
}

.social-link:hover { 
  background: var(--primary); 
  transform: translateY(-2px); 
  opacity: 1;
}

.footer-bottom { 
  border-top: 1px solid rgba(255,255,255,0.1); 
  padding-top: 1rem; 
  text-align: center; 
  opacity: 0.8;
}

/* Typing Animation */
.typing-text { 
  overflow: hidden; 
  border-right: 3px solid var(--white); 
  white-space: nowrap; 
  animation: typing 3s steps(20) 1s both, blink 1s infinite; 
}

[data-theme="legacy"] .typing-text { 
  animation: horror-typing 4s steps(20) 1s both, horror-blink 1s infinite; 
}

@keyframes typing { from { width: 0; } to { width: 100%; } }
@keyframes blink { 50% { border-color: transparent; } }

@keyframes horror-typing { 
  0% { width: 0; } 
  50% { width: 50%; } 
  100% { width: 100%; } 
}

@keyframes horror-blink { 
  0%, 50% { border-color: var(--primary); } 
  51%, 100% { border-color: transparent; } 
}

/* Legacy Theme Horror Effects */
[data-theme="legacy"] body { 
  background: var(--white); 
  color: var(--primary); 
}

[data-theme="legacy"] .hero-bg { 
  background: linear-gradient(135deg, var(--light) 0%, var(--secondary) 100%); 
}

[data-theme="legacy"] .hero-content { color: var(--primary); }

[data-theme="legacy"] .feature-card:hover { 
  animation: shake 0.5s ease-in-out; 
}

@keyframes shake { 
  0%, 100% { transform: translateX(0); } 
  25% { transform: translateX(-5px) translateY(-5px); } 
  75% { transform: translateX(5px) translateY(5px); } 
}

/* Responsive */
@media (max-width: 768px) {
  .nav { flex-direction: column; gap: 1rem; }
  .nav-menu { flex-wrap: wrap; justify-content: center; }
  .hero-content { grid-template-columns: 1fr; text-align: center; }
  .hero-buttons { justify-content: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-controls { order: -1; }
}

@media (max-width: 480px) {
  .features-grid, .testimonials-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .hero-buttons { flex-direction: column; }
  .footer-content { grid-template-columns: 1fr; }
}