/* ---------- 基礎 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { overflow-x: hidden; }
body {
  margin: 0;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei",
               "Hiragino Sans", system-ui, sans-serif;
  color: #fff;
  background: #f7a8cd;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 背景：粉紅天空 + 雲丘 + 飄落花瓣 ---------- */
.sky {
  position: fixed; inset: 0; z-index: -3;
  background:
    radial-gradient(120% 80% at 50% 0%, #ffd6ea 0%, #ff9fd0 45%, #f57ab7 100%);
}
.hills { position: fixed; left: 0; right: 0; bottom: 0; height: 26vh; z-index: -2; overflow: hidden; }
.hills span {
  position: absolute; bottom: 0; left: -10%; width: 120%; height: 100%;
  border-radius: 50% 50% 0 0 / 70% 70% 0 0;
}
.hills span:nth-child(1) { background: #ffb3da; opacity: .75; transform: translateY(28%); }
.hills span:nth-child(2) { background: #ffd0e8; opacity: .85; transform: translateY(52%) scaleX(1.2); }

.petals { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.petal {
  position: absolute; top: -6vh; width: 10px; height: 10px;
  background: #ff7fbe; opacity: .55;
  clip-path: polygon(50% 0, 100% 35%, 78% 100%, 22% 100%, 0 35%);
  animation: fall linear infinite;
}
@keyframes fall {
  from { transform: translateY(-10vh) rotate(0deg); }
  to   { transform: translateY(112vh) rotate(540deg); }
}
@media (prefers-reduced-motion: reduce) { .petal { display: none; } }

/* ---------- 版面 ---------- */
.stage {
  position: relative;
  min-height: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex; align-items: center; justify-content: center;
}
.screen { display: none; width: 100%; text-align: center; }
.screen.is-on { display: block; animation: pop .32s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- 像素相框 ---------- */
.frame {
  width: 178px; height: 178px; margin: 0 auto 26px;
  display: grid; place-items: center;
  background: #2a1220;
  border: 6px solid #ff7ab5;
  outline: 5px solid #ffd9ec;
  box-shadow: 0 0 0 5px #e0559a, 0 10px 0 5px rgba(160,40,100,.35);
  image-rendering: pixelated;
}
.frame img { width: 148px; height: auto; image-rendering: pixelated; display: block; }
#s4 .frame, #s2 .frame, #s3 .frame { background: #fff6fb; }

/* ---------- 文字 ---------- */
.title {
  margin: 0 0 14px;
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 800;
  letter-spacing: .06em;
  color: #fff;
  text-shadow: 0 3px 0 #e2569c, 0 0 18px rgba(255,255,255,.6);
}
.sub { margin: 0 0 18px; font-size: 13px; color: #fff; opacity: .92; letter-spacing: .04em; }
.hint { margin: 8px 0 0; font-size: 13px; font-weight: 700; color: #8d1f57; }

/* ---------- 按鈕 ---------- */
.row { display: flex; gap: 18px; justify-content: center; align-items: center; }
.btn {
  font: inherit; font-weight: 800; letter-spacing: .08em;
  padding: 13px 28px; cursor: pointer;
  border-radius: 999px;
  border: 3px solid #d94b91;
  box-shadow: 0 5px 0 #c33d80;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #c33d80; }
.btn-yes { background: #e84d95; color: #fff; text-transform: uppercase; }
.btn-no  { background: #fff5fa; color: #b03a74; }
.btn-ghost {
  background: #fff5fa; color: #b03a74; margin-top: 22px;
  padding: 12px 34px; border-radius: 14px;
}
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; box-shadow: 0 5px 0 #c33d80; }
.btn .heart { margin-left: 4px; }

/* No 按鈕逃跑用 */
.btn-no.runaway { position: fixed; z-index: 20; margin: 0; }

/* ---------- 日期 ---------- */
.datebox { display: flex; justify-content: center; }
#dateInput {
  font: inherit; font-weight: 800; letter-spacing: .05em;
  padding: 12px 18px; color: #c23c7f;
  background: #fff5fa;
  border: 3px solid #d94b91; border-radius: 12px;
  box-shadow: 0 5px 0 #c33d80;
  min-width: 200px; text-align: center;
}

/* ---------- 活動選項 ---------- */
.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 6px;
}
.opt {
  font: inherit; font-size: 14px; font-weight: 700; letter-spacing: .04em;
  padding: 16px 8px; cursor: pointer;
  background: #fff5fa; color: #b03a74;
  border: 3px solid #d94b91; border-radius: 12px;
  box-shadow: 0 5px 0 #c33d80;
  transition: transform .08s ease, box-shadow .08s ease, background .12s ease;
}
.opt:active { transform: translateY(4px); box-shadow: 0 1px 0 #c33d80; }
.opt.on { background: #e84d95; color: #fff; }

/* ---------- 結果卡 ---------- */
.card {
  background: #fff5fa; color: #a83570;
  border: 3px solid #e8659f; border-radius: 12px;
  box-shadow: 0 5px 0 rgba(180,60,120,.4);
  padding: 16px 18px; margin: 4px 0 6px;
  font-size: 15px; font-weight: 700; line-height: 1.9;
}
.card b { color: #d23a83; font-size: 17px; }

/* ---------- 情書彈窗 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(120,30,80,.45);
  backdrop-filter: blur(2px);
}
.overlay[hidden] { display: none; }
.win {
  position: relative;
  width: min(380px, 100%);
  background: #fdfdfd;
  border: 3px solid #e2569c;
  border-radius: 12px;
  box-shadow: 0 12px 0 rgba(150,40,95,.4);
  overflow: hidden;
  animation: pop .25s ease-out;
}
.win-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  background: #f7a8cd; color: #7d2352;
  font-size: 13px; font-weight: 800; letter-spacing: .05em;
  border-bottom: 3px solid #e2569c;
}
.win-x {
  font: inherit; font-weight: 800; line-height: 1;
  width: 26px; height: 22px; cursor: pointer;
  background: #e84d95; color: #fff;
  border: 2px solid #fff; border-radius: 5px;
}
.win-body {
  max-height: min(62vh, 440px); overflow-y: auto;
  padding: 18px 22px 34px;
  color: #4a3540; font-size: 16px; line-height: 1.95; text-align: left;
}
.win-body p { margin: 0 0 18px; }
.photo {
  margin: 0 0 20px; padding: 7px 7px 7px;
  background: #fff;
  border: 3px solid #f2a8cb; border-radius: 8px;
  box-shadow: 0 4px 0 rgba(180,60,120,.22);
}
.photo img {
  display: block; width: 100%; height: auto; border-radius: 4px;
  max-height: 30vh; object-fit: cover; object-position: center 42%;
}
.sign { text-align: right; margin-bottom: 4px; }
.sign span { font-family: ui-monospace, "SF Mono", Menlo, monospace; color: #b03a74; }
.win-more {
  position: absolute; left: 3px; right: 3px; bottom: 0; height: 30px;
  display: flex; align-items: flex-end; padding: 0 0 5px 16px;
  color: #e8659f; font-size: 14px;
  background: linear-gradient(rgba(253,253,253,0), #fdfdfd 62%);
  animation: nudge 1.1s ease-in-out infinite;
  pointer-events: none;
}
.win-more[hidden] { display: none; }
@keyframes nudge { 50% { transform: translateY(4px); } }
