*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f6f5f2;
  --shell: #e9e8e4;
  --card: #ffffff;
  --ink: #171a21;
  --muted: #6d727c;
  --line: #e6e7ea;
  --soft: #f6f7f9;
  --accent: #e8731c;
  --accent-ink: #ffffff;
  --ok: #1a8f55;
  --bad: #c93b3b;
  --warn-bg: #fff6dc;
  --warn-ink: #8a5a00;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.shell {
  width: 100%;
  max-width: 500px;
  padding: 20px 18px 22px;
  background: var(--shell);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(30, 30, 40, 0.08);
}

.head {
  text-align: center;
  padding: 2px 0 18px;
}

.logo {
  width: 54px;
  height: 54px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(160deg, #f08a33, #dd6410);
  color: #fff;
  font-size: 30px;
  font-weight: 800;
}

.ref {
  margin: 0;
  color: #9a9da4;
  font-size: 14px;
  word-break: break-all;
}

.total {
  margin: 4px 0 0;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 550;
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.timer b {
  font-weight: 550;
}

.timer.low {
  background: #fde3e3;
  color: var(--bad);
}

.tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--soft);
  border-radius: 10px;
}

.tabs a {
  padding: 9px 8px;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  font-weight: 550;
}

.tabs a.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(20, 20, 30, 0.12);
}

.steps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.steps li {
  padding-bottom: 8px;
  border-bottom: 3px solid var(--line);
}

.steps li.on,
.steps li.done {
  color: var(--ink);
  border-color: var(--accent);
}

.form {
  display: grid;
  gap: 16px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span {
  font-size: 13px;
  color: var(--muted);
}

.field small,
.hint,
.muted {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

input[type='text'],
input[type='search'],
select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236d727c' stroke-width='2'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(232, 115, 28, 0.35);
  border-color: var(--accent);
}

.coins {
  display: grid;
  gap: 8px;
  max-height: 330px;
  overflow-y: auto;
  padding: 2px;
}

.coin {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
}

.coin[hidden] {
  display: none;
}

.coin input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.coin:has(input:checked) {
  border-color: var(--accent);
  background: #fff8f2;
  box-shadow: 0 0 0 1px var(--accent);
}

.coin:has(input:focus-visible) {
  outline: 2px solid rgba(232, 115, 28, 0.45);
}

.coin-ico {
  width: 30px;
  height: 30px;
  flex: none;
}

.coin-text {
  display: grid;
  line-height: 1.25;
  min-width: 0;
}

.coin-text em {
  font-style: normal;
  font-size: 12.5px;
  color: var(--muted);
}

.net {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}

.link:hover {
  color: var(--ink);
}

.back {
  margin-top: 14px;
  text-align: center;
}

.alert,
.warn {
  margin: 0 0 16px;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 13.5px;
}

.alert {
  background: #fde8e8;
  color: #9c2424;
}

.warn {
  margin-top: 16px;
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.pay-box {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 18px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--soft);
}

.qr {
  width: 150px;
  height: 150px;
  flex: none;
  padding: 6px;
  border-radius: 8px;
  background: #fff;
}

.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.pay-info {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.pay-info dt {
  font-size: 13px;
  color: var(--muted);
}

.pay-info dd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 12px;
  font-size: 16px;
}

.pay-info dd:last-child {
  margin-bottom: 0;
}

.pay-info dd .coin-ico {
  width: 20px;
  height: 20px;
}

.pay-info dd b {
  font-weight: 600;
  word-break: break-all;
}

.pay-info dd .copy {
  margin-left: auto;
}

.line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.line > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.line span {
  font-size: 13px;
  color: var(--muted);
}

.line code,
.line strong {
  font-size: 15px;
  font-weight: 550;
  word-break: break-all;
}

.line code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.copy {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8b9099;
  cursor: pointer;
}

.copy:hover {
  background: var(--soft);
  color: var(--ink);
}

.copy.copied {
  background: #e3f5ea;
  color: var(--ok);
}

.state {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 18px 6px;
  text-align: center;
}

.state h2 {
  font-size: 19px;
  font-weight: 650;
}

.state p {
  margin: 0;
  color: var(--muted);
}

.state form,
.state .btn {
  width: 100%;
  margin-top: 8px;
}

.badge {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--soft);
}

.state.ok .badge {
  background: #e3f5ea url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a8f55' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center / 30px no-repeat;
}

.state.bad .badge {
  background: #fde8e8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c93b3b' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m7 7 10 10M17 7 7 17'/%3E%3C/svg%3E") center / 28px no-repeat;
}

.state.wait .badge {
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  background: none;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.foot {
  margin-top: 18px;
  text-align: center;
}

.foot span {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  color: #555a63;
}

@media (max-width: 460px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  .shell {
    border-radius: 0;
    min-height: 100vh;
  }

  .pay-box {
    flex-direction: column;
    align-items: stretch;
  }

  .qr {
    margin: 0 auto;
  }

  .row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .state.wait .badge {
    animation-duration: 3s;
  }
}

.sr-copy {
  position: fixed;
  top: 0;
  left: 0;
  opacity: 0;
}
