:root {
  color-scheme: dark;
  --bg: #07101d;
  --bg-deep: #040914;
  --surface: rgba(16, 30, 49, 0.9);
  --surface-strong: #111f33;
  --surface-soft: rgba(24, 42, 65, 0.72);
  --line: rgba(151, 178, 211, 0.16);
  --line-strong: rgba(151, 178, 211, 0.3);
  --text: #f4f8ff;
  --muted: #9fb0c6;
  --muted-light: #c7d3e3;
  --cyan: #40e5cf;
  --cyan-soft: rgba(64, 229, 207, 0.14);
  --violet: #8b7cff;
  --violet-soft: rgba(139, 124, 255, 0.16);
  --amber: #ffcb66;
  --amber-soft: rgba(255, 203, 102, 0.13);
  --red: #ff7d8d;
  --green: #59e495;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg-deep); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 15%, rgba(25, 114, 123, 0.18), transparent 35%),
    radial-gradient(circle at 85% 10%, rgba(99, 76, 188, 0.15), transparent 30%),
    linear-gradient(145deg, var(--bg-deep), var(--bg) 48%, #081422);
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(64, 229, 207, 0.45);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.14;
  pointer-events: none;
}
.ambient-one { top: -190px; left: -120px; background: var(--cyan); }
.ambient-two { right: -180px; bottom: -220px; background: var(--violet); }

.site-header {
  width: min(1180px, calc(100% - 40px));
  min-height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid rgba(64, 229, 207, .36);
  border-radius: 13px;
  background: #0a1728;
  box-shadow: 0 10px 28px rgba(64, 229, 207, .2);
}
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: 15px; letter-spacing: 0.01em; }
.brand-copy small { color: var(--muted); font-size: 12px; }
.header-trust { color: var(--muted-light); font-size: 13px; display: flex; align-items: center; gap: 9px; }
.trust-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(89, 228, 149, 0.1); }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.language-selector { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted-light); background: rgba(16, 29, 47, .58); }
.language-selector svg { width: 15px; height: 15px; flex: 0 0 auto; fill: none; stroke: var(--cyan); stroke-width: 1.65; }
.language-selector select { min-width: 90px; border: 0; outline: 0; color: inherit; background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.language-selector option { color: #07101d; background: #ffffff; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html[dir="rtl"] .payment-details code, html[dir="rtl"] .signature-controls input { direction: ltr; text-align: left; }
html[dir="rtl"] .toast { right: 50%; left: auto; transform: translateX(50%); }


.page-shell { width: min(1120px, calc(100% - 40px)); margin: 34px auto 50px; }
.checkout-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(390px, 1.1fr); gap: clamp(36px, 6vw, 76px); align-items: center; }
.summary-column { padding: 20px 0; }
.eyebrow { margin-bottom: 16px; color: var(--cyan); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 560px; margin-bottom: 16px; font-size: clamp(38px, 5vw, 64px); line-height: .99; letter-spacing: -.045em; }
.intro { max-width: 570px; margin-bottom: 30px; color: var(--muted-light); font-size: 17px; line-height: 1.65; }

.summary-card {
  max-width: 580px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(16, 29, 47, 0.64);
  backdrop-filter: blur(16px);
}
.summary-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.concept-line strong { display: block; font-size: 17px; line-height: 1.45; }
.amount-line { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-top: 22px; padding-top: 0; border-top: 0; }
.amount-line > div { text-align: right; }
.amount-line strong { font-size: 30px; letter-spacing: -.03em; }
.amount-line #base-asset-code { color: var(--cyan); font-size: 15px; font-weight: 800; }

.security-note { max-width: 580px; display: flex; gap: 14px; margin-top: 20px; color: var(--muted-light); }
.security-note svg { width: 26px; height: 26px; flex: 0 0 auto; fill: var(--cyan); }
.security-note strong { display: block; margin-bottom: 5px; color: var(--text); font-size: 14px; }
.security-note p { margin: 0; font-size: 13px; line-height: 1.55; }

.payment-card {
  position: relative;
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(21, 38, 61, .96), rgba(11, 23, 39, .97));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.payment-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, transparent, var(--cyan), var(--violet), transparent); opacity: .78; }
.payment-topline { display: flex; justify-content: space-between; align-items: start; gap: 18px; }
.payment-topline h2 { margin: 0; font-size: 27px; letter-spacing: -.025em; }
.network-badge { display: inline-flex; min-height: 29px; align-items: center; padding: 6px 10px; border: 1px solid rgba(139, 124, 255, .28); border-radius: 999px; background: var(--violet-soft); color: #c7beff; font-size: 11px; font-weight: 800; }

.status-strip { display: flex; gap: 13px; margin: 24px 0 26px; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); }
.status-strip strong { display: block; margin-bottom: 4px; font-size: 14px; }
.status-strip p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.status-icon { width: 12px; height: 12px; flex: 0 0 auto; margin-top: 3px; border: 3px solid rgba(64, 229, 207, .22); border-top-color: var(--cyan); border-radius: 50%; animation: spin 1s linear infinite; }
.status-strip[data-status="CONFIRMED"] { border-color: rgba(89, 228, 149, .28); background: rgba(89, 228, 149, .08); }
.status-strip[data-status="CONFIRMED"] .status-icon { border: 0; background: var(--green); box-shadow: 0 0 0 5px rgba(89, 228, 149, .11); animation: none; }
.status-strip[data-status="EXPIRED"], .status-strip[data-status="FAILED"] { border-color: rgba(255, 125, 141, .25); background: rgba(255, 125, 141, .08); }
.status-strip[data-status="EXPIRED"] .status-icon, .status-strip[data-status="FAILED"] .status-icon { border: 0; background: var(--red); animation: none; }
.status-strip[data-status="MANUAL_REVIEW"] { border-color: rgba(255, 203, 102, .28); background: var(--amber-soft); }
.status-strip[data-status="MANUAL_REVIEW"] .status-icon { border: 0; background: var(--amber); animation: none; }

.qr-wrap { position: relative; width: fit-content; margin: 0 auto; padding: 16px; border-radius: 20px; background: #fff; box-shadow: 0 16px 40px rgba(0, 0, 0, .28); }
.qr-code { width: 210px; min-height: 210px; display: grid; place-items: center; color: #07101d; }
.qr-code img, .qr-code canvas { display: block; width: 210px !important; height: 210px !important; }
.qr-code .qr-fallback { max-width: 180px; color: #283444; font-size: 12px; text-align: center; }
.qr-corner { position: absolute; width: 22px; height: 22px; border-color: var(--cyan); border-style: solid; }
.corner-one { top: -6px; left: -6px; border-width: 2px 0 0 2px; border-radius: 8px 0 0; }
.corner-two { top: -6px; right: -6px; border-width: 2px 2px 0 0; border-radius: 0 8px 0 0; }
.corner-three { bottom: -6px; right: -6px; border-width: 0 2px 2px 0; border-radius: 0 0 8px; }
.corner-four { bottom: -6px; left: -6px; border-width: 0 0 2px 2px; border-radius: 0 0 0 8px; }
.scan-hint { margin: 19px auto 17px; color: var(--muted); font-size: 12px; text-align: center; }

.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; border: 0; border-radius: 13px; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .18s ease, filter .18s ease, border-color .18s ease; }
.button:hover { transform: translateY(-1px); filter: brightness(1.06); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.button svg { width: 20px; height: 20px; fill: currentColor; }
.button-primary { width: 100%; color: #06101b; background: linear-gradient(110deg, var(--cyan), #75b8ff); box-shadow: 0 12px 28px rgba(64, 229, 207, .17); }
.button-secondary { min-height: 42px; border: 1px solid var(--line-strong); color: var(--text); background: rgba(255, 255, 255, .045); }
.wallet-actions { display: grid; gap: 10px; }
.wallet-actions .button-secondary { width: 100%; }
.wallet-feedback { display: block; min-height: 19px; margin-top: 10px; color: var(--muted-light); font-size: 11px; line-height: 1.45; text-align: center; }
.countdown-row { display: flex; justify-content: center; gap: 8px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.countdown-row strong { color: var(--muted-light); font-variant-numeric: tabular-nums; }

.payment-details { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.payment-details summary { color: var(--muted-light); font-size: 13px; font-weight: 700; cursor: pointer; }
.payment-details dl { display: grid; gap: 14px; margin: 18px 0 0; }
.payment-details dl > div { min-width: 0; }
.payment-details dt { margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.payment-details dd { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; }
.payment-details code { min-width: 0; flex: 1; overflow: hidden; color: var(--muted-light); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.copy-button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--cyan); background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }

.signature-form { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.signature-form label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 800; }
.signature-form > p { margin-bottom: 12px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.signature-controls { display: flex; gap: 9px; }
.signature-controls input { min-width: 0; flex: 1; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 11px; outline: 0; color: var(--text); background: rgba(3, 10, 20, .42); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.signature-controls input:focus { border-color: rgba(64, 229, 207, .55); }
.form-feedback { display: block; min-height: 18px; margin-top: 8px; color: var(--muted); font-size: 11px; }

.loading-panel, .message-panel { min-height: 460px; display: flex; align-items: center; justify-content: center; gap: 18px; text-align: left; }
.loading-panel strong { font-size: 18px; }
.loading-panel p, .message-panel p { margin: 6px 0 0; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(64, 229, 207, .14); border-top-color: var(--cyan); border-radius: 50%; animation: spin 1s linear infinite; }
.message-panel { max-width: 650px; margin: 0 auto; }
.message-panel h1 { margin-bottom: 10px; font-size: 34px; }
.message-panel .button { margin-top: 20px; }
.message-icon { width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(255, 125, 141, .3); border-radius: 50%; color: var(--red); background: rgba(255, 125, 141, .08); font-size: 25px; font-weight: 900; }

.site-footer { width: min(1120px, calc(100% - 40px)); display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 auto; padding: 0 0 32px; color: #708198; font-size: 11px; }
.footer-separator { width: 3px; height: 3px; border-radius: 50%; background: #586a82; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 11px 15px; border: 1px solid rgba(64, 229, 207, .25); border-radius: 12px; color: var(--text); background: #13243a; box-shadow: 0 14px 36px rgba(0, 0, 0, .32); font-size: 12px; }

[hidden] { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 840px) {
  .checkout-grid { grid-template-columns: 1fr; gap: 28px; }
  .summary-column { padding-bottom: 0; }
  h1 { font-size: clamp(38px, 12vw, 58px); }
  .summary-card, .security-note { max-width: none; }
}

@media (max-width: 560px) {
  .site-header, .page-shell, .site-footer { width: min(100% - 26px, 1120px); }
  .site-header { min-height: 76px; }
  .header-trust { display: none; }
  .header-actions { gap: 8px; }
  .language-selector { min-height: 34px; padding: 0 7px; }
  .language-selector select { min-width: 82px; font-size: 11px; }
  .page-shell { margin-top: 20px; }
  .summary-column { padding-top: 5px; }
  .intro { font-size: 15px; }
  .payment-card { padding: 24px 18px; border-radius: 22px; }
  .qr-code, .qr-code img, .qr-code canvas { width: 190px !important; height: 190px !important; min-height: 190px; }
  .signature-controls { flex-direction: column; }
  .signature-controls .button { width: 100%; }
  .amount-line { align-items: center; }
  .amount-line strong { font-size: 26px; }
  .site-footer { flex-wrap: wrap; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


.payment-amount-panel { margin: 1rem 0 1.25rem; padding: 1rem 1.1rem; border: 1px solid rgba(83, 220, 195, .28); border-radius: 14px; background: rgba(20, 57, 66, .35); }
.payment-amount-panel > div { margin-top: .35rem; font-size: 1.4rem; }
.payment-amount-panel small { display: block; margin-top: .4rem; color: var(--muted); }
#active-payment > .button + .button { margin-left: .65rem; }
