/* ===== CSS Variables ===== */
:root {
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary-color: #64748b;
  --accent-color: #3b82f6;
  --background: #ffffff;
  --background-alt: #f8fafc;
  --surface: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  --max-width: 1200px;
  --header-height: 4rem;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
  --background: #0f172a;
  --background-alt: #1e293b;
  --surface: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

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

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

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

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

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

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  backdrop-filter: blur(8px);
  background: rgba(var(--surface), 0.8);
}

[data-theme="dark"] .header {
  background: rgba(30, 41, 59, 0.8);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo:hover {
  color: var(--primary-color);
}

.logo-icon {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
}

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

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width var(--transition-fast);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* ===== Language & Theme Switcher ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle,
.lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  background: var(--background-alt);
}

.theme-toggle:hover,
.lang-toggle:hover {
  color: var(--text-primary);
  background: var(--border-color);
}

.theme-toggle svg,
.lang-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.lang-toggle {
  font-weight: 600;
  font-size: 0.875rem;
}

/* ===== Mobile Menu ===== */
.mobile-menu-btn {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.mobile-menu-btn svg {
  width: 1.5rem;
  height: 1.5rem;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .nav-links.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--surface);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
  }
}

/* ===== Hero Section ===== */
.hero {
  padding: calc(var(--header-height) + 4rem) 0 4rem;
  text-align: center;
  background: linear-gradient(to bottom, var(--background-alt), var(--background));
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

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

.btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* ===== Apps Grid ===== */
.apps-section {
  padding: 4rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-secondary);
}

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

/* ===== App Card ===== */
.app-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.app-card-icon-wrapper {
  padding: 1.5rem 1.5rem 0;
  text-align: center;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
}

.app-card-icon-large {
  width: 7rem;
  height: 7rem;
  border-radius: var(--radius-xl);
  object-fit: contain;
  transition: all var(--transition-fast);
  /* Ensure consistent appearance regardless of original image size */
  max-width: 100%;
  max-height: 100%;
  /* Force same visual size by using fixed dimensions */
  width: 7rem !important;
  height: 7rem !important;
  /* Remove any background or shadow */
  background: transparent !important;
  box-shadow: none !important;
}

.app-card:hover .app-card-icon-large {
  transform: translateY(-4px);
}

.app-card-icon-large {
  width: 7rem;
  height: 7rem;
  border-radius: var(--radius-xl);
  object-fit: contain;
  transition: all var(--transition-fast);
  /* Ensure consistent appearance regardless of original image size */
  max-width: 100%;
  max-height: 100%;
  /* Force same visual size by using fixed dimensions */
  width: 7rem !important;
  height: 7rem !important;
}

.app-card:hover .app-card-icon-large {
  transform: translateY(-4px);
}

.app-card-icon-large {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-lg);
  object-fit: contain;
  background: var(--background-alt);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  /* Ensure consistent appearance regardless of original image size */
  max-width: 100%;
  max-height: 100%;
}

.app-card:hover .app-card-icon-large {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.app-card-content {
  padding: 0 1.5rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-card-header {
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.app-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.app-card-category {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.25rem;
}

.app-card-description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.7;
  flex: 1;
}

.app-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.app-card-category {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.app-card-description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.app-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--primary-color);
}

.app-card-link svg {
  width: 1rem;
  height: 1rem;
  transition: transform var(--transition-fast);
}

.app-card-link:hover svg {
  transform: translateX(4px);
}

/* ===== Footer ===== */
.footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border-color);
  background: var(--background-alt);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-link {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-link:hover {
  color: var(--text-primary);
}

/* ===== Legal Pages ===== */
.legal-page {
  padding-top: calc(var(--header-height) + 2rem);
  padding-bottom: 4rem;
}

.legal-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.legal-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.legal-subtitle {
  color: var(--text-secondary);
}

.legal-content {
  max-width: 800px;
  margin: 0 auto;
}

.legal-content h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.legal-content h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.legal-content p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.legal-content ul {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.legal-content li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  line-height: 1.7;
  list-style: disc;
}

.legal-content strong {
  color: var(--text-primary);
}

.legal-updated {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

/* ===== App Detail Page ===== */
.app-detail {
  padding-top: var(--header-height);
}

.app-hero {
  padding: 4rem 0;
  background: linear-gradient(to bottom, var(--background-alt), var(--background));
}

.app-hero-content {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 4rem;
  align-items: center;
}

@media (max-width: 768px) {
  .app-hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.app-hero-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.app-detail-icon {
  width: 6rem;
  height: 6rem;
  border-radius: var(--radius-xl);
  object-fit: cover;
  box-shadow: var(--shadow-lg);
}

.app-detail-title {
  font-size: 2.5rem;
  font-weight: 800;
}

.app-detail-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--primary-color);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  width: fit-content;
}

@media (max-width: 768px) {
  .app-detail-category {
    margin: 0 auto;
  }
}

.app-detail-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.app-hero-screenshot {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--background-alt);
}

.app-hero-screenshot img {
  width: 100%;
  height: auto;
}

.app-features {
  padding: 4rem 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition-fast);
}

.feature-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.feature-icon svg {
  width: 1.5rem;
  height: 1.5rem;
  color: white;
}

.feature-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature-description {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.app-actions {
  padding: 4rem 0;
  background: var(--background-alt);
  text-align: center;
}

.app-actions-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.download-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.legal-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 2rem;
}

.legal-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.legal-links a:hover {
  color: var(--primary-color);
}

/* ===== Utilities ===== */
.text-center {
  text-align: center;
}

.mt-4 {
  margin-top: 2rem;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeIn 0.6s ease forwards;
}

.animate-delay-1 {
  animation-delay: 0.1s;
}

.animate-delay-2 {
  animation-delay: 0.2s;
}

.animate-delay-3 {
  animation-delay: 0.3s;
}

/* ===== App Store Download Section ===== */
.download-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.app-actions .download-buttons {
  margin-top: 2rem;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 1.5rem;
}

.app-store-badge {
  height: auto;
  max-height: 82px;
  width: auto;
  transition: transform var(--transition-fast);
}

.app-store-badge:hover {
  transform: translateY(-1px);
}

[data-theme="dark"] .app-store-badge {
  /* 在深色模式下可能需要调整图片颜色 */
  filter: brightness(1.1);
}

.download-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: 180px;
}

.download-qr-img {
  width: 140px;
  height: auto;
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .download-qr-img {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.download-qr-caption {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-secondary);
  max-width: 14rem;
}

@media (max-width: 640px) {
  .download-buttons {
    gap: 0.5rem;
  }

  .app-actions .download-buttons {
    margin-top: 1.5rem;
    gap: 1.25rem;
  }

  .app-store-badge {
    max-height: 60px;
  }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }

  .hero {
    padding: calc(var(--header-height) + 2rem) 0 2rem;
  }

  .apps-section,
  .app-features,
  .app-actions {
    padding: 2rem 0;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .legal-title {
    font-size: 1.75rem;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .app-store-btn {
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }

  .app-store-icon {
    height: 1.25rem;
  }

  .app-store-name {
    font-size: 1rem;
  }
}
