:root {
  --canvas: #f3e1cf;
  --canvas-glow: rgba(255,247,231,.76);
  --canvas-shadow: rgba(214,150,133,.42);
  --halftone: rgba(126,79,66,.22);
  --paper: #fff8ed;
  --paper-light: #fffaf2;
  --paper-warm: #f4cfbe;
  --cover-page: #f8e883;
  --ink: #292a2a;
  --ink-soft: #694d4b;
  --accent: #c9434d;
  --accent-deep: #923643;
  --accent-light: #e7757d;
  --accent-soft: #f6dedb;
  --secondary: #d8f1ed;
  --secondary-soft: #dcf2ed;
  --secondary-ink: #276d73;
  --highlight: #f8e883;
  --highlight-soft: #fff4bf;
  --line: #d49b8c;
  --tape: rgba(155,214,208,.78);
  --shadow-tint: rgba(117,62,56,.33);
  --shadow-ink: rgba(41,42,42,.8);
  --paper-glass: rgba(255,246,231,.27);
  --highlight-glow: rgba(248,232,131,.6);
  --rule: rgba(154,180,179,.3);
  font-family: 'Patrick Hand', sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 280px; }
body { margin: 0; }
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid #206f77; outline-offset: 4px; }
svg { width: 1.25em; height: 1.25em; flex: none; }
#app { min-height: 100dvh; }

.scene {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 15px 17px;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 10% 12%, var(--canvas-glow) 0 105px, transparent 106px),
    radial-gradient(circle at 90% 75%, var(--canvas-shadow) 0 135px, transparent 136px),
    var(--canvas);
}

.scene__halftone {
  position: absolute;
  inset: 0;
  background: radial-gradient(var(--halftone) 1px, transparent 1.3px) 0 0 / 15px 15px;
  mask-image: linear-gradient(130deg, #0006, transparent 50%, #0007);
  pointer-events: none;
}

.topbar {
  width: min(100%, 455px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  position: relative;
  z-index: 2;
  margin: 0 auto 13px;
}
.topbar__episode { padding-left: 4px; }

.brand-mark {
  width: 43px;
  height: 43px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 3px 4px 0 var(--ink);
  display: grid;
  place-items: center;
  font: 700 16px 'Balsamiq Sans', cursive;
  transform: rotate(-9deg);
}

.brand-mark span { position: absolute; font: 15px 'Caveat', cursive; right: -6px; top: -7px; color: var(--accent-deep); }
.topbar__episode { flex: 1; font: 700 12px 'Balsamiq Sans', cursive; letter-spacing: .02em; color: var(--ink-soft); }
.topbar__episode small { display: block; font-size: 8px; letter-spacing: .15em; color: var(--accent-deep); margin-bottom: 2px; }
.music-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--highlight);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 3px 4px 0 var(--ink);
  transition: transform .2s;
}
.music-toggle:hover { transform: rotate(12deg); }
.music-toggle.is-playing { animation: tiny-bob 2s ease-in-out infinite; }
.music-toggle.is-muted { background: var(--paper); }
.music-toggle svg { width: 21px; height: 21px; }

.book {
  width: min(100%, 455px);
  position: relative;
  z-index: 1;
  filter: drop-shadow(9px 11px 0 var(--shadow-ink)) drop-shadow(0 18px 20px var(--shadow-tint));
}

.page {
  width: 100%;
  min-height: min(735px, calc(100dvh - 114px));
  border: 3px solid var(--ink);
  border-radius: 25px;
  background: var(--paper);
  padding: 31px 29px 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  animation: page-in .47s ease-out both;
}

.page:before {
  content: '';
  position: absolute;
  inset: 11px;
  border: 1.5px dashed var(--line);
  border-radius: 16px;
  pointer-events: none;
}

.scene__bottom { z-index: 1; margin-top: 20px; font: 23px 'Caveat', cursive; color: var(--ink-soft); text-align: center; }
.eyebrow { font: 700 10px 'Balsamiq Sans', cursive; letter-spacing: .19em; color: var(--accent-deep); }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: 'Balsamiq Sans', cursive; font-weight: 700; letter-spacing: -.055em; }
.hand-caption { font: 26px/1 'Caveat', cursive; color: var(--accent-deep); }

/* A comic cover with the recipient's real photo. */
.page--cover { background: var(--cover-page); padding: 26px; justify-content: space-between; }
.page--cover:before { border-color: var(--line); }
.cover__corner { position: relative; z-index: 1; font: 700 10px/1.55 'Balsamiq Sans', cursive; letter-spacing: .13em; color: var(--ink-soft); }
.cover__photo-wrap {
  position: relative;
  width: 81%;
  height: clamp(210px, 35dvh, 295px);
  margin: 25px auto 15px;
  transform: rotate(-5deg);
  border: 8px solid var(--paper);
  outline: 2.5px solid var(--ink);
  background: var(--paper-warm);
  box-shadow: 8px 9px 0 var(--accent-deep);
}
.cover__photo { width: 100%; height: 100%; object-fit: cover; object-position: center 43%; display: block; }
.photo-sticker { position: absolute; right: -25px; bottom: -22px; border: 2px solid var(--ink); background: var(--accent-light); border-radius: 50%; width: 64px; height: 64px; display: grid; place-items: center; color: var(--paper); transform: rotate(14deg); box-shadow: 4px 4px 0 var(--ink); }
.photo-sticker svg { width: 31px; height: 31px; }
.photo-tape { position: absolute; width: 82px; height: 27px; background: var(--tape); top: -20px; left: 33%; transform: rotate(4deg); }
.cover__speech {
  position: relative;
  z-index: 1;
  background: var(--paper-light);
  border: 2.5px solid var(--ink);
  border-radius: 32px;
  padding: 25px 23px 20px;
  box-shadow: 5px 6px 0 var(--ink);
  transform: rotate(1.5deg);
}
.cover__speech:after { content: ''; position: absolute; width: 20px; height: 20px; background: var(--paper-light); border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); bottom: -12px; left: 32px; transform: rotate(45deg); }
.cover__speech h1 { color: var(--ink); font-size: clamp(30px, 8vw, 43px); line-height: 1.09; margin: 12px 0; }
.cover__speech p { color: var(--ink-soft); font: 22px 'Caveat', cursive; margin: 0; }
.cover__speech p strong { color: var(--accent-deep); }
.cover__footer { position: relative; z-index: 1; display: flex; align-items: center; gap: 16px; margin-top: 29px; }
.cover__footer span { flex: 1; font: 18px/1.08 'Caveat', cursive; color: var(--ink-soft); }
.primary, .secondary {
  min-height: 57px;
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 2px solid var(--ink);
  border-radius: 13px;
  background: var(--accent);
  color: var(--ink);
  font: 700 15px 'Balsamiq Sans', cursive;
  box-shadow: 4px 5px 0 var(--ink);
  transition: transform .18s, box-shadow .18s;
}
.primary:hover, .secondary:hover { transform: translate(2px, 2px); box-shadow: 2px 3px 0 var(--ink); }
.primary svg, .secondary svg { width: 18px; height: 18px; }

/* Each chapter remains a compact, centered comic page. */
.page--memory, .page--reasons, .page--letter, .page--question { gap: 0; }
.page h2 { font-size: clamp(28px, 7.4vw, 39px); line-height: 1.11; margin: 13px 0 18px; position: relative; z-index: 1; }
.comic-photo { position: relative; border: 3px solid var(--ink); background: var(--paper-warm); box-shadow: 5px 6px 0 var(--ink); transform: rotate(2deg); }
.comic-photo--large { height: clamp(210px, 35dvh, 295px); width: 100%; margin: 4px 0 16px; }
.comic-photo img, .reason-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.photo-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: radial-gradient(circle at 72% 25%, var(--highlight-soft) 0 48px, transparent 49px), repeating-linear-gradient(135deg, var(--highlight) 0 18px, var(--canvas) 18px 36px); color: var(--ink); text-align: center; }
.photo-placeholder span { width: 64px; height: 64px; border: 2px solid var(--ink); border-radius: 50%; display: grid; place-items: center; background: var(--paper); box-shadow: 4px 5px 0 var(--ink); }
.photo-placeholder span svg { width: 31px; height: 31px; color: var(--accent); }
.photo-placeholder strong { font: 700 16px 'Balsamiq Sans', cursive; letter-spacing: .13em; }
.photo-placeholder small { font: 25px 'Caveat', cursive; color: var(--accent-deep); }
.comic-photo__flash { position: absolute; z-index: 2; top: -15px; left: -12px; width: 34px; height: 34px; color: var(--accent); transform: rotate(-8deg); filter: drop-shadow(2px 2px 0 var(--ink)); pointer-events: none; }
.comic-photo__flash svg { display: block; width: 100%; height: 100%; overflow: visible; }
.comic-photo__flash path { fill: var(--highlight); stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
.page--memory>.hand-caption { text-align: center; margin: 2px 0 19px; transform: rotate(-3deg); }
.speech-bubble { border: 2px solid var(--ink); background: var(--secondary); border-radius: 21px; padding: 15px 18px 12px; position: relative; box-shadow: 4px 4px 0 var(--ink); }
.speech-bubble span { display: inline-block; font: 700 11px 'Balsamiq Sans', cursive; letter-spacing: .1em; color: var(--secondary-ink); text-transform: uppercase; margin-bottom: 7px; }
.speech-bubble p { font: 22px/1.18 'Patrick Hand', cursive; margin: 0; }

.reason-grid { position: relative; z-index: 1; display: grid; gap: 10px; }
.reason { min-height: 72px; display: flex; gap: 13px; align-items: center; padding: 10px 13px; border: 2px solid var(--ink); background: var(--accent-soft); box-shadow: 3px 3px 0 var(--ink); transform: rotate(-1deg); opacity: 0; translate: 0 16px; animation: reason-reveal .48s cubic-bezier(.2,.72,.25,1) forwards; animation-delay: calc(120ms + var(--reason-index, 0) * 190ms); }
.reason:nth-child(2) { background: var(--secondary-soft); transform: rotate(1deg); }
.reason:nth-child(3) { background: var(--highlight-soft); transform: rotate(-.6deg); }
@keyframes reason-reveal { to { opacity: 1; translate: 0 0; } }
.reason__number { flex: none; font: 700 18px 'Balsamiq Sans', cursive; color: var(--accent-deep); }
.reason p { font: 21px/1.06 'Patrick Hand', cursive; margin: 0; }
.reason-photo { width: 65%; height: 125px; margin: 23px auto 12px; position: relative; border: 5px solid var(--paper-light); outline: 2px solid var(--ink); transform: rotate(5deg); box-shadow: 5px 6px 0 var(--ink); }
.reason-photo span { position: absolute; bottom: -16px; right: -13px; transform: rotate(-9deg); background: var(--paper-light); padding: 4px 10px; border: 1.5px solid var(--ink); font: 20px 'Caveat', cursive; white-space: nowrap; }
.reason-note { align-self: center; font: 31px 'Caveat', cursive; color: var(--accent-deep); transform: rotate(-3deg); margin: 20px 0 0; }

.page--letter { background: var(--paper); }
.page--letter:after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, transparent 0 35px, var(--rule) 36px, transparent 37px); pointer-events: none; }
.page--letter h2 { max-width: 100%; }
.letter-paper { position: relative; z-index: 1; display: flex; flex-direction: column; flex: 1; padding: 17px 5px 12px; }
.letter-paper__dear { font: 30px 'Caveat', cursive; color: var(--accent-deep); }
.letter-paper>p { font: 27px/1.25 'Caveat', cursive; color: var(--ink-soft); margin: 17px 0 15px; white-space: pre-line; overflow-wrap: anywhere; }
.letter-paper__signoff { margin-top: auto; align-self: flex-end; text-align: right; font: 21px/1.1 'Caveat', cursive; color: var(--ink-soft); }
.letter-paper__signoff strong { display: block; font: 40px 'Caveat', cursive; color: var(--accent-deep); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 18px; position: relative; z-index: 2; }
.pager button { width: 47px; height: 47px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; color: var(--ink); background: var(--paper); box-shadow: 3px 3px 0 var(--ink); }
.pager button:disabled { opacity: .3; cursor: default; }
.pager button svg { width: 21px; height: 21px; }
.pager span { font: 700 12px 'Balsamiq Sans', cursive; letter-spacing: .18em; color: var(--accent-deep); white-space: nowrap; }
.pager i { display: inline-block; width: 48px; height: 2px; background: var(--accent-deep); vertical-align: middle; margin: 0 7px; }

/* The No button hops, then eventually stays so a real answer is possible. */
.page--question { background: var(--secondary); }
.question__bubble { position: relative; z-index: 1; background: var(--paper-light); border: 3px solid var(--ink); border-radius: 43px; padding: 27px 24px 19px; margin: 22px 0 25px; box-shadow: 6px 7px 0 var(--ink); transform: rotate(-2deg); }
.question__bubble:after { content: ''; position: absolute; width: 24px; height: 24px; bottom: -15px; right: 45px; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); background: var(--paper-light); transform: rotate(45deg); }
.question__bubble .hand-caption { display: block; font-size: 26px; }
.question__bubble h2 { font-size: clamp(31px, 8vw, 43px); margin: 14px 0; }
.question__signature { text-align: right; font: 28px 'Caveat', cursive; color: var(--accent-deep); margin: 0; }
.answer-area { position: relative; height: 163px; z-index: 1; }
.answer-yes, .answer-no { position: absolute; min-width: 113px; height: 55px; border: 2px solid var(--ink); border-radius: 15px; box-shadow: 4px 5px 0 var(--ink); font: 700 16px 'Balsamiq Sans', cursive; transition: left .26s ease, top .26s ease, transform .2s; }
.answer-yes { top: 10px; left: 4px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.answer-yes svg { width: 20px; height: 20px; }
.answer-no { background: var(--paper-light); padding: 0 12px; }
.answer-hint { font: 22px 'Caveat', cursive; color: var(--ink-soft); text-align: center; margin: 0; min-height: 30px; position: relative; z-index: 1; }

.page--result { justify-content: flex-start; align-items: center; gap: 12px; text-align: center; background: var(--highlight); overflow-y: auto; }
.page--result .eyebrow { margin: 0; }
.answer-printer { position: relative; isolation: isolate; width: min(100%, 360px); padding-top: 55px; margin: 3px auto 0; }
.answer-printer__machine { position: absolute; z-index: 3; top: 0; left: 0; right: 0; height: 94px; padding: 21px 22px; display: flex; align-items: flex-start; justify-content: space-between; color: var(--paper); background: linear-gradient(160deg, var(--accent-deep), var(--accent)); border: 2px solid var(--ink); border-radius: 17px 17px 5px 5px; box-shadow: 4px 6px 0 var(--ink); }
.answer-printer__machine span { font: 700 9px 'Balsamiq Sans', cursive; letter-spacing: .14em; }
.answer-printer__machine i { width: 11px; height: 11px; border-radius: 50%; background: var(--highlight); box-shadow: 0 0 12px var(--highlight); }
.answer-printer__slot { position: absolute; left: 5%; right: 5%; bottom: 10px; height: 14px; border-radius: 5px; background: var(--ink); box-shadow: inset 0 4px 7px #0008; }
.answer-ticket { position: relative; z-index: 1; width: 88%; min-height: 280px; margin: 0 auto; padding: 52px 19px 20px; border: 2px solid var(--line); background: var(--paper-light); box-shadow: 5px 7px 0 color-mix(in srgb, var(--ink) 28%, transparent); text-align: left; transform: translateY(-78px); animation: answer-print 1.65s cubic-bezier(.2,.68,.22,1) .16s forwards; }
.answer-ticket::before,.answer-ticket::after { content: ''; position: absolute; top: 0; bottom: 0; width: 12px; background: radial-gradient(circle, var(--highlight) 0 4px, transparent 4.5px) center / 12px 18px repeat-y; }
.answer-ticket::before { left: -7px; }.answer-ticket::after { right: -7px; }
.answer-ticket__eyebrow { display: block; color: var(--accent-deep); font: 700 8px 'Balsamiq Sans', cursive; letter-spacing: .16em; text-align: center; }
.answer-ticket__rule { height: 1px; margin: 12px 0; background: var(--line); }
.answer-ticket__names b { color: var(--accent-deep); padding: 0 4px; }
.answer-ticket__answer { padding: 10px 12px; display: grid; gap: 3px; border: 1px dashed var(--accent); background: var(--secondary); text-align: center; }
.answer-ticket__answer small { color: var(--accent-deep); font: 700 8px 'Balsamiq Sans', cursive; letter-spacing: .14em; }
.answer-ticket__answer strong { font: 700 22px 'Balsamiq Sans', cursive; overflow-wrap: anywhere; }
.answer-ticket>p { margin: 12px 0; color: var(--ink-soft); font: 17px/1.18 'Patrick Hand', cursive; overflow-wrap: anywhere; }
.answer-card-actions { width: min(100%, 360px); display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.answer-card-actions button,.result-replay { min-height: 45px; padding: 9px 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 2px solid var(--ink); border-radius: 12px; box-shadow: 3px 4px 0 var(--ink); font: 700 13px 'Balsamiq Sans', cursive; }
.answer-card-actions svg,.result-replay svg { width: 17px; height: 17px; }
.answer-card-actions .secondary { min-width: 0; background: var(--paper); }
.answer-card-actions .primary { min-width: 0; }
.answer-export-status { min-height: 17px; margin: 0; color: var(--ink-soft); font: 15px 'Caveat', cursive; }
.result-replay { min-height: 38px; min-width: 150px; border: 1px solid var(--line); background: transparent; box-shadow: none; }
@keyframes answer-print { from { transform: translateY(-78px); } to { transform: translateY(0); } }

@keyframes page-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes tiny-bob { 50% { transform: rotate(10deg); } }

@media (max-width: 480px) {
  .scene { justify-content: flex-start; overflow: auto; padding: 15px 13px 22px; }
  .topbar { margin-bottom: 13px; }
  .book { margin: auto 0 0; }
  .page { min-height: min(730px, calc(100dvh - 100px)); padding: 26px 24px 20px; }
  .page--cover { padding: 23px 22px; }
  .cover__photo-wrap { width: 83%; height: clamp(190px, 31dvh, 265px); margin: 22px auto 14px; }
  .cover__speech { padding: 19px 18px 16px; }
  .cover__speech h1 { margin: 8px 0; }
  .cover__footer { margin-top: 28px; }
  .cover__footer span { font-size: 16px; }
  .primary { min-height: 52px; font-size: 14px; padding: 9px 12px; }
  .comic-photo--large { height: clamp(180px, 29dvh, 265px); }
  .page--memory>.hand-caption { margin-bottom: 13px; }
  .speech-bubble p { font-size: 20px; }
  .reason { min-height: 66px; }
  .reason p { font-size: 19px; }
  .reason-photo { height: 135px; margin-top: 18px; }
  .reason-note { font-size: 28px; margin-top: 17px; }
  .letter-paper>p { font-size: 24px; line-height: 1.17; }
  .question__bubble { margin-top: 22px; }
  .scene__bottom { margin-top: 16px; }
}

@media (max-width: 350px) {
  .scene { padding-left: 10px; padding-right: 10px; }
  .page { min-height: 610px; padding: 22px 18px 17px; }
  .page--cover { padding: 20px 17px; }
  .cover__photo-wrap { height: 180px; }
  .cover__speech h1 { font-size: 29px; }
  .cover__footer { gap: 8px; }
  .cover__footer span { font-size: 14px; }
  .primary { font-size: 12px; gap: 5px; padding: 9px 8px; }
  .page h2 { font-size: 27px; }
  .speech-bubble p, .reason p { font-size: 18px; }
  .letter-paper>p { font-size: 22px; }
  .question__bubble { padding: 22px 17px; }
  .question__bubble h2 { font-size: 29px; }
  .answer-yes, .answer-no { min-width: 103px; font-size: 14px; }
  .page--result { padding: 22px 18px 18px; gap: 10px; }
  .answer-printer { width: min(100%, 330px); }
  .answer-ticket { min-height: 260px; padding: 49px 16px 17px; }
  .answer-card-actions button { font-size: 11px; gap: 4px; padding-inline: 5px; }
}

@media (max-height: 680px) {
  .scene { justify-content: flex-start; }
  .page { min-height: 610px; }
  .book { margin: auto 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Opening puzzle follows The Plan's three-piece interaction, redrawn in comic ink. */
.puzzle-scene {
  min-height: 100dvh;
  overflow: auto;
  padding: 24px 14px;
  display: grid;
  place-items: center;
  background: radial-gradient(var(--halftone) 1px, transparent 1.3px) 0 0 / 15px 15px, linear-gradient(145deg, var(--canvas), var(--highlight) 140%);
}
.puzzle-gate {
  width: min(100%, 455px);
  min-height: min(760px, calc(100dvh - 48px));
  padding: 29px 28px 24px;
  border: 3px solid var(--ink);
  border-radius: 25px;
  background: var(--paper);
  box-shadow: 9px 11px 0 var(--ink), 0 18px 28px var(--shadow-tint);
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: page-in .47s ease-out both;
}
.puzzle-gate:before { content: ''; position: absolute; inset: 11px; border: 1.5px dashed var(--line); border-radius: 16px; pointer-events: none; }
.puzzle-gate>h1 { position: relative; margin: 10px auto 20px; font: 700 clamp(30px, 8vw, 42px)/1.07 'Balsamiq Sans', cursive; color: var(--ink); }
.puzzle-board { width: min(100%, 370px); margin: 0 auto 14px; }
.puzzle-photo-mount { position: relative; padding: 10px 10px 29px; border: 3px solid var(--ink); background: var(--paper-light); box-shadow: 6px 7px 0 var(--accent), 9px 10px 0 var(--ink); transform: rotate(-1.3deg); }
.puzzle-photo-mount:after { content: ''; position: absolute; z-index: 5; top: 8px; bottom: 25px; left: -45%; width: 35%; background: linear-gradient(90deg, transparent, #fff9, transparent); opacity: 0; pointer-events: none; transform: skewX(-18deg); }
.puzzle-tape { position: absolute; z-index: 6; top: -13px; left: 50%; width: 82px; height: 25px; background: var(--tape); border: 1px solid color-mix(in srgb, var(--ink) 40%, transparent); transform: translateX(-50%) rotate(-4deg); }
.puzzle-visual { position: relative; isolation: isolate; overflow: hidden; border: 2px solid var(--ink); background: var(--accent-light); }
.puzzle-photo { display: block; width: 100%; height: auto; aspect-ratio: 10 / 7; }
.puzzle-filled-piece { opacity: 0; transition: opacity .28s ease; }
.puzzle-filled-piece.is-filled { opacity: 1; }
.puzzle-complete-photo { opacity: 0; transition: opacity .42s ease; }
.puzzle-empty-shape { fill: url('#puzzle-hole-fill'); stroke: var(--ink)cc; stroke-width: 2.5; vector-effect: non-scaling-stroke; filter: url('#puzzle-hole-shadow'); transition: opacity .2s ease; }
.puzzle-empty-shape.is-filled { opacity: 0; }
.puzzle-photo-line { fill: none; stroke: var(--paper); stroke-width: 5; }
.puzzle-target { position: absolute; z-index: 4; border-radius: 30%; pointer-events: none; transition: box-shadow .18s ease, background .18s ease; }
.puzzle-target.near { background: var(--paper-glass); box-shadow: 0 0 0 6px var(--highlight-glow), 0 0 22px #fff; }
.puzzle-target.solved { opacity: 0; }
.puzzle-caption { margin: 7px 0 -3px; font: 24px 'Caveat', cursive; color: var(--accent-deep); }
.puzzle-board.is-complete .puzzle-complete-photo { opacity: 1; }
.puzzle-board.is-complete .puzzle-target, .puzzle-board.is-complete .puzzle-empty-shape, .puzzle-board.is-complete .puzzle-photo-line { opacity: 0; }
.puzzle-board.is-complete .puzzle-photo-mount { animation: completed-photo 1.2s cubic-bezier(.2,.75,.25,1) both; }
.puzzle-board.is-complete .puzzle-photo-mount:after { animation: photo-shine .85s .2s ease both; }
.puzzle-note { position: relative; margin: 9px auto 6px; max-width: 320px; font: 22px/1.15 'Caveat', cursive; color: var(--ink-soft); }
.puzzle-instruction { position: relative; margin: 9px auto; font: 700 9px/1.5 'Balsamiq Sans', cursive; letter-spacing: .12em; color: var(--accent-deep); text-transform: uppercase; }
.puzzle-progress { position: relative; display: flex; align-items: center; justify-content: center; gap: 9px; font: 700 9px 'Balsamiq Sans', cursive; letter-spacing: .13em; color: var(--accent-deep); }
.puzzle-progress strong { min-width: 34px; color: var(--ink); font-size: 11px; letter-spacing: 0; }
.puzzle-tray { position: relative; min-height: 83px; display: flex; align-items: center; justify-content: center; gap: 9px; }
.puzzle-piece { position: relative; z-index: 6; width: 69px; height: 69px; padding: 0; touch-action: none; border: 0; background: transparent; filter: drop-shadow(3px 7px 4px var(--ink)69); transition: filter .2s ease, opacity .2s ease; }
.puzzle-piece svg { width: 100%; height: 100%; overflow: visible; }
.puzzle-piece-line { fill: none; stroke: var(--paper); stroke-width: 4; vector-effect: non-scaling-stroke; }
.puzzle-piece.dragging { filter: drop-shadow(8px 15px 8px var(--ink)88); transition: none; }
.puzzle-piece.solved { opacity: 0; pointer-events: none; }
.puzzle-assist { position: relative; padding: 5px; border: 0; background: none; color: var(--ink-soft); font: 18px 'Caveat', cursive; text-decoration: underline; text-underline-offset: 3px; }
.puzzle-completed .puzzle-instruction, .puzzle-completed .puzzle-progress, .puzzle-completed .puzzle-tray, .puzzle-completed .puzzle-assist { display: none; }
.puzzle-continuation { position: relative; width: min(100%, 315px); margin: 17px auto 0; padding: 14px; border: 2px solid var(--ink); border-radius: 15px; background: var(--secondary); box-shadow: 4px 5px 0 var(--ink); opacity: 0; transform: translateY(13px) rotate(-.7deg); transition: opacity .38s ease, transform .48s ease; }
.puzzle-continuation.is-visible { opacity: 1; transform: translateY(0) rotate(-.7deg); }
.puzzle-continuation>span { display: block; margin-bottom: 9px; font: 25px 'Caveat', cursive; color: var(--accent-deep); }
.puzzle-continuation button { min-height: 50px; width: 100%; border: 2px solid var(--ink); border-radius: 11px; background: var(--accent); box-shadow: 3px 4px 0 var(--ink); display: flex; align-items: center; justify-content: center; gap: 10px; font: 700 15px 'Balsamiq Sans', cursive; }
.puzzle-continuation small { display: block; margin-top: 8px; font: 17px 'Caveat', cursive; color: var(--ink-soft); }
@keyframes completed-photo { 0% { transform: rotate(-1.3deg) scale(1); } 45% { transform: rotate(1deg) scale(1.035); } 100% { transform: rotate(0) scale(1); box-shadow: 7px 9px 0 var(--accent), 11px 13px 0 var(--ink); } }
@keyframes photo-shine { 0% { left: -45%; opacity: 0; } 20% { opacity: .9; } 100% { left: 115%; opacity: 0; } }

@media (max-width: 480px) {
  .puzzle-scene { display: block; padding: 14px 12px 22px; }
  .puzzle-gate { min-height: calc(100dvh - 36px); padding: 25px 20px 21px; margin: auto; }
  .puzzle-gate>h1 { margin-bottom: 17px; }
  .puzzle-board { width: min(100%, 355px); }
  .puzzle-piece { width: 63px; height: 63px; }
  .puzzle-tray { min-height: 73px; }
}

@media (max-width: 350px) {
  .puzzle-scene { padding-left: 8px; padding-right: 8px; }
  .puzzle-gate { padding: 22px 15px 18px; }
  .puzzle-gate>h1 { font-size: 29px; }
  .puzzle-piece { width: 57px; height: 57px; }
  .puzzle-note { font-size: 19px; }
}

.gift-loading,.gift-unavailable{min-height:100svh;display:grid;place-content:center;text-align:center;padding:24px;background:var(--canvas,#f3e1cf);color:var(--ink,#292a2a)}
.gift-unavailable{gap:14px}.gift-unavailable>span{letter-spacing:.2em;color:var(--accent-deep,#923643);font-weight:700}.gift-unavailable h1{font:700 clamp(36px,8vw,72px)/1 "Balsamiq Sans",sans-serif;margin:0}.gift-unavailable p{color:var(--ink-soft,#694d4b);font-size:18px}.gift-unavailable a{justify-self:center;padding:12px 22px;border-radius:99px;background:var(--accent-deep,#923643);color:white;text-decoration:none}
