/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: radial-gradient(ellipse at center, #1a0d2e 0%, #0a0a0a 100%);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #ffffff;
  overflow: hidden;
  cursor: none;
}

/* Custom Cursor */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, #8750f7 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.1s ease;
  transform: translate(-50%, -50%);
}

/* Audio Controls */
.audio-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 1000;
}

.audio-btn {
  width: 50px;
  height: 50px;
  border: 2px solid #8750f7;
  background: rgba(26, 17, 47, 0.8);
  color: #ffffff;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.audio-btn:hover {
  background: #8750f7;
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(135, 80, 247, 0.5);
}

.audio-btn.muted {
  opacity: 0.5;
  background: rgba(255, 0, 0, 0.2);
  border-color: #ff4444;
}

/* Book Container */
.book {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  position: relative;
  perspective: 2000px;
}

/* Page Styles */
.page {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90vw;
  max-width: 900px;
  height: 85vh;
  padding: 4rem;
  background: linear-gradient(145deg, #1a112f 0%, #2c1a4a 100%);
  border: 3px solid #8750f7;
  border-radius: 25px;
  box-shadow: 
    0 0 60px rgba(135, 80, 247, 0.3),
    inset 0 0 60px rgba(135, 80, 247, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  transform: translate(-50%, -50%) !important;
  opacity: 0;
  visibility: hidden;
  z-index: 1;
  backdrop-filter: blur(20px);
}

.page.active {
  transform: translate(-50%, -50%) !important;
  opacity: 1;
  z-index: 10;
  visibility: visible;
}


/* Cover Page */
.cover {
  background: linear-gradient(145deg, #8750f7 0%, #2c1a4a 50%, #1a112f 100%);
  position: relative;
  overflow: hidden;
}

.cover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.logo-container {
  margin-bottom: 2rem;
}

.portal-icon {
  font-size: 4rem;
  filter: drop-shadow(0 0 20px #8750f7);
}

.title-main {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  background: linear-gradient(45deg, #ffffff, #8750f7, #ffffff);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(135, 80, 247, 0.5);
}

.subtitle {
  font-size: 1.3rem;
  line-height: 1.8;
  margin-bottom: 3rem;
  max-width: 600px;
}

.subtitle p {
  margin-bottom: 0.5rem;
  opacity: 1;
}

.subtitle p.emphasis { 
  color: #8750f7;
  font-weight: 600;
  font-size: 1.4rem;
}

.start-btn {
  padding: 1.5rem 3rem;
  font-size: 1.3rem;
  font-weight: 600;
  background: linear-gradient(45deg, #8750f7, #a180ff);
  border: none;
  border-radius: 50px;
  color: white;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.4s ease;
  box-shadow: 0 10px 30px rgba(135, 80, 247, 0.4);
  position: relative;
  overflow: hidden;
}

.start-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.start-btn:hover::before {
  left: 100%;
}

.start-btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 20px 40px rgba(135, 80, 247, 0.6);
}

/* Portal Pages */
.portal-page {
  position: relative;
}

.portal-number {
  position: absolute;
  top: 2rem;
  right: 2rem;
  font-size: 6rem;
  font-weight: 900;
  color: rgba(135, 80, 247, 0.2);
  line-height: 1;
}

.portal-title {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: #ffffff;
  text-shadow: 0 0 20px rgba(135, 80, 247, 0.5);
}

.portal-description {
  font-size: 1.4rem;
  line-height: 1.7;
  margin-bottom: 3rem;
  color: #cccccc;
  max-width: 700px;
  font-style: italic;
}

.portal-visual {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 2rem auto;
}

.portal-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid #8750f7;
  border-radius: 50%;
}

.portal-ring::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: #8750f7;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 20px #8750f7;
}

.portal-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, #8750f7 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.portal-hint {
  font-size: 1rem;
  color: #8750f7;
  margin-top: 2rem;
  opacity: 0.8;
}

/* Final Page */
.final {
  background: linear-gradient(145deg, #2c1a4a 0%, #8750f7 50%, #1a112f 100%);
  position: relative;
  overflow: hidden;
  color: #ffffff !important;
}

.final .content {
  position: relative;
  z-index: 2;
  color: #ffffff !important;
}

.final .content * {
  color: inherit !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.finale-logo {
  position: relative;
  margin-bottom: 2rem;
}

.glow {
  font-size: 4rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 
    0 0 10px #8750f7,
    0 0 20px #8750f7,
    0 0 40px #8750f7,
    0 0 80px #8750f7;
}

.logo-particles {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 300px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.logo-particles::before,
.logo-particles::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: #8750f7;
  border-radius: 50%;
}

.logo-particles::before {
  top: 20%;
  left: 10%;
}

.logo-particles::after {
  top: 70%;
  right: 15%;
}

.finale-text {
  font-size: 1.4rem;
  line-height: 1.8;
  margin-bottom: 3rem;
  max-width: 600px;
}

.finale-text p.emphasis {
  color: #8750f7;
  font-weight: 600;
  font-size: 1.5rem;
  margin-top: 1rem;
}

.cta {
  display: inline-block;
  padding: 1.5rem 3rem;
  font-size: 1.3rem;
  font-weight: 600;
  background: linear-gradient(45deg, #ffffff, #8750f7);
  color: #1a112f;
  border: none;
  border-radius: 50px;
  text-decoration: none;
  transition: all 0.4s ease;
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.3);
  margin-bottom: 2rem;
}

.cta:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 20px 40px rgba(255, 255, 255, 0.5);
}

.social-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 2rem;
}

.social-link {
  color: #cccccc;
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(135, 80, 247, 0.3);
  border-radius: 25px;
}

.social-link:hover {
  color: #8750f7;
  border-color: #8750f7;
  box-shadow: 0 0 20px rgba(135, 80, 247, 0.3);
}

/* Navigation */
.navigation {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 100;
}

.nav-hint {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 1rem;
}

.page-counter {
  font-size: 1.1rem;
  color: #8750f7;
  font-weight: 600;
}

/* Animations */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

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

@keyframes glow-pulse {
  0%, 100% { 
    text-shadow: 
      0 0 10px #8750f7,
      0 0 20px #8750f7,
      0 0 40px #8750f7,
      0 0 80px #8750f7;
  }
  50% { 
    text-shadow: 
      0 0 20px #8750f7,
      0 0 40px #8750f7,
      0 0 80px #8750f7,
      0 0 120px #8750f7;
  }
}

@keyframes particle-float {
  0%, 100% { 
    transform: translateY(0px) scale(1);
    opacity: 0.6;
  }
  50% { 
    transform: translateY(-30px) scale(1.2);
    opacity: 1;
  }
}

@keyframes fade-in-out {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
  .page {
    width: 95vw;
    height: 90vh;
    padding: 2rem;
  }

  .title-main {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 1.1rem;
  }

  .portal-title {
    font-size: 2.2rem;
  }

  .portal-description {
    font-size: 1.2rem;
  }

  .portal-number {
    font-size: 4rem;
    top: 1rem;
    right: 1rem;
  }

  .glow {
    font-size: 2.5rem;
  }

  .start-btn,
  .cta {
    padding: 1rem 2rem;
    font-size: 1.1rem;
  }

  .social-links {
    flex-direction: column;
    gap: 1rem;
  }

  .audio-controls {
    top: 10px;
    right: 10px;
  }

  .audio-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
}

@media screen and (max-width: 480px) {
  .page {
    padding: 1.5rem;
  }

  .title-main {
    font-size: 2rem;
  }

  .portal-title {
    font-size: 1.8rem;
  }

  .portal-visual {
    width: 150px;
    height: 150px;
  }

  .glow {
    font-size: 2rem;
  }
}