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

img { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }

:root {
  --gold: #ffd76e;
  --gold-soft: #ffc94d;
  --pink: #ff9ec7;
  --teal: #7fd8be;
  --text: #fff7e8;
  --night: #0b1026;
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background-color: #0b1026;
  background: radial-gradient(1200px 800px at 70% -10%, #1b2a5e 0%, transparent 60%),
              radial-gradient(1000px 700px at 10% 110%, #3d1a4e 0%, transparent 55%),
              linear-gradient(180deg, #0b1026 0%, #101a3c 55%, #0b1026 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* ---------- 星空背景 ---------- */

#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
  animation: twinkle var(--du, 3s) ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.star.big {
  background: var(--gold-soft);
  box-shadow: 0 0 12px rgba(255, 201, 77, 0.9);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.1; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

#aurora {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(600px 300px at 20% 20%, rgba(126, 87, 224, 0.15), transparent 70%),
    radial-gradient(700px 350px at 85% 35%, rgba(255, 107, 153, 0.12), transparent 70%);
}

/* ---------- 烟花画布 ---------- */

#fireworks {
  position: fixed; inset: 0; z-index: 1130; pointer-events: none;
}

/* ---------- 锁定页 ---------- */

#lockScreen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  overflow-y: auto;
  background: radial-gradient(900px 600px at 50% 30%, rgba(20, 30, 70, 0.55), transparent 70%);
  transition: opacity 0.9s ease;
}
#lockScreen.fading { opacity: 0; pointer-events: none; }

#lockBox {
  text-align: center;
  width: 100%;
  max-width: 340px;
  box-sizing: border-box;
  padding: 34px 44px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 215, 110, 0.25);
  border-radius: 22px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* 礼物盒 */
#giftBox {
  position: relative;
  width: 150px; height: 130px;
  margin: 0 auto 26px;
  cursor: pointer;
}
#giftBox.float { animation: floaty 3s ease-in-out infinite; }

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

.gift-body {
  position: absolute; left: 10px; right: 10px; bottom: 0; top: 42px;
  background: linear-gradient(160deg, #ff7eb3, #ff4d88);
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(255, 77, 136, 0.35);
}
.gift-lid {
  position: absolute; left: 0; right: 0; top: 16px; height: 32px;
  background: linear-gradient(160deg, #ffd76e, #ffb347);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.gift-ribbon-v {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 22px;
  transform: translateX(-50%);
  background: linear-gradient(160deg, #ffd76e, #ffb347);
  z-index: 2;
}
.gift-ribbon-h {
  position: absolute; left: 0; right: 0; top: 38px; height: 18px;
  background: linear-gradient(160deg, #ffd76e, #ffb347);
  z-index: 2;
}
.gift-bow {
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 77px; height: 24px;
  z-index: 3;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}
.bow-loop {
  position: absolute; top: 0;
  width: 40px; height: 24px;
  border: 5px solid #f7b544;
  border-radius: 50%;
}
.bow-loop-left { left: 0; transform: rotate(26deg); }
.bow-loop-right { right: 0; transform: rotate(-26deg); }
.gift-shine {
  position: absolute; left: 22px; top: 60px; width: 26px; height: 50px;
  background: linear-gradient(180deg, rgba(255,255,255,0.5), transparent);
  border-radius: 50%;
  transform: rotate(18deg);
  opacity: 0.5;
}

/* 打开动画 */
#giftBox.opening .gift-lid {
  animation: lidOpen 1.1s ease-out forwards;
  transform-origin: 30% center;
}
#giftBox.opening .gift-bow { animation: bowPop 0.6s ease-out forwards; }
#giftBox.opening .gift-body { animation: bodyGlow 1.4s ease-out forwards; }

@keyframes lidOpen {
  0% { transform: rotate(0) translateY(0); }
  30% { transform: rotate(8deg) translateY(-6px); }
  100% { transform: rotate(42deg) translateY(-70px); opacity: 0.6; }
}
@keyframes bowPop {
  0% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-90px) scale(1.6); opacity: 0; }
}
@keyframes bodyGlow {
  0% { box-shadow: 0 14px 30px rgba(255, 77, 136, 0.35); }
  40% { box-shadow: 0 0 60px 30px rgba(255, 215, 110, 0.55); }
  100% { box-shadow: 0 14px 30px rgba(255, 77, 136, 0.35); }
}

#lockBox.shake #giftBox { animation: shake 0.5s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-12px) rotate(-2deg); }
  40% { transform: translateX(10px) rotate(2deg); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(6px); }
}

.lock-title { font-size: 22px; font-weight: 700; letter-spacing: 2px; }
.lock-sub { margin-top: 8px; font-size: 13px; color: rgba(255, 247, 232, 0.65); }

.lock-inputs { margin: 22px 0 28px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.lock-inputs input {
  width: 86px; height: 46px;
  font-size: 22px; text-align: center; color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 215, 110, 0.4);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.lock-inputs input:focus {
  border-color: var(--gold-soft);
  box-shadow: 0 0 0 3px rgba(255, 215, 110, 0.2);
}
.lock-inputs input::-webkit-outer-spin-button,
.lock-inputs input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lock-inputs input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.slash { font-size: 22px; color: rgba(255, 247, 232, 0.5); }

#unlockBtn {
  padding: 13px 46px;
  font-size: 16px; font-weight: 600; letter-spacing: 3px;
  color: #3a2500;
  background: linear-gradient(135deg, #ffe08a, var(--gold-soft));
  border: none; border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 201, 77, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}
#unlockBtn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(255, 201, 77, 0.5); }
#unlockBtn:active { transform: translateY(0) scale(0.97); }

#lockHint {
  margin-top: 14px; min-height: 20px;
  max-width: 300px;
  margin-left: auto; margin-right: auto;
  font-size: 14px; line-height: 1.6; color: var(--pink);
  opacity: 0;
  transition: opacity 0.25s;
}
#lockHint.show { opacity: 1; }

/* ---------- 祝福页 ---------- */

#birthdayScreen {
  position: relative; z-index: 10;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; align-items: center;
  padding: 30px 20px 24px;
  opacity: 0;
  transition: opacity 1s ease;
}
#birthdayScreen.visible { opacity: 1; }

#musicToggle {
  position: fixed; top: 18px; right: 18px; z-index: 50;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 215, 110, 0.35);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.15s, background 0.2s;
}
#musicToggle:hover { transform: scale(1.08); background: rgba(255, 255, 255, 0.15); }
#musicToggle.muted { color: rgba(255, 247, 232, 0.45); }

.title {
  margin-top: auto;
  font-size: clamp(34px, 8vw, 56px);
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  letter-spacing: 6px;
  background: linear-gradient(110deg, #fff6da 10%, var(--gold-soft) 35%, #fff2c4 50%, var(--gold) 65%, #fff6da 90%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 4s linear infinite;
  filter: drop-shadow(0 0 22px rgba(255, 201, 77, 0.35));
}
@keyframes shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: -200% 50%; }
}

/* 头像 */
.avatar-wrap { margin-top: clamp(4px, 3.5vh, 30px); text-align: center; animation: floaty 4s ease-in-out infinite; }

.avatar-ring {
  width: clamp(110px, min(34vw, 30vh), 220px);
  aspect-ratio: 1 / 1;
  padding: 7px;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: conic-gradient(from 0deg, var(--gold), #fff2c4, var(--pink), #7fd8be, var(--gold));
  box-shadow: 0 0 45px rgba(255, 215, 110, 0.45);
  animation: glowPulse 3s ease-in-out infinite;
  transition: transform 0.15s ease;
}
.avatar-ring:active { transform: scale(0.94); }
.avatar-ring img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid #0d1330;
  display: block;
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 28px rgba(255, 215, 110, 0.35); }
  50% { box-shadow: 0 0 55px rgba(255, 215, 110, 0.6); }
}
.avatar-name {
  display: block;
  margin-top: clamp(4px, 1.6vh, 12px);
  font-size: 15px; letter-spacing: 3px;
  color: rgba(255, 247, 232, 0.8);
}

/* ---------- 蛋糕 ---------- */

.cake {
  position: relative;
  margin-top: clamp(6px, 4.5vh, 42px);
  width: 340px; height: 250px;
  animation: floaty 3.4s ease-in-out infinite;
}
.cake * { pointer-events: none; }
.candle { pointer-events: auto; cursor: pointer; }

.plate {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 320px; height: 22px;
  background: linear-gradient(180deg, #e8f4ff, #bcd6ee);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}
.plate::after {
  content: ""; position: absolute; inset: 6px 14px 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(188,214,238,0.4));
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}

.cake-base {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  width: 300px; height: 84px;
  background: linear-gradient(180deg, #ffe3d0, #f5b8c6 60%, #e79ab4);
  border-radius: 14px;
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.12);
}
.cake-top {
  position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%);
  width: 210px; height: 62px;
  background: linear-gradient(180deg, #fff3e0, #ffd9c4 60%, #f7c4ae);
  border-radius: 12px;
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.1);
}
.frosting-line {
  position: absolute; top: 6px; left: 0; right: 0; height: 14px;
  background:
    radial-gradient(circle at 14px 7px, #fff 0 5px, transparent 5px),
    radial-gradient(circle at 42px 7px, #fff 0 5px, transparent 5px),
    radial-gradient(circle at 70px 7px, #fff 0 5px, transparent 5px),
    radial-gradient(circle at 98px 7px, #fff 0 5px, transparent 5px),
    radial-gradient(circle at 126px 7px, #fff 0 5px, transparent 5px),
    radial-gradient(circle at 154px 7px, #fff 0 5px, transparent 5px),
    radial-gradient(circle at 182px 7px, #fff 0 5px, transparent 5px),
    radial-gradient(circle at 210px 7px, #fff 0 5px, transparent 5px);
  background-size: 28px 14px;
  background-repeat: repeat-x;
  opacity: 0.9;
}
.cake-top .frosting-line { top: 4px; }

/* 蜡烛 */
.candles {
  position: absolute; top: -48px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 20px;
}
.candle {
  position: relative;
  width: 12px; height: 52px;
  border-radius: 3px;
  background: repeating-linear-gradient(45deg, #fff 0 4px, #ffd0e0 4px 8px, #ffb3cd 8px 12px);
  box-shadow: inset 0 -3px 4px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s;
}
.candle:nth-child(2n) {
  background: repeating-linear-gradient(45deg, #fff 0 4px, #c9f3e4 4px 8px, #9fe6cd 8px 12px);
}
.candle:nth-child(3n) {
  background: repeating-linear-gradient(45deg, #fff 0 4px, #ffe9b8 4px 8px, #ffd98a 8px 12px);
}
.candle:hover { transform: translateY(-2px); }
.candle::before {
  content: ""; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 7px;
  background: #7a5a34;
  border-radius: 2px;
}

.flame {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  width: 14px; height: 20px;
  background: radial-gradient(circle at 50% 72%, #ffdf8e 0%, #ffab3d 45%, #ff7a1f 75%, rgba(255, 122, 31, 0) 100%);
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  transform-origin: 50% 100%;
  animation: flicker 0.35s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 8px rgba(255, 171, 61, 0.9));
}
@keyframes flicker {
  0% { transform: translateX(-50%) scale(1) rotate(-3deg); }
  100% { transform: translateX(-50%) scale(1.12, 1.05) rotate(3deg); }
}

.candle.blown .flame {
  animation: blowout 0.45s ease-out forwards;
}
@keyframes blowout {
  0% { transform: translateX(-50%) scale(1); opacity: 1; }
  60% { transform: translateX(-50%) scale(0.4) translateY(-5px); opacity: 0.5; }
  100% { transform: translateX(-50%) scale(0.1) translateY(-9px); opacity: 0; }
}

.smoke {
  position: absolute; top: -24px; left: 50%;
  width: 8px; height: 8px;
  background: radial-gradient(circle, rgba(200, 200, 210, 0.75), transparent 65%);
  border-radius: 50%;
  opacity: 0;
}
.candle.blown .smoke {
  animation: smoke 1s ease-out forwards;
}
@keyframes smoke {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.3); }
  30% { opacity: 0.8; transform: translate(-50%, -8px) scale(0.9); }
  100% {
    opacity: 0;
    transform: translate(-50%, -34px) scale(2.4);
  }
}

.cake-tip {
  margin-top: clamp(4px, 2.4vh, 20px);
  font-size: 13px; letter-spacing: 2px;
  color: rgba(255, 247, 232, 0.55);
}

/* ---------- 许愿 / 抽奖 ---------- */

.action-btns {
  margin-top: clamp(6px, 3vh, 26px);
  display: flex; align-items: center; justify-content: center;
  gap: 16px;
}
.action-btns button {
  flex: 1;
  max-width: 300px;
  padding: 15px 30px;
  white-space: nowrap;
  font-size: 17px; font-weight: 700; letter-spacing: 3px;
  color: #3a2500;
  background: linear-gradient(135deg, #ffe08a, var(--gold-soft));
  border: none; border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(255, 201, 77, 0.35), 0 0 0 6px rgba(255, 201, 77, 0.08);
  transition: transform 0.15s, box-shadow 0.2s;
}
.action-btns button:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 14px 34px rgba(255, 201, 77, 0.5); }
.action-btns button:active { transform: scale(0.96); }

.wish-hint {
  margin-top: clamp(6px, 2vh, 14px); margin-bottom: auto;
  font-size: 12px; color: rgba(255, 247, 232, 0.45); letter-spacing: 1px;
}

/* ---------- 许愿弹窗 ---------- */

#wishModal {
  position: fixed; inset: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 24, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.45s;
}
#wishModal.show { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity 0.3s ease; }

.modal-card {
  width: min(420px, 88vw);
  padding: 34px 30px 28px;
  text-align: center;
  background: linear-gradient(180deg, rgba(30, 40, 85, 0.95), rgba(18, 25, 58, 0.97));
  border: 1px solid rgba(255, 215, 110, 0.45);
  border-radius: 16px;
  box-shadow: 0 0 60px rgba(255, 201, 77, 0.2), 0 24px 60px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: scale(0.6);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
#wishModal.show .modal-card { transform: scale(1); opacity: 1; }
#wishModal.closing { opacity: 0; transition: opacity 0.45s ease; }
#wishModal.closing .modal-card {
  transform: scale(0.4);
  opacity: 0;
  transition: transform 0.45s ease, opacity 0.35s ease;
}

.modal-card h2 {
  font-size: 24px; letter-spacing: 4px;
  background: linear-gradient(110deg, #fff6da, var(--gold-soft));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.modal-sub { margin-top: 8px; font-size: 13px; color: rgba(255, 247, 232, 0.6); }

#wishInput {
  width: 100%;
  margin-top: 22px;
  padding: 14px 16px;
  font-size: 15px; line-height: 1.6;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 215, 110, 0.35);
  border-radius: 12px;
  outline: none;
  resize: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#wishInput:focus { border-color: var(--gold-soft); box-shadow: 0 0 0 3px rgba(255, 215, 110, 0.2); }

#wishHint { margin-top: 10px; min-height: 18px; font-size: 13px; color: var(--pink); }

#wishSubmit {
  padding: 10px 34px;
  font-size: 15px; font-weight: 600; letter-spacing: 3px;
  white-space: nowrap; /* 文字不换行，宽度随内容扩张 */
  color: #3a2500;
  background: linear-gradient(135deg, #ffe08a, var(--gold-soft));
  border: none; border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 201, 77, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}
#wishSubmit:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(255, 201, 77, 0.5); }
#wishSubmit:active { transform: scale(0.96); }

/* ---------- 流星 ---------- */

#meteors { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }

.shooting-star {
  position: absolute;
  width: clamp(90px, 18vw, 240px);
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.85) 70%, #ffffff 100%);
  border-radius: 2px;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
  opacity: 1;
  transform: rotate(var(--angle, 37deg));
  animation: meteor var(--dur, 1.5s) linear forwards;
}
.shooting-star::before {
  content: "";
  position: absolute; right: 0; top: 50%;
  transform: translate(50%, -50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px 3px rgba(255, 255, 255, 0.9);
}

@keyframes meteor {
  0% { transform: translate(0, 0) rotate(var(--angle, 37deg)); }
  100% {
    transform: translate(var(--dx, 120vw), var(--dy, 90vh)) rotate(var(--angle, 37deg));
  }
}

/* ---------- 幸运大抽奖 ---------- */

.ghost-btn {
  margin-top: clamp(4px, 1.6vh, 12px);
  padding: 10px 34px;
  font-size: 13px; font-weight: 600; letter-spacing: 3px;
  color: var(--gold-soft);
  background: transparent;
  border: 1.5px solid rgba(255, 215, 110, 0.55);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.ghost-btn:hover {
  background: rgba(255, 215, 110, 0.12);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 201, 77, 0.25);
}
.ghost-btn:active { transform: scale(0.96); }

.gold-btn {
  padding: 10px 30px;
  font-size: 13px; font-weight: 600; letter-spacing: 3px;
  color: #3a2500;
  background: linear-gradient(135deg, #ffe08a, var(--gold-soft));
  border: 1.5px solid transparent; /* 与 .ghost-btn 同高（补足边框） */
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 201, 77, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}
.gold-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(255, 201, 77, 0.5); }
.gold-btn:active { transform: scale(0.96); }

.confirm-actions {
  margin-top: 24px;
  display: flex; align-items: center; justify-content: center;
  gap: 14px;
}
.confirm-actions button { flex: 1; }
.confirm-actions .ghost-btn { margin-top: 0; }

/* 抽奖弹层（复用 .modal-card） */
#lotteryModal {
  position: fixed; inset: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 24, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.45s;
}
#lotteryModal.show {
  opacity: 1; pointer-events: auto; visibility: visible;
  transition: opacity 0.3s ease;
}
#lotteryModal.show .modal-card {
  transform: scale(1); opacity: 1;
}
#lotteryModal.closing {
  opacity: 0; visibility: hidden;
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}
#lotteryModal.closing .modal-card {
  transform: scale(0.4); opacity: 0;
  transition: transform 0.45s ease, opacity 0.35s ease;
}

/* 抽奖确认弹层：在转盘弹层之上（点击开始/GO 后弹出） */
#lotteryConfirmModal {
  position: fixed; inset: 0; z-index: 1120;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 24, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.45s;
}
#lotteryConfirmModal.show {
  opacity: 1; pointer-events: auto; visibility: visible;
  transition: opacity 0.3s ease;
}
#lotteryConfirmModal.show .modal-card {
  transform: scale(1); opacity: 1;
}
#lotteryConfirmModal.closing {
  opacity: 0; visibility: hidden;
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}
#lotteryConfirmModal.closing .modal-card {
  transform: scale(0.4); opacity: 0;
  transition: transform 0.45s ease, opacity 0.35s ease;
}

/* 转盘 */
.wheel-wrap {
  position: relative;
  width: min(320px, 76vw);
  margin: 26px auto 6px;
}

.wheel {
  position: relative;
  width: 100%; aspect-ratio: 1;
  --r: calc(min(320px, 76vw) / 2); /* 转盘半径，label 定位以它为基准，随缩放跟随 */
  border-radius: 50%;
  background: conic-gradient(
    var(--gold) 0deg 60deg,
    var(--pink) 60deg 120deg,
    var(--teal) 120deg 180deg,
    #b39dff 180deg 240deg,
    #ff7a6b 240deg 300deg,
    #fff2c4 300deg 360deg
  );
  box-shadow: 0 0 34px rgba(255, 201, 77, 0.28), inset 0 0 0 6px rgba(11, 16, 38, 0.85), inset 0 0 0 9px rgba(255, 215, 110, 0.85);
}
.wheel.spinning { transition: transform 4.5s cubic-bezier(0.15, 0.6, 0.15, 1); will-change: transform; }

.wheel-label {
  position: absolute; left: 50%; top: 50%;
  width: 88px;
  margin-left: -44px;
  font-size: 13px; font-weight: 700; line-height: 1.45;
  text-align: center;
  color: #3a2500;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  pointer-events: none;
}
.wl-0 { transform: translateY(-50%) rotate(30deg) translateY(calc(var(--r) * -0.62)) rotate(-30deg); }
.wl-1 { transform: translateY(-50%) rotate(90deg) translateY(calc(var(--r) * -0.62)) rotate(-90deg); }
.wl-2 { transform: translateY(-50%) rotate(150deg) translateY(calc(var(--r) * -0.62)) rotate(-150deg); }
.wl-3 { transform: translateY(-50%) rotate(210deg) translateY(calc(var(--r) * -0.62)) rotate(-210deg); }
.wl-4 { transform: translateY(-50%) rotate(270deg) translateY(calc(var(--r) * -0.62)) rotate(-270deg); }
.wl-5 { transform: translateY(-50%) rotate(330deg) translateY(calc(var(--r) * -0.62)) rotate(-330deg); }

.wheel-pointer {
  position: absolute; top: -14px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 30px solid var(--gold-soft);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
  z-index: 5;
}

.wheel-hub {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 66px; height: 66px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(11, 16, 38, 0.92);
  border: 2px solid rgba(255, 215, 110, 0.8);
  color: var(--gold-soft);
  font-size: 17px; font-weight: 800; letter-spacing: 1px;
  font-family: inherit;
  cursor: pointer;
  z-index: 6;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}
.wheel-hub:hover { transform: translate(-50%, -50%) scale(1.08); box-shadow: 0 0 18px rgba(255, 201, 77, 0.55); border-color: var(--gold-soft); }
.wheel-hub:active { transform: translate(-50%, -50%) scale(0.96); }

#lotteryResult {
  margin-top: 14px;
  min-height: 24px;
  font-size: 15px; font-weight: 600; letter-spacing: 1px;
  color: var(--gold);
}

.modal-actions {
  margin-top: 14px;
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
}
.modal-actions button { flex: 1; }
.modal-actions .ghost-btn { margin-top: 0; }

/* ---------- 结果提示 ---------- */

#toast {
  position: fixed; left: 50%; top: 42px; z-index: 1150;
  transform: translateX(-50%) translateY(-16px);
  padding: 12px 26px;
  background: rgba(18, 25, 58, 0.92);
  border: 1px solid rgba(255, 215, 110, 0.45);
  border-radius: 14px;
  color: var(--text);
  font-size: 14px; letter-spacing: 1px;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */

@media (max-width: 560px) {
  #lockBox { padding: 26px 22px; }
  #giftBox { scale: 0.85; margin-bottom: 16px; }
  .cake { scale: 0.82; margin-top: 30px; }
  #birthdayScreen { padding-top: 26px; }
  .title { letter-spacing: 3px; }
  .action-btns button { padding: 12px 14px; font-size: 14px; letter-spacing: 2px; }
}

@media (orientation: landscape) and (max-height: 900px) {
  #birthdayScreen { padding: 8px 20px; }
  .title { font-size: clamp(18px, min(8vw, 8vh), 32px); letter-spacing: 4px; }
  .avatar-ring { width: clamp(84px, 22vh, 150px); padding: 5px; }
  .avatar-name { font-size: 12px; letter-spacing: 2px; }
  .cake { margin-top: 4px; scale: 0.78; }
  .cake-tip { font-size: 11px; letter-spacing: 1px; }
  .action-btns button { padding: 10px 24px; font-size: 14px; letter-spacing: 2px; }
  .wish-hint { font-size: 10px; }
  #lockBox { padding: 18px 30px; }
  #giftBox { scale: 0.85; margin-bottom: 10px; }
  .lock-title { font-size: 17px; }
  .lock-inputs { margin: 12px 0 16px; }
  .lock-inputs input { width: 68px; height: 38px; font-size: 18px; }
  .modal-card { padding: 22px 22px 18px; }
}

@media (orientation: landscape) and (max-height: 640px) {
  .title { font-size: clamp(16px, 6.5vh, 22px); letter-spacing: 3px; }
  .avatar-ring { width: clamp(64px, 18vh, 100px); }
  .avatar-name { font-size: 11px; }
  .cake { scale: 0.55; }
  .action-btns button { padding: 9px 18px; font-size: 13px; letter-spacing: 1px; }
  .lock-title { font-size: 15px; }
}
