:root {
  --bg-start: #7c3aed;
  --bg-end: #2563eb;
  --bg-glow: rgba(167, 139, 250, 0.35);
  --panel: rgba(255, 255, 255, 0.92);
  --panel-dark: rgba(30, 41, 59, 0.85);
  --text: #1f2937;
  --text-light: #6b7280;
  --accent: #7c3aed;
  --accent-2: #2563eb;
  --shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.25);
  --radius: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.35), transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.25), transparent),
    radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.3), transparent),
    radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 230px 80px, rgba(255,255,255,0.25), transparent),
    radial-gradient(2px 2px at 300px 150px, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 350px 50px, rgba(255,255,255,0.2), transparent);
  background-repeat: repeat;
  background-size: 400px 200px;
  opacity: 0.8;
  animation: drift 60s linear infinite;
}

@keyframes drift {
  from { background-position: 0 0; }
  to { background-position: -400px -200px; }
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.hero {
  text-align: center;
  color: #fff;
}

.logo-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  margin-bottom: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15), var(--shadow), 0 0 80px var(--bg-glow);
  animation: float 6s ease-in-out infinite;
}

.logo-ring img {
  width: 140px;
  height: 140px;
  border-radius: 28px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.2);
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.hero h1 {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 16px rgba(0,0,0,0.2);
}

.tagline {
  margin-top: 10px;
  font-size: clamp(1rem, 3.8vw, 1.2rem);
  opacity: 0.92;
  font-weight: 400;
}

.apps {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--panel);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  will-change: transform;
}

.app-card:hover,
.app-card:focus-visible {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 28px 56px -16px rgba(0, 0, 0, 0.28);
  background: #fff;
  outline: none;
}

.app-card:active {
  transform: translateY(0) scale(0.99);
}

.app-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  color: var(--accent);
}

.app-icon.cosmic {
  color: var(--accent-2);
}

.app-icon.rts {
  color: #f59e0b;
}

.app-icon.kite {
  color: #22d3ee;
}

.app-info {
  flex: 1 1 auto;
  min-width: 0;
}

.app-info h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.app-info p {
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.55;
  margin-bottom: 10px;
}

.app-go {
  display: inline-block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  transition: transform 0.2s ease;
}

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

.soon {
  text-align: center;
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  padding: 12px;
}

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 28px 20px 40px;
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
}

@media (max-width: 520px) {
  .wrap {
    padding: 36px 16px 64px;
  }
  .logo-ring {
    width: 150px;
    height: 150px;
  }
  .logo-ring img {
    width: 110px;
    height: 110px;
  }
  .app-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
  }
  .app-icon {
    width: 64px;
    height: 64px;
  }
  .app-icon svg {
    width: 36px;
    height: 36px;
  }
}

/* ---------------- 顶部账户栏 ---------------- */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 20px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  text-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

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

.btn-account {
  border: none;
  cursor: pointer;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.18);
  transition: background 0.2s ease, transform 0.2s ease;
}
.btn-account:hover {
  background: rgba(255,255,255,0.28);
}
.btn-account:active {
  transform: scale(0.97);
}

.account-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 0.9rem;
}
.account-user .uname {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 8px rgba(0,0,0,0.3);
}
.account-user .btn-logout {
  border: none;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  color: #fff;
  background: rgba(0,0,0,0.18);
}
.account-user .btn-logout:hover { background: rgba(0,0,0,0.3); }

/* ---------------- 登录/注册 弹窗 ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 12, 35, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-mask[hidden] { display: none; }

.modal {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 22px;
  padding: 28px 24px 22px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.5);
  animation: pop 0.22s ease;
}
@keyframes pop {
  from { transform: translateY(12px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
}
.modal-close:hover { color: #4b5563; }

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}
.tabs .tab {
  flex: 1;
  border: none;
  cursor: pointer;
  padding: 10px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  transition: all 0.2s ease;
}
.tabs .tab.active {
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-form.hidden { display: none; }
.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.auth-form input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.btn-primary {
  border: none;
  cursor: pointer;
  padding: 12px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.btn-primary:hover { box-shadow: 0 10px 24px -8px rgba(124,58,237,0.6); }
.btn-primary:active { transform: scale(0.98); }

.auth-msg {
  min-height: 1.2em;
  margin: 12px 0 0;
  font-size: 0.88rem;
  color: #dc2626;
  text-align: center;
}
.auth-hint {
  margin: 12px 0 0;
  font-size: 0.78rem;
  color: #9ca3af;
  text-align: center;
  line-height: 1.5;
}

/* 卡片在未登录时需要登录的提示态 */
.app-card.locked {
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .stars, .logo-ring, .modal {
    animation: none;
  }
}
