/* =====================================================================
   magic.css – 마법 버전 전용 스타일 (#theme-magic 안쪽만)
   색: 배경 #0F1A2E→#1B2A47 / 골드 #C9A55C / 밝은 골드 #E8D5A3
       양피지 #E9DCC0 / 봉인 #7A1F2B / 글자 #EDE6D6 (양피지 위 #3B2A1A)
   글꼴: 제목 IM Fell English(영문)·Hahmlet(한글), 본문 Gowun Batang
   클래스 이름은 모두 mg- 로 시작합니다 (magic의 줄임).

   움직임 규칙
   - 별 반짝임, 떠다니는 깃털·편지는 .mg-sky(화면 고정 레이어)에서만 움직인다.
   - 날짜·장소·계좌 섹션(.mg-calm)이 화면에 보이면 #theme-magic에 .mg-paused가 붙어 멈춘다.
   - 폰의 '동작 줄이기' 설정은 base.css의 규칙이 모든 애니메이션을 거의 0초로 줄인다.
   ===================================================================== */

#theme-magic {
  background: linear-gradient(180deg, var(--mg-bg-top) 0%, var(--mg-bg-bottom) 100%);
  color: var(--mg-text);
  font-family: var(--font-serif);
}

/* ---------- 하늘 레이어: 별, 깃털, 편지 (화면에 고정, 430px 칸 안) ---------- */
.mg-sky {
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--page-width);
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
/* 별: 점 하나에 box-shadow로 여러 개를 찍는다 (요소 수가 적어 오래된 폰에도 가볍다) */
.mg-stars {
  position: absolute;
  top: 0; left: 0;
  width: 2px; height: 2px;
  border-radius: 50%;
}
.mg-stars--1 { animation: mg-twinkle 3.2s ease-in-out infinite; }
.mg-stars--2 { animation: mg-twinkle 4.3s ease-in-out 1.1s infinite; }
.mg-stars--3 { animation: mg-twinkle 5.1s ease-in-out 2.3s infinite; }
@keyframes mg-twinkle {
  0%, 100% { opacity: .35; }
  50% { opacity: 1; }
}
/* 떠다니는 깃털과 편지 */
.mg-drift {
  position: absolute;
  top: 0;
  color: var(--mg-gold-light);
  opacity: .55;
  animation: mg-drift 28s linear infinite;
  will-change: transform;
}
.mg-drift svg { display: block; width: 100%; height: auto; }
@keyframes mg-drift {
  0%   { transform: translate3d(0, -12vh, 0) rotate(-8deg); }
  25%  { transform: translate3d(18px, 20vh, 0) rotate(8deg); }
  50%  { transform: translate3d(-14px, 50vh, 0) rotate(-12deg); }
  75%  { transform: translate3d(16px, 80vh, 0) rotate(10deg); }
  100% { transform: translate3d(0, 112vh, 0) rotate(-6deg); }
}
/* 고요 구역: 날짜·장소·계좌가 보이는 동안 멈춤 */
#theme-magic.mg-paused .mg-sky * { animation-play-state: paused; }
#theme-magic.mg-paused .mg-drift { opacity: .12; transition: opacity .6s ease; }

/* ---------- 섹션 공통 ---------- */
.mg-section {
  position: relative;
  z-index: 1;
  padding: 72px 24px;
  text-align: center;
  overflow: hidden;
}
/* 등장할 때 섹션 위를 스치는 금빛 줄기 */
.mg-section.is-visible::before {
  content: "";
  position: absolute;
  top: 0; left: -40%;
  width: 40%; height: 100%;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 0%, rgba(232, 213, 163, .13) 50%, transparent 100%);
  animation: mg-sweep 1.4s ease-out .1s 1 both;
}
@keyframes mg-sweep {
  from { left: -40%; opacity: 0; }
  20%  { opacity: 1; }
  to   { left: 110%; opacity: 0; }
}
/* 등장할 때 흩어지는 작은 반짝임 (magic.js가 잠깐 넣었다 뺀다) */
.mg-spark {
  position: absolute;
  width: 6px; height: 6px;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, #FFF6DA 0%, var(--mg-gold-light) 40%, transparent 70%);
  animation: mg-spark 1.3s ease-out forwards;
}
.mg-spark::before, .mg-spark::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  background: var(--mg-gold-light);
  transform: translate(-50%, -50%);
}
.mg-spark::before { width: 16px; height: 1px; }
.mg-spark::after { width: 1px; height: 16px; }
@keyframes mg-spark {
  0%   { opacity: 0; transform: scale(.2); }
  35%  { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(.4) translateY(-12px); }
}

/* 섹션 제목: 영문(IM Fell) → 한글(Hahmlet) → 장식선 */
.mg-heading { margin-bottom: 32px; }
.mg-heading-en {
  font-family: var(--font-fell);
  font-style: italic;
  font-size: 14px;
  letter-spacing: .14em;
  color: var(--mg-gold);
}
.mg-heading-ko {
  font-family: var(--font-hahmlet);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: .04em;
  color: var(--mg-gold-light);
  margin-top: 2px;
}
.mg-heading-rule {
  display: block;
  width: 120px; height: 10px;
  margin: 12px auto 0;
  color: var(--mg-gold);
}

/* 본문 글 */
.mg-text { font-size: 15px; line-height: 1.95; white-space: pre-line; }
.mg-small { font-size: 13px; color: rgba(237, 230, 214, .65); line-height: 1.6; }

/* 양피지 카드 */
.mg-parchment {
  position: relative;
  padding: 28px 16px;          /* 좌우 여백을 줄여 360px에서도 한 줄에 17자 정도가 들어가게 */
  background:
    radial-gradient(ellipse at 20% 15%, rgba(255, 255, 255, .32), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(122, 90, 40, .14), transparent 55%),
    var(--mg-parchment);
  color: var(--mg-text-on-paper);
  border-radius: 3px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(122, 90, 40, .25);
  text-align: center;
}
.mg-parchment::before {
  content: "";
  position: absolute;
  top: 7px; left: 7px; right: 7px; bottom: 7px;
  border: 1px solid rgba(122, 90, 40, .4);
  pointer-events: none;
}
.mg-parchment + .mg-parchment { margin-top: 16px; }
.mg-parchment-title {
  font-family: var(--font-hahmlet);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: .12em;
  color: var(--mg-seal);
}
.mg-parchment-sub { margin-top: 4px; font-size: 12px; letter-spacing: .08em; color: #7A6246; }
.mg-parchment-to { font-size: 14px; color: #5A4530; }
.mg-parchment-text { margin-top: 14px; font-size: 15px; line-height: 1.95; white-space: pre-line; }
.mg-parchment-sign { margin-top: 18px; font-size: 13px; color: #6B5236; }
.mg-parchment-note { margin-top: 10px; font-size: 12px; color: #7A6246; }
.mg-parchment-rule {
  width: 60%; height: 1px;
  margin: 18px auto;
  background: linear-gradient(90deg, transparent, rgba(122, 90, 40, .6), transparent);
}

/* 버튼 */
.mg-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 3px;
  border: 1px solid var(--mg-gold);
  color: var(--mg-gold-light);
  background: rgba(201, 165, 92, .08);
  font-family: var(--font-hahmlet);
  font-size: 14px;
  letter-spacing: .04em;
  white-space: nowrap;
  transition: background-color .2s ease;
}
.mg-btn::before {
  content: "";
  position: absolute;
  top: 3px; left: 3px; right: 3px; bottom: 3px;
  border: 1px solid rgba(201, 165, 92, .35);
  pointer-events: none;
}
.mg-btn:active { background: rgba(201, 165, 92, .22); }
.mg-btn--fill {
  background: linear-gradient(180deg, var(--mg-gold-light), var(--mg-gold));
  border-color: var(--mg-gold-light);
  color: #2A1E12;
}
.mg-btn--fill::before { border-color: rgba(42, 30, 18, .25); }
.mg-btn--block { display: flex; width: 100%; }
.mg-btn--small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.mg-btn[disabled] { opacity: .4; cursor: default; }
.mg-btn-row { display: flex; gap: 8px; }
.mg-btn-row > .mg-btn { flex: 1 1 0; min-width: 0; padding: 0 6px; }
/* 양피지 위의 버튼은 버건디 */
.mg-parchment .mg-btn, .mg-letter .mg-btn {
  color: var(--mg-seal);
  border-color: var(--mg-seal);
  background: rgba(122, 31, 43, .06);
}
.mg-parchment .mg-btn::before, .mg-letter .mg-btn::before { border-color: rgba(122, 31, 43, .3); }
.mg-parchment .mg-btn:active, .mg-letter .mg-btn:active { background: rgba(122, 31, 43, .16); }
.mg-parchment .mg-btn--fill {
  background: linear-gradient(180deg, #8F2A38, var(--mg-seal));
  border-color: var(--mg-seal);
  color: var(--mg-parchment);
}
.mg-parchment .mg-btn--fill::before { border-color: rgba(233, 220, 192, .35); }

/* 사진 상자의 마법 색 */
#theme-magic .photo-box { background: #22314F; }
#theme-magic .photo-box.is-missing::after { color: rgba(237, 230, 214, .55); }

/* 양피지 위의 정보 줄 (의식 안내, 지도의 교통 안내) */
.mg-info-row {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid rgba(122, 90, 40, .3);
  text-align: left;
  font-size: 15px;
  line-height: 1.7;
}
.mg-info-row:last-child { border-bottom: 1px solid rgba(122, 90, 40, .3); }
.mg-info-key {
  flex: 0 0 64px;
  padding-top: 2px;
  font-family: var(--font-hahmlet);
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--mg-seal);
}
.mg-info-val { flex: 1 1 0; min-width: 0; }
.mg-info-val small { display: block; font-size: 13px; color: #6B5236; }
/* 세로 배치: 항목명이 위, 내용이 아래 (의식 일시처럼 긴 내용용) */
.mg-info-row--stack { flex-direction: column; gap: 2px; text-align: center; }
.mg-info-row--stack .mg-info-key { flex: 0 0 auto; padding-top: 0; }

/* ---------- 1. 입장: 초, 봉인된 편지 ---------- */
#magic-entrance {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(72px + env(safe-area-inset-top, 0px)) 24px 20px;
}
.mg-entrance-initials {
  font-family: var(--font-fell);
  font-size: 46px;
  line-height: 1;
  letter-spacing: .08em;
  color: var(--mg-gold-light);
  animation: mg-fade-up 1.2s ease 1.6s both;
}
.mg-entrance-initials .amp {
  font-style: italic;
  font-size: 30px;
  margin: 0 8px;
  color: var(--mg-gold);
}
.mg-entrance-names {
  margin-top: 10px;
  font-family: var(--font-hahmlet);
  font-size: 15px;
  letter-spacing: .3em;
  animation: mg-fade-up 1.2s ease 1.9s both;
}
@keyframes mg-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* 봉인된 편지 */
.mg-envelope-wrap { animation: mg-fade-up 1.2s ease 2.4s both; }
.mg-envelope {
  position: relative;
  width: 250px; height: 165px;
  margin: 0 auto;
  perspective: 900px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mg-env-back {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #D9C9A5;
  border-radius: 5px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .55);
}
.mg-env-letter {
  position: absolute;
  left: 14px; right: 14px; top: 12px; bottom: 14px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #F2E9D3;
  border: 1px solid rgba(122, 90, 40, .4);
  color: var(--mg-text-on-paper);
  transition: transform .9s cubic-bezier(.2, .7, .2, 1) .35s;
}
.mg-env-letter-en {
  font-family: var(--font-fell);
  font-style: italic;
  font-size: 19px;
  letter-spacing: .08em;
  color: var(--mg-seal);
}
.mg-env-letter-ko { margin-top: 4px; font-size: 12px; color: #6B5236; }
.mg-env-front {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 100%;
  z-index: 2;
  background: #E4D5B3;
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%);
  border-radius: 0 0 5px 5px;
}
.mg-env-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60%;
  z-index: 3;
  background: #E9DCC0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 5px 5px 0 0;
  transform-origin: top center;
  transition: transform .8s ease, z-index 0s .4s;
}
.mg-seal {
  position: absolute;
  left: 50%; top: 60%;
  z-index: 4;
  width: 58px; height: 58px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #A0333F, var(--mg-seal) 55%, #4E1119);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .5), 0 0 0 0 rgba(201, 165, 92, 0), inset 0 0 0 3px rgba(255, 255, 255, .08), inset 0 0 12px rgba(0, 0, 0, .35);
  font-family: var(--font-fell);
  font-size: 17px;
  letter-spacing: .04em;
  color: var(--mg-gold-light);
  transition: opacity .5s ease, transform .5s ease;
  animation: mg-seal-pulse 2.4s ease-in-out 3.6s infinite;
}
@keyframes mg-seal-pulse {
  0%, 100% { box-shadow: 0 3px 8px rgba(0, 0, 0, .5), 0 0 0 0 rgba(201, 165, 92, 0), inset 0 0 0 3px rgba(255, 255, 255, .08), inset 0 0 12px rgba(0, 0, 0, .35); }
  50%      { box-shadow: 0 3px 8px rgba(0, 0, 0, .5), 0 0 0 12px rgba(201, 165, 92, .14), inset 0 0 0 3px rgba(255, 255, 255, .08), inset 0 0 12px rgba(0, 0, 0, .35); }
}
.mg-envelope.is-open .mg-env-flap { transform: rotateX(180deg); z-index: 0; }
.mg-envelope.is-open .mg-seal { opacity: 0; transform: translate(-50%, -50%) scale(.5); animation: none; }
.mg-envelope.is-open .mg-env-letter { transform: translateY(-78px); }
.mg-entrance-label {
  margin-top: 24px;
  font-size: 14px;
  letter-spacing: .06em;
  color: var(--mg-gold);
}
.mg-entrance-label.is-done { color: var(--mg-text); }

/* 촛불: 하나씩 켜진다 (--delay는 magic.js가 초마다 다르게 넣는다) */
.mg-entrance-bottom { width: 100%; }
.mg-candles {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 22px;
}
.mg-candle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 22px;
}
.mg-candle-glow {
  position: absolute;
  top: -22px; left: 50%;
  width: 72px; height: 72px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 213, 163, .32), transparent 65%);
  opacity: 0;
  animation: mg-glow .9s ease var(--delay, 0s) forwards;
  pointer-events: none;
}
@keyframes mg-glow { to { opacity: 1; } }
.mg-candle-flame {
  width: 14px; height: 24px;
  opacity: 0;
  transform-origin: 50% 100%;
  animation:
    mg-light-up .7s ease var(--delay, 0s) forwards,
    mg-flicker 1.5s ease-in-out calc(var(--delay, 0s) + .7s) infinite alternate;
}
@keyframes mg-light-up {
  from { opacity: 0; transform: scale(.2); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes mg-flicker {
  0%   { transform: scale(1) skewX(0); }
  35%  { transform: scale(1.06, .94) skewX(-3deg); }
  70%  { transform: scale(.95, 1.08) skewX(3deg); }
  100% { transform: scale(1.03, .98) skewX(-1deg); }
}
.mg-candle-wick { width: 2px; height: 5px; background: #3A2A1A; margin-top: -3px; }
.mg-candle-body {
  width: 12px;
  height: var(--h, 40px);
  background: linear-gradient(90deg, #F3E6CC, #D8C7A2 60%, #B9A47E);
  border-radius: 2px 2px 1px 1px;
}
.mg-scroll-hint {
  margin-top: 26px;
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--mg-gold);
  opacity: .85;
  animation: mg-fade-up 1s ease 3.4s both;
}
.mg-scroll-hint::after {
  content: "";
  display: block;
  width: 8px; height: 8px;
  margin: 6px auto 0;
  border-right: 1px solid var(--mg-gold);
  border-bottom: 1px solid var(--mg-gold);
  animation: mg-bob 1.6s ease-in-out infinite;
}
@keyframes mg-bob {
  0%, 100% { transform: rotate(45deg) translate(0, 0); }
  50%      { transform: rotate(45deg) translate(3px, 3px); }
}

/* ---------- 2. 초대장: 가문 문장, 입학 통지서 ---------- */
.mg-crest {
  display: block;
  width: 200px; height: auto;
  margin: 0 auto 28px;
  filter: drop-shadow(0 0 16px rgba(201, 165, 92, .28));
}
/* 양가 가문: 세 칸(부모님 성함 | 의 아들 | 이름)짜리 표로 놓아 두 줄이 세로로 줄 맞게 (2026-11-09). 글꼴은 모두 Hahmlet 하나로 */
.mg-family {
  margin-top: 4px;
  font-family: var(--font-hahmlet);
  font-size: 14px;
  line-height: 2.1;
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: center;
  align-items: baseline;            /* 세 칸의 글씨 아랫줄을 맞춘다. 기본값이면 작은 글씨('의 아들')가 위로 떠 보인다 (2026-11-10) */
  column-gap: 8px;
}
.mg-family-title {
  grid-column: 1 / -1;              /* 제목은 표 위에 한 줄로 */
  font-size: 12px;
  letter-spacing: .24em;
  color: var(--mg-seal);
  margin-bottom: 6px;
}
.mg-family .mg-family-line { display: contents; }
.mg-family .mg-names { text-align: right; }
.mg-family .mg-rel { text-align: left; font-size: 13px; color: #7A6246; }
.mg-family strong { text-align: left; font-weight: 600; }
.mg-deceased { font-size: 11px; vertical-align: top; color: #7A6246; }

/* ---------- 3. 두 마법사 이야기 ---------- */
.mg-wizards { display: flex; flex-direction: column; gap: 22px; }
.mg-wizard {
  position: relative;
  padding: 26px 20px 24px;
  border: 1px solid rgba(201, 165, 92, .55);
  border-radius: 6px;
  background: rgba(15, 26, 46, .55);
  box-shadow: inset 0 0 0 1px rgba(201, 165, 92, .12), 0 12px 30px rgba(0, 0, 0, .4);
  animation: mg-hover 6s ease-in-out infinite;
}
.mg-wizard--bride { animation-delay: -3s; }
@keyframes mg-hover {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.mg-wizard::before {
  content: "";
  position: absolute;
  top: 6px; left: 6px; right: 6px; bottom: 6px;
  border: 1px solid rgba(201, 165, 92, .25);
  pointer-events: none;
}
.mg-wizard-frame {
  width: 140px; height: 172px;
  margin: 0 auto 16px;
  padding: 5px;
  border-radius: 50% / 45%;
  background: linear-gradient(160deg, var(--mg-gold-light), var(--mg-gold) 45%, #8E7036 80%, var(--mg-gold-light));
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.mg-wizard-frame .photo-box { width: 100%; height: 100%; border-radius: 50% / 45%; }
.mg-wizard-frame .photo-box::before { display: none; }
.mg-wizard-role {
  font-family: var(--font-fell);
  font-style: italic;
  font-size: 13px;
  letter-spacing: .16em;
  color: var(--mg-gold);
}
.mg-wizard-name {
  margin-top: 2px;
  font-family: var(--font-hahmlet);
  font-weight: 600;
  font-size: 22px;
  color: var(--mg-gold-light);
}
.mg-wizard-intro { margin-top: 12px; font-size: 14px; line-height: 1.9; }

/* ---------- 4. 의식 안내 (고요 구역) ---------- */
.mg-hourglass { display: block; width: 92px; height: auto; margin: 22px auto 0; }
.mg-dday-count {
  margin-top: 8px;
  font-family: var(--font-fell);
  font-size: 38px;
  line-height: 1.1;
  color: var(--mg-seal);
}
.mg-dday-text { margin-top: 4px; font-size: 13px; color: #6B5236; }
.mg-dday-text strong { color: var(--mg-seal); }
.mg-ceremony-actions { margin-top: 20px; }
.mg-notice {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px dashed rgba(122, 90, 40, .45);
  font-size: 13px;
  line-height: 1.7;
  color: #5A4530;
}

/* ---------- 5. 움직이는 사진첩: 벽에 걸린 액자가 왼쪽으로 흐른다 ----------
   액자 두 벌을 이어 붙인 띠(.mg-album-track)를 -50%까지 밀면 정확히 한 벌만큼 움직여 처음과 이어진다.
   한 바퀴 시간(animation-duration)은 magic.js가 액자 수에 맞춰 넣는다 (초당 40px). 아래 150s는 그 전의 임시값 */
.mg-album-wall {
  margin: 0 -24px;            /* 섹션 양 끝까지 */
  padding: 6px 0 28px;        /* 아래 여백은 액자 그림자 자리 */
  overflow: hidden;
}
.mg-album-track {
  display: flex;
  width: max-content;
  animation: mg-album-flow 150s linear infinite;
}
@keyframes mg-album-flow { to { transform: translateX(-50%); } }
.mg-album-wall.is-paused .mg-album-track { animation-play-state: paused; }
@media (hover: hover) { .mg-album-wall:hover .mg-album-track { animation-play-state: paused; } }   /* 데스크톱: 마우스를 올리면 멈춤 */

.mg-frame {
  position: relative;
  flex: 0 0 236px;
  margin-right: 22px;         /* gap 대신 margin: 두 벌의 경계에도 같은 간격이 생겨 -50%에서 정확히 이어진다 */
  padding-top: 30px;          /* 못과 줄이 들어갈 자리 */
}
/* 가로 사진(data.js의 wide: true)은 가로 액자. 사진 칸 313×250(5:4)으로 세로 액자의 200×250과 높이가 같다 */
.mg-frame--wide { flex-basis: 349px; }
.mg-frame.mg-frame--wide .photo-box::before { padding-top: 80%; }   /* 아래 .mg-frame .photo-box::before(125%)보다 우선하도록 선택자를 하나 더 */

/* 동작 줄이기: 흐르지 않고 예전처럼 손으로 옆으로 넘기는 벽 (magic.js가 띠 없이 액자를 바로 걸고 is-static을 붙인다) */
.mg-album-wall.is-static {
  display: flex;
  padding: 6px 24px 28px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mg-album-wall.is-static::-webkit-scrollbar { display: none; }
.mg-album-wall.is-static .mg-frame { scroll-snap-align: center; }
.mg-album-wall.is-static .mg-frame:first-child { margin-left: calc(50% - 118px - 24px); }  /* 첫 액자가 가운데 오도록 */
.mg-album-wall.is-static .mg-frame:last-child { margin-right: calc(50% - 118px - 24px); }

.mg-frame-string {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 30px;
  color: var(--mg-gold);
}
.mg-frame-border {
  display: block;
  width: 100%;
  padding: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, #E8D5A3, #C9A55C 35%, #8E7036 60%, #E8D5A3);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .5);
  transform-origin: 50% -30px;  /* 못을 중심으로 살짝 흔들린다 */
  animation: mg-sway 7s ease-in-out infinite;
}
.mg-frame--alt .mg-frame-border { animation-delay: -3.5s; }   /* 한 장 걸러 반대 위상 (번호 기준이라 두 벌이 같은 위상, 이음새에서 안 튐) */
@keyframes mg-sway {
  0%, 100% { transform: rotate(-1.2deg); }
  50%      { transform: rotate(1.2deg); }
}
.mg-frame-mat { padding: 8px; background: #EFE6D2; }
.mg-frame .photo-box::before { padding-top: 125%; }
.mg-frame-caption {
  margin-top: 12px;
  font-family: var(--font-fell);
  font-style: italic;
  font-size: 13px;
  letter-spacing: .1em;
  color: var(--mg-gold);
}
.mg-album-hint { font-size: 12px; letter-spacing: .1em; color: rgba(237, 230, 214, .6); }
.mg-album-all { margin-top: 14px; }

/* ---------- 6. 마법 지도 (고요 구역) ---------- */
.mg-venue-name {
  font-family: var(--font-hahmlet);
  font-weight: 600;
  font-size: 20px;
  color: var(--mg-seal);
}
.mg-venue-hall { margin-top: 2px; font-size: 14px; color: #6B5236; }
.mg-venue-address { margin-top: 10px; font-size: 14px; line-height: 1.7; }
/* 전화·주소 복사 칩 (양피지 위 작은 상자) */
.mg-venue-actions { margin-top: 10px; display: flex; justify-content: center; gap: 8px; }
.mg-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(122, 90, 40, .45);
  border-radius: 2px;
  background: rgba(255, 250, 240, .5);
  font-size: 12px;
  color: #6B5236;
  text-decoration: none;
}
.mg-chip:active { background: rgba(122, 90, 40, .12); }
.mg-map {
  position: relative;
  height: 230px;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(122, 90, 40, .5);
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(122, 90, 40, .12) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(122, 90, 40, .12) 23px 24px),
    #E3D3AE;
  color: #6B5236;
  font-size: 14px;
  overflow: hidden;
}
.mg-map small { font-size: 12px; }
/* 카카오맵이 그려지면 양피지 색감: 지도를 세피아로 바래게 하고, 위에 양피지 빛과 가장자리 그늘을 덧칠한다 */
#magic-map-box .map-canvas { filter: sepia(.6) saturate(.7) brightness(.97) contrast(.9); }
.mg-map.has-map::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2;
  pointer-events: none;             /* 확대·축소 버튼은 눌려야 하므로 손가락은 통과 */
  background:
    radial-gradient(ellipse at center, rgba(233, 220, 192, 0) 50%, rgba(122, 90, 40, .45) 100%),
    rgba(233, 220, 192, .22);
  mix-blend-mode: multiply;
}
.mg-compass { width: 46px; height: 46px; margin-bottom: 6px; color: var(--mg-seal); opacity: .8; }
.mg-map-actions { margin-top: 10px; }      /* 지도 앱 버튼 셋은 .mg-btn-row 로 한 줄 */

/* 교통 안내 탭 (양피지 위): 고른 탭만 봉인색 글자와 2px 밑줄 */
.mg-transport { margin-top: 24px; text-align: left; }
.mg-tabs { display: flex; border-bottom: 1px solid rgba(122, 90, 40, .35); }
.mg-tab {
  position: relative;
  flex: 1 1 0;
  min-height: 40px;
  font-family: var(--font-hahmlet);
  font-size: 14px;
  color: #8A7250;
}
.mg-tab.is-active { color: var(--mg-seal); font-weight: 600; }
.mg-tab.is-active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--mg-seal);
}
.mg-tab-panel { display: none; padding-top: 16px; }
.mg-tab-panel.is-active { display: block; }
.mg-transport-item { font-size: 14px; line-height: 1.8; color: #3B2A1A; }
.mg-transport-item + .mg-transport-item { margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(122, 90, 40, .35); }
.mg-transport-item strong { display: block; margin-bottom: 2px; font-size: 13px; font-weight: 600; color: var(--mg-seal); }   /* 항목 title (예: 정류장 이름) */

/* ---------- 7. 부엉이 우편 ---------- */
.mg-owl-icon { display: block; width: 60px; height: 60px; margin: 0 auto 16px; color: var(--mg-gold); }
.mg-owl-text { margin-bottom: 24px; font-size: 14px; line-height: 1.9; white-space: pre-line; }
.mg-letter {
  position: relative;
  padding: 18px 18px 12px;
  text-align: left;
  background: var(--mg-parchment);
  color: var(--mg-text-on-paper);
  border-radius: 3px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
}
.mg-letter + .mg-letter { margin-top: 14px; }
.mg-letter::before {
  content: "";
  position: absolute;
  top: 5px; left: 5px; right: 5px; bottom: 5px;
  border: 1px solid rgba(122, 90, 40, .35);
  pointer-events: none;
}
.mg-letter-side {
  margin-bottom: 4px;
  font-family: var(--font-hahmlet);
  font-size: 13px;
  letter-spacing: .2em;
  color: var(--mg-seal);
}
.mg-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
}
.mg-contact-row + .mg-contact-row { border-top: 1px solid rgba(122, 90, 40, .25); }
.mg-contact-who { flex: 1 1 0; min-width: 0; font-family: var(--font-hahmlet); font-size: 15px; }
.mg-contact-who small { display: block; font-family: var(--font-serif); font-size: 12px; color: #7A6246; }
.mg-contact-row .mg-btn { flex: 0 0 auto; }

/* ---------- 8. 금고 (고요 구역) ---------- */
.mg-vault-note { margin-bottom: 24px; font-size: 14px; line-height: 1.9; white-space: pre-line; }
.mg-vault {
  text-align: left;
  border: 1px solid var(--mg-gold);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(201, 165, 92, .1), rgba(201, 165, 92, .03));
  box-shadow: inset 0 0 0 1px rgba(201, 165, 92, .2), 0 8px 24px rgba(0, 0, 0, .4);
  overflow: hidden;
}
.mg-vault + .mg-vault { margin-top: 14px; }
.mg-vault summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  font-family: var(--font-hahmlet);
  font-size: 16px;
  color: var(--mg-gold-light);
}
.mg-vault summary::-webkit-details-marker { display: none; }
.mg-vault-lock { flex: 0 0 auto; width: 22px; height: 22px; color: var(--mg-gold); transition: transform .3s ease; }
.mg-vault[open] .mg-vault-lock { transform: rotate(-20deg); }
.mg-vault-hint { margin-left: auto; font-family: var(--font-serif); font-size: 12px; color: var(--mg-gold); opacity: .85; white-space: nowrap; }
.mg-vault-body { padding: 0 18px 14px; }
.mg-acc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid rgba(201, 165, 92, .25);
}
.mg-acc-info { flex: 1 1 0; min-width: 0; font-size: 14px; line-height: 1.6; }
.mg-acc-who { font-size: 12px; color: var(--mg-gold); }
.mg-acc-number { font-variant-numeric: tabular-nums; }
.mg-acc-pay { display: flex; gap: 10px; margin-top: 4px; }
.mg-acc-pay a { font-size: 12px; color: var(--mg-gold-light); text-decoration: underline; text-underline-offset: 3px; }
.mg-acc-row .mg-btn { flex: 0 0 auto; }

/* ---------- 9. 축복의 주문 (방명록) ----------
   폼은 금테 상자 한 덩어리: 내용 칸 → 글자 수 → [이름 | 주문 남기기] 한 줄.
   글은 금테 카드: 이름·날짜 머리줄 아래 내용. 처음 5개만 보이고 '더 보기'로 펼친다 (features.js) */
.mg-spell-form {
  text-align: left;
  padding: 12px;
  background: rgba(233, 220, 192, .05);
  border: 1px solid rgba(201, 165, 92, .3);
  border-radius: 3px;
}
.mg-input, .mg-textarea {
  display: block;
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--mg-text);
  background: rgba(15, 26, 46, .6);
  border: 1px solid rgba(201, 165, 92, .4);
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
}
.mg-input:focus, .mg-textarea:focus { outline: none; border-color: var(--mg-gold); }
.mg-textarea { min-height: 104px; resize: none; line-height: 1.6; }
.mg-input::placeholder, .mg-textarea::placeholder { color: rgba(237, 230, 214, .45); }
.mg-input:disabled, .mg-textarea:disabled { opacity: .6; }
.mg-spell-counter { margin: 6px 4px 0; text-align: right; font-size: 12px; color: rgba(237, 230, 214, .5); }
.mg-spell-row { display: flex; gap: 8px; margin-top: 8px; }
.mg-spell-row .mg-input { flex: 1 1 auto; min-width: 0; }
.mg-spell-row .mg-btn { flex: 0 0 auto; padding: 0 18px; }

.mg-spell-count {
  margin-top: 28px;
  text-align: left;
  font-family: var(--font-hahmlet);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--mg-gold);
}
.mg-spell-count:empty { display: none; }
.mg-spell-list { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.mg-spell-entry {
  padding: 12px 14px;
  text-align: left;
  background: rgba(233, 220, 192, .06);
  border: 1px solid rgba(201, 165, 92, .35);
  border-radius: 3px;
}
.mg-spell-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.mg-spell-name { font-family: var(--font-hahmlet); font-size: 13px; color: var(--mg-gold); word-break: break-all; }
.mg-spell-date { font-size: 11px; color: rgba(237, 230, 214, .5); white-space: nowrap; }
.mg-spell-msg { margin-top: 6px; font-size: 14px; line-height: 1.8; white-space: pre-line; word-break: break-word; }
.mg-spell-more { margin-top: 16px; }
.mg-spell-status { margin-top: 16px; }
.mg-spell-status:empty { display: none; }

/* ---------- 10. 마무리 ---------- */
#magic-closing { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
.mg-closing-text { font-size: 15px; line-height: 2; white-space: pre-line; }
.mg-closing-actions { margin-top: 28px; }   /* 두 버튼은 .mg-btn-row 로 한 줄에 나란히 */
/* 서명: 짧은 금선 → 이니셜 → 이름 → 예식 날짜 */
.mg-footer {
  margin-top: 44px;
  font-family: var(--font-fell);
  font-style: italic;
  font-size: 16px;
  letter-spacing: .14em;
  color: var(--mg-gold);
}
.mg-footer::before {
  content: "";
  display: block;
  width: 28px;
  height: 1px;
  background: var(--mg-gold);
  opacity: .6;
  margin: 0 auto 18px;
}
.mg-footer-ko {
  margin-top: 6px;
  font-family: var(--font-hahmlet);
  font-size: 12px;
  letter-spacing: .3em;
  color: rgba(237, 230, 214, .6);
}
.mg-footer-date {
  margin-top: 6px;
  font-family: var(--font-fell);
  font-style: italic;
  font-size: 12px;
  letter-spacing: .2em;
  color: rgba(237, 230, 214, .5);
}
/* 배경음악 출처 (마법 곡이 CC BY라 표기가 필요) */
.mg-credit {
  margin-top: 36px;
  font-size: 11px;
  line-height: 1.7;
  color: rgba(237, 230, 214, .45);
  white-space: pre-line;
  word-break: break-all;
}
.mg-credit a { color: inherit; text-decoration: underline; }

/* ---------- 전환 버튼으로 들어왔을 때 (theme.js가 #theme-magic에 .mg-arrived를 붙임) ----------
   연출 레이어에서 이미 초를 켰으므로 입장 화면의 초는 켜진 채로 시작하고,
   이름은 바로 보이고 봉인된 편지만 살짝 늦게 나타난다 */
#theme-magic.mg-arrived .mg-entrance-initials,
#theme-magic.mg-arrived .mg-entrance-names { animation-delay: 0s; animation-duration: .6s; }
#theme-magic.mg-arrived .mg-candle-glow { animation: none; opacity: 1; }
#theme-magic.mg-arrived .mg-candle-flame { opacity: 1; animation: mg-flicker 1.5s ease-in-out infinite alternate; }
#theme-magic.mg-arrived .mg-envelope-wrap { animation-delay: .4s; }
#theme-magic.mg-arrived .mg-scroll-hint { animation-delay: 1.2s; }
#theme-magic.mg-arrived .mg-seal { animation-delay: 1.8s; }
