/* ============================================
   蜜芽影院 - 完整样式表
   风格: 紫罗兰渐变 + 毛玻璃 + 圆角卡片
   响应式 + 暗色模式 + 动画
   ============================================ */

:root {
  --primary: #6d28d9;
  --primary-light: #8b5cf6;
  --primary-dark: #5b21b6;
  --primary-soft: #ede9fe;
  --bg: #f5f3ff;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-muted: #666;
  --text-light: #999;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 15px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 25px rgba(109,40,217,0.2);
  --gradient-main: linear-gradient(135deg, #6d28d9, #8b5cf6);
  --gradient-text: linear-gradient(to right, #fff, #e0d4ff);
  --radius-sm: 12px;
  --radius-md: 15px;
  --radius-lg: 20px;
  --transition: all 0.3s ease;
  --glass-bg: rgba(255,255,255,0.1);
  --glass-border: rgba(255,255,255,0.2);
  --footer-bg: #2e1065;
}

/* 暗色模式 */
[data-theme="dark"] {
  --bg: #0f0a1e;
  --bg-card: #1a1030;
  --text: #e0d4ff;
  --text-muted: #b0a0cc;
  --text-light: #8a7aaa;
  --primary-soft: #2a1a4a;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 15px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 25px rgba(0,0,0,0.5);
  --glass-bg: rgba(255,255,255,0.05);
  --glass-border: rgba(255,255,255,0.1);
  --footer-bg: #1a0a3a;
}

/* ============================================
   基础重置
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

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

/* ============================================
   头部
   ============================================ */
header {
  background: var(--gradient-main);
  color: white;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(109, 40, 217, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  gap: 15px;
  flex-wrap: wrap;
}

.logo h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(255,255,255,0.3)); }
  50% { filter: drop-shadow(0 0 15px rgba(255,255,255,0.6)); }
}

.header-top > div:last-child {
  font-size: 0.9rem;
  opacity: 0.9;
  background: var(--glass-bg);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* 导航 */
nav {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--glass-border);
}

nav ul {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px 0;
}

nav ul li a {
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

nav ul li a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform 0.3s ease;
}

nav ul li a:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

nav ul li a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

/* ============================================
   主体
   ============================================ */
main {
  padding: 30px 0;
  min-height: 60vh;
}

section {
  margin-bottom: 40px;
  scroll-margin-top: 120px;
}

/* 标题 */
h2 {
  font-size: 1.8rem;
  color: var(--primary-dark);
  margin-bottom: 20px;
  padding-left: 15px;
  border-left: 5px solid var(--primary-light);
  position: relative;
  transition: color 0.3s ease;
}

h2::after {
  content: '';
  position: absolute;
  left: 15px;
  bottom: -5px;
  width: 40px;
  height: 3px;
  background: var(--gradient-main);
  border-radius: 3px;
  opacity: 0.5;
}

h3 {
  font-size: 1.3rem;
  color: var(--primary);
  margin: 20px 0 10px;
}

/* ============================================
   卡片网格
   ============================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeInUp 0.6s ease both;
  border: 1px solid rgba(0,0,0,0.05);
  position: relative;
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: linear-gradient(135deg, #ddd, #eee);
  transition: transform 0.5s ease;
}

.card:hover img {
  transform: scale(1.05);
}

.card-body {
  padding: 15px;
}

.card-body h3 {
  font-size: 1.1rem;
  margin-bottom: 5px;
  position: relative;
  display: inline-block;
}

.card-body h3::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-light);
  transition: width 0.3s ease;
}

.card:hover .card-body h3::after {
  width: 100%;
}

.card-body p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 3px 0;
}

/* 标签 */
.tag {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  margin: 3px;
  transition: var(--transition);
  cursor: default;
}

.tag:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(109,40,217,0.3);
}

/* ============================================
   精品推荐
   ============================================ */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
}

.featured-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeInUp 0.6s ease both;
  border: 1px solid rgba(0,0,0,0.05);
}

.featured-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.featured-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: linear-gradient(135deg, #ddd, #eee);
  transition: transform 0.5s ease;
}

.featured-card:hover img {
  transform: scale(1.08);
}

.featured-body {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.featured-body h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.featured-body p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 4px 0;
  line-height: 1.6;
}

/* ============================================
   详细介绍
   ============================================ */
.detail-section {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 30px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.05);
  animation: fadeInUp 0.8s ease both;
}

.detail-section p {
  margin: 10px 0;
  color: var(--text-muted);
  line-height: 1.8;
}

.detail-section strong {
  color: var(--primary);
}

/* ============================================
   角色卡片
   ============================================ */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.character-card {
  text-align: center;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeInUp 0.6s ease both;
  border: 1px solid rgba(0,0,0,0.05);
}

.character-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.character-card img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #ddd, #eee);
  border: 3px solid var(--primary-light);
  transition: transform 0.3s ease, border-color 0.3s ease;
  margin: 0 auto 10px;
}

.character-card:hover img {
  transform: scale(1.1) rotate(5deg);
  border-color: var(--primary);
}

.character-card h3 {
  font-size: 1.1rem;
  margin: 10px 0 5px;
}

.character-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 3px 0;
  line-height: 1.5;
}

/* ============================================
   平台介绍
   ============================================ */
.platform-section {
  background: linear-gradient(135deg, var(--primary-soft), #ede9fe);
  border-radius: var(--radius-md);
  padding: 30px;
  border: 1px solid rgba(0,0,0,0.05);
  animation: fadeInUp 0.8s ease both;
}

.platform-section h3 {
  color: var(--primary-dark);
  font-size: 1.4rem;
  margin-bottom: 15px;
}

.platform-section p {
  margin: 10px 0;
  line-height: 1.8;
  color: var(--text-muted);
}

.platform-section strong {
  color: var(--primary);
}

/* ============================================
   APP下载
   ============================================ */
.app-download {
  text-align: center;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 40px;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.8s ease both;
  border: 1px solid rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
}

.app-download::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(139,92,246,0.1), transparent 60%);
  pointer-events: none;
}

.app-download h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.app-download p {
  color: var(--text-muted);
  margin: 10px 0;
  line-height: 1.6;
}

/* 按钮 */
.btn {
  display: inline-block;
  background: var(--gradient-main);
  color: white;
  padding: 12px 30px;
  border-radius: 30px;
  margin: 10px;
  font-weight: 600;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(109,40,217,0.3);
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(109,40,217,0.4);
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn:active {
  transform: translateY(-1px) scale(0.98);
}

/* ============================================
   用户评论
   ============================================ */
.comments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.comment-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 15px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeInUp 0.5s ease both;
  border: 1px solid rgba(0,0,0,0.05);
}

.comment-item:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-md);
}

.comment-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.comment-header img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
  background: linear-gradient(135deg, #ddd, #eee);
  border: 2px solid var(--primary-light);
  transition: transform 0.3s ease;
}

.comment-item:hover .comment-header img {
  transform: scale(1.1);
}

.comment-user {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.comment-time {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-left: 10px;
}

.comment-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================
   侧边栏
   ============================================ */
.sidebar-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  margin-top: 40px;
}

.sidebar {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.05);
  animation: fadeInUp 0.6s ease both;
}

.sidebar h3 {
  border-bottom: 2px solid var(--primary-soft);
  padding-bottom: 10px;
  margin-bottom: 15px;
  position: relative;
}

.sidebar h3::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 50px;
  height: 2px;
  background: var(--primary-light);
}

.rank-list {
  counter-reset: rank;
}

.rank-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--primary-soft);
  font-size: 0.95rem;
  transition: padding-left 0.3s ease, color 0.3s ease;
  cursor: pointer;
  color: var(--text);
}

.rank-list li:last-child {
  border: none;
}

.rank-list li:hover {
  padding-left: 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 8px;
}

/* 统计 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  text-align: center;
}

.stat-item {
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  padding: 15px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-item:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-md);
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  animation: countUp 2s ease;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ============================================
   页脚
   ============================================ */
footer {
  background: var(--footer-bg);
  color: #ddd;
  padding: 40px 0 20px;
  margin-top: 40px;
  position: relative;
  overflow: hidden;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-main);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}

.footer-links a {
  color: #bbb;
  font-size: 0.9rem;
  transition: color 0.3s ease, transform 0.3s ease;
  position: relative;
}

.footer-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: white;
  transition: width 0.3s ease;
}

.footer-links a:hover {
  color: white;
  transform: translateY(-2px);
}

.footer-links a:hover::after {
  width: 100%;
}

.footer-copy {
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 20px;
  font-size: 0.85rem;
  color: #999;
  line-height: 2;
}

/* ============================================
   动画
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* 滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ============================================
   暗色模式切换按钮
   ============================================ */
.theme-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--gradient-main);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(45deg);
  box-shadow: 0 10px 30px rgba(109,40,217,0.5);
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .header-top {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  .header-top > div:last-child {
    font-size: 0.8rem;
  }
  
  nav ul li a {
    font-size: 0.85rem;
    padding: 6px 10px;
  }
  
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .featured-grid {
    grid-template-columns: 1fr;
  }
  
  .comments {
    grid-template-columns: 1fr;
  }
  
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .detail-section,
  .platform-section {
    padding: 20px;
  }
  
  .app-download {
    padding: 30px 20px;
  }
  
  .card img {
    height: 180px;
  }
  
  .character-card {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .logo h1 {
    font-size: 1.4rem;
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
  
  .character-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .character-card img {
    width: 100px;
    height: 100px;
  }
  
  .btn {
    padding: 10px 24px;
    font-size: 0.9rem;
    display: block;
    width: 100%;
    margin: 8px 0;
  }
  
  .comment-time {
    display: block;
    margin-left: 0;
    margin-top: 4px;
  }
  
  .footer-links {
    gap: 10px;
    flex-direction: column;
    align-items: center;
  }
  
  .stat-number {
    font-size: 1.4rem;
  }
  
  .theme-toggle {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
  }
}

/* ============================================
   性能优化
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 图片加载动画 */
img {
  opacity: 0;
  animation: imgFadeIn 0.5s ease forwards;
}

@keyframes imgFadeIn {
  to {
    opacity: 1;
  }
}

/* 延迟动画 */
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }
.card:nth-child(10) { animation-delay: 0.5s; }
.card:nth-child(11) { animation-delay: 0.55s; }
.card:nth-child(12) { animation-delay: 0.6s; }

.featured-card:nth-child(1) { animation-delay: 0.1s; }
.featured-card:nth-child(2) { animation-delay: 0.2s; }
.featured-card:nth-child(3) { animation-delay: 0.3s; }
.featured-card:nth-child(4) { animation-delay: 0.4s; }

.character-card:nth-child(1) { animation-delay: 0.05s; }
.character-card:nth-child(2) { animation-delay: 0.1s; }
.character-card:nth-child(3) { animation-delay: 0.15s; }
.character-card:nth-child(4) { animation-delay: 0.2s; }
.character-card:nth-child(5) { animation-delay: 0.25s; }
.character-card:nth-child(6) { animation-delay: 0.3s; }

.comment-item:nth-child(1) { animation-delay: 0.05s; }
.comment-item:nth-child(2) { animation-delay: 0.1s; }
.comment-item:nth-child(3) { animation-delay: 0.15s; }
.comment-item:nth-child(4) { animation-delay: 0.2s; }
.comment-item:nth-child(5) { animation-delay: 0.25s; }
.comment-item:nth-child(6) { animation-delay: 0.3s; }
.comment-item:nth-child(7) { animation-delay: 0.35s; }
.comment-item:nth-child(8) { animation-delay: 0.4s; }
.comment-item:nth-child(9) { animation-delay: 0.45s; }
.comment-item:nth-child(10) { animation-delay: 0.5s; }
.comment-item:nth-child(11) { animation-delay: 0.55s; }
.comment-item:nth-child(12) { animation-delay: 0.6s; }

/* 打印样式 */
@media print {
  header,
  footer,
  .btn,
  .theme-toggle {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .card,
  .featured-card,
  .character-card,
  .comment-item,
  .sidebar {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}