:root { color-scheme: light; --ink: #281c39; --muted: #665b73; --purple: #563282; --paper: #fffefa; --line: #e8dfed; background: #f7f2f9; color: var(--ink); font: 16px/1.55 system-ui, Arial, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--purple); }
.site-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem max(1.25rem, calc((100vw - 62rem)/2)); background: var(--paper); border-bottom: 1px solid var(--line); gap: 1rem; }
.site-header a:first-child { color: var(--ink); font-weight: 800; text-decoration: none; }
main { width: min(100% - 2rem, 62rem); margin: 2rem auto 5rem; }
.narrow { max-width: 37rem; margin-inline: auto; }
.panel { padding: clamp(1rem, 4vw, 2.25rem); background: var(--paper); border: 1px solid var(--line); border-radius: 1.15rem; margin-block: 1rem; }
h1, h2, h3, p { margin: 0 0 .8rem; }
h1 { font-size: clamp(1.9rem, 5vw, 3.2rem); line-height: 1.13; letter-spacing: -.035em; }
h2 { font-size: 1.35rem; }
p, small { color: var(--muted); }
.row { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,15rem),1fr)); gap: 1rem; }
label { display: grid; gap: .3rem; font-weight: 650; margin-block: .8rem; }
input, textarea, select, button, .button { font: inherit; }
input:not([type=file]), textarea, select { padding: .65rem .75rem; border: 1px solid #b9acc5; border-radius: .55rem; width: 100%; color: inherit; background: white; }
textarea { resize: vertical; min-height: 7rem; }
button, .button { display: inline-block; border: 1px solid var(--purple); border-radius: .55rem; background: var(--purple); color: white; padding: .55rem 1rem; cursor: pointer; text-decoration: none; }
button.secondary, .button.secondary { color: var(--purple); background: transparent; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #9d6fcc; outline-offset: 3px; }
fieldset { border: 1px solid var(--line); border-radius: .7rem; margin: 1.4rem 0; padding: .5rem 1rem 1rem; }
legend { font-weight: 750; }
.notice { min-height: 1.6em; margin-top: .7rem; }
.error { color: #a02538; }
.cover, .card-image { display: block; max-width: 100%; max-height: 32rem; object-fit: contain; margin: 1rem auto; border-radius: .8rem; }
.card-image { background: #efe5f7; }
.event-list { list-style: none; padding: 0; margin: 0; }
.event-list li { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.event-list li:last-child { border: 0; }
.status { font-size: .9rem; color: var(--muted); }
.qr { width: 8rem; height: 8rem; }
.break { overflow-wrap: anywhere; white-space: pre-wrap; }

.json-editor { min-height: 15rem; font-family: ui-monospace, monospace; text-align: left; }

#openrouter-key-field[hidden] { display: none; }

/* The guest link is designed first for a phone-sized screen. */
.guest-mode .site-header a[href="/manager"] { display: none; }
.guest-mode main { width: min(100% - 1.25rem, 34rem); margin: .75rem auto 2rem; }
.photo-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.photo-action { min-height: 3rem; padding: .5rem; line-height: 1.25; }
.visually-hidden { display: none; }
.live-page { max-width: 65rem; margin-inline: auto; }
.guest-mode:has(.live-page) main { width: min(100% - 1.5rem, 65rem); }
.live-page header { text-align: center; margin-block: 1rem; }
#live-controls, .live-links { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center; margin-block: .8rem; }
.live-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(42%, 9rem),1fr)); gap: .7rem; }
.live-tile { display: grid; align-content: start; gap: .35rem; padding: .45rem; background: var(--paper); color: var(--purple); border-color: #ded0e5; }
.live-tile img { width: 100%; aspect-ratio: 2/3; object-fit: contain; background: #f2ebf5; border-radius: .45rem; }
.live-invite { grid-column: 1/-1; text-align: center; padding: 1rem; background: #eee3f4; border-radius: .8rem; }
.live-empty, #live-notice { text-align: center; }
.live-dialog { width: min(95vw, 38rem); max-height: 95dvh; border: 0; border-radius: .9rem; color: inherit; }
.live-dialog::backdrop { background: #1b1023bf; }
.live-dialog img { display: block; width: 100%; max-height: 70dvh; object-fit: contain; margin-block: .5rem; }
/* Projection setup and audience display */
.projection-mode { min-height: 100vh; background: #faf4eb; }
.projection-mode .site-header, .projection-mode [hidden] { display: none !important; }
.projection-setup { max-width: 34rem; margin-inline: auto; padding: clamp(1rem, 5vw, 2rem); background: #fffefa; border: 1px solid #e2d3c6; border-radius: .85rem; }
.projection-event { overflow-wrap: anywhere; }
.projection-setup h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
.projection-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); column-gap: 1rem; }
.projection-check { display: flex; align-items: center; gap: .55rem; font-weight: 500; }
.projection-check input { width: 1.15rem; height: 1.15rem; accent-color: #642738; margin: 0; }
.projection-count { border-top: 1px solid #e2d3c6; padding-top: .9rem; margin-top: 1.15rem; }
.projection-start { width: 100%; min-height: 3rem; background: #642738; border-color: #642738; font-weight: 750; }
.projection-hint { font-size: .85rem; text-align: center; margin-block: .8rem 0; }
.projection-playing { overflow: hidden; }
.projection-stage { position: fixed; inset: 0; z-index: 10; background: #100c14; color: #fff8ed; outline: none; }
.projection-stage:fullscreen { inset: 0; }
.projection-idle { cursor: none; }
.projection-slide { position: absolute; inset: 0; display: grid; place-items: center; }
.projection-photo { display: block; width: 100%; height: 100%; max-height: 100%; min-height: 0; object-fit: contain; }
.projection-new { animation: projection-fade .35s ease-out; }
@keyframes projection-fade { from { opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .projection-new { animation: none; } }
.projection-message { color: #e6d9e8; text-align: center; padding: 1rem; margin: 0; }
.projection-controls { position: absolute; z-index: 2; inset-inline: 0; bottom: max(1rem, env(safe-area-inset-bottom)); display: flex; justify-content: center; flex-wrap: wrap; gap: .4rem; margin: auto; padding: .5rem; width: max-content; max-width: calc(100% - 1rem); border: 1px solid #7f667f; border-radius: .65rem; background: #230f25ed; }
.projection-controls button { min-height: 44px; padding: .35rem .75rem; background: #452141; border-color: #a68da7; }
.projection-invite { text-align: center; max-width: 90%; padding: .65rem; }
.projection-invite h2 { color: #ffebbf; font-size: clamp(1.15rem, min(5vw, 9vh), 4rem); margin-block: 0 .2em; line-height: 1.15; }
.projection-prompt { color: #fff4e4; font-size: clamp(.9rem, min(2.75vw, 5.5vh), 1.9rem); margin-block: 0 .35em; }
.projection-invite a { display: inline-block; color: #fff4e4; }
.projection-invite img { display: block; width: min(52vh, 70vw, 34rem); width: min(52dvh, 70vw, 34rem); height: auto; margin: .45em auto; border-radius: .3rem; }
.projection-invite img:not([hidden]) + span { display: none; }
.projection-total { color: #ffdfa9; font-size: clamp(.85rem, min(2.15vw, 5vh), 1.45rem); margin: .3em 0 0; }
.projection-corner { position: absolute; left: max(1rem, env(safe-area-inset-left)); bottom: max(1rem, env(safe-area-inset-bottom)); width: clamp(7rem, 15vw, 12rem); display: grid; gap: .45rem; color: #fff4e4; text-decoration: none; text-align: center; }
.projection-corner-title { font-size: clamp(1rem, 1.6vw, 1.55rem); font-weight: 750; line-height: 1.2; }
.projection-corner img { display: block; width: 100%; background: white; }

.flip-book { --book-ink:#502e68; --book-paper:#fff9ef; margin:1rem auto; max-width:38rem; }
.flip-book[data-theme="sand"] { --book-ink:#785435; --book-paper:#fff3da; }
.flip-book[data-theme="forest"] { --book-ink:#2e5848; --book-paper:#eef5e9; }
.flip-page { display:grid; place-items:center; min-height: min(63dvh, 35rem); padding:clamp(.7rem,3vw,1.5rem); background:var(--book-paper); color:var(--book-ink); border-radius:.9rem; box-shadow:0 .5rem 2rem #26173324; touch-action:pan-y; text-align:center; }
.flip-cover { width:100%; }
.flip-cover img { display:block; width:100%; height:clamp(9rem,32vw,16rem); object-fit:cover; border-radius:.55rem; margin-bottom:1rem; }
.flip-dedication { width:min(100%,30rem); padding:1rem; }
.flip-card { display:block; padding:0; border:0; background:transparent; width:100%; }
.flip-card img, .flip-zoom img { display:block; width:100%; max-height:72dvh; object-fit:contain; }
.flip-zoom { width:min(95vw,48rem); border:0; border-radius:.8rem; }
.flip-zoom::backdrop { background:#1e1325cc; }
.flip-nav { display:flex; justify-content:space-between; align-items:center; gap:.5rem; margin-block:1rem; }
.flip-turn { animation:flip-in 300ms ease both; transform-origin:right; }
.flip-book[data-direction="prev"] .flip-turn { transform-origin:left; }
@keyframes flip-in { from { opacity:.55; transform:perspective(900px) rotateY(-8deg); } }
@media (prefers-reduced-motion:reduce) { .flip-turn { animation:none; } }
.book-choice { border-bottom:1px solid #ded0e5; padding:.7rem 0; }
.book-choice-layout{display:flex;align-items:flex-start;gap:1rem;min-width:0}
.book-choice-thumbnail{display:block;flex:0 0 6.5rem;width:6.5rem;min-height:9.75rem;background:#f3eaf8;border:1px solid #e2d5e9;border-radius:.55rem;padding:.2rem}
.book-choice-thumbnail img{display:block;width:100%;aspect-ratio:2/3;object-fit:contain;border-radius:.35rem}
.book-choice-details{flex:1;min-width:0}
.book-choice-details p{margin:0 0 .75rem;line-height:1.6;overflow-wrap:anywhere}
.book-choice-details .row{gap:.45rem}
.book-choice-details button{padding:.4rem .7rem;font-size:.9rem}
@media(max-width:460px){.book-choice-layout{gap:.7rem}.book-choice-thumbnail{flex-basis:5.4rem;width:5.4rem;min-height:8.1rem}.book-choice-details button{padding:.4rem .55rem;font-size:.82rem}}
.book-editor h2 { margin-top:1.3rem; }

.guest-mode main.book-reader { width:100%; max-width:none; margin:0; }
body:has(.book-reader .flip-book) .site-header { display:none; }
.flip-book { position:relative; max-width:none; padding:.75rem; background:radial-gradient(ellipse at 45% 35%,#fbfaf8,#e6e2df); }
.book-reader .flip-book, .flip-book:fullscreen { display:grid; grid-template-rows:auto 1fr auto; min-height:100dvh; margin:0; }
.flip-tools { grid-row:1; display:flex; flex-wrap:wrap; justify-content:center; gap:.25rem; margin:0 auto .65rem; padding:.25rem; border-radius:.65rem; background:#fffefa; width:max-content; max-width:100%; }
@media(min-width: 750px) { .flip-tools { margin-inline:0 auto; } }
.flip-tools button { color:var(--book-ink); background:transparent; border-color:transparent; padding:.25rem .65rem; min-height:2.7rem; }
.flip-tools .flip-prev,.flip-tools .flip-next,.flip-enlarge,.flip-full { font-size:1.35rem; }
.flip-page { grid-row:2; position:relative; overflow:hidden; isolation:isolate; align-self:center; justify-self:center; width:min(100%,calc(78dvh * .74),32rem); aspect-ratio:3/4; min-height:0; margin-inline:auto; padding:.75rem; border-radius:.2rem .7rem .7rem .2rem; box-shadow:0 .8rem 2.5rem #281c3945; }
.flip-page::after { content:""; position:absolute; inset:0 0 0 auto; width:8%; pointer-events:none; background:linear-gradient(to left,#21152c38,transparent); z-index:2; }
.flip-page[data-page="cover"] { padding:0; background:var(--book-ink); }
.flip-cover { position:absolute; inset:0; border:0; border-radius:0; display:flex; flex-direction:column; justify-content:end; align-items:center; padding:1.2rem; color:white; background:linear-gradient(transparent,#1b1125d9),var(--book-ink); overflow:hidden; isolation:isolate; }
.flip-cover img { position:absolute; z-index:-2; inset:0; height:100%; margin:0; border-radius:0; }
.flip-cover::after { content:""; position:absolute; inset:0; z-index:-1; background:linear-gradient(transparent 25%,#1b1125e8); }
.flip-cover .flip-title { font-weight:750; margin-bottom:.8rem;  font-size:clamp(1.5rem,5vw,3rem); overflow-wrap:anywhere; }
.flip-cover-label { padding:.5rem .9rem; border:1px solid #ffffffab; border-radius:.4rem; }
.flip-card { position:absolute; inset:.65rem; width:calc(100% - 1.3rem); height:calc(100% - 1.3rem); }
.flip-card img { height:100%; max-height:none; }
.flip-dedication { max-height:100%; overflow:auto; }
.flip-nav { grid-row:3; width:min(100%,42rem); margin:.55rem auto 0; padding-inline:.5rem; font-variant-numeric:tabular-nums; }
.flip-slider { flex:1; min-width:0; accent-color:var(--book-ink); height:2.45rem; }
.flip-nav span { min-width:5.5rem; text-align:center; }
.flip-feedback { text-align:center; overflow-wrap:anywhere; }
.flip-turn { animation:book-turn-next .36s ease-out both; }
.flip-book[data-direction="prev"] .flip-turn { animation-name:book-turn-prev; }
@keyframes book-turn-next { from { transform:perspective(950px) rotateY(-18deg); filter:brightness(.82); } }
@keyframes book-turn-prev { from { transform:perspective(950px) rotateY(18deg); filter:brightness(.82); } }
@media(prefers-reduced-motion:reduce) { .flip-turn { animation:none; } }

.flip-stage {
  grid-row: 2;
  align-self: center;
  justify-self: center;
  position: relative;
  width: min(100%, 52dvh, 32rem);
  aspect-ratio: 2 / 3;
  margin-inline: auto;
  perspective: 1100px;
}
.flip-stage .flip-page { width: 100%; height: 100%; aspect-ratio: auto; }
.flip-stage .flip-card { inset: 0; width: 100%; height: 100%; }
.flip-stage .flip-outgoing {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  transform-origin: right center;
}
.flip-book[data-direction="prev"] .flip-outgoing { transform-origin: left center; }
.flip-edge {
  position: absolute;
  top: 50%;
  z-index: 4;
  transform: translateY(-50%);
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: #261833c7;
  color: white;
  border: none;
  font-size: 1.6rem;
}
.flip-edge[hidden] { display: none; }
.flip-edge-prev { right: 0; border-radius: .5rem 0 0 .5rem; }
.flip-edge-next { left: 0; border-radius: 0 .5rem .5rem 0; }
.flip-opening {
  width: min(86%, 24rem);
  border-block: 1px solid #9f7855;
  padding: clamp(1rem, 5vw, 2.5rem) .5rem;
  text-align: center;
}
.flip-opening h2 { font-size: clamp(1.45rem, 5vw, 2.2rem); margin: 0 0 1rem; }
.flip-opening p { font-size: clamp(1rem, 3.8vw, 1.3rem); line-height: 1.7; margin: 0; }

/* Guest greeting flow */
.guest-journey {
  --paper: #fff9ee;
  --ink: #312025;
  --muted: #675451;
  --purple: #642738;
  --line: #ddcbb7;
  color: var(--ink);
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #f3dfd4, #f8f1e7 75%);
}
.guest-journey .site-header { display: none; }
.guest-journey main { width: min(100% - 1.5rem, 27rem); margin: clamp(.75rem, 4vw, 2rem) auto 2rem; }
.guest-edition {
  background: var(--paper);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: 0 14px 32px #39151f19;
}
.guest-sheet { padding: clamp(1rem, 5vw, 1.6rem); }
.guest-sheet [hidden], .guest-edition [hidden] { display: none !important; }
.guest-sheet h1 { font: 700 clamp(1.65rem, 7vw, 2.4rem)/1.16 Georgia, "Times New Roman", serif; overflow-wrap: anywhere; }
.guest-invitation, .guest-finish { text-align: center; }
.guest-edition .guest-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 3;
  border-radius: 0;
  object-fit: cover;
  object-position: center 54%;
  margin: 0;
}
.guest-vignette, .guest-develop {
  display: grid;
  place-items: center;
  color: #ffe2aa;
  background: radial-gradient(ellipse at 75% 4%, #9e5c69, transparent 60%), linear-gradient(145deg, #3d1628, #652f41 65%, #2b1425);
  outline: 1px solid #e8bf86;
  outline-offset: -.75rem;
}
.guest-vignette { min-height: 9rem; font-size: 2.85rem; }
.guest-intro { border-top: 1px solid var(--line); margin: 1rem 0; padding-top: .9rem; }
.guest-intro p { color: var(--ink); margin-bottom: .3rem; }
.guest-intro strong { color: var(--purple); }
.guest-sheet button, .guest-sheet .button { min-height: 2.85rem; }
.guest-sheet .guest-back { color: var(--purple); background: transparent; border-color: transparent; padding-inline: 0; }
.guest-sheet .guest-back:focus-visible { outline-offset: 0; }
.guest-sheet .guest-back + h1 { margin-top: .35rem; }
.guest-sheet textarea {
  color: var(--ink);
  line-height: 2rem;
  min-height: 10rem;
  border-color: var(--line);
  background: repeating-linear-gradient(#f9eddd 0 31px, #e3cfbb 31px 32px);
}
.guest-submit { width: 100%; font-weight: 700; }
/* Keep the form in normal flow around the fitted photo. */
.guest-journey.guest-photo-active { min-height: 0; }
.guest-photo-active main {
  box-sizing: border-box;
  margin: 0 auto;
  padding-block: max(.375rem, env(safe-area-inset-top)) max(.375rem, env(safe-area-inset-bottom));
}
.guest-photo-active #greeting-form {
  padding: clamp(.65rem, 3.5vw, 1.35rem);
}
#guest-photo-step {
  display: grid;
  grid-template-rows: auto auto auto;
  grid-template-areas: "heading" "stage" "footer";
  gap: .45rem;
  min-height: 0;
}
.guest-photo-heading { grid-area: heading; }
.guest-photo-heading h1 { margin: .12rem 0 0; font-size: clamp(1.35rem, 6vw, 1.95rem); }
.guest-photo-stage {
  grid-area: stage;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.guest-photo-stage > p { margin: .25rem 0 .55rem; }
.photo-preview {
  display: grid;
  justify-items: center;
  min-width: 0;
}
.photo-preview img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 30rem;
  object-fit: contain;
  border-radius: .85rem;
}
.guest-photo-tools { display: flex; justify-content: space-between; gap: .45rem; }
.guest-photo-tools #replace-photo { font-weight: 700; }
.guest-photo-footer { grid-area: footer; }
.guest-disclosure { font-size: .82rem; line-height: 1.4; margin: 0 0 .55rem; }
.guest-photo-footer .status, .guest-photo-active #notice { margin: .35rem 0 0; }
@media (orientation: landscape) and (max-height: 440px) {
  .guest-photo-active main { width: min(100% - 1rem, 47rem); }
  #guest-photo-step {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    grid-template-areas: "heading stage" ". stage" "footer stage";
    align-items: start;
    column-gap: .8rem;
  }
}
.guest-edition .notice:empty { display: none; }
.guest-develop {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  overflow: hidden;
  width: min(100%, 20rem);
  height: clamp(12rem, 45vh, 20rem);
  height: clamp(12rem, 45svh, 20rem);
  margin: .95rem auto .65rem;
  border-radius: .6rem;
}
.guest-envelope {
  position: relative;
  width: 68%;
  max-width: 13rem;
  aspect-ratio: 1.52;
  margin-top: 1.4rem;
  border-radius: .25rem;
  background: linear-gradient(125deg, #a76042, #683321);
  box-shadow: 0 16px 28px #1b0b14a6, inset 0 0 0 1px #e6ae7677;
  perspective: 35rem;
  animation: guest-envelope-breathe 4s ease-in-out infinite;
}
.guest-envelope-paper {
  position: absolute;
  inset: 5% 8% 9%;
  border-radius: .18rem;
  background: linear-gradient(150deg, #fff4d8, #d7a867);
  outline: 1px solid #9c602f66;
  opacity: 0;
}
.guest-envelope-front {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(35deg, #74381f 0%, #b56d49 49%, #9c5637 50%, #ba7750 100%);
  clip-path: polygon(0 0, 50% 57%, 100% 0, 100% 100%, 0 100%);
  z-index: 2;
}
.guest-envelope-flap {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transform-origin: center top;
  clip-path: polygon(0 0, 100% 0, 50% 62%);
  background: linear-gradient(155deg, #d89d6c, #9c5737 70%);
  z-index: 3;
}
.guest-envelope-seal {
  position: absolute;
  z-index: 4;
  top: 53%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 18%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid #f3c487;
  border-radius: 50%;
  color: #653420;
  background: radial-gradient(circle at 33% 24%, #f6d591, #ca8e4f 77%);
  box-shadow: 0 .14rem .25rem #4b1f1b80, inset 0 0 0 2px #8c512d45;
}
.guest-develop.is-opening .guest-envelope { animation: none; }
.guest-develop.is-opening .guest-envelope-flap { animation: guest-envelope-open .72s ease forwards; }
.guest-develop.is-opening .guest-envelope-paper { animation: guest-envelope-lift 1.1s .22s ease-out both; }
.guest-develop.is-opening .guest-envelope-seal { animation: guest-seal-off .32s ease-out both; }
.guest-wait-artwork { position: absolute; inset: .95rem .8rem 1.65rem; display: grid; place-items: center; }
.guest-wait-artwork img { display: block; width: 100%; height: 100%; min-height: 0; max-height: 100%; object-fit: contain; animation: guest-art-reveal .32s ease-out both; }
.guest-wait-source {
  position: absolute;
  inset-block-end: .36rem;
  color: #fff0d8;
  background: #331423;
  border-radius: 2rem;
  padding: .13rem .7rem;
  font-size: .76rem;
}
.guest-wait-caption { margin: .48rem auto; max-width: 28ch; line-height: 1.45; text-wrap: balance; }
.guest-wait-caption:empty { display: none; }
.guest-wait-hint { font-size: .87rem; margin: .6rem auto; max-width: 30ch; }
.guest-finish .card-image { max-width: 100%; max-height: min(55vh, 30rem); border-radius: .3rem; box-shadow: 0 8px 24px #39151f2e; }
.guest-finish-actions { display: grid; gap: .45rem; }
.card-reveal { animation: guest-art-reveal .42s ease-out both; }
@keyframes guest-envelope-breathe { 50% { transform: translateY(-.25rem); } }
@keyframes guest-envelope-open { to { transform: rotateX(160deg); opacity: .66; z-index: 0; } }
@keyframes guest-envelope-lift { from { opacity: 0; } to { opacity: 1; transform: translateY(-57%); } }
@keyframes guest-seal-off { to { opacity: 0; transform: translate(-50%, -90%); } }
@keyframes guest-art-reveal { from { opacity: 0; transform: translateY(.35rem); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .card-reveal, .guest-envelope, .guest-wait-artwork img { animation: none; }
}


/* Public event gallery — intentionally separate from projection controls */
.live-gallery-mode { background: radial-gradient(ellipse at top,#f2e2d8,#faf4eb 65%); color:#35232a; }
.live-gallery-mode .site-header { display:none; }
.live-gallery-mode main { width:min(100% - 1.25rem,65rem); margin:0 auto 3rem; }
.live-gallery-mode .live-page > header {
  position:sticky; top:0; z-index:2; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between;
  gap:.75rem; margin:0 0 1rem; padding:.75rem 1rem; padding-top:max(.75rem, env(safe-area-inset-top));
  border-radius:0 0 1rem 1rem; background:#551f34; color:#fff4e8; border-bottom:2px solid #c8a574;
  text-align:start;
}
.live-gallery-mode .live-page > header h1 { margin:0; font-size:clamp(1.1rem,4vw,1.8rem); overflow-wrap:anywhere; }
.live-gallery-mode .live-header-actions { display:flex; gap:.4rem; flex-wrap:wrap; }
.live-gallery-mode #live-back { padding:.6rem .7rem; border-color:#e8bf86; background:transparent; color:#fff4e8; }
.live-gallery-mode #live-write { flex:none; padding:.6rem .85rem; background:#f8ddb0; border-color:#f8ddb0; color:#421a29; font-weight:800; }
.live-gallery-mode #live-write[hidden], .live-gallery-mode #live-controls:empty { display:none; }
.live-gallery-mode .live-feature { text-align:center; margin:1.5rem auto 2.5rem; }
.live-gallery-mode .live-feature h2,.live-gallery-mode .live-gallery-section h2 { font-size:clamp(1.35rem,4vw,1.85rem); margin:0 0 1rem; }
.live-gallery-mode .live-feature-card { display:block; width:min(100%,22rem); padding:.6rem; margin:auto; background:#fffaf2; border:1px solid #d7c2aa; border-radius:.8rem; box-shadow:0 12px 32px #4b283321; }
.live-gallery-mode .live-feature-card img { display:block; width:100%; height:auto; max-height:65dvh; object-fit:contain; }
.live-gallery-mode .live-feature p { color:#705d59; font-size:.9rem; }
.live-gallery-mode .live-gallery-jump {
  position:fixed; z-index:3; left:50%; bottom:calc(.75rem + env(safe-area-inset-bottom, 0px));
  transform:translateX(-50%); min-height:44px; padding:.45rem 1.1rem; border:1px solid #f8ddb0;
  border-radius:999px; background:#551f34; color:#fff4e8; box-shadow:0 4px 16px #29121e55;
  font-weight:800; white-space:nowrap;
}
.live-gallery-mode .live-gallery-jump[hidden] { display:none; }
.live-gallery-mode .live-gallery-jump span { margin-inline-start:.3rem; }
.live-gallery-mode .live-gallery-section { text-align:center; }
.live-gallery-mode .live-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:.8rem; }
.live-gallery-mode .live-tile { position:relative; padding:.45rem; border:1px solid #dfcbb5; border-radius:.8rem; background:#fffaf2; box-shadow:0 5px 15px #44233313; }
.live-gallery-mode .live-tile img { display:block; aspect-ratio:2/3; object-fit:contain; background:#f4ece4; border-radius:.35rem; }
.live-gallery-mode .live-more { margin:1.5rem auto; background:transparent; color:#642738; border:1px solid #642738; }
.live-gallery-mode .live-more[hidden] { display:none; }
.live-gallery-mode .live-dialog { padding:1rem; background:#fffaf2; }
.live-gallery-mode .live-dialog-actions { display:flex; flex-wrap:wrap; justify-content:center; gap:.4rem; align-items:center; }
.live-gallery-mode .live-dialog-actions button,.live-gallery-mode .live-dialog-actions a { padding:.55rem .8rem; font-size:.9rem; }
.live-gallery-mode .view-close { display:block; margin-inline-start:auto; }
@media(min-width:700px) { .live-gallery-mode .live-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(min-width:1050px) { .live-gallery-mode .live-grid { grid-template-columns:repeat(4,minmax(0,1fr)); } }

/* The finished card uses the space left by the heading and its four actions. */
.guest-journey.guest-complete { min-height: 0; }
.guest-complete main {
  width: min(100% - 1rem, 27rem);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding-block: max(.4rem, env(safe-area-inset-top)) max(.4rem, env(safe-area-inset-bottom));
}
.guest-complete .guest-finish {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: .45rem;
  padding: clamp(.55rem, 2.25dvh, 1.05rem);
}
.guest-complete #card-status { margin: 0; font-size: clamp(1.3rem, 5.6vw, 2.05rem); }
.guest-complete #guest-result {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: .45rem;
}
.guest-final-actions { display: grid; gap: .3rem; }
.guest-complete .guest-card-art { position: relative; min-height: 0; min-width: 0; }
.guest-complete .guest-card-art .card-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  object-fit: contain;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 5px 12px #39151f2e);
}
.guest-complete .guest-finish-actions { gap: .25rem; }
.guest-complete .guest-final-actions :is(button, a), .guest-complete .guest-cancel {
  display: grid;
  align-content: center;
  min-height: 44px;
  padding: .26rem .55rem;
  font-size: .925rem;
  line-height: 1.2;
}
.guest-complete .guest-cancel { text-decoration: underline; text-underline-offset: .15em; }
.guest-complete .guest-finish-actions [aria-disabled="true"] { opacity: .65; }
.guest-complete .notice { margin: 0; font-size: .83rem; }
@media (max-height: 485px) and (orientation: landscape) {
  .guest-complete main { width: min(100% - 1rem, 48rem); }
  .guest-complete #guest-result {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
  }
  .guest-complete .guest-card-art { align-self: stretch; }
  .guest-complete .notice { grid-column: 1 / -1; }
}
@media (max-height: 295px) {
  .guest-complete main { height: auto; min-height: 100dvh; }
  .guest-complete .guest-card-art { min-height: 6rem; }
}

.cover-crop-editor { margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; background: #f9f5fa; }
.cover-crop-editor canvas { display: block; width: 100%; height: auto; aspect-ratio: 8 / 3; touch-action: none; cursor: grab; border-radius: .4rem; background: #eee; }
.cover-crop-editor canvas:active { cursor: grabbing; }
.cover-crop-editor input[type="range"] { width: 100%; }
