/* ===== 全局变量与基础 ===== */
:root {
  --bg-primary: #F8F4FF;
  --bg-card: #FFFFFF;
  --bg-accent: #1A1A2E;
  --bg-soft: #FCFAFF;
  --text-primary: #1A1A2E;
  --text-secondary: #2D2D44;
  --text-light: #F5F0FF;
  --accent-purple: #6B4CFF;
  --accent-blue: #4A6CF7;
  --border-light: #E0D6F5;
  --shadow-sm: 0 4px 10px rgba(0,0,0,0.04);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(107,76,255,0.15);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  --glass-bg: rgba(255,255,255,0.65);
  --glass-border: rgba(255,255,255,0.4);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #12121E;
    --bg-card: #1E1E32;
    --bg-accent: #0D0D1A;
    --bg-soft: #252540;
    --text-primary: #F0F0FF;
    --text-secondary: #C4C4E8;
    --text-light: #FFFFFF;
    --border-light: #3A3A5C;
    --shadow-sm: 0 4px 10px rgba(0,0,0,0.3);
    --shadow-md: 0 6px 18px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
    --glass-bg: rgba(30,30,50,0.7);
    --glass-border: rgba(255,255,255,0.1);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse at 20% 20%, rgba(107,76,255,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 0%, rgba(74,108,247,0.06) 0%, transparent 40%),
    linear-gradient(135deg, var(--bg-primary) 0%, #F0E8FF 100%);
  color: var(--text-primary);
  font-family: 'Segoe UI', 'Hiragino Sans', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.7;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* 背景装饰 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 90% 10%, rgba(107,76,255,0.05) 0%, transparent 30%),
    radial-gradient(circle at 10% 90%, rgba(74,108,247,0.04) 0%, transparent 25%);
  pointer-events: none;
  z-index: -1;
}

/* ===== 顶部导航 ===== */
header {
  background-color: var(--bg-accent);
  background-image: linear-gradient(135deg, #1A1A2E 0%, #2D2D44 100%);
  padding: 0.5rem 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

header nav {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.3rem 0;
}

header h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 1px;
  background: linear-gradient(90deg, #FFFFFF, #B9A5FF, #6B4CFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 6s ease infinite;
  background-size: 200% auto;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

header nav div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 500;
}

header nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 30px;
  transition: var(--transition);
  position: relative;
  font-size: 0.9rem;
}

header nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--accent-purple);
  border-radius: 2px;
  transition: width 0.3s ease;
}

header nav a:hover {
  color: #FFFFFF;
  background: rgba(107,76,255,0.15);
  transform: translateY(-2px);
}

header nav a:hover::after {
  width: 60%;
}

/* ===== 主内容区 ===== */
main {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding: 0 1rem;
  animation: fadeInUp 0.8s ease both;
}

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

/* ===== 区块标题 ===== */
section h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--text-secondary);
  border-left: 8px solid var(--accent-purple);
  padding-left: 1rem;
  margin-bottom: 1.8rem;
  letter-spacing: 0.5px;
  position: relative;
  display: inline-block;
}

section h2::after {
  content: '';
  position: absolute;
  left: 1rem;
  bottom: -6px;
  width: 30px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-purple), transparent);
  border-radius: 3px;
}

/* ===== 动漫卡片 ===== */
article {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
  transform: translateZ(0);
}

article:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: rgba(107,76,255,0.3);
}

article img {
  width: 100%;
  aspect-ratio: 300/420;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, #ddd 0%, #b8b8d0 100%);
  transition: transform 0.5s ease;
}

article:hover img {
  transform: scale(1.05);
}

article div {
  padding: 0.8rem;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

article h3 {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

article p {
  margin: 0.2rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

article p:last-child {
  margin: 0.4rem 0 0;
  font-weight: 700;
  color: var(--text-primary);
  background: linear-gradient(90deg, #FFD700, #FFA500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== 热门动漫网格 ===== */
section > div[style*="grid-template-columns"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.5rem;
}

/* ===== 新番推荐区块 ===== */
section:has(> h2[style*="4A6CF7"]) {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
}

section:has(> h2[style*="4A6CF7"]) article {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.8rem;
  background: var(--bg-soft);
  transition: var(--transition);
}

section:has(> h2[style*="4A6CF7"]) article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-purple);
}

section:has(> h2[style*="4A6CF7"]) article img {
  border-radius: var(--radius-sm);
}

/* ===== 深度介绍区块 ===== */
section:has(> h2[style*="6B4CFF"]) {
  background: linear-gradient(135deg, var(--bg-accent) 0%, #2D2D44 100%);
  color: var(--text-light);
  padding: 2rem;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

section:has(> h2[style*="6B4CFF"])::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(107,76,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}

section:has(> h2[style*="6B4CFF"]) h2 {
  color: #FFFFFF;
  border-left-color: var(--accent-purple);
}

section:has(> h2[style*="6B4CFF"]) article {
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 0;
}

section:has(> h2[style*="6B4CFF"]) article p {
  color: rgba(255,255,255,0.85);
  font-size: 1.05rem;
  line-height: 1.9;
  margin-bottom: 0.8rem;
}

section:has(> h2[style*="6B4CFF"]) article strong {
  color: #FFFFFF;
  font-weight: 600;
}

/* ===== 角色介绍 ===== */
section:has(> h2[style*="🧑"]) article {
  text-align: center;
  padding: 1rem;
}

section:has(> h2[style*="🧑"]) article img {
  aspect-ratio: 1/1;
  border-radius: 50%;
  width: 100%;
  object-fit: cover;
  border: 3px solid var(--accent-purple);
  padding: 3px;
  background: var(--bg-soft);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

section:has(> h2[style*="🧑"]) article:hover img {
  transform: rotate(5deg) scale(1.05);
  border-color: var(--accent-blue);
}

section:has(> h2[style*="🧑"]) article h3 {
  margin: 0.5rem 0 0.2rem;
  font-size: 1.1rem;
}

section:has(> h2[style*="🧑"]) article p {
  font-size: 0.85rem;
  margin: 0.2rem 0;
}

section:has(> h2[style*="🧑"]) article p:last-child {
  margin-top: 0.5rem;
  font-weight: 500;
  color: var(--accent-purple);
}

/* ===== 平台介绍 ===== */
section:has(> h2[style*="🚀"]) {
  background: linear-gradient(135deg, var(--bg-accent) 0%, #3D3D5C 100%);
  color: var(--text-light);
  padding: 2rem;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

section:has(> h2[style*="🚀"])::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(74,108,247,0.2) 0%, transparent 70%);
  pointer-events: none;
}

section:has(> h2[style*="🚀"]) h2 {
  color: #FFFFFF;
}

section:has(> h2[style*="🚀"]) p {
  font-size: 1.05rem;
  line-height: 1.9;
  color: rgba(255,255,255,0.9);
  max-width: 900px;
}

/* ===== APP下载 + 侧边栏 ===== */
div[style*="display:flex; gap:2rem"] {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

div[style*="display:flex; gap:2rem"] section {
  flex: 2;
  min-width: 280px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

div[style*="display:flex; gap:2rem"] section:hover {
  box-shadow: var(--shadow-lg);
}

div[style*="display:flex; gap:2rem"] section h2 {
  color: var(--text-primary);
  border-left: none;
  padding-left: 0;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

div[style*="display:flex; gap:2rem"] section p {
  color: var(--text-primary);
  margin-bottom: 1rem;
}

div[style*="display:flex; gap:2rem"] section div {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

div[style*="display:flex; gap:2rem"] section span {
  background: var(--accent-purple);
  color: #FFFFFF;
  padding: 0.8rem 1.5rem;
  border-radius: 40px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  display: inline-block;
  box-shadow: 0 4px 15px rgba(107,76,255,0.3);
}

div[style*="display:flex; gap:2rem"] section span:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(107,76,255,0.4);
}

div[style*="display:flex; gap:2rem"] section span:nth-child(2) {
  background: var(--bg-accent);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

div[style*="display:flex; gap:2rem"] section span:nth-child(3) {
  background: var(--accent-blue);
  box-shadow: 0 4px 15px rgba(74,108,247,0.3);
}

div[style*="display:flex; gap:2rem"] aside {
  flex: 1;
  min-width: 220px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

div[style*="display:flex; gap:2rem"] aside:hover {
  box-shadow: var(--shadow-md);
}

div[style*="display:flex; gap:2rem"] aside h3 {
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
  font-size: 1.1rem;
}

div[style*="display:flex; gap:2rem"] aside ul {
  color: var(--text-primary);
  padding-left: 1.2rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

div[style*="display:flex; gap:2rem"] aside ul li {
  margin: 0.4rem 0;
  font-size: 0.9rem;
}

div[style*="display:flex; gap:2rem"] aside p {
  color: var(--text-secondary);
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* ===== 用户评论 ===== */
section:has(> h2[style*="💬"]) > div {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

section:has(> h2[style*="💬"]) article {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

section:has(> h2[style*="💬"]) article:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(107,76,255,0.3);
}

section:has(> h2[style*="💬"]) article p {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

section:has(> h2[style*="💬"]) article span {
  color: var(--text-secondary);
  font-size: 0.85rem;
  opacity: 0.8;
}

/* ===== 底部 ===== */
footer {
  background: linear-gradient(135deg, var(--bg-accent) 0%, #0D0D1A 100%);
  color: var(--text-light);
  padding: 2rem 1rem;
  margin-top: 3rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

footer div {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: center;
}

footer p {
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  line-height: 1.8;
}

footer p:first-child {
  font-weight: 700;
  color: #FFFFFF;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

footer a {
  color: var(--accent-purple);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
}

footer a:hover {
  color: #FFFFFF;
  text-shadow: 0 0 10px rgba(107,76,255,0.5);
}

footer a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-purple);
  transition: width 0.3s ease;
}

footer a:hover::after {
  width: 100%;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  body {
    font-size: 0.95rem;
  }

  header {
    padding: 0.5rem 0.8rem;
  }

  header nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  header nav div {
    width: 100%;
    gap: 0.3rem 0.8rem;
    font-size: 0.85rem;
    overflow-x: auto;
    padding-bottom: 0.3rem;
    -webkit-overflow-scrolling: touch;
  }

  header nav a {
    white-space: nowrap;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
  }

  main {
    margin-top: 1.5rem;
    padding: 0 0.8rem;
  }

  section h2 {
    font-size: 1.4rem;
    margin-bottom: 1.2rem;
  }

  section > div[style*="grid-template-columns"] {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
  }

  section:has(> h2[style*="4A6CF7"]) {
    padding: 1rem;
  }

  section:has(> h2[style*="4A6CF7"]) > div {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
  }

  section:has(> h2[style*="6B4CFF"]) {
    padding: 1.5rem;
  }

  section:has(> h2[style*="🚀"]) {
    padding: 1.5rem;
  }

  div[style*="display:flex; gap:2rem"] {
    flex-direction: column;
    gap: 1.5rem;
  }

  div[style*="display:flex; gap:2rem"] section {
    min-width: 100%;
  }

  div[style*="display:flex; gap:2rem"] aside {
    min-width: 100%;
  }

  div[style*="display:flex; gap:2rem"] section div {
    flex-direction: column;
  }

  div[style*="display:flex; gap:2rem"] section span {
    text-align: center;
    width: 100%;
  }

  section:has(> h2[style*="💬"]) > div {
    grid-template-columns: 1fr;
  }

  footer div {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.3rem;
  }

  section > div[style*="grid-template-columns"] {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.8rem;
  }

  article div {
    padding: 0.6rem;
  }

  article h3 {
    font-size: 0.95rem;
  }

  article p {
    font-size: 0.75rem;
  }

  section:has(> h2[style*="4A6CF7"]) > div {
    grid-template-columns: 1fr;
  }
}

/* ===== 滚动动画 ===== */
@media (prefers-reduced-motion: no-preference) {
  section {
    opacity: 0;
    transform: translateY(30px);
    animation: sectionFadeIn 0.8s ease forwards;
  }

  section:nth-of-type(1) { animation-delay: 0.1s; }
  section:nth-of-type(2) { animation-delay: 0.2s; }
  section:nth-of-type(3) { animation-delay: 0.3s; }
  section:nth-of-type(4) { animation-delay: 0.4s; }
  section:nth-of-type(5) { animation-delay: 0.5s; }
  section:nth-of-type(6) { animation-delay: 0.6s; }
  section:nth-of-type(7) { animation-delay: 0.7s; }

  @keyframes sectionFadeIn {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ===== 卡片悬停特效 ===== */
article::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
  z-index: 1;
  pointer-events: none;
}

article:hover::before {
  left: 100%;
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent-purple), var(--accent-blue));
  border-radius: 5px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-blue), var(--accent-purple));
}

/* ===== 选中文本 ===== */
::selection {
  background: var(--accent-purple);
  color: #FFFFFF;
}

/* ===== 无障碍支持 ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}