/* Cupidon — an airmail love letter at night.
   Wine night sky, blush writing paper, crimson wax, airmail red and blue. */
:root {
  color-scheme: dark;   /* one deliberate look: night wine with paper */
  --wine: #2A0E1F;
  --wine-2: #3D1530;
  --wine-3: #562344;
  --paper: #FDF0EC;
  --paper-2: #F3DAD3;
  --paper-3: #E6C1B8;
  --paper-white: #FFF9F6;
  --ink: #3B1626;
  --ink-soft: #7A5566;
  --seal: #B3122E;
  --seal-hi: #C8203D;
  --seal-dark: #7E0B20;
  --blue: #27407A;
  --gold: #E9B872;
  --on-wine-soft: #D9B9C2;

  --script: "Pinyon Script", "Great Vibes", "Snell Roundhand", cursive;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --shadow-paper: 0 28px 60px -28px rgba(8, 0, 4, .8), 0 2px 6px rgba(8, 0, 4, .25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--wine);
  background-image:
    radial-gradient(110% 70% at 50% -10%, #50203F 0%, rgba(80, 32, 63, 0) 62%),
    radial-gradient(80% 50% at 50% 115%, #170610 0%, rgba(23, 6, 16, 0) 70%);
  background-repeat: no-repeat;
  color: var(--paper);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.script { font-family: var(--script); font-weight: 400; }
.muted { color: var(--on-wine-soft); }
.center { text-align: center; }
.error { color: #FF9DAE; font-weight: 600; margin: 0; min-height: 1.5em; }
.paper .error, .sheet .error { color: var(--seal); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 52px; padding: .75em 1.8em;
  border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--serif); font-weight: 700; font-size: 1.12rem; letter-spacing: .01em; line-height: 1.1;
  background: var(--seal); color: var(--paper);
  box-shadow: inset 0 -3px 0 var(--seal-dark), 0 10px 24px -12px rgba(0, 0, 0, .7);
  text-decoration: none;
  transition: background-color .15s, transform .1s;
}
.btn:hover { background: var(--seal-hi); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 1.5px currentColor; }
.btn-ghost:hover { background: rgba(255, 255, 255, .07); }
.paper .btn-ghost:hover, .sheet .btn-ghost:hover { background: rgba(59, 22, 38, .06); }
.btn-small { min-height: 40px; padding: .5em 1.1em; font-size: 1rem; }
.btn-light { background: var(--paper-white); color: var(--ink); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .7); }
.btn-light:hover { background: #fff; }
.btn-wide { width: 100%; }
.link-btn {
  background: none; border: 0; padding: .3em .2em; cursor: pointer;
  color: var(--on-wine-soft); font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--paper); }

/* ---------- paper ---------- */
.paper {
  background: var(--paper); color: var(--ink);
  border-radius: 4px; box-shadow: var(--shadow-paper);
  padding: clamp(22px, 6vw, 44px);
}
.airmail {
  padding: 10px; border-radius: 8px;
  background: repeating-linear-gradient(-45deg,
    var(--seal) 0 13px, var(--paper) 13px 21px, var(--blue) 21px 34px, var(--paper) 34px 42px);
}

/* ---------- envelope (back side, flap closed with a wax seal) ---------- */
.envelope {
  position: relative; width: min(86vw, 390px); aspect-ratio: 3 / 2;
  perspective: 1400px;
}
.env-back { position: absolute; inset: 0; box-shadow: var(--shadow-paper); }
.env-back > i { display: block; width: 100%; height: 100%; background: var(--paper-3); border-radius: 2px; }
.env-letter {
  position: absolute; left: 9%; right: 9%; top: 9%; height: 80%; z-index: 1;
  background: var(--paper-white); border-radius: 2px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 17px, rgba(122, 85, 102, .16) 17px 18px);
  background-position: 0 26px;
}
.env-pocket, .env-flap { position: absolute; left: 10px; right: 10px; }
.env-pocket { top: 10px; bottom: 10px; z-index: 2; filter: drop-shadow(0 -2px 3px rgba(59, 22, 38, .22)); }
.env-pocket > i {
  display: block; width: 100%; height: 100%;
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(to bottom right, transparent calc(50% - 1px), rgba(59, 22, 38, .13) 50%, transparent calc(50% + 1px)) left bottom / 50% 46% no-repeat,
    linear-gradient(to bottom left, transparent calc(50% - 1px), rgba(59, 22, 38, .13) 50%, transparent calc(50% + 1px)) right bottom / 50% 46% no-repeat,
    var(--paper);
}
.env-flap {
  top: 10px; height: 58%; z-index: 3; transform-origin: 50% 0;
  filter: drop-shadow(0 3px 3px rgba(59, 22, 38, .28));
}
.env-flap > i {
  display: block; width: 100%; height: 100%;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(to bottom, var(--paper) 0%, var(--paper-2) 100%);
}
.seal {
  position: absolute; left: 50%; top: calc(10px + 58% * 0.94); z-index: 4;
  width: 108px; height: 108px; margin: -54px 0 0 -54px; padding: 0;
  display: grid; place-items: center;
  border: 0; cursor: pointer;
  border-radius: 48% 52% 51% 49% / 52% 47% 53% 48%;
  background: radial-gradient(circle at 34% 30%, #DC3A55 0%, var(--seal) 46%, var(--seal-dark) 100%);
  box-shadow: 0 0 0 5px #9C0F27, 0 12px 22px -8px rgba(0, 0, 0, .6), inset 0 -4px 8px rgba(0, 0, 0, .25);
  color: #FFD9CF; font-family: var(--script); font-size: 1.75rem; line-height: 1;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .35), 0 1px 0 rgba(255, 190, 180, .25);
}
.seal::before {
  content: ""; position: absolute; inset: 11px; border-radius: 50%;
  border: 2px solid rgba(255, 215, 200, .32);
}
.seal span { position: relative; transform: rotate(-6deg); padding-top: 4px; }
.seal-static { cursor: default; width: 72px; height: 72px; margin: -36px 0 0 -36px; font-size: 1.9rem; }
.seal-static::before { inset: 8px; }
button.seal { animation: seal-breathe 2.6s ease-in-out infinite; }
button.seal:hover { filter: brightness(1.08); }
@keyframes seal-breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 5px #9C0F27, 0 12px 22px -8px rgba(0, 0, 0, .6), 0 0 0 0 rgba(233, 184, 114, .0); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 5px #9C0F27, 0 12px 22px -8px rgba(0, 0, 0, .6), 0 0 0 16px rgba(233, 184, 114, .14); }
}
.envelope.is-open .seal { animation: seal-break .45s ease-in forwards; pointer-events: none; }
.envelope.is-open .env-flap { animation: flap-open .75s .35s cubic-bezier(.4, 0, .2, 1) forwards; }
.envelope.is-open .env-letter { animation: letter-rise .8s 1.05s cubic-bezier(.2, .7, .2, 1) forwards; }
@keyframes seal-break { to { transform: scale(1.35) rotate(14deg); opacity: 0; } }
@keyframes flap-open {
  0% { transform: rotateX(0); z-index: 3; }
  49% { z-index: 3; }
  50% { z-index: 0; }
  100% { transform: rotateX(180deg); z-index: 0; }
}
@keyframes letter-rise { to { transform: translateY(-62%); } }

/* ---------- top bar (his side) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 980px; margin: 0 auto; padding: 14px 16px;
}
.brand { font-family: var(--script); font-size: 2.3rem; color: var(--gold); text-decoration: none; line-height: 1.2; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user { display: flex; align-items: center; gap: 10px; font-weight: 600; }
@media (max-width: 480px) { #userName { display: none; } .brand { font-size: 2rem; } }

/* UZ / RU / EN switch */
.lang-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--wine-3); }
.lang-switch button {
  min-width: 38px; min-height: 32px; padding: 0 8px; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--on-wine-soft); font-weight: 700; font-size: .9rem; letter-spacing: .04em;
}
.lang-switch button:hover { color: var(--paper); }
.lang-switch button[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.corner-lang { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 20; }
.user img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.user img:not([src]), .user img[src=""] { display: none; }
.demo-ribbon {
  background: var(--gold); color: var(--ink); text-align: center;
  font-weight: 600; font-size: .95rem; padding: 6px 16px;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px 72px; }

/* ---------- sign in ---------- */
.hero {
  display: grid; grid-template-columns: 1fr; justify-items: center; text-align: center;
  gap: 22px; padding: 36px 0 12px;
}
.hero .envelope { width: min(72vw, 320px); transform: rotate(-4deg); margin-bottom: 18px; }
.hero-title {
  margin: 0; max-width: 17ch;
  font-weight: 600; font-size: clamp(2.2rem, 7vw, 3.5rem); line-height: 1.06; letter-spacing: -.01em;
  text-wrap: balance;
}
.hero-sub { margin: 0; max-width: 36em; color: var(--on-wine-soft); font-size: 1.15rem; text-wrap: pretty; }
.btn-google { margin-top: 6px; }
.btn-google svg { width: 22px; height: 22px; }
.how {
  list-style: none; padding: 0; margin: 56px auto 0; max-width: 820px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
  counter-reset: how;
}
.how li { counter-increment: how; padding-top: 10px; border-top: 1px solid var(--wine-3); }
.how li::before { content: counter(how); display: block; font-family: var(--script); font-size: 2.4rem; color: var(--gold); line-height: 1.1; }
.how h3 { margin: 0 0 4px; font-size: 1.2rem; font-weight: 700; }
.how p { margin: 0; color: var(--on-wine-soft); font-size: 1.02rem; }
@media (max-width: 720px) { .how { grid-template-columns: 1fr; gap: 18px; } }

/* ---------- his letters ---------- */
.home-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 18px 0 22px; }
.page-title { margin: 0; font-family: var(--script); font-weight: 400; color: var(--gold); font-size: clamp(2.6rem, 8vw, 3.6rem); line-height: 1.15; }
.letters { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.letter-row {
  display: grid; grid-template-columns: 1fr auto; gap: 12px 20px; align-items: center;
  background: var(--paper); color: var(--ink); border-radius: 4px; box-shadow: var(--shadow-paper);
  padding: 18px 22px; border-left: 6px solid var(--paper-3);
}
.letter-row.is-answered { border-left-color: var(--seal); }
.lr-name { margin: 0; font-family: var(--script); font-size: 2rem; line-height: 1.2; color: var(--seal); }
.lr-meta { margin: 0; color: var(--ink-soft); font-size: .98rem; }
.lr-status { margin: 4px 0 0; font-weight: 600; }
.lr-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }
.lr-actions .btn { color: var(--ink); }
.lr-actions .btn-del { color: var(--seal); }
@media (max-width: 640px) { .letter-row { grid-template-columns: 1fr; } .lr-actions { justify-content: start; } }
.empty { text-align: center; padding: 48px 16px; border: 1.5px dashed var(--wine-3); border-radius: 8px; }
.empty p { margin: 0 0 18px; color: var(--on-wine-soft); }

/* ---------- write a letter (form) ---------- */
.sheet {
  background: var(--paper); color: var(--ink); border-radius: 4px; box-shadow: var(--shadow-paper);
  padding: clamp(20px, 5vw, 48px); max-width: 860px; margin: 0 auto;
}
.sheet-title { margin: 0 0 4px; font-family: var(--script); font-weight: 400; color: var(--seal); font-size: clamp(2.4rem, 7vw, 3.2rem); line-height: 1.2; }
.sheet-lead { margin: 0 0 8px; color: var(--ink-soft); }
.part { padding: 26px 0; border-top: 1px solid var(--paper-3); }
.part:first-of-type { border-top: 0; }
.part > h2 { margin: 0 0 4px; font-size: 1.4rem; font-weight: 700; line-height: 1.25; }
.part > .help { margin: 0 0 16px; color: var(--ink-soft); font-size: 1.02rem; max-width: 60ch; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .fields { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; align-content: start; }
.field > span { font-weight: 700; font-size: 1.02rem; }
.field > span small { font-weight: 500; color: var(--ink-soft); font-size: .92rem; }
.input {
  width: 100%; padding: .6em .85em; min-height: 50px;
  background: var(--paper-white); color: var(--ink);
  border: 1.5px solid var(--paper-3); border-radius: 10px;
  font-size: 1.12rem; font-weight: 500;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.45; }
.input::placeholder { color: #B294A0; }
.input:focus { outline: none; border-color: var(--seal); box-shadow: 0 0 0 3px rgba(179, 18, 46, .15); }
.input[aria-invalid="true"] { border-color: var(--seal); background: #FFF0F1; }
.field-error { color: var(--seal); font-size: .95rem; font-weight: 600; margin: 0; }

.pin { display: flex; gap: 12px; }
.pin input {
  width: 58px; height: 68px; text-align: center; padding: 0;
  font-size: 2rem; font-weight: 700;
  border-radius: 12px; border: 1.5px solid var(--paper-3); background: var(--paper-white); color: var(--ink);
}
.pin input:focus { outline: none; border-color: var(--seal); box-shadow: 0 0 0 3px rgba(179, 18, 46, .15); }
.pin[aria-invalid="true"] input { border-color: var(--seal); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-block; padding: .45em 1.1em; border-radius: 999px;
  border: 1.5px solid var(--paper-3); background: var(--paper-white); font-weight: 700; cursor: pointer;
}
.chip input:checked + span { background: var(--seal); border-color: var(--seal); color: var(--paper); }
.chip input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.letter-preview {
  background: var(--paper-white); border: 1px solid var(--paper-3); border-radius: 6px;
  padding: 18px 22px; max-height: 300px; overflow: auto; font-size: 1.02rem;
}
.letter-preview .lp-greeting { font-family: var(--script); color: var(--seal); font-size: 1.9rem; margin: 0 0 6px; line-height: 1.2; }
.letter-preview p { margin: 0 0 10px; }
.letter-preview .lp-sign { font-family: var(--script); font-size: 1.6rem; color: var(--seal); margin: 0; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .choices { grid-template-columns: 1fr; } }
.choice {
  position: relative; display: grid; gap: 2px; padding: 14px 16px 14px 48px; cursor: pointer;
  border: 1.5px solid var(--paper-3); border-radius: 12px; background: var(--paper-white);
}
.choice input { position: absolute; left: 16px; top: 18px; width: 20px; height: 20px; accent-color: var(--seal); margin: 0; }
.choice b { font-size: 1.1rem; }
.choice small { color: var(--ink-soft); font-size: .98rem; }
.choice:has(input:checked) { border-color: var(--seal); background: #FFF3F1; }

.dish-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 780px) { .dish-grid { grid-template-columns: 1fr; } }
.dish-slot { display: grid; gap: 12px; align-content: start; }
.photo-drop {
  position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden;
  border: 2px dashed var(--paper-3); border-radius: 10px; background: var(--paper-white);
  color: var(--ink-soft); cursor: pointer; text-align: center; font-weight: 700;
}
.photo-drop:hover { border-color: var(--ink-soft); }
.photo-drop:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.photo-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-drop svg { width: 34px; height: 34px; margin: 0 auto 6px; display: block; }
.photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-drop .change {
  position: absolute; right: 8px; bottom: 8px; padding: .2em .8em; border-radius: 999px;
  background: rgba(42, 14, 31, .78); color: var(--paper); font-size: .92rem;
}
.photo-drop.has-photo { border-style: solid; border-color: transparent; }
.photo-drop.is-busy::after { content: attr(data-busy); position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 249, 246, .85); }
.photo-drop[aria-invalid="true"] { border-color: var(--seal); }
.dish-slot h3 { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--ink-soft); }

.submit-row { display: grid; gap: 10px; justify-items: center; padding-top: 28px; border-top: 1px solid var(--paper-3); }
.submit-row .btn { min-width: 240px; font-size: 1.25rem; }
.submit-row .error { text-align: center; }
.field-note { margin-top: 16px; }
.link-cancel { color: var(--ink-soft); }
.link-cancel:hover { color: var(--ink); }

/* ---------- sealed (link ready) ---------- */
.done { display: grid; justify-items: center; text-align: center; gap: 20px; padding-top: 18px; }
.done .envelope { width: min(64vw, 260px); transform: rotate(3deg); margin: 10px 0 12px; }
.done-title { margin: 0; font-family: var(--script); font-weight: 400; color: var(--gold); font-size: clamp(2.8rem, 9vw, 3.8rem); line-height: 1.15; }
.done p { margin: 0; max-width: 34em; }
.linkbox {
  display: flex; gap: 8px; width: min(100%, 560px); padding: 8px;
  background: var(--paper); border-radius: 999px; box-shadow: var(--shadow-paper);
}
.linkbox input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); padding: 0 12px; font-size: 1rem; font-weight: 600; }
.linkbox input:focus { outline: none; }
.share-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.code-note {
  width: min(100%, 560px); padding: 16px 20px; border-radius: 10px;
  border: 1.5px dashed var(--gold); color: var(--paper); text-align: left;
}
.code-note b { font-size: 1.5rem; letter-spacing: .12em; color: var(--gold); }

.link-part { display: grid; justify-items: center; gap: 20px; width: 100%; }
.pay-box {
  display: grid; justify-items: center; gap: 12px; width: min(100%, 560px); padding: 24px 20px;
  background: var(--paper); color: var(--ink); border-radius: 6px; box-shadow: var(--shadow-paper);
}
.pay-box h2 { margin: 0; font-size: 1.45rem; font-weight: 700; line-height: 1.25; }
.pay-box p { margin: 0; color: var(--ink-soft); }
.pay-box .error { color: var(--seal); }
.pay-box .link-btn { color: var(--ink-soft); }
.card-marks { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; list-style: none; margin: 4px 0; padding: 0; }
.card-marks li { padding: .15em .7em; border: 1px solid var(--paper-3); border-radius: 6px; font-weight: 700; font-size: .95rem; background: var(--paper-white); }
.in-app-note { max-width: 32em; margin: 0; padding: 12px 16px; border-radius: 10px; border: 1.5px dashed var(--gold); color: var(--paper); }

/* ---------- her side ---------- */
.stage {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: max(64px, calc(env(safe-area-inset-top) + 52px)) 16px max(48px, env(safe-area-inset-bottom));
}
.screen { display: none; width: 100%; max-width: 580px; }
.screen.is-active { display: flex; flex-direction: column; align-items: center; gap: 22px; animation: screen-in .55s ease both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.screen:focus { outline: none; }
.script-title { margin: 0; font-family: var(--script); font-weight: 400; color: var(--gold); font-size: clamp(2.7rem, 11vw, 3.8rem); line-height: 1.15; text-align: center; }
.screen-head { text-align: center; display: grid; gap: 4px; }
.screen-head h2 { margin: 0; font-size: clamp(1.55rem, 6vw, 2rem); font-weight: 600; line-height: 1.2; text-wrap: balance; }
.screen-head p { margin: 0; }

.pin-card { display: grid; justify-items: center; gap: 14px; text-align: center; }
.pin-card p { margin: 0; }
.pin-card .envelope { width: min(60vw, 230px); margin-bottom: 14px; transform: rotate(-3deg); }
.pin-card .pin input { background: rgba(255, 255, 255, .06); border-color: var(--wine-3); color: var(--paper); }
.pin-card .pin input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(233, 184, 114, .2); }
.pin.is-checking { opacity: .6; }
.pin.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.hint { color: var(--on-wine-soft); font-style: italic; }

.env-caption { margin: 0 0 8px; font-size: 1.2rem; color: var(--on-wine-soft); text-align: center; }
.env-caption .script { display: block; font-size: 3.2rem; color: var(--paper); line-height: 1.2; }
#s-envelope .env-caption, #s-envelope .open-hint { transition: opacity .4s; }
#s-envelope:has(.is-open) .env-caption, #s-envelope:has(.is-open) .open-hint { opacity: 0; }
.nums, .pay-box .btn, .pin input, .cal-day, .time, .code-note b, .inv-date, .inv-when, .date-summary p, .lr-meta, .lr-status { font-variant-numeric: lining-nums tabular-nums; }
.open-hint { margin: 18px 0 0; color: var(--on-wine-soft); font-style: italic; text-align: center; }

.letter { width: 100%; position: relative; }
.letter-greeting { margin: 0 0 14px; font-family: var(--script); font-weight: 400; color: var(--seal); font-size: clamp(2.3rem, 9vw, 3.1rem); line-height: 1.2; }
.letter p { margin: 0 0 1em; font-size: 1.16rem; line-height: 1.65; text-wrap: pretty; }
.letter .letter-ps { font-style: italic; color: var(--ink-soft); }
.letter .letter-closing { margin: 1.6em 0 0; text-align: right; }
.letter .letter-sign { margin: 0; text-align: right; font-family: var(--script); color: var(--seal); font-size: 2.3rem; line-height: 1.2; }
.screen.is-active .letter { animation: letter-in .9s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes letter-in { from { opacity: 0; transform: translateY(60px) scale(.96); } to { opacity: 1; transform: none; } }

.stamps { display: grid; gap: 26px; width: 100%; }
.stamp {
  position: relative; display: block; width: 100%; padding: 10px; border: 0; cursor: pointer; text-align: left;
  background: radial-gradient(circle, transparent 5px, var(--paper-white) 5.5px) -8px -8px / 16px 16px round;
  filter: drop-shadow(0 16px 20px rgba(8, 0, 4, .45));
  transition: transform .2s;
}
.stamp:nth-child(1) { transform: rotate(-1.4deg); }
.stamp:nth-child(2) { transform: rotate(1deg); }
.stamp:nth-child(3) { transform: rotate(-.6deg); }
.stamp:hover:not(:disabled) { transform: rotate(0) translateY(-3px); }
.stamp:disabled { cursor: default; }
.stamp-in { display: block; background: var(--paper-white); padding: 12px; color: var(--ink); }
.stamp-photo { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--paper-2); }
.stamp-photo img { width: 100%; height: 100%; object-fit: cover; }
.stamp-name { display: block; margin-top: 10px; font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.stamp-place { display: block; color: var(--ink-soft); font-style: italic; font-size: 1.05rem; }
.stamps.has-choice .stamp:not(.is-chosen) { opacity: .35; filter: grayscale(.6) drop-shadow(0 8px 10px rgba(8, 0, 4, .3)); }
.postmark {
  position: absolute; right: 6%; top: 8%; width: 42%; max-width: 150px; color: var(--blue);
  opacity: 0; transform: scale(1.8) rotate(-18deg);
}
.stamp.is-chosen .postmark { animation: postmark .35s cubic-bezier(.3, 1.4, .5, 1) forwards; }
@keyframes postmark { to { opacity: .9; transform: scale(1) rotate(-14deg); } }

.cal { width: 100%; padding: clamp(18px, 5vw, 30px); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head h3 { margin: 0; font-size: 1.35rem; font-weight: 700; }
.cal-nav {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--paper-3); background: var(--paper-white);
  cursor: pointer; display: grid; place-items: center; color: var(--ink);
}
.cal-nav:disabled { opacity: .3; cursor: default; }
.cal-nav svg { width: 18px; height: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-dow { font-size: .9rem; font-weight: 700; color: var(--ink-soft); padding: 4px 0; }
.cal-day {
  aspect-ratio: 1; max-height: 48px; width: 100%; border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  font-weight: 700; font-size: 1.08rem; color: var(--ink); display: grid; place-items: center; justify-self: center;
}
.cal-day:hover:not(:disabled) { background: var(--paper-2); }
.cal-day:disabled { color: #CDB3BA; cursor: default; font-weight: 500; }
.cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--ink-soft); }
.cal-day.is-picked { background: var(--seal); color: var(--paper); box-shadow: none; }
.times { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--paper-3); }
.times h3 { margin: 0 0 10px; font-size: 1.2rem; font-weight: 700; }
.times .muted-ink { margin: 0; color: var(--ink-soft); font-style: italic; }
.time-group + .time-group { margin-top: 14px; }
.time-group p { margin: 0 0 6px; color: var(--ink-soft); font-size: .98rem; font-weight: 600; }
.time-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.time {
  min-height: 42px; border-radius: 999px; border: 1.5px solid var(--paper-3); background: var(--paper-white);
  font-weight: 700; cursor: pointer; color: var(--ink);
}
.time:hover:not(:disabled) { border-color: var(--ink-soft); }
.time:disabled { opacity: .35; cursor: default; }
.time.is-picked { background: var(--seal); border-color: var(--seal); color: var(--paper); }
.date-summary { display: grid; justify-items: center; gap: 12px; text-align: center; width: 100%; }
.date-summary p { margin: 0; font-size: 1.2rem; font-weight: 600; }

.invitation { width: 100%; box-shadow: var(--shadow-paper); }
.inv-inner { position: relative; background: var(--paper); color: var(--ink); border-radius: 2px; text-align: center; padding: 64px clamp(18px, 6vw, 40px) 36px; }
.inv-inner .seal-static { top: 0; }
.inv-inner p { margin: 0; }
.inv-kicker { font-family: var(--script); color: var(--seal); font-size: clamp(3.2rem, 14vw, 4.4rem); line-height: 1.1; }
.inv-dear { font-style: italic; font-size: 1.5rem; margin-top: 6px !important; }
.inv-line { color: var(--ink-soft); font-size: 1.15rem; }
.inv-date { font-size: clamp(4.2rem, 21vw, 6rem); font-weight: 600; line-height: 1; margin: 10px 0 4px !important; letter-spacing: -.01em; }
.inv-when { color: var(--seal); font-weight: 700; font-size: 1.4rem; }
.inv-dish { margin: 26px auto 14px; width: min(62%, 240px); }
.inv-dish .stamp-edge {
  padding: 9px; transform: rotate(-3deg);
  background: radial-gradient(circle, transparent 5px, var(--paper-white) 5.5px) -8px -8px / 16px 16px round;
  filter: drop-shadow(0 10px 14px rgba(59, 22, 38, .25));
}
.inv-dish img { width: 100%; aspect-ratio: 1; object-fit: cover; outline: 10px solid var(--paper-white); outline-offset: -1px; }
.inv-dish figcaption { margin-top: 14px; font-style: italic; font-weight: 700; font-size: 1.3rem; }
.inv-place { font-weight: 700; font-size: 1.3rem; }
.inv-addr { color: var(--ink-soft); }
.inv-map { margin-top: 14px; color: var(--ink); }
.inv-sign { font-family: var(--script); color: var(--seal); font-size: 2.4rem; margin-top: 20px !important; line-height: 1.2; }
.final-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 20px);
  background: var(--paper); color: var(--ink); font-weight: 700; padding: 10px 20px; border-radius: 999px;
  box-shadow: var(--shadow-paper); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  button.seal { animation: none; }
}
.test-pay-title { color: var(--seal); }

/* invitation picture shown on screen (press and hold to save) */
.picture-sheet {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; align-content: center; gap: 16px;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  background: rgba(20, 5, 14, .92); text-align: center; overflow: auto;
}
.picture-sheet img { max-width: min(100%, 420px); max-height: 70vh; width: auto; border-radius: 6px; box-shadow: var(--shadow-paper); }
.picture-sheet p { margin: 0; max-width: 30em; color: var(--paper); }

/* very small phones (320–380px): keep the top bar inside the screen */
@media (max-width: 380px) {
  .topbar { gap: 8px; }
  .brand { font-size: 1.7rem; }
  .topbar-right { gap: 8px; }
  .lang-switch button { min-width: 32px; padding: 0 5px; }
}
