/* Hosted checkout — лейаут референса 2328, палитра партнёрского портала. */

:root {
  --bg: #090a0c;
  --panel: #111318;
  --panel-2: #171a20;
  --panel-3: #1d2027;
  --text: #f3f2ed;
  --muted: #9a9c96;
  --quiet: #686b66;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.28);
  --accent: #d2ff38;
  --accent-ink: #14180a;
  --danger: #ff6b42;
  --ok: #6ee787;
  --blue: #75b7ff;
  --radius: 16px;
  --radius-sm: 10px;

  color-scheme: dark;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

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

html { min-width: 320px; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
  padding: clamp(16px, 4vw, 48px);
  background: var(--bg);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.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;
}

/* ---------- Каркас карточки ---------- */

.checkout {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.summary {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: clamp(24px, 4vw, 40px);
  border-right: 1px solid var(--line);
  border-radius: var(--radius) 0 0 var(--radius);
}

.stage {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: clamp(24px, 4vw, 40px);
  background: var(--panel-2);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ---------- Шапка ---------- */

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 800;
}

.brand-tools { display: flex; align-items: center; gap: 4px; }

.icon-button {
  min-width: 34px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.icon-button:hover { color: var(--text); background: var(--panel-3); }

/* ---------- Сумма ---------- */

.amount {
  margin: clamp(12px, 4vw, 34px) 0 0;
  font-size: clamp(38px, 7vw, 62px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
}
.amount em { font-style: normal; color: var(--accent); }

.order-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}
.order-row .label {
  color: var(--quiet);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.order-row code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
  word-break: break-all;
}

/* Разбивка заказа (появляется на шаге оплаты) */
.breakdown { display: grid; gap: 0; margin-top: 6px; }
.breakdown div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.breakdown div:last-child { border-bottom: 0; }
.breakdown dt { color: var(--muted); }
.breakdown dd { margin: 0; font-weight: 700; }
.breakdown .total { padding-top: 14px; font-size: 15px; }
.breakdown .total dt { color: var(--text); font-weight: 700; }
.breakdown .total dd { color: var(--accent); }

.summary-foot { margin-top: auto; padding-top: 20px; }

.support-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
}
.support-link:hover { color: var(--text); }

/* ---------- Заголовок шага ---------- */

.step-index {
  margin: 0;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.stage-head { display: grid; gap: 8px; }
.stage-head h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 29px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
}
.stage-head p:not(.step-index) { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

.stage-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 0;
  color: var(--accent);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.back-button:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Поля выбора ---------- */

.field { display: grid; gap: 9px; }

.field-label {
  color: var(--quiet);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.select-shell { position: relative; }

.select-trigger {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  color: var(--text);
  background: var(--panel);
  text-align: left;
}
.select-trigger:hover:not(:disabled) { border-color: var(--line-strong); }
.select-trigger[aria-expanded="true"] { border-color: var(--accent); }
.select-trigger:disabled { color: var(--quiet); opacity: 0.55; }
.select-trigger .placeholder { color: var(--quiet); }
.select-trigger .value { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; }
.select-trigger .value .dim { color: var(--muted); font-weight: 400; }
.select-trigger .chevron { flex: none; color: var(--muted); transition: transform 0.18s ease; }
.select-trigger[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.coin-badge {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---------- Выпадающий список ---------- */

.dropdown {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  max-height: 340px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel-3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.dropdown-search { padding: 10px; border-bottom: 1px solid var(--line); }
.dropdown-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: var(--panel);
  font-size: 14px;
  outline: 0;
}
.dropdown-search input::placeholder { color: var(--quiet); }

.dropdown-list { margin: 0; padding: 6px; overflow-y: auto; list-style: none; }

.option {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: transparent;
  text-align: left;
}
.option:hover, .option.is-active { background: var(--panel); }
.option .name { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; }
.option .name .dim { margin-left: 8px; color: var(--muted); font-weight: 400; }

.tag {
  flex: none;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dropdown-empty { padding: 22px 14px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Кнопки ---------- */

.primary-button {
  width: 100%;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.primary-button:hover:not(:disabled) { filter: brightness(1.08); }
.primary-button:disabled { color: rgba(243, 242, 237, 0.5); background: var(--panel-3); }

/* ---------- Шаг оплаты ---------- */

.pay-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(18px, 3vw, 30px);
  align-items: start;
}

.qr-frame {
  width: 176px;
  height: 176px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}
.qr-frame img, .qr-frame canvas { width: 100%; height: 100%; display: block; }

.pay-fields { display: grid; gap: 16px; min-width: 0; }

.send-line { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
/* Тикер и сеть — собственные имена: капс к ним не применяем. */
.send-line b { color: var(--accent); font-weight: 700; text-transform: none; letter-spacing: 0.02em; }

.copy-field {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  background: var(--panel);
}
.copy-field .text {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-all;
}
/* Первые и последние символы адреса — контрольные точки при сверке. */
.copy-field .text .edge { color: var(--accent); font-weight: 700; }

.copy-button {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}
.copy-button:hover { color: var(--text); background: var(--panel-3); }
.copy-button.is-done { color: var(--accent); }

.hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; text-align: center; }

.wait-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  background: var(--panel);
}
.wait-left { display: flex; align-items: center; gap: 11px; font-size: 14px; font-weight: 600; }
.wait-right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ok);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
}
.wait-right.is-urgent { color: var(--danger); }

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Финальный экран ---------- */

.result { display: grid; justify-items: center; gap: 16px; text-align: center; }

.stamp {
  border: 3px solid var(--ok);
  border-radius: 8px;
  padding: 8px 22px;
  color: var(--ok);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.06em;
  transform: rotate(-4deg);
}
.stamp.is-failed { border-color: var(--danger); color: var(--danger); }

.result-title { margin: 0; color: var(--ok); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.result-title.is-failed { color: var(--danger); }
.result p { margin: 0; color: var(--muted); font-size: 14px; }

.received {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 24px 18px;
  background: var(--panel);
}
.received .label { color: var(--quiet); font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.received .value { font-size: clamp(24px, 4vw, 34px); font-weight: 800; letter-spacing: -0.03em; }
.received .value em { font-style: normal; color: var(--accent); }
.received .approx { color: var(--muted); font-size: 13px; }

.result-fields { width: 100%; display: grid; gap: 14px; text-align: left; }

.field-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.explorer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
}
.explorer-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Подвал ---------- */

.powered {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}
.powered b { color: var(--text); }
.powered .brand-mark { width: 21px; height: 21px; border-radius: 6px; font-size: 10px; }

.notice {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

.state-message {
  display: grid;
  gap: 10px;
  padding: 40px 0;
  text-align: center;
}
.state-message h1 { margin: 0; font-size: 22px; font-weight: 800; }
.state-message p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Адаптив ---------- */

@media (max-width: 860px) {
  .checkout { grid-template-columns: minmax(0, 1fr); }
  .summary { border-right: 0; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
  .stage { border-radius: 0 0 var(--radius) var(--radius); }
  .amount { margin-top: 8px; }
  .summary-foot { margin-top: 4px; padding-top: 12px; }
}

@media (max-width: 620px) {
  .pay-grid { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .pay-fields { width: 100%; }
  .stage-top { flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  .select-trigger .chevron { transition: none; }
}
