:root {
  /* 深夜台灯：琥珀暖光，少冷蓝 */
  --lamp: #E8A86A;
  --lamp-soft: rgba(232, 168, 106, 0.22);
  --lamp-glow: rgba(255, 160, 90, 0.35);
  --rose: #FF5A7A;
  --rose-deep: #C73A55;
  --glass: rgba(32, 24, 20, 0.78);
  --glass-border: rgba(255, 210, 170, 0.16);
  --bubble-her: rgba(48, 36, 30, 0.9);
  --bubble-me: linear-gradient(145deg, #FF6B84, #D94A62);
  --scrim-deep: rgba(12, 8, 6, 0.94);
  --ios-pink: #FF5A7A;
  --ios-blue: #E8A86A;
}

.phone-frame {
  position: relative; width: 100%; max-width: 430px; height: 100dvh; overflow: hidden;
  background: #100c0a;
}

/* 背景人物层：模糊 → 半清 → 全清，叠加呼吸缩放 */
.bg-visual {
  position: absolute; inset: -20px; overflow: hidden;
  filter: blur(28px) brightness(0.58) saturate(1.05);
  transform: scale(1.08);
  transition: filter 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 3s ease;
  animation: breathe 8s infinite alternate ease-in-out;
}
.bg-visual::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 80% 55% at 50% 35%, rgba(255, 170, 100, 0.14), transparent 70%);
  opacity: 0.55; transition: opacity 0.9s ease;
}
@keyframes breathe { 0% { transform: scale(1.06); } 100% { transform: scale(1.13); } }
.bg-visual.step-2 { filter: blur(12px) brightness(0.7) saturate(1.08); }
.bg-visual.step-2::after { opacity: 0.75; }
.bg-visual.step-3 { filter: blur(0px) brightness(0.82) saturate(1.1); }
.bg-visual.step-3::after { opacity: 1; }
.bg-visual.unlock-flash::after {
  animation: lampFlash 0.7s ease-out;
}
@keyframes lampFlash {
  0% { opacity: 1; background: radial-gradient(circle at 50% 40%, rgba(255, 190, 120, 0.45), transparent 60%); }
  100% { opacity: 1; }
}

.top-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
  font-size: 12px; color: rgba(255, 230, 210, 0.72);
}

.ios-notification {
  position: absolute; top: calc(44px + env(safe-area-inset-top)); left: 14px; right: 14px; z-index: 20;
  background: rgba(42, 32, 28, 0.86); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border); border-radius: 22px; padding: 12px 15px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 40px rgba(255, 140, 80, 0.08);
  animation: slideDown 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes slideDown { from { transform: translateY(-80px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.avatar-sm {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
  border: 1.5px solid var(--lamp); box-shadow: 0 0 0 2px rgba(232, 168, 106, 0.2);
}
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.notif-time { font-size: 12px; color: rgba(255, 210, 170, 0.5); font-weight: 400; flex-shrink: 0; }
.notif-desc { font-size: 13px; color: rgba(255, 235, 220, 0.88); margin-top: 2px; }

.center-stage {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 20px; padding-top: calc(20px + env(safe-area-inset-top)); z-index: 20;
}
.ios-card {
  width: 100%; max-width: 340px; background: var(--glass);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border); border-radius: 26px;
  padding: 24px 20px; text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 220, 180, 0.08);
}
.badge-18 {
  display: inline-block; background: rgba(255, 90, 122, 0.16); color: #FF7A92;
  border: 1px solid rgba(255, 90, 122, 0.4); font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 12px; margin-bottom: 12px; letter-spacing: 0.5px;
}
.card-title { font-size: 19px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.3px; color: #FFF6EE; }
.card-sub { font-size: 14px; color: rgba(255, 230, 210, 0.72); line-height: 1.45; margin-bottom: 20px; }

.btn-stack { display: flex; flex-direction: column; gap: 10px; }
.ios-btn {
  width: 100%; min-height: 48px; padding: 14px 16px; border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 220, 180, 0.1); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease, box-shadow 0.2s ease;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  -webkit-user-select: none; touch-action: manipulation;
}
.ios-btn:active { transform: scale(0.96); background: rgba(255, 220, 180, 0.2); }
.ios-btn.primary {
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  border: none; box-shadow: 0 6px 22px rgba(255, 90, 122, 0.38);
}
.ios-btn.primary:active { box-shadow: 0 3px 12px rgba(255, 90, 122, 0.28); }
.ios-btn.secondary {
  color: rgba(255, 230, 210, 0.55); font-weight: 400; font-size: 13px;
  background: transparent; border: none; padding: 10px; min-height: 44px;
}

/* —— 聊天舞台 —— */
.chat-stage {
  position: absolute; inset: 0; display: none; flex-direction: column; justify-content: flex-end;
  padding: 12px 14px calc(18px + env(safe-area-inset-bottom));
  padding-top: calc(52px + env(safe-area-inset-top));
  z-index: 25;
  background: linear-gradient(
    to top,
    var(--scrim-deep) 12%,
    rgba(18, 12, 10, 0.55) 48%,
    rgba(18, 12, 10, 0.12) 78%,
    transparent 100%
  );
}

.unlock-rail {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 18px; right: 18px;
  height: 3px; border-radius: 99px; background: rgba(255, 210, 170, 0.12);
  overflow: hidden; z-index: 26;
}
.unlock-rail.pulse { box-shadow: 0 0 12px var(--lamp-glow); }
.unlock-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--lamp), var(--rose));
  border-radius: inherit;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 10px var(--lamp-glow);
}

.chat-messages {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 12px; max-height: 52dvh; overflow-y: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 4px 2px;
}
.msg-bubble {
  max-width: 82%; padding: 12px 15px; border-radius: 20px; font-size: 15px; line-height: 1.42;
  background: var(--bubble-her); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  align-self: flex-start; border-bottom-left-radius: 5px;
  color: #FFF4EA;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  animation: msgIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.msg-bubble.user {
  align-self: flex-end;
  background: var(--bubble-me);
  border-bottom-left-radius: 20px; border-bottom-right-radius: 5px;
  border: none; color: #fff;
  box-shadow: 0 6px 18px rgba(255, 90, 122, 0.28);
}
@keyframes msgIn {
  from { transform: translateY(12px) scale(0.94); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.typing-dots { display: inline-flex; gap: 4px; align-items: center; height: 18px; padding: 0 4px; }
.typing-dots span {
  width: 7px; height: 7px; background: rgba(255, 210, 170, 0.65); border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

.voice-bar { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 180px; min-height: 36px; }
.play-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(145deg, var(--lamp), #C87840);
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: #1a100c;
  box-shadow: 0 2px 10px rgba(232, 168, 106, 0.4);
  flex-shrink: 0;
}
.wave-lines { display: flex; align-items: center; gap: 3px; flex: 1; height: 20px; }
.wave-lines i { display: block; width: 3px; background: rgba(255, 230, 200, 0.75); border-radius: 2px; transition: height 0.2s; }
.voice-playing .wave-lines i { animation: waveAnim 0.5s infinite alternate; background: var(--lamp); }
.voice-playing .play-icon { box-shadow: 0 0 14px var(--lamp-glow); }
@keyframes waveAnim { from { height: 5px; } to { height: 18px; } }
.voice-len { font-size: 12px; color: rgba(255, 220, 190, 0.6); }

/* 输入 / 快捷回复区 */
.composer {
  background: rgba(28, 20, 16, 0.72);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  padding: 10px;
  box-shadow: 0 -4px 28px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 220, 180, 0.06);
}
.composer:has(.quick-replies:empty) { display: none; }
.quick-replies { display: flex; flex-direction: column; gap: 8px; }
.reply-chip {
  min-height: 48px;
  background: rgba(255, 220, 180, 0.1);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 210, 170, 0.28); color: #FFF6EE;
  padding: 13px 16px; border-radius: 16px; font-size: 15px; font-weight: 600;
  text-align: center; cursor: pointer;
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), background 0.18s ease, border-color 0.18s ease;
  display: flex; align-items: center; justify-content: center;
  -webkit-user-select: none; touch-action: manipulation;
}
.reply-chip:active {
  transform: scale(0.97);
  background: rgba(255, 90, 122, 0.55);
  border-color: rgba(255, 90, 122, 0.65);
}
.composer .ios-btn { border-radius: 14px; }

/* CTA 出现时轻呼吸 */
.composer .ios-btn.primary {
  animation: ctaGlow 2.4s ease-in-out infinite;
}
@keyframes ctaGlow {
  0%, 100% { box-shadow: 0 6px 22px rgba(255, 90, 122, 0.38); }
  50% { box-shadow: 0 8px 28px rgba(255, 140, 100, 0.5); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-visual { animation: none; }
  .msg-bubble, .ios-notification { animation: none; }
  .composer .ios-btn.primary { animation: none; }
  .typing-dots span, .voice-playing .wave-lines i { animation: none; }
}
