:root {
  --page: #F7931E;
  --page-light: #FFB34D;
  --ink: #2C1260;
  --muted: #5A2410;
  --brand: #35176E;
  --brand-edge: #1E0A45;
  --sheet: #FFFBF2;
  --sun: #FFC93C;
  --sun-soft: #FFE7A8;
  --danger: #B3122E;
  --display: "Unbounded", system-ui, sans-serif;
  --body: "Manrope", system-ui, sans-serif;
  --hand: "Caveat", "Segoe Print", cursive;
  /* Paper sheets lift off the page: a crisp contact edge plus a soft cast shadow. */
  --lift: 0 2px 0 rgba(90, 36, 16, 0.14), 0 10px 18px -8px rgba(90, 36, 16, 0.45);
  --paper-shadow: drop-shadow(0 2px 1px rgba(90, 36, 16, 0.18)) drop-shadow(0 10px 12px rgba(90, 36, 16, 0.28));
  --grain: 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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .15 0 0 0 0 .05 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  background: var(--grain), linear-gradient(180deg, var(--page-light) 0, var(--page) 520px) var(--page);
}

:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
a { color: var(--brand); font-weight: 700; text-underline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Perforated paper stamp ----------
   The sheet is a masked ::before layer, so the holes are truly see-through and
   the drop shadow on the element follows the perforated edge. */
.perf {
  --fill: var(--sheet);
  --r: 6px;
  --s: 18px;
  position: relative;
  isolation: isolate;
  background: none;
  filter: var(--paper-shadow);
}
.perf::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--grain), var(--fill);
  --hole: #0000 var(--r), #000 calc(var(--r) + 0.5px);
  -webkit-mask:
    radial-gradient(circle at 50% 0, var(--hole)) 0 0 / var(--s) 100% round no-repeat,
    radial-gradient(circle at 50% 100%, var(--hole)) 0 0 / var(--s) 100% round no-repeat,
    radial-gradient(circle at 0 50%, var(--hole)) 0 0 / 100% var(--s) no-repeat round,
    radial-gradient(circle at 100% 50%, var(--hole)) 0 0 / 100% var(--s) no-repeat round;
  -webkit-mask-composite: source-in;
  mask:
    radial-gradient(circle at 50% 0, var(--hole)) 0 0 / var(--s) 100% round no-repeat,
    radial-gradient(circle at 50% 100%, var(--hole)) 0 0 / var(--s) 100% round no-repeat,
    radial-gradient(circle at 0 50%, var(--hole)) 0 0 / 100% var(--s) no-repeat round,
    radial-gradient(circle at 100% 50%, var(--hole)) 0 0 / 100% var(--s) no-repeat round;
  mask-composite: intersect;
}

/* Airmail envelope edge along the very top, from the first version of the site. */
.airmail {
  height: 8px;
  background: repeating-linear-gradient(-45deg,
    #2442C9 0 14px, #FFFFFF 14px 24px, #E5484D 24px 38px, #FFFFFF 38px 48px);
}

/* ---------- Header ---------- */
.top {
  position: relative; z-index: 1;
  max-width: 1080px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.logo {
  display: inline-flex; padding: 6px 12px; border-radius: 16px;
  background: var(--grain), var(--sheet); box-shadow: var(--lift);
}
.logo img { display: block; height: 40px; width: auto; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.lang {
  display: inline-flex; padding: 3px; border-radius: 999px;
  background: var(--grain), var(--sheet); box-shadow: var(--lift);
}
.lang button {
  appearance: none; border: 0; cursor: pointer; min-width: 44px; min-height: 36px; padding: 0 10px;
  font: 700 13px/1 var(--body); color: var(--brand); background: transparent; border-radius: 999px;
}
.lang button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.top-link {
  font: 700 14px/1 var(--body); color: var(--brand); text-decoration: none;
  padding: 10px 14px; border-radius: 999px; background: var(--grain), var(--sheet); box-shadow: var(--lift);
}

main { max-width: 1080px; margin: 0 auto; padding: 8px 16px 32px; }

h1 {
  font: 700 clamp(32px, 7.4vw, 60px)/1.04 var(--display);
  letter-spacing: -0.035em; margin: 18px 0 18px; max-width: 13ch; color: var(--ink);
}
h2 {
  font: 700 clamp(22px, 4.5vw, 30px)/1.15 var(--display);
  letter-spacing: -0.02em; margin: 8px 0 22px; max-width: 24ch;
}
h1:focus, h2:focus { outline: none; }
h1, h2, .choice strong { overflow-wrap: break-word; hyphens: auto; }
.lead { font-size: 18px; color: var(--muted); max-width: 44ch; margin: 0 0 30px; font-weight: 500; }
/* The motto: one handwritten line, like a signature under the headline. */
.motto {
  font: 700 clamp(30px, 6vw, 40px)/1.05 var(--hand); color: var(--brand);
  margin: -6px 0 30px; transform: rotate(-2deg); transform-origin: left center;
}
.sub { font: 700 17px/1.3 var(--display); margin: 26px 0 6px; }

.note {
  font: 700 26px/1.1 var(--hand); color: var(--brand);
  margin: 0; transform: rotate(-2.5deg);
}

/* ---------- Home ---------- */
.hero {
  position: relative; z-index: 0;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 44px;
  padding-bottom: clamp(170px, 22vw, 280px);
}
.scene {
  position: absolute; z-index: -1;
  top: -110px; bottom: 0; left: 50%; width: 100vw;
  transform: translateX(-50%);
  pointer-events: none;
}
.scene svg, .meadow svg { display: block; width: 100%; height: 100%; }

.choices { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.choice {
  --r: 5px; --s: 14px;
  appearance: none; border: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 56px 1fr; gap: 16px; align-items: center;
  padding: 22px 22px 22px 20px; min-height: 96px;
  transition: transform 0.15s;
}
.choice:hover { --fill: var(--sun-soft); transform: translateY(-3px) rotate(-0.6deg); }
.choice:active { transform: translateY(1px); }
.choice svg { width: 56px; height: 56px; }
.choice strong { display: block; font: 700 18px/1.2 var(--display); letter-spacing: -0.01em; margin-bottom: 4px; }
.choice .desc { display: block; color: var(--muted); font-size: 15px; line-height: 1.45; }

.hero-stamp { margin: 0; justify-self: center; width: 100%; max-width: 420px; }
.hero-stamp .stamp { transform: rotate(2deg); }
.hero-stamp .note {
  display: inline-block; margin: 18px 0 0 24px; min-height: 1.1em; padding: 4px 14px 6px;
  background: var(--grain), var(--sheet); box-shadow: var(--lift); border-radius: 3px;
}

.panel {
  padding: 24px 26px; border-radius: 20px;
  background: var(--grain), var(--sheet); box-shadow: var(--lift);
}
.panel h2 { font-size: 19px; margin-bottom: 8px; }
.panel p { margin: 0 0 10px; color: var(--muted); }
/* One-line privacy note laid over the grass at the bottom of the landscape. */
.privacy-strip {
  position: absolute; left: 50%; bottom: clamp(18px, 3vw, 36px); transform: translateX(-50%);
  width: max-content; max-width: 100%; margin: 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px;
  padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: #FFFFFF; text-align: center;
  background: var(--grain), var(--brand); box-shadow: var(--lift);
}
.privacy-strip svg { width: 18px; height: 18px; flex: none; color: var(--sun); }
.privacy-strip a { color: var(--sun); }
@media (max-width: 600px) {
  .privacy-strip { border-radius: 18px; width: 100%; }
}

/* The home page already ends in grass, so the meadow above the footer would only add empty space. */
body[data-screen="home"] .meadow { display: none; }
/* Same gap above the support block as below it, before the footer. */
body[data-screen="home"] .support { margin-top: 32px; }
body[data-screen="home"] main { padding-bottom: 32px; }

/* monobank jar */
.jar {
  display: grid; gap: 20px; align-items: center; margin: 18px 0 8px; padding: 18px; border-radius: 20px;
  background: linear-gradient(160deg, #5B2A86, #8A5AAE); color: #FFFFFF;
}
.jar-qr { display: block; width: 100%; max-width: 300px; height: auto; justify-self: center; border-radius: 14px; }
.jar-body p { color: rgba(255, 255, 255, 0.88); margin: 0 0 12px; }
.jar-body h3 { font: 700 22px/1.2 var(--display); margin: 0 0 4px; color: #FFFFFF; }
.jar-brand { font: 700 13px/1 var(--body); letter-spacing: 0.02em; opacity: 0.75; margin-bottom: 8px !important; }
.jar-tagline { font: 700 26px/1.1 var(--hand); color: var(--sun) !important; }
.jar .jar-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; background: var(--grain), #111111; box-shadow: 0 5px 0 #000, 0 14px 20px -10px rgba(0, 0, 0, 0.6); margin: 4px 0 16px; }
.jar-card { display: grid; gap: 6px; margin-bottom: 8px; }
.jar-card-label { font-size: 13px; font-weight: 600; opacity: 0.85; }
.jar-card-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.jar-number { font: 700 20px/1 var(--body); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.jar-copy { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.jar .hint { color: rgba(255, 255, 255, 0.8); }
.donate-title { font-weight: 700; margin: 18px 0 0 !important; color: var(--ink) !important; }
@media (min-width: 760px) {
  .jar { grid-template-columns: 300px 1fr; padding: 22px 26px; }
}
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr) 420px; align-items: center; gap: 64px; }
}

/* ---------- Support ---------- */
.support { margin-top: 36px; }
.donate { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.donate-btn { min-height: 46px; gap: 8px; }
.donate-btn.is-soon { opacity: 0.6; cursor: default; box-shadow: none; border: 1.5px dashed rgba(44, 18, 96, 0.35); background: transparent; }
.donate-btn small { font-weight: 600; font-size: 12px; color: var(--muted); }

/* Paper meadow and footer */
.meadow { height: clamp(130px, 16vw, 220px); margin-top: 16px; pointer-events: none; }
.foot {
  display: grid; gap: 8px; justify-items: center; text-align: center;
  padding: 22px 16px calc(26px + env(safe-area-inset-bottom));
  background: #2E7D3A; color: #E8F5E0; font-size: 14px;
}
.foot p { margin: 0; }
.foot-copy { font-weight: 700; color: #FFFFFF; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: center; }
.foot a { color: #FFFFFF; display: inline-block; padding: 6px 0; }
.foot-note { color: #FFFFFF; }

/* ---------- Banner ---------- */
.banner {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  background: var(--grain), var(--sun); border-radius: 16px; padding: 14px 16px; margin: 4px 0 12px;
  font-weight: 600; box-shadow: var(--lift);
}
.banner p { margin: 0; }
.banner-close {
  appearance: none; border: 0; background: none; cursor: pointer; color: var(--ink);
  font: 700 24px/1 var(--body); padding: 0 4px; min-width: 44px; min-height: 44px;
}

/* ---------- Steps ---------- */
.step-head { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.back {
  appearance: none; border: 0; background: none; cursor: pointer; padding: 12px 0; min-height: 44px;
  font: 700 15px var(--body); color: var(--brand);
}
.step { color: var(--muted); font-weight: 700; font-size: 14px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
@media (min-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr) 420px; align-items: start; gap: 56px; }
  .layout > .stamp { position: sticky; top: 24px; }
}

.stamp {
  margin: 0; width: 100%; max-width: 540px; justify-self: center;
  padding: 12px; transform: rotate(-1.2deg);
}
.stamp::after {
  content: ""; position: absolute; right: -36px; top: -30px; width: 150px; height: 100px;
  background: url(postmark.svg) no-repeat center / contain;
  opacity: 0.5; transform: rotate(12deg); pointer-events: none;
}
.stamp canvas, .stamp img { display: block; width: 100%; height: auto; background: #F3D9B8; }
#cv-photo { cursor: grab; touch-action: none; }
#cv-photo.dragging { cursor: grabbing; }

/* ---------- Controls ---------- */
fieldset { border: 0; padding: 0; margin: 0 0 26px; min-width: 0; }
legend, .field { display: block; font-weight: 700; font-size: 15px; margin: 0 0 10px; padding: 0; }
legend small { font-weight: 500; color: var(--muted); margin-left: 4px; }

.sheet { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile {
  --r: 4px; --s: 12px;
  appearance: none; border: 0; cursor: pointer; color: var(--ink);
  display: grid; gap: 6px; padding: 9px 9px 8px;
  font: 700 12.5px/1.2 var(--body); text-align: center;
  transition: transform 0.15s;
}
.tile canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.tile span { min-height: 2.4em; display: grid; place-items: center; }
.tile:hover { --fill: var(--sun-soft); transform: translateY(-2px); }
.tile[aria-pressed="true"] { --fill: var(--brand); color: #FFFFFF; transform: translateY(-3px) rotate(-2deg); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 10px 15px;
  font: 600 15px/1 var(--body); color: var(--ink);
  background: var(--grain), var(--sheet); border: 0; border-radius: 999px; box-shadow: var(--lift);
}
.chip:hover { background: var(--grain), var(--sun-soft); }
.chip[aria-pressed="true"] { background: var(--grain), var(--brand); color: #fff; }
.swatch { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.15); }
.motto-fields { margin: -6px 0 26px; padding: 14px 16px 2px; border-radius: 16px; background: rgba(255, 251, 242, 0.55); }
.motto-fields input { margin-bottom: 16px; }
.inline-set { margin-bottom: 16px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch-btn {
  appearance: none; cursor: pointer; width: 40px; height: 40px; border-radius: 50%;
  background: var(--swatch); border: 3px solid var(--sheet); box-shadow: var(--lift);
}
.swatch-btn[aria-pressed="true"] { outline: 3px solid var(--brand); outline-offset: 2px; }
.chip.font-display { font-family: var(--display); }
.chip.font-hand { font-family: var(--hand); font-size: 20px; }
.custom-frame { margin: -10px 0 26px; padding: 14px 16px; border-radius: 16px; background: rgba(255, 251, 242, 0.55); }
.custom-frame .hint { margin-top: 0; }

.masks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mask-tile {
  appearance: none; cursor: pointer; color: var(--ink); text-align: center; min-width: 0;
  display: grid; gap: 6px; padding: 6px 6px 8px;
  font: 600 12.5px/1.2 var(--body);
  background: var(--grain), var(--sheet); border: 0; border-radius: 14px; box-shadow: var(--lift);
  transition: transform 0.15s;
}
.mask-tile span { overflow-wrap: anywhere; hyphens: auto; }
.mask-tile canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 9px; }
.mask-tile:hover { transform: translateY(-2px); }
.mask-tile[aria-pressed="true"] { background: var(--grain), var(--brand); color: #fff; transform: translateY(-3px) rotate(-2deg); }

.layer-panel { padding: 14px 16px 2px; margin-bottom: 18px; border-radius: 16px; background: rgba(255, 251, 242, 0.6); }
.layer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.layer-head .linkish { margin: 0; padding: 8px 0; }

textarea, input[type="text"] {
  width: 100%; padding: 10px 14px; color: var(--ink);
  background: var(--grain), var(--sheet); border: 0; border-radius: 14px;
  box-shadow: inset 0 2px 4px rgba(90, 36, 16, 0.2);
}
textarea { resize: vertical; font: 600 24px/1.25 var(--hand); }
input[type="text"] { font: 500 16px/1.5 var(--body); }
textarea:focus, input[type="text"]:focus { outline: 3px solid var(--brand); outline-offset: 2px; }
.suggest { display: grid; gap: 6px; margin: 10px 0 22px; }
.suggest button {
  appearance: none; cursor: pointer; text-align: left; padding: 10px 12px; min-height: 44px;
  font: 500 14px/1.4 var(--body); color: var(--ink);
  background: rgba(255, 251, 242, 0.6); border: 0; border-radius: 12px;
}
.suggest button:hover { background: rgba(255, 251, 242, 0.95); }
#signature { margin-bottom: 26px; }

input[type="range"] { width: 100%; margin: 0 0 18px; accent-color: var(--brand); height: 28px; }
.note-hint { font-size: 22px; margin: 4px 0 14px; }

/* Buttons are thick card: a darker edge underneath that flattens when pressed. */
.primary {
  appearance: none; cursor: pointer; width: 100%; min-height: 54px; padding: 16px 22px;
  font: 700 17px/1.2 var(--body); color: #fff;
  background: var(--grain), var(--brand); border: 0; border-radius: 16px;
  box-shadow: 0 5px 0 var(--brand-edge), 0 14px 20px -10px rgba(30, 10, 69, 0.6);
  transition: transform 0.1s, box-shadow 0.1s;
}
.primary:hover { filter: brightness(1.15); }
.primary:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--brand-edge), 0 4px 8px -4px rgba(30, 10, 69, 0.6); }
.primary:disabled {
  cursor: not-allowed; transform: none; filter: none;
  background: var(--grain), #A48F86; box-shadow: 0 5px 0 #7D6A62;
}
.btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 12px 14px; text-align: center; text-decoration: none;
  font: 700 15px/1.2 var(--body); color: var(--ink);
  background: var(--grain), var(--sheet); border: 0; border-radius: 14px;
  box-shadow: 0 4px 0 #D9B892, 0 12px 18px -10px rgba(90, 36, 16, 0.5);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover { background: var(--grain), var(--sun-soft); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #D9B892, 0 4px 8px -4px rgba(90, 36, 16, 0.5); }
.btn.danger, .linkish.danger { color: var(--danger); }

.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.linkish {
  appearance: none; cursor: pointer; background: none; border: 0; padding: 14px 0; margin-bottom: 12px; min-height: 44px;
  font: 700 15px var(--body); color: var(--brand); text-align: left;
  text-decoration: underline; text-underline-offset: 3px;
}
.hint { color: var(--muted); font-size: 14px; margin: 8px 0 18px; }

/* ---------- Result: format, sharing, QR ---------- */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 5px; border-radius: 16px; background: rgba(255, 251, 242, 0.5); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span {
  display: grid; place-items: center; min-height: 52px; padding: 6px; border-radius: 12px;
  font-weight: 700; text-align: center; line-height: 1.2;
}
.segmented small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.segmented input:checked + span { background: var(--grain), var(--brand); color: #fff; box-shadow: var(--lift); }
.segmented input:checked + span small { color: #E9DDFF; }
.segmented input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.format { margin-bottom: 18px; }

.result-actions { display: grid; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }

/* Share buttons are the brand logos alone, on round paper chips that grow on hover. */
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 4px 0 6px; }
.social {
  appearance: none; cursor: pointer; display: grid; place-items: center; width: 56px; height: 56px; padding: 0;
  text-decoration: none; background: var(--grain), var(--sheet); border: 0; border-radius: 50%; box-shadow: var(--lift);
  transition: transform 0.18s cubic-bezier(.3, 1.6, .5, 1), box-shadow 0.18s;
}
.social-icon { width: 28px; height: 28px; }
.social:hover, .social:focus-visible { transform: scale(1.18); box-shadow: 0 4px 0 rgba(90, 36, 16, 0.14), 0 16px 22px -10px rgba(90, 36, 16, 0.5); }
.social:active { transform: scale(1.05); }

/* The four action buttons wear the site's paper colours: sun, sky, grass and tomato. */
.btn.btn-sun { background: var(--grain), #FFC93C; color: #3A2A05; box-shadow: 0 4px 0 #D99A0E, 0 12px 18px -10px rgba(90, 36, 16, 0.5); }
.btn.btn-sky { background: var(--grain), #8EC9EA; color: #0E3352; box-shadow: 0 4px 0 #5B9BC2, 0 12px 18px -10px rgba(90, 36, 16, 0.5); }
.btn.btn-grass { background: var(--grain), #2E8B3A; color: #FFFFFF; box-shadow: 0 4px 0 #1C5E25, 0 12px 18px -10px rgba(90, 36, 16, 0.5); }
.btn.btn-tomato { background: var(--grain), #E8432F; color: #FFFFFF; box-shadow: 0 4px 0 #A82A1B, 0 12px 18px -10px rgba(90, 36, 16, 0.5); }
.btn.btn-sun:hover, .btn.btn-sky:hover, .btn.btn-grass:hover, .btn.btn-tomato:hover { filter: brightness(1.06); }
.btn.btn-sun:active, .btn.btn-sky:active, .btn.btn-grass:active, .btn.btn-tomato:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }

.qr-box { margin-top: 14px; padding: 16px; text-align: center; border-radius: 18px; background: var(--grain), var(--sheet); box-shadow: var(--lift); }
.qr-box canvas { width: 220px; height: 220px; image-rendering: pixelated; }
.qr-box .linkish { text-align: center; }

/* ---------- Consent dialog ---------- */
.modal {
  position: fixed; inset: 0; z-index: 20; padding: 16px;
  display: grid; place-items: center; background: rgba(44, 18, 96, 0.6);
}
.modal-box {
  width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; padding: 24px;
  background: var(--grain), var(--sheet); border-radius: 22px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
}
.modal-box h2 { font-size: 21px; }
.consent-list { margin: 0 0 16px; padding-left: 20px; color: var(--muted); }
.consent-list li { margin-bottom: 6px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 700; cursor: pointer; padding: 10px 0; }
.check input { width: 24px; height: 24px; flex: none; accent-color: var(--brand); margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30; max-width: calc(100% - 32px);
  padding: 12px 18px; text-align: center; font-weight: 600; color: #fff;
  background: var(--ink); border-radius: 12px;
  opacity: 0; pointer-events: none; transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Privacy page ---------- */
.doc { max-width: 760px; margin: 12px auto 40px; }
.doc h1 { font-size: clamp(28px, 6vw, 40px); max-width: none; }
.doc h2 { font-size: 20px; margin-top: 28px; }
.doc li { margin-bottom: 8px; color: var(--muted); }

/* ---------- Phone layout ---------- */
@media (max-width: 859px) {
  /* The preview stays in view while masks and controls scroll beneath it. */
  .layout-photo > .stamp {
    position: sticky; top: 6px; z-index: 2;
    width: min(100%, 40svh); padding: 8px; transform: none;
    /* Page-coloured backing so text scrolling underneath doesn't show through the perforation. */
    background: var(--page); box-shadow: 0 0 0 8px var(--page);
  }
  .layout-photo > .stamp::after { display: none; }
  .layout-photo { gap: 18px; }
  /* Mask and accessory tiles scroll sideways instead of making a long page. */
  .masks {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 88px;
    overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x mandatory;
  }
  .mask-tile { scroll-snap-align: start; }
  .sticky-action { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 3; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 430px) {
  .top-link { display: none; }
  .logo img { height: 34px; }
}

@media (max-width: 430px) {
  .top-link.keep { display: inline-block; }
}

/* Support block on the page and the donation dialog. */
.support { display: flex; flex-direction: column; gap: 16px; }
.support p { margin: 0; }
.support .support-open { align-self: center; width: auto; min-width: 220px; }
button.top-link { border: 0; cursor: pointer; }
.donate-box { max-width: 720px; padding: 20px 20px 24px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.modal-head h2 { margin: 0; font-size: 21px; }
.modal-close {
  appearance: none; border: 0; cursor: pointer; flex: none; width: 44px; height: 44px; border-radius: 50%;
  font: 700 26px/1 var(--body); color: var(--ink); background: rgba(44, 18, 96, 0.08);
}
.modal-close:hover { background: rgba(44, 18, 96, 0.16); }
.donate-box .jar { margin-top: 14px; }
@media (max-width: 600px) {
  .support .support-open { width: 100%; }
  .donate-box .jar-qr { max-width: 220px; }
}

/* Selfie camera */
.camera-box { max-width: 560px; padding: 16px 16px 20px; }
.camera-view {
  position: relative; margin: 10px 0 16px; overflow: hidden; border-radius: 18px;
  aspect-ratio: 3 / 4; max-height: 62svh; background: #1C1218;
}
.camera-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-view video.mirrored { transform: scaleX(-1); }
.camera-status {
  position: absolute; inset: 0; margin: 0; padding: 24px; display: grid; place-items: center; text-align: center;
  color: #FFFFFF; font-weight: 600; background: rgba(28, 18, 24, 0.75);
}
.camera-actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.camera-actions .btn { min-height: 46px; font-size: 14px; }
.camera-shot {
  appearance: none; cursor: pointer; width: 72px; height: 72px; border-radius: 50%;
  background: var(--sheet); border: 6px solid var(--brand); box-shadow: 0 0 0 4px var(--sheet), var(--lift);
}
.camera-shot:active { transform: scale(0.94); }
.camera-shot:disabled { opacity: 0.5; cursor: not-allowed; }

/* 404 page */
.notfound { text-align: center; }
.notfound h1, .notfound .lead { margin-left: auto; margin-right: auto; }
.notfound-code {
  margin: 0; font: 700 clamp(84px, 22vw, 150px)/1 var(--display); letter-spacing: -0.04em;
  color: var(--page); -webkit-text-stroke: 3px var(--brand);
}
.notfound-home { display: inline-flex; align-items: center; justify-content: center; width: auto; min-width: 220px; text-decoration: none; }
.notfound hr { border: 0; border-top: 1.5px dashed rgba(44, 18, 96, 0.25); margin: 28px 0 18px; }
.notfound h2 { font-size: 19px; margin: 0 auto 8px; }
noscript .banner { display: block; }
