/* «Тайный Санта»: a winter night, warm gold lights, the burgundy of the envelope. One fixed palette in both
   Telegram themes. Phone first (320 px and up); Telegram's safe areas come in as --sa-* / --csa-* (tg.js).
   The page is exactly --bg (#0b1430): the hero and the gifts pictures fade into that colour (img/README.md). */

:root {
  --bg: #0b1430;
  --panel: rgba(19, 32, 58, 0.9);
  --panel-hi: rgba(28, 45, 79, 0.92);
  --line: rgba(232, 192, 122, 0.22);
  --line-soft: rgba(255, 255, 255, 0.08);
  --gold: #e8c07a;
  --gold-hi: #f6dca6;
  --gold-lo: #b4883c;
  --wine: #8e2436;
  --wine-hi: #ad3448;
  --wine-lo: #5c1422;
  --text: #f3efe6;
  --muted: #aab5ca;
  --faint: #7a88a2;
  --ice: #a9cbe9;
  --ok: #93d4aa;
  --ink: #2b1c05;
  --radius: 18px;
  --pad-x: 18px;
  --top-gap: 14px;
  --serif: Georgia, "Noto Serif", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--sa-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--sa-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--sa-left, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--sa-right, 0px));
}

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

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.45 var(--sans);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:focus-visible, .input:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
p { margin: 0; }

.app {
  max-width: 600px;
  margin: 0 auto;
  padding:
    calc(var(--safe-top) + var(--csa-top, 0px) + var(--top-gap))
    calc(var(--safe-right) + var(--pad-x))
    calc(var(--safe-bottom) + var(--csa-bottom, 0px) + 32px)
    calc(var(--safe-left) + var(--pad-x));
}

/* ---- type ---------------------------------------------------------------------------------------------------- */
.kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

/* home: the canal at night, full-bleed and up under Telegram's bar; the title in the open sky, centred and
   narrow (the gables on the left rise to 9–18 % of the picture), clear of the content-safe inset */
.hero {
  position: relative;
  margin:
    calc(-1 * (var(--safe-top) + var(--csa-top, 0px) + var(--top-gap)))
    calc(-1 * (var(--safe-right) + var(--pad-x)))
    0
    calc(-1 * (var(--safe-left) + var(--pad-x)));
}
.hero-art {
  aspect-ratio: 1080 / 1446;
  background: url("../img/hero.webp") center top / cover no-repeat;
}
.hero-title {
  position: absolute;
  top: calc(var(--safe-top) + var(--csa-top, 0px) + 18px);
  left: 22%;
  right: 22%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font: 600 clamp(34px, 11vw, 54px)/1.02 var(--serif);
  color: #fbf0d8;
  text-align: center;
  text-shadow: 0 2px 16px rgba(4, 9, 28, 0.9), 0 0 3px rgba(4, 9, 28, 0.7);
}
.hero-title::before {
  content: "✦";
  margin-bottom: 6px;
  font-size: 0.36em;
  color: var(--gold);
}
/* the greeting sits on the picture's fade (its last fifth is plain --bg) */
.greeting { position: relative; margin: calc(-0.26 * 100% - 0.52 * var(--pad-x)) 0 24px; }
.greeting-title { font: 600 28px/1.15 var(--serif); margin-bottom: 8px; overflow-wrap: anywhere; }
.greeting-text { color: var(--muted); max-width: 40ch; }

.page-head { margin: 6px 0 22px; }
.page-title {
  font: 600 30px/1.15 var(--serif);
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.section { margin-top: 28px; }
.section-title {
  font: 700 12.5px/1.2 var(--sans);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.section-text { color: var(--muted); font-size: 14.5px; margin-bottom: 12px; }
.empty-note { color: var(--faint); font-size: 14.5px; padding: 14px 16px; border: 1px dashed var(--line-soft); border-radius: var(--radius); }
.footnote { color: var(--faint); font-size: 13px; text-align: center; margin-top: 28px; }

/* ---- buttons ------------------------------------------------------------------------------------------------- */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 650;
  font-size: 16px;
  line-height: 1.2;
  text-align: center;
  transition: transform 0.12s ease, opacity 0.2s ease, background-color 0.2s ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn.primary {
  background: linear-gradient(180deg, #f5d898 0%, #e1b263 100%);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(225, 178, 99, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.btn.ghost { background: rgba(255, 255, 255, 0.03); border-color: rgba(232, 192, 122, 0.42); color: var(--gold-hi); }
.btn.quiet { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.btn.danger { background: transparent; border-color: rgba(173, 52, 72, 0.6); color: #f2a9b4; }
.btn.big { min-height: 58px; font-size: 17px; }
.btn:disabled { opacity: 0.42; cursor: default; box-shadow: none; }
.btn.primary:disabled { opacity: 1; background: rgba(255, 255, 255, 0.06); border-color: var(--line-soft); color: var(--faint); }
.btn + .btn, .btn + .row, .row + .btn { margin-top: 10px; }
.btn.busy { color: transparent; }
.btn.busy::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  border: 2.5px solid rgba(43, 28, 5, 0.25);
  border-top-color: var(--ink);
  animation: spin 0.8s linear infinite;
}
.btn.ghost.busy::after, .btn.quiet.busy::after, .btn.danger.busy::after {
  border-color: rgba(246, 220, 166, 0.25);
  border-top-color: var(--gold-hi);
}
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1 1 0; min-width: 0; margin-top: 0; }

.icon-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--faint);
  font-size: 24px;
  line-height: 1;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.06); color: var(--text); }

/* ---- pills, avatars ------------------------------------------------------------------------------------------ */
.pill {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.3;
}
.pill.plain { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.pill.gold {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  color: var(--ink);
  animation: glow 3.2s ease-in-out infinite;
}
.pill.wine { background: rgba(173, 52, 72, 0.22); border: 1px solid rgba(173, 52, 72, 0.6); color: #f4b9c2; }

.avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font: 650 13px/1 var(--sans);
  letter-spacing: 0.02em;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.avatar.small { width: 28px; height: 28px; font-size: 11px; }
.avatar.big { width: 52px; height: 52px; font-size: 19px; }
.avatar.wine { background: linear-gradient(135deg, #b8405a, #7a1d2e); }
.avatar.pine { background: linear-gradient(135deg, #3a8a68, #1d4d3a); }
.avatar.navy { background: linear-gradient(135deg, #4a6db0, #26406f); }
.avatar.amber { background: linear-gradient(135deg, #cfa052, #8f6526); }
.avatar.plum { background: linear-gradient(135deg, #95568f, #5a2d58); }
.avatar.teal { background: linear-gradient(135deg, #3a9696, #1c5a5c); }
.avatar.ice { background: linear-gradient(135deg, #b4d3ee, #5f86ad); color: var(--bg); }

/* ---- cards --------------------------------------------------------------------------------------------------- */
.card {
  padding: 20px 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--line-soft);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}
.card-title { font: 600 22px/1.2 var(--serif); margin: 0 0 8px; }
.card-text { color: var(--muted); }
.card-text + .card-text { margin-top: 10px; }
.muted { color: var(--faint); }

.room-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "kind chev" "title chev" "meta chev" "status chev";
  width: 100%;
  padding: 16px 10px 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  text-align: left;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}
.room-card + .room-card { margin-top: 12px; }
.room-card.friends {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(232, 192, 122, 0.16) 0%, rgba(232, 192, 122, 0) 55%),
    linear-gradient(140deg, #7d2032 0%, #561525 55%, #2a1a35 100%);
  border-color: rgba(232, 192, 122, 0.38);
}
.room-card.test {
  background: linear-gradient(180deg, rgba(27, 44, 77, 0.92), rgba(18, 30, 54, 0.92));
  border: 1px dashed rgba(169, 203, 233, 0.5);
}
.room-kind { grid-area: kind; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-hi); }
.room-card.test .room-kind { color: var(--ice); }
.room-title { grid-area: title; font: 600 21px/1.2 var(--serif); margin: 6px 0 4px; overflow-wrap: anywhere; }
.room-meta { grid-area: meta; color: rgba(243, 239, 230, 0.72); font-size: 14px; }
.room-status { grid-area: status; margin-top: 12px; }
.chevron { grid-area: chev; align-self: center; padding-left: 10px; font-size: 30px; line-height: 1; color: rgba(243, 239, 230, 0.4); }

.wish-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 10px 16px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line-soft);
  text-align: left;
}
.wish-card-icon { font-size: 26px; }
.wish-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wish-card-title { font-weight: 700; }
.wish-card-text {
  color: var(--muted);
  font-size: 14.5px;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wish-card .chevron { color: var(--faint); }

/* gifts under the tree (img/empty-gifts.webp, edges fade into --bg): an empty home, a room before its draw */
.gifts-state { margin-top: 18px; text-align: center; }
.gifts {
  width: min(340px, 100%);
  margin: 0 auto 6px;
  aspect-ratio: 800 / 597;
  background: url("../img/empty-gifts.webp") center / contain no-repeat;
}
.gifts-title { margin: 0 0 8px; font: 600 24px/1.2 var(--serif); }
.gifts-text { max-width: 34ch; margin: 0 auto; color: var(--muted); }

details.archive { margin-top: 28px; }
details.archive summary { list-style: none; padding: 8px 0 12px; color: var(--muted); font-weight: 650; cursor: pointer; }
details.archive summary::-webkit-details-marker { display: none; }
details.archive summary::before { content: "▸ "; color: var(--faint); }
details.archive[open] summary::before { content: "▾ "; }
details.archive .room-card { opacity: 0.72; }

/* ---- a room -------------------------------------------------------------------------------------------------- */
.test-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px dashed rgba(169, 203, 233, 0.75);
  background: rgba(169, 203, 233, 0.12);
  color: var(--ice);
  font-size: 13px;
  font-weight: 700;
}
.test-line { margin-top: 14px; color: var(--ice); font-size: 14.5px; }
.secret-line { margin-top: 14px; color: var(--muted); font-size: 14.5px; }

.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.fact {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(232, 192, 122, 0.1);
  border: 1px solid rgba(232, 192, 122, 0.26);
  color: var(--gold-hi);
  font-size: 14.5px;
}

.lost { border-color: rgba(173, 52, 72, 0.55); background: linear-gradient(180deg, rgba(110, 26, 42, 0.5), var(--panel)); }
.lost-icon { font-size: 32px; margin-bottom: 8px; }

/* the envelope (js/envelope.js, css/envelope.css) with the painted papers. The component sizes the envelope by
   the smaller of the width and the height its opening needs (about 1.27 × the width); this is that height for
   the screen's width, from its own minimum of 420 px (320 px phones) to 470 px (390 px and up) */
.envelope-holder {
  --env-paper: url("../img/envelope-paper.webp");
  --card-paper: url("../img/card-paper.webp");
  height: clamp(420px, 126.6vw - 10px, 470px);
  margin: 0 calc(-1 * var(--pad-x));
}
.recipient-holder:not(:empty) { margin-top: 16px; }
.recipient-name {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 6px;
  font: 600 26px/1.15 var(--serif);
  overflow-wrap: anywhere;
}
.recipient-name > span:last-child { min-width: 0; }
.recipient-name.long { font-size: 21px; }
.recipient-name.longer { font-size: 18px; }
.recipient-gift { color: var(--gold-hi); font-size: 15px; }
.wish-block { margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); }
.wish-block.avoid { background: rgba(173, 52, 72, 0.12); }
.wish-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.wish-block.avoid .wish-title { color: #f2a9b4; }
.recipient .card-text { margin-top: 14px; }
.rich { white-space: pre-wrap; overflow-wrap: anywhere; }
.link { color: var(--gold-hi); text-decoration: underline; text-decoration-color: rgba(246, 220, 166, 0.45); text-underline-offset: 3px; }
.appear { animation: rise 0.5s ease both; }

.people { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.person {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 5px 14px 5px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-soft);
  font-size: 15px;
}
.person-name { min-width: 0; overflow-wrap: anywhere; }
.person-me {
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(232, 192, 122, 0.16);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}
.person .person-me { margin-left: 0; }

/* ---- forms --------------------------------------------------------------------------------------------------- */
.field { display: block; margin-bottom: 20px; }
.field-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.field-hint { display: block; margin-top: 8px; color: var(--faint); font-size: 13.5px; }
.counter { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); }
.counter.near { color: var(--gold); }
.input {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(7, 14, 30, 0.62);
  font-size: 16px;
  line-height: 1.4;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 192, 122, 0.18); }
.input::placeholder { color: var(--faint); }
.input::-webkit-date-and-time-value { text-align: left; }
.area { min-height: 100px; resize: none; overflow: hidden; }
.wish-editor .btn { margin-top: 4px; }
.wish-editor .field-hint { text-align: center; margin-top: 12px; }

.kinds { display: grid; gap: 10px; }
.kind {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-areas: "icon title" "icon text";
  column-gap: 6px;
  row-gap: 3px;
  width: 100%;
  padding: 15px 46px 15px 14px;
  border-radius: 15px;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
}
.kind::after {
  content: "";
  position: absolute;
  top: 16px;
  right: 15px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
}
.kind[aria-checked="true"]::after { border-color: var(--gold); background: radial-gradient(circle, var(--gold) 0 40%, transparent 46%); }
.kind.friends[aria-checked="true"] {
  border-color: rgba(232, 192, 122, 0.75);
  background: linear-gradient(140deg, rgba(125, 32, 50, 0.7), rgba(42, 26, 53, 0.7));
}
.kind.test[aria-checked="true"] { border-color: var(--ice); background: rgba(169, 203, 233, 0.09); }
.kind.test[aria-checked="true"]::after { border-color: var(--ice); background: radial-gradient(circle, var(--ice) 0 40%, transparent 46%); }
.kind:disabled { opacity: 0.55; cursor: default; }
.kind-icon { grid-area: icon; font-size: 24px; line-height: 1.2; }
.kind-title { grid-area: title; font-weight: 700; }
.kind-text { grid-area: text; color: var(--muted); font-size: 14px; }

/* ---- organiser ------------------------------------------------------------------------------------------------- */
.organizer { margin-top: 36px; padding-top: 4px; border-top: 1px solid var(--line); }
.organizer-title { font: 600 23px/1.2 var(--serif); color: var(--gold-hi); margin: 22px 0 0; }

.invite .row { margin-top: 2px; }
.invite-link {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(7, 14, 30, 0.7);
  border: 1px dashed rgba(232, 192, 122, 0.38);
  color: var(--gold-hi);
  font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.members { list-style: none; margin: 0; padding: 0; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line-soft); }
.member { display: flex; align-items: center; gap: 12px; padding: 11px 6px 11px 14px; }
.member + .member { border-top: 1px solid var(--line-soft); }
.member-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.member-name { font-weight: 650; overflow-wrap: anywhere; }
.member-name.long { font-size: 15px; }
.member-name.longer { font-size: 14px; }
.member-ticks { display: flex; flex-wrap: wrap; gap: 6px; }
.tick { padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.tick.on { color: var(--ok); background: rgba(147, 212, 170, 0.12); }
.tick.off { color: var(--faint); background: rgba(255, 255, 255, 0.05); }
.member .pill { font-size: 12.5px; padding: 2px 9px; }

.pair {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 4px 4px 4px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
}
.pair-names { font-weight: 650; overflow-wrap: anywhere; }
.picker { margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 40px;
  padding: 5px 14px 5px 5px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  font-size: 15px;
  text-align: left;
}
.chip.on { border-color: var(--gold); background: rgba(232, 192, 122, 0.15); }

.secret-note { margin: 14px 0; text-align: center; color: var(--muted); font-size: 14.5px; }
.blockers {
  margin: 14px 0 0;
  padding: 12px 16px 12px 32px;
  border-radius: 13px;
  background: rgba(173, 52, 72, 0.12);
  border: 1px solid rgba(173, 52, 72, 0.35);
  color: #f4c6cd;
  font-size: 14px;
}
.blockers li + li { margin-top: 6px; }

.progress { padding: 16px 18px; margin-bottom: 12px; }
.progress-text b { color: var(--gold-hi); }
.bar { height: 8px; margin-top: 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); }

.chain { margin-top: 12px; }
.chain-list { list-style: none; margin: 10px 0 0; padding: 0; }
.chain-step { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.chain-arrow { color: var(--gold); }

/* ---- states, toast ------------------------------------------------------------------------------------------- */
.boot, .state {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.state { padding: 20px 6px; }
.state-icon {
  width: 88px;
  height: 88px;
  margin-bottom: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  background: radial-gradient(circle at 35% 30%, rgba(232, 192, 122, 0.24), rgba(232, 192, 122, 0.04));
  border: 1px solid var(--line);
}
.state-title { font: 600 26px/1.2 var(--serif); margin: 0 0 10px; }
.state-text { color: var(--muted); max-width: 34ch; }
.loading .state-text { margin-top: 16px; }
.state-actions { width: 100%; max-width: 320px; margin-top: 26px; }

.spinner {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(232, 192, 122, 0.2);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + var(--csa-bottom, 0px) + 22px);
  z-index: 10;
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(246, 220, 166, 0.97);
  color: var(--ink);
  font-weight: 650;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.offscreen { position: fixed; top: 0; left: -9999px; opacity: 0; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px rgba(232, 192, 122, 0.35); }
  50% { box-shadow: 0 0 20px rgba(232, 192, 122, 0.65); }
}

@media (max-width: 360px) {
  :root { --pad-x: 14px; }
  .page-title { font-size: 26px; }
  .recipient-name { font-size: 23px; }
  .recipient-name.long, .recipient-name.longer { flex-direction: column; align-items: flex-start; gap: 10px; }
}

@media (min-width: 700px) {
  :root { --top-gap: 32px; }
  /* the picture is narrower than the window here: its sides fade out too */
  .hero-art {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pill.gold, .appear { animation: none; }
  .btn, .toast { transition: none; }
}
