:root {
  color-scheme: light;
  --page: #f6f2e8;
  --paper: rgba(255, 255, 255, 0.9);
  --ink: #111827;
  --muted: #5f6472;
  --soft: #8a909d;
  --line: rgba(17, 24, 39, 0.12);
  --line-strong: rgba(17, 24, 39, 0.2);
  --yellow: #ffd400;
  --blue: #1d4ed8;
  --green: #047857;
  --red: #dc2626;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: sans-serif;
  color: var(--ink);
  background:
    radial-gradient(780px 480px at 12% 8%, rgba(255, 212, 0, 0.32), transparent 62%),
    radial-gradient(680px 460px at 92% 0%, rgba(59, 130, 246, 0.16), transparent 58%),
    linear-gradient(145deg, #fff8df 0%, #f7f4ee 46%, #eef4ff 100%);
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

.pay-shell {
  min-height: 100vh;
  width: min(100% - 28px, 1000px);
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom));
}

.pay-card {
  position: relative;
  width: min(100%, 660px);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.82)),
    var(--paper);
  box-shadow:
    0 34px 90px rgba(100, 84, 35, 0.16),
    0 0 0 1px rgba(17, 24, 39, 0.04);
}

.back-link {
  display: inline-flex;
  width: max-content;
  margin-bottom: 20px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #334155;
  background: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 14px;
}

.pay-head {
  display: grid;
  justify-items: center;
  gap: 20px;
  margin-bottom: 28px;
  text-align: center;
}

.payment-demo {
  width: min(100%, 600px);
  height: auto;
  display: block;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.pay-desc {
  max-width: 430px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(18px, 4.4vw, 24px);
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: -0.05em;
}

.chain-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin-bottom: 14px;
}

.chain-card {
  width: 100%;
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.chain-card:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(255, 255, 255, 0.94);
}

.chain-card.active {
  border-color: rgba(29, 78, 216, 0.56);
  background: #eef5ff;
  box-shadow:
    0 14px 28px rgba(29, 78, 216, 0.12),
    inset 0 0 0 1px rgba(29, 78, 216, 0.08);
}

.chain-card.disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.chain-card strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.chain-logo {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
}

.chain-logo svg {
  width: 38px;
  height: 38px;
  display: block;
}

.connect-row,
.action-row {
  display: grid;
  gap: 10px;
}

.connect-row {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
}

.status-box,
.pay-summary {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.78);
}

.status-line {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.status-line.good {
  color: var(--green);
}

.status-line.bad {
  color: var(--red);
}

.wallet-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wallet-inline-change {
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(29, 78, 216, 0.24);
  border-radius: 999px;
  color: var(--blue);
  background: rgba(239, 246, 255, 0.86);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.summary-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
}

.summary-row span:first-child {
  color: var(--soft);
}

.summary-row code {
  overflow-wrap: anywhere;
  color: #1f2937;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.wallet-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(8px);
}

.wallet-modal__panel {
  position: relative;
  width: min(100%, 460px);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);
}

.wallet-modal__panel h2 {
  margin: 0 36px 8px 0;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.wallet-modal__panel p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.wallet-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(248, 250, 252, 0.86);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.wallet-options {
  display: grid;
  gap: 9px;
}

.wallet-option,
.wallet-add-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 15px;
  padding: 0 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.wallet-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(248, 250, 252, 0.86);
  text-align: left;
}

.wallet-option.active {
  border-color: rgba(29, 78, 216, 0.46);
  background: #eef5ff;
}

.wallet-option code {
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1f2937;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.wallet-option__tag {
  min-width: 42px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(219, 234, 254, 0.9);
  font-size: 13px;
  line-height: 1;
  text-align: center;
}

.wallet-option.active .wallet-option__tag {
  color: #ffffff;
  background: var(--green);
  font-size: 13px;
}

.wallet-add-btn {
  margin-top: 11px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  color: #111827;
  background: linear-gradient(135deg, #ffd400, #ffe681);
}

.folder-guide__panel {
  width: min(100%, 500px);
  text-align: center;
}

.folder-guide__message {
  max-width: 380px;
  margin: 2px auto 20px !important;
}

.folder-guide__icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 18px;
  color: #111827;
  background: linear-gradient(135deg, #ffd400, #ffe681);
  box-shadow: 0 12px 24px rgba(255, 212, 0, 0.2);
}

.folder-guide__icon svg {
  width: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.folder-guide__actions {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 10px;
}

.folder-guide__cancel,
.folder-guide__confirm {
  min-height: 48px;
  border-radius: 15px;
  font: inherit;
  font-weight: 900;
}

.folder-guide__cancel {
  border: 1px solid var(--line);
  color: #475569;
  background: #ffffff;
}

.folder-guide__confirm {
  border: 1px solid rgba(17, 24, 39, 0.08);
  color: #111827;
  background: linear-gradient(135deg, #ffd400, #ffe681);
}

.action-row {
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
}

.payment-note {
  margin: 9px 2px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.download-controls {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 0;
}

.download-control-btn {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: #1f2937;
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.download-control-btn:disabled {
  cursor: default;
  opacity: 0.5;
}

.wallet-btn,
.pay-btn,
.verify-btn,
.download-btn {
  min-height: 50px;
  border-radius: 15px;
  padding: 0 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, opacity 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.wallet-btn.loading,
.pay-btn.loading,
.verify-btn.loading,
.wallet-add-btn.loading,
.download-btn.loading {
  position: relative;
  color: transparent;
}

.wallet-btn.loading::after,
.pay-btn.loading::after,
.verify-btn.loading::after,
.wallet-add-btn.loading::after,
.download-btn.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  color: #111827;
  animation: spin 0.72s linear infinite;
}

.verify-btn.loading::after {
  color: #1f2937;
}

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

.verify-btn {
  border: 1px solid var(--line);
  color: #1f2937;
  background: rgba(255, 255, 255, 0.72);
}

.wallet-btn {
  min-height: 54px;
  color: #ffffff;
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.22);
}

.wallet-btn + .wallet-btn {
  color: #ffffff;
  border-color: rgba(37, 99, 235, 0.18);
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.22);
}

.pay-btn,
.download-btn {
  border: 1px solid rgba(17, 24, 39, 0.08);
  color: #111827;
  background: linear-gradient(135deg, #ffd400, #ffe681);
  box-shadow: 0 12px 24px rgba(255, 212, 0, 0.22);
}

.wallet-btn:hover,
.pay-btn:hover,
.verify-btn:hover,
.download-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.44;
  transform: none !important;
  box-shadow: none !important;
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
}

.action-row > .download-btn {
  grid-column: 1 / -1;
  margin-top: 0;
}

@media (max-width: 620px) {
  .pay-shell {
    width: min(100% - 18px, 1000px);
    place-items: start center;
  }

  .pay-card {
    padding: 18px;
    border-radius: 22px;
  }

  .payment-demo {
    width: 100%;
    border-radius: 0;
  }

  .chain-list,
  .connect-row,
  .action-row {
    grid-template-columns: 1fr;
  }

  .chain-card {
    min-height: 62px;
  }

  .summary-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .wallet-modal__panel {
    padding: 20px;
    border-radius: 20px;
  }

}
