:root {
  --paper: #f4efe7;
  --paper-deep: #e9e0d4;
  --ink: #201b18;
  --muted: #716a63;
  --accent: #99181b;
  --accent-dark: #671013;
  --white: #fffdf8;
  --line: rgba(153, 24, 27, 0.24);
  --danger: #a43b3b;
  --success: #2f7055;
  --shadow: 0 24px 72px rgba(58, 39, 26, 0.14);
  --radius: 4px;
  --content-width: 760px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: #e8e2dc;
}

body {
  margin: 0;
  color: var(--ink);
  background: #e8e2dc;
  font: 400 16px/1.72 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: var(--white);
  background: var(--ink);
  border-radius: 8px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.invitation-shell {
  width: min(100%, var(--content-width));
  min-height: 100vh;
  margin-inline: auto;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
  overflow: hidden;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 16% 14%, rgba(255, 255, 255, 0.56), transparent 31%),
    radial-gradient(ellipse at 82% 47%, rgba(116, 78, 48, 0.035), transparent 34%),
    repeating-linear-gradient(17deg, rgba(92, 63, 44, 0.018) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(103deg, rgba(255, 255, 255, 0.2) 0 1px, transparent 1px 7px);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  padding: max(36px, env(safe-area-inset-top)) clamp(24px, 7vw, 58px) 82px;
  color: var(--ink);
  text-align: center;
}

.hero-topline {
  display: flex;
  justify-content: space-between;
  color: var(--accent);
  font: 600 14px/1 Georgia, "Times New Roman", serif;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hero-copy {
  margin: clamp(68px, 11vw, 104px) auto 48px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font: 600 11px/1.4 Georgia, "Times New Roman", serif;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.hero .eyebrow {
  margin-bottom: 42px;
  font-size: clamp(28px, 7.2vw, 48px);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: 0.08em;
}

.hero-script {
  margin: 0 0 48px;
  color: #b52528;
  font: 400 clamp(22px, 5.4vw, 37px)/1.2 "Snell Roundhand", "Segoe Script",
    "Bradley Hand", "STKaiti", cursive;
  letter-spacing: 0.04em;
}

.lead-copy {
  max-width: 32rem;
  margin: 0 auto;
  color: var(--ink);
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(16px, 4vw, 21px);
  line-height: 1.95;
  white-space: pre-line;
}

.hero-media {
  position: relative;
  width: min(82%, 510px);
  aspect-ratio: 4 / 5;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper-deep);
}

.hero-media img,
.cover-placeholder {
  width: 100%;
  height: 100%;
}

.hero-media img {
  display: block;
  object-fit: cover;
}

.cover-placeholder {
  display: grid;
  align-content: center;
  place-items: center;
  color: var(--accent);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.68), transparent 48%),
    #e8ded1;
}

.cover-placeholder span {
  font: 400 clamp(140px, 36vw, 260px)/0.85 Georgia, "Times New Roman", serif;
  opacity: 0.16;
}

.cover-placeholder small {
  margin-top: 26px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
}

.hero-handwriting {
  display: grid;
  gap: 5px;
  margin: 42px 0 34px;
  font-family: "STKaiti", "KaiTi", "Segoe Print", cursive;
}

.hero-handwriting strong {
  font-size: clamp(25px, 6vw, 38px);
  font-weight: 400;
  letter-spacing: 0.18em;
}

.hero-handwriting span {
  font-size: clamp(16px, 4vw, 24px);
  letter-spacing: 0.12em;
}

.name-lockup {
  display: grid;
  max-width: 560px;
  grid-template-columns: 82px minmax(0, 1fr) 82px;
  gap: 12px;
  align-items: center;
  margin: 0 auto;
}

.name-lockup > span {
  color: var(--accent);
  font: 500 12px/1 Georgia, "Times New Roman", serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(27px, 6vw, 39px);
  font-weight: 400;
  line-height: 1.3;
  text-wrap: balance;
}

.hero-timing {
  margin: 68px 0 0;
}

.hero-timing > p:first-child {
  margin: 0 0 34px;
  color: var(--accent);
  font: 500 clamp(25px, 6vw, 38px)/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-date {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(18px, 4.5vw, 25px);
  letter-spacing: 0.06em;
}

.hero-actions {
  display: flex;
  max-width: 420px;
  justify-content: center;
  gap: 12px;
  margin: 48px auto 0;
}

.share-button {
  min-height: 48px;
  padding: 12px 22px;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
}

.music-toggle {
  position: fixed;
  z-index: 24;
  right: 16px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 9px;
  color: var(--white);
  background: rgba(103, 16, 19, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(48, 36, 27, 0.22);
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.music-toggle[hidden] {
  display: none;
}

.music-toggle:disabled {
  cursor: default;
  opacity: 0.72;
}

.music-toggle-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--accent-dark);
  background: var(--white);
  border-radius: 50%;
  font: 700 17px/1 Georgia, serif;
}

.music-toggle.is-playing .music-toggle-icon {
  animation: music-pulse 1.8s ease-in-out infinite;
}

.button,
.text-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.button:active,
.text-button:active,
.share-button:active,
.music-toggle:active {
  transform: scale(0.98);
}

.button-light {
  color: var(--white);
  background: var(--accent);
  border: 1px solid var(--accent);
}

#open-invitation[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.72;
}

.button-primary {
  width: 100%;
  color: var(--white);
  background: var(--accent);
  border: 1px solid var(--accent);
}

.button-outline {
  width: 100%;
  color: var(--accent-dark);
  background: transparent;
  border: 1px solid var(--accent);
}

.section {
  padding: 82px clamp(24px, 7vw, 58px);
  border-top: 1px solid rgba(153, 24, 27, 0.13);
}

.section-kicker {
  color: var(--accent);
}

.section h2 {
  margin: 0 0 22px;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 400;
  line-height: 1.25;
}

.event-section {
  padding-top: 74px;
}

.event-card {
  padding: 42px clamp(20px, 5vw, 38px);
  background: rgba(255, 253, 248, 0.36);
  border-block: 3px double var(--line);
  text-align: center;
}

.event-details {
  margin: 0;
}

.event-details div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 16px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.event-details dt {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.08em;
}

.event-details dd {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 17px;
  text-align: left;
  overflow-wrap: anywhere;
}

.text-button {
  min-height: 44px;
  margin-top: 20px;
  padding-inline: 0;
  color: var(--accent);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.content-stream {
  padding: 26px clamp(24px, 7vw, 58px) 70px;
}

.content-block {
  margin: 0 0 38px;
}

.text-block {
  padding: 26px 4px;
  color: var(--muted);
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 18px;
  line-height: 1.9;
  text-align: center;
  white-space: pre-line;
}

.image-block img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 78vh;
  object-fit: cover;
  background: var(--paper-deep);
  border: 1px solid rgba(32, 27, 24, 0.08);
}

.image-block figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.empty-story,
.empty-state {
  color: var(--muted);
  text-align: center;
}

.empty-story {
  padding: 48px 20px;
  border-block: 1px solid var(--line);
}

.form-section {
  background: rgba(255, 253, 248, 0.42);
}

.section-intro {
  margin: -10px 0 28px;
  color: var(--muted);
}

.stack-form {
  display: grid;
  gap: 18px;
}

.stack-form label > span,
.stack-form legend {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
}

.stack-form small {
  color: var(--muted);
  font-weight: 400;
}

input,
select,
textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.78);
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 16px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(105, 79, 60, 0.12);
}

select:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.72;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-card {
  position: relative;
}

.choice-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice-card span {
  display: grid;
  min-height: 50px;
  margin: 0;
  place-items: center;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
}

.choice-card input:checked + span {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
}

.choice-card input:focus-visible + span {
  outline: 3px solid #2f5da8;
  outline-offset: 3px;
}

.origin-fields {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: rgba(255, 253, 248, 0.5);
  border: 1px solid var(--line);
  border-radius: 2px;
}

.origin-fields[hidden] {
  display: none;
}

.origin-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.origin-map-section {
  background: rgba(255, 253, 248, 0.2);
}

.origin-summary {
  margin-bottom: 24px;
}

.map-stage {
  position: relative;
  min-height: 340px;
  overflow: hidden;
  background: #ece5dc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.guest-map {
  width: 100%;
  height: clamp(340px, 74vw, 440px);
}

.map-service-notice {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 16px;
  align-content: center;
  align-items: center;
  padding: 30px;
  color: var(--accent-dark);
  background:
    radial-gradient(circle at 75% 18%, rgba(153, 24, 27, 0.08), transparent 10rem),
    linear-gradient(145deg, #f7f2eb, #e9e0d5);
}

.map-service-notice[hidden] {
  display: none;
}

.map-notice-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: #b7473c;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(183, 71, 60, 0.2);
  border-radius: 50%;
  font: 400 32px/1 Georgia, serif;
}

.map-service-notice strong {
  display: block;
  margin-bottom: 5px;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 20px;
  font-weight: 400;
}

.map-service-notice p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.map-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.map-legend[hidden] {
  display: none;
}

.map-location-note {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.map-legend i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.heat-low {
  background: #f4b8ad;
}

.heat-medium {
  background: #db6659;
}

.heat-high {
  background: #ab241b;
}

.city-ranking {
  margin-top: 34px;
  padding: 22px;
  background: rgba(255, 253, 248, 0.36);
  border-block: 3px double var(--line);
}

.city-ranking h3 {
  margin: 0 0 16px;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 23px;
  font-weight: 400;
}

.city-ranking .empty-state {
  margin: 0;
  padding: 18px 6px;
}

.city-ranking-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.city-ranking-item {
  position: relative;
  display: grid;
  min-height: 46px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  overflow: hidden;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid rgba(217, 208, 197, 0.74);
  border-radius: 2px;
  isolation: isolate;
}

.city-ranking-item::before {
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 0;
  width: 34%;
  content: "";
  background: linear-gradient(90deg, rgba(183, 71, 60, 0.14), transparent);
}

.city-ranking-item.is-medium::before {
  width: 66%;
}

.city-ranking-item.is-high::before {
  width: 100%;
}

.city-rank {
  color: var(--accent);
  font: 600 15px/1 Georgia, serif;
}

.city-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.city-count {
  color: #a7352c;
  font-weight: 700;
  white-space: nowrap;
}

.privacy-note,
.form-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.form-status:not(:empty) {
  padding: 11px 13px;
  color: var(--success);
  background: rgba(47, 112, 85, 0.08);
  border-radius: 10px;
}

.form-status.is-error:not(:empty) {
  color: var(--danger);
  background: rgba(164, 59, 59, 0.08);
}

.guestbook-section {
  padding-bottom: 96px;
}

.activity-stage {
  margin: 30px 0 46px;
  padding: 24px 20px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.4);
  border-block: 3px double var(--line);
  box-shadow: none;
}

.activity-heading,
.subsection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.activity-heading {
  margin-bottom: 14px;
}

.activity-heading h3,
.subsection-heading h3 {
  margin: 0;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 23px;
  font-weight: 400;
}

.activity-heading h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
}

.activity-heading > span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(153, 24, 27, 0.12);
  animation: live-pulse 1.8s ease-in-out infinite;
}

.activity-feed {
  max-height: 310px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 9px;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-color: rgba(153, 24, 27, 0.6) rgba(153, 24, 27, 0.08);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.activity-feed:focus-visible {
  outline: 2px solid rgba(153, 24, 27, 0.58);
  outline-offset: 4px;
}

.activity-feed::-webkit-scrollbar {
  width: 8px;
}

.activity-feed::-webkit-scrollbar-track {
  background: rgba(153, 24, 27, 0.08);
  border-radius: 999px;
}

.activity-feed::-webkit-scrollbar-thumb {
  background: rgba(153, 24, 27, 0.6);
  border-radius: 999px;
}

.activity-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list[hidden] {
  display: none;
}

.activity-empty,
.activity-card {
  display: grid;
  min-height: 86px;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 15px;
  overflow: hidden;
  background: rgba(153, 24, 27, 0.035);
  border: 1px solid rgba(153, 24, 27, 0.14);
  border-radius: 2px;
}

.activity-empty {
  margin: 0;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  text-align: center;
}

.activity-empty[hidden] {
  display: none;
}

.activity-card.is-entering {
  animation: activity-enter 360ms ease both;
}

.activity-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  background: rgba(153, 24, 27, 0.08);
  border-radius: 50%;
  font-size: 30px;
}

.activity-content {
  min-width: 0;
}

.activity-content p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.activity-meta {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 5px;
}

.activity-content time {
  color: var(--muted);
  font-size: 12px;
}

.activity-like-button {
  display: inline-flex;
  min-width: 72px;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 12px;
  color: var(--accent);
  background: rgba(153, 24, 27, 0.04);
  border: 1px solid rgba(153, 24, 27, 0.2);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease,
    transform 160ms ease;
}

.activity-like-button:active {
  transform: scale(0.96);
}

.activity-like-button:focus-visible {
  outline: 3px solid rgba(153, 24, 27, 0.28);
  outline-offset: 2px;
}

.activity-like-button.is-liked {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
}

.activity-like-button[aria-disabled="true"] {
  cursor: wait;
  opacity: 0.62;
}

.activity-like-count {
  min-width: 1ch;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: left;
}

.activity-like-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.subsection-heading {
  margin-bottom: 22px;
}

.gift-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.gift-choice {
  position: relative;
  min-width: 0;
}

.gift-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stack-form .gift-choice > .gift-tile {
  display: grid;
  width: 100%;
  min-height: 64px;
  margin: 0;
  padding: 6px 5px;
  grid-template-columns: auto minmax(0, auto);
  grid-template-rows: auto auto;
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: 1px 5px;
  overflow: hidden;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.58);
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.gift-emoji {
  grid-row: 1 / span 2;
  font-size: 25px;
  line-height: 1;
}

.gift-name {
  grid-column: 2;
  color: inherit;
  font-weight: 600;
  text-align: left;
}

.gift-price {
  grid-column: 2;
  max-width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
}

.gift-choice input:checked + .gift-tile {
  color: var(--accent-dark);
  background: #fffaf5;
  border-color: var(--accent);
  box-shadow: 0 7px 18px rgba(105, 79, 60, 0.1);
  transform: translateY(-2px);
}

.gift-choice input:checked + .gift-tile .gift-price {
  color: var(--accent);
}

.gift-choice input:focus-visible + .gift-tile {
  outline: 3px solid #2f5da8;
  outline-offset: 3px;
}

.clear-gift-button {
  display: inline-flex;
  min-height: 44px;
  margin-top: 8px;
  align-items: center;
  padding: 6px 2px;
  color: var(--accent);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.clear-gift-button[hidden] {
  display: none;
}

.page-footer {
  padding: 48px 24px 64px;
  color: var(--ink);
  background: transparent;
  border-top: 3px double var(--line);
  text-align: center;
}

.page-footer p {
  margin: 0 0 8px;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 22px;
}

.page-footer small {
  color: var(--accent);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-footer .icp-link {
  display: block;
  width: fit-content;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.page-footer .icp-link:hover,
.page-footer .icp-link:focus-visible {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.bottom-actions {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(244, 239, 231, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.bottom-actions a {
  display: grid;
  min-height: 46px;
  place-items: center;
  color: var(--white);
  background: var(--accent);
  border-radius: 999px;
  text-decoration: none;
}

.gift-celebration[hidden] {
  display: none;
}

.gift-celebration {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  pointer-events: none;
}

.gift-celebration-card {
  position: relative;
  display: grid;
  width: min(260px, 82vw);
  min-height: 210px;
  padding: 30px 24px;
  place-items: center;
  align-content: center;
  color: var(--white);
  background: rgba(55, 39, 29, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 26px;
  box-shadow: 0 28px 80px rgba(36, 25, 18, 0.3);
  opacity: 0;
  transform: scale(0.7) translateY(24px);
}

.gift-celebration.is-active .gift-celebration-card {
  animation: gift-burst 1.7s cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

.gift-celebration-emoji {
  font-size: 74px;
  line-height: 1;
}

.gift-celebration-card p {
  margin: 18px 0 0;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 18px;
  text-align: center;
}

.celebration-spark {
  position: absolute;
  color: #f5d5a9;
  font-size: 22px;
  opacity: 0;
}

.celebration-spark-one {
  top: 24px;
  left: 30px;
}

.celebration-spark-two {
  top: 38px;
  right: 26px;
}

.celebration-spark-three {
  right: 38px;
  bottom: 38px;
}

.gift-celebration.is-active .celebration-spark {
  animation: sparkle 800ms ease 260ms both;
}

.gift-celebration.is-active .celebration-spark-two {
  animation-delay: 380ms;
}

.gift-celebration.is-active .celebration-spark-three {
  animation-delay: 500ms;
}

@keyframes activity-enter {
  from {
    opacity: 0.35;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes live-pulse {
  50% {
    box-shadow: 0 0 0 7px rgba(240, 190, 164, 0.04);
    opacity: 0.72;
  }
}

@keyframes gift-burst {
  0% {
    opacity: 0;
    transform: scale(0.7) translateY(24px);
  }
  18%,
  76% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(1.04) translateY(-10px);
  }
}

@keyframes sparkle {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(0);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.4) rotate(45deg);
  }
}

@keyframes music-pulse {
  50% {
    box-shadow: 0 0 0 6px rgba(255, 253, 249, 0.12);
    transform: scale(1.05);
  }
}

.share-guide[hidden],
.toast[hidden] {
  display: none;
}

.share-guide {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  align-items: end;
}

.share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(25, 19, 15, 0.62);
  border: 0;
}

.share-panel {
  position: relative;
  width: min(100%, 520px);
  margin-inline: auto;
  padding: 34px 24px calc(28px + env(safe-area-inset-bottom));
  background: var(--white);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow);
}

.share-panel h2 {
  margin: 0 0 8px;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 28px;
  font-weight: 400;
}

.share-panel p:not(.section-kicker) {
  margin: 0 0 24px;
  color: var(--muted);
}

.share-arrow {
  position: absolute;
  top: -54px;
  right: 24px;
  color: var(--white);
  font-size: 46px;
}

.toast {
  position: fixed;
  z-index: 80;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  color: var(--white);
  background: var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  text-align: center;
}

.poster-loading {
  display: none;
}

/* Long-image view keeps only the shareable invitation content in one document flow. */
body.poster-mode {
  background: var(--paper);
}

.poster-mode:not(.poster-ready) .invitation-shell {
  visibility: hidden;
}

.poster-mode .poster-loading {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 32px;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 16% 14%, rgba(255, 255, 255, 0.56), transparent 31%),
    repeating-linear-gradient(17deg, rgba(92, 63, 44, 0.018) 0 1px, transparent 1px 5px);
  text-align: center;
}

.poster-mode .poster-loading strong {
  color: var(--accent);
  font: 500 24px/1.3 "Songti SC", "STSong", serif;
}

.poster-mode .poster-loading span {
  color: var(--muted);
  font-size: 14px;
}

.poster-mode.poster-ready .poster-loading {
  display: none;
}

.poster-mode .invitation-shell {
  padding-bottom: 0;
  box-shadow: none;
}

.poster-mode .skip-link,
.poster-mode .hero-actions,
.poster-mode #rsvp,
.poster-mode .blessing-zone,
.poster-mode .bottom-actions,
.poster-mode .music-toggle,
.poster-mode .share-guide,
.poster-mode .toast,
.poster-mode .gift-celebration,
.poster-mode .text-button {
  display: none !important;
}

.poster-mode .activity-feed {
  max-height: none;
  overflow: visible;
  padding-right: 0;
  scrollbar-width: none;
}

.poster-mode .activity-feed::-webkit-scrollbar {
  display: none;
}

.poster-mode .activity-card,
.poster-mode .content-block,
.poster-mode .event-card,
.poster-mode .city-ranking,
.poster-mode .map-stage {
  break-inside: avoid;
}

.poster-mode .activity-card.is-entering,
.poster-mode .live-dot {
  animation: none;
}

.poster-mode .image-block img {
  max-height: none;
}

.poster-mode .empty-story {
  display: none;
}

.poster-mode .map-stage,
.poster-mode .map-legend,
.poster-mode .map-location-note,
.poster-mode .guestbook-section > .section-intro {
  display: none;
}

.poster-mode .guestbook-section {
  padding-bottom: 48px;
}

:focus-visible {
  outline: 3px solid #2f5da8;
  outline-offset: 3px;
}

@media (max-width: 520px) {
  .hero {
    padding-inline: 22px;
  }

  .hero-copy {
    margin-top: 64px;
  }

  .hero .eyebrow {
    margin-bottom: 34px;
    font-size: clamp(26px, 8vw, 36px);
  }

  .hero-script {
    margin-bottom: 38px;
  }

  .hero-media {
    width: 88%;
  }

  .name-lockup {
    grid-template-columns: 58px minmax(0, 1fr) 58px;
    gap: 6px;
  }

  .name-lockup > span {
    font-size: 10px;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .hero-actions > * {
    padding-inline: 14px;
  }

  .gift-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bottom-actions {
    gap: 6px;
    padding-inline: 10px;
  }

  .bottom-actions a {
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  .origin-selector-grid {
    grid-template-columns: 1fr;
  }

  .map-stage {
    min-height: 320px;
  }

  .guest-map {
    height: 320px;
  }

  .map-service-notice {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 24px;
  }

  .map-notice-mark {
    width: 48px;
    height: 48px;
  }

  .city-ranking {
    padding: 18px 14px;
  }
}

@media (min-width: 760px) {
  body {
    padding: 32px 0;
  }

  .invitation-shell {
    outline: 1px dashed rgba(103, 16, 19, 0.2);
    outline-offset: -8px;
  }

  .bottom-actions {
    right: 50%;
    left: auto;
    width: min(100%, var(--content-width));
    transform: translateX(50%);
  }

  .music-toggle {
    right: max(18px, calc((100vw - var(--content-width)) / 2 + 18px));
  }

  body.poster-mode {
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .gift-celebration.is-active .gift-celebration-card {
    opacity: 1;
    transform: none;
  }
}
