/* Swap page, coin picker and the home-page swap widget. Uses the tokens from site.css. */

.swap-page { padding-top: 56px; padding-bottom: 96px; display: grid; gap: 32px; justify-items: center; }
.swap-intro { text-align: center; max-width: 620px; }
.swap-intro h1 { font-size: clamp(2rem, 1.4rem + 2vw, 2.8rem); font-weight: 700; }
.swap-intro .lead { margin-top: 12px; color: var(--muted); }

.swap-card {
  width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 24px; box-shadow: 0 1px 2px rgba(20, 32, 51, .04), 0 12px 32px -18px rgba(20, 32, 51, .25); scroll-margin-top: 90px;
}
.pane { display: grid; gap: 16px; }
.pane[hidden] { display: none; }

/* stepper */
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 22px; counter-reset: st; }
.stepper li { counter-increment: st; font-size: .82rem; color: var(--muted); display: grid; gap: 6px; }
.stepper li::before { content: ""; height: 4px; border-radius: 4px; background: var(--line); }
.stepper li::after { content: counter(st) ". "; order: -1; display: none; }
.stepper li.on { color: var(--ink); font-weight: 500; }
.stepper li.on::before { background: var(--action); }
.swap-card .btn { min-height: 52px; }
.stepper li.done::before { background: var(--ok); }

/* send / get legs */
.leg { background: var(--sunk); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.leg:focus-within { border-color: var(--action); }
.leg-label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
.leg-row { display: flex; align-items: center; gap: 10px; }
.amount {
  flex: 1; min-width: 0; border: 0; background: transparent; font-family: inherit; font-size: 1.8rem; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; color: var(--ink);
  padding: 4px 0; outline: none; font-variant-numeric: tabular-nums;
}
.amount.out { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amount.out.loading { color: var(--muted); animation: swap-pulse 1s ease-in-out infinite alternate; }
@keyframes swap-pulse { to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .amount.out.loading { animation: none; } }

.coin-btn {
  display: inline-flex; align-items: center; gap: 8px; flex: none; max-width: 60%; min-height: 48px; padding: 6px 12px 6px 8px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: .98rem; font-weight: 600; line-height: 1.15; cursor: pointer; text-align: left;
}
.coin-btn:hover { border-color: var(--action); }
.coin-btn::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); margin-left: 4px; flex: none; }
.coin-btn .ci { display: inline-flex; flex: none; }
.coin-btn .ci img { width: 26px; height: 26px; }
.coin-btn .ct { display: grid; min-width: 0; }
.coin-btn .ct small { font-weight: 400; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.flip {
  justify-self: center; width: 40px; height: 40px; margin: -14px 0; position: relative; z-index: 1; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 1.1rem; cursor: pointer;
}
.flip:hover { border-color: var(--action); color: var(--action); }

.terms, .review { margin: 0; display: grid; gap: 8px; font-size: .92rem; }
.terms > div, .review > div { display: flex; justify-content: space-between; gap: 16px; }
.terms dt, .review dt { color: var(--muted); flex: none; }
.terms dd, .review dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.review { background: var(--sunk); border-radius: 12px; padding: 14px; }
.review dd small { color: var(--muted); }
.review.small { font-size: .85rem; }
.review .mono, .mono { font-family: var(--mono); font-size: .86em; overflow-wrap: anywhere; }

.msg { padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: .92rem; }
.msg[hidden] { display: none; }
#msg4 { background: var(--action-soft); color: var(--ink); }
.fine { font-size: .82rem; color: var(--muted); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.nav-row { display: flex; gap: 10px; }
.nav-row .btn:last-child { flex: 1; }

/* address fields */
.field { display: grid; gap: 6px; }
.field[hidden] { display: none; }
.field label { font-weight: 500; font-size: .95rem; }
.field .opt { color: var(--muted); font-weight: 400; }
.field input {
  min-height: 48px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
  font: 500 .92rem var(--mono); color: var(--ink); width: 100%;
}
.field input:focus { outline: 3px solid var(--action-soft); border-color: var(--action); }
.field-hint { font-size: .82rem; color: var(--muted); }
.field-hint:empty { display: none; }
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.agree input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--action); flex: none; }

/* robot check */
.robot { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--sunk); flex-wrap: wrap; }
.robot-box { width: 28px; height: 28px; border: 2px solid var(--line-strong); border-radius: 6px; background: var(--surface); cursor: pointer; display: grid; place-items: center; flex: none; padding: 0; }
.robot-box:hover { border-color: var(--action); }
.robot-box.busy { border-color: var(--action); border-top-color: transparent; border-radius: 50%; animation: swap-spin .8s linear infinite; }
.robot-box.ok { border-color: var(--ok); background: var(--ok); }
.robot-box.ok .tick { width: 8px; height: 14px; border-right: 3px solid #fff; border-bottom: 3px solid #fff; transform: rotate(45deg) translate(-1px, -2px); }
@keyframes swap-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .robot-box.busy { animation: none; } }
#robot-text { font-weight: 500; }
.robot-brand { margin-left: auto; font-size: .74rem; color: var(--muted); }

/* deposit */
.deposit { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; align-items: center; outline: none; }
.qr { width: 180px; height: 180px; border-radius: 10px; border: 1px solid var(--line); background: #fff; image-rendering: pixelated; }
.dep-info { display: grid; gap: 8px; min-width: 0; }
.dep-addr, .dep-memo { background: var(--sunk); border-radius: 10px; padding: 10px 12px; font-size: .9rem; overflow-wrap: anywhere; }
.dep-memo[hidden] { display: none; }
.copy { margin-left: 6px; font-family: inherit; font-size: .78rem; font-weight: 500; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 6px; padding: 2px 8px; cursor: pointer; color: var(--action); }

.timeline { display: grid; gap: 0; border-left: 2px solid var(--line); margin-left: 8px; }
.timeline li { position: relative; padding: 4px 0 14px 20px; color: var(--muted); font-size: .94rem; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 8px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline li.now { color: var(--wait); font-weight: 500; }
.timeline li.now::before { border-color: var(--wait); background: var(--wait-soft); }
.timeline li.done { color: var(--ink); }
.timeline li.done::before { border-color: var(--ok); background: var(--ok); }
.timeline.failed li { color: var(--muted); }
.timeline.failed li::before { border-color: var(--line-strong); background: var(--surface); }

.swap-terms { width: 100%; max-width: 560px; }
.swap-terms h2 { font-size: 1.25rem; margin-bottom: 12px; }
.swap-terms ul { display: grid; gap: 8px; color: var(--muted); font-size: .94rem; list-style: disc; padding-left: 20px; }

/* coin picker */
.picker { position: fixed; inset: 0; background: rgba(20, 32, 51, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.picker[hidden] { display: none; }
.picker-card { width: 100%; max-width: 440px; max-height: min(640px, 90vh); background: var(--surface); border-radius: 16px; display: grid; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; }
.picker-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; }
.picker-head h2 { font-size: 1.1rem; }
.picker-x { width: 40px; height: 40px; border: 0; background: transparent; font-size: 1.5rem; cursor: pointer; color: var(--muted); border-radius: 8px; }
.picker-x:hover { background: var(--sunk); color: var(--ink); }
#picker-q { margin: 0 18px 10px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; font-size: .95rem; background: var(--surface); color: var(--ink); }
#picker-list { overflow-y: auto; padding: 0 8px 12px; overscroll-behavior: contain; }
#picker-list li { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
#picker-list li:hover, #picker-list li:focus { background: var(--action-soft); outline: none; }
#picker-list li > span { display: block; min-width: 0; line-height: 1.3; }
#picker-list li small { display: block; }
#picker-list li img { width: 26px; height: 26px; flex: none; }
#picker-list li .muted { color: var(--muted); font-weight: 400; font-size: .9rem; }
#picker-list li small { color: var(--muted); font-size: .78rem; }
#picker-list li.empty { color: var(--muted); cursor: default; justify-content: center; }

/* home-page widget */
.swap-home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 56px; align-items: center; }
.swap-home ul.checks { margin-top: 20px; display: grid; gap: 8px; color: var(--muted); }
.swap-home ul.checks li::before { content: "✓"; color: var(--ok); font-weight: 700; margin-right: 10px; }
.swap-mini { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: grid; gap: 14px; box-shadow: 0 12px 32px -18px rgba(20, 32, 51, .25); }
.swap-mini .msg { margin: 0; }
section[data-unavailable] .swap-mini [data-go] { display: none; }

@media (max-width: 860px) {
  .swap-home { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}
@media (max-width: 560px) {
  .swap-page { padding-top: 32px; }
  .swap-card { padding: 18px 16px; border-radius: 14px; }
  .stepper li { font-size: .74rem; }
  .deposit { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .dep-info { width: 100%; }
  .amount { font-size: 1.35rem; }
  .coin-btn { max-width: 56%; }
  .robot-brand { margin-left: 0; width: 100%; }
}

/* swap FAQ */
.swap-faq { width: 100%; max-width: 760px; margin-top: 24px; }
.swap-faq h2 { margin-bottom: 20px; }
