/* ─────────────────────────────────────────────────────────────
   PEACHE TOWN — Apply  (apply.html)
   Ported from peache.world/invitation: one arched card per question, dealt like the laws;
   the last one is signed, then the application goes into an envelope tied with the bow.
   Dressed in the Town: its sky, its type, its butterfly. Light only.
   ───────────────────────────────────────────────────────────── */

@font-face{font-family:'BR';src:url('fonts/beau-rivage.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:'IS';src:url('fonts/instrument-serif.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:'IS';src:url('fonts/instrument-serif-italic.woff2') format('woff2');font-weight:400;font-style:italic;font-display:swap}
@font-face{font-family:'DM';src:url('fonts/dm-mono-400.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:'DM';src:url('fonts/dm-mono-500.woff2') format('woff2');font-weight:500;font-style:normal;font-display:swap}

:root {
  color-scheme: light;
  --paper: #FEF3E4;
  --blush: #FCE6D9;
  --peach: #F9CDB8;
  --rose: #EC9F92;          /* the butterfly's wire */
  --ink: #4F1B3D;
  --ink-2: #7B4A66;
  --accent: #B8336A;        /* raspberry */
  --mark: rgba(184,51,106,.72); /* the pen: raspberry, a touch lighter than the words */
  --mint: #DFF3E8;
  --sh: 176,92,92;          /* warm rose shadow, as rgb */

  --script: 'BR', "Snell Roundhand", cursive;
  --serif: 'IS', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --ui: 'DM', ui-monospace, "SF Mono", Menlo, monospace;
  --pen-ease: cubic-bezier(.62,0,.24,1);
  --ease: cubic-bezier(.22,1,.36,1);
  --out: cubic-bezier(.16,1,.3,1);
  --spring: cubic-bezier(.34,1.56,.64,1);
  --gutter: clamp(16px, 4.4vw, 56px);
}

* { box-sizing: border-box; }
/* the page's ground lives on html only: a body background would hide the z-index:-1 sky */
html { overflow-x: clip; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0; min-height: 100svh; overflow-x: clip;
  color: var(--ink); font-family: var(--ui); font-weight: 400;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--blush); color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { display: none; }

/* ───────── the sky (from town.css): cream, light that drifts, a little grain ───────── */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.sky i { position: absolute; display: block; }
.sky .glow { border-radius: 50%; will-change: transform; }
.sky .g1 { left: calc(6vw - 46vmax); top: calc(4vh - 46vmax); width: 92vmax; height: 92vmax; background: radial-gradient(closest-side, rgba(223,243,232,.92), rgba(223,243,232,0)); animation: drift1 44s ease-in-out infinite alternate; }
.sky .g2 { left: calc(98vw - 50vmax); top: calc(44vh - 50vmax); width: 100vmax; height: 100vmax; background: radial-gradient(closest-side, rgba(250,208,188,.78), rgba(250,208,188,0)); animation: drift2 57s ease-in-out infinite alternate; }
.sky .g3 { left: calc(18vw - 55vmax); top: calc(106vh - 55vmax); width: 110vmax; height: 110vmax; background: radial-gradient(closest-side, rgba(246,184,172,.56), rgba(246,184,172,0)); animation: drift3 66s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate3d(9vmax, 7vmax, 0) scale(1.12); } }
@keyframes drift2 { to { transform: translate3d(-11vmax, 9vmax, 0) scale(.9); } }
@keyframes drift3 { to { transform: translate3d(12vmax, -8vmax, 0) scale(1.1); } }
.sky .grain { inset: 0; background: url('img/grain.png') 0 0 / 220px 220px; opacity: .22; }
#dust { position: fixed; inset: 0; z-index: 55; pointer-events: none; width: 100vw; height: 100vh; }

/* ───────── the butterfly (from town.css): two wings on a hinge, and a body ───────── */
.bf { position: relative; width: 100%; aspect-ratio: 894 / 724; --bw: 68px; }
.bf-halo { position: absolute; left: 50%; top: 50%; width: 150%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,255,255,.7), rgba(255,246,238,.35) 45%, rgba(255,246,238,0) 72%); }
.bf-tilt { position: absolute; inset: 0; perspective: calc(var(--bw) * 2.7); }
.wing { position: absolute; top: 0; width: 50%; height: 100%; transform-style: preserve-3d; will-change: transform; }
.wing > i { position: absolute; inset: 0; display: block; background: no-repeat 50% 50% / 100% 100%; }
.wing-l { left: 0; transform-origin: 100% 50%; animation: beatL 4.4s ease-in-out 1.75s infinite both; }
.wing-r { left: 50%; transform-origin: 0 50%; animation: beatR 4.4s ease-in-out 1.75s infinite both; }
.wing-l > i { transform-origin: 100% 50%; background-image: url('fly/wing-l.webp'); }
.wing-r > i { transform-origin: 0 50%; background-image: url('fly/wing-r.webp'); }
.bf-body { position: absolute; left: 47.76%; top: 43.99%; width: 4.36%; height: 26.75%; background: url('fly/body.webp') 50% 50% / 100% 100% no-repeat; }
@keyframes beatL { 0%, 100% { transform: rotateY(3deg); } 34% { transform: rotateY(34deg); } 50% { transform: rotateY(26deg); } 66% { transform: rotateY(37deg); } }
@keyframes beatR { 0%, 100% { transform: rotateY(-3deg); } 34% { transform: rotateY(-34deg); } 50% { transform: rotateY(-26deg); } 66% { transform: rotateY(-37deg); } }
/* it arrives folded, then opens */
.bf.hatch .wing-l { animation: hatchL 1.6s cubic-bezier(.22,1.18,.32,1) .15s both, beatL 4.4s ease-in-out 1.75s infinite; }
.bf.hatch .wing-r { animation: hatchR 1.6s cubic-bezier(.22,1.18,.32,1) .15s both, beatR 4.4s ease-in-out 1.75s infinite; }
.bf.hatch { animation: arrive 1.5s var(--ease) .05s both; }
@keyframes hatchL { from { transform: rotateY(86deg); } to { transform: rotateY(3deg); } }
@keyframes hatchR { from { transform: rotateY(-86deg); } to { transform: rotateY(-3deg); } }
@keyframes arrive { from { opacity: 0; transform: translate3d(0, 7%, 0) scale(.86); } to { opacity: 1; transform: none; } }
/* a new card: it hops and flutters */
.bf.flit .wing-l > i { animation: flitL .46s ease-in-out 3; }
.bf.flit .wing-r > i { animation: flitR .46s ease-in-out 3; }
.bf.flit .bf-tilt { animation: hop 1.38s var(--ease); }
@keyframes flitL { 50% { transform: rotateY(44deg); } }
@keyframes flitR { 50% { transform: rotateY(-44deg); } }
@keyframes hop { 30% { transform: translate3d(0, -14%, 0) rotate(-6deg); } }

/* on the card's top-right shoulder, where the arch is */
.perch {
  position: absolute; z-index: 6; pointer-events: none;
  left: calc(var(--cw) * .84); top: calc(var(--cw) * .096);
  width: 70px; transform: translate(-50%, -74%) rotate(20deg);
}
.perch .bf { --bw: 70px; }

/* ───────── glass (from peache.css) ───────── */
.glass {
  position: relative;
  background: linear-gradient(160deg, rgba(255,255,255,.7) 0%, rgba(255,255,255,.34) 55%, rgba(255,246,236,.26) 100%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
  backdrop-filter: blur(18px) saturate(155%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95), inset 0 -1px 0 rgba(255,255,255,.35), 0 22px 48px -22px rgba(var(--sh),.42), 0 2px 8px -3px rgba(var(--sh),.16);
  isolation: isolate;
}
.glass::before, .gbtn::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.2px;
  background: linear-gradient(140deg, rgba(255,255,255,1) 0%, rgba(255,255,255,.25) 32%, rgba(255,255,255,0) 52%, rgba(203,235,220,.55) 78%, rgba(223,243,232,.95) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none; z-index: 2;
}
.glass > * { position: relative; z-index: 3; }

/* ───────── glass buttons: thick liquid glass, a pearl knob, a squish you can feel ───────── */
.gbtn {
  --tint: rgba(249,205,184,.66);
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 16px;
  height: 62px; padding: 0 8px 0 30px;
  border: 0; border-radius: 999px; cursor: pointer;
  font: 500 12.5px/1 var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--ink);
  text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; touch-action: manipulation;
  background:
    radial-gradient(90% 130% at 50% 135%, var(--tint), rgba(249,205,184,0) 72%),
    linear-gradient(180deg, rgba(255,255,255,.84) 0%, rgba(255,255,255,.38) 52%, rgba(255,255,255,.52) 100%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  box-shadow:
    inset 0 1.5px 0 #fff,
    inset 0 -1.5px 0 rgba(255,255,255,.75),
    inset 0 -16px 24px -16px rgba(236,159,146,.62),
    0 1px 2px rgba(var(--sh),.14),
    0 16px 32px -14px rgba(236,159,146,.66),
    0 36px 60px -36px rgba(var(--sh),.5);
  transition: transform .6s var(--spring), box-shadow .6s var(--ease);
}
.gbtn .gl { /* the specular lip */
  position: absolute; left: 16px; right: 16px; top: 3px; height: 44%; border-radius: 999px; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0));
  opacity: .85;
}
.gbtn::after { /* the glint */
  content: ""; position: absolute; top: -30%; bottom: -30%; width: 34%; left: -60%; z-index: 1;
  background: linear-gradient(105deg, transparent 0%, rgba(255,255,255,.9) 50%, transparent 100%);
  transform: skewX(-18deg); pointer-events: none;
}
.gbtn-t, .knob { position: relative; z-index: 3; }
.gbtn-t { margin-right: -.16em; }
.knob {
  width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(circle at 34% 28%, #fff 0 16%, #FFF6EC 46%, #F7D6C6 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -4px 8px rgba(236,159,146,.34), 0 6px 14px -4px rgba(var(--sh),.5);
}
.knob svg { width: 19px; height: 19px; color: var(--accent); }
@media (hover: hover) {
  .gbtn:hover { transform: translateY(-2px); box-shadow: inset 0 1.5px 0 #fff, inset 0 -1.5px 0 rgba(255,255,255,.75), inset 0 -16px 24px -16px rgba(236,159,146,.72), 0 1px 2px rgba(var(--sh),.14), 0 22px 40px -14px rgba(236,159,146,.76), 0 40px 70px -36px rgba(var(--sh),.55); }
  .gbtn:hover::after { animation: glint 1.2s var(--ease); }
}
.gbtn.press { transform: scale(.955, .92); transition: transform .14s var(--ease); }
.gbtn.pop { animation: jelly .75s var(--ease); }
.gbtn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--rose), 0 16px 32px -14px rgba(236,159,146,.66); }
@keyframes glint { from { left: -60%; } to { left: 135%; } }
@keyframes jelly { 0% { transform: scale(.955, .92); } 32% { transform: scale(1.045, 1.035); } 56% { transform: scale(.985, 1.005); } 78% { transform: scale(1.008, .998); } 100% { transform: none; } }
.ripple {
  position: absolute; z-index: 2; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.95), rgba(255,244,234,.4) 45%, rgba(255,255,255,0) 70%);
  animation: ripple .9s var(--out) forwards;
}
@keyframes ripple { from { transform: scale(0); opacity: 1; } to { transform: scale(18); opacity: 0; } }
.gbtn.ghost {
  --tint: rgba(223,243,232,0);
  background: linear-gradient(180deg, rgba(255,255,255,.62) 0%, rgba(255,255,255,.2) 55%, rgba(255,255,255,.34) 100%);
  box-shadow: inset 0 1.5px 0 #fff, inset 0 -1.5px 0 rgba(255,255,255,.7), inset 0 -14px 22px -16px rgba(236,159,146,.42), 0 1px 2px rgba(var(--sh),.1), 0 14px 28px -16px rgba(var(--sh),.4);
}

/* ───────── the pen: hand-drawn marks, drawn on when they arrive ───────── */
.mk-w { position: relative; display: inline-block; white-space: nowrap; }
.mk { position: absolute; overflow: visible; pointer-events: none; z-index: 3; }
.mk path { fill: none; stroke: var(--mark); stroke-linecap: round; stroke-linejoin: round; }
.mk.under { left: -3%; bottom: -.02em; width: 106%; height: .13em; clip-path: inset(-60% 100% -60% -2%); transition: clip-path .9s var(--pen-ease) var(--d, 0s); }
.mk.under path { stroke-width: 2.3px; vector-effect: non-scaling-stroke; }
.go .mk.under { clip-path: inset(-60% -2% -60% -2%); }
.mk.bow, .mk.xo { transform-origin: 50% 50%; }
.mk.bow path, .mk.xo path, .mk.sig-x path { transition: stroke-dashoffset var(--dur, .8s) var(--pen-ease) var(--pd, 0s); }
.mk.bow { position: relative; width: 42px; height: 32px; }
.mk.xo { position: relative; width: 92px; height: 48px; margin-top: 26px; rotate: -7deg; }
.go .mk.bow { animation: mk-sway 4.2s ease-in-out 1.8s infinite alternate; }
.go .mk.xo { animation: mk-kiss 2.6s ease-in-out 2.2s infinite; }
@keyframes mk-sway { from { transform: rotate(-6deg) translateY(1px); } to { transform: rotate(6deg) translateY(-2px); } }
@keyframes mk-kiss { 0%, 70%, 100% { transform: scale(1); } 78% { transform: scale(1.14); } 86% { transform: scale(.98); } 92% { transform: scale(1.06); } }

/* "Peache" in running script drops into the print italic */
.pn { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: .82em; letter-spacing: -.01em; }

/* ───────── the bar: back · butterfly · count, with story bars underneath ───────── */
.bar {
  position: relative; z-index: 5;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  width: min(calc(100vw - 2 * var(--gutter)), 460px); margin: 0 auto;
  padding-top: max(14px, env(safe-area-inset-top));
}
.bar-back {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--ink);
  -webkit-tap-highlight-color: transparent; transition: transform .5s var(--spring);
}
.bar-back svg { width: 18px; height: 18px; }
.bar-back:active { transform: scale(.9); }
.bar-logo { justify-self: center; display: block; width: 64px; padding: 4px 0; -webkit-tap-highlight-color: transparent; transition: transform .5s var(--spring); }
.bar-logo:active { transform: scale(.92); }
.bar-logo img { width: 100%; height: auto; }
.bar-n { justify-self: end; font: 400 10.5px/1 var(--ui); letter-spacing: .14em; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.prog { grid-column: 1 / -1; display: flex; gap: 4px; margin-top: 10px; opacity: 0; transition: opacity .6s var(--ease); }
.prog i { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(184,51,106,.12); overflow: hidden; }
.prog b { display: block; height: 100%; background: linear-gradient(90deg, var(--rose), var(--accent)); transform-origin: 0 50%; transform: scaleX(0); transition: transform .7s var(--ease); }
.prog i.on b { transform: scaleX(1); }
.ap.going .prog { opacity: 1; }

/* ───────── the deck ───────── */
.stage { position: relative; z-index: 2; padding: 26px 0 0; }
.deck {
  --cw: min(calc(100vw - 2 * var(--gutter)), 430px);
  --arch: calc(var(--cw) / 2) calc(var(--cw) / 2) 26px 26px / calc(var(--cw) * .36) calc(var(--cw) * .36) 26px 26px;
  position: relative; margin: 0 auto; width: var(--cw);
  height: var(--h, calc(var(--cw) * 1.36));
  transition: height .6s var(--ease), opacity .5s var(--ease), transform .6s var(--ease);
}
/* the cards still to come, waiting behind */
.deck::before, .deck::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: calc(var(--h, calc(var(--cw) * 1.36)) - 26px);
  border-radius: var(--arch);
  background: linear-gradient(172deg, #FFF9F0, #FCEBDD 70%, #F9DCCB);
  box-shadow: inset 0 2px 0 #fff, 0 30px 50px -34px rgba(var(--sh),.55);
  transition: opacity .6s var(--ease), height .6s var(--ease);
}
.deck::before { transform: translateY(13px) scale(.95); opacity: .9; z-index: 0; }
.deck::after { transform: translateY(26px) scale(.9); opacity: .7; z-index: -1; }
.deck[data-left="1"]::after, .deck[data-left="0"]::after, .deck[data-left="0"]::before { opacity: 0; }

.card {
  position: absolute; left: 0; top: 0; width: var(--cw); z-index: 1;
  transform: translate3d(0, 13px, 0) scale(.95); opacity: 0; visibility: hidden;
  transition: transform .8s var(--ease), opacity .45s var(--ease), visibility 0s linear .8s;
  will-change: transform;
}
.card.on { transform: none; opacity: 1; visibility: visible; z-index: 3; transition: transform .8s var(--ease), opacity .45s var(--ease), visibility 0s; }
.card.past { transform: translate3d(-118vw, 40px, 0) rotate(-16deg); opacity: 0; z-index: 4; transition: transform .85s var(--ease), opacity .6s var(--ease) .15s, visibility 0s linear .85s; }
.card.on.from-left { transition: transform .8s var(--ease), opacity .3s var(--ease), visibility 0s; }

.card-in {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  min-height: calc(var(--cw) * 1.3);
  padding: calc(var(--cw) * .15) calc(var(--cw) * .075) 26px;
  border-radius: var(--arch);
  background:
    radial-gradient(110% 55% at 50% 0%, #fff, rgba(255,255,255,0) 62%),
    linear-gradient(172deg, #FFFCF7, #FEF4E8 45%, #FCE5D7);
  box-shadow:
    inset 0 2px 0 #fff,
    inset 0 -22px 44px -24px rgba(236,159,146,.5),
    0 1px 2px rgba(var(--sh),.12),
    0 44px 70px -38px rgba(var(--sh),.6),
    0 12px 24px -16px rgba(var(--sh),.3);
}
.card-in::before { /* the rose-gold frame, like a perfume label */
  content: ""; position: absolute; inset: 10px; pointer-events: none;
  border-radius: calc(var(--cw) / 2 - 10px) calc(var(--cw) / 2 - 10px) 18px 18px / calc(var(--cw) * .36 - 10px) calc(var(--cw) * .36 - 10px) 18px 18px;
  border: 1px solid rgba(236,159,146,.58);
}
.card-in::after { /* glass rim with the cool edge */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(150deg, #fff 0%, rgba(255,255,255,.2) 35%, rgba(255,255,255,0) 55%, rgba(203,235,220,.6) 82%, rgba(223,243,232,1) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.card-in > * { position: relative; z-index: 1; }
/* the words arrive a beat after the card */
.card-in > * { opacity: 0; transform: translateY(10px); transition: opacity .6s var(--ease), transform .7s var(--ease); }
.card.on .card-in > * { opacity: 1; transform: none; }
.card.on .card-in > :nth-child(1) { transition-delay: .18s; }
.card.on .card-in > :nth-child(2) { transition-delay: .26s; }
.card.on .card-in > :nth-child(3) { transition-delay: .34s; }
.card.on .card-in > :nth-child(4) { transition-delay: .42s; }
.card.on .card-in > :nth-child(5) { transition-delay: .5s; }
.card.on .card-in > :nth-child(n+6) { transition-delay: .56s; }

.card-n { font: 400 10px/1 var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); margin-right: -.2em; }
.ask {
  margin: 18px 0 0; font-family: var(--script); font-weight: 400;
  font-size: clamp(44px, 12.6vw, 62px); line-height: 1.04; color: var(--ink);
  text-wrap: balance;
}
.ask em { font-style: normal; color: var(--accent); }
.cover .ask { font-size: clamp(50px, 14.6vw, 76px); line-height: 1.04; margin-top: 22px; }
.lede {
  margin: 22px 0 0; max-width: 22ch;
  font-family: var(--serif); font-size: clamp(20px, 5.4vw, 23px); line-height: 1.38; color: var(--ink-2);
  text-wrap: balance;
}
.lede i { color: var(--ink); }
.hint {
  margin: 14px 0 0; max-width: 28ch; min-height: 1.4em;
  font-family: var(--serif); font-style: italic; font-size: 17.5px; line-height: 1.4; color: var(--ink-2);
  transition: color .3s var(--ease);
  text-wrap: balance;
}
.hint.err { color: var(--accent); }
.card-in > .gbtn { margin-top: auto; min-width: 200px; justify-content: space-between; }
.card-in > .hint + .gbtn, .card-in > .lede + .gbtn { margin-top: 26px; }
.cover .card-in > .gbtn { margin-top: auto; }
.card-in > .hint { margin-bottom: 24px; }
.gbtn.next:not(.ready) .knob svg { opacity: .55; }
.gbtn.next.ready .knob { box-shadow: inset 0 1px 0 #fff, inset 0 -4px 8px rgba(236,159,146,.34), 0 6px 14px -4px rgba(var(--sh),.5), 0 0 0 3px rgba(184,51,106,.12); }
.shake { animation: shake .5s var(--ease); }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }

/* ───────── the lines you write on ───────── */
.line { position: relative; display: block; width: 100%; max-width: 300px; margin: 30px auto 0; }
.line + .line { margin-top: 22px; }
.line-k { display: block; margin-bottom: 4px; font: 400 9.5px/1 var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2); }
.line-k i { font-style: normal; opacity: .7; letter-spacing: .12em; }
.in {
  display: block; width: 100%; height: 50px; padding: 0 4px; margin: 0;
  border: 0; border-radius: 0; background: transparent; outline: 0; -webkit-appearance: none; appearance: none;
  font: 400 26px/1.2 var(--serif); color: var(--ink); text-align: center;
  caret-color: var(--accent);
  box-shadow: inset 0 -1px 0 rgba(236,159,146,.62);
  transition: box-shadow .4s var(--ease);
}
.in::placeholder { color: var(--ink-2); opacity: .4; font-style: italic; }
.in:focus { box-shadow: inset 0 -1px 0 rgba(184,51,106,.5); }
.line .mk.under { left: -2%; width: 104%; bottom: -5px; height: 9px; transition-duration: .7s; }
.line .mk.under path { stroke-width: 2.1px; }
.line.ok .mk.under { clip-path: inset(-60% -2% -60% -2%); }
.line.ok .in { box-shadow: inset 0 -1px 0 rgba(236,159,146,0); }

.words { width: 100%; margin-top: 8px; }
.words .line { display: grid; grid-template-columns: 30px 1fr 30px; align-items: end; margin-top: 14px; }
.words .line .in { grid-column: 2; height: 46px; }
.words .line .mk.under { left: 30px; width: calc(100% - 60px); }
.wn { grid-column: 1; grid-row: 1; padding-bottom: 13px; text-align: left; font: italic 400 17px/1 var(--serif); color: var(--accent); opacity: .8; }

/* ───────── choices ───────── */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 28px; max-width: 330px; }
.chip {
  position: relative; border: 0; cursor: pointer; padding: 12px 17px 13px; border-radius: 999px;
  font: 400 18px/1.05 var(--serif); color: var(--ink);
  background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,255,255,.46));
  box-shadow: inset 0 0 0 1px rgba(236,159,146,.46), inset 0 1px 0 #fff, 0 6px 14px -10px rgba(var(--sh),.45);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .45s var(--spring), background .4s var(--ease), box-shadow .4s var(--ease), color .3s var(--ease);
}
.chip:active { transform: scale(.94); }
.chip[aria-pressed="true"] {
  color: var(--ink);
  background: linear-gradient(90deg, rgba(223,243,232,.95) 0%, rgba(249,205,184,.98) 45%, rgba(236,159,146,.95) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 0 0 1px rgba(255,255,255,.55), 0 10px 20px -10px rgba(236,159,146,.8);
}
.chip:focus-visible { outline: 0; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--rose); }

/* ───────── the laws, signed ───────── */
.laws-list { list-style: none; margin: 18px 0 0; padding: 0; }
.laws-list li { font: 400 clamp(28px, 7.8vw, 34px)/1.08 var(--script); color: var(--ink); }
.laws-list li + li { margin-top: 12px; }
.laws-list li span:first-child { display: block; margin-bottom: 3px; font: 400 9px/1 var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); }
.laws-list .pn { font-size: .86em; }
.tick {
  display: flex; align-items: center; gap: 13px; width: 100%; max-width: 300px; margin-top: 24px; padding: 12px 14px 12px 12px;
  border: 0; border-radius: 18px; cursor: pointer; text-align: left;
  background: rgba(255,255,255,.5); box-shadow: inset 0 0 0 1px rgba(236,159,146,.4);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: background .4s var(--ease), transform .4s var(--spring);
}
.tick:active { transform: scale(.98); }
.tick[aria-checked="true"] { background: rgba(255,255,255,.78); }
.box { /* a real checkbox: empty square, then raspberry with a tick */
  position: relative; flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: #fff; box-shadow: inset 0 0 0 1.6px var(--accent), 0 3px 8px -4px rgba(var(--sh),.45);
  transition: background .3s var(--ease), box-shadow .3s var(--ease), transform .45s var(--spring);
}
.box svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset .35s var(--ease) .05s; }
.tick[aria-checked="true"] .box { background: var(--accent); box-shadow: inset 0 0 0 1.6px var(--accent), 0 6px 14px -6px rgba(184,51,106,.6); transform: scale(1.06); }
.tick[aria-checked="true"] .box svg { stroke-dashoffset: 0; }
.tick:not([aria-checked="true"]) .box { animation: nudge-box 2.4s var(--ease) 1.2s 2; }
@keyframes nudge-box { 0%, 100% { transform: none; } 50% { transform: scale(1.12); box-shadow: inset 0 0 0 1.6px var(--accent), 0 0 0 5px rgba(184,51,106,.14); } }
.tick-t { font: 400 17px/1.3 var(--serif); color: var(--ink); }
.sign { position: relative; width: 100%; max-width: 300px; height: 118px; margin-top: 16px; }
.sig-pad { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; touch-action: none; cursor: crosshair; border-radius: 14px; }
.sig-ph { position: absolute; left: 0; right: 0; bottom: 38px; text-align: center; font: italic 400 17px/1 var(--serif); color: var(--ink-2); opacity: .5; transition: opacity .3s var(--ease); pointer-events: none; }
.sign.signed .sig-ph { opacity: 0; }
.sig-line { position: absolute; left: 0; right: 0; bottom: 22px; height: 1px; background: linear-gradient(90deg, rgba(236,159,146,.8), rgba(236,159,146,.3)); pointer-events: none; }
.mk.sig-x { position: absolute; left: 2px; bottom: 6px; width: 20px; height: 20px; }
.sig-clear {
  position: absolute; right: 0; bottom: -4px; z-index: 3; border: 0; background: none; cursor: pointer; padding: 4px 2px;
  font: 400 9.5px/1 var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2);
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease);
}
.sign.signed .sig-clear { opacity: .85; pointer-events: auto; }
.sign-card .hint { margin-top: 8px; }
.gbtn.busy { pointer-events: none; }
.gbtn.busy .knob svg { animation: twirl 1s linear infinite; }
@keyframes twirl { to { transform: rotate(360deg); } }

.fine-print {
  margin: 34px auto 0; padding-bottom: max(30px, env(safe-area-inset-bottom));
  text-align: center; white-space: nowrap;
  font: 400 9.5px/1.8 var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); opacity: .85;
  transition: opacity .5s var(--ease);
}

/* ───────── sealed: into the envelope, tied with the bow ───────── */
.deck.gone { opacity: 0; transform: translateY(30px) scale(.94); pointer-events: none; }
.sealed { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 16px var(--gutter) max(50px, env(safe-area-inset-bottom)); }
.sealed[hidden] { display: none; }
.label {
  display: inline-flex; align-items: center; gap: 14px;
  font: 400 10.5px/1 var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2);
}
.label b { font-weight: 400; margin-right: -.16em; }
.label::before, .label::after { content: ""; width: 26px; height: 1px; background: linear-gradient(90deg, rgba(184,51,106,0), rgba(184,51,106,.6)); }
.label::after { transform: scaleX(-1); }
.sealed .label { opacity: 0; transition: opacity .8s var(--ease) .2s; }
.sealed.play .label { opacity: 1; }
.env {
  --ew: min(76vw, 320px);
  position: relative; width: var(--ew); height: calc(var(--ew) * .646); margin: calc(var(--ew) * .48) auto 0;
  opacity: 0; transform: translateY(40px) scale(.9); transition: opacity .7s var(--ease), transform .9s var(--spring), margin .9s var(--ease);
}
.sealed.close .env { margin-top: calc(var(--ew) * .2); } /* once the flap is down, the page closes the gap */
.sealed.play .env { opacity: 1; transform: none; }
.env.jelly { animation: jelly .8s var(--ease); }
.env-back {
  position: absolute; inset: 0; border-radius: 6px; z-index: 1;
  background: linear-gradient(180deg, #F6CDBC, #FADCCD 60%, #FCE6D9);
  box-shadow: 0 40px 60px -34px rgba(var(--sh),.7), 0 2px 4px rgba(var(--sh),.18), inset 0 0 0 1px rgba(236,159,146,.4);
}
/* shadows painted, not filtered: the flap animates */
.env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 64%; z-index: 2;
  transform-origin: 50% 0; transform: scaleY(-1);
}
.env-flap::after { content: ""; position: absolute; left: 10%; right: 10%; top: 0; height: 70%; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 80% at 50% 0%, rgba(var(--sh),.16), rgba(var(--sh),0) 70%); transform: translateY(4px); }
.env-flap svg, .env-front svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sealed.close .env-flap { animation: flap .75s var(--ease) forwards; }
@keyframes flap { 0% { transform: scaleY(-1); z-index: 2; } 49% { z-index: 2; } 50% { transform: scaleY(-.02); z-index: 5; } 100% { transform: scaleY(1); z-index: 5; } }
.letter {
  position: absolute; left: 8%; right: 8%; top: 7%; height: 88%; z-index: 3;
  border-radius: 50% 50% 8px 8px / 30% 30% 8px 8px;
  background: radial-gradient(110% 55% at 50% 0%, #fff, rgba(255,255,255,0) 62%), linear-gradient(172deg, #FFFCF7, #FEF4E8 50%, #FCE8DB);
  box-shadow: inset 0 0 0 1px rgba(236,159,146,.5), 0 6px 14px -8px rgba(var(--sh),.5);
  display: flex; flex-direction: column; align-items: center; padding-top: 16%;
  transform: translateY(-74%); transition: transform 1s var(--ease);
}
.sealed.tuck .letter { transform: translateY(0); }
.letter-n { font: 400 7.5px/1 var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.letter-sig { width: 78%; height: auto; margin-top: 4px; }
.env-front { position: absolute; inset: 0; z-index: 4; }
.env-from { position: absolute; left: 0; right: 0; bottom: 7%; font: 400 9.5px/1 var(--ui); letter-spacing: .16em; color: var(--ink-2); }
.mk.bow.seal { position: absolute; left: 50%; top: 63%; width: 30%; height: auto; aspect-ratio: 100 / 76; margin: calc(var(--ew) * -.114) 0 0 calc(var(--ew) * -.15); z-index: 6; }
.env .env-perch { left: 94%; top: -2%; width: 64px; z-index: 7; transform: translate(-50%, -62%) rotate(18deg); opacity: 0; transition: opacity .9s var(--ease); }
.env .env-perch .bf { --bw: 64px; }
.sealed.go .env-perch { opacity: 1; }
.display {
  margin: 46px 0 0; font-family: var(--script); font-weight: 400; color: var(--ink);
  font-size: clamp(72px, 20vw, 120px); line-height: 1.04; text-wrap: balance;
  padding: 0 .12em; /* room for the swashes */
}
.display em { font-style: normal; color: var(--accent); }
.sealed .display { opacity: 0; transform: translateY(16px); transition: opacity 1s var(--ease), transform 1.1s var(--ease); }
.sub { margin: 0; max-width: 28ch; font: 400 clamp(20px, 5.4vw, 24px)/1.4 var(--serif); color: var(--ink-2); text-wrap: pretty; }
.sealed .sub { margin-top: 20px; opacity: 0; transform: translateY(12px); transition: opacity 1s var(--ease) .25s, transform 1.1s var(--ease) .25s; }
.sealed-ctas { display: flex; flex-direction: column; align-items: stretch; gap: 14px; margin-top: 36px; width: 100%; max-width: 340px; opacity: 0; transform: translateY(12px); transition: opacity 1s var(--ease) .5s, transform 1.1s var(--ease) .5s; }
.sealed-ctas .gbtn { justify-content: space-between; }
.sealed.words .display, .sealed.words .sub, .sealed.words .sealed-ctas { opacity: 1; transform: none; }
.sealed .mk.xo { margin-top: 34px; }

/* ───────── toast ───────── */
.toast {
  position: fixed; left: 50%; top: max(18px, env(safe-area-inset-top)); z-index: 80;
  max-width: calc(100vw - 32px);
  transform: translate(-50%, -170%); transition: transform .7s var(--spring);
  border-radius: 999px; padding: 15px 20px 15px 16px; display: flex; align-items: center; gap: 9px;
  font: 500 10.5px/1.3 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); white-space: nowrap;
}
.toast.show { transform: translate(-50%, 0); }
.toast svg { width: 14px; height: 14px; flex: none; color: var(--rose); }

/* ───────── wider screens ───────── */
@media (min-width: 900px) {
  .stage { padding-top: 34px; }
  .bar-logo { width: 72px; }
  .sealed-ctas { flex-direction: row; max-width: none; width: auto; }
}

/* the keyboard is up: room below so the card can slide above it */
.ap.typing .stage { padding-bottom: 75vh; }
.ap.typing .fine-print { opacity: 0; }

/* ───────── review (?still) + reduced motion ───────── */
.still *, .still *::before, .still *::after { animation: none !important; transition: none !important; }
.still .mk.under { clip-path: none; }
.still .sealed.close .env-flap { transform: scaleY(1); z-index: 5; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
  .sky .glow { animation: none; }
  .mk.under { clip-path: none !important; }
  .card, .card.on, .card.past { transition-duration: .2s !important; }
}
