
:root {
  --wine: #5c1a24;
  --wine-deep: #3d0f17;
  --wine-light: #8b3040;
  --rose: #c4787a;
  --rose-soft: #e8b4b6;
  --gold: #c9a227;
  --gold-light: #e8d48b;
  --gold-pale: #f5ecd3;
  --champagne: #faf3e8;
  --ivory: #fffdf8;
  --cream: #f7f0e4;
  --text: #2c1810;
  --text-soft: #6b4f45;
  --text-muted: #9a8078;
  --shadow-wine: rgba(92, 26, 36, 0.25);
  --shadow-gold: rgba(201, 162, 39, 0.2);
  --radius: 2px;
  --font-serif: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Serif SC", "STSong", serif;
  --font-calligraphy: var(--font-names);
  --font-names: "STKaiti", "KaiTi", "PingFang SC", serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-serif);
  background: var(--wine-deep);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* ─── Background ─── */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(139, 48, 64, 0.5) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(201, 162, 39, 0.08) 0%, transparent 50%),
    linear-gradient(180deg, var(--wine-deep) 0%, #2a0a10 50%, var(--wine-deep) 100%);
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: glowPulse 8s ease-in-out infinite;
}

.bg-glow-1 {
  width: 300px;
  height: 300px;
  background: var(--rose);
  top: 10%;
  left: -10%;
}

.bg-glow-2 {
  width: 250px;
  height: 250px;
  background: var(--gold);
  bottom: 20%;
  right: -5%;
  animation-delay: -4s;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.1); }
}

/* Floating petals */
.petals span {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--rose-soft);
  border-radius: 50% 0 50% 50%;
  opacity: 0;
  animation: petalFall linear infinite;
}

.petals span:nth-child(1) { left: 10%; animation-duration: 12s; animation-delay: 0s; width: 6px; height: 6px; }
.petals span:nth-child(2) { left: 25%; animation-duration: 15s; animation-delay: 2s; }
.petals span:nth-child(3) { left: 40%; animation-duration: 11s; animation-delay: 4s; width: 5px; height: 5px; }
.petals span:nth-child(4) { left: 55%; animation-duration: 14s; animation-delay: 1s; }
.petals span:nth-child(5) { left: 70%; animation-duration: 13s; animation-delay: 3s; width: 7px; height: 7px; }
.petals span:nth-child(6) { left: 85%; animation-duration: 16s; animation-delay: 5s; }
.petals span:nth-child(7) { left: 15%; animation-duration: 18s; animation-delay: 7s; width: 4px; height: 4px; }
.petals span:nth-child(8) { left: 60%; animation-duration: 10s; animation-delay: 6s; }

@keyframes petalFall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.3; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ─── Envelope Overlay ─── */
.envelope-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(45, 10, 16, 0.95);
  transition: opacity 0.8s ease, visibility 0.8s ease;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.envelope-overlay.opening {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope {
  position: relative;
  width: 280px;
  animation: envelopeFloat 3s ease-in-out infinite;
}

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

.envelope-body {
  width: 280px;
  height: 180px;
  background: linear-gradient(145deg, var(--champagne) 0%, var(--cream) 100%);
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid rgba(201, 162, 39, 0.3);
}

.envelope-flap {
  position: absolute;
  top: -60px;
  left: 0;
  width: 0;
  height: 0;
  border-left: 140px solid transparent;
  border-right: 140px solid transparent;
  border-bottom: 60px solid var(--gold-pale);
  filter: drop-shadow(0 -2px 4px rgba(0,0,0,0.1));
  transform-origin: top center;
  transition: transform 0.6s ease;
}

.envelope-overlay.opening .envelope-flap {
  transform: rotateX(180deg);
}

.seal {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--wine-light), var(--wine));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--shadow-wine), inset 0 2px 4px rgba(255,255,255,0.15);
  animation: sealPulse 2s ease-in-out infinite;
}

.seal span {
  font-family: var(--font-calligraphy);
  font-size: 2rem;
  color: var(--gold-light);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

@keyframes sealPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 20px var(--shadow-wine); }
  50% { transform: scale(1.05); box-shadow: 0 6px 30px var(--shadow-wine), 0 0 20px rgba(201,162,39,0.3); }
}

.envelope-hint {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  animation: hintBlink 2s ease-in-out infinite;
}

@keyframes hintBlink {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ─── Page Layout ─── */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(1.5rem + var(--safe-top)) 0 calc(3rem + var(--safe-bottom));
  opacity: 1;
  transition: opacity 0.6s ease 0.3s;
  -webkit-overflow-scrolling: touch;
}

.page.hidden {
  opacity: 0;
  pointer-events: none;
}

.letter-wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 1rem;
}

.letter-frame {
  position: relative;
  background: linear-gradient(180deg, var(--ivory) 0%, var(--champagne) 50%, var(--cream) 100%);
  border: 1px solid rgba(201, 162, 39, 0.35);
  box-shadow:
    0 0 0 4px rgba(201, 162, 39, 0.08),
    0 0 0 8px rgba(201, 162, 39, 0.04),
    0 30px 80px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  padding: 0.5rem;
}

/* Corner decorations */
.corner {
  position: absolute;
  width: 32px;
  height: 32px;
  z-index: 2;
  pointer-events: none;
}

.corner::before,
.corner::after {
  content: "";
  position: absolute;
  background: var(--gold);
  opacity: 0.6;
}

.corner-tl { top: 12px; left: 12px; }
.corner-tl::before { top: 0; left: 0; width: 20px; height: 1px; }
.corner-tl::after { top: 0; left: 0; width: 1px; height: 20px; }

.corner-tr { top: 12px; right: 12px; }
.corner-tr::before { top: 0; right: 0; width: 20px; height: 1px; }
.corner-tr::after { top: 0; right: 0; width: 1px; height: 20px; }

.corner-bl { bottom: 12px; left: 12px; }
.corner-bl::before { bottom: 0; left: 0; width: 20px; height: 1px; }
.corner-bl::after { bottom: 0; left: 0; width: 1px; height: 20px; }

.corner-br { bottom: 12px; right: 12px; }
.corner-br::before { bottom: 0; right: 0; width: 20px; height: 1px; }
.corner-br::after { bottom: 0; right: 0; width: 1px; height: 20px; }

.container {
  padding: 2rem 1.5rem 1.5rem;
}

/* ─── Header ─── */
.invite-header {
  text-align: center;
  padding-bottom: 0.5rem;
}

.top-ornament {
  color: var(--gold);
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

.ornament-svg {
  width: 160px;
  height: 32px;
}

.eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.title-calligraphy {
  font-family: var(--font-calligraphy);
  font-size: 3rem;
  font-weight: 400;
  color: var(--wine);
  line-height: 1.2;
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 8px var(--shadow-gold);
}

.names-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.name {
  font-family: var(--font-names);
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--wine);
  letter-spacing: 0.08em;
  line-height: 1.3;
}

.name-connector {
  color: #d43838;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: heartBeat 1.3s ease-in-out infinite;
  transform-origin: center center;
  filter: drop-shadow(0 2px 6px rgba(212, 56, 56, 0.35));
}

.name-connector svg {
  display: block;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.22); }
  24% { transform: scale(1); }
  36% { transform: scale(1.14); }
  48% { transform: scale(1); }
}

.poem-box {
  position: relative;
  padding: 1.25rem 1rem;
  margin: 0 auto;
  max-width: 320px;
}

.poem-box::before,
.poem-box::after {
  content: """;
  font-family: var(--font-calligraphy);
  font-size: 3rem;
  color: var(--gold);
  opacity: 0.25;
  position: absolute;
  line-height: 1;
}

.poem-box::before { top: -0.25rem; left: -0.5rem; content: "\201C"; }
.poem-box::after { bottom: -1rem; right: -0.5rem; content: "\201D"; }

.poem-box p {
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 2;
  letter-spacing: 0.08em;
}

/* ─── Cards ─── */
.card {
  margin-bottom: 1.25rem;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: var(--delay, 0s);
}

.card.revealed {
  opacity: 1;
  transform: translateY(0);
}

.card-inner {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(201, 162, 39, 0.2);
  padding: 1.5rem 1.25rem;
  position: relative;
}

.card-inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
  opacity: 0.5;
}

.section-title {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--wine);
  letter-spacing: 0.25em;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.title-deco {
  color: var(--gold);
  font-size: 0.6rem;
  opacity: 0.7;
}

/* ─── Countdown ─── */
.countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.countdown-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 58px;
  padding: 0.75rem 0.5rem 0.6rem;
  background: linear-gradient(180deg, #fff 0%, var(--gold-pale) 100%);
  border: 1px solid rgba(201, 162, 39, 0.35);
  box-shadow: 0 4px 12px var(--shadow-gold), inset 0 1px 0 rgba(255,255,255,0.9);
  position: relative;
}

.countdown-box::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  right: 4px;
  height: 1px;
  background: rgba(201, 162, 39, 0.15);
}

.countdown-box .number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--wine);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
}

.countdown-box .unit {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  letter-spacing: 0.15em;
}

.countdown-colon {
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--gold);
  padding-bottom: 0.5rem;
  animation: colonBlink 1s step-end infinite;
}

@keyframes colonBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ─── Event Info ─── */
.info-cards {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 0.5rem;
}

.info-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--wine) 0%, var(--wine-light) 100%);
  border-radius: 50%;
  color: var(--gold-light);
}

.info-icon svg {
  width: 20px;
  height: 20px;
}

.info-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.info-value {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.5;
}

.info-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,162,39,0.3), transparent);
  margin: 0 0.5rem;
}

/* ─── Tabs ─── */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  background: rgba(201, 162, 39, 0.06);
  padding: 4px;
  border: 1px solid rgba(201, 162, 39, 0.15);
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.5rem;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.tab svg {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.tab.active {
  background: #fff;
  color: var(--wine);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.tab.active svg {
  opacity: 1;
  color: var(--wine);
}

.tab-panel {
  display: none;
  animation: panelIn 0.35s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Form ─── */
.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.08em;
}

.input-wrap {
  position: relative;
}

.input-wrap::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--rose-soft));
  transform: scaleX(0);
  transition: transform 0.3s ease;
  transform-origin: left;
}

.input-wrap:focus-within::after {
  transform: scaleX(1);
}

.form-group input {
  width: 100%;
  padding: 0.8rem 0.75rem;
  border: none;
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
  background: rgba(255, 255, 255, 0.5);
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  transition: background 0.2s;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.85);
}

.form-group input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* ─── Room Grid ─── */
.room-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.room-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1rem;
}

.room-option {
  position: relative;
}

.room-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.room-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.7rem 0.4rem;
  border: 1px solid rgba(201, 162, 39, 0.25);
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
}

.room-option label .room-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--wine);
}

.room-option label .room-count {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.room-option input:checked + label {
  border-color: var(--wine);
  background: linear-gradient(135deg, rgba(92,26,36,0.08) 0%, rgba(201,162,39,0.08) 100%);
  box-shadow: 0 0 0 2px rgba(92, 26, 36, 0.12), 0 4px 12px var(--shadow-wine);
  transform: translateY(-2px);
}

.room-option label:hover {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.7);
}

/* ─── Buttons ─── */
.btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  overflow: hidden;
  margin-top: 0.5rem;
}

.btn span {
  display: block;
  padding: 0.95rem;
  font-size: 0.95rem;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
  position: relative;
  z-index: 1;
  touch-action: manipulation;
}

.btn-primary {
  background: linear-gradient(135deg, var(--wine) 0%, var(--wine-light) 50%, var(--wine) 100%);
  background-size: 200% 100%;
  color: var(--gold-light);
  box-shadow: 0 6px 24px var(--shadow-wine);
  transition: box-shadow 0.3s, background-position 0.4s;
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s;
}

.btn-primary:hover {
  background-position: 100% 0;
  box-shadow: 0 8px 32px var(--shadow-wine);
}

.btn-primary:hover::before {
  transform: translateX(100%);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ─── Query Result ─── */
.query-result {
  margin-top: 1.25rem;
  padding: 0;
  background: #fff;
  border: 1px solid rgba(201, 162, 39, 0.25);
  display: none;
  overflow: hidden;
}

.query-result.show {
  display: block;
  animation: panelIn 0.4s ease;
}

.query-result-header {
  background: linear-gradient(135deg, var(--wine) 0%, var(--wine-light) 100%);
  color: var(--gold-light);
  text-align: center;
  padding: 0.65rem;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
}

.query-result .result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.1);
}

.query-result .result-row:last-child {
  border-bottom: none;
}

.query-result .result-row.hidden {
  display: none;
}

.query-result .key {
  color: var(--text-muted);
}

.query-result .val {
  color: var(--text);
  font-weight: 500;
}

.query-result .val.highlight {
  color: var(--wine);
  font-weight: 700;
}

.query-result .val.muted {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.88rem;
}

.query-multiple {
  margin-top: 0.75rem;
}

.query-multiple-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.query-multiple-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.query-multiple-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(201, 162, 39, 0.25);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: left;
}

.query-multiple-item:hover {
  border-color: rgba(201, 162, 39, 0.5);
  background: rgba(201, 162, 39, 0.08);
}

.query-multiple-item .name {
  font-weight: 600;
  color: var(--gold-light);
}

.query-multiple-item .meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ─── Background music toggle ─── */
.music-toggle {
  position: fixed;
  top: calc(1rem + var(--safe-top));
  right: calc(1rem + var(--safe-right));
  z-index: 200;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(61, 15, 23, 0.72);
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
}

.music-toggle:hover {
  transform: scale(1.05);
  border-color: rgba(201, 162, 39, 0.6);
  background: rgba(92, 26, 36, 0.85);
}

.music-toggle:active {
  transform: scale(0.96);
}

.music-toggle .icon-music-off {
  display: none;
}

.music-toggle.off {
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(44, 24, 16, 0.55);
}

.music-toggle.off .icon-music-on {
  display: none;
}

.music-toggle.off .icon-music-off {
  display: block;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: var(--wine);
  color: var(--gold-light);
  padding: 0.85rem 1.75rem;
  font-size: 0.88rem;
  z-index: 1000;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  max-width: 90%;
  text-align: center;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  border: 1px solid rgba(201, 162, 39, 0.2);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  background: linear-gradient(135deg, #2d5a3d, #3d7a52);
}

.toast.error {
  background: linear-gradient(135deg, var(--wine-deep), var(--wine));
}

/* ─── Footer ─── */
.footer {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: var(--delay, 0s);
}

.footer.revealed {
  opacity: 1;
  transform: translateY(0);
}

.footer-ornament {
  color: var(--gold);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}

.footer p {
  font-size: 0.9rem;
  color: var(--text-soft);
  letter-spacing: 0.15em;
}

.footer-sub {
  margin-top: 0.35rem;
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
  letter-spacing: 0.2em !important;
}

/* ─── Reveal animation ─── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .title-calligraphy {
    font-size: 2.4rem;
  }

  .names-block .name {
    font-size: 1.5rem;
  }

  .countdown-box {
    min-width: 48px;
    padding: 0.6rem 0.35rem 0.5rem;
  }

  .countdown-box .number {
    font-size: 1.4rem;
  }

  .room-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .container {
    padding: 1.5rem 1rem 1rem;
  }

  .letter-frame {
    box-shadow:
      0 0 0 3px rgba(201, 162, 39, 0.06),
      0 20px 60px rgba(0, 0, 0, 0.3);
  }
}

@media (min-width: 481px) {
  .page {
    padding: calc(2.5rem + var(--safe-top)) 0 calc(4rem + var(--safe-bottom));
  }
}

/* ─── H5 移动端适配 ─── */
@supports (-webkit-touch-callout: none) {
  .page {
    min-height: -webkit-fill-available;
  }
}

@media (max-width: 480px) {
  .countdown {
    gap: 0.2rem;
  }

  .countdown-colon {
    font-size: 1rem;
    padding-bottom: 0.75rem;
  }

  .envelope {
    width: min(280px, 85vw);
  }

  .envelope-body {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal, .card, .footer {
    opacity: 1;
    transform: none;
  }
}
