/* 全屏引导首页 */
html.home-page,
body.home-page {
  height: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

body.home-page {
  min-height: 100dvh;
  background: #070b16;
  color: #eef2ff;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui,
    -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.home-splash {
  position: relative;
  min-height: 100dvh;
  min-height: 100svh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  overflow: hidden;
  box-sizing: border-box;
}

/* 背景动效 */
.home-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(0, 160, 234, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 40%, rgba(217, 0, 17, 0.18), transparent 50%),
    radial-gradient(ellipse 60% 45% at 0% 80%, rgba(26, 61, 150, 0.35), transparent 50%),
    linear-gradient(165deg, #0a1224 0%, #0b1220 45%, #101828 100%);
}

.home-bg::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 204, 0, 0.06) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(0, 160, 234, 0.08) 0 1px, transparent 2px);
  background-size: 48px 48px, 36px 36px;
  opacity: 0.5;
  animation: home-drift 28s linear infinite;
}

.home-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.55;
  animation: home-float 10s ease-in-out infinite;
}

.home-orb-a {
  width: min(52vw, 280px);
  height: min(52vw, 280px);
  top: 8%;
  left: -8%;
  background: rgba(0, 160, 234, 0.35);
}

.home-orb-b {
  width: min(48vw, 260px);
  height: min(48vw, 260px);
  right: -10%;
  bottom: 18%;
  background: rgba(217, 0, 17, 0.28);
  animation-delay: -4s;
}

.home-orb-c {
  width: min(36vw, 180px);
  height: min(36vw, 180px);
  left: 40%;
  bottom: -6%;
  background: rgba(255, 204, 0, 0.12);
  animation-delay: -7s;
}

@keyframes home-float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(12px, -18px) scale(1.06);
  }
}

@keyframes home-drift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-48px);
  }
}

.home-inner {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.home-logo {
  width: 104px;
  height: 104px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  font-size: 40px;
  font-weight: 800;
  color: #fff;
  background: transparent;
  box-shadow:
    0 0 0 1px rgba(255, 204, 0, 0.12),
    0 18px 48px rgba(0, 0, 0, 0.45),
    0 0 40px rgba(255, 196, 40, 0.18);
  margin-bottom: 22px;
  animation: home-logo-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
  overflow: hidden;
}

.home-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

@keyframes home-logo-in {
  from {
    opacity: 0;
    transform: scale(0.7) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.home-title {
  margin: 0 0 36px;
  font-size: clamp(32px, 8vw, 40px);
  font-weight: 800;
  letter-spacing: 6px;
  line-height: 1.25;
  background: linear-gradient(180deg, #ffffff 20%, #c5d4f5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: home-fade-up 0.7s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.home-sub {
  margin: 0 0 36px;
  font-size: 15px;
  color: rgba(147, 160, 189, 0.95);
  letter-spacing: 0.4px;
  line-height: 1.6;
  animation: home-fade-up 0.7s 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.home-sub strong {
  color: #ffcc00;
  font-weight: 700;
}

.home-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: home-fade-up 0.75s 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes home-fade-up {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 16px 20px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
  position: relative;
  overflow: hidden;
}

.home-btn:active {
  transform: scale(0.98);
}

.home-btn .home-btn-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.home-btn-enter {
  color: #fff;
  background: linear-gradient(135deg, #1a8cff 0%, #0066d6 50%, #0a4fb5 100%);
  box-shadow:
    0 12px 32px rgba(0, 102, 214, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.home-btn-enter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.18) 50%,
    transparent 60%
  );
  transform: translateX(-120%);
  animation: home-shine 3.2s ease-in-out infinite;
}

@keyframes home-shine {
  0%,
  55% {
    transform: translateX(-120%);
  }
  75%,
  100% {
    transform: translateX(120%);
  }
}

.home-btn-enter:hover {
  filter: brightness(1.06);
}

.home-btn-fav {
  color: #1a1200;
  background: linear-gradient(135deg, #ffe082 0%, #ffcc00 45%, #f0a500 100%);
  box-shadow:
    0 12px 28px rgba(240, 165, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.home-btn-fav:hover {
  filter: brightness(1.04);
}

.home-btn-install {
  color: #eef2ff;
  background: linear-gradient(180deg, rgba(28, 39, 64, 0.95), rgba(18, 26, 43, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.home-btn-install:hover {
  border-color: rgba(0, 160, 234, 0.45);
  box-shadow: 0 10px 28px rgba(0, 160, 234, 0.18);
}

.home-btn-install.is-installed {
  opacity: 0.72;
  border-color: rgba(67, 160, 71, 0.45);
  color: #a5d6a7;
}

.home-foot {
  margin-top: 28px;
  font-size: 12px;
  color: rgba(147, 160, 189, 0.75);
  line-height: 1.5;
  animation: home-fade-up 0.7s 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.home-foot a {
  color: #00a0ea;
  text-decoration: none;
}

/* 收藏引导弹层 */
.home-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4, 8, 18, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  animation: home-modal-in 0.25s ease both;
}

.home-modal[hidden] {
  display: none !important;
}

@keyframes home-modal-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.home-modal-card {
  position: relative;
  width: min(440px, 100%);
  background: linear-gradient(180deg, #1a2540, #121a2b);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 22px 20px 18px;
  text-align: left;
  animation: home-card-up 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes home-card-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home-modal-card h3 {
  margin: 0 40px 10px 0;
  font-size: 19px;
  font-weight: 800;
}

.home-modal-card p {
  margin: 0 0 12px;
  color: #93a0bd;
  font-size: 14px;
  line-height: 1.65;
}

.home-modal-card .home-warn {
  color: #ffcc80;
}

.home-modal-card .home-warn strong {
  color: #ffab40;
}

.home-link-box {
  margin: 10px 0 12px !important;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 160, 234, 0.1);
  border: 1px solid rgba(0, 160, 234, 0.25);
  color: #c5d4f5 !important;
  word-break: break-all;
  font-size: 13px !important;
}

.home-link-box strong {
  color: #80d8ff;
  font-weight: 700;
}

.home-modal-card ol {
  margin: 0 0 14px;
  padding-left: 1.25em;
  color: #eef2ff;
  font-size: 14px;
  line-height: 1.8;
}

.home-modal-card li {
  margin-bottom: 4px;
}

.home-modal-card strong {
  color: #ffcc00;
}

.home-modal-key {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 700;
}

.home-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.home-modal-actions .home-btn {
  flex: 1 1 auto;
  min-width: 120px;
  min-height: 48px;
  padding: 12px 16px;
  font-size: 15px;
}

.home-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #eef2ff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.home-toast {
  position: fixed;
  left: 50%;
  bottom: max(28px, calc(16px + env(safe-area-inset-bottom)));
  transform: translateX(-50%) translateY(12px);
  z-index: 300;
  max-width: min(90vw, 360px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(20, 30, 50, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #eef2ff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  text-align: center;
}

.home-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 大屏居中卡片感 */
@media (min-width: 640px) {
  .home-modal {
    align-items: center;
  }

  .home-modal-card {
    border-radius: 22px;
  }

  .home-logo {
    width: 100px;
    height: 100px;
    font-size: 46px;
    border-radius: 28px;
  }
}

/* 已安装 PWA 时隐藏安装按钮可选（由 JS class 控制） */
body.home-standalone .home-btn-install {
  display: none;
}
