/* 全局样式 */
:root {
  --primary: #165dff;
}

body {
  font-family: "Inter", sans-serif;
}

a {
  text-decoration: none;
}

/* 导航栏滚动效果 */
#navbar.scroll {
  background-color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  padding-top: 1rem;
  padding-bottom: 1rem;
}

/* 轮播图 */
.carousel-item.active {
  opacity: 1;
  z-index: 1;
}

/* 移动端菜单 */
#mobileMenu.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* 漫画卡片悬停效果 */
.comic-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* 分类卡片悬停效果 */
.category-card:hover .category-image {
  transform: scale(1.05);
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

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

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Line clamp 样式 */
.line-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.line-clamp-3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* 自定义动画 */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.animate-shimmer {
  animation: shimmer 2s linear infinite;
}

/* 响应式阴影 */
.shadow-3xl {
  box-shadow: 0 35px 60px -12px rgba(0, 0, 0, 0.25);
}

/* 自定义圆角 */
.rounded-4xl {
  border-radius: 2rem;
}

.rounded-5xl {
  border-radius: 2.5rem;
}

/* 自定义边框 */
.border-3 {
  border-width: 3px;
}

/* 移动端优化样式 */
@media (max-width: 768px) {
  /* 触摸设备优化 */
  .touch-card {
    min-height: 44px; /* 苹果推荐的最小触摸目标 */
    transition: all 0.2s ease-in-out;
  }
  
  .touch-card:active {
    transform: scale(0.98);
    opacity: 0.8;
  }
  
  /* 移动端文本优化 */
  .mobile-title {
    font-size: 1.75rem;
    line-height: 2rem;
  }
  
  .mobile-subtitle {
    font-size: 1rem;
    line-height: 1.5rem;
  }
  
  /* 移动端间距优化 */
  .mobile-padding {
    padding: 1rem;
  }
  
  .mobile-margin {
    margin: 0.5rem 0;
  }
  
  /* 移动端按钮优化 */
  .mobile-button {
    min-height: 48px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
  }
  
  /* 移动端搜索框优化 */
  .mobile-search {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    font-size: 16px; /* 防止iOS自动缩放 */
  }
  
  /* 移动端网格优化 */
  .mobile-grid-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .mobile-grid-1 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  /* 移动端轮播图优化 */
  .mobile-hero {
    padding: 2rem 1rem;
    text-align: center;
  }
  
  .mobile-hero h1 {
    font-size: 2rem;
    line-height: 2.5rem;
    margin-bottom: 1rem;
  }
  
  .mobile-hero p {
    font-size: 1rem;
    line-height: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  /* 移动端导航优化 */
  .mobile-nav {
    padding: 0.5rem 1rem;
  }
  
  .mobile-nav-item {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-bottom: 1px solid #f3f4f6;
  }
  
  .mobile-nav-item:last-child {
    border-bottom: none;
  }
  
  /* 移动端排行榜优化 */
  .mobile-ranking {
    flex-direction: column;
    gap: 1rem;
  }
  
  .mobile-ranking-item {
    padding: 1rem;
    margin-bottom: 0.5rem;
  }
  
  /* 移动端底部导航 */
  .mobile-footer {
    padding: 2rem 1rem 1rem 1rem;
  }
  
  .mobile-footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  
  /* 移动端模态框优化 */
  .mobile-modal {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
    padding: 1.5rem;
  }
  
  /* 移动端回到顶部按钮 */
  .mobile-back-to-top {
    bottom: 5rem;
    right: 1rem;
    width: 48px;
    height: 48px;
  }
}

/* 超小屏幕优化 (小于375px) */
@media (max-width: 375px) {
  .xs-padding {
    padding: 0.75rem;
  }
  
  .xs-text {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }
  
  .xs-title {
    font-size: 1.5rem;
    line-height: 2rem;
  }
  
  .xs-button {
    padding: 10px 20px;
    font-size: 0.875rem;
  }
  
  .xs-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  /* 超小屏幕轮播图 */
  .xs-hero {
    padding: 1.5rem 0.75rem;
  }
  
  .xs-hero h1 {
    font-size: 1.75rem;
    line-height: 2rem;
  }
  
  .xs-hero p {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }
}

/* 横屏模式优化 */
@media (max-height: 600px) and (orientation: landscape) {
  .landscape-nav {
    height: 3rem;
  }
  
  .landscape-hero {
    padding: 1rem 0;
  }
  
  .landscape-hero h1 {
    font-size: 1.5rem;
    line-height: 2rem;
  }
  
  .landscape-section {
    padding: 2rem 0;
  }
}

/* 触摸设备全局优化 */
@media (hover: none) and (pointer: coarse) {
  /* 移除悬停效果，使用点击效果 */
  .hover\:shadow-lg:hover {
    box-shadow: inherit;
  }
  
  .hover\:scale-105:hover {
    transform: inherit;
  }
  
  /* 为触摸设备添加点击效果 */
  .touch-feedback:active {
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(0.98);
  }
  
  /* 增加可点击区域 */
  .touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* 确保在高分辨率屏幕上文本清晰 */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  /* 高清图标和按钮 */
  .hd-icon {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  /* 可以在这里添加暗色模式样式 */
  .auto-dark {
    background-color: #1f2937;
    color: #f9fafb;
  }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 打印样式 */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: black;
    background: white;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
}