/* Tailwind override and custom styles */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  background-color: #000;
  color: #fff;
  line-height: 1.6;
}

/* Loading placeholders */
.loading-placeholder {
  padding: 1rem 0;
}

.loading-line {
  height: 1rem;
  margin-bottom: 0.75rem;
  border-radius: 0.25rem;
  background: linear-gradient(90deg, rgba(75, 85, 99, 0.2) 0%, rgba(75, 85, 99, 0.4) 50%, rgba(75, 85, 99, 0.2) 100%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Starry background */
#stars-container {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#stars {
  width: 1px;
  height: 1px;
  background: transparent;
  box-shadow:
      743px 984px #FFF,
      1487px 1904px #FFF,
      1559px 471px #FFF,
      1151px 1891px #FFF,
      1512px 1885px #FFF,
      174px 1161px #FFF,
      1687px 699px #FFF,
      1859px 439px #FFF,
      452px 1005px #FFF,
      1864px 1970px #FFF,
      677px 280px #FFF,
      1369px 892px #FFF,
      1708px 810px #FFF,
      207px 713px #FFF,
      993px 59px #FFF,
      1757px 9px #FFF,
      674px 382px #FFF,
      1712px 1976px #FFF,
      1975px 1125px #FFF,
      1937px 1580px #FFF,
      1758px 149px #FFF,
      1381px 1557px #FFF,
      1908px 263px #FFF,
      571px 558px #FFF,
      1106px 1276px #FFF,
      726px 1124px #FFF,
      1884px 1367px #FFF,
      1684px 169px #FFF,
      1062px 1033px #FFF,
      1645px 305px #FFF,
      669px 440px #FFF,
      1498px 1842px #FFF,
      1623px 643px #FFF,
      1019px 169px #FFF,
      1577px 1904px #FFF;
  animation: animateStars 100s linear infinite;
}

#stars2 {
  width: 2px;
  height: 2px;
  background: transparent;
  box-shadow:
      1354px 1409px #FFF,
      1612px 1827px #FFF,
      878px 1333px #FFF,
      799px 764px #FFF,
      542px 1052px #FFF,
      1680px 564px #FFF,
      1979px 1106px #FFF,
      1052px 1804px #FFF,
      233px 1518px #FFF,
      1184px 754px #FFF,
      318px 1627px #FFF,
      1787px 1750px #FFF,
      1701px 1482px #FFF,
      1235px 1409px #FFF;
  animation: animateStars 150s linear infinite;
}

#stars3 {
  width: 3px;
  height: 3px;
  background: transparent;
  box-shadow:
      387px 1168px #FFF,
      1250px 1454px #FFF,
      933px 1508px #FFF,
      1122px 1666px #FFF,
      1338px 115px #FFF,
      368px 1017px #FFF,
      1054px 1379px #FFF;
  animation: animateStars 200s linear infinite;
}

@keyframes animateStars {
  from {
    transform: translateY(0px);
  }
  to {
    transform: translateY(-2000px);
  }
}

/* Nebula background */
/* Nebula background */
.nebula-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('https://r2.flowith.net/files/o/1746695501813-Dynamic_Nebula_Lonely_Planet_With_Multiverse_Structures_And_String_Theory_Visuals@1536x1024.png');
  background-size: cover;
  background-position: center;
  opacity: 0.65;
  z-index: -1;
  /* Improved image quality */
  image-rendering: high-quality;
  /* Subtle animation for increased immersion */
  animation: subtle-pulse 15s infinite alternate ease-in-out;
}

@keyframes subtle-pulse {
  0% {
    opacity: 0.65;
    transform: scale(1);
  }
  100% {
    opacity: 0.72;
    transform: scale(1.05);
  }
}

/* Cosmic overlay and darks forest overlay */
.cosmic-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('https://r2.flowith.net/files/o/1746695505824-Detailed_Deep_Space_Star_Map_with_Realistic_and_Sci_Fi_Elements@1536x1024.png');
  background-size: cover;
  background-position: center;
  opacity: 0.25;
  z-index: 0;
}

.dark-forest-overlay {
  position: absolute;
  top: 0;
  left
: 0;
  width: 100%;
  height: 100%;
  background-image: url('https://r2.flowith.net/files/o/1746695478742-cosmic_dark_forest_hunters_and_hidden_civilizations@1024x1024.png');
  background-size: cover;
  background-position: center;
  opacity: 0.15;
  z-index: 0;
}

/* Dark forest strike animation */
.dark-forest-strike {
  position: relative;
  overflow: hidden;
  background-color: #000;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.civilization-light {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: rgba(255, 255, 180, 0.8);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(255, 255, 180, 0.8), 0 0 20px rgba(255, 255, 180, 0.5);
  animation: civilizationPulse 4s infinite;
}

@keyframes civilizationPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 10px rgba(255, 255, 180, 0.8), 0 0 20px rgba(255, 255, 180, 0.5);
  }
  45% {
    transform: translate(-50%, -50%) scale(1.5);
    box-shadow: 0 0 15px rgba(255, 255, 180, 0.9), 0 0 30px rgba(255, 255, 180, 0.7);
  }
  50% {
    transform: translate(-50%, -50%) scale(2);
    box-shadow: 0 0 20px rgba(255, 255, 180, 1), 0 0 40px rgba(255, 255, 180, 0.8);
  }
  55% {
    transform: translate(-50%, -50%) scale(0.2);
    box-shadow: 0 0 100px red, 0 0 150px rgba(255, 0, 0, 0.8);
  }
  60% {
    transform: translate(-50%, -50%) scale(0);
    box-shadow: 0 0 0px transparent;
  }
  61%, 99% {
    transform: translate(-50%, -50%) scale(0);
  }
}

/* Concept cards styling */
/* Concept cards styling */
.concept-card {
  background-color: rgba(17, 24, 39, 0.7);
  border: 1px solid #1f2937;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  /* Added elevation effect */
  box-shadow: 0 4px 12px -1px rgba(0, 0, 0, 0.3);
}

.concept-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  border-color: #3b82f6;
}

.concept-image {
  height: 200px;
  overflow: hidden;
  position: relative;
}

/* Added enhancement for concept images */
.concept-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 70%, rgba(17, 24, 39, 0.8));
}

.concept-image img {
  transition: transform 0.5s ease;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.concept-card:hover .concept-image img {
  transform: scale(1.05);
}

.concept-content {
  padding: 1.5rem;
}

/* Upcoming features animation */
.upcoming-feature {
  transition: transform 0.3s ease, border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}

.upcoming-feature:hover {
  transform: translateY(-3px);
  border-color: #3b82f6;
}

.upcoming-feature::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, rgba(17, 24, 39, 0) 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.upcoming-feature:hover::after {
  opacity: 1;
}

/* Three Body System Background Animation */
.trisolaris-background {
  background-color: #000511;
  position: relative;
}

#three-body-simulation {
  overflow: hidden;
  opacity: 0.3;
  z-index: 0;
  /* Ensure suns are positioned relative to this container */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.sun {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  box-shadow: 0 0 60px rgba(255, 255, 255, 0.8), 0 0 100px rgba(255, 200, 100, 0.6);
}

.sun-1 {
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, rgba(255,235,59,1) 0%, rgba(255,152,0,1) 50%, rgba(255,87,34,1) 100%);
  top: 25%;
  left: 20%;
  animation: sun1Move 25s linear infinite;
}

.sun-2 {
  width: 45px;
  height: 45px;
  background: radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(100,181,246,1) 50%, rgba(30,136,229,1) 100%);
  top: 60%;
  left: 65%;
  animation: sun2Move 30s linear infinite;
}

.sun-3 {
  width: 35px;
  height: 35px;
  background: radial-gradient(circle, rgba(255,235,238,1) 0%, rgba(244,143,177,1) 50%, rgba(233,30,99,1) 100%);
  top: 30%;
  left: 70%;
  animation: sun3Move 18s linear infinite;
}

@keyframes sun1Move {
  0% { transform: translate(0, 0); }
  25% { transform: translate(30vw, 10vh); }
  50% { transform: translate(0, 30vh); }
  75% { transform: translate(-20vw, 15vh); }
  100% { transform: translate(0, 0); }
}

@keyframes sun2Move {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-40vw, -15vh); }
  66% { transform: translate(20vw, -30vh); }
  100% { transform: translate(0, 0); }
}

@keyframes sun3Move {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-25vw, 20vh); }
  40% { transform: translate(15vw, 40vh); }
  60% { transform: translate(45vw, 10vh); }
  80% { transform: translate(20vw, -20vh); }
  100% { transform: translate(0, 0); }
}

/* Fade in animation for elements */
.fade-in-element {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-element.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Hover effects for images */
/* Corrected selector as images are inside Trisolaris section, not section with class trisolaris-section */
#trisolaris img {
  transition: transform 0.5s ease, box-shadow 0.5s ease;
}

#trisolaris img:hover {
  transform: scale(1.02);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* 3D text effect for the chapter title */
#trisolaris h2 {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2),
               0 2px 0 rgba(255, 255, 255, 0.1),
               0 3px 0 rgba(255, 255, 255, 0.05),
               0 4px 5px rgba(0, 0, 0, 0.5);
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.active {
  opacity: 1;
}

.modal-content {
  background-color: #111827;
  margin: 5% auto;
  padding: 2rem;
  border-radius: 0.5rem;
  max-width: 800px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid #374151;
  transform: translateY(-50px);
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.modal.active .modal-content {
  transform: translateY(0);
  opacity: 1;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close:hover,
.close:focus {
  color: #fff;
  text-decoration: none;
}

/* Prose override for Markdown content */
.prose pre {
  background-color: #1a202c;
  border-radius: 0.375rem;
  padding: 1rem;
  overflow-x: auto;
}

.prose code {
  color: #93c5fd;
  background-color: #1e293b;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.prose a {
  color: #3b82f6;
  text-decoration: none;
  transition: color 0.2s ease;
}

.prose a:hover {
  color: #60a5fa;
  text-decoration: underline;
}

.prose blockquote {
  border-left: 4px solid #3b82f6;
  padding-left: 1rem;
  color: #d1d5db;
  font-style: italic;
}

/* Future Technology section styles */
.future-tech-interactive {
  position: relative;
  overflow: hidden;
}

.future-tech-interactive::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
  opacity: 0.5;
  pointer-events: none;
  animation: futureTechPulse 8s infinite ease-in-out;
}

@keyframes futureTechPulse {
  0%, 100% {
    opacity: 0.2;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.1);
  }
}

#future-tech .tech-card {
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#future-tech .tech-card:hover {
  transform: translateY(-15px) scale(1.03);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
}

#future-tech .tech-image {
  position: relative;
  overflow: hidden;
  border-radius: 0.375rem;
}

#future-tech .tech-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, transparent 70%, rgba(0, 0, 0, 0.8));
}

#future-tech .tech-image img {
  transition: transform 0.8s ease-in-out;
}

#future-tech .tech-card:hover .tech-image img {
  transform: scale(1.1);
}

#future-tech h3 {
  position: relative;
}

#future-tech h3::after {
  content: "";
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 3rem;
  height: 2px;
  background: currentColor;
  opacity: 0.6
}

/* Modal animations for future tech */
#future-tech-detail.modal .modal-content {
  background-image: linear-gradient(to bottom, rgba(17, 24, 39, 0.95), rgba(17, 24, 39, 0.8)),
                    url('https://r2.flowith.net/files/o/1746703167015-Visualizations_of_Key_SciFi_Elements_from_ThreeBody@1024x1024.png');
  background-size: cover;
  background-position: center;
  background-blend-mode: darken;
}

#future-tech-detail.modal .modal-content h2 {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Technology visualization parallax effects */
.tech-visual-parallax {
  position: relative;
  overflow: hidden;
  height: 300px;
  border-radius: 0.5rem;
}

.tech-visual-parallax img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease-out;
}
/* Character cards and section */
.character-card {
  transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
  position: relative;
  overflow: hidden;
}

.character-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.character-card .text-sm.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Typography Improvements */
.prose h2 {
  font-size: 1.75rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #60a5fa;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #374151;
}

.prose h3 {
  font-size: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: #a78bfa;
}

.prose p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.prose strong {
  color: #e5e7eb;
  font-weight: 600;
}

/* Featured images for sections */
.featured-image {
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.featured-image:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  transform: translateY(-5px);
}

.featured-image img {
  width: 100%;
  display: block;
}

/* Loading animations improvement */
@keyframes loading {
  0% {
    background-position: 200% 0;
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    background-position: -200% 0;
    opacity: 0.3;
  }
}

/* Performance improvements for animations */
.sun {
  will-change: transform, filter, opacity;
}

.trisolaris-background {
  will-change: transform;
}

/* Enhanced mobile experience */
@media (max-width: 768px) {
  .prose h2 {
    font-size: 1.5rem;
  }

  .prose h3 {
    font-size: 1.25rem;
  }

  .featured-image {
    margin-bottom: 1.5rem;
  }

  #stars-container {
    opacity: 0.7; /* Reduce visual noise on mobile */
  }
}
.secondary-character-card {
  transition: all 0.3s ease;
}

.secondary-character-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

#characters {
  background-image: linear-gradient(to bottom, rgba(0,0,0,0.95), rgba(17, 24, 39, 0.95)),
                    url('https://r2.flowith.net/files/o/1746713815008-Zhang_Beihai_Silent_Resolve_Amidst_Cosmic_Farewell@1536x1024.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-blend-mode: darken;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .modal-content {
    margin: 10% auto;
    width: 90%;
  }

  .concept-image {
    height: 180px;
  }
}
