/* ===== 香蕉漫画网 全局样式 ===== */
:root {
  --bg-primary: #0a0a18;
  --bg-secondary: #14142a;
  --bg-card: rgba(26, 26, 53, 0.85);
  --bg-nav: rgba(13, 13, 32, 0.92);
  --border-color: rgba(45, 45, 85, 0.6);
  --text-primary: #e0e0f0;
  --text-secondary: #b0b0d0;
  --text-muted: #8888aa;
  --accent: #8b5cf6;
  --accent-light: #a78bfa;
  --accent-lighter: #c4b5fd;
  --gradient-accent: linear-gradient(135deg, #7c3aed, #6d28d9);
  --gradient-bg: linear-gradient(135deg, #0a0a18 0%, #14142a 50%, #1a1035 100%);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 16px 40px rgba(139, 92, 246, 0.25);
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --blur: blur(12px);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--gradient-bg);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease;
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), #4c1d95);
  border-radius: 5px;
  border: 2px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
}

/* ===== 链接 ===== */
a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color 0.25s ease, text-decoration 0.25s ease;
  position: relative;
}

a:hover {
  color: var(--accent-lighter);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ===== 容器 ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ===== 标题 ===== */
h1, h2, h3, h4, h5, h6 {
  color: #f0f0ff;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  background: linear-gradient(135deg, #f0f0ff 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 30px 0 10px;
  text-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
}

h2 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin: 2.5rem 0 1.2rem;
  border-left: 6px solid var(--accent);
  padding-left: 15px;
  position: relative;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.15), transparent);
  padding: 10px 15px;
  border-radius: 0 12px 12px 0;
}

h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: linear-gradient(180deg, var(--accent), var(--accent-light));
  border-radius: 3px;
}

h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  margin: 1.2rem 0 0.8rem;
  transition: color 0.3s ease;
}

h3:hover {
  color: var(--accent-light);
}

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.08), transparent);
  transition: left 0.5s ease;
}

.card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-hover);
  border-color: rgba(139, 92, 246, 0.4);
}

.card:hover::before {
  left: 100%;
}

.card img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.card:hover img {
  transform: scale(1.02);
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
}

.card h3 {
  margin-top: 15px;
  font-size: 1.2rem;
}

.card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 4px 0;
  line-height: 1.5;
}

/* ===== 网格 ===== */
.grid {
  display: grid;
  gap: 24px;
}

.grid-4 {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

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

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  background: var(--gradient-accent);
  color: #ffffff !important;
  padding: 14px 32px;
  border-radius: 50px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
  text-decoration: none !important;
  font-size: 0.95rem;
}

.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 ease;
}

.btn:hover {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
  text-decoration: none !important;
  color: #fff !important;
}

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

.btn:active {
  transform: scale(0.98);
}

.btn-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ===== 元数据 ===== */
.meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(45, 45, 85, 0.4);
}

.highlight {
  color: var(--accent-light);
  font-weight: 600;
}

/* ===== 侧边栏 ===== */
.sidebar-card {
  background: rgba(20, 20, 46, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: all 0.3s ease;
}

.sidebar-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: var(--shadow-hover);
}

.sidebar-card h3 {
  color: #f0f0ff;
  margin-bottom: 15px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-card ul {
  list-style: none;
}

.sidebar-card li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(45, 45, 85, 0.5);
  color: var(--text-secondary);
  transition: all 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-card li:last-child {
  border-bottom: none;
}

.sidebar-card li:hover {
  color: var(--accent-light);
  padding-left: 8px;
}

.sidebar-card li::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 10px;
  opacity: 0.6;
  transition: all 0.3s ease;
}

.sidebar-card li:hover::before {
  opacity: 1;
  transform: scale(1.3);
}

/* ===== 评论 ===== */
.comment-item {
  background: rgba(26, 26, 53, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.comment-item:hover {
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateX(4px);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.15);
}

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

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

.comment-item p {
  margin-top: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ===== 页脚 ===== */
footer {
  background: rgba(10, 10, 24, 0.95);
  padding: 50px 0;
  margin-top: 60px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  position: relative;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

footer a {
  color: var(--accent-light);
  transition: all 0.3s ease;
}

footer a:hover {
  color: var(--accent-lighter);
  text-decoration: underline;
}

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

.footer-links a {
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: rgba(139, 92, 246, 0.05);
  border: 1px solid transparent;
}

.footer-links a:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
}

/* ===== 图片 ===== */
img {
  border-radius: var(--radius-sm);
  max-width: 100%;
  height: auto;
  background: #2d2d55;
  display: block;
}

.img-placeholder {
  background: linear-gradient(145deg, #1c1c3a, #181835);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  min-height: 200px;
}

/* ===== Logo ===== */
.logo {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 700;
  color: #f0f0ff;
  background: linear-gradient(135deg, #f0f0ff, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all 0.3s ease;
  cursor: pointer;
}

.logo:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.4));
}

/* ===== 导航栏 ===== */
nav {
  background: var(--bg-nav);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(45, 45, 85, 0.3);
  transition: all 0.3s ease;
}

nav::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.5), transparent);
}

nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}

nav ul {
  display: flex;
  gap: 28px;
  list-style: none;
  flex-wrap: wrap;
}

nav a {
  color: var(--text-secondary);
  font-weight: 500;
  position: relative;
  padding: 5px 0;
  transition: all 0.3s ease;
}

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

nav a:hover {
  color: var(--accent-light);
  text-decoration: none;
}

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

nav a.active {
  color: var(--accent);
}

nav a.active::after {
  width: 100%;
}

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

aside {
  padding: 20px 0;
}

/* ===== 区块动画 ===== */
section {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.6s ease forwards;
}

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

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

/* ===== 文章块 ===== */
article {
  background: rgba(22, 22, 48, 0.9);
  padding: 30px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: all 0.3s ease;
}

article:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: var(--shadow-hover);
}

article p {
  margin-bottom: 15px;
  color: var(--text-primary);
  line-height: 1.8;
}

/* ===== 精选区块 ===== */
#recommend .card {
  display: flex;
  flex-direction: column;
}

#recommend .card img {
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

#recommend .card p {
  flex: 1;
}

/* ===== 下载区块 ===== */
#download > div {
  text-align: center;
  background: rgba(26, 26, 53, 0.85);
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  border: 1px solid var(--border-color);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  position: relative;
  overflow: hidden;
}

#download > div::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(139, 92, 246, 0.1), transparent 50%);
  animation: rotate 20s linear infinite;
}

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

#download .btn-group {
  justify-content: center;
  position: relative;
  z-index: 1;
}

/* ===== 平台介绍 ===== */
#platform > div {
  background: rgba(20, 20, 46, 0.85);
  padding: 30px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: all 0.3s ease;
}

#platform > div:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: var(--shadow-hover);
}

#platform ul {
  margin-left: 20px;
  color: var(--text-primary);
  list-style: none;
}

#platform ul li {
  padding: 8px 0;
  position: relative;
  padding-left: 30px;
  transition: all 0.3s ease;
}

#platform ul li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 1.1em;
  opacity: 0.8;
}

#platform ul li:hover {
  padding-left: 35px;
  color: var(--accent-light);
}

/* ===== 角色卡片 ===== */
#characters .card {
  text-align: center;
}

#characters .card img {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 15px;
  border: 3px solid var(--accent);
  transition: all 0.3s ease;
}

#characters .card:hover img {
  transform: scale(1.05);
  border-color: var(--accent-light);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
}

#characters .card p {
  font-size: 0.9rem;
}

/* ===== 侧边栏布局 ===== */
aside.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

/* ===== 响应式布局 ===== */
@media (max-width: 1200px) {
  .container {
    padding: 0 15px;
  }
  
  .grid-4 {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 992px) {
  .grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  body {
    font-size: 15px;
  }
  
  .container {
    padding: 0 12px;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.5rem;
    padding-left: 12px;
  }
  
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  nav ul {
    gap: 12px;
    width: 100%;
    justify-content: center;
    padding: 10px 0;
  }
  
  nav .container {
    flex-direction: column;
    text-align: center;
  }
  
  .logo {
    margin-bottom: 10px;
  }
  
  .btn {
    padding: 12px 24px;
    font-size: 0.9rem;
  }
  
  .btn-group {
    gap: 10px;
  }
  
  .card {
    padding: 15px;
  }
  
  .comment-item {
    padding: 14px;
  }
  
  article, #platform > div, #download > div {
    padding: 20px;
  }
  
  .footer-links {
    gap: 10px;
  }
  
  .footer-links a {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
  
  aside.container {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  #characters .card img {
    width: 140px;
    height: 140px;
  }
}

@media (max-width: 480px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .card {
    padding: 12px;
  }
  
  .card h3 {
    font-size: 1rem;
  }
  
  .card p {
    font-size: 0.8rem;
  }
  
  .meta {
    font-size: 0.75rem;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.3rem;
  }
  
  nav ul {
    gap: 8px;
    font-size: 0.85rem;
  }
  
  .btn {
    padding: 10px 20px;
    font-size: 0.85rem;
  }
  
  .comment-time {
    display: block;
    margin-left: 0;
    margin-top: 4px;
  }
  
  .footer-links {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* ===== 暗色模式增强 ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0a0a18;
    --bg-secondary: #14142a;
    --bg-card: rgba(20, 20, 42, 0.9);
    --text-primary: #e0e0f0;
    --text-secondary: #b0b0d0;
  }
}

/* ===== 动画效果 ===== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

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

/* ===== 工具类 ===== */
.text-center {
  text-align: center;
}

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

/* ===== 卡片图片占位优化 ===== */
.card img[alt*="封面"] {
  aspect-ratio: 220/310;
  object-fit: cover;
}

.card img[alt*="角色"] {
  aspect-ratio: 1/1;
  object-fit: cover;
}

/* ===== 阅读统计卡片 ===== */
.sidebar-card ul li {
  font-size: 0.9rem;
}

.sidebar-card ul li:hover {
  transform: translateX(4px);
}

/* ===== 精选推荐卡片增强 ===== */
#recommend .card {
  position: relative;
}

#recommend .card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-accent);
  border-radius: 0 0 16px 16px;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

#recommend .card:hover::after {
  transform: scaleX(1);
}

/* ===== 评论区域增强 ===== */
#reviews .comment-item {
  position: relative;
  overflow: hidden;
}

#reviews .comment-item::before {
  content: '"';
  position: absolute;
  top: -10px;
  right: 10px;
  font-size: 4rem;
  color: rgba(139, 92, 246, 0.1);
  font-family: serif;
  line-height: 1;
}

/* ===== 下载区域按钮 ===== */
#download .btn-group .btn:nth-child(2) {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent-light) !important;
}

#download .btn-group .btn:nth-child(2):hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--accent-light);
}

#download .btn-group .btn:nth-child(3) {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

#download .btn-group .btn:nth-child(3):hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

/* ===== 导航栏滚动效果 ===== */
nav.scrolled {
  background: rgba(13, 13, 32, 0.98);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ===== 卡片加载动画 ===== */
.card {
  position: relative;
}

.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover::after {
  opacity: 1;
}

/* ===== 图片懒加载占位 ===== */
img[data-src] {
  background: linear-gradient(135deg, #1c1c3a, #181835);
  animation: shimmer 2s infinite;
  background-size: 1000px 100%;
}

/* ===== 保证可访问性 ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}