/* Fonts bundled locally so the app works on any Wi-Fi (Google Fonts, OFL / Apache licences) */
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/cormorant.woff) format("woff"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/cormorant-italic.woff) format("woff"); font-weight: 300 700; font-style: italic; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url(fonts/dmsans.woff) format("woff"); font-weight: 100 1000; font-style: normal; font-display: swap; }
@font-face { font-family: "La Belle Aurore"; src: url(fonts/labelleaurore.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Pinyon Script"; src: url(fonts/pinyon.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Special Elite"; src: url(fonts/specialelite.woff) format("woff"); font-display: swap; }
/* Memory Exchange — built from the Figma hi-fi (iPhone 17 Pro, 402 × 874 pt) */
:root {
  --bg: #f2ede2; --card: #fbf7ee; --line: #d2c6ae; --ink: #3a2f28; --muted: #6e6360;
  --burg: #7a3340; --navy: #2b3f6b; --blush: #e6d2ce; --sage: #a9bc98; --sage-ink: #33452b;
  --tan: #d9c7a3; --paper: #e4d5b1; --pcback: #f7f1e3; --pblue: #4b6fa8; --air-red: #a8392e; --air-blue: #2b4c8c;
  --scrim: rgba(30, 20, 15, .45);
  --serif: "Cormorant Garamond", Georgia, serif; --sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --script: "Pinyon Script", cursive; --hand: "La Belle Aurore", cursive; --type: "Special Elite", "Courier New", monospace;
  --safe-top: max(env(safe-area-inset-top), 14px); --safe-bot: env(safe-area-inset-bottom);
  --ease: cubic-bezier(.22, .9, .25, 1); --spring: cubic-bezier(.34, 1.4, .5, 1);
  --pola-shadow: 0 2px 3px rgba(40, 25, 10, .16), 0 6px 14px rgba(40, 25, 10, .14);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
img { display: block; }

/* ================= iPhone 17 Pro frame (desktop / laptop only) ================= */
.stagefloor { height: 100dvh; width: 100%; }
.phone { position: relative; width: 100%; height: 100%; }
.glass { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--bg); }
.statusbar, .island, .homebar, .pbtn { display: none; }
.app { position: absolute; inset: 0; }

@media (min-width: 620px) and (min-height: 600px) {
  body { background: radial-gradient(120% 90% at 50% 20%, #efe7da 0%, #ded3c1 70%, #d4c7b2 100%); }
  .stagefloor { position: relative; overflow: hidden; }
  .phone {
    position: absolute; left: 50%; top: 50%; margin: -449px 0 0 -213px;
    width: 426px; height: 898px; flex: none; border-radius: 74px; padding: 12px;
    /* aluminium unibody in Deep Blue */
    background: linear-gradient(145deg, #4a5a78 0%, #2d3a55 28%, #1f2a40 55%, #34425f 80%, #56678a 100%);
    box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18), inset 0 0 0 4px #1a2236, 0 1px 0 rgba(255,255,255,.4), 0 40px 80px -20px rgba(40, 25, 10, .45), 0 18px 30px rgba(40, 25, 10, .18);
    transform-origin: 50% 50%;
  }
  .phone::before { /* black display border */
    content: ""; position: absolute; inset: 5px; border-radius: 69px; background: #050608; pointer-events: none;
  }
  .glass { width: 402px; height: 874px; border-radius: 62px; z-index: 1; }
  :root { --safe-top: 56px; --safe-bot: 18px; }
  .statusbar { display: flex; position: absolute; z-index: 40; top: 0; left: 0; right: 0; height: 54px; align-items: center; justify-content: space-between; padding: 6px 30px 0 46px; pointer-events: none; }
  .statusbar b { font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--ink); }
  .island { display: block; position: absolute; z-index: 41; top: 11px; left: 50%; transform: translateX(-50%); width: 126px; height: 37px; border-radius: 19px; background: #000; pointer-events: none; }
  .island::after { content: ""; position: absolute; right: 22px; top: 13px; width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #2a3550 0%, #0b0f18 60%); }
  .homebar { display: block; position: absolute; z-index: 41; bottom: 8px; left: 50%; transform: translateX(-50%); width: 134px; height: 5px; border-radius: 3px; background: var(--ink); opacity: .9; pointer-events: none; }
  .pbtn { display: block; position: absolute; width: 4px; border-radius: 2px; background: linear-gradient(90deg, #1c2538, #4f5f80 60%, #2a364f); }
  .pbtn.l { left: -3px; } .pbtn.r { right: -3px; background: linear-gradient(270deg, #1c2538, #4f5f80 60%, #2a364f); }
  .pbtn.action { top: 172px; height: 34px; } .pbtn.vup { top: 236px; height: 62px; } .pbtn.vdn { top: 312px; height: 62px; }
  .pbtn.power { top: 262px; height: 96px; } .pbtn.cam { top: 560px; height: 58px; width: 3px; right: -2px; background: linear-gradient(270deg, #10151f, #3b4866); }
  .is-blush .statusbar b { color: var(--ink); }
}

/* ================= screens ================= */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); will-change: transform; }
.screen.blush { background: var(--blush); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-top: var(--safe-top); -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { display: none; }
.top { padding-top: var(--safe-top); flex: none; }
.pad { padding-left: 20px; padding-right: 20px; }

.hdr { display: flex; align-items: flex-start; justify-content: space-between; padding: 8px 20px 0; min-height: 52px; gap: 10px; }
.hdr-right { display: flex; align-items: center; gap: 10px; }
.title-script { font-family: var(--script); font-size: 48px; line-height: 50.4px; color: var(--burg); margin: 0; font-weight: 400; }
.title-serif { font-family: var(--serif); font-weight: 500; font-size: 36px; line-height: 37.8px; margin: 0; }
.hand { font-family: var(--hand); color: var(--navy); font-size: 16px; line-height: 22.4px; }
.hand-line { padding: 0 20px 8px; }
.avatar { width: 36px; height: 36px; border-radius: 18px; background: var(--blush); border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 500; flex: none; }
.hpill { height: 34px; border-radius: 17px; background: var(--burg); color: #fff; display: inline-flex; align-items: center; gap: 5px; padding: 0 13px 0 10px; font-size: 13px; font-weight: 500; white-space: nowrap; transition: transform .15s; }
.hpill:active, .btn:active, .chip:active, .opt:active { transform: scale(.97); }

.navbar { position: relative; height: 48px; display: flex; align-items: center; padding: 0 20px; flex: none; }
.navbar .back { width: 26px; height: 26px; display: grid; place-items: center; margin-left: -2px; }
.navbar .back.with-label { width: auto; display: flex; gap: 2px; color: var(--burg); font-size: 15px; }
.navbar .label { position: absolute; left: 50%; transform: translateX(-50%); font-family: var(--serif); font-weight: 600; font-size: 12px; letter-spacing: .24em; text-transform: uppercase; white-space: nowrap; }
.navbar .next { margin-left: auto; color: var(--burg); font-weight: 500; font-size: 15px; }
.navbar .next[disabled] { opacity: .35; }
.hint { font-family: var(--hand); color: var(--navy); font-size: 15px; line-height: 19.5px; padding: 0 20px 8px; margin-top: -4px; }

.sec { display: flex; align-items: baseline; justify-content: space-between; padding-top: 6px; }
.sec h3 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; }
.sec .link { font-size: 12px; color: var(--burg); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; align-items: center; gap: 14px; }
.card .t { font-family: var(--serif); font-weight: 500; font-size: 20px; line-height: 23px; }
.card .s { font-size: 13px; line-height: 18.2px; color: var(--muted); }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; border-radius: 26px; background: var(--burg); color: #fff; font-weight: 500; font-size: 16px; transition: transform .15s, opacity .2s; }
.btn.outline { background: transparent; color: var(--burg); border: 1.5px solid var(--burg); }
.btn.small { width: auto; height: 38px; padding: 0 16px; font-size: 14px; }
.btn[disabled] { opacity: .45; }
.cta { padding: 12px 20px calc(var(--safe-bot) + 18px); display: flex; flex-direction: column; gap: 10px; flex: none; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.seg { display: flex; gap: 10px; padding: 10px 20px 12px; border-bottom: 1px solid var(--line); flex: none; }
.chip { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: background .2s, color .2s, transform .15s; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.tabbar { flex: none; height: calc(65px + var(--safe-bot)); min-height: 65px; padding: 8px 6px var(--safe-bot); border-top: 1px solid var(--line); background: var(--bg); display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 5; }
.tab { width: 64px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 10.5px; line-height: 14.7px; position: relative; padding-top: 13px; transition: color .2s; }
.tab.on { color: var(--burg); }
.tab svg { width: 24px; height: 24px; }
.tab .count { position: absolute; top: 10px; right: 12px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--burg); color: #fff; font-size: 10px; font-weight: 500; line-height: 16px; text-align: center; padding: 0 5px; }
.tab-plus { width: 50px; height: 50px; border-radius: 25px; background: var(--burg); display: grid; place-items: center; margin-top: -3px; box-shadow: 0 4px 10px rgba(122, 51, 64, .35); transition: transform .2s var(--spring); }
.tab-plus:active { transform: scale(.9) rotate(45deg); }

/* polaroid — box-shadow keeps photos sharp (no filter re-rasterising) */
.pola { position: relative; background: #fff; padding: 6px 6px 24px; box-shadow: var(--pola-shadow); }
.pola .ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #ddd; display: block; }
.pola .cap { position: absolute; left: 8px; bottom: 3px; font-family: var(--hand); color: var(--navy); font-size: 12px; line-height: 14.4px; white-space: nowrap; max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; }

.recent { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 4px 2px 8px; }
.recent .pola .ph { aspect-ratio: 100 / 75; }
.tilt-l { transform: rotate(-3deg); } .tilt-r { transform: rotate(3deg); } .tilt-s { transform: rotate(-2deg); }

/* sheet */
.scrim { position: absolute; inset: 0; background: var(--scrim); z-index: 30; animation: fade .25s ease; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--bg); border-radius: 24px 24px 0 0; padding: 12px 20px calc(var(--safe-bot) + 26px); display: flex; flex-direction: column; gap: 10px; animation: up .38s var(--ease); max-height: 88%; overflow-y: auto; }
.sheet.closing { animation: down .22s ease forwards; } .scrim.closing { animation: fadeout .22s ease forwards; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes down { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } } @keyframes fadeout { to { opacity: 0; } }
.grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 6px; flex: none; }
.sheet h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 26px; line-height: 27.3px; }
.opt { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 13px; display: flex; gap: 14px; align-items: center; text-align: left; width: 100%; transition: transform .15s; }
.opt .ic { width: 42px; height: 42px; border-radius: 21px; display: grid; place-items: center; flex: none; }
.opt b { display: block; font-family: var(--serif); font-weight: 500; font-size: 19px; line-height: 20.9px; }
.opt span { font-size: 12px; color: var(--muted); line-height: 16.8px; }
.field { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; font-family: var(--hand); color: var(--navy); font-size: 20px; outline: none; }
.field:focus { border-color: var(--burg); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.dot.on { box-shadow: 0 0 0 2px var(--burg); }
.lbl { font-family: var(--serif); font-weight: 600; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; margin-top: 4px; }
.preview-text { min-height: 54px; display: grid; place-items: center; background: var(--paper); border-radius: 12px; padding: 8px; overflow: hidden; }

/* memories */
.polagrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 14px; padding: 14px 22px 24px; }
.polagrid .pola { padding-bottom: 22px; }
.polagrid .pola .ph { aspect-ratio: 145 / 118; }
.polagrid > :nth-child(4n+1) { transform: rotate(-3deg); } .polagrid > :nth-child(4n+2) { transform: rotate(3deg) translateY(14px); }
.polagrid > :nth-child(4n+3) { transform: rotate(2deg); } .polagrid > :nth-child(4n+4) { transform: rotate(-3deg) translateY(10px); }
.collections { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 18px; padding: 18px 20px 24px; }
.coll .stackp { position: relative; height: 130px; }
.coll .stackp .pola { position: absolute; width: 104px; padding: 5px 5px 16px; }
.coll .stackp .pola:nth-child(1) { left: 0; top: 18px; transform: rotate(-4deg); } .coll .stackp .pola:nth-child(2) { left: 56px; top: 0; transform: rotate(4deg); }
.coll b { display: block; font-family: var(--serif); font-weight: 500; font-size: 20px; margin-top: 10px; }
.coll span { font-size: 13px; color: var(--muted); }
.coll.new .stackp { border: 1.5px dashed var(--burg); border-radius: 12px; display: grid; place-items: center; font-size: 28px; color: var(--burg); height: 125px; }

.picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 8px 20px 20px; }
.pick { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #ddd; transition: transform .2s var(--spring); }
.pick:active { transform: scale(.95); }
.pick img, .pick video { width: 100%; height: 100%; object-fit: cover; }
.pick .ring { position: absolute; top: 6px; right: 6px; width: 23px; height: 23px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(100,18,35,.6); display: grid; place-items: center; transition: background .2s; }
.pick .ring.on { background: var(--burg); }
.pick.upload { border: 2px dashed var(--burg); background: transparent; color: var(--burg); font-size: 13px; line-height: 16.9px; display: grid; place-items: center; text-align: center; }
.pick .vid { position: absolute; left: 6px; bottom: 6px; font-size: 10px; color: #fff; background: rgba(0,0,0,.45); border-radius: 6px; padding: 1px 6px; }

/* ================= stage (scrapbook + postcard front) ================= */
.stage-area { flex: 1; min-height: 0; position: relative; padding: 4px 20px 10px; }
.stage-box { position: relative; width: 100%; height: 100%; }
.stage-box.wfit { height: auto; aspect-ratio: 362 / 540; }
.stage { position: absolute; left: 0; top: 0; width: 362px; height: 540px; transform-origin: 0 0; transform: translate(var(--ox, 0px), 0) scale(var(--s, 1)); }
.stage[data-stage] { touch-action: none; }
.stage > svg.paper { position: absolute; inset: 0; width: 362px; height: 540px; transition: fill .4s; }
.stage.armed { cursor: copy; }
.stage.armed::after, .stage.drop::after { content: ""; position: absolute; inset: 0; border: 2px dashed var(--burg); border-radius: 6px; opacity: .55; pointer-events: none; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .2; } }
.it { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; user-select: none; -webkit-user-select: none; touch-action: none; will-change: transform; }
.it .pola .ph { aspect-ratio: auto; }
.it img.stk { width: 100%; height: auto; pointer-events: none; filter: drop-shadow(0 1.5px 1.5px rgba(60, 40, 20, .18)); }
.it.pop { animation: pop .35s var(--spring); }
@keyframes pop { from { scale: .4; opacity: 0; } }
.sel-ui { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 20; }
.sel-ui .box { position: absolute; border: 1.5px dashed rgba(122, 51, 64, .8); border-radius: 4px; }
.sel-ui .h { position: absolute; pointer-events: auto; border-radius: 50%; background: #fff; border: 1.5px solid var(--burg); display: grid; place-items: center; color: var(--burg); box-shadow: 0 2px 6px rgba(40,25,10,.25); touch-action: none; }
.sel-ui .h svg { width: 60%; height: 60%; }
.sel-ui .h.del { background: var(--burg); color: #fff; }
.pmark { background: rgba(242, 237, 226, .85); border: 2px solid var(--pblue); border-radius: 3px; padding: 5px 10px 6px; font-family: var(--type); color: var(--pblue); font-size: 11px; line-height: 14.3px; white-space: nowrap; }
.st-good { background: var(--sage); border: 3px solid #fff; border-radius: 6px; padding: 10px 14px; font-family: var(--type); color: var(--sage-ink); font-size: 14px; line-height: 14px; white-space: nowrap; box-shadow: 0 2px 4px rgba(60, 40, 20, .2); }
.st-note { background: var(--card); border: 3px solid #fff; border-radius: 22px; padding: 4px 18px 8px; font-family: var(--script); font-size: 26px; line-height: 30px; white-space: nowrap; box-shadow: 0 2px 4px rgba(60, 40, 20, .2); }
.st-ribbon { background: var(--burg); color: #fff; padding: 7px 22px; font-family: var(--serif); font-weight: 600; letter-spacing: .18em; font-size: 13px; text-transform: uppercase; white-space: nowrap; clip-path: polygon(0 0, 100% 0, 92% 50%, 100% 100%, 0 100%, 8% 50%); }
.st-text { white-space: pre; text-align: center; }
.f-pen { font-family: var(--hand); font-size: 22px; line-height: 26.4px; }
.f-script { font-family: var(--script); font-size: 30px; line-height: 34px; }
.f-typed { font-family: var(--type); font-size: 15px; line-height: 20px; }

/* helper bar above the tray */
.helper { flex: none; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 6px 16px; border-top: 1px solid var(--line); background: var(--card); font-size: 13px; color: var(--muted); line-height: 17px; }
.helper .steps { display: flex; gap: 10px; align-items: center; flex: 1; flex-wrap: wrap; }
.helper .n { width: 18px; height: 18px; border-radius: 9px; background: var(--burg); color: #fff; font-size: 11px; display: inline-grid; place-items: center; margin-right: 5px; font-weight: 500; flex: none; }
.helper .act { display: flex; gap: 6px; flex: 1; justify-content: space-between; }
.helper .act button { height: 32px; padding: 0 11px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
.helper .act button.primary { background: var(--burg); color: #fff; border-color: var(--burg); }
.helper .act button.danger { color: var(--burg); }
.helper .armed-msg { flex: 1; color: var(--burg); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.helper .armed-msg img, .helper .armed-msg .mini-l { height: 26px; width: auto; }

.tray { flex: none; border-top: 1px solid var(--line); background: var(--bg); height: 96px; overflow-x: auto; overflow-y: hidden; display: flex; align-items: center; gap: 22px; padding: 0 20px; scrollbar-width: none; touch-action: pan-x; }
.tray::-webkit-scrollbar { display: none; }
.tray .ts { flex: none; display: grid; place-items: center; position: relative; padding: 6px; border-radius: 14px; transition: transform .25s var(--spring), background .2s; touch-action: pan-x; user-select: none; -webkit-user-select: none; }
.tray .ts img { pointer-events: none; -webkit-user-drag: none; }
.tray .ts.on { background: var(--blush); transform: translateY(-6px) scale(1.06); box-shadow: 0 0 0 1.5px var(--burg); }
.tray .ts .cnt { position: absolute; top: 0; right: -2px; background: var(--burg); color: #fff; font-size: 10px; border-radius: 8px; padding: 1px 5px; }
.tray .make { width: 60px; height: 60px; border-radius: 30px; border: 1.5px dashed var(--burg); color: var(--burg); font-size: 11px; line-height: 13px; text-align: center; }
.ghost { position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none; transform-origin: 50% 50%; filter: drop-shadow(0 10px 14px rgba(40, 25, 10, .3)); }
.tools { flex: none; border-top: 1px solid var(--line); height: calc(83px + var(--safe-bot) - 18px); min-height: 72px; padding: 12px 8px var(--safe-bot); display: flex; justify-content: space-around; align-items: flex-start; background: var(--bg); }
.tool { width: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--burg); font-size: 12px; line-height: 16.8px; transition: transform .15s; }
.tool:active { transform: scale(.92); }
.tool.on { font-weight: 600; }

.coach { position: absolute; z-index: 25; left: 16px; right: 16px; bottom: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 16px 14px; box-shadow: 0 12px 30px rgba(40, 25, 10, .22); animation: up .45s var(--ease); }
.coach h4 { margin: 0 0 8px; font-family: var(--serif); font-weight: 500; font-size: 22px; }
.coach ol { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 13.5px; line-height: 18px; }
.coach li { display: flex; gap: 10px; align-items: flex-start; }
.coach li .n { width: 22px; height: 22px; border-radius: 11px; background: var(--burg); color: #fff; font-size: 12px; display: grid; place-items: center; flex: none; }

/* fields */
.fl { display: block; border-bottom: 1px solid var(--line); padding: 12px 20px 10px; }
.fl small { display: block; font-size: 11px; letter-spacing: .08em; color: var(--muted); line-height: 15.4px; }
.fl input { width: 100%; border: 0; background: transparent; font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 26.4px; padding: 2px 0 0; outline: none; }

/* ================= postcard ================= */
.pc-box { position: relative; display: block; width: 100%; aspect-ratio: 362 / 241; perspective: 1400px; text-align: left; }
.pc-flip { position: absolute; left: 0; top: 0; width: 362px; height: 241px; transform-origin: 0 0; transform: scale(var(--s, 1)); }
.pc-inner { position: absolute; inset: 0; transition: transform .75s var(--ease); transform-style: preserve-3d; }
.pc-inner.flipped { transform: rotateY(180deg); }
.pc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 2px 4px rgba(40,25,10,.14), 0 8px 18px rgba(40,25,10,.16); }
.pc-face.back { transform: rotateY(180deg); }
.pc { position: absolute; inset: 0; background: #fff; overflow: hidden; }
.pc .photo { position: absolute; left: 10px; top: 10px; width: 342px; height: 190px; object-fit: cover; }
.pc .cap { position: absolute; left: 14px; top: 206px; font-family: var(--hand); color: var(--navy); font-size: 18px; line-height: 25.2px; white-space: nowrap; }
.pc.t-polaroid { background: var(--blush); }
.pc.t-polaroid .pola { position: absolute; left: 96px; top: 14px; width: 170px; transform: rotate(-4deg); padding: 7px 7px 30px; }
.pc.t-polaroid .pola .ph { aspect-ratio: 156 / 150; }
.pc.t-polaroid .pola .cap { font-size: 15px; bottom: 6px; left: 10px; top: auto; }
.pc.t-greetings .photo { left: 0; top: 0; width: 362px; height: 241px; }
.pc.t-greetings .grad { position: absolute; left: 0; right: 0; bottom: 0; height: 130px; background: linear-gradient(180deg, rgba(42, 26, 28, 0) 0%, rgba(42, 26, 28, .55) 100%); }
.pc.t-greetings .gf { position: absolute; left: 16px; top: 8px; font-family: var(--script); font-size: 30px; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.pc.t-greetings .gp { position: absolute; left: 14px; bottom: 6px; font-family: var(--serif); font-weight: 600; font-size: 54px; line-height: 1; color: #fff; letter-spacing: .02em; text-transform: uppercase; max-width: 340px; white-space: nowrap; overflow: hidden; }
.pc.t-torn .photo { height: 221px; }
.pc.t-torn .torn { position: absolute; right: 0; bottom: 0; width: 196px; height: 122px; }
.pc.t-torn .cap { left: auto; right: 14px; top: auto; bottom: 8px; }
.pc .stk-layer { position: absolute; inset: 0; width: 362px; height: 241px; }
.stk-layer[data-stage] { touch-action: none; }
.stk-layer.armed { cursor: copy; }
.stk-layer.armed::after, .stk-layer.drop::after { content: ""; position: absolute; inset: 3px; border: 2px dashed #fff; border-radius: 4px; opacity: .85; pointer-events: none; animation: breathe 1.4s ease-in-out infinite; box-shadow: 0 0 0 2px rgba(122,51,64,.5); }
.screen.leaving { z-index: 1; }
.pc-box.editing .pc-flip { transform: none; }
.pcback { position: absolute; inset: 0; background: var(--pcback); overflow: hidden; }
.pcback .lines { position: absolute; inset: 0; }
.pcback .msg { position: absolute; left: 12px; top: 12px; width: 181px; font-family: var(--hand); color: var(--navy); font-size: 17px; line-height: 24px; white-space: pre-wrap; word-wrap: break-word; }
.pcback .msg.f-script { font-family: var(--script); font-size: 21px; line-height: 24px; }
.pcback .msg.f-typed { font-family: var(--type); font-size: 13px; line-height: 24px; }
.pcback .pclabel { position: absolute; left: 212px; top: 12px; font-family: var(--serif); font-weight: 600; font-size: 11px; letter-spacing: .22em; }
.pcback .stampbox { position: absolute; left: 299px; top: 10px; width: 51px; height: 61px; background: #fff; border-radius: 2px; padding: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.pcback .stampbox img { width: 43px; height: 53px; border: 2px dashed #fff; object-fit: cover; }
.pcback .air { position: absolute; left: 213px; top: 43px; width: 69px; height: 24px; background: #fff; border-top: 4px solid var(--air-red); border-bottom: 4px solid var(--air-red); transform: rotate(-3deg); font-size: 8px; font-weight: 500; letter-spacing: .12em; color: var(--air-blue); display: grid; place-items: center; }
.pcback .pm { position: absolute; left: 253px; top: 60px; width: 56px; height: 32px; background: rgba(247, 241, 227, .6); border: 1.5px solid var(--pblue); transform: rotate(-10deg); font-family: var(--type); font-size: 9px; line-height: 11.7px; color: var(--pblue); padding: 2px 4px; text-align: right; overflow: hidden; }
.pcback .addr { position: absolute; left: 212px; width: 138px; height: 21px; border-bottom: 1px solid rgba(58, 47, 40, .45); font-family: var(--hand); color: var(--navy); font-size: 15px; line-height: 18px; white-space: nowrap; overflow: hidden; }

.tpls { display: flex; gap: 14px; overflow-x: auto; padding: 14px 20px 8px; scrollbar-width: none; }
.tpls::-webkit-scrollbar { display: none; }
.tpl { flex: none; width: 83px; text-align: center; font-size: 11px; color: var(--muted); line-height: 15.4px; }
.tpl .mini { width: 83px; height: 55px; position: relative; overflow: hidden; outline: 2px solid transparent; outline-offset: 2px; border-radius: 1px; transition: outline-color .2s; }
.tpl.on .mini { outline-color: var(--burg); }
.tpl.on { color: var(--ink); }
.tpl .mini .pc-flip { transform: scale(.2293); }
.photostrip { display: flex; gap: 8px; overflow-x: auto; padding: 0 20px 4px; scrollbar-width: none; }
.photostrip::-webkit-scrollbar { display: none; }
.photostrip button { flex: none; width: 64px; height: 48px; position: relative; }
.photostrip img { width: 64px; height: 48px; object-fit: cover; }
.photostrip button.on::after { content: ""; position: absolute; inset: -3px; border: 2px solid var(--burg); border-radius: 2px; }
.photostrip .up { border: 1.5px dashed var(--burg); color: var(--burg); font-size: 20px; border-radius: 2px; }
.chips { display: flex; gap: 8px; padding: 8px 20px 0; flex-wrap: wrap; }
.stampsel { display: flex; gap: 12px; padding: 8px 20px; }
.sp { width: 48px; height: 58px; background: #fff; border-radius: 2px; padding: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.2); position: relative; }
.sp img { width: 40px; height: 50px; border: 2px dashed #fff; object-fit: cover; }
.sp.on::after { content: ""; position: absolute; inset: -5px; border: 2px solid var(--burg); border-radius: 4px; }
.msg-input { width: calc(100% - 40px); margin: 10px 20px 0; min-height: 96px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 10px 12px; font-family: var(--hand); font-size: 17px; line-height: 24px; color: var(--navy); outline: none; resize: none; }

.rl { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.rl .who b { display: block; font-family: var(--serif); font-weight: 500; font-size: 20px; line-height: 23px; }
.rl .who span { font-size: 12px; color: var(--muted); }
.rl .ck { margin-left: auto; width: 24px; height: 24px; border-radius: 12px; border: 1.5px solid var(--line); flex: none; transition: background .2s, border-color .2s; }
.rl .ck.on { background: var(--burg); border-color: var(--burg); }
.rl .avatar.dashed { background: transparent; border: 1.5px dashed var(--burg); color: var(--burg); }
.togrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.togrow b { display: block; font-weight: 500; font-size: 15px; line-height: 21px; }
.togrow span { font-size: 12px; color: var(--muted); line-height: 16.8px; }
.tog { width: 50px; height: 30px; border-radius: 15px; background: var(--line); position: relative; flex: none; transition: background .25s; }
.tog::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 12px; background: #fff; transition: transform .3s var(--spring); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.tog.on { background: var(--burg); } .tog.on::after { transform: translateX(20px); }

/* ================= mail ================= */
.mailbox-hero { display: flex; flex-direction: column; align-items: center; padding-top: 44px; position: relative; }
.mb-btn { position: relative; width: 230px; height: 198px; animation: bob 3.2s ease-in-out infinite; }
.mb-btn svg { width: 230px; height: 198px; overflow: visible; }
@keyframes bob { 50% { transform: translateY(-5px); } }
#mbFlag { transform-box: view-box; transform-origin: 176.5px 126.6px; animation: wave 2.4s ease-in-out infinite; }
@keyframes wave { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-9deg); } 86% { transform: rotate(5deg); } 93% { transform: rotate(-3deg); } }
#mbDoor { transform-box: view-box; transform-origin: 103.5px 147.3px; }
.mailbox-hero .yg { font-family: var(--script); color: var(--burg); font-size: 44px; line-height: 46.2px; margin-top: 8px; }
.flycard { position: absolute; width: 96px; background: #fff; padding: 5px 5px 16px; box-shadow: var(--pola-shadow); left: 50%; top: 0; pointer-events: none; }
.flycard img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.mrow { display: flex; align-items: center; gap: 22px; padding: 6px 20px 6px 24px; min-height: 121px; width: 100%; text-align: left; }
.mrow .pola { width: 112px; flex: none; padding-bottom: 18px; }
.mrow .pola .ph { aspect-ratio: 100 / 78; }
.mrow b { font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 24.2px; }
.mrow .new { display: inline-block; background: var(--burg); color: #fff; font-size: 10px; font-weight: 500; border-radius: 8px; padding: 2px 6px; margin-left: 6px; vertical-align: 3px; }
.mrow span.s { display: block; font-size: 13px; color: var(--muted); line-height: 18.2px; }
.enter { animation: rise .45s var(--ease) both; animation-delay: min(calc(var(--i, 0) * 50ms), 300ms); }
.screen.still .scroll .enter, .screen.still .scroll .float-in, .screen.still .scroll .collected-art { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } }
.trk { padding: 14px 20px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; display: block; }
.trk .top { display: flex; justify-content: space-between; align-items: baseline; }
.trk .top b { font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 24.2px; }
.trk .top i { font-family: var(--type); font-style: normal; font-size: 11px; color: var(--muted); }
.rail { display: flex; align-items: center; margin: 12px 0 6px; }
.rail .d { width: 13px; height: 13px; border-radius: 7px; border: 1.5px solid var(--burg); background: var(--burg); flex: none; transition: background .4s, border-color .4s; }
.rail .d.i { background: var(--bg); border-color: #b8956a; }
.rail .l { flex: 1; height: 2px; background: var(--burg); transition: background .4s; }
.rail .l.u { background: #b8956a; }
.rlabels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }
.trk .hand { font-size: 15px; margin-top: 6px; display: block; }

/* ================= stickers ================= */
.sgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 20px 24px; }
.scell { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; min-height: 124px; justify-content: space-between; text-align: center; transition: transform .2s var(--spring); }
.scell:active { transform: scale(.96); }
.scell .art { height: 70px; width: 100%; display: grid; place-items: center; overflow: hidden; }
.scell .art > div { transform: scale(.62); white-space: nowrap; }
.scell .art > img { max-width: 86px; }
.scell .art img { max-height: 66px; max-width: 86px; }
.scell b { font-family: var(--serif); font-weight: 500; font-size: 15px; line-height: 17px; }
.scell .em { position: absolute; top: 8px; right: 8px; background: var(--burg); color: #fff; font-size: 10px; font-weight: 500; border-radius: 9px; min-width: 18px; padding: 2px 5px; }
.scell.locked { background: transparent; border-style: dashed; color: var(--muted); }
.scell.locked .art { font-family: var(--type); font-size: 15px; }
.scell.make { border: 1.5px dashed var(--burg); background: transparent; color: var(--burg); }
.mini-art { transform-origin: 50% 50%; }
.maker-stage { display: grid; place-items: center; padding: 6px 20px 4px; }
.maker-stage canvas { width: 250px; height: 250px; touch-action: none; border-radius: 18px; background: repeating-conic-gradient(#f6f1e6 0 25%, #efe8da 0 50%) 0 0 / 22px 22px; }
.slider { width: calc(100% - 40px); margin: 8px 20px 0; accent-color: var(--burg); }
.words-prev { margin: 6px 20px 0; height: 150px; border-radius: 18px; background: var(--paper); display: grid; place-items: center; overflow: hidden; }

/* misc */
.center { text-align: center; }
.big-script { font-family: var(--script); color: var(--burg); font-size: 52px; line-height: 54.6px; text-align: center; }
.small { font-size: 13px; color: var(--muted); line-height: 18.2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; text-align: center; padding: 12px 4px 10px; }
.stat b { display: block; font-family: var(--serif); font-weight: 500; font-size: 28px; line-height: 28px; }
.stat span { font-size: 13px; color: var(--muted); }
.book { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 10px; padding: 6px 0; }
.book .cell { position: relative; height: 76px; display: grid; place-items: center; }
.book .cell img { max-height: 62px; max-width: 70px; }
.book .cell .em { position: absolute; top: 0; right: 0; background: var(--burg); color: #fff; font-size: 10px; font-weight: 500; border-radius: 9px; min-width: 16px; padding: 2px 5px; text-align: center; }
.book .lock { width: 60px; height: 34px; border-radius: 6px; background: var(--line); font-family: var(--type); color: var(--muted); font-size: 13px; display: grid; place-items: center; }
.toast { position: absolute; left: 50%; bottom: calc(118px + var(--safe-bot)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 20px; font-size: 13px; z-index: 60; white-space: nowrap; animation: toastin .35s var(--spring); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 12px) scale(.9); } }
.linkish { text-decoration: underline; color: var(--muted); font-size: 12px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.empty .hand { display: block; margin-top: 6px; }
.collected-art { animation: drop .8s var(--spring) both; }
@keyframes drop { from { transform: translateY(-40px) rotate(-30deg) scale(.6); opacity: 0; } }
.float-in { animation: rise .6s var(--ease) both; }

/* ================= profile sticker shelf (scrolls sideways) ================= */
.shelf { display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; padding: 12px 20px 14px; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent); }
.shelf::-webkit-scrollbar { display: none; }
.shelf-st { flex: none; width: 104px; height: 128px; scroll-snap-align: start; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 6px 9px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; position: relative; transition: transform .25s var(--spring); }
.shelf-st:active { transform: scale(.95) rotate(-2deg); }
.shelf-st .art { height: 72px; width: 100%; display: grid; place-items: center; overflow: hidden; }
.shelf-st .art img { max-height: 66px; max-width: 84px; }
.shelf-st .art > div { transform: scale(.62); white-space: nowrap; }
.shelf-st b { font-family: var(--serif); font-weight: 500; font-size: 14px; line-height: 15px; text-align: center; }
.shelf-st .em { position: absolute; top: 7px; right: 7px; background: var(--burg); color: #fff; font-size: 10px; font-weight: 500; border-radius: 9px; padding: 2px 5px; }
.shelf-st.make { background: transparent; border: 1.5px dashed var(--burg); color: var(--burg); }
.shelf-st.make .art { font-size: 30px; font-family: var(--sans); font-weight: 300; }
.shelf-book { flex: none; width: 96px; height: 128px; scroll-snap-align: start; border-radius: 6px 14px 14px 6px; position: relative; color: var(--bg);
  background: linear-gradient(90deg, #5e2531 0, #5e2531 9px, #7a3340 9px, #8a3c4a 100%); box-shadow: 0 6px 14px rgba(58,47,40,.22), inset -2px 0 0 rgba(255,255,255,.08);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding-left: 9px; transform-origin: left center; transition: transform .35s var(--spring); }
.shelf-book img { width: 54px; height: 54px; border-radius: 50%; }
.shelf-book span { font-family: var(--serif); font-weight: 600; font-size: 14px; line-height: 15px; text-align: center; letter-spacing: .02em; }
.shelf-book:active { transform: perspective(400px) rotateY(-24deg); }


/* ---- usability round: bigger tap targets, clearer entry points ---- */
.card.tap { width: 100%; text-align: left; transition: transform .15s, border-color .2s, background .2s; }
.card.tap:active { transform: scale(.98); }
.card.tap.got { border-color: var(--sage); }
.pillbtn { flex: none; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 18px; border-radius: 22px; border: 1.5px solid var(--burg); color: var(--burg); font-size: 14px; font-weight: 500; }
.pillbtn.done { background: var(--sage); border-color: var(--sage); color: var(--sage-ink); }
.chev { font-size: 28px; line-height: 1; color: var(--burg); padding: 0 4px; }

.upload-hero { display: flex; align-items: center; gap: 14px; width: calc(100% - 40px); margin: 6px 20px 12px; padding: 14px 16px; border: 2px dashed var(--burg); border-radius: 18px; background: var(--card); text-align: left; color: var(--burg); transition: transform .15s; }
.upload-hero:active { transform: scale(.98); }
.upload-hero .plus { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--burg); color: #fff; display: grid; place-items: center; font-size: 28px; line-height: 1; }
.upload-hero b { display: block; font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 24px; }
.upload-hero small { display: block; font-size: 13px; line-height: 18px; color: var(--muted); }
.photostrip .up small { display: block; font-size: 10px; line-height: 11px; }

.tray .ts.book { width: 66px; height: 60px; border-radius: 14px; border: 1.5px solid var(--burg); background: var(--card); gap: 1px; padding: 4px; }
.tray .ts.book span { font-size: 10px; line-height: 11px; color: var(--burg); text-align: center; }
.tray .ts.book img { pointer-events: none; }

.scrim.clear { background: transparent; }
.swatches { display: flex; gap: 10px; justify-content: space-between; padding: 6px 0 12px; }
.sw { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 44px; }
.sw i { width: 46px; height: 46px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); transition: box-shadow .2s, transform .2s var(--spring); }
.sw.on i { box-shadow: 0 0 0 3px var(--burg); transform: scale(1.08); }
.sw span { font-size: 12px; line-height: 14px; color: var(--muted); }
.sw.on span { color: var(--burg); font-weight: 600; }

.burst { position: absolute; left: 50%; top: 115px; width: 0; height: 0; z-index: 5; pointer-events: none; }
.burst img { position: absolute; left: -18px; top: -18px; width: 36px; height: auto; opacity: 0; animation: burst 1.25s var(--ease) both; }
@keyframes burst {
  0% { opacity: 0; transform: rotate(var(--a)) translateY(-8px) rotate(calc(var(--a) * -1)) scale(.3); }
  15% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--d) * -1)) rotate(calc(var(--a) * -1 + 140deg)) scale(1); }
}
.thud { animation: thud .6s var(--ease) .1s both; }
@keyframes thud { 0% { scale: 1.35; opacity: 0; } 55% { scale: .94; opacity: 1; } 100% { scale: 1; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .burst { display: none; } .thud, .enter, .float-in, .collected-art { animation: none; } }


/* ---- enlarge / isolate view ---- */
.enlarge { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 22px; border: 1.5px solid var(--burg); color: var(--burg); font-size: 14px; font-weight: 500; transition: transform .15s; }
.enlarge:active { transform: scale(.97); }
.focusview { position: absolute; inset: 0; z-index: 45; background: var(--bg); display: flex; flex-direction: column; }
.fv-top { flex: none; display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-top) + 2px) 6px 2px 20px; min-height: 58px; }
.fv-title { font-family: var(--serif); font-weight: 500; font-size: 24px; line-height: 26px; }
.fv-x { width: 48px; height: 48px; display: grid; place-items: center; color: var(--burg); }
.fv-x svg { width: 26px; height: 26px; }
.fv-scroll { flex: 1; min-height: 0; display: flex; overflow: auto; padding: 12px; background: #e9e1d0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.fv-wrap { margin: auto; flex: none; position: relative; }
.fv-art { position: relative; }
.fv-wrap.rot .fv-art { position: absolute; top: 0; transform: rotate(90deg); transform-origin: 0 0; }
.fv-art .pc-box { box-shadow: 0 6px 22px rgba(40, 25, 10, .28); }
.fv-tip { flex: none; text-align: center; font-family: var(--hand); color: var(--navy); font-size: 14px; line-height: 18px; padding: 6px 12px 0; background: var(--card); }
.fv-bar { flex: none; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 8px 12px calc(var(--safe-bot) + 12px); background: var(--card); }
.fv-b { min-width: 48px; height: 48px; padding: 0 14px; border-radius: 24px; border: 1.5px solid var(--burg); color: var(--burg); font-size: 24px; line-height: 1; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .15s, opacity .2s; }
.fv-b.txt { font-size: 14px; }
.fv-b.txt svg { width: 16px; height: 16px; }
.fv-b:active { transform: scale(.96); }
.fv-b[disabled] { opacity: .35; }
.fv-z { min-width: 50px; text-align: center; font-size: 14px; color: var(--muted); }
