:root {
  --primary-color: #6c5ce7;
  --secondary-color: #00cec9;
  --accent-color: #fd79a8;
  --text-color: #2d3436;
  --background-color: #f1f2f6;
  --card-background: #ffffff;
}

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

body {
  font-family: "Roboto", sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  height: 100vh;
  overflow: hidden;
}

main {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

#hero {
  z-index: 1;
  background-color: var(--card-background);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  width: 90%;
  min-height: 350px; /* Change height to min-height */
  position: relative;
  overflow: hidden;
  transition: transform 0.1s ease-in-out, box-shadow 0.3s ease-in-out;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* Add these fallback properties */
  display: -webkit-flex;
  -webkit-flex-direction: column;
  -webkit-align-items: center;
  -webkit-justify-content: center;
}

#hero::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 83.3%;
  height: 83.3%;
  background-image: url("../images/icon.webp");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.08;
  z-index: -1;
}

/* Ensure text remains visible over the background */
#hero h1,
#hero p,
#hero .cta-button {
  position: relative;
  z-index: 2;
}

h1 {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
  font-weight: 900;
  letter-spacing: -1px;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: var(--text-color);
}

.cta-button {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  background-color: var(--accent-color);
  color: var(--card-background);
  text-decoration: none;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 0;
  position: relative;
  overflow: hidden;
}

.cta-button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease-out, height 0.6s ease-out;
}

.cta-button:hover {
  background-color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.cta-button:hover::before {
  width: 300px;
  height: 300px;
}

#hero:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

#game-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.1;
}

.modal {
  display: none;
  position: fixed;
  z-index: 2;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: var(--card-background);
  background-image: url("../images/msw_creators.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  margin: 10% auto;
  padding: 20px;
  border: none;
  width: 90%;
  max-width: 600px;
  height: 50vh;
  aspect-ratio: 4 / 3;
  border-radius: 15px;
  text-align: center;
  color: var(--text-color);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  position: relative;
  transition: transform 0.3s ease-in-out;
}

.modal-content:hover {
  transform: scale(1.02);
}

.modal-content h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  background-color: rgba(255, 255, 255, 0.8);
  padding: 10px;
  border-radius: 5px;
}

.modal-content p {
  font-size: 1rem;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 10px;
  border-radius: 5px;
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--card-background);
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: var(--accent-color);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 1;
}

.close:hover {
  background-color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.modal-content::after {
  content: "Click to learn more";
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-content:hover::after {
  opacity: 1;
}

.discord-icon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-size: 2rem;
  color: var(--primary-color);
  transition: all 0.3s ease, transform 0.1s ease-in-out;
}

.discord-icon:hover {
  color: var(--accent-color);
  transform: scale(1.1) rotate(5deg);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Particle effect */
.particle {
  position: fixed;
  width: 5px;
  height: 5px;
  background-color: var(--accent-color);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.5;
  animation: float-particle linear infinite;
  will-change: transform;
  transition: transform 0.1s ease-out;
}

@keyframes float-particle {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  100% {
    transform: translateY(-100vh) rotate(360deg);
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
    height: auto;
    margin-bottom: 0.5rem;
  }

  p {
    font-size: 1rem;
  }

  #hero {
    padding: 1.5rem;
    min-height: 300px;
    width: 95%;
    transition: transform 0.3s ease-in-out;
  }

  .modal-content {
    width: 90%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 30vh auto 0;
    transform: translateY(-25%);
    border-radius: 15px;
  }

  .subtitle {
    font-size: 1rem;
    margin-bottom: 1rem;
    height: auto;
  }

  .cta-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    margin-top: 1rem;
    transition: transform 0.2s ease-in-out, background-color 0.3s ease;
  }

  .cta-button:active {
    transform: scale(0.95);
  }

  .discord-icon {
    bottom: 10px;
    right: 10px;
    font-size: 1.5rem;
  }

  .mobile-particle {
    position: fixed;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  #hero {
    padding: 1rem;
    min-height: 250px;
  }

  .cta-button {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }

  .modal-content h2 {
    font-size: 1.5rem;
  }

  .modal-content p {
    font-size: 0.9rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }
}

.subtitle {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  position: relative;
  height: 1.8rem;
  width: 300px;
  line-height: 1.5;
}

.subtitle::after {
  content: "|";
  position: absolute;
  right: -8px;
  color: var(--accent-color);
  animation: blink 0.7s infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Dark theme styles */
.dark-theme {
  --primary-color: #ffffff; /* White for main text */
  --secondary-color: #ff79c6; /* Bright pink for subtitle */
  --accent-color: #ff5555; /* Bright red for CTA button */
  --text-color: #f8f8f2; /* Light gray for general text */
  --background-color: #282a36; /* Dark background */
  --card-background: #44475a; /* Slightly lighter for card */
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --particle-color: #8be9fd; /* Bright cyan for particles */
  --discord-icon-color: #bd93f9; /* Bright purple for Discord icon */
}

.dark-theme #hero {
  background-color: var(--card-background);
  box-shadow: var(--card-shadow);
}

.dark-theme #hero::before {
  opacity: 0.1;
}

.dark-theme .cta-button {
  background-color: var(--accent-color);
  color: var(--primary-color);
  font-weight: bold;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark-theme .cta-button:hover {
  background-color: #ff6e6e;
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
}

.dark-theme .modal-content {
  background-color: var(--card-background);
  border: 1px solid var(--secondary-color);
}

.dark-theme .modal-content h2,
.dark-theme .modal-content p {
  color: var(--text-color);
}

.dark-theme #theme-toggle {
  background-color: var(--card-background);
  color: var(--text-color);
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.dark-theme #theme-toggle:hover {
  background-color: #6272a4;
  transform: scale(1.1);
}

.dark-theme #theme-toggle svg {
  stroke: var(--text-color);
  transition: stroke 0.3s ease;
}

.dark-theme #theme-toggle:hover svg {
  stroke: var(--primary-color);
}

.dark-theme .discord-icon {
  color: var(--discord-icon-color);
}

.dark-theme .discord-icon:hover {
  color: var(--accent-color);
}

.dark-theme .subtitle {
  color: var(--secondary-color);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.dark-theme .subtitle::after {
  color: var(--accent-color);
}

.dark-theme .particle {
  background-color: var(--particle-color);
  opacity: 0.6; /* Increased opacity for better visibility */
}

.dark-theme body {
  background-color: var(--background-color);
}

.dark-theme h1 {
  color: var(--primary-color);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.dark-theme p {
  color: var(--text-color); /* Ensure paragraph text is visible */
}

.dark-theme #game-background {
  opacity: 0.1; /* Slightly increased opacity */
}

.dark-theme .modal {
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
}

.dark-theme #theme-toggle svg {
  stroke: var(--text-color);
}

/* Add a subtle glow effect to the hero section */
.dark-theme #hero {
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.1);
}

/* Improve readability of the subtitle */
.dark-theme .subtitle {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.dark-theme .cta-button {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Enhance the modal content */
.dark-theme .modal-content {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Theme toggle button styles */
#theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--card-background);
  border: none;
  cursor: pointer;
  z-index: 1000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, transform 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#theme-toggle:hover {
  transform: scale(1.1);
}

#theme-toggle svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-color);
  transition: transform 0.5s ease, opacity 0.3s ease;
}

#theme-toggle:hover svg {
  transform: rotate(15deg);
}

.dark-theme #theme-toggle svg {
  transform: rotate(360deg);
}

@keyframes morphIcon {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

#theme-toggle.animating svg {
  animation: morphIcon 0.5s ease-in-out;
}

/* Responsive design for mobile devices */
@media (max-width: 768px) {
  #theme-toggle {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
  }

  #theme-toggle svg {
    width: 20px;
    height: 20px;
  }
}

.interactive-particle {
  position: fixed;
  width: 3px;
  height: 3px;
  background-color: rgba(108, 92, 231, 0.2);
  border-radius: 50%;
  pointer-events: none;
  transition: transform 0.5s ease-out;
}

.dark-theme .interactive-particle {
  background-color: rgba(255, 255, 255, 0.1);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

.shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@media screen and (max-width: 768px) {
  #hero {
    min-height: 300px;
    padding: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }
}
