:root {
  color-scheme: light;
  --paper: #fff8ea;
  --card: #fffdf7;
  --ink: #42281f;
  --muted: #756052;
  --red: #bc302b;
  --red-soft: #fff0e9;
  --yellow: #ffe48a;
  --sea: #196582;
  --sky: #d9eff8;
  --line: #dcc8ae;
  --line-strong: #ab7953;
  --font-body: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  --font-hand: 'Patrick Hand', cursive;
  --shadow: 0 4px 0 #e8d8bc;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--paper); -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: transparent; font: 14px/1.65 var(--font-body); }
/* app.js owns the images and their active state; this layer only presents them. */
#page-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: #d9eff8; }
.page-bg-item { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.2s ease; }
.page-bg-item.is-active { opacity: 1; }
#page-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(#fff8eaed, #fff8eaf2); }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
button, img, section, div, dd, span { min-width: 0; }
img { display: block; max-width: 100%; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--sea); outline-offset: 4px; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible) { outline: none; }
button:disabled { opacity: 1; cursor: not-allowed; color: #665d55; background: #e7e1d8; border-color: #c9bfb2; box-shadow: none; transform: none; }
button:disabled:active { color: #665d55; background: #e7e1d8; box-shadow: none; transform: none; }
html.sheet-open, html.sheet-open body { overflow: hidden; overscroll-behavior: none; }
html.sheet-open body { position: relative; }
html.sheet-open body::after { content: ''; position: fixed; inset: 0; background: #152e3b9e; z-index: 10; }
.sheet:not([open]) { display: none; }
.page { width: min(100%, 680px); margin-inline: auto; padding: calc(20px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.hero, .gift-column { min-width: 0; }
.channel { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 14px 10px 10px; border: 1px solid var(--line); border-radius: 18px 15px 18px 13px; background: var(--card); box-shadow: 0 3px 0 #d6e4df; text-decoration: none; }
.avatar { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; overflow: hidden; border: 1px solid #e7d9c3; border-radius: 50%; background: var(--paper); font-size: 24px; font-weight: 800; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.channel-copy { display: grid; line-height: 1.5; }
.channel-copy strong { font-size: 17px; font-weight: 800; }
.channel-copy small { font-size: 14px; color: var(--muted); }
.channel-arrow { display: grid; place-items: center; margin-left: auto; width: 38px; height: 38px; border-radius: 50%; background: var(--sky); color: var(--sea); font-size: 24px; }
.channel:active { background: #fff1ce; transform: translateY(2px); }
.hero-heading { text-align: center; padding-top: 28px; }
.eyebrow { margin: 0 0 12px; font-size: 11px; font-weight: 800; line-height: 1.6; letter-spacing: 1.6px; color: var(--sea); }
h1 { position: relative; width: fit-content; max-width: 100%; margin: 0 auto 22px; font: 400 clamp(40px, 10.5vw, 62px)/1.12 var(--font-hand); color: var(--red); }
.highlight { position: relative; isolation: isolate; display: inline-block; color: var(--ink); }
.highlight::before { content: ''; position: absolute; z-index: -1; left: -4px; right: -4px; top: 24%; bottom: 2%; background: var(--yellow); clip-path: polygon(1% 13%, 16% 7%, 39% 12%, 67% 0, 99% 9%, 97% 41%, 100% 70%, 98% 92%, 72% 86%, 44% 100%, 17% 90%, 0 98%, 2% 64%, 0 37%); transform: rotate(-2deg); }
.title-heart { position: absolute; right: -22px; top: -3px; font-size: 30px; transform: rotate(16deg); }
/* v5.1: reserve a separate row above the image, including room for the tail. */
.hero-scene { position: relative; display: flex; flex-direction: column; gap: 16px; border-radius: 24px 18px 26px 18px; }
.hero-image { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border: 1px solid #86bdd2; border-radius: inherit; box-shadow: 0 4px 0 #c5e0e6; }
.speech { position: relative; order: -1; width: 100%; margin: 0; padding: 12px 14px; border: 1.5px solid var(--ink); border-radius: 24px 27px 23px 20px; background: var(--card); text-align: center; font: 400 clamp(18px, 2.5vw, 22px)/1.12 var(--font-hand); overflow-wrap: break-word; box-shadow: 2px 2px 0 #42281f26; }
.speech::after { content: ''; position: absolute; left: 40%; bottom: -8px; width: 13px; height: 13px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); background: var(--card); transform: skewY(25deg) rotate(30deg); }
.speech-copy { position: relative; z-index: 1; display: block; }
.speech-copy > span:not(.speech-heart) { display: block; margin-top: 3px; }
.speech-heart { color: var(--red); display: inline-block; margin-top: 2px; font-size: 22px; }
.hero-note { margin: 20px 0 12px; text-align: center; font: 400 24px/1.25 var(--font-hand); }
.hero-note strong { font-weight: 400; }
.little-dash { display: block; margin: 0 auto; width: 44px; height: 5px; background: var(--yellow); border-radius: 50%; transform: rotate(-4deg); }
/* v6: app.js owns stack order (--pos / data-pos), z-index and the 420ms flip. */
.moments-album { display: flex; flex-direction: column; min-width: 0; margin: 44px 0 28px; padding-bottom: 24px; overflow: hidden; }
.album-heading { order: -1; }
.album-heading .eyebrow { margin-bottom: 5px; }
.album-heading h2 { position: relative; margin: 0; font: 400 clamp(29px, 8vw, 40px)/1.15 var(--font-hand); }
.album-heading h2 > span:first-child { background: linear-gradient(transparent 55%, var(--yellow) 55%, var(--yellow) 94%, transparent 94%); }
.album-heart { display: inline-block; margin-left: 5px; color: var(--red); font-size: 24px; transform: rotate(12deg); }
.album-heading-copy > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.album-side { display: none; }
.album-stack { --album-stack-width: clamp(220px, 64vw, 280px); --flip-direction: 1; position: relative; isolation: isolate; flex: none; width: var(--album-stack-width); height: calc(var(--album-stack-width) * 1.25 + 96px); margin: 34px auto 28px; }
/* No :has() dependency: the heading follows the stack in DOM, appears first via order. */
.album-stack:not([data-count]), .album-stack[data-count="0"],
.album-stack:not([data-count]) ~ *, .album-stack[data-count="0"] ~ * { display: none; }
.album-item { --tilt: -.8deg; --offset-x: 0px; --offset-y: calc(min(var(--pos, 0), 3) * 4px); --lift: 0px; position: absolute; inset: 0; display: block; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 3px; background: transparent; text-align: left; cursor: default; pointer-events: none; opacity: 0; transform: translate(var(--offset-x), calc(var(--offset-y) + var(--lift))) rotate(var(--tilt)); transition: transform .46s cubic-bezier(.2,.7,.2,1), opacity .42s ease; }
.album-item[data-pos="0"] { opacity: 1; pointer-events: auto; cursor: pointer; }
.album-item[data-pos="1"] { --tilt: -4deg; --offset-x: -5px; opacity: 1; }
.album-item[data-pos="2"] { --tilt: 5deg; --offset-x: 5px; opacity: 1; }
.album-item[data-pos="3"] { --tilt: -6deg; --offset-x: -2px; opacity: 1; }
.album-float { display: block; height: 100%; }
.album-polaroid { position: relative; display: block; height: 100%; padding: 10px 10px 13px; border: 1px solid #e5ded2; border-radius: 3px 2px 4px 2px; background: #fffefa; box-shadow: 0 5px 10px #42281f1a; }
.album-polaroid::before { content: ''; position: absolute; z-index: 2; width: 70px; height: 23px; top: -12px; left: calc(50% - 35px); background: #e8d494bd; border-inline: 1px dashed #b99b6259; transform: rotate(-5deg); }
.album-polaroid::after { content: ''; position: absolute; z-index: -1; inset: 0; border-radius: inherit; box-shadow: 0 15px 23px #42281f2b; opacity: 0; transition: opacity .46s ease; }
.album-item:nth-child(3n + 2) .album-polaroid::before { background: #b9d9e2c9; transform: rotate(5deg); }
.album-item[data-pos="0"] .album-polaroid::after { opacity: 1; }
.album-photo { display: block; width: 100%; aspect-ratio: 4 / 5; overflow: hidden; background: var(--sky); }
.album-photo img { display: block; width: 100%; height: 100%; aspect-ratio: 4 / 5; object-fit: contain; }
.album-caption { display: block; min-height: 2.3em; margin-top: 10px; overflow-wrap: anywhere; color: var(--ink); font: 400 23px/1.15 var(--font-hand); }
.album-chapter { display: inline-block; margin-top: 8px; color: var(--sea); font-size: 14px; font-weight: 600; line-height: 1.4; }
.album-chapter:empty { display: none; }
.album-item[data-kind="chibi"] .album-caption::after { content: ' ♡'; color: var(--red); }
.album-item[data-pos="0"]:focus-visible { --lift: -5px; outline: 3px solid var(--sea); outline-offset: 5px; }
.album-item[data-pos="0"]:active { --lift: -2px; }
.album-stack:focus-within .album-item[data-pos="1"] { --offset-x: -8px; --offset-y: 7px; --tilt: -5deg; }
.album-stack:focus-within .album-item[data-pos="2"] { --offset-x: 8px; --offset-y: 11px; --tilt: 6deg; }
.album-stack:focus-within .album-item[data-pos="3"] { --offset-y: 16px; }
@media (hover: hover) {
  .album-stack:hover .album-item[data-pos="0"] { --lift: -5px; }
  .album-stack:hover .album-item[data-pos="1"] { --offset-x: -8px; --offset-y: 7px; --tilt: -5deg; }
  .album-stack:hover .album-item[data-pos="2"] { --offset-x: 8px; --offset-y: 11px; --tilt: 6deg; }
  .album-stack:hover .album-item[data-pos="3"] { --offset-y: 16px; }
}
.album-item[data-pos="0"].is-flipping { pointer-events: none; animation: album-flip-out 420ms ease-in both; }
@keyframes album-flip-out {
  from { transform: translate(0, var(--lift)) rotate(-.8deg); opacity: 1; }
  to { transform: translate(calc(var(--flip-direction) * 42%), -18px) rotate(calc(var(--flip-direction) * 18deg)); opacity: 0; }
}
.album-footnote { margin: 0; padding-inline: 8px; text-align: center; color: var(--muted); font-size: 14px; }
.album-footnote > span, .album-side-label > span { color: var(--red); }
.setup-warning { margin: 26px 0 0; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 12px; background: #fff1cd; color: #654323; }
.gifts-section { margin-top: 36px; }
.section-heading { margin-bottom: 22px; }
.section-heading .eyebrow { margin-bottom: 6px; }
.section-heading h2 { margin: 0 0 9px; font: 400 clamp(32px, 8.5vw, 42px)/1.2 var(--font-hand); }
.section-heading h2 > span:first-child { background: linear-gradient(transparent 48%, var(--sky) 48%, var(--sky) 92%, transparent 92%); }
.heading-heart { color: var(--red); display: inline-block; margin-left: 8px; transform: rotate(13deg); }
.section-heading > p:last-child { margin: 0; color: var(--muted); }
.gift-group + .gift-group { margin-top: 24px; }
.group-heading { margin-bottom: 14px; padding-left: 12px; border-left: 3px solid #77b9d0; }
.group-heading h3 { margin: 0; font-size: 18px; line-height: 1.5; font-weight: 800; }
.group-heading p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.gift-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.gift { position: relative; display: flex; flex-direction: column; align-items: center; padding: 10px; border: 1px solid var(--line-strong); border-radius: 20px 18px 19px 16px; box-shadow: var(--shadow); background: #fff8eaf2; text-align: center; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; overflow-wrap: anywhere; }
.gift-art { display: grid; place-items: center; width: clamp(80px, 24vw, 100px); max-width: 100%; aspect-ratio: 1; flex-shrink: 0; font-size: 48px; line-height: 1; }
.gift-art img { width: 100%; height: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 12px; }
.gift-price { font-size: clamp(20px, 5.4vw, 26px); font-weight: 800; line-height: 1.3; color: var(--red); margin-top: 5px; white-space: nowrap; overflow-wrap: normal; }
.gift-name { font-size: 14px; line-height: 1.4; margin-top: 3px; }
.gift-desc { display: block; font-size: 14px; line-height: 1.4; color: var(--muted); margin: 4px 0 0; }
.gift:active { transform: translateY(3px); box-shadow: 0 1px 0 #e8d8bc; background: #ffedbd; }
.gift.is-recommended { border: 2px solid var(--red); padding: 9px; box-shadow: 0 4px 0 #e9bca6; }
.badge { position: absolute; top: -11px; right: 9px; padding: 3px 10px; border: 1px solid var(--red); border-radius: 6px 8px 6px 8px; background: var(--red); color: white; font-size: 11px; font-weight: 700; line-height: 1.6; transform: rotate(3deg); }
.gift.is-custom { grid-column: 1 / -1; display: grid; grid-template-columns: 92px minmax(0, 1fr); column-gap: 16px; align-items: start; text-align: left; padding: 14px 16px; background: var(--paper); }
.gift.is-custom .gift-art { grid-column: 1; grid-row: 1 / 4; align-self: center; }
.gift.is-custom .gift-price { grid-column: 2; margin-top: 4px; font-size: 24px; }
.gift.is-custom .gift-name { grid-column: 2; margin-top: 2px; }
.gift.is-custom .gift-desc { grid-column: 2; margin-bottom: 0; }
.reader-note { position: relative; margin-top: 50px; padding: 20px 18px 25px; border: 1px solid var(--line); border-radius: 5px 17px 7px 18px; text-align: center; background: var(--paper); box-shadow: 3px 4px 0 #eadfcb; }
.note-tape { position: absolute; width: 76px; height: 21px; background: #f7d574b3; top: -10px; left: calc(50% - 38px); transform: rotate(-4deg); }
.reader-note img { width: 160px; height: 160px; margin: 0 auto; object-fit: contain; }
.reader-note .handwritten { margin: 4px 0 12px; font: 400 28px/1.2 var(--font-hand); }
.reader-note .handwritten span { color: var(--red); }
.reader-note > p:not(.handwritten) { color: var(--muted); margin: 0; }
.reader-note .note-signature { padding-top: 16px; font: 400 22px/1.2 var(--font-hand); color: var(--sea) !important; }
.footer { margin-top: 36px; border-top: 1px dashed var(--line-strong); padding-top: 22px; color: var(--muted); }
.footer > p { margin: 0 0 8px; font-size: 14px; }
.footer a { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; }
.footer a strong { color: var(--ink); font-size: 17px; }
.footer a > span { color: var(--sea); font-size: 14px; }
.footer a > span > span { margin-left: 4px; font-size: 22px; }
.footer a:active { background: var(--sky); border-radius: 8px; }
.footer-heart { display: block; text-align: center; color: var(--red); font: 400 27px var(--font-hand); margin-top: 18px; }
/* The dialog itself scrolls: app.js resets sheet.scrollTop when switching steps. */
.sheet { position: fixed; inset: auto 0 0; margin: 0 auto; width: min(100%, 600px); max-width: 100%; height: auto; max-height: calc(100vh - max(12px, env(safe-area-inset-top, 0px))); max-height: calc(100dvh - max(12px, env(safe-area-inset-top, 0px))); padding: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 28px 28px 0 0; background: var(--paper); color: var(--ink); box-shadow: 0 -12px 60px #291d2933; }
.sheet[open] { animation: sheet-in .24s ease-out; }
/* A body overlay also works with app.js's Safari 15.0–15.3 dialog fallback. */
.sheet { z-index: 11; }
.sheet::backdrop { background: transparent; }
.sheet-content { position: relative; padding: 22px max(20px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); }
.sheet-handle { display: block; width: 40px; height: 5px; margin: -10px auto 24px; border-radius: 99px; background: #cfbaa0; }
.close { position: absolute; top: 20px; right: 14px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card); font: 400 29px/1 var(--font-body); z-index: 1; }
.close:active { background: var(--yellow); }
/* Initial dialog focus announces the gift title without highlighting Close. */
#preview-title:focus { outline: none; }
.step-label { padding: 0 36px 0 0; font-size: 10px; letter-spacing: 1px; min-height: 26px; margin-bottom: 10px; }
.preview-step { text-align: center; }
.preview-step .step-label, .thanks-step .step-label { padding: 0 30px; }
.sheet-art { display: grid; place-items: center; width: 176px; height: 176px; margin: 0 auto 12px; font-size: 84px; line-height: 1; }
.sheet-art img { width: 100%; height: 100%; object-fit: contain; border-radius: 18px; }
.sheet h2 { margin: 0; font: 400 36px/1.15 var(--font-hand); overflow-wrap: anywhere; }
.preview-desc { color: var(--muted); margin: 12px auto 18px; max-width: 360px; }
.preview-amount { margin: 0 0 24px; color: var(--muted); }
.preview-amount strong { display: block; color: var(--red); font-size: 28px; line-height: 1.5; font-weight: 800; }
.sheet-actions { display: grid; gap: 12px; }
.primary, .secondary, .text-btn { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 12px; line-height: 1.5; font-size: 15px; }
.primary { display: flex; align-items: center; justify-content: center; gap: 12px; font-weight: 800; color: #fff; background: var(--red); border: 1px solid #94221c; box-shadow: 0 3px 0 #8f2c23; }
.primary > span { font-size: 20px; line-height: 1; }
.secondary { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--sky); color: #20556a; font-weight: 700; border: 1px solid #96bece; }
.secondary > span { font-size: 22px; line-height: 1; }
.text-btn { background: transparent; border: 1px solid transparent; color: var(--muted); }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #8f2c23; background: #a02823; }
.secondary:active, .text-btn:active { background: #f5dfae; color: var(--ink); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding-right: 12px; }
.sheet-art.small { flex: 0 0 64px; width: 64px; height: 64px; margin: 0; font-size: 38px; border: 1px solid var(--line); border-radius: 14px; }
.sheet-art.small img { border-radius: 14px; }
.sheet-head h2 { font-size: 28px; }
.sheet-head p { margin: 4px 0 0; color: var(--red); font-weight: 800; font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
.qr-frame { position: relative; width: 100%; margin: 18px auto 12px; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 18px; }
/* The display image is a square QR PNG with its own white quiet zone. */
.qr-image-window { width: 100%; aspect-ratio: 1; background: white; }
.qr-image-window img { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.qr-loading { position: absolute; z-index: 1; inset: 10px; display: grid; place-items: center; padding: 16px; margin: 0; background: white; color: var(--muted); text-align: center; font-size: 14px; }
.is-bank-missing .qr-frame { border-style: dashed; border-color: var(--line-strong); background: #fffcf3; }
.is-bank-missing .qr-loading { padding: 28px; border-radius: 12px; background: #fffcf3; color: #654323; line-height: 1.8; }
.is-bank-missing .qr-loading::before { content: '♡'; display: block; align-self: end; color: var(--red); font: 400 52px/1 var(--font-hand); }
.is-bank-missing .qr-loading { grid-template-rows: 1fr 1fr; gap: 16px; }
.hint { margin: 0 0 18px; padding: 11px 12px; border: 1px dashed #a8c4cb; background: #edf6f7; border-radius: 10px; color: #3c5d68; font-size: 14px; text-align: center; }
.bank { margin: 0 0 22px; padding: 0 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: 14px; }
.bank > div { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 0; }
.bank > div + div { border-top: 1px dashed var(--line); }
.bank dt { color: var(--muted); white-space: nowrap; }
.bank dd { margin: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; text-align: right; font-weight: 700; overflow-wrap: anywhere; word-break: break-word; }
.bank dd > span { max-width: 100%; }
.bank button { display: inline-grid; place-items: center; padding: 8px 10px; min-width: 44px; min-height: 44px; border: 1px solid #a6c4ce; border-radius: 8px; background: #eef7fa; color: #20556a; font-size: 14px; font-weight: 600; }
.bank button:active { background: var(--yellow); }
.privacy { margin: 12px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.thanks-step { text-align: center; }
.thanks-image { width: min(100%, 240px); height: auto; aspect-ratio: 1; margin: 0 auto 12px; }
.thanks-step h2 { color: var(--red); }
.thanks-step > p:not(.eyebrow) { color: var(--muted); margin: 16px auto; max-width: 380px; }
.thanks-step .thanks-message { font: 400 23px/1.3 var(--font-hand); color: var(--sea) !important; }
.thanks-message span { color: var(--red); }
.thanks-step .primary { margin-top: 22px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 100; width: max-content; max-width: calc(100% - 32px); padding: 12px 18px; border: 1px solid #ffffff55; border-radius: 14px; background: var(--ink); color: white; font-size: 14px; text-align: center; overflow-wrap: anywhere; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (hover: hover) { .gift:hover { background: #fff0d1; border-color: var(--red); transform: translateY(-2px); } .channel:hover { background: #fff2d1; } }
@media (max-width: 559px) {
  /* A final unpaired card fills the row, regardless of gift id or count. */
  .gift:last-child:nth-child(odd) { grid-column: 1 / -1; display: grid; grid-template-columns: 80px minmax(0, 1fr); column-gap: 14px; align-items: start; padding: 12px 14px; text-align: left; }
  .gift:last-child:nth-child(odd) .gift-art { grid-column: 1; grid-row: 1 / 4; width: 80px; align-self: center; }
  .gift:last-child:nth-child(odd) .gift-price { grid-column: 2; margin-top: 0; }
  .gift:last-child:nth-child(odd) .gift-name, .gift:last-child:nth-child(odd) .gift-desc { grid-column: 2; }
  .gift:last-child:nth-child(odd).is-recommended { padding: 11px 13px; }
}
@media (max-width: 430px) {
  .bank > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .bank dd { justify-content: flex-start; text-align: left; }
}
@media (min-width: 560px) {
  .page { padding-right: 28px; padding-left: 28px; padding-top: 28px; }
  .channel { max-width: 360px; margin: 0 auto; }
  .hero-heading { padding-top: 36px; }
  .hero-note { font-size: 29px; }
  .gift-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .gift-art { max-width: 170px; }
  .gift.is-custom { grid-template-columns: 112px minmax(0, 1fr); padding: 18px 24px; }
  .gift.is-custom .gift-art { width: 112px; }
  .reader-note { padding-top: 24px; }
  .reader-note img { width: 180px; height: 180px; }
  .sheet-content { padding-left: 28px; padding-right: 28px; }
  .qr-frame { max-width: 380px; }
}
@media (min-width: 768px) {
  .page { width: min(100%, 840px); }
  #page-bg::after { background: linear-gradient(90deg, #fff8eaed, #fff8eaf2 20%, #fff8eaf2 80%, #fff8eaed); }
  .sheet { inset: 0; margin: auto; width: min(580px, calc(100% - 48px)); height: fit-content; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); border: 1px solid var(--line-strong); border-radius: 26px; box-shadow: 0 20px 80px #291d2940; }
  .sheet-content { padding: 30px 28px 26px; }
  .sheet-handle { display: none; }
  .close { top: 16px; right: 16px; }
  .sheet[open] { animation: modal-in .2s ease-out; }
  .sheet .step-label { margin-bottom: 18px; }
}
@media (min-width: 1024px) {
  #page-bg::after { background: linear-gradient(90deg, #fff8eab8, #fff8ead6 16%, #fff8ead6 84%, #fff8eab8); }
  .page { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.35fr); align-items: start; gap: 28px; width: min(100%, 1280px); padding: 32px 28px 40px; }
  .hero { position: sticky; top: 24px; padding: 20px; border: 1px solid #fffdf7; border-radius: 28px 22px 26px 24px; background: #fff8eadb; box-shadow: 0 8px 36px #42281f0f; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .channel { max-width: none; }
  .hero-heading { padding-top: 28px; }
  h1 { font-size: clamp(43px, 4.2vw, 59px); margin-bottom: 22px; }
  .title-heart { right: -16px; font-size: 28px; }
  .hero-scene { border-radius: 20px 16px 22px 16px; }
  .hero-note { font-size: 27px; }
  .gift-column { padding: 24px; border: 1px solid #fffdf7; border-radius: 26px 28px 22px 26px; background: #fff8eae6; box-shadow: 0 8px 36px #42281f0f; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .setup-warning { margin-top: 0; margin-bottom: 24px; }
  .gifts-section { margin-top: 0; }
  .section-heading { margin-bottom: 28px; }
  .section-heading h2 { font-size: 44px; }
  .section-heading > p:last-child { font-size: 15px; }
  .group-heading h3 { font-size: 20px; }
  .gift-list { gap: 16px 12px; }
  .gift { padding: 12px 10px; }
  .gift.is-recommended { padding: 11px 9px; }
  .gift-art { width: 108px; }
  .gift-price { font-size: clamp(20px, 1.8vw, 25px); }
  .gift-name { font-size: 16px; }
  .gift-group + .gift-group { margin-top: 28px; }
  .reader-note { margin-top: 36px; }
  .footer { margin-top: 28px; }
}
@media (min-width: 1400px) {
  .page { grid-template-columns: minmax(0, .85fr) minmax(0, 1.45fr); gap: 32px; }
  .gift-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* Existing groups have 1–3 gifts. Let the final card use the spare columns. */
  .gift:last-child:nth-child(3) { grid-column: span 2; }
  .gift:last-child:nth-child(2) { grid-column: span 3; }
  .gift-art { width: 116px; }
  .gift-price { font-size: clamp(19px, 1.65vw, 24px); }
}
@media (min-width: 1024px) and (max-height: 740px) {
  .hero { position: static; }
}
/* v4: each sticker has a reserved corner; none live in the payment dialog. */
.edge-sticker { display: block; pointer-events: none; user-select: none; object-fit: contain; height: auto; max-width: none; flex-shrink: 0; transform-origin: 50% 88%; animation: sticker-bob 5.8s ease-in-out infinite; }
.hero-signoff { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.hero-signoff .hero-note { flex: 1; min-width: 0; margin: 0; font-size: 23px; }
.sticker-teo { width: 66px; animation-name: sticker-wave; animation-duration: 6.4s; animation-delay: -1.7s; }
.sticker-vu, .sticker-thao { display: none; }
.gift-column { position: relative; }
.section-heading { position: relative; min-height: 120px; padding-right: 88px; }
.sticker-black-cat { position: absolute; top: -6px; right: 0; width: 76px; height: 104px; animation-duration: 7.1s; animation-delay: -3.4s; }
.reader-note .sticker-duong { position: absolute; right: 4px; top: -38px; width: 72px; height: 108px; margin: 0; animation-duration: 6.7s; animation-delay: -2.1s; }
.footer { position: relative; margin-top: 32px; padding-top: 114px; }
.sticker-white-cat { position: absolute; top: 8px; right: 12px; width: 140px; height: 88px; transform-origin: 50% 90%; animation: sticker-breathe 6.5s ease-in-out -4s infinite; }
.speech-question { white-space: normal; font-size: clamp(14px, 3.6vw, 16px); }
.speech-copy > .speech-question { margin-top: 0; }
html.sheet-open .edge-sticker { visibility: hidden; }
@media (min-width: 768px) {
  .sticker-teo { width: 88px; }
  .section-heading { min-height: 134px; padding-right: 116px; }
  .sticker-black-cat { width: 96px; height: 126px; }
  .reader-note .sticker-duong { width: 104px; height: 156px; top: -40px; right: 12px; }
  .sticker-white-cat { width: 142px; height: 94px; }
  .speech-question { font-size: 18px; }
}
@media (min-width: 1024px) {
  .hero-signoff .hero-note { font-size: 24px; }
  .sticker-teo { width: 76px; }
  .section-heading { padding-right: 100px; min-height: 146px; }
  .sticker-black-cat { width: 88px; height: 120px; }
  .reader-note .sticker-duong { width: 116px; height: 174px; right: 6px; }
  .reader-note { margin-top: 62px; }
  .speech-question { font-size: clamp(14px, 1.1vw, 16px); }
}
@media (min-width: 1400px) {
  /* 120px outer lanes at 1440px; content retains a wide two-column layout. */
  .page { width: min(calc(100% - 240px), 1280px); }
  .sticker-vu, .sticker-thao { display: block; position: absolute; width: 122px; height: 210px; }
  .sticker-vu { top: 330px; left: -140px; animation-name: sticker-wave; animation-duration: 7.3s; animation-delay: -2.8s; }
  .sticker-thao { top: 350px; right: -140px; animation-duration: 6.9s; animation-delay: -4.3s; }
  /* Three equal cards use more of each narrow group than 1 + 1 + 2 columns. */
  .gift-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gift:last-child:nth-child(3) { grid-column: auto; }
  .gift:last-child:nth-child(2) { grid-column: span 2; }
  .gift-price { font-size: clamp(20px, 1.65vw, 24px); }
}
@keyframes sticker-bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-4px) rotate(1deg); } }
@keyframes sticker-wave { 0%, 65%, 100% { transform: rotate(-2deg); } 72%, 86% { transform: translateY(-3px) rotate(3deg); } 79%, 93% { transform: rotate(-3deg); } }
@keyframes sticker-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025, 1.035); } }
@keyframes modal-in { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
/* v6: retain the existing two-column page and reserved outer lanes. */
@media (min-width: 1024px) {
  :root { --album-side-width: clamp(136px, 12vw, 210px); --album-lane: calc(var(--album-side-width) + 16px); }
  .page { width: min(calc(100% - var(--album-lane) - var(--album-lane)), 1280px); padding: 24px 8px 40px; gap: 18px; grid-template-columns: minmax(0, .78fr) minmax(0, 1.3fr); }
  #album { display: none; }
  .hero { padding: 16px 12px; top: 20px; }
  .hero-heading { padding-top: 24px; }
  h1 { font-size: clamp(32px, 3.15vw, 49px); }
  .speech-question { font-size: 14px; }
  .hero-signoff .hero-note { font-size: 21px; }
  .sticker-teo { width: 60px; }
  .gift-column { padding: 20px 16px; }
  .section-heading { min-height: 132px; padding-right: 74px; }
  .section-heading h2 { font-size: clamp(30px, 2.8vw, 42px); }
  .sticker-black-cat { width: 68px; height: 100px; }
  /* v8: three equal gift cards per group also fit the compact desktop layout. */
  .gift-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gift:last-child:nth-child(2), .gift:last-child:nth-child(3) { grid-column: auto; }
  .gift.is-custom { grid-column: 1 / -1; }
  .gift-art { width: 100px; }
  .gift-price { font-size: clamp(20px, 1.65vw, 24px); }
  .gift-name { font-size: 14px; }
  .reader-note .sticker-duong { width: 72px; height: 108px; right: 4px; top: -38px; }
  /* Each fixed lane clips only the outward flip, never the central content. */
  .album-side { display: flex; flex-direction: column; position: fixed; top: 50%; transform: translateY(-50%); width: var(--album-lane); max-height: 100vh; max-height: 100dvh; padding: 20px 0; overflow: hidden; z-index: 1; }
  .album-side-left { left: 0; }
  .album-side-right { right: 0; }
  .album-side .album-stack { --album-stack-width: calc(var(--album-side-width) - 24px); height: calc(var(--album-stack-width) * 1.25 + 100px); margin-block: 22px 26px; }
  .album-side-left .album-stack { --flip-direction: -1; }
  .album-side-label { order: -1; margin: 0; text-align: center; font: 400 24px/1.2 var(--font-hand); }
  .album-side .album-polaroid { padding: 6px 6px 8px; }
  .album-side .album-polaroid::before { width: 42px; height: 14px; top: -7px; left: calc(50% - 21px); }
  .album-side .album-caption { min-height: 3.6em; font-size: 17px; line-height: 1.2; margin-top: 7px; }
  .album-side .album-chapter { font-size: 14px; margin-top: 4px; }
  /* Vũ and Thảo keep their v4 assets, now in reserved footer corners. */
  .footer { padding-top: 152px; }
  .footer .sticker-vu, .footer .sticker-thao { display: block; position: absolute; top: 8px; width: 72px; height: 126px; }
  .footer .sticker-vu { left: 0; }
  .footer .sticker-thao { right: 0; }
  .footer .sticker-white-cat { left: calc(50% - 49px); right: auto; top: 42px; width: 98px; height: 80px; }
}
@media (min-width: 1280px) {
  .page { grid-template-columns: minmax(0, .82fr) minmax(0, 1.4fr); gap: 24px; }
  .gift-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gift:last-child:nth-child(2) { grid-column: span 2; }
  .gift.is-custom { grid-column: 1 / -1; }
  .reader-note .sticker-duong { width: 104px; height: 156px; right: 8px; }
}
@media (min-width: 1600px) {
  .hero { padding: 20px; }
  .gift-column { padding: 24px; }
  .gift-art { width: 116px; }
  .gift-name { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
