/* ===== INVITE THEMES：.ivt-a 晨光金（淺）/ .ivt-b 星夜藍（深） ===== */
.ivt-a {
  --iv-bg:          radial-gradient(ellipse at 50% 35%, #fdf8f3 0%, #f3e6da 55%, #e8d5c6 100%);
  --iv-env:         #ead6c6;
  --iv-env-light:   #f3e5da;
  --iv-env-dark:    #dcc0ab;
  --iv-env-inner:   #cfae96;
  --iv-paper:       #fffdf9;
  --iv-accent:      #c9a585;
  --iv-accent-dark: #a07850;
  --iv-text:        #3d2b1f;
  --iv-text-mid:    #6b5040;
  --iv-text-light:  #9b8070;
  --iv-seal:        #97453a;
  --iv-seal-dark:   #6e2e26;
  --iv-seal-text:   #f6e3c8;
  --iv-input-bg:    #fff;
  --iv-btn-bg:      #a07850;
  --iv-btn-text:    #fff;
  --iv-btn-hover:   #3d2b1f;
  --iv-err:         #b4533e;
  --iv-shadow:      rgba(60,40,25,.45);
  --iv-font-script: 'Great Vibes', cursive;
  --iv-font-serif:  'Noto Serif TC', 'Playfair Display', Georgia, serif;
  --iv-font-body:   'Lato', 'Noto Sans TC', sans-serif;
}
.ivt-b {
  --iv-bg:          radial-gradient(ellipse at 50% 30%, #22375a 0%, #142440 50%, #0b1528 100%);
  --iv-paper:       #13213a;
  --iv-accent:      #7fa3c4;
  --iv-accent-dark: #cfe0f0;
  --iv-text:        #eef3f8;
  --iv-text-mid:    #b9c7d6;
  --iv-text-light:  #8196ad;
  --iv-seal:        #c7d6e4;
  --iv-seal-dark:   #8aa2b8;
  --iv-seal-text:   #1b2a44;
  --iv-input-bg:    rgba(255,255,255,.06);
  --iv-btn-bg:      #cfe0f0;
  --iv-btn-text:    #13213a;
  --iv-btn-hover:   #fff;
  --iv-err:         #ff9f8a;
  --iv-shadow:      rgba(0,0,0,.7);
  --iv-gf:          #1d3052;
  --iv-gf-light:    #2a4270;
  --iv-silver:      #d9e3ec;
  --iv-font-script: 'Lato', sans-serif;
  --iv-font-serif:  'Noto Serif TC', serif;
  --iv-font-body:   'Noto Sans TC', 'Lato', sans-serif;
  color-scheme: dark;
}
/* 藍色版無草寫字體：眉標改為字距大寫 */
.ivt-b .iv-eyebrow, .ivt-b .iv-letter-eyebrow { text-transform: uppercase; letter-spacing: .4em; font-weight: 300; }
.ivt-b .iv-eyebrow { font-size: .72rem; }
.ivt-b .iv-letter-eyebrow { font-size: calc(var(--gf-w) * .042); }

/* ===== BASE ===== */
/* 第 3 版：邀請函是獨立一頁（第 1 章），整頁就是這個畫面；信封顏色跟著全站風格（A＝晨光金、B＝星夜藍） */
body.invite-page { overflow: hidden; }

/* 左上「← 主頁」、右上「重看開信動畫」、管理者預覽標記 */
.iv-home, .iv-replay, .iv-preview {
  position: absolute; z-index: 5; top: calc(14px + env(safe-area-inset-top));
  font-size: .78rem; letter-spacing: .15em; line-height: 1.6;
  color: var(--iv-text-light); background: none; border: 0; padding: 8px 10px; text-decoration: none; cursor: pointer;
}
.iv-home { left: 8px; }
.iv-replay { right: 8px; display: none; }
.iv[data-stage="card"] .iv-replay { display: block; }
.iv[data-stage="auth"] .iv-home { display: none; }
.iv-home:hover, .iv-replay:hover { color: var(--iv-accent-dark); }
.iv-preview { left: 50%; transform: translateX(-50%); padding: 2px 12px; margin-top: 8px; border: 1px dashed var(--iv-accent); border-radius: 999px; color: var(--iv-accent-dark); font-size: .72rem; pointer-events: none; }
.iv[data-stage="auth"] .iv-preview { display: none; }

.iv {
  --env-w: min(84vw, 440px, calc((100vh - 150px) * .95));
  --env-h: calc(var(--env-w) * .64);
  --gf-w: min(52vw, 270px, calc((100vh - 200px) / 1.38));
  --gf-h: calc(var(--gf-w) * 1.38);
  position: fixed; inset: 0; z-index: 10000;
  background: radial-gradient(ellipse at 50% 35%, #fdf8f3 0%, #f3e6da 55%, #e8d5c6 100%);
  color: var(--iv-text);
  font-family: var(--iv-font-body);
  transition: opacity .7s ease, color .6s ease;
}
/* 夜空：選藍色時淡入（漸層無法直接過渡，改用疊層透明度） */
.iv::before, .iv-sky {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  opacity: 0; transition: opacity .9s ease;
}
.iv::before { background: radial-gradient(ellipse at 50% 30%, #22375a 0%, #142440 50%, #0b1528 100%); }
.iv.ivt-b::before, .iv.ivt-b .iv-sky { opacity: 1; }
.iv-sky i {
  position: absolute; inset: -10%;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 62%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 41% 9%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 38%, #fff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 73% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 55%, #fff 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 93% 82%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 88%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 35% 90%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 75%, #fff 50%, transparent 51%);
  background-size: 420px 420px;
  opacity: .55;
  animation: ivTwinkle 5s ease-in-out infinite;
}
.iv-sky i:nth-child(2) { background-size: 300px 300px; background-position: 90px 140px; animation-delay: -1.7s; opacity: .4; }
.iv-sky i:nth-child(3) { background-size: 560px 560px; background-position: 200px 40px; animation-delay: -3.3s; opacity: .7; }

.iv.iv-leaving { opacity: 0; pointer-events: none; }

/* ===== STAGE 1: SCROLL TRACK ===== */
.iv-scroll {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  outline: none;
}
.iv-scroll::-webkit-scrollbar { display: none; }
.iv-track { height: calc(100vh + 170vh); }
.iv-stage {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 16px;
}
.iv.is-open .iv-scroll { opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility 0s .5s; }

.iv-to {
  font-family: var(--iv-font-serif);
  font-size: .95rem; letter-spacing: .3em;
  color: var(--iv-text-mid);
  margin-bottom: calc(var(--env-h) * .55);
}

.iv-float { animation: ivFloat 4s ease-in-out infinite; }
.iv.is-moving .iv-float { animation-play-state: paused; }

/* ----- envelope ----- */
.iv-env {
  position: relative;
  width: var(--env-w); height: var(--env-h);
  cursor: pointer;
  will-change: transform;
}
.iv-env-back {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, var(--iv-env-inner), var(--iv-env-dark));
  border-radius: 6px;
  box-shadow: 0 22px 45px -18px rgba(60,40,25,.45), 0 4px 12px rgba(60,40,25,.12);
}

.iv-letter {
  position: absolute; z-index: 2;
  left: 5%; right: 5%; top: 5%; height: 92%;
  background: var(--iv-paper);
  border-radius: 3px;
  box-shadow: 0 2px 10px rgba(60,40,25,.15);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 9%;
  text-align: center;
  will-change: transform;
}
.iv-letter::before {
  content: ''; position: absolute; inset: 6px;
  border: 1px solid var(--iv-accent); opacity: .55; pointer-events: none;
}
.iv-letter-eyebrow {
  font-family: var(--iv-font-script);
  font-size: calc(var(--env-w) * .055);
  color: var(--iv-accent-dark); line-height: 1.2;
}
.iv-letter-names {
  font-family: var(--iv-font-serif);
  font-size: calc(var(--env-w) * .068);
  letter-spacing: .12em; color: var(--iv-text);
  margin-top: .3em;
}
.iv-letter-line { width: 22%; height: 1px; background: var(--iv-accent); margin: .7em 0; }
.iv-letter-date {
  font-family: var(--iv-font-serif);
  font-size: calc(var(--env-w) * .038);
  letter-spacing: .25em; color: var(--iv-text-mid);
}

.iv-env-front-wrap {
  position: absolute; inset: 0; z-index: 3;
  filter: drop-shadow(0 -1px 1px rgba(60,40,25,.12));
  pointer-events: none;
}
.iv-env-front {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, var(--iv-env-light), var(--iv-env));
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
  border-radius: 0 0 6px 6px;
}
.iv-env-front::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(0deg, var(--iv-env), var(--iv-env-light));
  clip-path: polygon(0 100%, 50% 50%, 100% 100%);
  filter: brightness(1.02);
}
.iv-env-label {
  position: absolute; left: 0; right: 0; bottom: 11%;
  text-align: center;
  font-family: var(--iv-font-serif);
  font-size: calc(var(--env-w) * .036);
  letter-spacing: .3em; color: var(--iv-text-mid);
}

.iv-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 100%; z-index: 4;
  transform-origin: 50% 0;
  filter: drop-shadow(0 3px 3px rgba(60,40,25,.18));
  pointer-events: none;
  will-change: transform;
}
.iv-flap-shape {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--iv-env-light), var(--iv-env));
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  border-radius: 6px 6px 0 0;
}
.iv-flap.is-back { z-index: 0; }
.iv-flap.is-back .iv-flap-shape { background: linear-gradient(0deg, var(--iv-env-inner), var(--iv-env-dark)); }

.iv-seal {
  position: absolute; z-index: 5;
  left: 50%; top: 58%;
  width: calc(var(--env-w) * .17); height: calc(var(--env-w) * .17);
  margin: calc(var(--env-w) * -.085) 0 0 calc(var(--env-w) * -.085);
  border: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--iv-seal) 70%, #fff) 0%, var(--iv-seal) 45%, var(--iv-seal-dark) 100%);
  box-shadow: 0 3px 8px rgba(0,0,0,.28), inset 0 0 0 calc(var(--env-w) * .012) rgba(0,0,0,.12);
  color: var(--iv-seal-text);
  font-family: var(--iv-font-serif);
  font-size: calc(var(--env-w) * .07); line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  will-change: transform, opacity;
}
.iv-seal::after {
  content: ''; position: absolute; inset: 14%;
  border-radius: 50%; border: 1px dashed rgba(255,255,255,.35);
}
.iv-seal:focus-visible { outline: 2px solid var(--iv-accent-dark); outline-offset: 4px; }

.iv-hint {
  margin-top: 2.2rem;
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  font-size: .75rem; letter-spacing: .3em; color: var(--iv-text-light);
}
.iv-hint i {
  display: block; width: 14px; height: 14px;
  border-right: 1.5px solid var(--iv-accent-dark); border-bottom: 1.5px solid var(--iv-accent-dark);
  transform: rotate(45deg);
  animation: ivArrow 1.6s ease-in-out infinite;
}

/* ===== STAGE 2: CARD ===== */
.iv-card-wrap {
  position: absolute; inset: 0;
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
  padding: 24px 16px;
  visibility: hidden; opacity: 0;
}
.iv.is-open .iv-card-wrap { visibility: visible; opacity: 1; }

.iv-card {
  position: relative;
  width: 100%; max-width: 540px; margin: auto;
  background: var(--iv-paper);
  border-radius: 4px;
  box-shadow: 0 30px 60px -25px var(--iv-shadow), 0 6px 18px rgba(0,0,0,.1);
  transform-origin: 50% 0;
  transition: transform .6s ease, opacity .6s ease;
}
.iv-card::before {
  content: ''; position: absolute; inset: 10px; z-index: 1;
  border: 1px solid var(--iv-accent); opacity: .5; pointer-events: none;
}
.iv.iv-leaving .iv-card { transform: translateY(-30px) scale(.98); }

.iv-card > * { opacity: 0; transition: opacity .7s ease .35s; }
.iv.is-revealed .iv-card > * { opacity: 1; }


.iv-card-body { padding: 2rem 2.2rem 2.4rem; text-align: center; }
.iv-eyebrow {
  display: block;
  font-family: var(--iv-font-script);
  font-size: 1.6rem; color: var(--iv-accent-dark); line-height: 1.2;
}
.iv-names {
  font-family: var(--iv-font-serif); font-weight: 400;
  font-size: clamp(1.7rem, 7vw, 2.3rem);
  letter-spacing: .15em; color: var(--iv-text);
  margin: .35rem 0 .2rem;
}
.iv-event { font-size: .85rem; letter-spacing: .5em; color: var(--iv-text-mid); }

.iv-orn { display: flex; align-items: center; justify-content: center; gap: .9rem; margin: 1.5rem 0; color: var(--iv-accent); }
.iv-orn::before, .iv-orn::after { content: ''; width: 50px; height: 1px; background: var(--iv-accent); opacity: .7; }

.iv-greeting { text-align: left; font-family: var(--iv-font-serif); color: var(--iv-text); margin-bottom: .4rem; }
.iv-message { text-align: left; color: var(--iv-text-mid); line-height: 2; white-space: pre-line; font-size: .95rem; }

.iv-details { margin: 1.6rem 0 0; display: grid; gap: .9rem; text-align: left; }
.iv-detail { display: grid; grid-template-columns: 6.2em 1fr; gap: .8rem; align-items: baseline; }
.iv-detail dt { font-size: .72rem; letter-spacing: .15em; color: var(--iv-accent-dark); font-weight: 700; }
.iv-detail dd { margin: 0; color: var(--iv-text); font-size: .95rem; line-height: 1.7; }
.iv-detail small { color: var(--iv-text-light); letter-spacing: .1em; margin-left: .3em; }
.iv-map { display: inline-block; margin-left: .3em; font-size: .78rem; color: var(--iv-accent-dark); border-bottom: 1px solid currentColor; }

.iv-sub { font-size: .75rem; letter-spacing: .3em; color: var(--iv-accent-dark); font-weight: 700; margin-bottom: .8rem; }
.iv-sched { margin-top: 1.6rem; }
.iv-sched ul { list-style: none; margin: 0 auto; padding: 0; max-width: 340px; }
.iv-sched li {
  display: grid; grid-template-columns: 4.2em 1fr; gap: .8rem;
  text-align: left; padding: .35rem 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--iv-accent) 45%, transparent);
  font-size: .9rem; color: var(--iv-text-mid);
}
.iv-sched li:last-child { border-bottom: 0; }
.iv-sched time { color: var(--iv-accent-dark); font-family: var(--iv-font-serif); letter-spacing: .05em; }

.iv-verse {
  margin: 1.6rem 0 0; padding: 0 .5rem;
  font-family: var(--iv-font-serif); font-size: .85rem; line-height: 1.9;
  color: var(--iv-text-light); font-style: normal;
}

/* ----- form ----- */
.iv-form { text-align: left; }
.iv-form .iv-sub { text-align: center; }
.iv-deadline { text-align: center; font-size: .8rem; color: var(--iv-text-light); margin: -.4rem 0 1.2rem; }
.iv-field { margin-bottom: 1.1rem; }
.iv-field label, .iv-label {
  display: block; font-size: .72rem; letter-spacing: .12em; font-weight: 700;
  color: var(--iv-text-mid); margin-bottom: .4rem;
}
.iv-field input[type=text], .iv-field input[type=email], .iv-field select, .iv-field textarea {
  width: 100%; padding: .7rem .9rem;
  border: 1px solid color-mix(in srgb, var(--iv-accent) 55%, transparent);
  border-radius: 2px; background: var(--iv-input-bg);
  font: inherit; font-size: 16px; color: var(--iv-text);
  outline: none; transition: border-color .25s, box-shadow .25s;
  -webkit-appearance: none; appearance: none;
}
.iv-field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--iv-accent-dark) 50%), linear-gradient(135deg, var(--iv-accent-dark) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.iv-field textarea { resize: vertical; min-height: 84px; }
.iv-field label.iv-check { display: flex; align-items: flex-start; gap: .55rem; margin: .65rem 0 0; font-size: .82rem; line-height: 1.55; letter-spacing: .04em; font-weight: 400; text-transform: none; opacity: .9; cursor: pointer; }
.iv-check input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: .15rem; accent-color: var(--iv-accent-dark); }
.iv-field :is(input, select, textarea):focus { border-color: var(--iv-accent-dark); box-shadow: 0 0 0 3px color-mix(in srgb, var(--iv-accent) 25%, transparent); }
.iv-field.is-invalid :is(input, .iv-choice span) { border-color: var(--iv-err); }
.iv-field select option { color: #222; background: #fff; }

.iv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.iv-guests { transition: opacity .3s; }
.iv-guests.is-disabled { opacity: .4; }

.iv-choice { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.iv-choice label { margin: 0; cursor: pointer; }
.iv-choice input { position: absolute; opacity: 0; pointer-events: none; }
.iv-choice span {
  display: block; text-align: center;
  padding: .75rem .5rem;
  border: 1px solid color-mix(in srgb, var(--iv-accent) 55%, transparent);
  border-radius: 2px; background: var(--iv-input-bg);
  font-size: .95rem; letter-spacing: .15em; font-weight: 400;
  color: var(--iv-text-mid);
  transition: all .25s;
}
.iv-choice input:checked + span { background: var(--iv-btn-bg); border-color: var(--iv-btn-bg); color: var(--iv-btn-text); }
.iv-choice input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--iv-accent) 35%, transparent); }

.iv-err { min-height: 1.2em; text-align: center; font-size: .85rem; color: var(--iv-err); margin: .2rem 0 .6rem; }
.iv-btn {
  display: block; width: 100%;
  padding: .95rem 1rem;
  border: 0; border-radius: 2px;
  background: var(--iv-btn-bg); color: var(--iv-btn-text);
  font: inherit; font-size: .9rem; letter-spacing: .35em; font-weight: 700;
  cursor: pointer; transition: background .3s, transform .3s, box-shadow .3s;
}
.iv-btn:hover { background: var(--iv-btn-hover); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,.12); }
.iv-btn:disabled { opacity: .6; cursor: wait; transform: none; }

.iv-thanks { display: none; padding: .5rem 0 0; }
.iv-card.is-done .iv-form { display: none; }
.iv-card.is-done .iv-thanks { display: block; animation: ivPop .6s ease both; }
.iv-thanks-icon { font-size: 2.2rem; color: var(--iv-seal); line-height: 1; }
.iv-thanks h3 { font-family: var(--iv-font-serif); font-weight: 400; font-size: 1.4rem; letter-spacing: .15em; margin: .6rem 0; color: var(--iv-text); }
.iv-thanks p { color: var(--iv-text-mid); margin-bottom: 1.5rem; white-space: pre-line; }

/* ===== ANIMATIONS ===== */
@keyframes ivFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes ivArrow { 0%,100% { transform: translateY(0) rotate(45deg); opacity: .5; } 50% { transform: translateY(6px) rotate(45deg); opacity: 1; } }
@keyframes ivPop   { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ===== RWD ===== */
@media (max-width: 480px) {
  .iv-card-body { padding: 1.6rem 1.4rem 2rem; }
  .iv-card::before { inset: 7px; }
  .iv-row { grid-template-columns: 1fr; gap: 0; }
  .iv-detail { grid-template-columns: 1fr; gap: .1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .iv-float, .iv-hint i { animation: none; }
  .iv-card > * { transition-delay: 0s; }
}

/* ===== 頁尾「重看邀請函」 ===== */
.iv-reopen {
  display: inline-block; margin-top: 1.8rem;
  padding: .55rem 1.6rem;
  border: 1px solid var(--iv-accent); border-radius: 2px;
  font-size: .78rem; letter-spacing: .3em;
  color: var(--iv-accent); transition: background .3s, color .3s;
}
.iv-reopen:hover { background: var(--iv-accent); color: #fff; }

/* ===== 頁尾連結 ===== */
.foot-links { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 1.8rem; }
.foot-links .iv-reopen { margin-top: 0; }
.foot-switch { font-size: .75rem; letter-spacing: .2em; color: var(--iv-text-light, #9b8070); opacity: .8; }
.foot-switch:hover { opacity: 1; text-decoration: underline; }
.foot-links .foot-admin { margin-top: .5rem; }
.foot-credit {
  margin-top: 1.2rem; padding-top: 1.2rem; width: min(260px, 80%);
  border-top: 1px solid rgba(155,128,112,.25);
  font-size: .72rem; letter-spacing: .2em; color: #9b8070; opacity: .75;
}
.foot-credit span { margin: 0 .5em; opacity: .5; }

/* ===== 階段切換 ===== */
.iv-auth, .iv-choose { position: absolute; inset: 0; display: none; }
.iv[data-stage="auth"]   .iv-auth,
.iv[data-stage="choose"] .iv-choose { display: flex; }
.iv:not([data-stage="envelope"]):not([data-stage="card"]) .iv-scroll { display: none; }
.iv:not([data-stage="card"]) .iv-card-wrap { visibility: hidden; }

/* ----- 0. 辨識 / 登入 ----- */
.iv-auth { align-items: center; justify-content: center; padding: 24px 16px; text-align: center; }
.iv-auth-box { max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 1.1rem; }
.iv-auth-text { font-family: var(--iv-font-serif); color: var(--iv-text-mid); letter-spacing: .15em; line-height: 1.9; white-space: pre-line; }
.iv-auth-note { font-size: .8rem; color: var(--iv-text-light); line-height: 1.8; }
.iv-auth .iv-btn { width: auto; padding: .9rem 2.4rem; }
.iv-btn-ghost { background: transparent; color: var(--iv-text-mid); box-shadow: inset 0 0 0 1px currentColor; }
.iv-btn-ghost:hover { background: transparent; color: var(--iv-text); }
.iv-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--iv-accent) 30%, transparent);
  border-top-color: var(--iv-accent-dark);
  animation: ivSpin 1s linear infinite;
}
.iv [hidden] { display: none !important; }

/* ----- 1. 選信封 ----- */
.iv-choose { flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; text-align: center; }
.iv-choose .iv-to { margin-bottom: 1.2rem; }
.iv-choose-title { font-family: var(--iv-font-serif); color: var(--iv-text); letter-spacing: .2em; line-height: 1.8; margin-bottom: 2.2rem; }
.iv-choose-title small { font-size: .8rem; color: var(--iv-text-light); letter-spacing: .25em; }
.iv-choose-row { display: flex; gap: clamp(1rem, 5vw, 3rem); flex-wrap: wrap; justify-content: center; }
.iv-pick {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  background: none; border: 0; padding: .6rem; cursor: pointer;
  transition: transform .35s ease;
}
.iv-pick:hover, .iv-pick:focus-visible { transform: translateY(-6px); }
.iv-pick:focus-visible { outline: 2px solid var(--iv-accent-dark); outline-offset: 6px; border-radius: 4px; }
.iv-pick.is-last .iv-pick-label::after { content: '（上次選的）'; display: block; margin-top: .2rem; font-size: .7rem; letter-spacing: .05em; opacity: .8; }
.iv-pick-label { font-size: .8rem; letter-spacing: .25em; color: var(--iv-text-mid); }
.iv-env-mini {
  --env-w: min(38vw, 210px);
  --env-h: calc(var(--env-w) * .64);
  display: block; pointer-events: none;
  animation: ivFloat 4s ease-in-out infinite;
}
.iv-pick[data-theme="b"] .iv-env-mini { animation-delay: -2s; }
.iv-env-mini > span { display: block; }
.iv-env-mini .iv-flap { transform: perspective(900px) rotateX(0deg); }
.iv-choose.is-picked .iv-pick:not(.is-chosen) { opacity: 0; transform: scale(.9); transition: opacity .4s, transform .4s; }
.iv-choose.is-picked .iv-pick.is-chosen { transform: scale(1.08); }

/* ----- 3. 邀請函：無法回覆 / 進站按鈕 ----- */
.iv-blocked { display: none; text-align: center; }
.iv-card.is-blocked .iv-blocked { display: block; }
.iv-card.is-blocked .iv-form,
.iv-card.is-blocked .iv-edit-wrap,
.iv-card.is-blocked #iv-edit { display: none; }
.iv-blocked-text { color: var(--iv-text-mid); line-height: 1.9; white-space: pre-line; margin-bottom: .5rem; }
.iv-enter { display: none; margin-top: 1.2rem; }
.iv-card.is-done .iv-enter, .iv-card.is-blocked .iv-enter { display: block; }

.iv-btn-line { background: #06c755; }
.iv-btn-line:hover { background: #05a847; }
.iv-line-who { text-align: center; font-size: .78rem; color: var(--iv-text-light); margin: 0; }
.iv-line-who:empty { display: none; }
.iv-link {
  display: inline-block; margin-top: .6rem;
  background: none; border: 0; padding: .3rem .5rem;
  font: inherit; font-size: .82rem; letter-spacing: .15em;
  color: var(--iv-text-light); text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.iv-link:hover { color: var(--iv-accent-dark); }

@keyframes ivSpin { to { transform: rotate(360deg); } }
@keyframes ivTwinkle { 0%,100% { opacity: .25; } 50% { opacity: .8; } }


/* =====================================================================
   雙版本差異：金 a（淺色 · 封蠟信封）/ 藍 b（深色 · 緞帶對開卡）
   ===================================================================== */
.iv.ivt-a .iv-only-b, .iv.ivt-b .iv-only-a { display: none !important; }
.iv.ivt-a .iv-stage .iv-gf, .iv.ivt-b .iv-stage .iv-env { display: none; }
.iv.ivt-a .iv-hint-b, .iv.ivt-b .iv-hint-a { display: none; }
.iv-stage { overflow-x: clip; }
.iv.ivt-b .iv-stage .iv-to { margin-bottom: 1.8rem; }
.iv-choose-row { align-items: flex-end; }

/* ----- 藍 b：對開卡 ----- */
.iv-gf {
  position: relative; display: block;
  width: var(--gf-w); height: var(--gf-h);
  perspective: 1400px;
  cursor: pointer;
  will-change: transform;
}
.iv-gf > span, .iv-gf span.iv-gf-face, .iv-gf span.iv-gf-back { display: block; }
.iv-gf-inner {
  position: absolute; inset: 0; z-index: 1;
  background: var(--iv-paper); color: var(--iv-text);
  border-radius: 4px;
  box-shadow: 0 26px 50px -18px rgba(0,0,0,.75), 0 4px 14px rgba(0,0,0,.3);
  display: flex !important; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(var(--gf-w) * .03); text-align: center;
  will-change: transform;
}
.iv-gf-inner::before {
  content: ''; position: absolute; inset: 8px;
  border: 1px solid var(--iv-accent); opacity: .5; pointer-events: none;
}
.iv-gf-date {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: calc(var(--gf-w) * .22); line-height: 1;
  color: var(--iv-accent-dark); letter-spacing: .03em;
}
.iv-gf-inner .iv-letter-names {
  font-size: calc(var(--gf-w) * .075); margin-top: .2em;
  color: var(--iv-text); letter-spacing: .2em;
}

.iv-gf-door {
  position: absolute; top: 0; bottom: 0; width: 50%; z-index: 3;
  transform-style: preserve-3d;
  will-change: transform;
}
.iv-gf-l { left: 0;  transform-origin: 0 50%; }
.iv-gf-r { right: 0; transform-origin: 100% 50%; }
.iv-gf-face, .iv-gf-back {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.iv-gf-face {
  background:
    radial-gradient(1.4px 1.4px at 30% 22%, var(--iv-silver) 50%, transparent 52%),
    radial-gradient(1px 1px at 62% 34%, var(--iv-silver) 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 44% 58%, var(--iv-silver) 50%, transparent 52%),
    radial-gradient(1px 1px at 20% 70%, var(--iv-silver) 50%, transparent 52%),
    linear-gradient(165deg, var(--iv-gf-light), var(--iv-gf) 65%);
  box-shadow: 0 20px 40px -18px rgba(0,0,0,.7);
}
.iv-gf-r .iv-gf-face { background-position: 40% 10%, 0 0, 0 0, 0 0, 0 0; }
.iv-gf-l .iv-gf-face { border-radius: 4px 0 0 4px; box-shadow: inset -1px 0 0 rgba(0,0,0,.35), 0 20px 40px -18px rgba(0,0,0,.7); }
.iv-gf-r .iv-gf-face { border-radius: 0 4px 4px 0; box-shadow: inset 1px 0 0 rgba(255,255,255,.08), 0 20px 40px -18px rgba(0,0,0,.7); }
.iv-gf-face::before {
  content: ''; position: absolute; top: 8px; bottom: 8px;
  border: 1px solid var(--iv-silver); opacity: .4;
}
.iv-gf-l .iv-gf-face::before { left: 8px; right: 0; border-right: 0; }
.iv-gf-r .iv-gf-face::before { right: 8px; left: 0; border-left: 0; }
.iv-gf-face em {
  position: absolute; bottom: 13%;
  font-family: var(--iv-font-serif); font-style: normal;
  font-size: calc(var(--gf-w) * .07); letter-spacing: .3em;
  color: var(--iv-silver);
}
.iv-gf-l .iv-gf-face em { right: 12%; }
.iv-gf-r .iv-gf-face em { left: 14%; }
.iv-gf-back {
  transform: rotateY(180deg);
  background: linear-gradient(195deg, #22375c, #182a47);
  box-shadow: inset 0 0 0 1px rgba(217,227,236,.12);
}
.iv-gf-l .iv-gf-back { border-radius: 0 4px 4px 0; }
.iv-gf-r .iv-gf-back { border-radius: 4px 0 0 4px; }

.iv-gf-band {
  --rib: 0;
  position: absolute; z-index: 5;
  left: -3%; right: -3%; top: 50%;
  height: calc(var(--gf-h) * .085); margin-top: calc(var(--gf-h) * -.0425);
  pointer-events: none;
}
.iv-gf-rib {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background: linear-gradient(180deg, #eef3f7 0%, #b9c8d6 48%, #dfe7ee 100%);
  box-shadow: 0 3px 6px rgba(0,0,0,.35);
  opacity: calc(1 - var(--rib));
}
.iv-gf-rib-l { left: 0;  border-radius: 2px 0 0 2px; transform: translateX(calc(var(--rib) * -60%)) rotate(calc(var(--rib) * -10deg)); }
.iv-gf-rib-r { right: 0; border-radius: 0 2px 2px 0; transform: translateX(calc(var(--rib) * 60%))  rotate(calc(var(--rib) * 10deg)); }
.iv-gf-tag {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--gf-w) * .22); height: calc(var(--gf-w) * .22);
  border: 0; border-radius: 50%; padding: 0;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--iv-seal) 45%, var(--iv-seal-dark) 100%);
  box-shadow: 0 4px 10px rgba(0,0,0,.45), inset 0 0 0 calc(var(--gf-w) * .012) rgba(255,255,255,.35);
  color: var(--iv-seal-text);
  font-family: var(--iv-font-serif); font-size: calc(var(--gf-w) * .09); line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; pointer-events: auto;
  will-change: transform, opacity;
}
.iv-gf-tag::after { content: ''; position: absolute; inset: 13%; border-radius: 50%; border: 1px dashed rgba(27,42,68,.35); }
.iv-gf-tag:focus-visible { outline: 2px solid var(--iv-silver); outline-offset: 4px; }

/* 選信封的迷你版 */
.iv-gf-mini {
  --gf-w: min(26vw, 138px);
  --gf-h: calc(var(--gf-w) * 1.38);
  pointer-events: none;
  animation: ivFloat 4s ease-in-out infinite -2s;
}
.iv-gf-mini .iv-gf-tag { pointer-events: none; }

/* ----- 邀請函內頁：金 a 拱門主照 + 圓形小照 ----- */
.iv-photo { position: relative; width: min(70%, 320px); margin: 38px auto 0; }
.iv-arch {
  aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: 999px 999px 4px 4px;
  box-shadow: 0 0 0 6px var(--iv-paper), 0 0 0 7px var(--iv-accent);
}
.iv-arch img, .iv-medal img, .iv-collage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.iv-medal {
  position: absolute; right: -11%; bottom: -7%;
  width: 36%; aspect-ratio: 1; overflow: hidden; border-radius: 50%;
  box-shadow: 0 0 0 5px var(--iv-paper), 0 0 0 6px var(--iv-accent), 0 12px 22px -8px rgba(60,40,25,.45);
}
.iv.ivt-a .iv-photo + .iv-card-body { padding-top: 2.6rem; }
.iv-names i { font-style: normal; margin: 0 .3em; }
.iv.ivt-a .iv-names i { font-family: 'Great Vibes', cursive; color: var(--iv-accent-dark); letter-spacing: 0; font-size: 1.15em; }

/* ----- 邀請函內頁：藍 b 相簿拼貼 + 大日期 + 時間軸 ----- */
.iv-collage { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 16px 16px 0; }
.iv-collage figure { margin: 0; overflow: hidden; border-radius: 2px; background: rgba(255,255,255,.04); }
.iv-collage figure:first-child { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.iv-collage figure:not(:first-child) { aspect-ratio: 4 / 5; }
.iv-collage.n2 figure:nth-child(2) { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.iv-collage.n1 { grid-template-columns: 1fr; }
.iv-collage.n1 figure { aspect-ratio: 4 / 5; }
/* 藍 b 一大格：整張照片顯示不裁切；空白處用同一張照片放大模糊補滿 */
.iv-slides .iv-pic { position: absolute; inset: 0; overflow: hidden; opacity: 0; transition: opacity 1.4s ease; }
.iv-slides .iv-pic.is-on { opacity: 1; }
.iv-slides .iv-pic::before {
  content: ''; position: absolute; inset: -14%; background: var(--pic) center / cover no-repeat;
  filter: blur(22px) brightness(.62) saturate(1.1);
}
.iv-slides .iv-pic img { position: relative; opacity: 1; animation: none; transition: none; object-fit: contain; }
.iv.ivt-b .iv-card::before { inset: 10px; }
.iv.ivt-b .iv-card-body { padding-top: 2.2rem; }

.iv.ivt-b .iv-names {
  display: flex; flex-direction: column; align-items: center;
  font-size: clamp(1.9rem, 8vw, 2.5rem); letter-spacing: .3em; padding-left: .3em; line-height: 1.35;
}
.iv.ivt-b .iv-names i {
  font-family: 'Playfair Display', Georgia, serif; font-style: italic;
  font-size: .55em; letter-spacing: 0; color: var(--iv-accent); margin: .1em 0;
}
.iv.ivt-b .iv-event { margin-top: .6rem; }

.iv-datebig {
  margin: 1.6rem auto 0; padding: 1.1rem 0 1rem; max-width: 300px;
  border-top: 1px solid color-mix(in srgb, var(--iv-accent) 45%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--iv-accent) 45%, transparent);
}
.iv-datebig strong {
  display: block; font-family: 'Playfair Display', Georgia, serif; font-weight: 400;
  font-size: clamp(3rem, 15vw, 4.2rem); line-height: 1; letter-spacing: .04em;
  color: var(--iv-accent-dark);
}
.iv-datebig span { display: block; margin-top: .6rem; font-size: .78rem; letter-spacing: .3em; color: var(--iv-text-mid); }

.iv.ivt-b .iv-details { grid-template-columns: 1fr; }
.iv.ivt-b .iv-detail:first-child { display: none; }   /* 日期已在大日期區 */
.iv.ivt-b .iv-detail {
  display: block; text-align: center;
  padding: 1rem 1rem 1.1rem; border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--iv-accent) 35%, transparent);
  background: rgba(255,255,255,.03);
}
.iv.ivt-b .iv-detail dt { margin-bottom: .45rem; }
.iv.ivt-b .iv-detail small { display: block; margin: .25rem 0 0; }
.iv.ivt-b .iv-map { margin: .6rem 0 0; }

.iv.ivt-b .iv-sched ul { position: relative; max-width: 300px; }
.iv.ivt-b .iv-sched ul::before {
  content: ''; position: absolute; left: 4px; top: .9em; bottom: .9em; width: 1px;
  background: color-mix(in srgb, var(--iv-accent) 55%, transparent);
}
.iv.ivt-b .iv-sched li { position: relative; padding: .5rem 0 .5rem 1.6rem; border-bottom: 0; }
.iv.ivt-b .iv-sched li::before {
  content: ''; position: absolute; left: 0; top: 1.05em;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--iv-paper); border: 1px solid var(--iv-accent-dark);
}
.iv.ivt-b .iv-sched time { font-family: 'Playfair Display', Georgia, serif; }
.iv.ivt-b .iv-verse { font-style: italic; }

@media (max-width: 480px) {
  .iv-collage { padding: 12px 12px 0; gap: 5px; }
  .iv-photo { margin-top: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .iv-sky i, .iv-gf-mini { animation: none; }
}

/* =====================================================================
   收件面（To · 親愛的 ○○）→ 點擊翻面 → 才能捲動開信
   ===================================================================== */
.iv-float { perspective: 1600px; }
.iv-flipper { position: relative; transform-style: preserve-3d; transition: transform .95s cubic-bezier(.5,.05,.2,1); }
.iv-flipper.is-flipping { transform: rotateY(180deg); }
.iv-back  { position: relative; transform: rotateY(180deg); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.iv-flipper.is-flipped { transition: none; transform: none; transform-style: flat; }
.iv-flipper.is-flipped .iv-back { transform: none; }
.iv-flipper.is-flipped .iv-front { display: none; }
.iv[data-side="front"] .iv-scroll, .iv[data-side="turning"] .iv-scroll { overflow: hidden; touch-action: none; }
.iv:not([data-side="back"]) .iv-hint-roll, .iv[data-side="back"] .iv-hint-tap { display: none !important; }
.iv[data-side="front"] .iv-hint i { display: none; }

.iv-front {
  position: absolute; inset: 0; z-index: 2;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 0; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: var(--iv-text); text-align: left;
  border-radius: 6px;
  background: linear-gradient(160deg, var(--iv-env-light), var(--iv-env));
  box-shadow: 0 22px 45px -18px rgba(60,40,25,.45), 0 4px 12px rgba(60,40,25,.12);
}
.iv-front > span { position: absolute; display: block; }
.iv-front:focus-visible { outline: 2px solid var(--iv-accent-dark); outline-offset: 6px; }

/* 郵票 */
.iv-stamp {
  top: 10%; right: 6%;
  width: calc(var(--env-w) * .14); aspect-ratio: .82;
  padding: 4px; background: var(--iv-paper);
  border: 2px dotted var(--iv-env);
  box-shadow: 0 1px 3px rgba(60,40,25,.25);
  transform: rotate(3deg);
}
.iv-stamp span {
  display: flex; align-items: center; justify-content: center; height: 100%;
  background: linear-gradient(160deg, var(--iv-seal), var(--iv-seal-dark));
  color: var(--iv-seal-text); font-family: var(--iv-font-serif);
  font-size: calc(var(--env-w) * .06);
}
/* 郵戳 */
.iv-postmark {
  top: 8%; right: 17%;
  width: calc(var(--env-w) * .17); aspect-ratio: 1; border-radius: 50%;
  border: 1.5px solid var(--iv-accent-dark); opacity: .55;
  display: flex !important; flex-direction: column; align-items: center; justify-content: center;
  color: var(--iv-accent-dark); line-height: 1.25; transform: rotate(-12deg);
  font-size: calc(var(--env-w) * .022); letter-spacing: .12em;
}
.iv-postmark b { font-family: 'Playfair Display', Georgia, serif; font-size: calc(var(--env-w) * .038); letter-spacing: .04em; }
/* 收件人 */
.iv-addr { left: 12%; right: 12%; top: 32%; }
.iv-addr > span { display: block; }
.iv-addr-to {
  font-family: 'Great Vibes', cursive; color: var(--iv-accent-dark);
  font-size: calc(var(--env-w) * .075); line-height: 1;
}
.iv-addr-name {
  margin-top: .25em; padding: 0 0 .35em .2em;
  font-family: var(--iv-font-serif); font-size: calc(var(--env-w) * .05); letter-spacing: .2em;
  color: var(--iv-text);
  border-bottom: 1px solid color-mix(in srgb, var(--iv-accent) 70%, transparent);
}
/* 「親愛的」一行靠左，名字另起一行置中 */
.iv-addr-greet { display: block; text-align: left; font-size: .72em; letter-spacing: .25em; opacity: .75; }
.iv-addr-name .iv-addressee { display: block; text-align: center; margin-top: .2em; }
.iv-addr::after {
  content: ''; display: block; height: calc(var(--env-w) * .06);
  border-bottom: 1px solid color-mix(in srgb, var(--iv-accent) 40%, transparent);
}
.iv-addr::after { display: none; }   /* 收件人改兩行後，第二條地址線會壓到 From，拿掉 */
.iv-from {
  left: 8%; bottom: 8%;
  font-size: calc(var(--env-w) * .028); letter-spacing: .25em; color: var(--iv-text-light);
}

/* 藍 b：深藍卡片封底，銀字 */
.iv.ivt-b .iv-front {
  border-radius: 4px; color: var(--iv-silver); text-align: center;
  background:
    radial-gradient(1.4px 1.4px at 22% 18%, var(--iv-silver) 50%, transparent 52%),
    radial-gradient(1px 1px at 78% 30%, var(--iv-silver) 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 30% 80%, var(--iv-silver) 50%, transparent 52%),
    radial-gradient(1px 1px at 70% 72%, var(--iv-silver) 50%, transparent 52%),
    linear-gradient(165deg, var(--iv-gf-light), var(--iv-gf) 65%);
  box-shadow: 0 26px 50px -18px rgba(0,0,0,.75), 0 4px 14px rgba(0,0,0,.3);
}
.iv.ivt-b .iv-front::before {
  content: ''; position: absolute; inset: 8px;
  border: 1px solid var(--iv-silver); opacity: .4; pointer-events: none;
}
.iv.ivt-b .iv-stamp {
  top: 7%; right: 8%; width: calc(var(--gf-w) * .2);
  background: #20365b; border-color: #0f1b30; transform: rotate(-4deg);
}
.iv.ivt-b .iv-stamp span {
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--iv-seal) 45%, var(--iv-seal-dark) 100%);
  font-size: calc(var(--gf-w) * .085);
}
.iv.ivt-b .iv-postmark { display: none !important; }
.iv.ivt-b .iv-addr { left: 10%; right: 10%; top: 34%; }
.iv.ivt-b .iv-addr-to {
  font-family: 'Playfair Display', Georgia, serif; font-style: italic;
  color: var(--iv-silver); font-size: calc(var(--gf-w) * .13);
}
.iv.ivt-b .iv-addr-name {
  margin-top: .5em; padding: 0 0 .5em;
  font-size: calc(var(--gf-w) * .07); letter-spacing: .25em; color: #fff;
  border-bottom-color: color-mix(in srgb, var(--iv-silver) 45%, transparent);
}
.iv.ivt-b .iv-from {
  left: 0; right: 0; bottom: 9%;
  font-size: calc(var(--gf-w) * .042); color: var(--iv-text-mid);
}
@media (prefers-reduced-motion: reduce) { .iv-flipper { transition: none; } }

/* =====================================================================
   背景動態：藍 b 流星 / 金 a 晨光 + 飄落花瓣
   ===================================================================== */
.iv-sky, .iv-garden { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

/* 流星：由右上往左下劃過，三顆錯開週期，偶爾出現 */
.iv-sky b {
  position: absolute; top: 8%; left: 78%;
  width: clamp(90px, 18vw, 170px); height: 1.5px;
  background: linear-gradient(90deg, #fff 0%, rgba(214,230,245,.55) 30%, transparent 100%);
  border-radius: 2px; opacity: 0;
  transform-origin: 0 50%;
  animation: ivMeteor 9s linear infinite;
}
.iv-sky b::before {
  content: ''; position: absolute; left: -2px; top: 50%;
  width: 4px; height: 4px; margin-top: -2px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 8px 2px rgba(200,225,255,.8);
}
.iv-sky b:nth-of-type(2) { top: 22%; left: 95%; animation-duration: 13s; animation-delay: 4s; }
.iv-sky b:nth-of-type(3) { top: -2%; left: 50%; animation-duration: 17s; animation-delay: 9s; width: clamp(70px, 12vw, 120px); }
@keyframes ivMeteor {
  0%   { opacity: 0; transform: rotate(-32deg) translateX(0); }
  2%   { opacity: 1; }
  9%   { opacity: 0; transform: rotate(-32deg) translateX(-55vmax); }
  100% { opacity: 0; transform: rotate(-32deg) translateX(-55vmax); }
}

/* 晨光：左上暖色光暈 + 淡淡光束 */
.iv-garden { opacity: 1; transition: opacity .9s ease; }
.iv.ivt-b .iv-garden { opacity: 0; }
.iv-garden::before {
  content: ''; position: absolute; left: -20%; top: -25%; width: 90vmax; height: 90vmax;
  background: radial-gradient(circle, rgba(255,236,200,.75) 0%, rgba(255,228,190,.3) 30%, transparent 60%);
  animation: ivGlow 8s ease-in-out infinite;
}
.iv-garden::after {
  content: ''; position: absolute; left: -30%; top: -40%; width: 160vmax; height: 160vmax;
  background: repeating-conic-gradient(from 100deg at 0 0, rgba(255,240,215,.22) 0deg 4deg, transparent 4deg 11deg);
  -webkit-mask: radial-gradient(circle at 0 0, #000 0%, transparent 55%);
          mask: radial-gradient(circle at 0 0, #000 0%, transparent 55%);
  transform-origin: 0 0;
  animation: ivRays 30s ease-in-out infinite alternate;
}
@keyframes ivGlow { 0%,100% { opacity: .8; } 50% { opacity: 1; } }
@keyframes ivRays { from { transform: rotate(-3deg); } to { transform: rotate(4deg); } }

/* 花瓣 */
.iv-garden i {
  --dx: 60px;
  position: absolute; top: -6%; left: 10%;
  width: 13px; height: 10px;
  border-radius: 150% 0 150% 0;
  background: radial-gradient(ellipse at 30% 30%, #fff5f0 0%, #f4cfc6 55%, #e6ab9f 100%);
  box-shadow: 0 2px 4px rgba(160,100,80,.12);
  opacity: 0;
  animation: ivPetal 16s linear infinite;
}
.iv-garden i:nth-child(1) { left: 6%;  animation-delay: 0s;   animation-duration: 17s; --dx: 90px; }
.iv-garden i:nth-child(2) { left: 18%; animation-delay: -6s;  animation-duration: 21s; --dx: 40px;  width: 10px; height: 8px; }
.iv-garden i:nth-child(3) { left: 31%; animation-delay: -11s; animation-duration: 15s; --dx: 110px; }
.iv-garden i:nth-child(4) { left: 44%; animation-delay: -3s;  animation-duration: 19s; --dx: -50px; width: 15px; height: 11px; }
.iv-garden i:nth-child(5) { left: 57%; animation-delay: -14s; animation-duration: 23s; --dx: 70px;  width: 9px;  height: 7px; }
.iv-garden i:nth-child(6) { left: 68%; animation-delay: -8s;  animation-duration: 16s; --dx: -80px; }
.iv-garden i:nth-child(7) { left: 79%; animation-delay: -17s; animation-duration: 20s; --dx: 50px;  width: 12px; height: 9px; }
.iv-garden i:nth-child(8) { left: 90%; animation-delay: -5s;  animation-duration: 18s; --dx: -100px; }
.iv-garden i:nth-child(9) { left: 38%; animation-delay: -20s; animation-duration: 25s; --dx: 30px;  width: 8px;  height: 6px; }
@keyframes ivPetal {
  0%   { opacity: 0;   transform: translate(0, 0) rotate(0deg) rotateX(0deg); }
  8%   { opacity: .85; }
  25%  { transform: translate(calc(var(--dx) * .5 + 25px), 27vh) rotate(110deg) rotateX(60deg); }
  50%  { transform: translate(calc(var(--dx) * .6 - 20px), 55vh) rotate(220deg) rotateX(0deg); }
  75%  { transform: translate(calc(var(--dx) * .9 + 20px), 82vh) rotate(330deg) rotateX(70deg); }
  92%  { opacity: .75; }
  100% { opacity: 0;   transform: translate(var(--dx), 110vh) rotate(420deg) rotateX(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .iv-sky b, .iv-garden i { animation: none; display: none; }
  .iv-garden::before, .iv-garden::after { animation: none; }
}

/* =====================================================================
   內頁照片動態：輪播（Ken Burns 慢速推移）＋ 進場動畫 ＋ 光澤掃過
   ===================================================================== */
.iv-slides { position: relative; width: 100%; height: 100%; overflow: hidden; }
.iv-slides img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.4s ease;
  animation: ivKenA 14s ease-in-out infinite alternate;
}
.iv-slides img:nth-child(even) { animation-name: ivKenB; animation-duration: 17s; }
.iv-slides img.is-on { opacity: 1; }
@keyframes ivKenA { from { transform: scale(1.03) translate(0, 0); }      to { transform: scale(1.16) translate(-2.5%, -2%); } }
@keyframes ivKenB { from { transform: scale(1.15) translate(2.5%, 1.5%); } to { transform: scale(1.03) translate(0, 0); } }

/* 光澤掃過 */
.iv-arch, .iv-collage figure { position: relative; }
.iv-arch::after, .iv-collage figure::after {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.3) 50%, transparent 65%);
  transform: translateX(-130%);
}
.iv.is-revealed .iv-arch::after { animation: ivShine 8s ease-in-out 2.6s infinite; }
.iv.is-revealed .iv-collage figure::after { animation: ivShine 9s ease-in-out infinite; }
.iv.is-revealed .iv-collage figure:nth-child(1)::after { animation-delay: 2.2s; }
.iv.is-revealed .iv-collage figure:nth-child(2)::after { animation-delay: 2.6s; }
.iv.is-revealed .iv-collage figure:nth-child(3)::after { animation-delay: 3s; }
@keyframes ivShine { 0% { transform: translateX(-130%); } 22%, 100% { transform: translateX(130%); } }

/* 金 a：拱門內照片由下往上升起，圓形小照旋轉彈出後輕輕漂浮 */
.iv-arch .iv-slides { clip-path: inset(100% 0 0 0); transition: clip-path 1.4s cubic-bezier(.6,0,.2,1) .5s; }
.iv.is-revealed .iv-arch .iv-slides { clip-path: inset(0 0 0 0); }
.iv-medal { transform: scale(0) rotate(-140deg); transition: transform .9s cubic-bezier(.34,1.56,.64,1) 1.6s; }
.iv.is-revealed .iv-medal { transform: none; animation: ivBob 5s ease-in-out 2.6s infinite; }
@keyframes ivBob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(4deg); } }

/* 藍 b：拼貼照片依序飛入 */
.iv-collage figure {
  opacity: 0; transform: translateY(28px) scale(.94) rotate(-2.5deg);
  transition: opacity .8s ease, transform 1.1s cubic-bezier(.2,.8,.2,1);
  transition-delay: .45s;
}
.iv-collage figure:nth-child(2) { transform: translate(-14px, 30px) scale(.94) rotate(3deg); transition-delay: .75s; }
.iv-collage figure:nth-child(3) { transform: translate(14px, 30px) scale(.94) rotate(-3deg); transition-delay: 1.05s; }
.iv.is-revealed .iv-collage figure { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .iv-slides img, .iv-medal, .iv.is-revealed .iv-medal, .iv-arch::after, .iv-collage figure::after { animation: none !important; }
  .iv-arch .iv-slides, .iv-medal, .iv-collage figure { transition: none; clip-path: none; transform: none; opacity: 1; }
}

/* 第 3 版：頂端留出「← 主頁」「重看開信動畫」的位置，不壓到卡片 */
.iv-card-wrap { padding-top: calc(52px + env(safe-area-inset-top)); }
/* 內頁捲動時，兩個連結蓋在文字上 → 做成半透明膠囊，維持可讀 */
.iv[data-stage="card"] .iv-home, .iv[data-stage="card"] .iv-replay {
  top: calc(10px + env(safe-area-inset-top)); padding: 4px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--iv-paper) 90%, transparent);
  box-shadow: 0 1px 6px rgba(0,0,0,.12); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.iv[data-stage="card"] .iv-home { left: 10px; } .iv[data-stage="card"] .iv-replay { right: 10px; }

/* 頁尾署名（邀請函內頁最下面；顏色用邀請函自己的變數） */
.site-credit.in-card { padding: 1.6rem 0 .4rem; margin: 0; font: 300 .72rem/1.6 'Josefin Sans', 'Lato', sans-serif; letter-spacing: .18em; color: var(--iv-text-light); text-align: center; opacity: .9; }
