:root {
  --accent: #ff4d4f;
  --accent-dark: #e83e40;
  --ink: #172033;
  --muted: #718096;
  --line: #e7eaf0;
  --surface: rgba(255, 255, 255, 0.92);
  --soft: #f4f6f9;
  --success: #0f9f6e;
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 77, 79, 0.14), transparent 32rem),
    radial-gradient(circle at 92% 12%, rgba(45, 172, 255, 0.12), transparent 30rem),
    #eef2f7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang HK", "Noto Sans TC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, a { -webkit-tap-highlight-color: transparent; }

.auth-gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px;
  text-align: center;
}

.auth-gate img { width: 104px; height: 104px; object-fit: contain; }
.auth-gate p { margin: 0; color: var(--muted); font-size: 15px; font-weight: 700; }

.auth-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 77, 79, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.download-page {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 0 max(34px, env(safe-area-inset-bottom));
}

.download-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.back-link,
.language-button,
.login-chip {
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.back-link {
  gap: 8px;
  padding: 0 17px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 26px rgba(48, 62, 88, 0.08);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.back-link svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; }

.header-actions { display: flex; align-items: center; gap: 10px; }

.login-chip {
  gap: 8px;
  padding: 0 15px;
  color: #087854;
  background: #e8f8f1;
  border: 1px solid #c7eddf;
  font-size: 13px;
  font-weight: 800;
}

.login-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

.language-button {
  min-width: 52px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 26px rgba(48, 62, 88, 0.08);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.hero,
.download-section,
.help-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(45, 58, 87, 0.1);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.hero {
  min-height: 220px;
  display: flex;
  align-items: center;
  gap: clamp(24px, 5vw, 60px);
  padding: clamp(28px, 5vw, 58px);
  border-radius: 30px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  width: 310px;
  height: 310px;
  position: absolute;
  right: -105px;
  bottom: -185px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 77, 79, 0.16), rgba(255, 170, 80, 0.08));
}

.hero-logo { width: clamp(108px, 15vw, 160px); height: auto; flex: 0 0 auto; }
.hero-copy { position: relative; z-index: 1; }
.eyebrow, .section-kicker { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: 0.16em; }
.hero h1 { margin: 0; font-size: clamp(34px, 6vw, 62px); line-height: 1.05; letter-spacing: -0.045em; }
.hero-description { max-width: 590px; margin: 16px 0 0; color: var(--muted); font-size: clamp(16px, 2vw, 20px); line-height: 1.6; }
.signed-in-as { margin: 12px 0 0; color: #4a5568; font-size: 13px; font-weight: 700; }

.download-section { margin-top: 22px; padding: clamp(24px, 4vw, 44px); border-radius: 30px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-heading h2 { margin: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.025em; }
.updated-at { color: var(--muted); font-size: 12px; font-weight: 700; text-align: right; }

.download-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }

.download-card {
  display: flex;
  flex-direction: column;
  min-height: 330px;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  position: relative;
  overflow: hidden;
}

.download-card::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -70px;
  top: -70px;
  border-radius: 50%;
  background: var(--card-glow, rgba(255, 77, 79, 0.08));
}

.card-top { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.platform-icon { width: 64px; height: 64px; border-radius: 19px; display: flex; align-items: center; justify-content: center; background: var(--icon-bg, #fff0f0); color: var(--icon-color, var(--accent)); }
.platform-icon svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card-title { min-width: 0; }
.card-title h3 { margin: 0; font-size: 23px; letter-spacing: -0.02em; }
.version-row { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.version-badge { padding: 5px 9px; border-radius: 999px; background: var(--soft); color: #566176; font-size: 12px; font-weight: 800; }
.latest-badge { color: #087854; background: #e8f8f1; }
.card-description { margin: 22px 0 14px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.file-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; margin: auto 0 18px; color: #7b8495; font-size: 12px; font-weight: 700; }
.file-meta span { display: inline-flex; align-items: center; gap: 6px; }
.file-meta svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.download-button {
  width: 100%;
  height: 48px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 12px 28px rgba(255, 77, 79, 0.22);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  transition: transform 0.16s ease, background 0.16s ease;
}

.download-button:hover { color: #fff; background: var(--accent-dark); transform: translateY(-1px); }
.download-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

.download-error { padding: 28px; border: 1px solid #ffd5d5; border-radius: 20px; color: #a72828; background: #fff5f5; text-align: center; }
.download-error strong { display: block; margin-bottom: 12px; }
.download-error button { height: 44px; padding: 0 22px; border: 0; border-radius: 999px; color: #fff; background: var(--accent); font-size: 14px; font-weight: 700; cursor: pointer; }

.help-card { display: flex; align-items: flex-start; gap: 16px; margin-top: 22px; padding: 24px 28px; border-radius: 24px; }
.help-icon { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #3762d0; background: #edf3ff; }
.help-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.help-card strong { font-size: 16px; }
.help-card p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; padding: 25px 12px 0; color: #7d8798; font-size: 12px; font-weight: 700; }
footer strong { color: var(--ink); }

@media (max-width: 720px) {
  .download-page { width: min(100% - 24px, 1180px); padding-top: max(14px, env(safe-area-inset-top)); }
  .download-header { margin-bottom: 14px; }
  .login-chip { display: none; }
  .hero { min-height: 0; align-items: flex-start; border-radius: 24px; padding: 26px 22px; }
  .hero-logo { width: 88px; }
  .hero h1 { font-size: 34px; }
  .hero-description { margin-top: 11px; font-size: 15px; }
  .download-section { margin-top: 14px; padding: 22px 16px; border-radius: 24px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .updated-at { text-align: left; }
  .download-grid { grid-template-columns: 1fr; }
  .download-card { min-height: 305px; padding: 21px; }
  .help-card { margin-top: 14px; padding: 20px; }
}

@media (max-width: 460px) {
  .back-link { padding: 0 14px; }
  .hero { gap: 17px; }
  .hero-logo { width: 72px; }
  .eyebrow { display: none; }
  .hero h1 { font-size: 29px; }
  .signed-in-as { display: none; }
  .footer-separator { display: none; }
  footer { flex-direction: column; align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-spinner { animation-duration: 1.8s; }
  .download-button { transition: none; }
}
