:root {
  --bg-main: #0a0d14;
  --bg-gradient: radial-gradient(circle at 50% 0%, #172033 0%, #0a0d14 75%);
  --card-bg: rgba(18, 24, 38, 0.72);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover-border: rgba(56, 189, 248, 0.35);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #38bdf8;
  --accent-indigo: #6366f1;
  --accent-green: #34d399;
  --accent-purple: #a855f7;
  --win-color: #38bdf8;
  --win-bg: rgba(56, 189, 248, 0.12);
  --android-color: #34d399;
  --android-bg: rgba(52, 211, 153, 0.12);
  --btn-primary: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  --btn-primary-hover: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
  --btn-android: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --btn-android-hover: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-main);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient glow balls in background */
.ambient-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
}
.glow-1 {
  top: -150px;
  left: 20%;
  background: #0284c7;
}
.glow-2 {
  top: 30%;
  right: -150px;
  background: #8b5cf6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* Header */
header {
  padding: 28px 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(2, 132, 199, 0.4);
}
.brand-icon svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}
.brand-text h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-text p {
  font-size: 13px;
  color: var(--text-muted);
}
.server-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: #34d399;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Hero Section */
.hero {
  padding: 48px 0 32px;
  text-align: center;
}
.hero h2 {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ffffff 30%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 28px;
}

/* Control Bar: Filters & Search */
.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 36px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
}
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}
.filter-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.filter-tab.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.search-box {
  position: relative;
  min-width: 240px;
}
.search-box input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus {
  border-color: var(--accent-blue);
}
.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  fill: var(--text-muted);
}

/* App Grid */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 28px;
  margin-bottom: 60px;
}

/* App Card */
.app-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.app-card:hover {
  transform: translateY(-4px);
  border-color: var(--card-hover-border);
  box-shadow: 0 16px 40px -12px rgba(2, 132, 199, 0.25);
}
.app-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.6), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.app-card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.app-logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-logo img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
}
.app-title-area {
  flex: 1;
  min-width: 0;
}
.app-name {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.app-tagline {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.card-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.6;
  min-height: 60px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tags */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.tag {
  font-size: 11px;
  padding: 2.5px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Platform Section Inside Card */
.platform-releases {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 16px;
}

/* In-Card Multi-Platform Switcher */
.card-plat-switcher {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.plat-switch-btn {
  flex: 1;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.plat-switch-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.plat-switch-btn.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.platform-block {
  background: rgba(10, 15, 26, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 14px 16px 16px;
  transition: border-color 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.platform-block:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.platform-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.platform-head-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2.5px 8px;
  border-radius: 6px;
}
.platform-badge.windows {
  background: var(--win-bg);
  color: var(--win-color);
  border: 1px solid rgba(56, 189, 248, 0.25);
}
.platform-badge.android {
  background: var(--android-bg);
  color: var(--android-color);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.version-badge {
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.5px 7px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.variant-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 1.5px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.variant-pill.portable {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.28);
}
.variant-pill.installer {
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.release-date {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Download Action Container */
.download-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Hero Download Button */
.btn-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 10px;
  text-decoration: none;
  color: #fff;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  text-align: left;
}
.btn-hero.windows {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
}
.btn-hero.windows:hover {
  background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
}
.btn-hero.android {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}
.btn-hero.android:hover {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}
.btn-hero-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}
.btn-hero-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.btn-hero-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
}
.btn-hero-sub {
  font-size: 11px;
  opacity: 0.88;
  margin-top: 2px;
  font-weight: 400;
}

.btn-hero-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-hero-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
}

/* Secondary Actions Toolbar */
.action-tools {
  display: flex;
  gap: 8px;
  width: 100%;
}
.btn-tool {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}
.btn-tool svg {
  width: 13.5px;
  height: 13.5px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Modals and Drawers */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 20px;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 30px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  position: relative;
}
.modal-backdrop.open .modal-card {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.qr-wrapper {
  background: #ffffff;
  padding: 16px;
  border-radius: 12px;
  display: inline-block;
  margin: 20px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.qr-wrapper canvas {
  display: block;
}

/* History Modal / Drawer */
.history-modal-card {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.modal-backdrop.open .history-modal-card {
  transform: translateY(0);
}
.history-header {
  margin-bottom: 20px;
  text-align: left;
}
.history-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.history-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.history-list {
  overflow-y: auto;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.history-list::-webkit-scrollbar {
  width: 6px;
}
.history-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.history-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  transition: all 0.2s;
}
.history-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
.history-info {
  flex: 1;
  min-width: 200px;
}
.history-ver {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.history-tag-latest {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  font-weight: 500;
}
.history-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.history-notes {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 8px;
  white-space: pre-wrap;
  font-family: var(--font-sans);
  line-height: 1.45;
  border-left: 2px solid var(--accent-blue);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Footer */
footer {
  padding: 40px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 12px;
}
.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-links a:hover {
  color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
  .hero h2 {
    font-size: 28px;
  }
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    width: 100%;
  }
}

/* Download count badge */
.download-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  white-space: nowrap;
}
