/* ============================================================
   APK 下载站点 - 样式表
   移动端优先 · 暗色渐变主题 · 卡片式布局
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
  --bg-primary: #0f0f1a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-card: rgba(255, 255, 255, 0.08);
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b8;
  --text-muted: #606078;
  --accent: #667eea;
  --accent2: #764ba2;
  --accent-glow: rgba(102, 126, 234, 0.3);
  --success: #34d399;
  --danger: #f87171;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 28px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-btn: 0 4px 20px rgba(102, 126, 234, 0.35);
  --font-sans: "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

/* ---------- 背景装饰 ---------- */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.bg-orb--1 {
  width: 320px;
  height: 320px;
  background: var(--accent);
  top: -60px;
  right: -80px;
  animation: orbFloat1 12s ease-in-out infinite;
}

.bg-orb--2 {
  width: 260px;
  height: 260px;
  background: var(--accent2);
  bottom: 20%;
  left: -100px;
  animation: orbFloat2 15s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-30px, 40px) scale(1.08); }
  66% { transform: translate(20px, -20px) scale(0.95); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, -30px) scale(1.12); }
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ---------- 主容器 ---------- */
.container {
  position: relative;
  z-index: 1;
  max-width: 500px;
  margin: 0 auto;
  padding: 30px 18px 60px;
}

/* ---------- App 品牌区域 ---------- */
.brand-section {
  text-align: center;
  padding: 20px 0 30px;
  animation: fadeInUp 0.6s ease-out;
}

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

.app-icon-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}

.app-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px var(--accent-glow);
  position: relative;
  z-index: 1;
  animation: iconPulse 3s ease-in-out infinite;
}

.app-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.app-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

@keyframes iconPulse {
  0%, 100% { box-shadow: 0 8px 32px var(--accent-glow); }
  50% { box-shadow: 0 8px 48px rgba(102, 126, 234, 0.45); }
}

.app-icon-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border-radius: 25px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  filter: blur(24px);
  opacity: 0.2;
  z-index: 0;
}

.app-name {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, #e0e0ff, #c0b0f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.app-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 320px;
  margin: 0 auto 16px;
  line-height: 1.5;
}

.brand-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.meta-item svg {
  flex-shrink: 0;
}

/* ---------- 下载卡片 ---------- */
.download-card {
  background: linear-gradient(145deg, rgba(30, 30, 60, 0.7), rgba(20, 20, 40, 0.9));
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  margin-bottom: 16px;
  position: relative;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  animation: fadeInUp 0.6s ease-out 0.15s both;
  transition: border-color var(--transition);
}

.download-card:hover {
  border-color: rgba(102, 126, 234, 0.25);
}

.card-badge {
  position: absolute;
  top: -1px;
  right: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 14px;
  border-radius: 0 0 10px 10px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
  padding-top: 4px;
}

.version-info {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.version-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.version-number {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #c0b0f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.version-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 文件元信息 */
.file-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.meta-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 12px;
  border-radius: 20px;
}

.meta-row svg {
  flex-shrink: 0;
  opacity: 0.6;
}

/* ---------- 下载按钮 ---------- */
.btn-download {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-btn);
  transition: all var(--transition);
  margin-bottom: 20px;
}

.btn-download::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.45);
}

.btn-download:hover::before {
  opacity: 1;
}

.btn-download:active {
  transform: translateY(0) scale(0.98);
}

.btn-download.downloading {
  background: linear-gradient(135deg, #4a5568, #2d3748);
  pointer-events: none;
  box-shadow: none;
}

.btn-download .btn-icon {
  display: flex;
  align-items: center;
}

.btn-download .btn-icon svg {
  transition: transform var(--transition);
}

.btn-download.downloading .btn-icon svg {
  animation: bounceDown 0.6s ease-in-out infinite;
}

@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ---------- 下载进度条 ---------- */
.download-progress {
  display: none;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease-out;
}

.download-progress.active {
  display: block;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width 0.3s ease-out;
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
}

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

.progress-percent {
  color: var(--accent);
  font-weight: 600;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- 更新日志 ---------- */
.changelog-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.changelog-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.changelog-list {
  list-style: none;
  padding: 0;
}

.changelog-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.changelog-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}

/* ---------- 历史版本区域 ---------- */
.history-section {
  margin-bottom: 40px;
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.history-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: linear-gradient(145deg, rgba(30, 30, 60, 0.5), rgba(20, 20, 40, 0.7));
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.history-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.toggle-icon {
  transition: transform 0.3s ease;
}

.toggle-icon.open {
  transform: rotate(180deg);
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, margin 0.3s ease;
}

.history-list.open {
  max-height: 2000px;
  margin-top: 12px;
}

/* 历史版本卡片 */
.history-item {
  background: linear-gradient(145deg, rgba(30, 30, 60, 0.5), rgba(20, 20, 40, 0.7));
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all var(--transition);
}

.history-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(102, 126, 234, 0.15);
}

.history-item-info {
  flex: 1;
  min-width: 0;
}

.history-item-version {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.history-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-download-sm {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(102, 126, 234, 0.15);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 25px;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-download-sm:hover {
  background: rgba(102, 126, 234, 0.25);
  border-color: var(--accent);
}

.btn-download-sm svg {
  width: 14px;
  height: 14px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  text-align: center;
  padding: 30px 0 10px;
  color: var(--text-muted);
  font-size: 0.78rem;
  animation: fadeInUp 0.6s ease-out 0.45s both;
}

.footer-sub {
  margin-top: 6px;
  font-size: 0.72rem;
  opacity: 0.5;
}

/* ---------- Toast 通知 ---------- */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: toastIn 0.35s ease-out, toastOut 0.35s ease-in 2.5s forwards;
  pointer-events: auto;
  text-align: center;
  white-space: nowrap;
}

.toast-success { background: rgba(52, 211, 153, 0.9); }
.toast-error { background: rgba(248, 113, 113, 0.9); }
.toast-info { background: rgba(102, 126, 234, 0.9); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ---------- 响应式 - 平板及以上 ---------- */
@media (min-width: 640px) {
  .container {
    padding: 50px 32px 80px;
  }

  .app-name {
    font-size: 2.2rem;
  }

  .version-number {
    font-size: 1.5rem;
  }

  .file-meta {
    gap: 12px;
  }

  .download-card {
    padding: 30px 28px;
  }

  .btn-download {
    padding: 18px 28px;
    font-size: 1.05rem;
  }
}

/* ---------- 响应式 - 桌面 ---------- */
@media (min-width: 1024px) {
  .container {
    max-width: 560px;
  }
}

/* ---------- 暗色滚动条 ---------- */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ---------- 选中文字颜色 ---------- */
::selection {
  background: rgba(102, 126, 234, 0.3);
  color: #fff;
}
