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

:root {
  --primary: #1a237e;
  --primary-light: #283593;
  --accent: #c9a84c;
  --accent-light: #e0c068;
  --bg: #f5f6fa;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #e0e0e0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 10px;
  --transition: 0.3s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== HEADER ===== */
.site-header {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-wrap img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.logo-wrap .logo-text {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav a {
  color: rgba(255,255,255,0.85);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right .company-name {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
}

.btn-login, .btn-register {
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.btn-login {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
}

.btn-login:hover {
  border-color: #fff;
  background: rgba(255,255,255,0.1);
}

.btn-register {
  background: var(--accent);
  color: var(--primary);
}

.btn-register:hover {
  background: var(--accent-light);
}

/* ===== MOBILE NAV ===== */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  margin: 5px 0;
  transition: var(--transition);
}

/* ===== HERO ===== */
.hero {
  position: relative;
  height: 420px;
  overflow: hidden;
  background: linear-gradient(135deg, #0d1b3e 0%, #1a237e 50%, #283593 100%);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(13,27,62,0.7), rgba(26,35,126,0.5));
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #fff;
  padding: 0 20px;
}

.hero-content h1 {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 16px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
  letter-spacing: 2px;
}

.hero-content p {
  font-size: 18px;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

.hero-decor {
  position: absolute;
  z-index: 1;
  opacity: 0.06;
}

.hero-decor svg { width: 100%; height: 100%; }

/* ===== SECTION ===== */
.section {
  padding: 60px 0;
}

.section-title {
  text-align: center;
  margin-bottom: 40px;
}

.section-title h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.section-title p {
  color: var(--text-light);
  font-size: 15px;
}

.section-title .title-line {
  width: 50px;
  height: 3px;
  background: var(--accent);
  margin: 12px auto 0;
  border-radius: 2px;
}

/* ===== ANIME CARDS ===== */
.anime-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.anime-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  cursor: pointer;
}

.anime-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.anime-card .card-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.anime-card .card-body {
  padding: 20px;
}

.anime-card .card-body h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--primary);
}

.anime-card .card-body .meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.anime-card .card-body .desc {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.anime-card .card-tag {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 10px;
}

/* ===== ANIME DETAIL PAGE ===== */
.detail-hero {
  position: relative;
  height: 360px;
  overflow: hidden;
  background: var(--primary);
}

.detail-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}

.detail-hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 40px;
  background: linear-gradient(transparent 30%, rgba(0,0,0,0.7));
  color: #fff;
}

.detail-hero-content h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 8px;
}

.detail-hero-content .detail-meta {
  display: flex;
  gap: 20px;
  font-size: 14px;
  opacity: 0.85;
}

.detail-info {
  background: var(--card-bg);
  padding: 30px;
  border-radius: var(--radius);
  margin-top: -40px;
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow);
}

.detail-info p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
}

/* ===== IMAGE GALLERY ===== */
.gallery {
  padding: 40px 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.gallery-item {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 3/4;
  background: #eee;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform var(--transition);
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.gallery-item .page-num {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
}

.lightbox.active { display: flex; }

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  background: none;
  border: none;
  z-index: 10;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 40px;
  cursor: pointer;
  background: rgba(255,255,255,0.1);
  border: none;
  padding: 10px 18px;
  border-radius: 50%;
  transition: background var(--transition);
}

.lightbox-nav:hover { background: rgba(255,255,255,0.25); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* ===== AUTH PAGES ===== */
.auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
}

.auth-card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
}

.auth-card h2 {
  text-align: center;
  font-size: 24px;
  color: var(--primary);
  margin-bottom: 8px;
}

.auth-card .auth-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-light);
}

.form-check input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--primary);
}

.form-check a {
  color: var(--primary);
  text-decoration: underline;
}

.btn-submit {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-submit:hover { background: var(--primary-light); }

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-light);
}

.auth-footer a { color: var(--primary); font-weight: 500; }

/* ===== LEGAL PAGES ===== */
.legal-page {
  flex: 1;
  padding: 40px 0;
}

.legal-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 30px;
}

.legal-sidebar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: 84px;
}

.legal-sidebar h3 {
  font-size: 16px;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.legal-sidebar a {
  display: block;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  border-radius: 6px;
  margin-bottom: 2px;
  transition: all var(--transition);
}

.legal-sidebar a:hover,
.legal-sidebar a.active {
  background: rgba(26,35,126,0.08);
  color: var(--primary);
}

.legal-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
}

.legal-content h1 {
  font-size: 26px;
  color: var(--primary);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--accent);
}

.legal-content h2 {
  font-size: 20px;
  color: var(--primary);
  margin: 28px 0 12px;
}

.legal-content h3 {
  font-size: 17px;
  color: var(--text);
  margin: 20px 0 10px;
}

.legal-content p {
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 12px;
  color: var(--text);
}

.legal-content ul, .legal-content ol {
  margin: 12px 0;
  padding-left: 24px;
}

.legal-content li {
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 6px;
}

.legal-content .update-date {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 24px;
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.7);
  padding: 40px 0 0;
  margin-top: auto;
}

.footer-bottom {
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
  line-height: 2;
}

.footer-bottom a {
  color: rgba(255,255,255,0.65);
  margin: 0 8px;
}

.footer-bottom a:hover { color: var(--accent); }

.footer-bottom .sep {
  color: rgba(255,255,255,0.3);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .anime-grid { grid-template-columns: repeat(2, 1fr); }
  .legal-layout { grid-template-columns: 1fr; }
  .legal-sidebar { position: static; }
}

@media (max-width: 768px) {
  .main-nav { display: none; }
  .nav-toggle { display: block; }
  .header-right .company-name { display: none; }
  .hero { height: 300px; }
  .hero-content h1 { font-size: 28px; }
  .anime-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px; }
}
