﻿/* 页面布局与基础控件 */
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  place-items: center;
  gap: 6px;
  padding: 24px;
  isolation: isolate;
  background: #090d25;
  color: #79475d;
  font-family: system-ui, "Microsoft YaHei", sans-serif;
}
main {
  width: min(640px, 100%);
  padding: 24px 24px 32px;
  text-align: center;
  border: 1px solid transparent;
  border-radius: 28px;
  color: #fff4fa;
  text-shadow: 0 2px 5px #231020, 0 0 14px #23102099;
}
h1 { margin: 12px 0; font-size: clamp(26px, 5vw, 36px); }
p { color: #987788; line-height: 1.8; }
label { display: block; margin-bottom: 12px; }
input, button {
  max-width: 100%;
  margin: 6px 2px;
  padding: 12px;
  border: 1px solid #e6c0d044;
  border-radius: 12px;
  font: inherit;
}
input { color-scheme: dark; color: #f6e7f1; background: #ffffff0b; }
button { color: white; background: #ab618b; cursor: pointer; }
button:hover { background: #b85a7f; }
:focus-visible { outline: 3px solid #ad6a99; outline-offset: 3px; }
#status { min-height: 24px; margin-bottom: 0; font-size: 14px; }
footer { margin-top: 24px; font-size: 13px; }

/* 标题与倒计时 */
.page-title {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  text-align: center;
  border-radius: 24px;
}
.love-logo {
  display: block;
  width: min(540px, 88vw);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 0 15px #f7a9cf40);
}
.page-title h2 { margin: 0; font-size: clamp(17px, 3.8vw, 23px); font-weight: 400; letter-spacing: .2em; }
.page-title p {
  margin: 10px 0 0;
  font-size: 11px;
  letter-spacing: .18em;
  opacity: .65;
  color: #fff4fa;
  text-shadow: 0 2px 5px #231020, 0 0 14px #23102099;
}
.domain-greeting { text-align: center; margin: 14px auto 24px; }
.domain-greeting h2 {
  font: italic 400 clamp(23px, 4.6vw, 39px) Georgia, serif;
  letter-spacing: .035em;
  color: #f7e6c8;
  text-shadow: 0 0 24px #d7b4fc77;
  margin: 0 0 12px;
  white-space: nowrap;
}
.domain-greeting p { font: clamp(9px, 2.35vw, 15px) Consolas, monospace; color: #cbc8e9; white-space: nowrap; margin: 0; }
.heart { color: #ffb5d3; font-size: 40px; text-shadow: 0 2px 8px #361027; animation: heartbeat 1.8s ease-in-out infinite; }
.timer { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 32px 0; }
.unit { padding: 20px 4px; border-radius: 16px; background: #e5ccff08; border: 1px solid #efd5ff1c; }
.unit strong { display: block; font-size: clamp(28px, 6vw, 44px); font-variant-numeric: tabular-nums; }
.unit span { font-size: 13px; }
.page-title h2, main h1, main > p, main label, main footer, .unit strong, .unit span {
  background-image: linear-gradient(110deg, #fff1f8, #ff9fc9, #ead0ff, #ffe0ac, #fff1f8);
  background-size: 300% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 3px #2b1026);
  animation: romantic-text 9s ease-in-out infinite;
}

/* 摄影背景、星星与流星 */
.star-sky {
  /* 统一控制流星刷新周期；数值越小，出现越频繁。 */
  --meteor-cycle-scale: .55;
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background-color: #080e20;
  background-image:
    linear-gradient(180deg, rgba(5, 9, 24, .16), rgba(9, 10, 28, .22) 55%, rgba(6, 10, 20, .08)),
    url("skybackground/romantic-night-sky.jpg");
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
}
.star-sky::before {
  content: "";
  position: absolute;
  inset: -25%;
  background: linear-gradient(125deg, transparent 35%, #d2bbef22 48%, #8c9ad21a 55%, transparent 65%);
  filter: blur(25px);
  opacity: .28;
  animation: drift 20s ease-in-out infinite alternate;
}
.stars { position: absolute; inset: 0; animation: drift 40s ease-in-out infinite alternate; }
.star {
  position: absolute;
  border-radius: 50%;
  background: #fff3ec;
  box-shadow: 0 0 6px #e3caff;
  animation: twinkle var(--duration) ease-in-out infinite alternate;
  animation-delay: var(--delay);
}
.star:nth-child(9n) { background: #c7d9ff; box-shadow: 0 0 5px #a8c5ff; }
.star:nth-child(17n) { background: #ffe6bc; box-shadow: 0 0 7px #ffe0ae; }
.star:nth-child(23n) { animation-name: bright-star; animation-duration: 7s; box-shadow: 0 0 5px #fff, 0 0 13px #c5cfff; }
.star:nth-child(23n)::before, .star:nth-child(23n)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(transparent, #eef0ff, transparent);
  width: 1px;
  height: 11px;
}
.star:nth-child(23n)::after { transform: translate(-50%, -50%) rotate(90deg); }
.meteor {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 170px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #bdceff, #fff);
  box-shadow: 0 0 9px #cdd8ff55;
  opacity: 0;
}

/* 悄悄话弹窗与浮动按钮 */
.whisper-button {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  display: block;
  margin: 0;
  max-width: calc(100vw - 16px);
  padding: 14px 26px;
  border: 1px solid #ffd8e9;
  border-radius: 999px;
  background: linear-gradient(120deg, #ec80aa, #c95790);
  box-shadow: 0 6px 24px #c3488055;
  color: white;
  will-change: transform;
  transition: box-shadow .2s;
}
.whisper-button:hover { background: linear-gradient(120deg, #f195b9, #d4679d); box-shadow: 0 9px 28px #c3488070; }
.whisper-dialog {
  width: min(420px, calc(100vw - 40px));
  padding: 34px 24px 24px;
  border: 1px solid #ffe0ed;
  border-radius: 26px;
  text-align: center;
  color: #8e3b65;
  background: linear-gradient(145deg, #fff7fcf5, #ffe3eff5);
  box-shadow: 0 24px 80px #36102755;
}
.whisper-dialog::backdrop { background: #28102055; }
.whisper-dialog h2 { margin: 0; font-size: 14px; letter-spacing: .15em; color: #b66b8e; }
.whisper-dialog p { margin: 24px 0; color: #993c69; font-size: clamp(21px, 5vw, 27px); line-height: 1.8; }
.whisper-dialog button { border-radius: 999px; padding: 10px 25px; }

/* 首次进入的日期选择弹窗 */
body:has(#date-dialog[open]) { overflow: hidden; }
.date-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 32px 24px;
  border: 1px solid #e4bde866;
  border-radius: 28px;
  color: #f8eafa;
  text-align: center;
  background: radial-gradient(ellipse at top, #54416788, transparent 70%), #15162ef5;
  box-shadow: 0 24px 100px #050717aa, 0 0 45px #d7a4dc16;
  color-scheme: dark;
}
.date-dialog::backdrop { background: #070b20a8; backdrop-filter: blur(7px); }
.date-dialog-star { color: #edc6e6; font-size: 38px; }
.date-dialog h2 { margin: 12px 0 28px; font-size: clamp(21px, 5vw, 27px); font-weight: 400; letter-spacing: .04em; }
.date-fields { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.date-fields label { min-width: 0; font-size: 12px; color: #d2bfdc; }
.date-fields select {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px 6px;
  border: 1px solid #e6c0d044;
  border-radius: 12px;
  background: #25243c;
  color: #fff0fa;
  font: inherit;
  font-size: 16px;
}
.time-fields { grid-template-columns: 1fr auto 1fr; align-items: center; max-width: 240px; margin: 0 auto; }
#date-hint { min-height: 22px; margin: 10px 0; font-size: 12px; color: #ddc6e4; }
#date-open { width: 100%; margin: 0; border-radius: 999px; background: linear-gradient(120deg, #bc77a8, #886caf); }
#date-open:disabled { opacity: .4; cursor: not-allowed; }
#time-preface { margin: 18px 0 10px; font-size: 14px; line-height: 1.9; }

/* 点击爱心粒子 */
#heart-effects { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.burst-heart {
  position: absolute;
  left: 0;
  top: 0;
  line-height: 1;
  user-select: none;
  will-change: transform, opacity;
  text-shadow: 0 2px 7px #e85a9433;
}

/* 动画定义 */
@keyframes heartbeat { 50% { transform: scale(1.12); } }
@keyframes romantic-text { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes twinkle { from { opacity: .15; } to { opacity: .95; } }
@keyframes drift { to { transform: translate(3%, 3%) rotate(3deg); } }
@keyframes bright-star {
  0%, 60%, 100% { opacity: .12; transform: scale(.65); }
  72% { opacity: 1; transform: scale(1.45); }
  82% { opacity: .3; transform: scale(.85); }
  88% { opacity: .85; transform: scale(1.15); }
}

/* 小屏幕与减少动态效果设置 */
@media (max-width: 600px) { .star-sky { background-position: 58% bottom; } }
@media (max-width: 480px) {
  body { padding: 16px 12px; }
  main { padding: 20px 8px; }
  .timer { gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .heart, .stars, .star-sky::before, .star,
  .page-title h2, main h1, main > p, main label, main footer,
  .unit strong, .unit span { animation: none; }
  .star:nth-child(23n) { animation: none; opacity: .7; }
  .meteor { display: none; }
}
