:root {
  --bg: #16040a;
  --ink: #f7ebd5;
  --ink-soft: #cbb28c;
  --ink-dim: #b39a78;
  --label: #e2c38a;
  --gold: #f0cf82;
  --gold-mid: #e2b865;
  --gold-edge: #b98a3e;
  --gold-deep: #8c6428;
  --field: #12030a;
  --chip: #3a0814;
  --chip-edge: #6e1426;
  --error: #ff9a80;
  --on-gold: #2a0a10;
  --gold-grad: linear-gradient(180deg, #f6dd97 0%, #d9a956 55%, #b07f33 100%);
  --font: 'Montserrat', system-ui, sans-serif;
  --font-display: 'Cormorant SC', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}
/* Damask and shade sit on one layer pinned to the screen, sized by the viewport and not by the page:
   switching «Донат» / «Заказать действие» changes the page height, and the pattern must not rescale or move.
   A fixed element, not a fixed background attachment (iOS ignores that); 100lvh keeps the size stable while
   the mobile address bar hides and shows. */
body::before {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(22, 4, 10, 0.15) 0%, rgba(10, 1, 4, 0.8) 100%),
    var(--bg) url('../img/damask_big.webp') center top / cover no-repeat;
}
img { max-width: 100%; }
a { color: inherit; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.page { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 40px 16px; }
.page--wide { max-width: 760px; }

.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.stack { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.stack--lg { gap: 22px; }
.stack--sm { gap: 8px; }
.stack--xs { gap: 4px; }

/* Frame */
.frame {
  position: relative;
  padding: 50px clamp(24px, 6vw, 38px) 56px;
  background: linear-gradient(180deg, rgba(70, 10, 26, 0.84) 0%, rgba(34, 5, 13, 0.92) 100%);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
}
.frame--doc {
  padding-inline: clamp(24px, 6vw, 56px);
  background: linear-gradient(180deg, rgba(58, 8, 21, 0.9) 0%, rgba(28, 4, 11, 0.95) 100%);
}
.frame__body { position: relative; }
.frame__line { position: absolute; pointer-events: none; }
.frame__line--outer {
  inset: 5px;
  border: 3px solid #c99a4a;
  border-image: linear-gradient(180deg, #f6dd97 0%, #c99a4a 45%, #7a5216 100%) 1;
  box-shadow: 0 0 0 1px #3a2208, inset 0 0 0 1px #3a2208;
}
.frame__line--inner { inset: 13px; border: 1px solid rgba(201, 154, 74, 0.4); }
.corner { position: absolute; width: 68px; height: 68px; pointer-events: none; }
.corner--sm { width: 30px; height: 30px; }
.corner--tl { top: 0; left: 0; }
.corner--tr { top: 0; right: 0; transform: scaleX(-1); }
.corner--bl { bottom: 0; left: 0; transform: scaleY(-1); }
.corner--br { bottom: 0; right: 0; transform: scale(-1, -1); }

/* Header */
.head { display: flex; flex-direction: column; gap: 10px; }
.head__row { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 50px; height: 50px; flex: none; border-radius: 50%;
  background: var(--field); border: 1.5px solid var(--gold-edge);
  box-shadow: 0 0 0 3px rgba(185, 138, 62, 0.15);
  color: #f07b3f; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 23px;
}
.head__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.head__name {
  margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 800; font-size: 28px; line-height: 1.1; color: #fbf1de;
}
.head__tagline { margin: 0; font-size: 14px; line-height: 1.4; color: var(--ink-soft); }
.pills { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 10px; border-radius: 999px;
  border: 1.5px solid var(--gold-edge); background: rgba(18, 3, 10, 0.75);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13px; white-space: nowrap;
}
.pill__icon { flex: none; color: var(--gold-mid); }

/* Tabs */
.tabs {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 5px;
  border-radius: 14px; background: var(--field); border: 1px solid var(--gold-deep);
}
.tabs--doc { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.tabs__input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tabs__tab {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 46px; padding: 6px 10px; border-radius: 10px;
  border: 1px solid var(--chip-edge); background: var(--chip); color: #e9c77b;
  font-weight: 700; font-size: 15px; line-height: 1.2; cursor: pointer; text-decoration: none;
}
.tabs--doc .tabs__tab { min-height: 44px; font-size: 14px; }
.tabs__input:checked + .tabs__tab,
.tabs__tab[aria-pressed='true'] {
  background: var(--gold-grad); border-color: #f6dd97; color: var(--on-gold);
  box-shadow: 0 0 14px rgba(240, 200, 110, 0.35);
}
.tabs__input:focus-visible + .tabs__tab { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Panels switch by the checked "kind" radio, so the form works without JavaScript */
.panel--action { display: none; }
form:has(#kind-action:checked) .panel--action { display: block; }
form:has(#kind-action:checked) .panel--donation { display: none; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 8px; }
.field__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field__label { font-size: 14px; font-weight: 600; color: var(--label); }
.field__count { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.input {
  width: 100%; min-height: 54px; padding: 0 16px;
  border: 1.5px solid var(--gold-edge); border-radius: 12px; background: var(--field);
  box-shadow: 0 0 0 3px rgba(185, 138, 62, 0.12), inset 0 2px 10px rgba(0, 0, 0, 0.6);
  color: var(--ink); font-family: var(--font); font-weight: 500; font-size: 16px;
}
.input::placeholder { color: #8f7a5e; }
.input.is-error, .input[aria-invalid='true'] { border-color: var(--error); }
.input--area { padding: 14px 16px; font-size: 15px; line-height: 1.5; resize: none; font-weight: 400; }
.note { margin: 0; font-size: 13px; line-height: 1.4; color: var(--ink-soft); }
.note--center { text-align: center; font-size: 14px; font-weight: 500; }
.note--error { color: var(--error); font-size: 14px; font-weight: 600; }
.note--icon { display: flex; align-items: center; gap: 8px; }
.note--icon svg { flex: none; color: var(--gold-mid); }
.note[hidden] { display: none; }

/* Amount */
.amount { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.amount__label { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.amount__row {
  --amount-font: 64px; --amount-w: 2.1em;
  display: flex; align-items: baseline; justify-content: center; gap: 10px; max-width: 100%;
  filter: drop-shadow(0 0 14px rgba(240, 200, 110, 0.3));
}
.amount__input {
  flex: 0 1 auto; box-sizing: content-box; width: var(--amount-w); max-width: 100%; min-width: 0.7em;
  border: 0; padding: 0; background: transparent; text-align: right; color: var(--gold);
  text-shadow: 0 2px 0 #6b4310; font-family: var(--font); font-weight: 800;
  font-size: var(--amount-font); line-height: 1.1;
}
.amount__input:focus-visible { outline-offset: 6px; border-radius: 6px; }
.amount__cur {
  flex: none; font-weight: 800; font-size: var(--amount-font); line-height: 1.1;
  color: var(--gold); text-shadow: 0 2px 0 #6b4310;
}
.amount__line { width: 180px; height: 2px; border-radius: 1px; background: var(--gold-deep); box-shadow: 0 0 10px rgba(201, 154, 74, 0.6); }
.amount__line.is-error { background: var(--error); }

.chips { display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.js .chips { display: grid; }
.chip {
  min-height: 46px; padding: 0 6px; border-radius: 999px;
  border: 1.5px solid var(--gold-edge); background: var(--chip); color: var(--gold);
  font-family: var(--font); font-weight: 700; font-size: 15px; white-space: nowrap; cursor: pointer;
}
.chip--custom { font-size: 13px; }
.chip[aria-pressed='true'] {
  background: var(--gold-grad); border-color: #f6dd97; color: var(--on-gold);
  box-shadow: 0 0 14px rgba(240, 200, 110, 0.4);
}
.panel > .stack { gap: 16px; }

/* Action tiles */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile-wrap { position: relative; min-width: 0; }
.tile__input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  height: 100%; min-height: 150px; padding: 22px 12px 20px; border-radius: 4px; cursor: pointer; text-align: center;
  background: linear-gradient(180deg, #24050d 0%, #12030a 100%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
.tile__line { position: absolute; inset: 4px; border: 1.5px solid var(--gold-deep); pointer-events: none; }
.tile__icon { position: relative; display: flex; color: var(--gold); }
.tile__icon .icon { width: 38px; height: 38px; }
.tile__title {
  position: relative; min-height: 2.5em; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12.5px; line-height: 1.25; text-wrap: balance; overflow-wrap: anywhere;
}
.tile__price { position: relative; font-weight: 800; font-size: 15px; white-space: nowrap; color: var(--gold); }
.tile__input:checked + .tile {
  background: linear-gradient(180deg, #7a1428 0%, #4e0a19 100%);
  box-shadow: 0 0 0 1px var(--gold), 0 0 22px rgba(240, 200, 110, 0.35);
}
.tile__input:checked + .tile .tile__line { border-color: var(--gold); }
.tile__input:focus-visible + .tile { outline: 3px solid var(--gold); outline-offset: 3px; }
.js [data-action-hint]:empty { display: none; }
html:not(.js) [data-action-hint] { display: none; }

/* Divider, summary, pay */
.divider { display: flex; align-items: center; gap: 10px; color: #c99a4a; }
.divider__line { flex: 1 1 auto; height: 1px; background: var(--gold-deep); }
.summary { display: none; justify-content: space-between; align-items: flex-end; gap: 12px; }
.js .summary { display: flex; }
.summary__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.summary__label { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 0.04em; color: var(--gold-mid); }
.summary__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 15px; line-height: 1.3; }
.summary__sum { flex: none; font-weight: 800; font-size: 24px; white-space: nowrap; color: var(--gold); }

.pay, .paying__btn {
  position: relative; display: block; width: 100%; aspect-ratio: 900 / 155; min-height: 48px; max-height: 72px;
  padding: 0; border: 0; background: transparent; cursor: pointer; font-family: var(--font);
}
.pay[aria-disabled='true'] { cursor: not-allowed; filter: saturate(0.6) brightness(0.8); }
.pay__bg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.pay__text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 12%;
  color: var(--on-gold); font-weight: 800; font-size: 17px; line-height: 1.15; text-shadow: 0 1px 0 rgba(255, 236, 180, 0.6);
}
.pay__arrow { flex: none; }
.pay[aria-disabled='true'] .pay__arrow { display: none; }
.paying { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.paying[hidden], .pay[hidden] { display: none; }
.paying__btn { cursor: default; filter: saturate(0.85) brightness(0.92); }
.paying__btn .pay__text { font-size: 16px; gap: 8px; white-space: nowrap; }
.linkbtn {
  min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--label);
  text-decoration: underline; font-family: var(--font); font-size: 14px; cursor: pointer;
}
.consent { margin: -6px 0 0; text-align: center; font-size: 12.5px; line-height: 1.45; color: var(--ink-dim); }
.consent a { color: var(--label); text-underline-offset: 2px; }
.foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 6px; font-size: 13px; color: #8f7a5e; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: var(--ink-soft); text-decoration: none; }

/* Return page */
.result { align-items: center; text-align: center; padding: 8px 0; }
.result__title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 38px; line-height: 1.1; letter-spacing: 0.03em; color: var(--gold); }
.result__sum { margin: 0; font-weight: 800; font-size: 40px; color: var(--gold); text-shadow: 0 2px 0 #6b4310; white-space: nowrap; }
.result__text { margin: 0; max-width: 40ch; font-size: 15.5px; line-height: 1.6; color: #efe2ca; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 28px; border-radius: 999px;
  background: var(--gold-grad); border: 1px solid #f6dd97; color: var(--on-gold);
  font-weight: 800; font-size: 16px; text-decoration: none; box-shadow: 0 0 14px rgba(240, 200, 110, 0.35);
}

/* Documents */
.back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1.5px solid var(--gold-edge); background: rgba(18, 3, 10, 0.75);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px;
}
.back svg { color: var(--gold-mid); }
.doc__h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 38px; line-height: 1.1; letter-spacing: 0.03em; color: var(--gold); }
.doc { gap: 18px; }
.doc[hidden] { display: none; }
.doc__title { margin: 0; font-weight: 800; font-size: 24px; line-height: 1.25; color: #fbf1de; }
.doc__edition { font-size: 13px; color: var(--ink-dim); }
.doc__h3 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: 0.03em; color: var(--gold-mid); }
.doc__p { margin: 0; max-width: 64ch; font-size: 15.5px; line-height: 1.65; color: #efe2ca; white-space: pre-line; overflow-wrap: anywhere; }
.doc__foot { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-dim); overflow-wrap: anywhere; }
html:not(.js) .doc + .doc { padding-top: 12px; border-top: 1px solid var(--gold-deep); }

@media (max-width: 420px) {
  .page { padding: 24px 12px; }
  .head__name { font-size: 24px; }
  .tiles { gap: 8px; }
  .tile { padding-inline: 6px; }
  .pay__text { font-size: 15px; padding: 0 10%; }
}

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