:root {
  --bg: #04020a;
  --rose: #ff4f93;
  --rose-soft: #ff9bc4;
  --gold: #ffd79a;
  --violet: #9b6bff;
  --ink: #fff7fb;
  --ink-muted: rgba(255, 236, 246, 0.76);
  --glass: rgba(16, 8, 28, 0.68);
  --glass-strong: rgba(14, 7, 25, 0.86);
  --border: rgba(255, 206, 228, 0.24);
  --border-gold: rgba(255, 215, 154, 0.42);
  --font-serif: "Playfair Display", Georgia, serif;
  --font-sans: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
  --font-script: "Dancing Script", cursive;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100svh;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #160924 0%, #070311 58%, #020106 100%);
  color: var(--ink);
  font-family: var(--font-sans);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* WebGL 3D Canvas phủ toàn màn hình */
#universe-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  cursor: grab;
}

#universe-canvas:active {
  cursor: grabbing;
}

/* Vignette điện ảnh cực nhẹ ở viền */
.cinema-vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 48%, transparent 52%, rgba(3, 1, 8, 0.66) 100%);
}

/* Thanh trên cùng: Badge + Nhạc */
.top-bar {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.brand-pill,
.icon-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: transform 0.2s ease, border-color 0.25s ease, background 0.25s ease, opacity 0.35s ease;
}

.brand-pill {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.icon-pill {
  cursor: pointer;
}

.icon-pill:hover {
  border-color: var(--border-gold);
  background: rgba(34, 14, 52, 0.86);
}

.icon-pill:active {
  transform: scale(0.95);
}

.eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.eq-bars span {
  width: 2px;
  height: 4px;
  border-radius: 2px;
  background: var(--gold);
}

.icon-pill.is-playing .eq-bars span:nth-child(1) {
  animation: eq 0.8s ease-in-out infinite;
}
.icon-pill.is-playing .eq-bars span:nth-child(2) {
  animation: eq 0.62s ease-in-out 0.14s infinite;
}
.icon-pill.is-playing .eq-bars span:nth-child(3) {
  animation: eq 0.74s ease-in-out 0.26s infinite;
}

@keyframes eq {
  0%, 100% { height: 4px; }
  50% { height: 12px; }
}

/* ================= MÀN MỞ ĐẦU (PORTAL OVERLAY) ================= */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: radial-gradient(circle at 50% 50%, rgba(12, 4, 24, 0.35) 0%, rgba(4, 2, 10, 0.72) 100%);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.9s;
}

.intro-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.08);
  pointer-events: none;
}

.intro-box {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

.intro-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(28px, 6.2vw, 48px);
  line-height: 1.28;
  font-weight: 600;
  color: #fff;
  white-space: pre-line;
  text-shadow: 0 6px 32px rgba(255, 79, 147, 0.38), 0 2px 12px rgba(0, 0, 0, 0.85);
}

.intro-hint {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-muted);
  max-width: 400px;
}

.btn-portal {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 224, 184, 0.65);
  background: linear-gradient(135deg, #ff3e88 0%, #ff76ab 50%, #ffba86 100%);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 12px 42px rgba(255, 62, 136, 0.48), 0 0 24px rgba(255, 215, 154, 0.3);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.24s ease;
}

.btn-portal::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 75%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  transform: skewX(-22deg);
  animation: sheen 3s ease-in-out infinite;
}

@keyframes sheen {
  0%, 58% { left: -120%; }
  100% { left: 165%; }
}

.btn-portal:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 18px 52px rgba(255, 62, 136, 0.64), 0 0 32px rgba(255, 215, 154, 0.42);
}

.btn-portal:active {
  transform: scale(0.96);
}

/* ================= PHỤ ĐỀ ĐIỆN ẢNH SẮC NÉT (STORY HUD) ================= */
.story-hud {
  position: fixed;
  top: max(54px, calc(env(safe-area-inset-top) + 46px));
  left: 50%;
  transform: translateX(-50%);
  width: min(90vw, 520px);
  z-index: 15;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.story-hud.is-visible {
  opacity: 1;
}

.story-hud.is-switching {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
}

.story-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(18px, 3.6vw, 26px);
  font-weight: 500;
  line-height: 1.3;
  margin-top: 4px;
  color: #fff;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.92), 0 0 18px rgba(255, 110, 174, 0.38);
}

.story-sub {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 240, 248, 0.82);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.95);
}

.story-sub:empty {
  display: none;
}

/* ================= HỒI I: CÂU CHUYỆN DẪN DẮT PHẦN ĐẦU ================= */
.prologue-overlay {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 50%, rgba(14, 5, 28, 0.48), rgba(4, 2, 10, 0.78));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.75s ease, visibility 0.75s ease;
}

.prologue-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.prologue-card {
  width: min(92vw, 520px);
  padding: 32px 26px 26px;
  border-radius: 28px;
  border: 1px solid var(--border-gold);
  background: linear-gradient(165deg, rgba(24, 10, 40, 0.84), rgba(10, 4, 20, 0.9));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 46px rgba(255, 79, 147, 0.2);
  text-align: center;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.prologue-card.is-switching {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
}

.prologue-title {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(24px, 5.6vw, 34px);
  color: #fff;
  line-height: 1.3;
  text-shadow: 0 2px 20px rgba(255, 110, 174, 0.35);
}

.prologue-text {
  margin-top: 12px;
  font-size: clamp(14px, 3.4vw, 16px);
  line-height: 1.72;
  color: rgba(255, 240, 248, 0.9);
}

.prologue-controls {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prologue-dots {
  display: flex;
  align-items: center;
  gap: 7px;
}

.prologue-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  transition: width 0.35s ease, background 0.35s ease;
}

.prologue-dot.is-active {
  width: 24px;
  background: linear-gradient(90deg, var(--rose), var(--gold));
}

/* ================= HỒI III: PHONG THƯ 3D TƯƠNG TÁC ================= */
.envelope-stage {
  position: fixed;
  left: 50%;
  bottom: max(84px, calc(env(safe-area-inset-bottom) + 78px));
  transform: translateX(-50%) translateY(24px) scale(0.94);
  z-index: 27;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.65s;
}

.envelope-stage.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
  pointer-events: auto;
}

.envelope-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 26px;
  border-radius: 26px;
  border: 1px solid var(--border-gold);
  background: linear-gradient(165deg, rgba(24, 10, 40, 0.84), rgba(10, 4, 20, 0.9));
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.65), 0 0 42px rgba(255, 79, 147, 0.24);
  text-align: center;
}

.envelope-3d {
  position: relative;
  width: 176px;
  height: 116px;
  border: none;
  background: transparent;
  cursor: pointer;
  perspective: 700px;
  animation: envFloat 2.8s ease-in-out infinite;
  transition: transform 0.25s ease;
}

.envelope-3d:hover {
  transform: scale(1.06);
}

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

.env-back {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, #3a154d, #240c36);
  border: 1px solid rgba(255, 215, 154, 0.55);
  box-shadow: 0 12px 32px rgba(255, 79, 147, 0.35);
}

.env-paper {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 12px;
  bottom: 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff9f5, #fde7f0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.env-paper-line {
  width: 68%;
  height: 3px;
  border-radius: 4px;
  background: rgba(180, 90, 130, 0.32);
}

.env-paper-line.short {
  width: 44%;
}

.env-paper-heart {
  font-size: 16px;
  color: #ff448b;
  margin-top: 2px;
}

.env-pocket {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(160deg, #541d6b 0%, #341147 100%);
  clip-path: polygon(0 28%, 50% 66%, 100% 28%, 100% 100%, 0 100%);
  border-bottom: 1px solid rgba(255, 215, 154, 0.5);
}

.env-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 62%;
  background: linear-gradient(180deg, #6d2484, #491762);
  clip-path: polygon(0 0, 50% 92%, 100% 0);
  transform-origin: top center;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.env-seal {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff3e88, #ffd79a);
  box-shadow: 0 4px 18px rgba(255, 62, 136, 0.65);
  display: grid;
  place-items: center;
  font-size: 17px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.envelope-3d.is-opening .env-flap {
  transform: rotateX(175deg);
}

.envelope-3d.is-opening .env-paper {
  transform: translateY(-42px);
}

.envelope-3d.is-opening .env-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.4);
}

.envelope-hint {
  font-size: 13px;
  color: var(--ink-muted);
  max-width: 280px;
  line-height: 1.5;
}

/* Gợi ý nhỏ tương tác */
.interact-hint {
  position: fixed;
  bottom: max(84px, calc(env(safe-area-inset-bottom) + 76px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 16;
  font-size: 12px;
  color: rgba(255, 224, 240, 0.72);
  background: rgba(12, 5, 22, 0.52);
  border: 1px solid rgba(255, 206, 228, 0.16);
  padding: 6px 14px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.interact-hint.is-visible {
  opacity: 1;
}

/* ================= CAO TRÀO TỎ TÌNH (PROPOSAL BAR) ================= */
.proposal-bar {
  position: fixed;
  left: 50%;
  bottom: max(80px, calc(env(safe-area-inset-bottom) + 74px));
  transform: translateX(-50%) translateY(28px) scale(0.96);
  width: min(92vw, 490px);
  z-index: 26;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.65s;
}

.proposal-bar.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
  pointer-events: auto;
}

.proposal-card {
  padding: 20px 20px 18px;
  border-radius: 26px;
  border: 1px solid var(--border-gold);
  background: linear-gradient(165deg, rgba(24, 10, 38, 0.86), rgba(10, 4, 20, 0.92));
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.65), 0 0 42px rgba(255, 79, 147, 0.22);
  text-align: center;
}

.proposal-question {
  font-family: var(--font-serif);
  font-size: clamp(22px, 5.5vw, 30px);
  font-weight: 600;
  line-height: 1.28;
  margin-top: 6px;
  color: #fff;
  text-shadow: 0 2px 16px rgba(255, 79, 147, 0.35);
}

.proposal-subtext {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.proposal-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
}

.btn-yes {
  padding: 13px 26px;
  font-size: 15px;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.btn-no {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 234, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 236, 246, 0.9);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: left 0.24s cubic-bezier(0.22, 1, 0.36, 1), top 0.24s cubic-bezier(0.22, 1, 0.36, 1), transform 0.2s ease, background 0.2s ease;
}

.btn-no.is-floating {
  position: fixed;
  z-index: 42;
  background: rgba(26, 10, 42, 0.92);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.btn-no.is-converted {
  border-color: rgba(255, 224, 184, 0.7);
  background: linear-gradient(135deg, #ff3e88, #ff937e);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(255, 62, 136, 0.45);
}

/* ================= THANH DOCK ĐIỀU KHIỂN VŨ TRỤ 3D ================= */
.universe-dock {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(14, 6, 26, 0.78);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6), 0 0 28px rgba(255, 79, 147, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: calc(100vw - 16px);
  overflow-x: auto;
}

.universe-dock.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.dock-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.18s ease;
}

.dock-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.dock-btn:active {
  transform: scale(0.95);
}

.dock-btn.is-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 62, 136, 0.42), rgba(255, 186, 134, 0.28));
  border-color: rgba(255, 215, 154, 0.48);
  box-shadow: 0 4px 18px rgba(255, 62, 136, 0.3);
}

.dock-btn.dock-letter {
  background: linear-gradient(135deg, #ff478e, #ff937e);
  color: #fff;
  font-weight: 600;
}

/* ================= MODAL XEM CHI TIẾT BỨC ẢNH 3D ================= */
.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 2, 10, 0.72);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.photo-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.photo-card {
  position: relative;
  width: min(92vw, 390px);
  border-radius: 26px;
  padding: 14px 14px 20px;
  background: linear-gradient(165deg, rgba(28, 12, 42, 0.95), rgba(14, 6, 24, 0.96));
  border: 1px solid var(--border-gold);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.72), 0 0 46px rgba(255, 79, 147, 0.24);
  transform: scale(0.92) translateY(14px);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  text-align: center;
}

.photo-modal.is-open .photo-card {
  transform: scale(1) translateY(0);
}

.photo-card-img-wrap {
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 52dvh;
  border-radius: 18px;
  overflow: hidden;
  background: #140822;
}

.photo-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-card-tag {
  display: inline-block;
  margin-top: 14px;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

.photo-card-title {
  margin-top: 4px;
  font-family: var(--font-serif);
  font-size: 22px;
  color: #fff;
}

.photo-card-caption {
  margin-top: 6px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-muted);
  padding: 0 6px;
}

.photo-card-nav {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal-btn {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.18s ease;
}

.modal-btn:hover {
  background: rgba(255, 79, 147, 0.28);
}

.modal-btn:active {
  transform: scale(0.95);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(10, 4, 18, 0.78);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

/* ================= MODAL LÁ THƯ & VÉ KỶ NIỆM ================= */
.letter-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 2, 10, 0.76);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.letter-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.letter-shell {
  position: relative;
  width: min(94vw, 480px);
  max-height: 84dvh;
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  border: 1px solid var(--border-gold);
  background: linear-gradient(165deg, rgba(28, 12, 42, 0.94), rgba(12, 6, 22, 0.97));
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.72), 0 0 48px rgba(255, 79, 147, 0.24);
  overflow: hidden;
  transform: translateY(18px) scale(0.95);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.letter-modal.is-open .letter-shell {
  transform: translateY(0) scale(1);
}

.letter-header {
  padding: 20px 22px 12px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.letter-header h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  color: #fff;
}

.letter-body {
  padding: 18px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 14px;
  line-height: 1.75;
  color: rgba(255, 244, 250, 0.92);
}

.letter-salutation {
  font-family: var(--font-script);
  font-size: 28px;
  color: var(--gold);
  margin-bottom: 12px;
}

.letter-body p {
  margin-bottom: 12px;
}

.letter-sign {
  margin-top: 16px;
  text-align: right;
  font-style: italic;
  color: var(--rose-soft);
}

.letter-sign strong {
  display: block;
  font-style: normal;
  font-family: var(--font-serif);
  font-size: 16px;
  color: #fff;
  margin-top: 2px;
}

.letter-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-save-ticket {
  flex: 1;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 224, 184, 0.55);
  background: linear-gradient(135deg, #ff3e88, #ff867e);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(84px, calc(env(safe-area-inset-bottom) + 74px));
  transform: translate(-50%, 16px);
  z-index: 60;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(24, 10, 38, 0.95);
  border: 1px solid var(--border-gold);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 520px) {
  .dock-btn {
    padding: 9px 11px;
    font-size: 11.5px;
  }
  .brand-pill {
    display: none;
  }
}

/* =============================================================================
   MÀN GIÁ TREO HOA — "Chọn một bó, hoa sẽ bước ra."
   Atelier tối ấm espresso-tím; sân khấu (#bouquet-rack-mount) phủ TOÀN màn hình,
   tiêu đề / thẻ thủy tinh / chấm chọn nhanh nằm ở các góc, KHÔNG che thanh treo & bó hoa trung tâm.
   ============================================================================= */
.bouquet-overlay {
  --bq-gold-1: #fff2c6;
  --bq-gold-2: #d4a657;
  --bq-gold-3: #7a5722;
  --bq-edge: clamp(20px, 4vw, 56px);
  --bq-bottom: clamp(28px, 6vh, 56px);
  position: fixed;
  inset: 0;
  height: 100dvh;
  z-index: 43;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 25%, #2a1822 0%, #140a18 55%, #09040c 100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  touch-action: manipulation;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.bouquet-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.rack-open .top-bar {
  z-index: 50;
}

body.rack-open .brand-pill {
  opacity: 0;
}

body.rack-open .btn-no.is-floating {
  visibility: hidden;
}

/* Tường atelier: đèn rọi champagne từ trên + vân gỗ/vải dọc rất nhẹ + hơi hồng ở đáy */
.bq-wall {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 52% 40% at 50% 8%, rgba(255, 220, 160, 0.2), transparent 72%),
    radial-gradient(ellipse 80% 38% at 50% 104%, rgba(255, 79, 147, 0.12), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 235, 215, 0.022) 0 2px, transparent 2px 46px);
}

.bq-rack-mount {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

/* ---- Tiêu đề góc dưới-trái ---- */
.bq-header {
  position: absolute;
  z-index: 4;
  left: var(--bq-edge);
  bottom: var(--bq-bottom);
  max-width: min(360px, 34vw);
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s ease 0.2s, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}

.bouquet-overlay.is-open .bq-header {
  opacity: 1;
  transform: translateY(0);
}

.bq-title {
  margin-top: 8px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(26px, 3.2vw, 44px);
  line-height: 1.18;
  color: #fff7ea;
  text-shadow: 0 4px 28px rgba(212, 166, 87, 0.35), 0 2px 10px rgba(0, 0, 0, 0.7);
}

.bq-hint {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(255, 232, 214, 0.62);
}

/* ---- Thẻ thủy tinh góc dưới-phải ---- */
.bq-card {
  --accent: #ff8fb5;
  position: absolute;
  z-index: 5;
  right: var(--bq-edge);
  bottom: var(--bq-bottom);
  width: min(340px, 32vw);
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 16px;
  border-radius: 24px;
  border: 1px solid rgba(212, 166, 87, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 36%),
    linear-gradient(165deg, rgba(52, 28, 40, 0.84), rgba(20, 10, 26, 0.92));
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(212, 166, 87, 0.12),
    inset 0 1px 0 rgba(255, 240, 210, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s ease 0.3s, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.3s;
}

.bq-card::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.85;
}

.bouquet-overlay.is-open .bq-card {
  opacity: 1;
  transform: translateY(0);
}

.bq-prompt {
  padding: 6px 0 2px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.5;
  color: rgba(255, 232, 200, 0.84);
}

.bq-pick {
  display: none;
  flex-direction: column;
  gap: 6px;
}

.bq-card.has-pick .bq-prompt {
  display: none;
}

.bq-card.has-pick .bq-pick {
  display: flex;
}

.bq-card.is-pop .bq-pick {
  animation: bqPop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes bqPop {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.bq-card.is-shake {
  animation: bqShake 0.45s ease;
}

@keyframes bqShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

.bq-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.bq-counter {
  flex-shrink: 0;
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--bq-gold-2);
}

.bq-flowers {
  min-width: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 226, 180, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bq-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(20px, 2vw, 25px);
  line-height: 1.2;
  color: #fff;
}

.bq-meaning {
  font-size: 13px;
  line-height: 1.58;
  color: rgba(255, 236, 224, 0.82);
}

.bq-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.bq-confirm {
  width: 100%;
  padding: 13px 18px;
  font-size: 14px;
}

.bq-confirm:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  filter: saturate(0.5);
  box-shadow: none;
  transform: none;
}

.bq-confirm:disabled::after {
  display: none;
}

.bq-skip {
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: rgba(255, 232, 214, 0.6);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.bq-skip:hover {
  color: #fff;
}

/* ---- Chấm chọn nhanh ở giữa đáy ---- */
.bq-dots {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(20, 10, 24, 0.55);
  border: 1px solid rgba(212, 166, 87, 0.22);
}

.bq-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 236, 214, 0.34);
  cursor: pointer;
  position: relative;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;
}

/* tăng vùng chạm mà không đổi kích thước hiển thị */
.bq-dot::after {
  content: "";
  position: absolute;
  inset: -10px -4px;
}

.bq-dot:hover {
  background: rgba(255, 236, 214, 0.7);
}

.bq-dot.is-active {
  width: 26px;
  background: linear-gradient(90deg, var(--bq-gold-1), var(--bq-gold-2));
  box-shadow: 0 0 10px rgba(212, 166, 87, 0.55);
}

/* ---- Nút dock 💐 & bó hoa trong Tâm Thư ---- */
.dock-btn.dock-bouquet {
  border-color: rgba(212, 166, 87, 0.4);
  color: #fff2c6;
}

.letter-bouquet {
  --accent: #ff8fb5;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 0 4px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(212, 166, 87, 0.42);
  background: linear-gradient(135deg, rgba(212, 166, 87, 0.14), rgba(255, 79, 147, 0.07));
}

.letter-bouquet-thumb {
  flex: 0 0 auto;
  width: 54px;
  height: 80px;
  display: grid;
  place-items: center;
}

.letter-bouquet-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 12px var(--accent));
}

.letter-bouquet-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.letter-bouquet-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.letter-bouquet-info strong {
  font-family: var(--font-serif);
  font-size: 17px;
  color: #fff;
}

.letter-bouquet-info em {
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(255, 236, 224, 0.78);
}

/* Màn thấp (laptop 1280x720 trở xuống / điện thoại xoay ngang) */
@media (max-height: 640px) {
  .bq-card {
    gap: 10px;
    padding: 14px 18px 12px;
  }
  .bq-meaning {
    font-size: 12.5px;
    line-height: 1.5;
  }
  .bq-hint {
    display: none;
  }
}

@media (max-height: 520px) and (min-width: 821px) {
  .bq-header .eyebrow {
    display: none;
  }
  .bq-title {
    font-size: 22px;
  }
  .bq-meaning,
  .bq-flowers {
    display: none;
  }
  .bq-card {
    --bq-bottom: 40px;
  }
}

/* Điện thoại / tablet dọc: tiêu đề gọn góc trên-trái, thẻ gọn ở đáy, sân khấu nằm giữa */
@media (max-width: 820px) {
  .bouquet-overlay {
    --bq-card-h: 198px;
    --bq-edge: 14px;
  }

  .bq-rack-mount {
    inset: 66px 0 calc(var(--bq-card-h) + max(40px, calc(env(safe-area-inset-bottom) + 34px)) + 6px) 0;
  }

  .bq-header {
    top: max(14px, env(safe-area-inset-top));
    bottom: auto;
    left: 16px;
    max-width: calc(100% - 150px);
  }

  .bq-header .eyebrow {
    font-size: 9px;
    letter-spacing: 0.2em;
  }

  .bq-title {
    margin-top: 3px;
    font-size: 19px;
    line-height: 1.2;
  }

  .bq-hint {
    display: none;
  }

  .bq-card {
    left: 50%;
    right: auto;
    bottom: max(40px, calc(env(safe-area-inset-bottom) + 34px));
    width: min(94vw, 480px);
    min-width: 0;
    height: var(--bq-card-h);
    gap: 8px;
    padding: 14px 16px 12px;
    justify-content: space-between;
    transform: translate(-50%, 18px);
  }

  .bouquet-overlay.is-open .bq-card {
    transform: translate(-50%, 0);
  }

  .bq-card.is-shake {
    animation: none;
  }

  .bq-prompt {
    font-size: 15px;
  }

  .bq-name {
    font-size: 19px;
  }

  .bq-meaning {
    font-size: 12.5px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .bq-actions {
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .bq-confirm {
    flex: 1;
    width: auto;
    padding: 12px 14px;
    font-size: 13.5px;
  }

  .bq-skip {
    flex-shrink: 0;
    padding: 9px 6px;
    font-size: 12.5px;
  }

  .bq-dots {
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 8px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .bq-card,
  .bq-header,
  .bouquet-overlay {
    transition-duration: 0.01s;
    transition-delay: 0s;
  }
}

/* =============================================================================
   SÂN KHẤU GIÁ TREO HOA — visual của các phần tử do js/bouquet-rack.js dựng
   (.rack-rail .rack-item .rack-knot .rack-ribbon .rack-bouquet-body img .rack-dust)
   Hình học đọc từ CSS var --bq-w / --bq-ribbon trên #bouquet-rack-mount (responsive).
   !important để thắng style inline mặc định của module.
   ============================================================================= */
.bq-rack-mount {
  --bq-w: clamp(86px, 13.5vw, 190px);
  --bq-ribbon: clamp(54px, 11dvh, 120px);
  position: absolute !important;
  inset: 0;
  overflow: hidden !important;
  touch-action: manipulation;
}

.bq-spot {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
  background: radial-gradient(ellipse 34% 48% at 50% 52%, rgba(255, 214, 150, 0.24), rgba(255, 160, 120, 0.07) 55%, transparent 76%);
}

.bouquet-overlay.has-pick .bq-spot {
  opacity: 1;
}

/* Thanh ngang đồng vàng bóng 3D + 2 đầu bi + dây treo mảnh lên trần */
.rack-rail {
  left: clamp(12px, 4vw, 64px) !important;
  right: clamp(12px, 4vw, 64px) !important;
  height: 14px !important;
  margin-top: -7px;
  border-radius: 999px !important;
  background: linear-gradient(180deg, #fff2c6 0%, #d4a657 45%, #7a5722 100%) !important;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(212, 166, 87, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -2px 3px rgba(60, 36, 8, 0.5);
  pointer-events: none;
  z-index: 2;
}

.rack-rail::before,
.rack-rail::after {
  content: "";
  position: absolute;
  bottom: -6px;
  width: 26px;
  height: calc(13dvh + 24px);
  pointer-events: none;
  background:
    radial-gradient(circle at 36% 32%, #fffbe6 0%, #f0cf86 28%, #c9993f 60%, #6e4e1b 100%) bottom center / 26px 26px no-repeat,
    linear-gradient(90deg, transparent 12px, rgba(255, 226, 160, 0.78) 12px, rgba(160, 112, 40, 0.8) 14px, transparent 14px) top center / 26px calc(100% - 22px) no-repeat;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.5));
}

.rack-rail::before {
  left: -13px;
}

.rack-rail::after {
  right: -13px;
}

.rack-item {
  width: 0;
  height: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}

/* Nút thắt đồng nhỏ tại điểm treo */
.rack-knot {
  width: 12px !important;
  height: 12px !important;
  left: -6px !important;
  top: -6px !important;
  border-radius: 50% !important;
  background: radial-gradient(circle at 36% 32%, #fffbe6 0%, #f0cf86 30%, #c9993f 64%, #6e4e1b 100%) !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
  z-index: 3;
}

/* Dây lụa champagne mảnh */
.rack-ribbon {
  width: 3px !important;
  height: var(--bq-ribbon) !important;
  left: -1.5px !important;
  top: 0 !important;
  border-radius: 2px;
  background: linear-gradient(180deg, #f6ead0 0%, #dcc89c 60%, #b79f6c 100%) !important;
  box-shadow: 0 0 8px rgba(255, 232, 180, 0.28);
}

/* Thân bó hoa: PNG nền trong suốt, KHÔNG khung/viền/nền; chỉ có bóng đổ mềm sang trọng */
.rack-bouquet-body {
  left: calc(var(--bq-w) / -2) !important;
  top: var(--bq-ribbon) !important;
  width: var(--bq-w) !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  transform-origin: 50% 50%;
  will-change: transform;
}

.rack-bouquet-body img {
  display: block;
  width: 100% !important;
  height: auto !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  filter: drop-shadow(0 16px 20px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 18px rgba(255, 214, 150, 0.1));
  -webkit-user-drag: none;
  user-select: none;
}

/* Bụi vàng lấp lánh quanh bó hoa đang được trình bày */
.rack-dust {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, #fff6d6 0%, #e6bd6b 55%, transparent 100%);
}

@media (max-width: 820px) {
  .bq-rack-mount {
    --bq-w: clamp(64px, 19vw, 118px);
    --bq-ribbon: clamp(40px, 9dvh, 76px);
  }
  .rack-rail::before,
  .rack-rail::after {
    width: 20px;
    height: calc(13dvh + 20px);
    background:
      radial-gradient(circle at 36% 32%, #fffbe6 0%, #f0cf86 28%, #c9993f 60%, #6e4e1b 100%) bottom center / 20px 20px no-repeat,
      linear-gradient(90deg, transparent 9px, rgba(255, 226, 160, 0.78) 9px, rgba(160, 112, 40, 0.8) 11px, transparent 11px) top center / 20px calc(100% - 16px) no-repeat;
  }
  .rack-rail::before {
    left: -10px;
  }
  .rack-rail::after {
    right: -10px;
  }
}

@media (max-height: 520px) and (min-width: 821px) {
  .bq-rack-mount {
    --bq-w: clamp(70px, 16dvh, 120px);
    --bq-ribbon: clamp(34px, 9dvh, 56px);
  }
}


/* =============================================================================
   BẢN ĐỘT PHÁ "ONE-SHOT CINEMA" (QR LANDSCAPE-FIRST + CÁNH CỬA RỪNG HOA + SPLIT-STAGE)
   ============================================================================= */
:root {
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

/* Micro sound-cue khi mobile chặn autoplay nhạc nền */
.icon-pill.is-needs-unlock {
  border-color: rgba(255, 215, 154, 0.85);
  box-shadow: 0 0 18px rgba(255, 215, 154, 0.45);
  animation: soundCuePulse 1.8s ease-in-out infinite;
}

@keyframes soundCuePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 154, 0.35); transform: scale(1); }
  50% { box-shadow: 0 0 24px rgba(255, 215, 154, 0.78); transform: scale(1.04); }
}

/* ================= MÀN DẪN XOAY NGANG (CHỈ HIỆN TRÊN ĐIỆN THOẠI CẦM DỌC) ================= */
.rotate-guard {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 65% 45% at 50% 35%, rgba(255, 206, 138, 0.18), transparent 70%),
    linear-gradient(170deg, #16091e 0%, #090310 100%);
  text-align: center;
}

.rotate-guard.is-dismissed {
  display: none !important;
}

@media (orientation: portrait) and (max-width: 900px) {
  .rotate-guard {
    display: flex;
  }
}

.rotate-glow {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 154, 0.25), rgba(255, 79, 147, 0.08) 55%, transparent 72%);
  filter: blur(18px);
  pointer-events: none;
}

.rotate-box {
  position: relative;
  z-index: 2;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.rotate-phone {
  width: 44px;
  height: 76px;
  border-radius: 10px;
  border: 2px solid rgba(255, 224, 178, 0.85);
  background: rgba(255, 215, 154, 0.08);
  padding: 6px 4px;
  margin-bottom: 8px;
  box-shadow: 0 0 24px rgba(255, 215, 154, 0.28);
  animation: rotatePhoneHint 2.6s ease-in-out infinite;
}

.rotate-phone-screen {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(255, 215, 154, 0.35), rgba(255, 79, 147, 0.25));
}

@keyframes rotatePhoneHint {
  0%, 20% { transform: rotate(0deg); }
  55%, 80% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

.rotate-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 24px;
  color: #fff8ee;
  line-height: 1.25;
}

.rotate-sub {
  font-size: 13.5px;
  line-height: 1.6;
  color: rgba(255, 232, 216, 0.78);
}

.rotate-actions {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rotate-sound-btn {
  padding: 12px 22px;
  font-size: 13.5px;
}

/* ================= CẢNH 1: CÁNH CỬA BÍ MẬT GIỮA KHU RỪNG ĐẦY HOA ================= */
.door-portal-stage {
  position: fixed;
  inset: 0;
  z-index: 55;
  overflow: hidden;
  background: #0d0611;
  perspective: 1300px;
}

.door-camera {
  position: absolute;
  inset: 0;
  transform-origin: 50% 52%;
  will-change: transform;
}

.door-forest-bg {
  position: absolute;
  inset: -4%;
  background:
    radial-gradient(ellipse 42% 58% at 50% 50%, rgba(255, 215, 154, 0.22), rgba(18, 8, 24, 0.58) 54%, rgba(8, 3, 14, 0.92) 100%),
    url("./assets/forest-bg.jpg") center / cover no-repeat;
  filter: brightness(0.72) saturate(1.12);
}

/* Luồng sáng Volumetric God-Rays tràn từ khe cửa */
.door-rays {
  position: absolute;
  left: 50%;
  top: 52%;
  width: min(86vw, 960px);
  height: min(92dvh, 760px);
  transform: translate(-50%, -50%) scaleX(0.08);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  background:
    radial-gradient(ellipse 48% 58% at 50% 50%, rgba(255, 244, 212, 0.95) 0%, rgba(255, 210, 138, 0.62) 34%, rgba(255, 145, 180, 0.22) 62%, transparent 80%),
    conic-gradient(from -22deg at 50% 50%, transparent 0deg, rgba(255, 232, 180, 0.35) 14deg, transparent 28deg, rgba(255, 215, 150, 0.28) 44deg, transparent 62deg, rgba(255, 232, 180, 0.32) 195deg, transparent 215deg, rgba(255, 215, 150, 0.28) 235deg, transparent 260deg);
  will-change: transform, opacity;
}

.door-petals {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}

.door-petal {
  position: absolute;
  width: 11px;
  height: 15px;
  border-radius: 70% 30% 65% 35% / 65% 35% 65% 35%;
  background: radial-gradient(circle at 30% 30%, #fff0f5, #ff99ba 65%, #d64e82);
  opacity: 0.78;
  animation: doorPetalDrift var(--dur, 7s) linear var(--delay, 0s) infinite;
}

.door-firefly {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8dc 0%, #ffd27a 55%, transparent 100%);
  box-shadow: 0 0 10px rgba(255, 215, 140, 0.8);
  animation: doorFireflyFloat var(--dur, 5s) ease-in-out var(--delay, 0s) infinite alternate;
}

@keyframes doorPetalDrift {
  0% { transform: translate3d(0, -10dvh, 0) rotate(0deg); opacity: 0; }
  15% { opacity: 0.85; }
  85% { opacity: 0.75; }
  100% { transform: translate3d(var(--drift-x, 60px), 108dvh, 0) rotate(320deg); opacity: 0; }
}

@keyframes doorFireflyFloat {
  0% { transform: translate3d(0, 0, 0) scale(0.7); opacity: 0.25; }
  50% { opacity: 0.95; }
  100% { transform: translate3d(var(--fx, 22px), var(--fy, -26px), 0) scale(1.25); opacity: 0.4; }
}

/* Khung cửa mái vòm cổ điển 2 cánh 3D */
.door-assembly {
  position: absolute;
  left: 50%;
  top: 52%;
  width: clamp(170px, 24dvh * 0.68 + 90px, 270px);
  height: clamp(245px, 60dvh, 410px);
  transform: translate(-50%, -50%);
  perspective: 1100px;
  z-index: 3;
}

.door-inner-light {
  position: absolute;
  inset: 10px;
  border-radius: 999px 999px 10px 10px;
  background: radial-gradient(ellipse at 50% 48%, #fffdf5 0%, #ffe0a8 42%, #e09b5c 76%, #45211a 100%);
  box-shadow: 0 0 70px rgba(255, 215, 145, 0.65), inset 0 0 36px rgba(255, 255, 255, 0.9);
}

.door-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 999px 999px 12px 12px;
  border: 6px solid #c99b52;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.78),
    0 0 36px rgba(255, 214, 145, 0.3),
    inset 0 0 0 2px rgba(255, 240, 200, 0.55);
  display: flex;
  overflow: hidden;
  transform-style: preserve-3d;
}

.door-leaf {
  position: relative;
  width: 50%;
  height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 232, 190, 0.14), transparent 22%, rgba(0, 0, 0, 0.25) 100%),
    linear-gradient(135deg, #4b2822 0%, #2f1617 55%, #1f0d12 100%);
  border: 1px solid rgba(226, 184, 112, 0.42);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.55);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform;
}

.door-leaf-left {
  transform-origin: left center;
  border-right: 1px solid rgba(255, 224, 165, 0.55);
}

.door-leaf-right {
  transform-origin: right center;
  border-left: 1px solid rgba(255, 224, 165, 0.55);
}

.door-panel-ornament {
  position: absolute;
  inset: 14% 16% 12%;
  border-radius: 999px 999px 6px 6px;
  border: 1.5px solid rgba(235, 196, 128, 0.45);
  box-shadow: inset 0 0 14px rgba(255, 215, 145, 0.12);
}

.door-handle {
  position: absolute;
  top: 56%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7da, #d4a44f 65%, #7a541a);
  box-shadow: 0 0 10px rgba(255, 215, 145, 0.7);
}

.door-leaf-left .door-handle { right: 9px; }
.door-leaf-right .door-handle { left: 9px; }

.door-seam-glow {
  position: absolute;
  left: 50%;
  top: 6%;
  bottom: 4%;
  width: 6px;
  margin-left: -3px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, #fff7dd 20%, #ffd588 50%, #fff7dd 80%, transparent);
  box-shadow: 0 0 22px 6px rgba(255, 222, 158, 0.85);
  opacity: 0;
  pointer-events: none;
}

/* Vòm lá hoa tiền cảnh 2 bên tạo hiệu ứng chiều sâu khi zoom xuyên cửa */
.door-fg-arch {
  position: absolute;
  inset: -6%;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(ellipse 36% 75% at 0% 50%, rgba(18, 7, 22, 0.82) 0%, rgba(45, 16, 36, 0.45) 50%, transparent 78%),
    radial-gradient(ellipse 36% 75% at 100% 50%, rgba(18, 7, 22, 0.82) 0%, rgba(45, 16, 36, 0.45) 50%, transparent 78%),
    radial-gradient(ellipse 90% 24% at 50% 0%, rgba(14, 5, 18, 0.78), transparent 72%);
  will-change: transform, opacity;
}

.door-caption {
  position: absolute;
  left: 50%;
  bottom: max(28px, calc(var(--safe-b) + 20px));
  transform: translateX(-50%);
  z-index: 7;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(16px, 2.2vw, 22px);
  color: #fff6e6;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.85), 0 0 24px rgba(255, 215, 154, 0.45);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.door-skip {
  position: absolute;
  right: max(18px, var(--safe-r));
  bottom: max(18px, var(--safe-b));
  z-index: 8;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 226, 184, 0.28);
  background: rgba(18, 8, 26, 0.48);
  color: rgba(255, 238, 218, 0.72);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s;
}

.door-skip:hover {
  color: #fff;
  border-color: rgba(255, 226, 184, 0.65);
}

.door-light-wash {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 48%, #fffdf5 0%, #ffe6b8 45%, #d69856 100%);
  will-change: opacity;
}

/* ================= CẢNH 4: SPLIT-STAGE PHONG THƯ & TÂM THƯ (KHÔNG CHE TRÁI TIM 3D!) ================= */
.envelope-stage {
  left: 52%;
  right: max(20px, var(--safe-r));
  top: 50%;
  bottom: auto;
  transform: translateY(-44%) scale(0.95);
  width: auto;
}

.envelope-stage.is-visible {
  transform: translateY(-50%) scale(1);
}

.envelope-wrap {
  padding: 20px 24px;
  border-radius: 26px;
  background: rgba(18, 7, 30, 0.38);
  border: 1px solid rgba(255, 215, 154, 0.26);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Bỏ màn đen đặc che Trái Tim 3D ở nửa trái khi đọc Tâm Thư! */
.letter-modal {
  justify-content: flex-end;
  padding: max(14px, var(--safe-t)) max(22px, var(--safe-r)) max(14px, var(--safe-b)) max(14px, var(--safe-l));
  background: linear-gradient(90deg, transparent 0%, rgba(7, 3, 16, 0.14) 44%, rgba(7, 3, 16, 0.72) 100%);
}

.letter-shell {
  width: min(440px, 47dvw);
  max-height: 86dvh;
  background: linear-gradient(165deg, rgba(24, 10, 38, 0.74), rgba(12, 5, 22, 0.84));
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border: 1px solid rgba(255, 215, 154, 0.42);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 38px rgba(255, 120, 172, 0.16);
}

/* ================= CẢNH 5: KIỂU B — PHỤ ĐỀ ĐIỆN ẢNH 1/3 ĐÁY (75% TRÊN THOÁNG TRÁI TIM 3D!) ================= */
.proposal-bar {
  bottom: max(66px, calc(var(--safe-b) + 58px));
  width: min(86dvw, 560px);
}

.proposal-card {
  padding: 16px 24px 16px;
  border-radius: 24px;
  border: 1px solid rgba(255, 215, 154, 0.36);
  background: linear-gradient(180deg, rgba(16, 6, 28, 0.36), rgba(9, 4, 18, 0.68));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45), 0 0 34px rgba(255, 79, 147, 0.18);
}

.proposal-question {
  font-size: clamp(20px, 3.2vw, 30px);
}

/* ================= TỐI ƯU MOBILE XOAY NGANG (Y HỆT MÁY TÍNH TRÊN 844×390 / 915×412) ================= */
@media (orientation: landscape) and (max-height: 520px) {
  .top-bar {
    padding: max(8px, var(--safe-t)) max(14px, var(--safe-r)) 0 max(14px, var(--safe-l));
  }

  .brand-pill,
  .icon-pill {
    padding: 6px 12px;
    font-size: 11px;
  }

  .story-hud {
    top: max(42px, calc(var(--safe-t) + 34px));
  }

  .story-title {
    font-size: clamp(18px, 4.4dvh, 26px);
  }

  .interact-hint {
    bottom: max(48px, calc(var(--safe-b) + 42px));
    font-size: 10.5px;
    padding: 4px 11px;
  }

  .universe-dock {
    bottom: max(8px, var(--safe-b));
    padding: 4px 5px;
    gap: 4px;
  }

  .dock-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* Giá treo hoa trên điện thoại xoay ngang giữ đúng layout desktop: trái tiêu đề, phải thẻ, giữa hoa */
  .bouquet-overlay {
    --bq-edge: max(16px, var(--safe-l));
    --bq-bottom: max(12px, var(--safe-b));
  }

  .bq-rack-mount {
    inset: 0 !important;
    --bq-w: clamp(68px, 16dvh, 112px);
    --bq-ribbon: clamp(28px, 8dvh, 52px);
  }

  .bq-header {
    top: auto;
    bottom: max(14px, var(--safe-b));
    left: max(18px, var(--safe-l));
    max-width: 28dvw;
  }

  .bq-title {
    font-size: clamp(17px, 4.8dvh, 24px);
  }

  .bq-card {
    left: auto;
    right: max(18px, var(--safe-r));
    bottom: max(12px, var(--safe-b));
    width: min(290px, 34dvw);
    height: auto;
    padding: 11px 14px 10px;
    gap: 7px;
    transform: translateY(14px);
  }

  .bouquet-overlay.is-open .bq-card {
    transform: translateY(0);
  }

  .bq-name {
    font-size: 16px;
  }

  .bq-meaning {
    font-size: 11.5px;
    line-height: 1.4;
    -webkit-line-clamp: 2;
  }

  .bq-confirm {
    padding: 9px 12px;
    font-size: 12px;
  }

  .bq-dots {
    bottom: max(8px, var(--safe-b));
    padding: 4px 8px;
  }

  /* Split-stage Tâm thư & Phụ đề Tỏ tình trên mobile xoay ngang */
  .envelope-3d {
    width: 138px;
    height: 96px;
  }

  .envelope-wrap {
    padding: 12px 16px;
  }

  .letter-shell {
    width: min(390px, 50dvw);
    max-height: 90dvh;
  }

  .letter-header {
    padding: 12px 16px 8px;
  }

  .letter-body {
    padding: 10px 16px;
    font-size: 12.5px;
  }

  .letter-footer {
    padding: 10px 14px 12px;
  }

  .proposal-bar {
    bottom: max(46px, calc(var(--safe-b) + 40px));
    width: min(76dvw, 480px);
  }

  .proposal-card {
    padding: 10px 18px 11px;
  }

  .proposal-question {
    font-size: clamp(17px, 4.6dvh, 22px);
  }

  .proposal-subtext {
    font-size: 11.5px;
    margin-top: 3px;
  }

  .proposal-actions {
    margin-top: 9px;
    min-height: 38px;
    gap: 8px;
  }

  .btn-yes {
    padding: 8px 18px;
    font-size: 13px;
  }

  .btn-no {
    padding: 8px 14px;
    font-size: 12px;
  }
}


/* =============================================================================
   NÂNG CẤP TINH CHỈNH: CÁNH CỬA ẢNH THẬT PIXEL-PERFECT + PHONG THƯ UIVERSE KHÔNG HỘP
   + MŨI TÊN CHUYỂN 3 VÒNG ẢNH + MƯA CHỮ YÊU THƯƠNG KHI ĐỒNG Ý
   ============================================================================= */

/* 1. Khớp pixel-perfect 2 cánh cửa gỗ chạm khắc thật vào vòm đá hoa hồng 16:9 */
.door-scene-box {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: max(100vw, calc(100dvh * 16 / 9));
  height: max(100dvh, calc(100vw * 9 / 16));
  aspect-ratio: 16 / 9;
}

.door-forest-bg {
  position: absolute;
  inset: 0;
  background: url("./assets/enchanted-door-bg.jpg") center / 100% 100% no-repeat;
  filter: brightness(0.95) contrast(1.04);
}

.door-assembly {
  position: absolute;
  left: 41.2%;
  top: 24.2%;
  width: 17.6%;
  height: 50.0%;
  transform: none;
  perspective: 1100px;
  z-index: 3;
}

.door-inner-light {
  inset: 1%;
  border-radius: 50% 50% 4px 4px / 28% 28% 4px 4px;
  background: radial-gradient(ellipse at 50% 48%, #ffffff 0%, #fff0c2 38%, #f5b963 74%, #6a331d 100%);
  box-shadow: 0 0 90px 20px rgba(255, 224, 158, 0.72), inset 0 0 42px rgba(255, 255, 255, 0.95);
}

.door-frame {
  border: none;
  border-radius: 50% 50% 2px 2px / 28% 28% 2px 2px;
  box-shadow: none;
  background: transparent;
}

.door-leaf {
  border: none;
  box-shadow: none;
  background-color: #2c1610;
  background-image: url("./assets/door-leaves.jpg");
  background-size: 200% 100%;
  background-repeat: no-repeat;
}

.door-leaf-left {
  background-position: 0% 50%;
  border-right: none;
}

.door-leaf-right {
  background-position: 100% 50%;
  border-left: none;
}

.door-rays {
  left: 50%;
  top: 49%;
  width: 65%;
  height: 85%;
  z-index: 2;
}

/* 2. Phong Thư 3D Uiverse thả nổi KHÔNG HỘP KHUNG TO, nhỏ gọn ở góc phải dưới + nút tắt ✕ */
.envelope-stage {
  left: auto;
  right: max(28px, calc(var(--safe-r) + 18px));
  top: auto;
  bottom: max(84px, calc(var(--safe-b) + 74px));
  width: auto;
  transform: translate3d(-180px, -60px, 0) scale(0.45) rotate(-14deg);
  transition: opacity 0.75s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.75s;
}

.envelope-stage.is-visible {
  transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
}

.envelope-wrap {
  position: relative;
  padding: 6px 10px 4px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.env-dismiss {
  position: absolute;
  top: -8px;
  right: -4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 224, 184, 0.35);
  background: rgba(20, 8, 32, 0.65);
  color: rgba(255, 236, 224, 0.8);
  font-size: 12px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 6;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.env-dismiss:hover {
  background: rgba(255, 62, 136, 0.55);
  color: #fff;
  transform: scale(1.1);
}

.envelope-wrap .eyebrow {
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}

/* Phong thư kiểu Uiverse: giấy kem-ngà sang trọng + viền chỉ vàng + dấu sáp đỏ hồng */
.envelope-3d {
  width: 152px;
  height: 102px;
  animation: envFloatGentle 3.2s ease-in-out infinite;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 22px rgba(255, 215, 154, 0.32));
}

@keyframes envFloatGentle {
  0%, 100% { transform: translateY(0px) rotate(-1.5deg); }
  50% { transform: translateY(-7px) rotate(1.5deg); }
}

.env-back {
  background: linear-gradient(145deg, #f7ecdc 0%, #e6d1b5 100%);
  border: 1px solid rgba(212, 166, 87, 0.75);
}

.env-pocket {
  background: linear-gradient(160deg, #fff8ee 0%, #edd9bd 100%);
  border-bottom: 1.5px solid rgba(212, 166, 87, 0.8);
}

.env-flap {
  background: linear-gradient(180deg, #f3e2c8 0%, #e1c49d 100%);
  filter: drop-shadow(0 3px 5px rgba(80, 42, 16, 0.25));
}

.env-seal {
  width: 32px;
  height: 32px;
  font-size: 14px;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff6b9d, #d9235c 68%, #8f1038 100%);
  box-shadow: 0 4px 14px rgba(217, 35, 92, 0.65), inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

.envelope-hint {
  font-size: 11.5px;
  color: rgba(255, 238, 222, 0.85);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  max-width: 190px;
}

/* 3. Nút mũi tên mảnh chuyển 3 chế độ ảnh (Xoắn Ốc / Sao Thổ / Trái Tim) không phá xoay 3D */
.mode-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 18;
  width: 38px;
  height: 54px;
  border-radius: 999px;
  border: 1px solid rgba(255, 224, 184, 0.22);
  background: rgba(16, 6, 28, 0.32);
  color: rgba(255, 236, 220, 0.68);
  font-size: 26px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, background 0.25s, color 0.25s, transform 0.2s;
}

.mode-arrow.is-visible {
  opacity: 0.72;
  pointer-events: auto;
}

.mode-arrow:hover {
  opacity: 1;
  background: rgba(255, 79, 147, 0.28);
  border-color: rgba(255, 215, 154, 0.6);
  color: #fff;
}

.mode-arrow-prev {
  left: max(12px, var(--safe-l));
}

.mode-arrow-next {
  right: max(12px, var(--safe-r));
}

body.rack-open .mode-arrow {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* 4. Mưa Chữ Yêu Thương rơi liên tục sau khi bấm Em đồng ý */
.love-text-rain {
  position: fixed;
  inset: 0;
  z-index: 14;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.love-text-rain.is-active {
  opacity: 1;
}

.love-rain-word {
  position: absolute;
  top: -12vh;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  white-space: nowrap;
  color: #fff3dc;
  text-shadow:
    0 0 12px rgba(255, 102, 168, 0.85),
    0 0 26px rgba(255, 215, 154, 0.55),
    0 2px 6px rgba(0, 0, 0, 0.55);
  will-change: transform, opacity;
  animation: loveWordFall var(--rain-dur, 8s) linear var(--rain-delay, 0s) infinite;
}

@keyframes loveWordFall {
  0% {
    transform: translate3d(0, -10vh, 0) rotate(var(--rain-rot, 0deg));
    opacity: 0;
  }
  15% {
    opacity: 0.62;
  }
  82% {
    opacity: 0.54;
  }
  100% {
    transform: translate3d(var(--rain-drift, 30px), 116vh, 0) rotate(calc(var(--rain-rot, 0deg) * -1));
    opacity: 0;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .envelope-stage {
    right: max(18px, var(--safe-r));
    bottom: max(54px, calc(var(--safe-b) + 46px));
  }
  .envelope-3d {
    width: 122px;
    height: 82px;
  }
  .mode-arrow {
    width: 32px;
    height: 44px;
    font-size: 22px;
  }
}


/* =============================================================================
   TINH CHỈNH CUỐI: CAP NGẮN TỰ ẨN + DOCK SIÊU GỌN + PHONG THƯ & TÂM THƯ GIỮA MÀN HÌNH
   + ĐỒNG BỘ MÀU BÓ HOA EM CHỌN
   ============================================================================= */
:root {
  --theme-accent: #ff66a8;
}

/* 1. Caption ngắn gọn, nhỏ thanh thoát ở sát mép trên, tự ẩn sau 2.8s không che Trái Tim */
.story-hud {
  top: max(52px, calc(var(--safe-t) + 46px));
  max-width: min(84vw, 520px);
}

.story-hud .eyebrow {
  font-size: 9.5px;
  letter-spacing: 0.24em;
}

.story-title {
  margin-top: 3px;
  font-size: clamp(16px, 2.2vw, 24px);
  line-height: 1.25;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85), 0 0 18px rgba(255, 110, 175, 0.35);
}

/* 2. Thanh Dock siêu nhỏ gọn, mảnh mai, không chiếm chỗ */
.universe-dock {
  bottom: max(12px, var(--safe-b));
  padding: 4px 5px;
  gap: 3px;
  background: rgba(12, 5, 22, 0.64);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.45s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.universe-dock.is-visible {
  opacity: 0.82;
}

.universe-dock.is-visible:hover {
  opacity: 1;
}

.dock-btn {
  padding: 6px 10px;
  font-size: 11.5px;
  gap: 4px;
}

.interact-hint {
  bottom: max(56px, calc(var(--safe-b) + 48px));
  font-size: 11px;
  padding: 4px 12px;
}

/* 3. Phong Thư 3D nằm CHÍNH GIỮA PHÍA DƯỚI ngay dưới Trái Tim 3D (dễ thấy, gọn, có nút tắt ✕) */
.envelope-stage {
  left: 50%;
  right: auto;
  top: auto;
  bottom: max(64px, calc(var(--safe-b) + 56px));
  transform: translate3d(-50%, 34px, 0) scale(0.84);
}

.envelope-stage.is-visible {
  transform: translate3d(-50%, 0, 0) scale(1);
}

/* 4. Tâm Thư mở CHÍNH GIỮA MÀN HÌNH dễ đọc, vẫn thoáng mờ bầu trời sao phía sau */
.letter-modal {
  justify-content: center;
  align-items: center;
  padding: max(16px, var(--safe-t)) max(16px, var(--safe-r)) max(16px, var(--safe-b)) max(16px, var(--safe-l));
  background: radial-gradient(ellipse at 50% 50%, rgba(16, 6, 30, 0.42), rgba(6, 2, 14, 0.72));
}

.letter-shell {
  width: min(500px, 88vw);
  max-height: 84dvh;
  margin-right: 0;
  background: linear-gradient(165deg, rgba(26, 11, 42, 0.84), rgba(12, 5, 22, 0.90));
  border-color: rgba(255, 215, 154, 0.45);
}

/* 5. Mưa chữ yêu thương phát sáng theo đúng màu bó hoa em đã chọn */
.love-rain-word {
  text-shadow:
    0 0 12px var(--theme-accent, rgba(255, 102, 168, 0.88)),
    0 0 26px rgba(255, 215, 154, 0.52),
    0 2px 6px rgba(0, 0, 0, 0.55);
}

@media (orientation: landscape) and (max-height: 520px) {
  .envelope-stage {
    left: 50%;
    right: auto;
    bottom: max(46px, calc(var(--safe-b) + 40px));
  }
  .letter-shell {
    width: min(480px, 76dvw);
    max-height: 88dvh;
  }
}


/* =============================================================================
   PHONG THƯ RƠI NHẸ TỪ TRÊN TRỜI XUỐNG + DẤU SÁP ĐỔI MÀU THEO BÓ HOA EM CHỌN
   ============================================================================= */
.envelope-stage {
  left: 50%;
  right: auto;
  top: auto;
  bottom: max(62px, calc(var(--safe-b) + 54px));
  transform: translate3d(-50%, -115vh, 0) rotate(-11deg) scale(0.86);
  transition:
    opacity 1.1s ease,
    transform 2.4s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 1.1s;
}

.envelope-stage.is-visible {
  transform: translate3d(-50%, 0, 0) rotate(0deg) scale(1);
}

/* Dấu sáp phong thư mang sắc màu của bó hoa em vừa chọn */
.env-seal {
  background: radial-gradient(circle at 35% 30%, #fff2f6 0%, var(--theme-accent, #ff4f93) 52%, #7a1238 100%);
  box-shadow: 0 4px 16px var(--theme-accent, rgba(217, 35, 92, 0.65)), inset 0 1px 2px rgba(255, 255, 255, 0.55);
}


/* =============================================================================
   TỐI ƯU 60FPS GPU: TẮT BACKDROP-FILTER BLUR ĐÈ LÊN WEBGL CANVAS ĐỂ CHỐNG TỤT FPS
   ============================================================================= */
.universe-dock,
.proposal-card,
.letter-shell {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.universe-dock {
  background: rgba(14, 6, 26, 0.84);
}

.proposal-card {
  background: linear-gradient(180deg, rgba(18, 7, 32, 0.62), rgba(10, 4, 20, 0.84));
}

.letter-shell {
  background: linear-gradient(165deg, rgba(24, 10, 40, 0.90), rgba(12, 5, 22, 0.95));
}
