/* Customer payment page: a summary panel (what is paid, status, time) and an action panel (choose a
   coin and network, then send). Colours come from theme.css and follow the user's Telegram theme;
   when the money lands the invoice gets stamped. */
:root {
  --font: "Estedad", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --radius: 20px;
}
:root[lang="ru"], :root[lang="en"] { --font: -apple-system, system-ui, "Segoe UI", Roboto, "Estedad", sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  /* a soft light from the top corner, in the theme's own accent */
  background: radial-gradient(1100px 560px at 85% -12%, var(--accent-wash), transparent 62%) no-repeat, var(--bg);
  color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: var(--link); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 6px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.wrap { max-width: 480px; margin: 0 auto; padding: 12px 14px 32px; }
.wrap.wide { max-width: 1040px; }

/* ---------- top bar ---------- */
.pay-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; padding: 2px 4px 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; text-decoration: none; }
.back svg { width: 18px; height: 18px; }
:root[dir="rtl"] .back svg { transform: scaleX(-1); }
.langs { display: flex; align-items: center; gap: 12px; font-size: 13px; white-space: nowrap; }
.langs a { color: var(--hint); text-decoration: none; }
.theme-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surface); color: var(--subtle); cursor: pointer; padding: 0; }
.theme-btn svg { width: 18px; height: 18px; }
:root[data-theme="dark"] .theme-btn .i-moon, :root[data-theme="light"] .theme-btn .i-sun { display: none; }

/* ---------- panels ---------- */
.panels { display: grid; gap: 12px; align-items: start; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 22px 20px; border: 1px solid var(--sep); }
@media (min-width: 880px) {
  .panels { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 14px; }
  .panel { padding: 34px 38px; }
  .summary { position: sticky; top: 16px; }
}
.panel h2 { font-size: 18px; font-weight: 700; margin: 0; }
.sub { color: var(--subtle); font-size: 14px; margin: 4px 0 0; }

/* ---------- summary ---------- */
.merchant { display: flex; flex-direction: column; margin: 0; }
.merchant .shop { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.desc { margin: 2px 0 0; color: var(--subtle); font-size: 14px; }
.amt { margin-top: 22px; }
.amt .label { margin: 0; font-weight: 700; font-size: 15px; }
.big { font-size: clamp(30px, 8.4vw, 46px); font-weight: 800; line-height: 1.15; margin-top: 4px; overflow-wrap: anywhere; }
.big.mono { font-weight: 700; letter-spacing: -0.02em; }
.big .unit { font-size: .78em; }
/* amounts read left to right; on a right-to-left page they still sit on the start (right) side */
:root[dir="rtl"] .amt .big.ltr { text-align: right; }
.big mark, .copyrow mark { background: var(--accent-wash); color: var(--link); border-radius: .2em; padding: 0 .06em; }
.under { margin: 6px 0 0; color: var(--subtle); font-size: 14.5px; }
.under.small { font-size: 13px; color: var(--hint); margin-top: 2px; }
.amt.paid .label, .amt.paid .big { color: var(--ok); }

.rows { margin: 22px 0 0; }
/* phones: two facts per line, so the next step is reached without much scrolling */
@media (max-width: 879px) {
  .panel { padding: 20px 18px; }
  .amt { margin-top: 16px; }
  .rows { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; margin-top: 16px; }
  .row { grid-column: 1 / -1; padding: 11px 0; }
  .row.half { grid-column: auto; }
  #refresh { display: none; } /* the status checks itself every few seconds; no room beside it here */
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid var(--sep); }
.rk { display: block; color: var(--subtle); font-size: 13.5px; }
.rv { display: block; margin-top: 2px; font-weight: 600; }
.rv a { font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.ext { width: 15px; height: 15px; }
.iconbtn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--subtle); cursor: pointer; padding: 0; flex: none; }
.iconbtn:hover { background: var(--field); }
.iconbtn svg { width: 19px; height: 19px; }
.iconbtn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.rv.status { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--link); box-shadow: 0 0 0 0 var(--link); animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--link) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.panels[data-status="partially_paid"] .dot { background: var(--warn); animation: none; }
.panels[data-status="paid"] .dot { background: var(--ok); animation: none; }
.panels:is([data-status="expired"], [data-status="canceled"]) .dot { background: var(--danger); animation: none; }

.rv.timer { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 600; }
.rv.timer.low { color: var(--warn); }
.ring { width: 18px; height: 18px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: var(--track); stroke-width: 2.4; }
.ring .prog { stroke: currentColor; stroke-dasharray: 100; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear; }

/* ---------- choose a coin and network ---------- */
.field-label { display: block; margin: 20px 0 8px; font-weight: 700; font-size: 14px; }
.select { position: relative; }
.select-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 0 14px; border-radius: 14px;
  border: 1px solid var(--sep); background: var(--field); cursor: pointer; text-align: start;
}
.select-btn:disabled { cursor: default; opacity: .55; }
.select-btn[aria-expanded="true"], .select-btn:focus-visible { border-color: var(--link); outline: none; box-shadow: 0 0 0 3px var(--accent-wash); }
.select-btn .val { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.select-btn .ph { color: var(--hint); }
.chev { width: 18px; height: 18px; color: var(--subtle); flex: none; transition: transform .15s; }
.select-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.menu {
  position: absolute; z-index: 10; inset-inline: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--sep); border-radius: 14px; max-height: 300px; overflow: auto;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .28);
}
.menu li { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; cursor: pointer; }
.menu li:hover, .menu li:focus { background: var(--field); outline: none; }
.menu li[aria-selected="true"] { background: var(--accent-wash); }
.menu .muted, .val .muted { color: var(--subtle); font-size: 13.5px; }
.ico { width: 24px; height: 24px; flex: none; display: block; }
.badge { margin-inline-start: auto; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge.fee-low { color: var(--ok); background: var(--ok-wash); }
.badge.fee-high { color: var(--warn); background: var(--warn-wash); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; margin-top: 22px; padding: 0 20px;
  border-radius: 14px; background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; border: 0; cursor: pointer; width: 100%;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.sec { background: var(--field); color: var(--link); }
.btn .arrow, .btn .cp { width: 18px; height: 18px; }
:root[dir="rtl"] .btn .arrow { transform: scaleX(-1); }

/* ---------- send ---------- */
.v-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.linkbtn { border: 0; background: none; color: var(--link); font-weight: 600; cursor: pointer; font-size: 14px; padding: 0; }
.qr { margin: 22px 0 0; display: flex; justify-content: center; }
/* corner marks around the code, like a scanner's viewfinder */
.qr-frame { position: relative; padding: 9px; }
.qr-frame::before {
  content: ""; position: absolute; inset: 0; border: 2px solid var(--link); border-radius: 20px; pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) 0 0 / 30px 30px no-repeat, linear-gradient(#000 0 0) 100% 0 / 30px 30px no-repeat,
    linear-gradient(#000 0 0) 0 100% / 30px 30px no-repeat, linear-gradient(#000 0 0) 100% 100% / 30px 30px no-repeat;
  mask: linear-gradient(#000 0 0) 0 0 / 30px 30px no-repeat, linear-gradient(#000 0 0) 100% 0 / 30px 30px no-repeat,
    linear-gradient(#000 0 0) 0 100% / 30px 30px no-repeat, linear-gradient(#000 0 0) 100% 100% / 30px 30px no-repeat;
}
.qr-box { position: relative; width: 212px; padding: 8px; background: #fff; border-radius: 14px; }
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-logo { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; padding: 4px; transform: translate(-50%, -50%); background: #fff; border-radius: 50%; }
.qr-logo .ico { width: 100%; height: 100%; }
.qr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.qr-actions .btn { width: auto; margin-top: 0; min-height: 46px; flex: 1 1 auto; max-width: 240px; padding: 0 16px; white-space: nowrap; }
/* phones: "open in wallet" gets its own row, copy and share go under it */
@media (max-width: 560px) {
  .qr-actions a.btn { flex-basis: 100%; max-width: none; }
  .qr-actions button.btn:not(.square) { max-width: none; }
}
.qr-actions .btn.square { flex: none; width: 46px; padding: 0; }
.qr-actions .btn.square svg { width: 20px; height: 20px; }

.details { margin-top: 20px; padding: 2px 18px; background: var(--field); border-radius: 16px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 0; }
.pair .v { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pair .ico { width: 20px; height: 20px; }
.k { display: block; color: var(--subtle); font-size: 13px; margin-bottom: 4px; }
.kv { padding: 14px 0; border-top: 1px solid var(--sep); }
.copyrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 0; border: 0; background: none;
  cursor: pointer; text-align: start; font-size: 15px; font-weight: 600; color: var(--text);
}
.copyrow .cp { width: 19px; height: 19px; flex: none; color: var(--subtle); }
.copyrow.done .cp { color: var(--ok); }
.addr { overflow-wrap: anywhere; font-size: 14px; font-weight: 500; }
.addr em { font-style: normal; font-weight: 700; color: var(--link); }
.memo { margin: 0 -18px; padding: 14px 18px; background: var(--accent-wash); }
.memo:last-child { border-radius: 0 0 16px 16px; }
.memo .k { color: var(--link); font-weight: 700; }
.memo .code { display: inline-flex; gap: .45em; font-size: 22px; letter-spacing: .05em; }
.memo .code span:first-child { color: var(--link); }

.notes { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; font-size: 13.5px; color: var(--subtle); }
.notes li { position: relative; padding-inline-start: 22px; }
.notes li::before { content: ""; position: absolute; inset-inline-start: 4px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--hint); }
.notes .strong { color: var(--link); font-weight: 600; }
.notes .strong::before { background: var(--link); }
.notes .warn { padding: 10px 14px; border-radius: 12px; background: var(--warn-wash); color: var(--warn); }
.notes .warn::before { display: none; }
.notes .info::before {
  width: 15px; height: 15px; top: .2em; inset-inline-start: 0; background: none; border: 1.6px solid var(--hint);
}
.tc-pay { display: block; margin: 16px auto 0; }
.tc-msg { text-align: center; color: var(--subtle); font-size: 13px; margin: 8px 0 0; min-height: 0; }
.tc-msg:empty { display: none; }
.notice { margin: 0 0 18px; padding: 12px 14px; border-radius: 12px; background: var(--warn-wash); color: var(--warn); font-size: 14px; }

/* ---------- outcome ---------- */
.outcome { text-align: center; }
.outcome .stamp-wrap { display: flex; justify-content: center; margin: 4px 0 10px; }
.outcome h2 { font-size: 22px; font-weight: 800; }
.outcome .big { font-size: clamp(24px, 6vw, 30px); margin-top: 6px; }
.outcome > p { color: var(--subtle); margin: 8px 0 0; }
.outcome .details { text-align: start; margin-top: 18px; }
.outcome .details .kv:first-child { border-top: 0; }
.outcome .kv a { font-size: 13.5px; font-weight: 600; text-decoration: none; }
.redirect { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px 16px; border-radius: 16px; background: var(--field); text-align: start; }
.redirect .count { position: relative; display: grid; place-items: center; width: 42px; height: 42px; flex: none; font-weight: 700; }
.redirect .count svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.redirect .count circle { fill: none; stroke: var(--track); stroke-width: 2.4; }
.redirect .count .prog { stroke: var(--link); stroke-dasharray: 100; transition: stroke-dashoffset 1s linear; }
.redirect b { display: block; font-size: 14.5px; }
.outcome .btn { margin-top: 16px; }

.stamp { display: block; transform: rotate(var(--rot, -13deg)); }
.stamp.green { color: var(--ok); }
.stamp.red { color: var(--danger); }
.stamp.accent { color: var(--link); }
:root[data-theme="light"] .stamp { mix-blend-mode: multiply; }
.press { animation: press .5s cubic-bezier(.2, .9, .25, 1.25) both; }
@keyframes press {
  0% { transform: scale(2) rotate(-32deg); opacity: 0; }
  55% { transform: scale(.92) rotate(-11deg); opacity: 1; }
  100% { transform: scale(1) rotate(var(--rot, -13deg)); opacity: 1; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 30; top: 14px; inset-inline-end: 14px; max-width: calc(100vw - 28px);
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px;
  background: var(--ok-wash); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }

/* ---------- disclaimer ---------- */
.disclaimer { margin: 12px 0 0; padding: 14px 18px; background: var(--surface); border: 1px solid var(--sep); border-radius: 16px; color: var(--subtle); font-size: 12.5px; line-height: 1.75; }
.disclaimer h2 { margin: 0 0 2px; font-size: 13px; font-weight: 700; color: var(--text); }
.disclaimer p { margin: 0; }

/* ---------- verified merchant ---------- */
.vtick { width: 20px; height: 20px; vertical-align: -4px; }
.vmark { display: inline-flex; color: var(--link); }
.vmark.endorsed { color: var(--ok); }
.vline { font-size: 12.5px; font-weight: 600; color: var(--link); }
.vline.endorsed { color: var(--ok); }
.trust { display: grid; grid-template-columns: 26px 1fr; gap: 10px; margin: 12px 0 0; padding: 14px 18px; border-radius: 16px; background: var(--accent-wash); font-size: 13px; line-height: 1.75; color: var(--subtle); }
.trust.endorsed { background: var(--ok-wash); }
.trust .vtick { width: 26px; height: 26px; }
.trust h2 { margin: 0 0 2px; font-size: 14px; font-weight: 700; color: var(--text); }
.trust p { margin: 0; }

/* ---------- tooltip ---------- */
.tip { position: relative; }
.tip-text {
  position: absolute; z-index: 20; bottom: calc(100% + 6px); inset-inline-end: 0; width: max-content; max-width: 250px;
  padding: 8px 12px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 12.5px; line-height: 1.6;
  opacity: 0; visibility: hidden; transition: opacity .12s;
}
.tip:hover .tip-text, .tip:focus-within .tip-text { opacity: 1; visibility: visible; }

/* ---------- generic pages (home, docs, errors) ---------- */
.card { background: var(--surface); border-radius: 16px; padding: 20px; margin-bottom: 12px; }
.card.status { text-align: center; }
.card .icon { font-size: 40px; }
.card .shop, .card h1 { font-weight: 800; font-size: 26px; }
.card .btn.sec, a.btn.sec { background: var(--field); color: var(--link); }
.foot { text-align: center; color: var(--hint); font-size: 12.5px; margin-top: 18px; }
.foot a { color: var(--hint); }

@media (prefers-reduced-motion: reduce) {
  .press, .dot, .toast, .iconbtn.spin svg { animation: none; }
  .ring .prog, .redirect .count .prog { transition: none; }
}
