:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --ink: #111827;
  --muted: #9ca3af;
  --line: #f3f4f6;
  --soft: #f9fafb;
  --green: #26a17b;
  --green-soft: #f0faf6;
  --green-border: #d1ede4;
  --radius: 24px;
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "SF Pro Display", "SF Pro Text", BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button { font: inherit; }

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
}

.card-wrap {
  width: min(450px, 100%);
  opacity: 0;
  animation: cardIn .5s cubic-bezier(.22,1,.36,1) .05s forwards;
}

.card {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 2px 20px rgba(0,0,0,.08), 0 0 0 .5px rgba(0,0,0,.06);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--line);
  opacity: 0;
  animation: fadeUp .4s ease .15s forwards;
}

.card-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  height: 34px;
  padding: 0 28px 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E")
    right 8px center / 12px no-repeat,
    #fff;
  color: #0f172a;
  font: 600 12px/1 Inter, system-ui, sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lang-select:focus {
  outline: none;
  border-color: rgba(38, 161, 123, 0.55);
  box-shadow: 0 0 0 3px rgba(38, 161, 123, 0.15);
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.card-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.token-badge {
  width: 40px;
  height: 40px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
}

.amount-block {
  padding: 20px 24px 0;
  opacity: 0;
  animation: fadeUp .4s ease .25s forwards;
}

.receive-box {
  position: relative;
  margin-bottom: 10px;
  padding: 20px;
  border: 1px solid var(--green-border);
  border-radius: 16px;
  background: linear-gradient(135deg, #f0faf6 0%, #e8f7f1 100%);
}

.receive-box .label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.receive-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.receive-row strong {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
}

.receive-row span {
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.receive-fiat {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
}

.usd-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid #f0f0f0;
  border-radius: 16px;
  background: var(--soft);
}

.usd-box .label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.usd-box strong {
  font-size: 16px;
}

.details {
  padding: 0 24px;
  opacity: 0;
  animation: fadeUp .4s ease .35s forwards;
}

.details-toggle {
  width: 100%;
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.details-toggle-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-pill {
  padding: 2px 8px;
  border-radius: 999px;
  color: #16a34a;
  background: #f0fdf4;
  font-size: 10px;
  font-weight: 700;
}

.chevron {
  width: 16px;
  height: 16px;
  color: #d1d5db;
  transition: transform .3s cubic-bezier(.22,1,.36,1);
}

.chevron.open { transform: rotate(180deg); }

.details-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .38s cubic-bezier(.22,1,.36,1);
}

.details-body.open { max-height: 420px; }

.details-list {
  display: grid;
  gap: 8px;
  padding-bottom: 16px;
}

.detail-row {
  padding: 14px 16px;
  border: 1px solid #f0f0f0;
  border-radius: 16px;
  background: var(--soft);
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .25s ease, transform .25s ease;
}

.detail-row.visible {
  opacity: 1;
  transform: none;
}

.detail-row .label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.detail-row .value {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

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

.from-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.visa-chip {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.visa-chip img { width: 22px; height: auto; }

.from-main .muted { color: var(--muted); font-weight: 500; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.network-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  color: #16a34a;
  background: #f0fdf4;
  font-size: 10px;
  font-weight: 700;
}

.cta-block {
  padding: 8px 24px 24px;
  opacity: 0;
  animation: fadeUp .4s ease .45s forwards;
}

.cta {
  position: relative;
  width: 100%;
  padding: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  color: #fff;
  background: #111827;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

.cta:hover { background: #1f2937; }
.cta:active { transform: scale(.985); }
.cta svg { width: 16px; height: 16px; }

.cta.is-claimed {
  background: #0f766e;
}

.cta.is-claimed:hover { background: #0d9488; }

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

.terms-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.terms-link:hover {
  color: #1e8a68;
}

/* Terms modal */
.terms-overlay {
  z-index: 1050;
  place-items: center;
  align-items: center;
}

.terms-modal {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(86vh, 720px);
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(0,0,0,.22);
  text-align: left;
}

.terms-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.terms-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.terms-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.terms-x {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: #f3f4f6;
  color: #4b5563;
  cursor: pointer;
  flex-shrink: 0;
}

.terms-x:hover { background: #e5e7eb; }

.terms-body {
  flex: 1;
  overflow: auto;
  padding: 16px 20px 8px;
  color: #334155;
  font-size: 12.5px;
  line-height: 1.65;
  -webkit-overflow-scrolling: touch;
}

.terms-body h3 {
  margin: 18px 0 8px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.terms-body h3:first-child { margin-top: 0; }

.terms-body p {
  margin: 0 0 10px;
  text-align: left;
}

.terms-end {
  margin-top: 18px !important;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: #0f172a;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.55;
}

.terms-foot {
  padding: 12px 20px 18px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.terms-accept {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  font: 700 14px/1 Inter, system-ui, sans-serif;
  cursor: pointer;
}

.terms-accept:hover { background: #1f2937; }
.terms-accept:active { transform: scale(.985); }

.trust-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  opacity: 0;
  animation: fadeUp .4s ease .55s forwards;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #d1d5db;
  font-size: 10px;
  letter-spacing: .04em;
}

.trust-item svg { width: 12px; height: 12px; }
.trust-sep { width: 1px; height: 12px; background: #e5e7eb; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Rate loading modal */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, .45);
  backdrop-filter: blur(6px);
}

.overlay.is-open { display: grid; }

.modal {
  width: min(360px, 100%);
  padding: 28px 24px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0,0,0,.18);
  text-align: center;
}

.modal-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 16px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

.modal h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
}

.modal p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

/* Receipt check */
.check-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, .5);
  backdrop-filter: blur(8px);
}

.check-overlay.is-open { display: grid; }

.check {
  width: min(420px, 100%);
  overflow: hidden;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(0,0,0,.22);
}

.check-top {
  padding: 28px 24px 20px;
  text-align: center;
  background: linear-gradient(180deg, #f0faf6, #fff);
}

.check-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  box-shadow: 0 10px 24px rgba(38,161,123,.28);
}

.check-icon svg { width: 28px; height: 28px; }

.check-top h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 800;
}

.check-top p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.check-body {
  padding: 8px 24px 24px;
  display: grid;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #f0f0f0;
  border-radius: 14px;
  background: var(--soft);
}

.check-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.check-row strong {
  font-size: 14px;
  text-align: right;
  overflow-wrap: anywhere;
}

.check-balance {
  border-color: var(--green-border);
  background: linear-gradient(135deg, #f0faf6, #e8f7f1);
}

.check-balance strong {
  color: var(--green);
  font-size: 20px;
}

.confirms-row {
  align-items: center;
}

.confirms-value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
}

.live-dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(38,161,123,.55);
  animation: livePulse 1.4s ease-out infinite;
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1.5px solid rgba(38,161,123,.35);
  border-radius: 50%;
  animation: liveRing 1.4s ease-out infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(38,161,123,.5); }
  70% { box-shadow: 0 0 0 8px rgba(38,161,123,0); }
  100% { box-shadow: 0 0 0 0 rgba(38,161,123,0); }
}

@keyframes liveRing {
  0% { transform: scale(.7); opacity: .9; }
  100% { transform: scale(1.5); opacity: 0; }
}

.check-close {
  width: 100%;
  margin-top: 6px;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: #111827;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.check-close:hover { background: #1f2937; }

@media (max-width: 720px) {
  .page {
    align-items: flex-start;
    padding: 40px 16px 48px;
  }
}

@media (max-width: 420px) {
  .page { padding-top: 28px; }
  .receive-row strong { font-size: 30px; }
}
