:root {
  --bg: #fbf1e4;
  --ink: #3a2e4d;
  --muted: #7d7290;
  --pink: #ff8fb4;
  --pink-soft: #ffd9e6;
  --card: #fffaf3;
  --edge: #3a2e4d;
  --note-w: min(340px, 82vw);
  --hole: #f1e4d2;
  /* paper fiber grain */
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .34 0 0 0 0 .24 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Fredoka', ui-rounded, system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(rgba(58, 46, 77, .09) 1.3px, transparent 1.4px);
  background-size: 22px 22px;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.muted { color: var(--muted); margin: 0; }

/* ---------- chrome ---------- */
.topbar { display: flex; justify-content: center; padding: 20px 16px 0; }
.logo { border: 0; background: none; font-size: 20px; font-weight: 600; padding: 6px 14px; border-radius: 999px; }
.logo:hover { background: rgba(255, 143, 180, .2); }
.logo { display: inline-flex; align-items: center; gap: 8px; }
.logo-icon { width: 30px; height: 30px; border-radius: 8px; }
main { max-width: 1080px; margin: 0 auto; padding: 12px 20px 80px; }
.view { display: none; }
.view.active { display: block; animation: viewIn .4s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

.view-head { display: flex; align-items: center; gap: 14px; margin: 10px 0 18px; }
.view-head h2 { margin: 0; font-size: 26px; font-weight: 600; }
.back-link { color: var(--muted); text-decoration: none; font-weight: 500; padding: 4px 10px; border-radius: 999px; }
.back-link:hover { background: rgba(58, 46, 77, .07); color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 999px; border: 2.5px solid var(--edge);
  background: #fff; color: var(--ink); font-weight: 500; text-decoration: none;
  box-shadow: 0 3px 0 var(--edge); transition: transform .1s, box-shadow .1s, background .15s;
}
.btn:hover { background: #fff6fa; }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--edge); }
.btn.primary { background: var(--pink); }
.btn.primary:hover { background: #ff9fbf; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: rgba(58, 46, 77, .06); }
.btn.big { width: 100%; font-size: 19px; padding: 13px; font-weight: 600; }
.btn.small { padding: 7px 14px; font-size: 14.5px; border-width: 2px; box-shadow: 0 2px 0 var(--edge); }

#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-weight: 500; transition: .25s;
  width: max-content; max-width: calc(100vw - 32px); text-align: center; line-height: 1.4;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- home ---------- */
/* striped shop awning, home page only */
.awning-wrap { display: none; }
body.on-home .awning-wrap { display: block; filter: drop-shadow(0 3px 0 var(--edge)); }
body.on-home .topbar { padding-top: 10px; }
.awning {
  height: 40px; background: repeating-linear-gradient(90deg, #ee7b86 0 34px, #fff6ea 34px 68px);
  -webkit-mask: linear-gradient(#000 0 0) top/100% 24px no-repeat, radial-gradient(circle 17px at 17px 0, #000 97%, transparent) 0 23px/34px 17px repeat-x;
          mask: linear-gradient(#000 0 0) top/100% 24px no-repeat, radial-gradient(circle 17px at 17px 0, #000 97%, transparent) 0 23px/34px 17px repeat-x;
}

.hero { position: relative; text-align: center; margin: 28px auto 30px; max-width: 560px; }
.hero h1 { font-size: clamp(32px, 6vw, 48px); margin: 0 0 10px; font-weight: 600; letter-spacing: -.5px; }
.home-postmark { position: absolute; left: -84px; top: -10px; width: 96px; height: 96px; transform: rotate(-12deg); }
.steps { list-style: none; padding: 0; margin: 16px 0 0; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; font-weight: 600; font-size: 16px; white-space: nowrap;
  background: var(--card); border: 2px solid var(--edge); border-radius: 999px; box-shadow: 0 2px 0 var(--edge);
}
.step b { width: 26px; height: 26px; border-radius: 50%; background: var(--pink); border: 2px solid var(--edge); display: grid; place-items: center; font-size: 14px; }
.step.s2 b { background: #9fcbf5; }
.step.s3 b { background: #ffd166; }
.step-arrow { font-weight: 700; color: var(--muted); }

/* the two main choices are perforated stamps */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; max-width: 760px; margin: 0 auto; }
.choice {
  display: block; text-decoration: none; color: inherit;
  border: 11px solid transparent; padding: 14px 16px 20px;
  background: linear-gradient(var(--card), var(--card)) padding-box, radial-gradient(circle at 8px 8px, transparent 4.6px, var(--card) 5.2px) -8px -8px/16px 16px border-box;
  box-shadow: inset 0 0 0 2.5px var(--edge);
  filter: drop-shadow(1.5px 0 0 var(--edge)) drop-shadow(-1.5px 0 0 var(--edge)) drop-shadow(0 1.5px 0 var(--edge)) drop-shadow(0 -1.5px 0 var(--edge)) drop-shadow(4px 5px 0 var(--edge));
  transition: transform .15s;
}
.choice:hover { transform: translate(-2px, -3px) rotate(-.7deg); }
.choice:nth-child(2):hover { transform: translate(-2px, -3px) rotate(.7deg); }
.choice h2 { margin: 14px 4px 4px; font-size: 24px; font-weight: 600; }
.choice p { margin: 0 4px; color: var(--muted); line-height: 1.45; }
.choice-art { position: relative; height: 170px; border: 2px solid var(--edge); border-radius: 4px; overflow: hidden; }
.note-art { background: #ffe6ef; }
.card-art { background: #def0ff; }

/* the little spread inside them: origami folds around a note, a fan of postcards */
.sp-fold { position: absolute; width: 74px; height: 74px; transform: rotate(var(--r)); filter: drop-shadow(2px 3px 0 rgba(58, 46, 77, .18)); transition: transform .3s; }
.choice:hover .sp-fold { transform: translateY(-4px) rotate(var(--r)); }
.fold-ico svg, svg.fold-ico { width: 100%; height: 100%; display: block; overflow: visible; }
/* outline only the silhouette: a thick ink copy behind, the shaded paper on top with thin fold lines */
.fold-ico .sil polygon { fill: var(--edge); stroke: var(--edge); stroke-width: 9; stroke-linejoin: round; }
.fold-ico .sil .o-puff-edge, .fold-ico .sil .o-puff { stroke-width: 30; }
.fold-ico .sil .o-line, .fold-ico .sil circle, .fold-ico .sil .o-facet { display: none; }
.fold-ico .paper polygon { stroke: color-mix(in srgb, var(--paper) 50%, #3a2e4d); stroke-width: 1.4; stroke-linejoin: round; }
.fold-ico .paper .o-line { stroke: color-mix(in srgb, var(--paper) 45%, #3a2e4d); stroke-width: 1.6; }
.fold-ico .paper circle { stroke: var(--edge); stroke-width: 2; }
.fold-ico .paper .o-puff-edge { fill: none; stroke: none; }
.fold-ico .paper .o-puff { fill: var(--paper); stroke: var(--paper); stroke-width: 19; }
.sp-letter {
  position: absolute; left: 50%; top: 50%; z-index: 2; width: 118px; height: 54px; transform: translate(-50%, -42%) rotate(-5deg);
  background: var(--noise), #fff4c2; border: 2px solid var(--edge); border-radius: 4px; box-shadow: 3px 4px 0 rgba(58, 46, 77, .18);
  display: grid; place-items: center; font-family: 'Caveat', cursive; font-size: 23px; color: #6b3fb3; transition: transform .3s;
}
.choice:hover .sp-letter { transform: translate(-50%, -42%) rotate(-1deg) scale(1.05); }
.sp-pc {
  position: absolute; left: 50%; top: 50%; width: 146px; height: 98px; background: #fff;
  border: 2px solid var(--edge); border-radius: 5px; box-shadow: 3px 4px 0 rgba(58, 46, 77, .18); transition: transform .3s;
}
.sp-pc > svg { width: 100%; height: 100%; display: block; clip-path: inset(0 round 3px); }
.choice:hover .sp-pc.top { transform: translate(-30%, -46%) rotate(9deg) scale(1.04); }
.sp-stamp { position: absolute; right: 6px; top: 6px; width: 28px; z-index: 2; transform: rotate(6deg); filter: drop-shadow(1px 1.5px 0 rgba(58, 46, 77, .35)); }
.sp-stamp svg { display: block; width: 100%; }

/* keepsake mailbox, framed in airmail stripes */
.box {
  position: relative; isolation: isolate; max-width: 760px; margin: 40px auto 0; padding: 22px 28px 26px;
  border: 2.5px solid var(--edge); border-radius: 22px; box-shadow: 5px 6px 0 var(--edge);
  background: repeating-linear-gradient(135deg, #e0606f 0 12px, #fffaf3 12px 20px, #2f5d8a 20px 32px, #fffaf3 32px 40px);
}
.box::before { content: ''; position: absolute; inset: 9px; z-index: -1; background: var(--card); border: 2px solid var(--edge); border-radius: 14px; }
.box h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; font-size: 20px; font-weight: 600; }
.mb-icon { width: 54px; height: 49px; flex: none; }
.box li a { padding-left: 7px; }
.box li button.pin svg, .box-sub svg, .btn .ico { width: 16px; height: 16px; display: block; }
.box-sub svg { display: inline-block; width: 13px; height: 13px; vertical-align: -1px; margin-right: 4px; }
.box li button.pin { filter: none; opacity: .35; }
.box li button.pin:hover, .box li button.pin.on { opacity: 1; }
.thumb-pc { width: 36px; height: 25px; flex: none; border: 1.8px solid var(--edge); border-radius: 3px; overflow: hidden; background: #fff; }
.thumb-pc svg, .thumb-pc img { width: 100%; height: 100%; display: block; object-fit: cover; }
svg.fold-ico.thumb-note { width: 28px; height: 28px; flex: none; display: block; }
.thumb-sheet { width: 22px; height: 28px; flex: none; display: block; }
@media (max-width: 700px) {
  .home-postmark { position: static; display: block; width: 76px; height: 76px; margin: 0 auto 4px; }
  .step-arrow { display: none; }
  .steps { gap: 8px; align-items: stretch; flex-wrap: nowrap; }
  .step { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; text-align: center; white-space: normal; font-size: 13px; line-height: 1.2; gap: 4px; padding: 7px 4px; border-radius: 16px; }
  .step b { width: 22px; height: 22px; font-size: 12px; }
}
.box ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.box ul:empty { display: none; }
.box li { display: flex; align-items: center; background: #fff; border: 2px solid var(--edge); border-radius: 14px; box-shadow: 2px 3px 0 var(--edge); transition: transform .12s; }
.box li:hover { transform: translateY(-2px) rotate(-1deg); }
.box li a { padding: 8px 2px 8px 12px; text-decoration: none; color: inherit; display: flex; gap: 8px; align-items: center; }
.box li small { color: var(--muted); }
.box li button { border: 0; background: none; padding: 8px 10px; color: var(--muted); font-size: 16px; }
.box li button:hover { color: #d43f7a; }
.box li button.pin { padding: 8px 4px 8px 6px; font-size: 14px; filter: grayscale(1); opacity: .45; }
.box li button.pin:hover, .box li button.pin.on { filter: none; opacity: 1; }
.box-sub { margin: 14px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.box-older { margin-top: 16px; }
.box-older summary { cursor: pointer; font-weight: 600; color: var(--muted); font-size: 14.5px; }
.box-older summary:hover { color: var(--ink); }
.box-month { margin: 12px 0 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.no-photo { color: #c2306a; }
.box-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ---------- composer layout ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 34px; align-items: start; }
@media (max-width: 860px) { .composer { grid-template-columns: 1fr; } }
.stage { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 6px; }
.note-composer .paper-box { width: min(400px, 100%); filter: drop-shadow(0 6px 14px rgba(58, 46, 77, .16)) drop-shadow(0 2px 0 rgba(58, 46, 77, .06)); }
.stage-card { width: min(620px, 100%); }
.hint { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }

.controls {
  background: var(--card); border: 2.5px solid var(--edge); border-radius: 24px;
  padding: 18px; box-shadow: 5px 6px 0 var(--edge);
  display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px;
}
@media (max-width: 860px) { .controls { position: static; } }
.tabs { display: flex; gap: 4px; background: #f3e8da; border-radius: 14px; padding: 4px; }
.tabs button {
  flex: 1; border: 0; background: transparent; border-radius: 10px;
  padding: 7px 2px; font-weight: 500; font-size: 13.5px; color: var(--muted); white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 2px 0 rgba(58, 46, 77, .15); }
.tab-panel { display: flex; flex-direction: column; gap: 16px; min-height: 150px; animation: viewIn .25s ease both; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: block; }
.field span, .ctl-label { display: block; font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .9px; color: var(--muted); margin-bottom: 7px; }
.field input { width: 100%; border: 2px solid var(--edge); border-radius: 12px; padding: 9px 12px; background: #fff; outline: none; }
.field input:focus { box-shadow: 0 0 0 3px var(--pink-soft); }

.swatches, .pills, .tray, .kaomoji { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; padding: 0; border: 2px solid var(--edge); background: var(--c); transition: transform .12s; }
.swatches button:hover { transform: scale(1.1); }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--card), 0 0 0 5.5px var(--pink); transform: scale(1.08); }
.pills button { border: 2px solid var(--edge); background: #fff; border-radius: 999px; padding: 3px 13px; font-size: 19px; line-height: 1.4; }
.pills button[aria-pressed="true"] { background: var(--pink-soft); box-shadow: 0 2px 0 var(--edge); }
.pills .toggle { font-size: 15px; padding: 6px 14px; }
.text-pills button { font-size: 14.5px; padding: 5px 12px; }
.phrases { margin-top: -6px; }
.lettering-box { display: flex; flex-direction: column; gap: 16px; }
.no-greet .pc-greet { display: none; }
.look-pills button { font-size: 16px; }
.text-move-row { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.text-move-row .hint { text-align: left; font-size: 13.5px; }
#c-text-reset:disabled { opacity: .45; cursor: default; }
.tray button { width: 38px; height: 38px; border-radius: 12px; border: 2px solid transparent; background: #fff; font-size: 21px; padding: 0; display: grid; place-items: center; transition: transform .12s; }
.tray button:hover { transform: scale(1.15) rotate(-6deg); }
.tray button[aria-pressed="true"] { border-color: var(--edge); background: var(--pink-soft); }
.tray button.wide { width: 58px; }
.kaomoji button { border: 2px solid rgba(58, 46, 77, .25); background: #fff; border-radius: 10px; padding: 3px 8px; font-size: 14px; white-space: nowrap; }
.kaomoji button:hover { border-color: var(--edge); background: #fff6fa; }

.patterns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.patterns button { border: 2px solid transparent; background: none; padding: 6px 2px 4px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 13px; }
.patterns button:hover { background: rgba(58, 46, 77, .05); }
.patterns button[aria-pressed="true"] { border-color: var(--edge); background: var(--pink-soft); }
.mini { container-type: inline-size; position: relative; width: 52px; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 3px; box-shadow: 0 1px 3px rgba(58, 46, 77, .3); }

.folds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.folds button { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px solid var(--edge); background: #fff; border-radius: 14px; padding: 8px 4px 6px; font-size: 13.5px; font-weight: 500; transition: transform .12s; }
.folds button:hover { transform: translateY(-2px); }
.folds button[aria-pressed="true"] { background: var(--pink-soft); box-shadow: 0 2px 0 var(--edge); }
.folds svg { width: 20px; height: 26px; fill: #fff; stroke: var(--edge); stroke-width: 1.6; }
.folds .crease { stroke: #d43f7a; stroke-dasharray: 2 2; }

.scene-groups { display: flex; flex-direction: column; gap: 10px; }
.series-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.scenes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.scenes button { aspect-ratio: 3 / 2; border-radius: 9px; border: 2px solid var(--edge); padding: 0; overflow: hidden; background: #fff; transition: transform .12s; }
.scenes button:hover { transform: translateY(-2px); }
.scenes button svg { width: 100%; height: 100%; display: block; }
.scenes button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--card), 0 0 0 5.5px var(--pink); }
.photo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: -4px; }
.stamp-series { display: flex; flex-direction: column; gap: 14px; }
.stamps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stamps button { border: 0; background: none; padding: 4px; border-radius: 10px; transition: transform .12s; }
.stamps button:hover { transform: rotate(-4deg) scale(1.06); }
.stamps button[aria-pressed="true"] { background: var(--pink-soft); box-shadow: 0 0 0 2px var(--edge); }
.stamps svg { width: 100%; display: block; filter: drop-shadow(0 1px 1.5px rgba(58, 46, 77, .25)); }

/* ---------- washi tape ---------- */
.tape {
  display: flex; align-items: center; justify-content: space-around; overflow: hidden; opacity: .9;
  clip-path: polygon(2% 0, 98% 0, 100% 15%, 97% 32%, 100% 50%, 97% 68%, 100% 85%, 98% 100%, 2% 100%, 0 85%, 3% 68%, 0 50%, 3% 32%, 0 15%);
  line-height: 1;
}
.tape-pink { background: linear-gradient(90deg, rgba(255, 128, 170, .45) 50%, transparent 0) 0 0 / 1.2em 1.2em, linear-gradient(rgba(255, 128, 170, .45) 50%, transparent 0) 0 0 / 1.2em 1.2em, #ffe6ee; }
.tape-mint { background: radial-gradient(#fff 26%, transparent 29%) 0 0 / 1.1em 1.1em, #9fdfc3; }
.tape-lilac { background: repeating-linear-gradient(45deg, #c7b0ff 0 .45em, #ede5ff .45em .9em); }
.tape-sun { background: radial-gradient(#ffad3b 22%, transparent 25%) 0 0 / 1.2em 1.2em, #fff0b0; }
.tape-sakura { background: #ffd6e5; }
.tape-sakura::before { content: '✿ ✿ ✿ ✿ ✿ ✿ ✿ ✿'; color: #e5789a; white-space: nowrap; font-size: .8em; }
.tape-mini { width: 46px; height: 15px; font-size: 7px; transform: rotate(-8deg); }

/* ---------- note paper ---------- */
.paper-box { container-type: inline-size; position: relative; width: 100%; aspect-ratio: 3 / 4; }
.sheet {
  position: absolute; left: 0; top: 0; width: 100cqw; height: 133.3333cqw;
  background: var(--noise), var(--paper);
  box-shadow: inset 0 0 5cqw rgba(140, 105, 60, .06), inset 0 0 .6cqw rgba(140, 105, 60, .08);
}
.ruling { position: absolute; inset: 0; pointer-events: none; }
.ruling::before, .ruling::after { content: ''; position: absolute; pointer-events: none; }
.ruling .band { display: none; }

.pat-lined .ruling::before, .pat-torn .ruling::before {
  left: 0; right: 0; top: 12cqw; bottom: 0; opacity: .85;
  background: repeating-linear-gradient(to bottom, transparent 0 calc(9cqw - 1.5px), var(--rule) calc(9cqw - 1.5px) 9cqw);
}
.pat-lined .ruling::after, .pat-torn .ruling::after { top: 0; bottom: 0; left: 12.5cqw; width: .45cqw; background: var(--margin); opacity: .6; }
.pat-grid .ruling {
  opacity: .6;
  background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 4.5cqw 4.5cqw; background-position: 0 calc(12cqw - 1px);
}
.pat-dots .ruling { background-image: radial-gradient(circle, var(--rule) .4cqw, transparent .55cqw); background-size: 4.5cqw 4.5cqw; background-position: 0 9.75cqw; }
.pat-torn { clip-path: var(--torn); }
.pat-torn .ruling {
  background:
    radial-gradient(circle at 6cqw 22cqw, var(--hole) 1.7cqw, rgba(58, 46, 77, .18) 1.8cqw, transparent 2.2cqw),
    radial-gradient(circle at 6cqw 66.6cqw, var(--hole) 1.7cqw, rgba(58, 46, 77, .18) 1.8cqw, transparent 2.2cqw),
    radial-gradient(circle at 6cqw 111cqw, var(--hole) 1.7cqw, rgba(58, 46, 77, .18) 1.8cqw, transparent 2.2cqw);
}
.pat-letterset .ruling::before {
  left: 8cqw; right: 8cqw; top: 12cqw; bottom: 10cqw; opacity: .9;
  background: repeating-linear-gradient(to bottom, transparent 0 calc(9cqw - 1.5px), var(--rule) calc(9cqw - 1.5px) 9cqw);
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 1.6cqw, transparent 1.6cqw 2.8cqw);
  mask-image: repeating-linear-gradient(90deg, #000 0 1.6cqw, transparent 1.6cqw 2.8cqw);
}
.pat-letterset .ruling::after, .pat-letterset .ruling .band {
  --g: color-mix(in srgb, var(--margin) 45%, transparent);
  left: 0; right: 0; height: 7cqw;
  background: linear-gradient(90deg, var(--g) 50%, transparent 0) 0 0 / 3cqw 3cqw, linear-gradient(var(--g) 50%, transparent 0) 0 0 / 3cqw 3cqw;
}
.pat-letterset .ruling::after { top: 0; content: '♡'; color: #e5789a; text-align: center; font-size: 6cqw; line-height: 8.5cqw; }
.pat-letterset .ruling .band { display: block; position: absolute; bottom: 0; }
.pat-letterset .sheet-date { display: none; }

.sheet-date { position: absolute; top: 3cqw; right: 6cqw; font-family: var(--hand); font-size: 5.2cqw; color: var(--pen); opacity: .55; }
.msg {
  position: absolute; left: 16cqw; right: 6cqw; top: 13.5cqw; height: 90cqw;
  margin: 0; padding: 0; border: 0; background: transparent; z-index: 1;
  font-family: var(--hand); font-size: var(--fs); line-height: 9cqw; color: var(--pen);
  white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word;
  overflow: hidden; resize: none; outline: none;
}
.pat-grid .msg, .pat-dots .msg, .pat-blank .msg, .pat-letterset .msg { left: 9cqw; right: 8cqw; }
textarea.msg::placeholder { color: var(--pen); opacity: .35; }
.sig { position: absolute; right: 8cqw; top: 103.5cqw; height: 9cqw; line-height: 9cqw; z-index: 1; font-family: var(--hand); font-size: var(--fs); color: var(--pen); white-space: nowrap; }
.sticker-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.sticker {
  position: absolute; font-size: 10cqw; line-height: 1; user-select: none; -webkit-user-select: none;
  transform: translate(-50%, -50%) rotate(var(--r, 0deg));
  filter: drop-shadow(0 .4cqw 0 rgba(0, 0, 0, .12));
}
.edit-sheet .sticker { pointer-events: auto; cursor: grab; touch-action: none; }
.sticker.dragging { cursor: grabbing; transform: translate(-50%, -50%) rotate(var(--r)) scale(1.2); }
.sticker.leaving { opacity: .35; }
.sticker.pop { animation: pop .4s cubic-bezier(.3, 1.7, .5, 1); }
@keyframes pop { from { transform: translate(-50%, -50%) rotate(var(--r)) scale(0); } }

/* ---------- folding ---------- */
.paper { position: absolute; inset: 0; transform-style: preserve-3d; perspective: 1800px; transition: transform .75s cubic-bezier(.5, 0, .25, 1); }
.paper-shadow {
  position: absolute; left: 0; top: 0; width: 100cqw; height: 133.3333cqw; transform: translateZ(-1px);
  box-shadow: 0 2cqw 5cqw rgba(58, 46, 77, .2), 0 .5cqw 0 rgba(58, 46, 77, .06);
  transition: top .75s, height .75s, width .75s; transition-timing-function: cubic-bezier(.5, 0, .25, 1);
}
.panel { position: absolute; transform-style: preserve-3d; transition: transform .75s cubic-bezier(.5, 0, .25, 1); }
.face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face.front::after { content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none; box-shadow: inset 0 0 1.8cqw rgba(58, 46, 77, .06); }
.face.back {
  transform: rotateX(180deg);
  background: var(--noise), color-mix(in srgb, var(--paper) 95%, #8a7356);
  box-shadow: inset 0 0 3cqw rgba(140, 105, 60, .1);
}
.face.back.flip-y { transform: rotateY(180deg); }
.lines-back .face.back::before {
  content: ''; position: absolute; inset: 0; opacity: .3;
  background: repeating-linear-gradient(to bottom, transparent 0 calc(9cqw - 2px), var(--rule) calc(9cqw - 2px) 9cqw);
}

/* Letter: bottom third up, then top third down */
.fold-letter .p-top { transform-origin: 50% 100%; }
.fold-letter .p-bot { transform-origin: 50% 0; }
.fold-letter .f1 .p-bot { transform: rotateX(180deg) translateZ(-1.5px); }
.fold-letter .f2 .p-top { transform: rotateX(-180deg) translateZ(-3px); }
.fold-letter .f1 .paper-shadow { height: 88.8889cqw; }
.fold-letter .f1.f2 .paper-shadow { top: 44.4444cqw; height: 44.4444cqw; }

/* Card: top half folds down */

/* Book: right half folds over the left */

/* Tiny square: bottom half up, then right half over */
.fold-square .p-bl, .fold-square .p-br { transform-origin: 50% 0; }
.fold-square .f1 .p-bl, .fold-square .f1 .p-br { transform: rotateX(180deg) translateZ(-1.5px); }
.fold-square .p-right { transform-origin: 0 50%; }
.fold-square .f2 .p-right { transform: rotateY(-180deg) translateZ(-4px); }
.fold-square .f1 .paper { transform: translateY(33.3333cqw); }
.fold-square .f1.f2 .paper { transform: translate(25cqw, 33.3333cqw); }
.fold-square .f1 .paper-shadow { height: 66.6667cqw; }
.fold-square .f1.f2 .paper-shadow { width: 50cqw; }

/* Pocket: thirds, then in half */
.fold-pocket .p-tl, .fold-pocket .p-tr { transform-origin: 50% 100%; }
.fold-pocket .p-bl, .fold-pocket .p-br { transform-origin: 50% 0; }
.fold-pocket .f1 .p-bl, .fold-pocket .f1 .p-br { transform: rotateX(180deg) translateZ(-1.5px); }
.fold-pocket .f2 .p-tl, .fold-pocket .f2 .p-tr { transform: rotateX(-180deg) translateZ(-3px); }
.fold-pocket .p-right { transform-origin: 0 50%; }
.fold-pocket .f3 .p-right { transform: rotateY(-180deg) translateZ(-6px); }
.fold-pocket .f3 .paper { transform: translateX(25cqw); }
.fold-pocket .f1 .paper-shadow { height: 88.8889cqw; }
.fold-pocket .f1.f2 .paper-shadow { top: 44.4444cqw; height: 44.4444cqw; }
.fold-pocket .f1.f2.f3 .paper-shadow { width: 50cqw; }

/* Gate: both sides fold in like doors */
.fold-gate .p-gl { transform-origin: 100% 50%; }
.fold-gate .p-gr { transform-origin: 0 50%; }
.fold-gate .f1 .p-gl { transform: rotateY(180deg) translateZ(-1.5px); }
.fold-gate .f2 .p-gr { transform: rotateY(-180deg) translateZ(-3px); }
.fold-gate .f1 .paper-shadow { left: 0; width: 75cqw; }
.fold-gate .f1.f2 .paper-shadow { left: 25cqw; width: 50cqw; }
.fold-gate .paper-shadow { transition-property: top, height, width, left; }

/* Fan: zig-zag accordion, folded up from the bottom */
.fold-fan .p-g2, .fold-fan .p-g3, .fold-fan .p-g4 { transform-origin: 50% 0; }
.fold-fan .f1 .p-g4 { transform: rotateX(180deg) translateZ(-1.5px); }
.fold-fan .f2 .p-g3 { transform: rotateX(-180deg) translateZ(1.5px); }
.fold-fan .f3 .p-g2 { transform: rotateX(180deg) translateZ(-1.5px); }
.fold-fan .f1 .paper { transform: translateY(16.6667cqw); }
.fold-fan .f1.f2 .paper { transform: translateY(33.3333cqw); }
.fold-fan .f1.f2.f3 .paper { transform: translateY(50cqw); }
.fold-fan .f1 .paper-shadow { height: 100cqw; }
.fold-fan .f1.f2 .paper-shadow { height: 66.6667cqw; }
.fold-fan .f1.f2.f3 .paper-shadow { height: 33.3333cqw; }
.fold-gate .outside-label .for { font-size: 4.5cqw; }
.fold-gate .outside-label .name { font-size: 6.5cqw; max-width: 92%; }
.fold-gate .outside-label .name::after { content: ''; }
.fold-gate .outside-label { padding: 0 0 12cqw; transform: rotate(-4deg); }

/* Origami engine: stacked flat layers, each swinging about its crease */
.ori-idle { position: absolute; inset: 0; }
.ori-stage {
  position: absolute; left: 0; top: 0; width: 100cqw; height: 133.3333cqw;
  perspective: 1500px; transform-origin: 50cqw 66.6667cqw;
  transition: transform .7s cubic-bezier(.45, .05, .35, 1);
  filter: drop-shadow(0 1.2cqw 2cqw rgba(58, 46, 77, .18));
}
.ori-layer { position: absolute; left: 0; top: 0; width: 100cqw; height: 133.3333cqw; transform-origin: 0 0; transform-style: preserve-3d; }
.ori-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; filter: drop-shadow(0 0 .25cqw rgba(58, 46, 77, .28)); }
.ori-back { transform: rotateY(180deg); }
.ori-clip { position: absolute; inset: 0; }
.ori-blank { position: absolute; inset: 0; background: var(--noise), color-mix(in srgb, var(--paper) 93%, #8a7356); }
.ori-seal {
  position: absolute; z-index: 99999; line-height: 1; pointer-events: none;
  transform: translate(-50%, -50%) rotate(var(--sr, -12deg)) scale(0);
  transition: transform .45s cubic-bezier(.3, 1.7, .5, 1);
}
.sealed .ori-seal { transform: translate(-50%, -50%) rotate(var(--sr, -12deg)) scale(1); }
.ori-model .ori-label { position: absolute; left: 0; right: 0; top: 90%; text-align: center; opacity: 0; transition: opacity .4s; }
.ori-model.ready .ori-label { opacity: 1; }
.ori-model.fold-shape .ori-label { position: static; opacity: 1; }
.ori-model.waiting { animation: none; }
.ori-model.ready:not(.morph) .ori-idle { animation: var(--idle) 2.6s ease-in-out infinite; }
.ori-model.ready.arrive:not(.morph) .ori-idle { animation: shapeArrive .9s cubic-bezier(.2, 1.2, .4, 1) both, var(--idle) 2.6s ease-in-out .9s infinite; }
.no-anim .ori-stage, .no-anim .ori-seal { transition: none !important; }

/* Origami shapes */
.shape {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; transform: scale(.35) rotate(-25deg);
  transition: opacity .35s, transform .55s cubic-bezier(.3, 1.5, .5, 1);
}
.morph .shape { opacity: 1; transform: none; }
.morph .paper-box { opacity: 0; transform: scale(.5) rotate(10deg); }
.fold-wrap .paper-box { transition: opacity .3s, transform .4s; }
.no-anim .shape, .no-anim .paper-box { transition: none !important; }
.shape-art { position: relative; width: 74%; aspect-ratio: 1; }
.shape-svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 8px 10px rgba(58, 46, 77, .2)); }
.shape-svg polygon, .shape-icon polygon { stroke: color-mix(in srgb, var(--paper) 55%, #5a4a7a); stroke-width: 1.4; stroke-linejoin: round; }
.o-base { fill: var(--paper); }
.o-shade { fill: color-mix(in srgb, var(--paper) 86%, #6b5a8e); }
.o-shade2 { fill: color-mix(in srgb, var(--paper) 77%, #6b5a8e); }
.o-dark { fill: color-mix(in srgb, var(--paper) 64%, #6b5a8e); }
.o-line { fill: none; stroke: color-mix(in srgb, var(--paper) 55%, #5a4a7a); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.shape-svg .o-puff-edge, .shape-icon .o-puff-edge { fill: none; stroke: color-mix(in srgb, var(--paper) 55%, #5a4a7a); stroke-width: 22; }
.shape-svg .o-puff, .shape-icon .o-puff { fill: var(--paper); stroke: var(--paper); stroke-width: 19; }
.o-facet polygon { fill: color-mix(in srgb, var(--paper) 86%, #6b5a8e); stroke: none !important; opacity: .8; }
.shape-seal { position: absolute; right: 6%; bottom: 8%; font-size: calc(var(--note-w) * .12); line-height: 1; transform: rotate(-12deg); }
.shape-seal.tape { width: calc(var(--note-w) * .26); height: calc(var(--note-w) * .085); font-size: calc(var(--note-w) * .04); right: 0; transform: rotate(-8deg); }
.shape-label { font-family: var(--hand); color: var(--pen); font-size: calc(var(--note-w) * .075); margin-top: 2%; transform: rotate(-3deg); white-space: nowrap; }
.shape-label .for { opacity: .7; font-size: .75em; }
.shape-label .name::after { content: ' ♡'; }
.morph .shape-art { animation: var(--idle) 2.6s ease-in-out infinite; }
.arrive.morph .shape-art { animation: shapeArrive .9s cubic-bezier(.2, 1.2, .4, 1) both, var(--idle) 2.6s ease-in-out .9s infinite; }
.shape-plane { --idle: idlePlane; }
.shape-heart { --idle: idleHeart; }
.shape-crane { --idle: idleBob; }
.shape-star { --idle: idleSpin; }
.shape-fortune { --idle: idlePinch; }
.shape-football { --idle: idleFlick; }
@keyframes shapeArrive { from { transform: translate(-140px, -70px) rotate(-30deg) scale(.5); opacity: 0; } }
@keyframes idlePlane { 0%, 100% { transform: translate(0, 0) rotate(-6deg); } 50% { transform: translate(8px, -12px) rotate(-1deg); } }
@keyframes idleHeart { 0%, 60%, 100% { transform: scale(1); } 15% { transform: scale(1.08); } 30% { transform: scale(.97); } 45% { transform: scale(1.05); } }
@keyframes idleBob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
@keyframes idleSpin { 0%, 100% { transform: rotate(-9deg) scale(1); } 50% { transform: rotate(9deg) scale(1.05); } }
@keyframes idlePinch { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(.85, 1.08); } }
@keyframes idleFlick { 0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(-14deg); } 90% { transform: rotate(9deg); } }
.folds button { --paper: #ffffff; }
.folds.origami button { --paper: #ffe9f1; }
.folds.origami button[aria-pressed="true"] { --paper: #ffffff; }
.folds .shape-icon { width: 30px; height: 30px; overflow: visible; }
.folds.origami { grid-template-columns: repeat(3, 1fr); }

.outside-label {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--hand); color: var(--pen); transform: rotate(-3deg); padding-bottom: 5cqw;
}
.outside-label .for { font-size: 6.5cqw; opacity: .7; line-height: 1; }
.outside-label .name { font-size: 11.5cqw; line-height: 1.15; max-width: 88%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outside-label .name::after { content: ' ♡'; }
.fold-square .outside-label .for, .fold-pocket .outside-label .for { font-size: 4.6cqw; }
.fold-square .outside-label .name, .fold-pocket .outside-label .name { font-size: 7.5cqw; }

.seal {
  position: absolute; font-size: 13cqw; line-height: 1; pointer-events: none;
  transform: translate(-50%, -50%) translateZ(7px) scale(0);
  transition: transform .45s cubic-bezier(.3, 1.7, .5, 1);
}
.sealed .seal { transform: translate(-50%, -50%) translateZ(7px) scale(1) rotate(-12deg); }
.seal.tape { width: 28cqw; height: 9cqw; font-size: 4.2cqw; }
.sealed .seal.tape { transform: translate(-50%, -50%) translateZ(7px) scale(1) rotate(-6deg); }
.no-anim .paper, .no-anim .panel, .no-anim .seal, .no-anim .paper-shadow { transition: none !important; }

.show-stage { position: relative; display: flex; justify-content: center; margin: 8px auto 0; }
.fold-wrap { width: var(--note-w); transition: transform .6s, margin .75s cubic-bezier(.5, 0, .25, 1); outline: none; }
.fold-wrap.compact { margin-block: calc(var(--note-w) * -.36); }
.fold-square.compact { margin-block: calc(var(--note-w) * -.26); }
.fold-gate.compact { margin-block: 0; }
.fold-fan.compact { margin-block: calc(var(--note-w) * -.4); }
.fold-shape.compact { margin-block: calc(var(--note-w) * -.16); }
.fold-shape.waiting { animation: none; }
.fold-shape.done { transform: none; }
.fold-wrap { position: relative; }
.fold-wrap.done { transform: rotate(-4deg) scale(1.04); }
.fold-wrap.waiting { cursor: pointer; animation: wiggle 2.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg) translateY(-8px); } }

/* ---------- postcard ---------- */
.postcard { container-type: inline-size; width: 100%; perspective: 2200px; }
.card-stage .postcard { width: min(580px, 92vw); }
.pc-inner { position: relative; width: 100%; aspect-ratio: 3 / 2; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.35, .9, .3, 1); }
.postcard.flipped .pc-inner { transform: rotateY(180deg); }
.postcard.flipped .pc-front, .postcard:not(.flipped) .pc-back { pointer-events: none; }
.pc-face {
  position: absolute; inset: 0; border-radius: 1.6cqw; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 2cqw 4.5cqw rgba(58, 46, 77, .2), 0 .5cqw 0 rgba(58, 46, 77, .08);
}
.pc-front { background: #fff; }
.pc-front svg, .pc-photo { position: absolute; inset: 0; width: 100%; height: 100%; }
.pc-photo { object-fit: cover; }
.pc-front::after { content: ''; position: absolute; inset: 2.4cqw; pointer-events: none; border: .6cqw solid rgba(255, 255, 255, .88); border-radius: 1cqw; }
.pc-front::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: var(--noise); opacity: .5; }
/* Front lettering: a box + font per art style ("look"). The text starts bottom-centre and the
   sender can move (--tx/--ty, % of the card), resize (--ts) and tilt (--tr, degrees) it. */
.pc-title {
  --sc: calc(.62 * var(--ts, 1) * var(--lk, 1));
  position: absolute; left: calc(var(--tx, 50) * 1%); top: calc(var(--ty, 82) * 1%); z-index: 2;
  transform: translate(-50%, -50%) rotate(calc(var(--tr, 0) * 1deg)) scale(var(--sc));
  text-align: center; white-space: nowrap;
}
.pc-box { position: relative; isolation: isolate; }
.pc-greet { font: 600 2.7cqw/1.7 'Fredoka', sans-serif; letter-spacing: .6cqw; text-transform: uppercase; color: var(--ink); }
.pc-place { line-height: 1.1; color: var(--title); }
/* boxes */
.look-retro .pc-box { background: #fffdf8; padding: 1.4cqw 5.5cqw 2cqw;
  -webkit-mask: radial-gradient(circle, #0000 .7cqw, #000 .75cqw) -1cqw -1cqw / 2cqw 2cqw round, linear-gradient(#000 0 0) center / calc(100% - 2cqw) calc(100% - 2cqw) no-repeat;
  mask: radial-gradient(circle, #0000 .7cqw, #000 .75cqw) -1cqw -1cqw / 2cqw 2cqw round, linear-gradient(#000 0 0) center / calc(100% - 2cqw) calc(100% - 2cqw) no-repeat; }
.look-retro .pc-box::before { content: ''; position: absolute; inset: 1.8cqw; border: .3cqw solid color-mix(in srgb, var(--title) 45%, #fff); }
.look-kawaii .pc-box { rotate: -3deg; padding: .6cqw 7cqw 1.2cqw; opacity: .96;
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--title) 22%, #fff) 0 2cqw, color-mix(in srgb, var(--title) 8%, #fff) 2cqw 4cqw);
  -webkit-mask: conic-gradient(from -45deg at left, #0000 90deg, #000 0) left / 51% 2cqw repeat-y, conic-gradient(from 135deg at right, #0000 90deg, #000 0) right / 51% 2cqw repeat-y;
  mask: conic-gradient(from -45deg at left, #0000 90deg, #000 0) left / 51% 2cqw repeat-y, conic-gradient(from 135deg at right, #0000 90deg, #000 0) right / 51% 2cqw repeat-y; }
.look-lino .pc-box, .look-engr .pc-box, .look-wood .pc-box { padding: .8cqw 6cqw 1.3cqw; background: var(--band); box-shadow: inset 0 0 0 .55cqw var(--band), inset 0 0 0 .8cqw var(--paper); }
.look-lino .pc-greet, .look-lino .pc-place, .look-engr .pc-greet, .look-engr .pc-place, .look-wood .pc-greet, .look-wood .pc-place { color: var(--paper); }
.look-riso .pc-box { rotate: -1.5deg; background: var(--paper); padding: .5cqw 5cqw 1cqw; border: .45cqw solid var(--title); box-shadow: .9cqw .7cqw 0 color-mix(in srgb, var(--ink) 75%, transparent); }
.look-felt .pc-box { padding: 1.4cqw 6cqw 2cqw; background: var(--paper); border-radius: 2cqw; box-shadow: 0 .6cqw 1cqw rgba(58, 46, 77, .2); }
.look-felt .pc-box::before { content: ''; position: absolute; inset: 1cqw; border: .4cqw dashed var(--title); border-radius: 1.4cqw; }
.look-chino .pc-box { background: var(--paper); border-radius: 50%; padding: 1.6cqw 8cqw 2.2cqw;
  box-shadow: inset 0 0 0 .6cqw var(--paper), inset 0 0 0 .85cqw var(--title), inset 0 0 0 1.4cqw var(--paper), inset 0 0 0 1.55cqw color-mix(in srgb, var(--title) 50%, var(--paper)), 0 .5cqw 1cqw rgba(0, 0, 0, .12); }
.look-cut .pc-box { rotate: -2deg; background: var(--paper); padding: 1.2cqw 6cqw 1.8cqw; box-shadow: 1.3cqw 1.3cqw 0 var(--title), 1.3cqw 1.3cqw 1.8cqw rgba(58, 46, 77, .28), 0 .4cqw .8cqw rgba(58, 46, 77, .18); }
.look-xs .pc-box { background: var(--paper); padding: 2cqw 6cqw 2.4cqw; }
.look-xs .pc-box::before { content: ''; position: absolute; inset: 0; z-index: -1; padding: 1.2cqw;
  background: repeating-linear-gradient(45deg, var(--title) 0 .3cqw, transparent .3cqw 1.2cqw), repeating-linear-gradient(-45deg, var(--title) 0 .3cqw, transparent .3cqw 1.2cqw);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.look-letter .pc-box { background: var(--paper); padding: .8cqw 5.5cqw 1.4cqw; box-shadow: inset 0 0 0 .5cqw var(--paper), inset 0 0 0 .75cqw var(--title), inset 0 0 0 1.1cqw var(--paper), inset 0 0 0 1.3cqw var(--title); }
.look-cyan .pc-place { text-shadow: 0 0 1.4cqw rgba(255, 255, 255, .45); }
.look-cyan .pc-greet { opacity: .85; }
.look-plain .pc-place { -webkit-text-stroke: .8cqw #fff; paint-order: stroke fill; text-shadow: 0 .5cqw 1cqw rgba(0, 0, 0, .2); }
.look-plain .pc-greet { color: #fff; text-shadow: 0 .3cqw .6cqw rgba(0, 0, 0, .3); }
/* fonts */
.look-chino .pc-place, .look-cyan .pc-place { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-weight: 700; }
.look-retro .pc-place, .look-cut .pc-place, .look-plain .pc-place { font-family: 'Sniglet', 'Fredoka', sans-serif; font-weight: 800; }
.look-retro .pc-place, .look-plain .pc-place { text-transform: uppercase; }
.look-retro .pc-greet, .look-cut .pc-greet { font-family: 'Sniglet', 'Fredoka', sans-serif; font-weight: 800; }
.look-riso .pc-place, .look-riso .pc-greet { font-family: 'Courier Prime', 'Courier New', monospace; font-weight: 700; text-transform: uppercase; }
.look-riso .pc-place { text-shadow: .6cqw .4cqw 0 color-mix(in srgb, var(--ink) 80%, transparent); }
.look-lino .pc-place, .look-lino .pc-greet { font-family: 'Bowlby One', 'Arial Black', sans-serif; font-weight: 400; text-transform: uppercase; }
.look-letter .pc-place, .look-letter .pc-greet { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; }
.look-letter .pc-greet { font-weight: 400; }
.look-felt .pc-place, .look-felt .pc-greet { font-family: 'DynaPuff', 'Fredoka', sans-serif; font-weight: 600; }
.look-engr .pc-place, .look-engr .pc-greet { font-family: Georgia, 'Times New Roman', serif; font-weight: 400; text-transform: uppercase; }
.look-engr .pc-place { letter-spacing: .8cqw; }
.look-wood .pc-place, .look-wood .pc-greet { font-family: 'Abril Fatface', Georgia, serif; font-weight: 400; }
.look-xs .pc-place { font-family: 'Pixelify Sans', 'Courier New', monospace; font-weight: 600; }
.look-kawaii .pc-place { font-family: 'Gaegu', 'Fredoka', cursive; font-weight: 700; }
/* moving, tilting and resizing in the composer */
.pc-title.movable { cursor: grab; touch-action: none; }
.pc-title.movable.dragging { cursor: grabbing; }
.pc-title.movable::after { content: ''; position: absolute; inset: calc(-1.2cqw / var(--sc)); border: calc(.35cqw / var(--sc)) dashed rgba(255, 92, 141, .85); border-radius: calc(1cqw / var(--sc)); pointer-events: none; }
.pc-title .pc-handle { display: none; position: absolute; z-index: 3; width: calc(3.8cqw / var(--sc)); height: calc(3.8cqw / var(--sc)); padding: 0; border-radius: 50%;
  background: #fff; border: calc(.45cqw / var(--sc)) solid #ff5c8d; box-shadow: 0 calc(.3cqw / var(--sc)) calc(.8cqw / var(--sc)) rgba(58, 46, 77, .3); touch-action: none; }
.pc-title.movable .pc-handle { display: block; }
.pc-handle.size { right: calc(-1.2cqw / var(--sc)); bottom: calc(-1.2cqw / var(--sc)); translate: 50% 50%; cursor: nwse-resize; }
.pc-handle.turn { left: 50%; top: calc(-1.2cqw / var(--sc)); translate: -50% -150%; cursor: grab; }
@media (pointer: coarse) { .pc-title .pc-handle { width: calc(6cqw / var(--sc)); height: calc(6cqw / var(--sc)); } }
.pc-handle::after { content: ''; position: absolute; inset: 28%; border-radius: 50%; background: #ff5c8d; }
.pc-handle.turn::before { content: ''; position: absolute; left: 50%; top: 100%; width: calc(.35cqw / var(--sc)); height: calc(2cqw / var(--sc)); translate: -50% 0; background: #ff5c8d; }
.pc-back {
  transform: rotateY(180deg); background-color: var(--card-bg, #fdf8ee);
  background-image: var(--noise), radial-gradient(rgba(150, 120, 80, .06) 1px, transparent 1.2px);
  background-size: auto, 1.6cqw 1.6cqw;
}
.pc-back.air::before {
  content: ''; position: absolute; inset: 0; padding: 2cqw; z-index: 4; pointer-events: none;
  background: repeating-linear-gradient(-45deg, #e5484d 0 2.6cqw, transparent 2.6cqw 4.2cqw, #3b6fd6 4.2cqw 6.8cqw, transparent 6.8cqw 8.4cqw);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.pc-label { position: absolute; left: 0; right: 0; top: 4.4cqw; text-align: center; font-size: 2.4cqw; letter-spacing: 1.2cqw; color: #b3a68f; font-weight: 600; }
.pc-msg {
  position: absolute; left: 6cqw; top: 11.5cqw; width: 47cqw; height: 44.8cqw;
  margin: 0; padding: 0; border: 0; background: transparent; outline: none; resize: none; overflow: hidden;
  font-family: var(--hand); font-size: var(--fs); line-height: 6.4cqw; color: var(--pen);
  white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word;
}
textarea.pc-msg::placeholder { color: var(--pen); opacity: .35; }
.pc-from { position: absolute; left: 6cqw; top: 57cqw; font-family: var(--hand); font-size: calc(var(--fs) * .95); color: var(--pen); white-space: nowrap; }
.pc-divider { position: absolute; left: 57cqw; top: 10cqw; bottom: 7cqw; width: .35cqw; background: rgba(150, 125, 90, .3); border-radius: 1cqw; }
.stamp { position: absolute; right: 5.5cqw; top: 5.5cqw; width: 15cqw; transform: rotate(3deg); filter: drop-shadow(0 .3cqw .4cqw rgba(58, 46, 77, .25)); }
.stamp svg { width: 100%; display: block; }
.postmark { position: absolute; right: 12cqw; top: 10cqw; width: 30cqw; color: rgba(140, 50, 100, .62); transform: rotate(-9deg); opacity: 0; pointer-events: none; z-index: 2; }
.postmark svg { width: 100%; display: block; }
.stamped .postmark { opacity: 1; animation: thunk .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes thunk { from { transform: rotate(-9deg) scale(1.8); opacity: 0; } }
.pc-addr { position: absolute; left: 61cqw; right: 6.5cqw; top: 32cqw; }
.addr-line { height: 8.5cqw; border-bottom: .3cqw solid rgba(150, 125, 90, .4); display: flex; align-items: flex-end; gap: 1.5cqw; padding-bottom: .6cqw; }
.addr-to { font-size: 2.6cqw; color: #b3a68f; font-weight: 600; letter-spacing: .3cqw; padding-bottom: .8cqw; }
.addr-name { font-family: var(--hand); font-size: calc(var(--fs) * 1.05); color: var(--pen); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-composer .postcard:not(.flipped) .pc-front { cursor: pointer; }
.card-holder { transform: rotate(-1.5deg); }
.card-holder .postcard { cursor: pointer; }
.postcard.arrive { animation: arrive .9s cubic-bezier(.2, 1.2, .4, 1) both; }
@keyframes arrive { from { transform: translateY(-70px) rotate(-10deg); opacity: 0; } }

/* ---------- locked items ---------- */
.locked { position: relative; }
.locked svg, .tray button.locked, .item.locked > * { filter: grayscale(1); opacity: .38; }
.item-sticker.locked { filter: grayscale(1); opacity: .38; }
.locked::after {
  content: ''; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3' fill='none' stroke='%233a2e4d' stroke-width='2.4' stroke-linecap='round'/%3E%3Crect x='5' y='10.5' width='14' height='10.5' rx='2.5' fill='%23ffd9e6' stroke='%233a2e4d' stroke-width='2.2'/%3E%3Ccircle cx='12' cy='15.7' r='1.6' fill='%233a2e4d'/%3E%3C/svg%3E") center / contain no-repeat; width: 13px; height: 13px; position: absolute; right: 3px; bottom: 3px;
  filter: none; opacity: 1;
}
.tray button.locked { filter: none; opacity: 1; }
.tray button.locked > *, .tray button.locked { color: inherit; }
.tray button.locked:not(.wide) { filter: grayscale(1); opacity: .45; }
.tray button.wide.locked .tape { filter: grayscale(1); opacity: .45; }

/* ---------- home cards ---------- */
.home-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; max-width: 860px; margin: 26px auto 0; }
.home-card {
  display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit;
  background: var(--card); border: 2.5px solid var(--edge); border-radius: 22px; padding: 14px 18px;
  box-shadow: 4px 5px 0 var(--edge); transition: transform .15s, box-shadow .15s;
}
.home-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 7px 0 var(--edge); }
/* envelope flap folded across the top of each shortcut card */
.home-row .home-card { position: relative; isolation: isolate; overflow: hidden; padding-top: 34px; }
.home-row .home-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 28px; z-index: -1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 50' preserveAspectRatio='none'%3E%3Cpath d='M0 0L50 50L100 0Z' fill='%23f6e7d3'/%3E%3Cpath d='M0 0L50 50L100 0' fill='none' stroke='%233a2e4d' stroke-opacity='.35' stroke-width='1.2' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") 0 0/100% 100% no-repeat;
}
.home-row .capsule-card.ready::before { filter: hue-rotate(-25deg) saturate(1.6); }
.install-card {
  position: relative; display: flex; align-items: center; gap: 14px; max-width: 860px; margin: 22px auto 0;
  background: #e3f6ec; border: 2.5px solid var(--edge); border-radius: 22px; padding: 14px 44px 14px 16px;
  box-shadow: 4px 5px 0 var(--edge);
}
.install-card.hidden { display: none; }
.install-icon { width: 52px; height: 52px; border-radius: 14px; flex: none; }
.install-text { flex: 1; min-width: 0; }
.install-text h3 { margin: 0 0 2px; font-size: 18px; font-weight: 600; }
.install-text p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.4; }
.install-card .btn { flex: none; }
.install-close { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 15px; color: var(--muted); padding: 4px 6px; border-radius: 999px; }
.install-close:hover { background: rgba(58, 46, 77, .08); }
@media (max-width: 520px) { .install-card { flex-wrap: wrap; } .install-card .btn { width: 100%; } }
.home-card h3 { margin: 0 0 2px; font-size: 19px; font-weight: 600; }
.home-card p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.4; }
.home-card p b { color: var(--ink); }
.capsule-mini { width: 54px; flex: none; }
.capsule-mini svg { width: 100%; display: block; }
.capsule-card.ready { background: #fff1f6; }
.capsule-card.ready .capsule-mini { animation: wiggle 2.2s ease-in-out infinite; }
.capsule-card.ready p { color: #d43f7a; font-weight: 500; }
.collection-mini { position: relative; width: 54px; height: 60px; flex: none; }
.collection-mini span { position: absolute; width: 34px; height: 42px; border: 2px solid var(--edge); border-radius: 3px; background: #fdeef2; }
.collection-mini span:nth-child(1) { left: 0; top: 10px; transform: rotate(-12deg); background: #efe4cc; }
.collection-mini span:nth-child(2) { left: 10px; top: 4px; transform: rotate(4deg); background: #f2c14e; }
.collection-mini span:nth-child(3) { left: 18px; top: 12px; transform: rotate(14deg); background: #ffd6e5; }

/* ---------- capsule page ---------- */
.capsule-page { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 520px; margin: 0 auto; }
.cap-stage { position: relative; width: 230px; height: 330px; }
.machine { width: 230px; }
.machine svg { width: 100%; display: block; overflow: visible; }
.machine .knob { transform-origin: 100px 196px; transform-box: view-box; }
.machine.turning { animation: shake .5s ease-in-out 2; }
.machine.turning .knob { animation: knob 1.05s cubic-bezier(.4, 0, .3, 1); }
@keyframes knob { to { transform: rotate(360deg); } }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2.5deg); } 75% { transform: rotate(2.5deg); } }
.capsule-drop { position: absolute; left: 50%; top: 262px; width: 58px; height: 58px; margin-left: -29px; }
.capsule-drop span { position: absolute; left: 0; width: 58px; height: 29px; border: 3px solid var(--edge); box-sizing: border-box; transition: transform .45s cubic-bezier(.3, 1.4, .5, 1); }
.cap-top { top: 0; border-radius: 29px 29px 0 0; background: var(--cap, #ff8fb4); border-bottom-width: 1.5px !important; }
.cap-bottom { bottom: 0; border-radius: 0 0 29px 29px; background: #fff; border-top-width: 1.5px !important; }
.capsule-drop.drop { animation: capDrop .85s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes capDrop { 0% { transform: translateY(-40px) scale(.4); opacity: 0; } 60% { transform: translateY(8px) scale(1.05); opacity: 1; } }
.capsule-drop.open .cap-top { transform: translate(-22px, -26px) rotate(-38deg); }
.capsule-drop.open .cap-bottom { transform: translate(18px, 10px) rotate(24deg); }
.cap-status { margin: 0; font-size: 18px; font-weight: 500; text-align: center; min-height: 1.4em; }
.cap-turn { max-width: 300px; }
.cap-turn:disabled { opacity: .7; cursor: default; }
.cap-result { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.prize {
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: 150px; padding: 14px 10px 12px;
  background: var(--card); border: 2.5px solid var(--edge); border-radius: 18px; box-shadow: 3px 4px 0 var(--edge);
  animation: prizeIn .55s cubic-bezier(.3, 1.6, .5, 1) both;
}
@keyframes prizeIn { from { transform: translateY(20px) scale(.6) rotate(-8deg); opacity: 0; } }
.prize .item { width: 100%; }
.prize-name { font-size: 13.5px; font-weight: 500; text-align: center; }
.prize-actions { width: 100%; }

/* ---------- items (collection, prizes, collect panel) ---------- */
.item svg { width: 100%; display: block; }
.item-stamp { max-width: 96px; margin: 0 auto; filter: drop-shadow(0 2px 3px rgba(58, 46, 77, .22)); }
.item-scene { border-radius: 6px; overflow: hidden; border: 2px solid var(--edge); aspect-ratio: 3 / 2; }
.item-scene svg { height: 100%; }
.item-sticker { font-size: 40px; text-align: center; line-height: 1.2; }
.item-tape { display: grid; place-items: center; min-height: 44px; }
.tape-item { width: 90px; height: 26px; font-size: 13px; transform: rotate(-6deg); }

/* ---------- my collection ---------- */
.col-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -6px 0 20px; font-size: 17px; font-weight: 500; }
.pack { background: var(--card); border: 2.5px solid var(--edge); border-radius: 22px; box-shadow: 4px 5px 0 var(--edge); padding: 14px 20px 18px; margin-bottom: 22px; }
.pack-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pack-head h3 { margin: 0; font-size: 18px; font-weight: 600; }
.pack-kind { color: var(--muted); font-size: 13.5px; }
.pack-count { margin-left: auto; font-weight: 600; font-size: 14px; }
.pack-count.done { color: #2f7a55; }
.pack-bar { height: 8px; border-radius: 99px; background: #f1e6d7; margin: 10px 0 14px; overflow: hidden; }
.pack-bar i { display: block; height: 100%; background: var(--pink); border-radius: 99px; transition: width .4s; }
.pack-items { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); align-items: center; }
.pack-items.kind-stickers { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
.pack-items.kind-stamps .item-scene { grid-column: span 2; }

.col-heading { margin: 30px 0 6px; font-size: 21px; font-weight: 600; }
.col-note { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; }
.pack-badge { font-size: 12.5px; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: #f1e6d7; color: var(--muted); }
.pack-badge.live { background: #ffd9e6; color: #c2306a; }
.pack-badge.free { background: #dff5e7; color: #2f7a55; }
.tray-label { flex-basis: 100%; font-size: 12px; font-weight: 600; color: var(--muted); margin: 6px 0 -2px; }
.tray-label:first-child { margin-top: 0; }
.cap-live { margin: -6px 0 0; color: var(--muted); font-size: 14px; text-align: center; }
.prize-from { font-size: 12px; color: var(--muted); text-align: center; margin-top: -4px; }
/* Shiny foil stamps: a rainbow sheen sweeping over the printed panel, plus a few twinkles */
.item-shiny { position: relative; } /* .stamp is already positioned on the card, so it needs nothing here */
.foil, .twinkle { position: absolute; left: 9%; right: 9%; top: 7.5%; bottom: 7.5%; pointer-events: none; }
.foil {
  mix-blend-mode: overlay; opacity: .9;
  background: linear-gradient(115deg, transparent 12%, rgba(255, 110, 190, .75) 30%, rgba(110, 220, 255, .75) 43%, rgba(255, 240, 120, .75) 56%, rgba(170, 130, 255, .75) 69%, transparent 86%);
  background-size: 260% 260%; animation: foil 3.6s ease-in-out infinite alternate;
}
.twinkle {
  background:
    radial-gradient(circle at 24% 28%, #fff 0 1.4%, transparent 3%),
    radial-gradient(circle at 74% 56%, #fff 0 1.1%, transparent 2.6%),
    radial-gradient(circle at 42% 82%, #fff 0 1%, transparent 2.4%);
  animation: twinkle 2.4s ease-in-out infinite;
}
@keyframes foil { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
@keyframes twinkle { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }
.has-shiny::before { content: ''; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 2c.7 5 3 7.3 8 8-5 .7-7.3 3-8 8-.7-5-3-7.3-8-8 5-.7 7.3-3 8-8z' fill='%23ffd34d' stroke='%233a2e4d' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M19.5 15c.2 1.7 1 2.5 2.7 2.7-1.7.2-2.5 1-2.7 2.7-.2-1.7-1-2.5-2.7-2.7 1.7-.2 2.5-1 2.7-2.7z' fill='%23fff' stroke='%233a2e4d' stroke-width='1.2'/%3E%3C/svg%3E") center / contain no-repeat; width: 14px; height: 14px; position: absolute; left: 2px; top: 1px; z-index: 2; }
.stamps button { position: relative; }
.shiny-toggle { align-self: flex-start; border: 2px solid var(--edge); background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 14.5px; }
.shiny-toggle[aria-pressed="true"] { background: linear-gradient(110deg, #ffd9ec, #d9f0ff, #fff3c4, #e9dcff); box-shadow: 0 2px 0 var(--edge); }
.pack-badge.shiny { background: linear-gradient(110deg, #ffd9ec, #d9f0ff, #fff3c4); color: #7a4d9a; }
.prize-shiny { background: linear-gradient(160deg, #fff7fb, #f1f8ff 50%, #fffbe8); }
@media (prefers-reduced-motion: reduce) { .foil, .twinkle { animation: none; } }

/* First-edition ribbon */
.item.fe { position: relative; }
.item.fe::before {
  content: attr(data-fe); position: absolute; left: -4px; top: -6px; z-index: 2;
  background: #ffd36b; color: #6b4a1a; font-size: 10px; font-weight: 700; letter-spacing: .3px;
  padding: 1px 6px; border-radius: 6px; border: 1.5px solid var(--edge); transform: rotate(-8deg); white-space: nowrap;
}

/* ---------- collect from a friend ---------- */
.collect {
  max-width: 460px; margin: 28px auto 0; text-align: center; padding: 14px 18px 16px; position: relative;
  background: #fff1f6; border: 2.5px dashed #ff8fb4; border-radius: 20px; animation: viewIn .4s both;
}
.collect p { margin: 0 0 10px; font-weight: 500; }
.collect-items { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.collect-items .item { width: 80px; }
.collect-items .item-scene { width: 110px; }
.collect-items .item-sticker { width: auto; font-size: 34px; }

/* ---------- send / receive ---------- */
.headline { text-align: center; font-size: clamp(24px, 4.5vw, 34px); font-weight: 600; margin: 18px 0 4px; min-height: 1.3em; }
.sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 17px; min-height: 1.4em; }
.share { max-width: 560px; margin: 34px auto 0; text-align: center; background: var(--card); border: 2.5px solid var(--edge); border-radius: 24px; padding: 20px 22px; box-shadow: 5px 6px 0 var(--edge); animation: viewIn .4s both; }
.share-lead { margin: 0; font-size: 17px; }
.linkbox { display: flex; gap: 8px; margin: 14px 0 0; }
.linkbox input { flex: 1; min-width: 0; border: 2px solid var(--edge); border-radius: 12px; padding: 10px 12px; background: #fff; font-size: 14px; color: var(--muted); }
.unsend-row { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sent-links { max-width: 760px; margin: 22px auto 0; padding: 14px 20px; border: 2px solid var(--edge); border-radius: 16px; background: #fffaf3; }
.sent-links summary { cursor: pointer; font-weight: 600; }
.sent-links > p { font-size: 14px; margin: 8px 0 4px; }
.sent-links ul { list-style: none; margin: 0; padding: 0; }
.sent-links li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1.5px dashed #e4d6c4; font-size: 15px; }
.sent-links li:first-child { border-top: 0; }
.warn { font-size: 14px; background: #fff4c2; border-radius: 12px; padding: 10px 12px; margin: 12px 0 0; text-align: left; line-height: 1.45; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.send-row { margin-top: 14px; }
.send-row a.btn { text-decoration: none; }
#recv-actions { margin-top: 34px; }

.burst { position: absolute; left: 50%; top: 45%; font-size: 24px; pointer-events: none; z-index: 5; animation: burst 1.2s cubic-bezier(.2, .8, .3, 1) forwards; }
@keyframes burst {
  from { transform: translate(-50%, -50%) scale(.3); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(1); opacity: 0; }
}

/* ---------- my album: a cloth binder with cream pages ---------- */
.album { max-width: 1000px; margin: 0 auto; }
.album-cover {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: #f4eee0;
  background: #2f5a46; border: 2.5px solid var(--edge); border-radius: 18px 18px 6px 6px; padding: 12px 20px; box-shadow: 4px 5px 0 var(--edge);
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .03) 0 2px, transparent 2px 5px);
}
.album-title { font-family: Georgia, 'Times New Roman', serif; letter-spacing: 2px; font-size: 18px; }
.album-cover #col-total { margin-left: auto; font-weight: 500; }
.album-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 14px 2px 8px; scrollbar-width: thin; }
.album-tab { flex: none; border: 2px solid var(--edge); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13.5px; font-weight: 500; }
.album-tab[aria-selected="true"] { background: var(--pink-soft); box-shadow: 0 2px 0 var(--edge); }
.album-tab.live::after { content: ' ●'; color: #d43f7a; font-size: 10px; vertical-align: 1px; }
.album-book { display: flex; align-items: center; gap: 10px; }
.album-nav { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--edge); background: #fff; font-size: 24px; line-height: 1; box-shadow: 0 2px 0 var(--edge); }
.album-nav:disabled { opacity: .3; cursor: default; box-shadow: none; }
.album-spread {
  flex: 1; display: grid; grid-template-columns: 1fr 1fr; min-height: 440px; padding: 12px; perspective: 1600px; touch-action: pan-y;
  background: #3d6b57; border: 2.5px solid var(--edge); border-radius: 10px; box-shadow: 4px 5px 0 var(--edge);
}
.album-page { background: var(--noise), #f6f0e2; padding: 18px 18px 22px; display: flex; flex-direction: column; gap: 10px; }
.album-page.left { border-radius: 4px 0 0 4px; box-shadow: inset -16px 0 18px -14px rgba(60, 40, 20, .4), inset 0 0 18px rgba(120, 95, 60, .12); }
.album-page.right { border-radius: 0 4px 4px 0; box-shadow: inset 16px 0 18px -14px rgba(60, 40, 20, .4), inset 0 0 18px rgba(120, 95, 60, .12); }
@media (max-width: 720px) {
  .album-spread { grid-template-columns: 1fr; }
  .album-page.left, .album-page.right { border-radius: 4px; box-shadow: inset 0 0 18px rgba(120, 95, 60, .12); }
  .album-nav { width: 32px; height: 32px; font-size: 20px; }
}
.turn-next .album-page { animation: pageNext .45s ease both; }
.turn-prev .album-page { animation: pagePrev .45s ease both; }
.turn-next .album-page.right, .turn-prev .album-page.right { animation-delay: .06s; }
@keyframes pageNext { from { transform: rotateY(-28deg) translateX(30px); opacity: 0; } }
@keyframes pagePrev { from { transform: rotateY(28deg) translateX(-30px); opacity: 0; } }
.page-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.page-head h3 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: 21px; font-weight: 400; color: #4a3b2a; }
.page-head .pack-count { margin-left: auto; }
.page-label { font-family: Georgia, 'Times New Roman', serif; font-size: 11.5px; letter-spacing: 2px; text-transform: uppercase; color: #9b8a6c; border-bottom: 1px solid #e2d6bd; padding-bottom: 3px; margin-top: 4px; }
.page-note { margin: 0; font-size: 13px; color: #9b8a6c; font-style: italic; }
.stamp-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 14px; }
.photo-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; padding: 4px; }
.sticker-sheet { display: flex; flex-wrap: wrap; gap: 6px; background: #fff; border-radius: 8px; padding: 8px; box-shadow: 0 1px 3px rgba(60, 40, 20, .2); }
.slot { position: relative; border: 0; background: none; padding: 8px 6px 6px; cursor: pointer; border-radius: 4px; transition: transform .15s; }
.slot:hover { transform: translateY(-2px) rotate(-1deg); }
.slot.empty { outline: 2px dashed #cbbf9f; outline-offset: -2px; }
.slot-stamp::before {
  content: ''; position: absolute; top: 2px; left: 50%; width: 30px; height: 10px; margin-left: -15px; z-index: 2;
  background: rgba(255, 255, 255, .7); border: 1px solid rgba(160, 140, 110, .35);
}
.slot.empty::before { display: none; }
.item.ghost { filter: grayscale(1); opacity: .22; }
.slot-shiny::after { content: ''; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 2c.7 5 3 7.3 8 8-5 .7-7.3 3-8 8-.7-5-3-7.3-8-8 5-.7 7.3-3 8-8z' fill='%23ffd34d' stroke='%233a2e4d' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M19.5 15c.2 1.7 1 2.5 2.7 2.7-1.7.2-2.5 1-2.7 2.7-.2-1.7-1-2.5-2.7-2.7 1.7-.2 2.5-1 2.7-2.7z' fill='%23fff' stroke='%233a2e4d' stroke-width='1.2'/%3E%3C/svg%3E") center / contain no-repeat; width: 15px; height: 15px; position: absolute; right: 2px; bottom: 2px; }
.slot-photo { padding: 0; }
.slot-photo .item-scene { border: 0; border-radius: 1px; box-shadow: 0 2px 5px rgba(60, 40, 20, .3); }
.slot-photo .corner { position: absolute; width: 16px; height: 16px; background: #3a2e4d; opacity: .85; }
.corner.tl { top: -4px; left: -4px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.corner.tr { top: -4px; right: -4px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.corner.bl { bottom: -4px; left: -4px; clip-path: polygon(0 0, 0 100%, 100% 100%); }
.corner.br { bottom: -4px; right: -4px; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.slot-photo.empty .corner { display: none; }
.slot-sticker { padding: 4px 6px; }
.slot-sticker .item-sticker { font-size: 30px; }
.slot-tape { padding: 8px 4px; }
.slot-tape .tape-item { width: 70px; height: 20px; font-size: 10px; }
.album-pageno { text-align: center; color: var(--muted); font-size: 13px; margin: 10px 0 0; }

/* ---------- zoomed album item ---------- */
.item-zoom { position: fixed; inset: 0; z-index: 60; background: rgba(40, 30, 50, .45); display: grid; place-items: center; padding: 20px; }
.zoom-card { position: relative; width: 100%; max-width: 360px; text-align: center; background: var(--card); border: 2.5px solid var(--edge); border-radius: 22px; box-shadow: 5px 6px 0 var(--edge); padding: 24px 24px 20px; animation: prizeIn .4s both; }
.zoom-art .item { width: 100%; }
.zoom-art .item-stamp { max-width: 180px; }
.zoom-art .item-sticker { font-size: 96px; }
.zoom-art .tape-item { width: 200px; height: 56px; font-size: 28px; }
#zoom-name { margin: 14px 0 4px; font-size: 19px; font-weight: 600; }
#zoom-meta { margin: 0; white-space: pre-line; color: var(--muted); font-size: 14px; line-height: 1.5; }
.zoom-close { position: absolute; top: 6px; right: 12px; border: 0; background: none; font-size: 26px; color: var(--muted); }

/* ---------- corkboard ---------- */
.board-hint { text-align: center; color: var(--muted); margin: -6px 0 14px; }
.corkboard {
  container-type: inline-size; position: relative; min-height: 320px; overflow: hidden;
  border: 7px solid #8a6440; border-radius: 16px; box-shadow: 4px 5px 0 var(--edge), inset 0 0 34px rgba(60, 35, 10, .35);
  background: radial-gradient(rgba(90, 55, 20, .28) 1px, transparent 1.7px) 0 0 / 9px 9px, radial-gradient(rgba(255, 240, 210, .2) 1px, transparent 1.7px) 4px 5px / 11px 11px, #c99a6b;
}
.corkboard.empty { display: grid; place-items: center; min-height: 260px; }
.board-empty { color: #fff8ec; font-size: 18px; font-weight: 500; text-align: center; padding: 20px; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.board-item { position: absolute; transform: translate(-50%, -50%) rotate(var(--r)); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; transition: transform .15s; }
.board-item:hover { transform: translate(-50%, -50%) rotate(var(--r)) scale(1.03); }
.board-item.dragging { cursor: grabbing; transform: translate(-50%, -50%) rotate(0deg) scale(1.06); z-index: 10; transition: none; }
.board-postcard { width: 30cqw; }
.board-postcard .postcard { pointer-events: none; }
.board-note { width: 18cqw; }
.mini-fold {
  position: relative; aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--noise), var(--paper); border-radius: 2px; box-shadow: 0 .8cqw 1.6cqw rgba(40, 25, 10, .35);
  font-family: var(--hand); color: var(--pen);
}
.mini-fold::before { content: ''; position: absolute; left: 0; right: 0; top: 33%; height: 1px; background: rgba(0, 0, 0, .09); }
.mini-fold::after { content: ''; position: absolute; left: 0; right: 0; top: 66%; height: 1px; background: rgba(0, 0, 0, .09); }
.mini-for { font-size: 2.2cqw; opacity: .7; line-height: 1; }
.mini-name { font-size: 3.4cqw; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-seal { position: absolute; bottom: -1.6cqw; font-size: 4cqw; line-height: 1; }
.mini-seal.tape { width: 10cqw; height: 3cqw; font-size: 1.4cqw; bottom: -1.2cqw; transform: rotate(-6deg); }
.board-pin { position: absolute; top: -.8cqw; left: 50%; width: 2.4cqw; height: 2.4cqw; margin-left: -1.2cqw; border-radius: 50%; z-index: 3; box-shadow: inset -.3cqw -.3cqw 0 rgba(0, 0, 0, .25), 0 .4cqw .6cqw rgba(0, 0, 0, .35); }
.board-unpin {
  position: absolute; top: -14px; right: -14px; width: 28px; height: 28px; border-radius: 50%; z-index: 4;
  border: 2px solid var(--edge); background: #fff; font-size: 16px; line-height: 1; opacity: 0; transition: opacity .15s;
}
.board-item:hover .board-unpin, .board-unpin:focus-visible { opacity: 1; }
@media (hover: none) { .board-unpin { opacity: .9; } }
@media (max-width: 600px) { .board-postcard { width: 40cqw; } .board-note { width: 26cqw; } }
.board-mini { position: relative; width: 54px; height: 44px; flex: none; border-radius: 6px; background: #c99a6b; border: 3px solid #8a6440; }
.board-mini i { position: absolute; width: 16px; height: 12px; background: #fdeef2; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.board-mini i:nth-child(1) { left: 5px; top: 6px; transform: rotate(-8deg); }
.board-mini i:nth-child(2) { left: 25px; top: 5px; transform: rotate(6deg); background: #f2c14e; }
.board-mini i:nth-child(3) { left: 14px; top: 21px; transform: rotate(4deg); background: #e2e6ee; }

/* ---------- downloads: off-screen copy for images, and print pages ---------- */
.export-sheet { position: fixed; left: -12000px; top: 0; width: 900px; padding: 40px; background: #fbf1e4; display: flex; flex-direction: column; gap: 36px; }
.export-sheet .pc-inner, .print-page .pc-inner { transform: none !important; transition: none !important; }
.export-front .pc-back, .export-back .pc-front, .print-front .pc-back, .print-back .pc-front { display: none; }
.export-back .pc-back, .print-back .pc-back { transform: none; }
.export-sheet .postmark, .print-page .postmark { animation: none !important; opacity: 1; }
/* The image library can't draw the SVG paper-grain texture (it comes out black), so the saved copy skips it. */
.export-sheet .pc-back { background-image: radial-gradient(rgba(150, 120, 80, .06) 1px, transparent 1.2px); background-size: 1.6cqw 1.6cqw; }
.export-sheet .sheet, .export-sheet .face.back { background: var(--paper); }
.export-sheet .pc-front::before { display: none; }
.export-note .sheet { border-radius: 1cqw; box-shadow: 0 1.6cqw 4.5cqw rgba(58, 46, 77, .16); }
#print-root { display: none; }
@media print {
  html, body { background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-page { width: 6in; height: 4in; overflow: hidden; break-after: page; page-break-after: always; }
  .print-page .postcard { width: 6in; }
  .print-page .pc-face { border-radius: 0; box-shadow: none; }
  .print-note-page { display: flex; justify-content: center; }
  .print-note-page .paper-box { width: 5.5in; }
}

@media (prefers-reduced-motion: reduce) {
  .fold-wrap.waiting { animation: none; }
  .view.active, .tab-panel { animation: none; }
}

/* Footer: copyright + trademark, small and soft (same feel as the other app's footer). */
.site-foot { text-align: center; padding: 8px 16px 28px; color: var(--ink); opacity: .6; font-size: .72rem; font-weight: 600; letter-spacing: .02em; }
.site-foot p { margin: 2px 0; }
@media print { .site-foot { display: none; } }

/* Launch: the capsule machine wears a little "Coming soon" paper tag until the drops are ready. */
.soon-tag { position: absolute; left: 50%; top: 92px; transform: translateX(-50%) rotate(-7deg); transform-origin: 50% -26px; animation: soon-sway 3.2s ease-in-out infinite; pointer-events: none; }
.soon-tag::before { content: ''; position: absolute; left: 50%; top: -26px; width: 2px; height: 28px; background: var(--edge); transform: translateX(-50%); border-radius: 2px; }
.soon-tag span { position: relative; display: block; padding: 9px 16px 9px 26px; background: #fff6d6; color: var(--edge); border: 2.5px solid var(--edge); border-radius: 6px 14px 14px 6px; box-shadow: 0 3px 0 var(--edge); font: 600 15px/1 Fredoka, sans-serif; letter-spacing: .02em; white-space: nowrap; }
.soon-tag span::before { content: ''; position: absolute; left: 9px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--card); border: 2px solid var(--edge); }
@keyframes soon-sway { 0%, 100% { transform: translateX(-50%) rotate(-7deg); } 50% { transform: translateX(-50%) rotate(-2deg); } }
@media (prefers-reduced-motion: reduce) { .soon-tag { animation: none; } }

/* Easy card picker: chips (All / Favorites / Recent / each style) over a grid of the cards you own. */
.pick-chips { display: flex; gap: 6px; overflow-x: auto; width: 0; min-width: 100%; /* scroll inside the panel; never widen it */ padding: 2px 2px 8px; margin-bottom: 4px; scrollbar-width: thin; }
.pick-chip { flex: none; border: 2px solid var(--edge); background: #fff; color: var(--ink); border-radius: 999px; padding: 5px 11px; font: 500 13px/1.1 inherit; font-family: inherit; white-space: nowrap; cursor: pointer; }
.pick-chip[aria-pressed="true"] { background: var(--pink-soft); box-shadow: 0 2px 0 var(--edge); }
.pick-cell { position: relative; min-width: 0; }
.pick-cell > button:first-child { width: 100%; }
.pick-grid .pick-fav { all: unset; position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .88); box-shadow: 0 0 0 1.5px var(--edge); display: grid; place-items: center; cursor: pointer; z-index: 3; }
.pick-grid .pick-fav svg { width: 13px; height: 13px; fill: none; stroke: var(--edge); stroke-width: 2.2; }
.pick-grid .pick-fav.on svg { fill: var(--pink); stroke: var(--edge); }
.pick-grid .pick-fav:focus-visible { box-shadow: 0 0 0 1.5px var(--edge), 0 0 0 4px var(--pink-soft); }
.stamps.pick-grid .pick-fav { top: -2px; right: -2px; }
.pick-more { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }

/* Drawn stickers and wax seals (art/stickers, art/seals): the image sizes itself from the font size each
   spot already used for emoji, so stickers, seals, tray buttons and album slots keep their old sizes. */
.has-art { line-height: 0; }
.has-art > .art-img { width: 1.25em; height: 1.25em; display: block; object-fit: contain; pointer-events: none; -webkit-user-drag: none; user-select: none; }
.item-sticker.has-art > .art-img { margin: 0 auto; }
.tray button.has-art > .art-img { width: 30px; height: 30px; }

/* Drawn line icons for buttons and tabs (the #i-* symbols in index.html). Ink colour follows the text. */
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.22em; margin-right: .32em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico.end { margin: 0 0 0 .32em; }

/* Toast with a button (Undo after removing a keepsake): clickable while it shows. */
#toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; }
.toast-action { border: 0; background: var(--pink); color: var(--ink); font: inherit; font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.toast-action:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
