* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --space-dark: #0a0a1a;
  --space-darker: #050510;
  --space-blue: #1a1a3a;
  --space-purple: #3a1a5a;
  --star-white: #ffffff;
  --star-blue: #4db8ff;
  --star-pink: #ff66b2;
  --accent-purple: #8a2be2;
  --accent-pink: #ff1493;
  --text-light: #e6e6ff;
  --text-gray: #a0a0cc;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--space-darker) 0%, var(--space-blue) 50%, var(--space-purple) 100%);
  color: var(--text-light);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

#spaceCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(138, 43, 226, 0.3);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  text-decoration: none;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
}

.logo-text {
  font-size: 1.8rem;
  font-weight: bold;
  background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-subtitle {
  font-size: 0.8rem;
  color: var(--text-gray);
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  color: var(--text-light);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: all 0.3s ease;
}

.nav-link:hover {
  background: rgba(138, 43, 226, 0.2);
  color: var(--star-blue);
}

.user-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.username {
  color: var(--star-blue);
  font-weight: 500;
}

.btn {
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-login {
  background: transparent;
  border: 1px solid var(--accent-purple);
  color: var(--accent-purple);
}

.btn-register {
  background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink));
  color: white;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--star-pink);
  color: var(--star-pink);
  padding: 0.3rem 1rem;
  font-size: 0.9rem;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(138, 43, 226, 0.4);
}

/* Main content */
.main-content {
  padding: 2rem 0;
  min-height: 70vh;
}

.hero {
  text-align: center;
  padding: 4rem 0;
  position: relative;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, var(--star-blue), var(--star-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-gray);
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Novel cards */
.novels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.novel-card {
  background: rgba(26, 26, 58, 0.7);
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(138, 43, 226, 0.2);
}

.novel-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(138, 43, 226, 0.3);
  border-color: var(--accent-purple);
}

.novel-cover {
  height: 200px;
  overflow: hidden;
  position: relative;
}

.novel-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.novel-card:hover .novel-cover img {
  transform: scale(1.05);
}

.blurred {
  filter: blur(10px) grayscale(100%);
  position: relative;
}

.blur-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  text-align: center;
  padding: 1rem;
}

.novel-info {
  padding: 1.5rem;
}

.novel-info h3 {
  margin-bottom: 0.5rem;
  color: var(--text-light);
}

.author {
  color: var(--text-gray);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.genre-tag {
  background: rgba(138, 43, 226, 0.2);
  color: var(--star-blue);
  padding: 0.2rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
}

.btn-read {
  display: inline-block;
  background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink));
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 5px;
  text-decoration: none;
  margin-top: 1rem;
}

/* Novel detail */
.novel-detail-header {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.novel-cover-large {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.novel-cover-large img {
  width: 100%;
  height: auto;
  display: block;
}

.novel-header-info h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-light);
}

.novel-stats {
  display: flex;
  gap: 2rem;
  margin: 1rem 0;
  color: var(--text-gray);
}

.novel-description {
  margin-top: 2rem;
  padding: 1.5rem;
  background: rgba(26, 26, 58, 0.5);
  border-radius: 10px;
  border-left: 4px solid var(--accent-purple);
}

/* Chapters list */
.chapters-list {
  background: rgba(26, 26, 58, 0.7);
  border-radius: 10px;
  padding: 2rem;
}

.chapter-item {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chapter-item:last-child {
  border-bottom: none;
}

.chapter-link {
  color: var(--text-light);
  text-decoration: none;
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.chapter-link:hover {
  color: var(--star-blue);
}

.chapter-link.disabled {
  color: var(--text-gray);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Chapter content */
.chapter-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: rgba(26, 26, 58, 0.7);
  border-radius: 10px;
}

.chapter-header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem;
  background: rgba(26, 26, 58, 0.5);
  border-radius: 10px;
}

.chapter-content {
  font-size: 1.1rem;
  line-height: 1.8;
  padding: 2rem;
  background: rgba(26, 26, 58, 0.3);
  border-radius: 10px;
  margin-bottom: 3rem;
}

.chapter-content p {
  margin-bottom: 1.5rem;
}

/* Auth modal */
.auth-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.auth-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, var(--space-blue) 0%, var(--space-purple) 100%);
  padding: 2rem;
  border-radius: 15px;
  width: 90%;
  max-width: 400px;
  border: 1px solid rgba(138, 43, 226, 0.5);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.close-modal {
  position: absolute;
  right: 1rem;
  top: 1rem;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.5rem;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close-modal:hover {
  background: rgba(255, 255, 255, 0.1);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-light);
}

.form-group input {
  width: 100%;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(138, 43, 226, 0.5);
  border-radius: 5px;
  color: var(--text-light);
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.btn-submit {
  width: 100%;
  background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink));
  color: white;
  padding: 0.8rem;
  font-size: 1.1rem;
}

.auth-switch {
  text-align: center;
  margin-top: 1rem;
  color: var(--text-gray);
}

.auth-switch a {
  color: var(--star-blue);
  text-decoration: none;
}

.auth-message {
  margin-top: 1rem;
  padding: 0.8rem;
  border-radius: 5px;
  text-align: center;
}

.auth-message.success {
  background: rgba(0, 255, 0, 0.1);
  color: #4CAF50;
  border: 1px solid #4CAF50;
}

.auth-message.error {
  background: rgba(255, 0, 0, 0.1);
  color: #f44336;
  border: 1px solid #f44336;
}

/* Footer */
.footer {
  background: rgba(5, 5, 16, 0.9);
  border-top: 1px solid rgba(138, 43, 226, 0.3);
  padding: 3rem 0 1rem;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
  color: var(--text-light);
  margin-bottom: 1rem;
}

.footer-section a {
  display: block;
  color: var(--text-gray);
  text-decoration: none;
  margin-bottom: 0.5rem;
  transition: color 0.3s ease;
}

.footer-section a:hover {
  color: var(--star-blue);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-gray);
}

.disclaimer {
  font-size: 0.9rem;
  margin-top: 0.5rem;
  opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 70px;
    right: -100%;
    flex-direction: column;
    background: rgba(10, 10, 26, 0.95);
    width: 80%;
    height: calc(100vh - 70px);
    transition: right 0.3s ease;
    padding: 2rem;
  }

  .nav-links.active {
    right: 0;
  }

  .menu-toggle {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 24px;
    position: relative;
  }

  .menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--text-light);
    margin: 5px 0;
    transition: 0.3s;
  }

  .novel-detail-header {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .novels-grid {
    grid-template-columns: 1fr;
  }
}