*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  background: radial-gradient(circle at top, #1a0044 0, #05010e 50%, #020109 100%);
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: relative;
}

canvas#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 9999; /* 烟花在最上层 */
  background: transparent;
  pointer-events: none; /* 允许点击穿透，确保文字和按钮可点击 */
}

.noise-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  background-image: url("https://grainy-gradients.vercel.app/noise.svg");
  mix-blend-mode: soft-light;
  opacity: 0.25;
}

.page {
  position: relative;
  z-index: 10; /* 页面内容在背景之上，但在烟花之下 */
  width: 100%;
  min-height: 100%;
  padding: 24px 24px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end; /* 将卡片整体靠近页面下方 */
  perspective: 1400px;
}

.page-inner {
  position: relative;
  width: min(880px, 100%); /* 整体卡片变窄一点，给烟花让出两侧空间 */
  max-height: none;
  min-height: auto;
  padding: 22px 22px 18px; /* 上下内边距减小，让内容区域更紧凑 */
  border-radius: 28px;
  background: radial-gradient(circle at top left, rgba(60, 31, 112, 0.75) 0, rgba(18, 8, 38, 0.8) 40%, rgba(5, 2, 13, 0.85) 100%);
  box-shadow:
    0 0 80px rgba(124, 58, 237, 0.65),
    0 0 120px rgba(244, 63, 94, 0.35),
    0 0 40px rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(248, 250, 252, 0.1);
  backdrop-filter: blur(18px) saturate(1.4);
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: visible;
  transform-style: preserve-3d;
  margin-top: auto;   /* 把卡片整体推向页面底部 */
  margin-bottom: 32px;
  z-index: 1; /* 相对于 page 容器 */
}

  transition:
    transform 0.35s ease-out,
    box-shadow 0.35s ease-out;
}

.corner {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 32px;
  border: 2px solid transparent;
  pointer-events: none;
  z-index: 2;
}

.corner--tl {
  top: 12px;
  left: 12px;
  border-top-color: rgba(248, 250, 252, 0.35);
  border-left-color: rgba(248, 250, 252, 0.15);
}

.corner--tr {
  top: 12px;
  right: 12px;
  border-top-color: rgba(244, 63, 94, 0.6);
  border-right-color: rgba(248, 250, 252, 0.15);
}

.corner--bl {
  bottom: 12px;
  left: 12px;
  border-bottom-color: rgba(56, 189, 248, 0.85);
  border-left-color: rgba(248, 250, 252, 0.15);
}

.corner--br {
  bottom: 12px;
  right: 12px;
  border-bottom-color: rgba(250, 204, 21, 0.75);
  border-right-color: rgba(248, 250, 252, 0.25);
}

.hero {
  position: relative;
  padding: 12px 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.hero-year-wrapper {
  display: inline-flex;
  gap: 10px;
  align-items: baseline;
  position: relative;
  overflow: visible;
}

.hero-year {
  position: relative;
  font-size: clamp(52px, 9vw, 88px); /* 数字整体缩小，避免遮挡太多烟花 */
  font-weight: 900;
  letter-spacing: 0.12em;
  color: transparent;
  -webkit-text-stroke: 2px rgba(252, 211, 77, 0.95);
  text-shadow:
    0 0 18px rgba(234, 179, 8, 0.8),
    0 0 40px rgba(251, 191, 36, 0.85);
  filter: drop-shadow(0 0 30px rgba(251, 191, 36, 0.7));
  animation: year-pulse 5.2s ease-in-out infinite;
}

.hero-year:nth-child(2) {
  animation-delay: 0.18s;
}

.hero-year:nth-child(3) {
  animation-delay: 0.36s;
}

.hero-year:nth-child(4) {
  animation-delay: 0.54s;
}

.hero-year--2 {
  background: radial-gradient(circle at 20% 0%, #f97316, #facc15, #fef9c3);
  -webkit-background-clip: text;
}

.hero-year--0 {
  background: radial-gradient(circle at 50% 0%, #a855f7, #ec4899, #f97316);
  -webkit-background-clip: text;
}

.hero-year.second {
  background: radial-gradient(circle at 60% 20%, #22c55e, #22d3ee, #818cf8);
  -webkit-background-clip: text;
}

.hero-year--6 {
  background: radial-gradient(circle at 80% 10%, #38bdf8, #6366f1, #f97316);
  -webkit-background-clip: text;
}

.hero-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hero-text {
  position: relative;
  font-size: clamp(18px, 2.4vw, 24px); /* “新年快乐”字号也减小 */
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  text-align: center;
}

.hero-text--stroke {
  color: transparent;
  -webkit-text-stroke: 1px rgba(248, 250, 252, 0.6);
  text-shadow:
    0 0 12px rgba(251, 113, 133, 0.9),
    0 0 30px rgba(244, 63, 94, 0.9);
}

.hero-text--glow {
  margin-top: 2px;
  background: linear-gradient(90deg, #22d3ee, #a855f7, #fb7185, #facc15);
  -webkit-background-clip: text;
  color: transparent;
  text-shadow:
    0 0 18px rgba(56, 189, 248, 0.9),
    0 0 40px rgba(129, 140, 248, 0.9);
}

.hero-subline {
  margin-top: 6px;
  font-size: 12px; /* 祝福文案更小一号 */
  letter-spacing: 0.08em;
  text-align: center;
  color: rgba(226, 232, 240, 0.9);
  text-shadow:
    0 0 10px rgba(15, 23, 42, 0.9),
    0 0 24px rgba(56, 189, 248, 0.65);
}

.hero-sub {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2px;
}

.tag {
  position: relative;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-indent: 0.18em;
  border: 1px solid rgba(248, 250, 252, 0.16);
  backdrop-filter: blur(16px);
}

.tag--gold {
  background: linear-gradient(
    110deg,
    rgba(250, 204, 21, 0.2),
    rgba(234, 179, 8, 0.05)
  );
  color: #facc15;
}

.tag--red {
  background: linear-gradient(
    120deg,
    rgba(239, 68, 68, 0.3),
    rgba(248, 113, 113, 0.08)
  );
  color: #fecaca;
}

.btn-primary {
  position: relative;
  margin-top: 10px;
  padding: 12px 32px;
  border-radius: 999px;
  border: 0;
  outline: none;
  background: radial-gradient(circle at 0 0, #f97316, #f43f5e, #6366f1);
  color: #fefce8;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 0 24px rgba(248, 113, 113, 0.8),
    0 0 40px rgba(129, 140, 248, 0.7);
  transform: translateY(0);
  transition:
    transform 0.18s ease-out,
    box-shadow 0.18s ease-out,
    filter 0.18s ease-out;
}

.btn-primary__glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 0 0, #fef9c3 0, transparent 55%);
  mix-blend-mode: soft-light;
  opacity: 0.65;
  animation: glow-move 5s infinite linear;
}

.btn-primary__text {
  position: relative;
  z-index: 1;
}

.btn-primary:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow:
    0 0 30px rgba(248, 113, 113, 0.95),
    0 0 60px rgba(129, 140, 248, 0.9);
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary--disabled {
  cursor: default;
  opacity: 0.9;
  box-shadow:
    0 0 18px rgba(148, 163, 184, 0.7),
    0 0 32px rgba(55, 65, 81, 0.9);
  filter: grayscale(0.1) brightness(0.9);
}

.content {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 24px;
  margin-top: 12px;
}

.panel {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: radial-gradient(circle at top left, #4c1d95 0, #020617 45%);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow:
    0 0 32px rgba(15, 23, 42, 0.9),
    0 0 40px rgba(30, 64, 175, 0.65);
  overflow: hidden;
}

.panel--blessing::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 0 0, rgba(248, 250, 252, 0.16), transparent 60%);
  opacity: 0.8;
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.panel--countdown {
  background: radial-gradient(circle at top right, #0f172a 0, #020617 40%, #020617 100%);
}

.panel-title {
  position: relative;
  margin-bottom: 12px;
}

.panel-title__shadow {
  display: block;
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  text-indent: 0.26em;
  color: rgba(148, 163, 184, 0.65);
}

.panel-title__main {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  padding: 2px 12px;
  border-radius: 999px;
  border: 1px solid rgba(248, 250, 252, 0.12);
  font-size: 15px;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  color: #e5e7eb;
  background: radial-gradient(circle at 0 0, rgba(248, 250, 252, 0.12), transparent 60%);
  backdrop-filter: blur(18px);
}

.blessing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 6px;
}

.blessing-card {
  position: relative;
  padding: 10px 12px;
  border-radius: 16px;
  background: radial-gradient(circle at 0 0, rgba(236, 72, 153, 0.18), transparent 60%);
  border: 1px solid rgba(248, 250, 252, 0.16);
  box-shadow: 0 0 22px rgba(15, 23, 42, 0.8);
  overflow: hidden;
}

.blessing-card::before {
  content: "";
  position: absolute;
  inset: -60%;
  background: radial-gradient(circle at 0 0, rgba(250, 250, 250, 0.4), transparent 55%);
  mix-blend-mode: soft-light;
  opacity: 0.35;
}

.blessing-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 22px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  color: #fee2e2;
  background: radial-gradient(circle at 0 0, rgba(248, 113, 113, 0.6), rgba(248, 113, 113, 0.2));
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.9);
}

.blessing-text {
  position: relative;
  margin-top: 4px;
  font-size: 14px;
  color: #f9fafb;
}

.countdown-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.85));
  box-shadow:
    0 0 20px rgba(15, 23, 42, 0.9),
    0 0 36px rgba(30, 64, 175, 0.7);
}

.countdown-item {
  text-align: center;
  min-width: 56px;
}

.countdown-number {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.75), rgba(15, 23, 42, 0.98));
  box-shadow:
    0 0 22px rgba(37, 99, 235, 0.85),
    0 0 36px rgba(56, 189, 248, 0.75);
}

.countdown-label {
  margin-top: 2px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.9);
}

.countdown-sep {
  margin: 0 8px;
  font-size: 22px;
  color: rgba(148, 163, 184, 0.7);
}

.wish {
  padding: 10px 12px 8px;
  border-radius: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.65);
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.15), rgba(15, 23, 42, 0.95));
}

.wish-label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: #e5e7eb;
}

.wish-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.wish-input {
  flex: 1;
  min-width: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  padding: 6px 12px;
  font-size: 13px;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  outline: none;
  transition:
    border-color 0.18s ease-out,
    box-shadow 0.18s ease-out,
    background 0.18s ease-out;
}

.wish-input::placeholder {
  color: rgba(148, 163, 184, 0.8);
}

.wish-input:focus {
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow:
    0 0 18px rgba(56, 189, 248, 0.8),
    0 0 30px rgba(59, 130, 246, 0.7);
  background: rgba(15, 23, 42, 0.98);
}

.btn-ghost {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.8);
  background: radial-gradient(circle at 100% 0, rgba(45, 212, 191, 0.4), transparent 60%);
  color: #a5f3fc;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.18s ease-out,
    box-shadow 0.18s ease-out,
    transform 0.18s ease-out;
}

.btn-ghost:hover {
  background: radial-gradient(circle at 0 0, rgba(45, 212, 191, 0.55), transparent 70%);
  box-shadow:
    0 0 20px rgba(45, 212, 191, 0.9),
    0 0 32px rgba(34, 211, 238, 0.7);
  transform: translateY(-0.5px);
}

.btn-ghost:active {
  transform: translateY(1px) scale(0.98);
}

.wish-display {
  margin-top: 8px;
  font-size: 13px;
  color: #fef9c3;
  min-height: 18px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed rgba(148, 163, 184, 0.4);
  font-size: 11px;
  color: rgba(148, 163, 184, 0.9);
}

.footer-text--small {
  opacity: 0.8;
}

@keyframes glow-move {
  0% {
    transform: translateX(-40%);
  }
  50% {
    transform: translateX(40%);
  }
  100% {
    transform: translateX(-40%);
  }
}

@keyframes year-pulse {
  0% {
    transform: translateY(0) scale(1);
    text-shadow:
      0 0 18px rgba(234, 179, 8, 0.7),
      0 0 34px rgba(251, 191, 36, 0.6);
  }
  50% {
    transform: translateY(-6px) scale(1.06);
    text-shadow:
      0 0 26px rgba(250, 250, 210, 0.95),
      0 0 60px rgba(253, 224, 71, 1);
  }
  100% {
    transform: translateY(0) scale(1);
    text-shadow:
      0 0 18px rgba(234, 179, 8, 0.7),
      0 0 34px rgba(251, 191, 36, 0.6);
  }
}

@keyframes hero-scan {
  0% {
    transform: translateX(-150%) skewX(-18deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  40% {
    transform: translateX(150%) skewX(-18deg);
    opacity: 0;
  }
  100% {
    transform: translateX(150%) skewX(-18deg);
    opacity: 0;
  }
}

.hero-year-wrapper::after {
  content: "";
  position: absolute;
  top: -20%;
  left: -10%;
  width: 120%;
  height: 140%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.9) 40%,
    rgba(251, 191, 36, 0.95) 50%,
    rgba(255, 255, 255, 0.9) 60%,
    transparent 100%
  );
  mix-blend-mode: screen;
  transform: translateX(-150%) skewX(-18deg);
  animation: hero-scan 5.2s infinite ease-in-out;
  pointer-events: none;
}

@media (max-width: 900px) {
  .page {
    padding: 16px 16px 32px;
  }

  .page-inner {
    padding: 18px 16px 14px;
    border-radius: 24px;
  }

  .content {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-year {
    font-size: clamp(46px, 11vw, 78px);
  }

  .btn-primary {
    min-height: 44px;
    touch-action: manipulation;
  }

  .wish-input,
  .btn-ghost {
    min-height: 44px;
    touch-action: manipulation;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 8px 8px 32px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    perspective: none; /* 移动端禁用3D效果 */
  }

  .page-inner {
    transform-style: flat; /* 移动端禁用3D变换 */
  }

  .page-inner {
    padding: 16px 14px 14px;
    border-radius: 20px;
    gap: 18px;
    max-height: none;
    min-height: auto;
    margin-bottom: 24px;
  }

  .hero {
    gap: 12px;
    padding: 8px 4px 0;
  }

  .hero-year-wrapper {
    gap: 6px;
  }

  .hero-year {
    font-size: clamp(40px, 16vw, 70px);
    letter-spacing: 0.08em;
    -webkit-text-stroke: 1.5px rgba(252, 211, 77, 0.95);
    text-shadow:
      0 0 12px rgba(234, 179, 8, 0.7),
      0 0 28px rgba(251, 191, 36, 0.75);
    filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.6));
  }

  .hero-title {
    gap: 3px;
  }

  .hero-text {
    letter-spacing: 0.25em;
    text-indent: 0.25em;
    font-size: clamp(16px, 4.4vw, 20px);
  }

  .hero-sub {
    gap: 6px;
    flex-wrap: wrap;
  }

  .tag {
    font-size: 11px;
    padding: 5px 10px;
  }

  .btn-primary {
    margin-top: 8px;
    padding: 14px 28px;
    font-size: 13px;
    min-height: 44px; /* 确保触摸目标足够大 */
    touch-action: manipulation;
  }

  .content {
    margin-top: 8px;
    gap: 16px;
  }

  .panel {
    padding: 16px 14px 14px;
    border-radius: 18px;
  }

  .panel-title {
    margin-bottom: 10px;
  }

  .panel-title__main {
    font-size: 14px;
    padding: 3px 10px;
  }

  .blessing-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .blessing-card {
    padding: 12px 14px;
  }

  .blessing-label {
    width: 40px;
    height: 20px;
    font-size: 11px;
  }

  .blessing-text {
    font-size: 13px;
    margin-top: 6px;
  }

  .countdown {
    padding: 12px 10px;
    flex-wrap: wrap;
    gap: 4px;
  }

  .countdown-item {
    min-width: 48px;
  }

  .countdown-number {
    font-size: 20px;
    padding: 6px 8px;
  }

  .countdown-label {
    font-size: 10px;
    margin-top: 3px;
  }

  .countdown-sep {
    margin: 0 4px;
    font-size: 18px;
  }

  .wish {
    padding: 12px 14px 10px;
  }

  .wish-label {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .wish-input {
    font-size: 14px;
    padding: 10px 14px;
    min-height: 44px; /* 确保触摸目标足够大 */
    touch-action: manipulation;
  }

  .wish-input::placeholder {
    font-size: 13px;
  }

  .wish-input-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .btn-ghost {
    width: 100%;
    text-align: center;
    padding: 10px 16px;
    min-height: 44px; /* 确保触摸目标足够大 */
    font-size: 13px;
    touch-action: manipulation;
  }

  .wish-display {
    font-size: 12px;
    margin-top: 10px;
    line-height: 1.5;
  }

  .footer {
    font-size: 10px;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding-top: 12px;
  }

  .corner {
    width: 80px;
    height: 80px;
    border-radius: 20px;
  }

  .corner--tl,
  .corner--tr {
    top: 8px;
  }

  .corner--bl,
  .corner--br {
    bottom: 8px;
  }

  .corner--tl,
  .corner--bl {
    left: 8px;
  }

  .corner--tr,
  .corner--br {
    right: 8px;
  }
}

/* 超小屏幕优化（iPhone SE等） */
@media (max-width: 375px) {
  .hero-year {
    font-size: clamp(42px, 20vw, 70px);
  }

  .hero-text {
    font-size: clamp(16px, 5.5vw, 22px);
  }

  .countdown-number {
    font-size: 18px;
    padding: 5px 6px;
  }

  .countdown-item {
    min-width: 42px;
  }
}

