:root {
  --vermilion: #8f161a;
  --deep-red: #5e0b10;
  --paper: #f6ecd8;
  --paper-dark: #ddc797;
  --gold: #d8ad4c;
  --gold-pale: #f2d992;
  --ink: #331d16;
  --screen-w: min(100vw, 480px);
  font-family: "STKaiti", "KaiTi", "Kaiti SC", serif;
  color: var(--ink);
  background: #2e090d;
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100dvh; background: #2e090d; }
button { font: inherit; }

.invitation {
  position: relative;
  width: var(--screen-w);
  height: 100dvh;
  min-height: 600px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--vermilion);
  isolation: isolate;
}

.page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transform: translateY(5%);
  transition: opacity .68s ease, transform .68s cubic-bezier(.2,.8,.25,1), visibility .68s;
  pointer-events: none;
}

.page.is-active { visibility: visible; opacity: 1; transform: translateY(0); pointer-events: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.cover, .closing { color: var(--gold-pale); background: radial-gradient(circle at 50% 42%, #a5231f 0%, var(--vermilion) 46%, var(--deep-red) 100%); }
.paper-grain, .paper-page::before, .notice::before, .closing::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35; background-image: repeating-linear-gradient(115deg, transparent 0 12px, rgba(255,255,255,.035) 13px 14px), repeating-linear-gradient(0deg, transparent 0 3px, rgba(33,11,4,.05) 4px 5px); }
.frame { position: absolute; inset: 19px; border: 1px solid rgba(242,217,146,.7); }
.frame-inner { inset: 27px; border-color: rgba(242,217,146,.36); }
.cloud { position: absolute; width: 220px; height: 70px; border: 1px solid rgba(242,217,146,.28); border-radius: 50%; transform: rotate(-16deg); }
.cloud::after { content: ""; position: absolute; width: 120px; height: 45px; right: -30px; top: -6px; border: inherit; border-radius: 50%; }
.cloud-one { top: 11%; left: -112px; }
.cloud-two { right: -135px; bottom: 13%; transform: rotate(18deg); }
.cover-content { position: absolute; inset: 17% 0 auto; text-align: center; }
.eyebrow, .closing-eyebrow { margin: 0; color: var(--gold); font-size: 13px; letter-spacing: 8px; }
.cover h1 { margin: 32px 0 13px; font-size: clamp(48px, 14vw, 66px); font-weight: 500; letter-spacing: 13px; line-height: 1; }
.cover-name { margin: 0; font-size: 26px; letter-spacing: 12px; }
.cover-copy { margin: 28px 0 0; color: rgba(242,217,146,.86); font-size: 14px; letter-spacing: 4px; }
.seal-mark { position: absolute; top: 98px; left: calc(50% + 72px); display: grid; place-items: center; width: 48px; height: 48px; padding-left: 2px; border: 1px solid var(--gold-pale); border-radius: 50%; color: var(--gold-pale); font-size: 14px; line-height: 16px; transform: rotate(12deg); }
.seal-button { position: absolute; left: 50%; bottom: 13%; width: 68px; height: 68px; border: 1px solid #f3d98e; border-radius: 50%; color: #f3d98e; background: rgba(92,8,11,.28); cursor: pointer; transform: translateX(-50%); transition: transform .2s, background .2s; }
.seal-button span { display: block; font-size: 18px; line-height: 19px; letter-spacing: 2px; }
.seal-button:hover, .seal-button:focus-visible { background: rgba(242,217,146,.15); transform: translateX(-50%) scale(1.05); outline: none; }
.open-hint { position: absolute; bottom: 7%; width: 100%; margin: 0; text-align: center; color: rgba(242,217,146,.72); font-size: 12px; letter-spacing: 5px; }

.letter { background: var(--paper); }
.paper-page { position: absolute; inset: 0; border: 17px solid #c18f45; border-image: linear-gradient(135deg, #a66c2c, #e6c67c, #a66c2c) 1; }
.paper-page::after { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(115,64,23,.36); }
.letter-heading { position: absolute; top: 7%; left: 0; width: 100%; color: #9e201d; font-size: 19px; letter-spacing: 10px; line-height: 1; text-align: center; }
.letter-heading span { display: inline; }
.letter-copy { position: absolute; top: 17%; right: 12%; bottom: 22%; left: 16%; display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 3px; direction: rtl; }
.letter-copy p { height: 100%; margin: 0; direction: ltr; writing-mode: vertical-rl; color: #3a241a; font-size: clamp(15px, 4.25vw, 18px); line-height: 1.65; letter-spacing: 1px; text-align: start; }
.signature { position: absolute; left: 10%; bottom: 12%; margin: 0; writing-mode: vertical-rl; font-size: 14px; letter-spacing: 2px; }
.corner-branch { position: absolute; width: 110px; height: 110px; left: -18px; bottom: -24px; border: 1px solid rgba(120,59,29,.36); border-radius: 70% 30% 60% 40%; transform: rotate(32deg); }
.corner-branch::after { content: ""; position: absolute; width: 92px; height: 25px; border-top: 1px solid rgba(120,59,29,.4); transform: rotate(-35deg); top: 44px; left: 14px; }

.next-button { position: absolute; right: 8%; bottom: 5.5%; display: inline-flex; align-items: center; gap: 8px; padding: 9px 0; border: 0; border-bottom: 1px solid currentColor; color: #8d1c1e; background: transparent; font-size: 14px; letter-spacing: 3px; cursor: pointer; }
.next-button i { width: 7px; height: 7px; border-top: 1px solid currentColor; border-right: 1px solid currentColor; transform: rotate(45deg); }
.next-button.dark { color: var(--paper); }

.notice { background: linear-gradient(145deg, #0d4c66 0%, #0e6d88 43%, #0b3e57 100%); color: var(--paper); }
.notice::before { opacity: .18; }
.notice-topline { position: absolute; top: 8%; left: 10%; right: 10%; display: flex; align-items: center; gap: 12px; justify-content: center; color: #d8ba72; font-size: 16px; letter-spacing: 7px; }
.notice-topline span { flex: 1; height: 1px; background: rgba(216,186,114,.65); }
.notice-card { position: absolute; top: 20%; left: 8%; right: 8%; padding: 26px 18px 24px; color: #223039; background: #f5f0df; box-shadow: 0 14px 34px rgba(0,0,0,.25); transform: rotate(-1.2deg); }
.notice-card::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(33,83,105,.35); pointer-events: none; }
.notice-card img { display: block; width: 100%; height: auto; margin: 4px auto 20px; border: 1px solid #a8a79b; filter: saturate(.83) contrast(.95); }
.notice-ribbon { position: absolute; top: 0; right: 18px; padding: 8px 10px 15px; color: #f8e4aa; background: #9c2220; font-size: 12px; letter-spacing: 2px; writing-mode: vertical-rl; }
.notice-copy { padding-left: 10px; text-align: left; }
.notice-copy p { margin: 4px 0; font-size: 14px; letter-spacing: 2px; }
.notice-copy .notice-name { font-size: 18px; }
.notice-copy h2 { margin: 8px 0; color: #114e67; font-size: clamp(25px, 7vw, 32px); font-weight: 600; letter-spacing: 2px; }
.notice-copy .major { color: #4f5148; line-height: 1.8; }
.notice-stamp { position: absolute; right: 24px; bottom: 26px; display: grid; place-content: center; width: 55px; height: 55px; border: 2px solid #ad4d3d; border-radius: 50%; color: #ad4d3d; font-size: 13px; line-height: 15px; letter-spacing: 1px; text-align: center; transform: rotate(-13deg); }
.notice-note { position: absolute; bottom: 14%; width: 100%; margin: 0; color: rgba(245,240,223,.84); text-align: center; font-size: 15px; letter-spacing: 6px; }

.campus { color: #f4ead7; background: #173f4e; }
.campus::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(9,24,31,.2), transparent 25%, transparent 70%, rgba(6,20,26,.7)); z-index: 1; }
.campus-heading { position: absolute; z-index: 3; top: 7%; width: 100%; text-align: center; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.campus-heading span { display: block; font-size: 29px; letter-spacing: 9px; }
.campus-heading small { display: block; margin-top: 7px; font-family: Georgia, serif; font-size: 8px; letter-spacing: 2px; }
.campus-card { position: absolute; z-index: 0; top: 20%; right: 5%; left: 5%; aspect-ratio: 16 / 9; margin: 0; overflow: hidden; border: 1px solid rgba(244,234,215,.8); background: rgba(8,35,44,.65); box-shadow: 0 16px 34px rgba(1,14,20,.3); opacity: 0; transform: scale(1.04); transition: opacity 1s ease, transform 6s ease; }
.campus-card.is-showing { z-index: 1; opacity: 1; transform: scale(1); }
.campus-card img { width: 100%; height: 100%; object-fit: contain; }
.campus-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 48%, rgba(6,19,26,.78)); }
.campus-card figcaption { position: absolute; z-index: 1; right: 6%; bottom: 7%; color: #f3e8c9; font-size: 15px; letter-spacing: 3px; text-shadow: 0 1px 7px #102b34; }
.campus-verse { position: absolute; z-index: 3; bottom: 12%; width: 100%; margin: 0; color: #f8efd9; font-size: 16px; letter-spacing: 4px; line-height: 1.8; text-align: center; text-shadow: 0 1px 9px #0c222a; }
.campus-next { z-index: 4; right: 50%; bottom: 3%; color: var(--paper); transform: translateX(50%); }

.closing-content { position: absolute; inset: 13% 13% 10%; z-index: 1; text-align: center; }
.closing h2 { margin: 23px 0 38px; font-size: clamp(42px, 12vw, 56px); font-weight: 500; letter-spacing: 12px; }
.date-block { padding: 18px 0; border-top: 1px solid rgba(242,217,146,.58); border-bottom: 1px solid rgba(242,217,146,.58); }
.date-main, .date-lunar { margin: 4px 0; letter-spacing: 3px; }
.date-main { font-size: 19px; }.date-lunar { color: rgba(242,217,146,.82); font-size: 14px; }
.venue-block { display: flex; justify-content: center; align-items: baseline; gap: 19px; margin: 42px 0 26px; }
.venue-block span { font-size: 14px; letter-spacing: 5px; }.venue-block strong { font-size: 28px; font-weight: 500; letter-spacing: 8px; }
.closing-copy { margin: 0; font-size: 15px; letter-spacing: 4px; line-height: 2; }.closing-signature { margin: 40px 0 0; font-size: 14px; letter-spacing: 3px; }
.closing-seal { position: absolute; right: 10%; bottom: 6%; display: grid; place-content: center; width: 57px; height: 57px; border: 1px solid #f2d992; border-radius: 50%; color: #f2d992; font-size: 13px; line-height: 16px; text-align: center; transform: rotate(12deg); }
.restart-button { position: absolute; z-index: 2; left: 50%; bottom: 4.5%; padding: 8px 12px; border: 0; color: rgba(242,217,146,.82); background: transparent; font-size: 12px; letter-spacing: 3px; cursor: pointer; transform: translateX(-50%); }

.music-toggle { position: absolute; z-index: 20; top: max(16px, env(safe-area-inset-top)); right: 17px; display: grid; place-content: center; width: 34px; height: 34px; padding: 0; border: 1px solid rgba(242,217,146,.72); border-radius: 50%; color: var(--gold-pale); background: rgba(69,9,12,.28); cursor: pointer; }
.music-bars { display: flex; align-items: flex-end; gap: 2px; height: 13px; }.music-bars i { display: block; width: 2px; height: 6px; background: currentColor; }.music-bars i:nth-child(2) { height: 11px; }.music-bars i:nth-child(3) { height: 8px; }
.music-toggle[aria-pressed="true"] .music-bars i { animation: equalize .75s ease-in-out infinite alternate; }.music-toggle[aria-pressed="true"] .music-bars i:nth-child(2) { animation-delay: .18s; }.music-toggle[aria-pressed="true"] .music-bars i:nth-child(3) { animation-delay: .32s; }
@keyframes equalize { to { height: 13px; } }

@media (min-width: 481px) { body { display: grid; place-items: center; }.invitation { height: min(100dvh, 900px); border-radius: 3px; box-shadow: 0 20px 60px rgba(0,0,0,.45); } }
@media (max-height: 690px) { .cover-content { inset: 11% 0 auto; }.seal-button { bottom: 10%; }.open-hint { bottom: 3%; }.letter-copy { top: 11%; bottom: 13%; font-size: 17px; }.notice-card { top: 16%; }.notice-note { bottom: 11%; }.closing-content { inset: 9% 13% 7%; }.closing h2 { margin: 17px 0 25px; }.venue-block { margin: 29px 0 19px; }.closing-signature { margin-top: 26px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
