/* ============================================
   AI 桌宠下载站 — 全局样式
   ============================================ */

/* --- CSS 变量（暗色主题） --- */
:root {
  --bg-primary: #0f0f14;
  --bg-secondary: #1a1a24;
  --bg-card: #1e1e2e;
  --bg-hover: #282840;
  --bg-elevated: #252538;
  --text-primary: #e8e8f0;
  --text-secondary: #9898b0;
  --text-muted: #686880;
  --accent: #7c6ff0;
  --accent-hover: #6a5cd8;
  --accent-glow: rgba(124, 111, 240, 0.25);
  --accent-gradient: linear-gradient(135deg, #7c6ff0, #b96cf0);
  --green: #4ade80;
  --yellow: #fbbf24;
  --orange: #fb923c;
  --red: #f87171;
  --border: #2a2a3e;
  --border-hover: #3a3a54;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px var(--accent-glow);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --header-height: 64px;
  --max-width: 1200px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

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

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

ul { list-style: none; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* --- Header / Navigation --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(15, 15, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

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

.nav a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav a:hover,
.nav a.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

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

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Layout --- */
.page {
  padding-top: var(--header-height);
  min-height: 100vh;
}

.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* --- Hero Section (首页) --- */
.hero {
  background: linear-gradient(180deg, #1a1a30 0%, var(--bg-primary) 100%);
  border-bottom: 1px solid var(--border);
  padding: 80px 24px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(124, 111, 240, 0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 50%, rgba(185, 108, 240, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero-inner {
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}

.hero h1 {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  margin-top: 48px;
}

.hero-stat {
  text-align: center;
}

.hero-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}

.hero-stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Pet Cards --- */
.pet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.pet-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.25s;
  cursor: pointer;
}

.pet-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.pet-card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
}

.pet-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pet-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-hot {
  background: var(--orange);
  color: #fff;
}

.badge-new {
  background: var(--green);
  color: #000;
}

.badge-ai {
  background: var(--accent-gradient);
  color: #fff;
}

.pet-card-body {
  padding: 16px;
}

.pet-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pet-card-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.pet-card-rating {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  color: var(--yellow);
  font-weight: 600;
  white-space: nowrap;
}

.pet-card-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.pet-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.pet-tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.pet-tag-ai { border-color: rgba(124, 111, 240, 0.3); color: #b096f0; }
.pet-tag-hot { border-color: rgba(251, 146, 60, 0.3); color: var(--orange); }

.pet-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.pet-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.pet-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --- Featured Slider --- */
.featured-section {
  padding-top: 20px;
}

.featured-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.featured-scroll::-webkit-scrollbar { height: 4px; }
.featured-scroll::-webkit-scrollbar-thumb { border-radius: 2px; }

.featured-card {
  flex: 0 0 360px;
  scroll-snap-align: start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.25s;
  cursor: pointer;
}

.featured-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.featured-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
}

.featured-card-body {
  padding: 16px;
}

.featured-card-name {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.featured-card-summary {
  font-size: 13px;
  color: var(--text-secondary);
}

/* --- Market Page --- */
.market-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--accent);
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
}

/* --- Detail Page --- */
.detail-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
}

.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.detail-breadcrumb a {
  color: var(--text-secondary);
}

.detail-breadcrumb a:hover {
  color: var(--accent);
}

.detail-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}

.detail-gallery {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  color: var(--text-muted);
}

.detail-info {
  display: flex;
  flex-direction: column;
}

.detail-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 4px;
}

.detail-author {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.detail-description {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.detail-platforms {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.platform-tag {
  padding: 4px 12px;
  border-radius: 4px;
  background: var(--bg-elevated);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
}

.detail-actions .btn {
  flex: 1;
  justify-content: center;
  font-size: 16px;
  padding: 14px 24px;
}

/* --- Categories (首页) --- */
.categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.category-card {
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

.category-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.category-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.category-name {
  font-size: 14px;
  font-weight: 600;
}

.category-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  margin-top: 60px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-text {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--text-secondary);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 15px;
  color: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero h1 { font-size: 30px; }
  .hero p { font-size: 16px; }
  .hero-stats { gap: 24px; }
  .hero-stat-value { font-size: 22px; }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .featured-card {
    flex: 0 0 280px;
  }

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

  .nav a { padding: 8px 10px; font-size: 13px; }

  .market-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box { min-width: 0; }

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

@media (max-width: 480px) {
  .section { padding: 24px 16px; }
  .header-inner { padding: 0 16px; }
  .hero { padding: 60px 16px 40px; }
  .hero-stats { flex-direction: column; gap: 16px; }
  .detail-actions { flex-direction: column; }
}
