/* Estructura básica y estilos comunes */
:root {
  --primary-color: #ff4d4d;
  --secondary-color: #333;
  --text-color: #f5f5f5;
  --background-color: #121212;
  --box-color: #1e1e1e;
  --modal-bg: rgba(0, 0, 0, 0.85);
  --font-main: "Poppins", sans-serif;
  --font-cursive: "Dancing Script", cursive;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 0.5s,
    color 0.3s;
}

html {
  perspective: 1000px;
}

body {
  font-family: var(--font-main);
  background-color: var(--background-color);
  color: var(--text-color);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  touch-action: manipulation;
  position: relative;
}

/* Canvas para efectos 3D */
.background-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Pantalla de carga mejorada con efectos 3D */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  background: linear-gradient(
    135deg,
    rgba(18, 18, 18, 0.95),
    rgba(30, 30, 30, 0.95)
  );
  backdrop-filter: blur(5px);
  transition: opacity 0.8s ease;
}

.loading-particles {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.loading-particles::before {
  content: "";
  position: absolute;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 77, 77, 0.1) 1px,
    transparent 1px
  );
  background-size: 50px 50px;
  animation: particles-move 20s linear infinite;
  top: -50%;
  left: -50%;
}

@keyframes particles-move {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(50px, 50px);
  }
}

.loading-bar-container {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 300px;
  z-index: 10;
}

.loading-bar-background {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(255, 77, 77, 0.3);
  box-shadow: 0 0 15px rgba(255, 77, 77, 0.2);
}

#loading-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff4d4d, #ff8888, #ff4d4d);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
  width: 0%;
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(255, 77, 77, 0.6);
  display: block !important;
  min-height: 8px;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
}

@keyframes loading-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.loading-percentage {
  text-align: center;
  font-size: 0.9rem;
  color: rgba(255, 77, 77, 0.8);
  margin-top: 10px;
  font-weight: 600;
  letter-spacing: 1px;
}

.loading-text {
  font-size: 1.5rem;
  color: var(--text-color);
  position: absolute;
  top: calc(50% - 40px);
  left: 50%;
  transform: translateX(-50%);
  transition: opacity 0.5s ease-out;
  letter-spacing: 2px;
  font-weight: 600;
  z-index: 10;
}

#name-container {
  position: relative;
  height: 80px;
  width: 200px;
  margin-top: 30px;
  z-index: 10;
  perspective: 1000px;
}

.cursive {
  font-family: var(--font-cursive);
  font-size: 2.5rem;
  color: var(--primary-color);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
}

#animated-name {
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  transform: translate(-50%, -50%) scale(0.9) rotateX(90deg);
  transform-style: preserve-3d;
}

#animated-name.visible {
  opacity: 1 !important;
  transform: translate(-50%, -50%) scale(1) rotateX(0deg);
}

.main-header {
  position: fixed;
  top: 20px;
  left: 0;
  width: 100%;
  text-align: center;
  transform: translateY(-100px) rotateX(20deg);
  opacity: 0;
  visibility: hidden;
  transition: all 1s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 100;
  perspective: 1000px;
  transform-style: preserve-3d;
}

.main-header h1 {
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--primary-color), #ff8888);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  letter-spacing: 1px;
  font-weight: 700;
}

.content {
  min-height: 100vh;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 1s ease;
  position: relative;
  z-index: 2;
}

.menu-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  width: 100%;
  max-width: 900px;
  padding: 20px;
  perspective: 1200px;
}

.menu-box {
  width: 150px;
  height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--box-color), rgba(30, 30, 30, 0.5));
  border-radius: 20px;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 77, 77, 0.1);
  transform-style: preserve-3d;
  transform: translateZ(0);
}

.box-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.box-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 77, 77, 0.3), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.menu-box:hover {
  transform: translateY(-10px) translateZ(50px) rotateX(5deg);
  background: linear-gradient(
    135deg,
    rgba(255, 77, 77, 0.2),
    rgba(30, 30, 30, 0.8)
  );
  box-shadow:
    0 20px 50px rgba(255, 77, 77, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 30px rgba(255, 77, 77, 0.2);
}

.menu-box:hover .box-glow {
  opacity: 1;
}

.menu-box i {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 10px;
  filter: drop-shadow(0 0 10px rgba(255, 77, 77, 0.3));
  transition: all 0.3s ease;
}

.menu-box:hover i {
  filter: drop-shadow(0 0 20px rgba(255, 77, 77, 0.6));
  transform: scale(1.2);
}

.menu-box span {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--modal-bg);
  z-index: 1001;
  justify-content: center;
  align-items: center;
  padding: 20px;
  touch-action: pan-y;
  backdrop-filter: blur(5px);
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(5px);
  }
}

.modal-content {
  background: linear-gradient(135deg, var(--box-color), rgba(30, 30, 30, 0.8));
  padding: 25px;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(255, 77, 77, 0.2);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

@keyframes modalSlideIn {
  from {
    transform: scale(0.8) translateY(50px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.scrollable-content {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.modal h2 {
  background: linear-gradient(135deg, var(--primary-color), #ff8888);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.bio-text {
  font-size: 1rem;
}

.bio-text h3 {
  color: var(--primary-color);
  margin: 20px 0 10px;
  font-size: 1.3em;
  letter-spacing: 0.5px;
}

.bio-text h4 {
  color: #ff8888;
  margin: 15px 0 8px;
  font-size: 1.1em;
  letter-spacing: 0.3px;
}

.bio-text p {
  margin-bottom: 15px;
  text-align: justify;
  line-height: 1.8;
}

.bio-text b {
  color: var(--primary-color);
  font-weight: 700;
}

.social-options,
.music-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-top: 25px;
}

.social-option,
.music-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    rgba(255, 77, 77, 0.1),
    rgba(51, 51, 51, 0.5)
  );
  padding: 15px;
  border-radius: 15px;
  min-width: 120px;
  width: 100%;
  max-width: 150px;
  text-decoration: none;
  color: var(--text-color);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  border: 1px solid rgba(255, 77, 77, 0.2);
  cursor: pointer;
  transform-style: preserve-3d;
}

.social-option:hover,
.music-option:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 77, 77, 0.3),
    rgba(51, 51, 51, 0.8)
  );
  transform: scale(1.1) translateZ(20px) rotateY(10deg);
  border-color: rgba(255, 77, 77, 0.6);
  box-shadow: 0 10px 30px rgba(255, 77, 77, 0.3);
}

.social-option i,
.music-option i {
  font-size: 1.8rem;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 5px rgba(255, 77, 77, 0.3));
  transition: all 0.3s ease;
}

.social-option:hover i,
.music-option:hover i {
  filter: drop-shadow(0 0 15px rgba(255, 77, 77, 0.6));
}

.mobile-close-hint {
  display: none;
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: rgba(255, 77, 77, 0.7);
  animation: slideUp 0.5s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .menu-container {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  .menu-box {
    width: 90%;
    max-width: 300px;
    height: 80px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 0 20px;
  }

  .menu-box i {
    font-size: 1.5rem;
    margin-right: 15px;
    margin-bottom: 0;
  }

  .modal-content {
    padding: 20px 15px;
  }

  .social-options,
  .music-options {
    flex-direction: column;
  }

  .social-option,
  .music-option {
    max-width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 20px;
  }

  .social-option i,
  .music-option i {
    margin-right: 15px;
    margin-bottom: 0;
  }

  .mobile-close-hint {
    display: block;
  }
}

@media (max-width: 480px) {
  #name-container {
    height: 70px;
    width: 180px;
  }

  .menu-box span {
    font-size: 1rem;
  }

  .social-option,
  .music-option {
    padding: 10px 15px;
  }

  .main-header h1 {
    font-size: 1.5rem;
  }
}

/* Indicador de recarga */
.refresh-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  z-index: 1000;
  display: none;
  pointer-events: none;
}

.refresh-circle {
  width: 100%;
  height: 100%;
  border: 3px solid rgba(255, 77, 77, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 0 10px rgba(255, 77, 77, 0.4);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

body.refreshing .refresh-indicator {
  display: block;
}

body.refreshing .refresh-circle {
  opacity: 1;
}
