:root {
  color-scheme: light;
  --bg: #eef1f4;
  --sheet: #ffffff;
  --field: #ffffff;
  --field-border: #d7dce2;
  --field-focus: #42f68b;
  --green: #42f68b;
  --green-btn: #42f68b;
  --green-btn-hover: #36df7d;
  --text: #171a1f;
  --muted: #7a8089;
  --label: #444b55;
  --shadow: 0 26px 70px rgba(20, 25, 34, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.phone {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: #f7f9fb;
  color: var(--text);
}

.sheet {
  min-height: 100vh;
  background: var(--sheet);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  box-shadow: var(--shadow);
}

.sheet-inner {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 22px 0;
}

.header {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 14px 0 28px;
}

.header h1 {
  margin: 0;
  text-align: center;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 760;
  letter-spacing: 0;
}

.flow-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.label {
  display: block;
  margin: 0 0 12px;
  color: var(--label);
  font-size: 18px;
  font-weight: 720;
}

.address-field {
  height: 74px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 30px 30px;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
  padding: 0 16px;
  border: 2px solid var(--field-focus);
  border-radius: 14px;
  background: var(--field);
}

.addr-input {
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #4c535d;
  font-size: 18px;
  font-weight: 520;
  overflow: hidden;
  text-overflow: ellipsis;
}

.addr-input::placeholder {
  color: #8b919a;
}

.paste-btn,
.field-icon,
.max-btn {
  border: 0;
  background: transparent;
}

.paste-btn {
  min-height: 30px;
  padding: 0;
  color: var(--green);
  font-size: 17px;
  font-weight: 720;
}

.field-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--green);
  display: grid;
  place-items: center;
}

.field-icon svg {
  width: 30px;
  height: 30px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.amount-field {
  height: 78px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  border: 1.5px solid var(--field-border);
  border-radius: 14px;
  background: var(--field);
}

.amount-input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #5d646f;
  font-size: 20px;
  font-weight: 720;
}

.token-name {
  color: #20242a;
  font-size: 18px;
  font-weight: 380;
}

.max-btn {
  min-height: 30px;
  padding: 0;
  color: var(--green);
  font-size: 18px;
  font-weight: 720;
}

.approx {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 450;
}

.spacer {
  flex: 1;
  min-height: 150px;
}

.next-btn {
  width: 100%;
  height: 64px;
  margin: 0 0 28px;
  border: 0;
  border-radius: 34px;
  background: var(--green-btn);
  color: #08170f;
  font-size: 21px;
  font-weight: 720;
}

.next-btn:hover {
  background: var(--green-btn-hover);
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.hidden {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 30;
  transform: translateX(-50%) translateY(100px);
  max-width: min(520px, calc(100% - 28px));
  padding: 13px 16px;
  border-radius: 12px;
  background: #151922;
  color: #fff;
  box-shadow: 0 14px 40px rgba(17, 24, 39, 0.28);
  opacity: 0;
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.wallet-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(246, 248, 250, 0.88);
  backdrop-filter: blur(10px);
}

.wallet-overlay.hidden {
  display: none;
}

.wallet-modal {
  width: min(320px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 34px 24px;
  border: 1px solid #e1e5eb;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 25, 34, 0.16);
  text-align: center;
}

.trust-mark {
  width: 74px;
  height: 84px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0, 92% 16%, 86% 70%, 50% 100%, 14% 70%, 8% 16%);
  background: #3375ff;
  color: #fff;
  font-size: 38px;
  font-weight: 800;
}

.wallet-modal h2 {
  margin: 8px 0 0;
  color: #171a1f;
  font-size: 24px;
}

.wallet-modal p {
  max-width: 250px;
  margin: 0;
  color: #697281;
  line-height: 1.4;
}

.wallet-spinner {
  width: 34px;
  height: 34px;
  margin-top: 10px;
  border: 3px solid #e5e9ef;
  border-top-color: #3375ff;
  border-radius: 50%;
  animation: spin 780ms linear infinite;
}

.wallet-overlay.complete .trust-mark {
  background: var(--green);
}

.wallet-overlay.complete .wallet-spinner {
  display: none;
}

.sent-close,
.processing-visual,
.tx-details-btn {
  display: none;
}

.wallet-overlay.sent {
  padding: 0;
  background: #fff;
  backdrop-filter: none;
  place-items: end center;
}

.wallet-overlay.sent .wallet-modal {
  width: 100%;
  height: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  padding: 0 28px calc(42px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.wallet-overlay.sent .trust-mark,
.wallet-overlay.sent .wallet-spinner,
.wallet-overlay.sent .sent-close {
  display: none;
}

.wallet-overlay.sent .processing-visual {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  margin-bottom: 38px;
}

.processing-svg {
  width: 112px;
  height: 112px;
  display: block;
  overflow: visible;
}

.wallet-overlay.sent .wallet-modal h2 {
  margin: 0 0 18px;
  color: #171a1f;
  font-size: 28px;
  font-weight: 780;
}

.wallet-overlay.sent .wallet-modal p {
  max-width: 340px;
  color: #727984;
  font-size: 18px;
  line-height: 1.36;
  font-weight: 540;
}

.wallet-overlay.sent .tx-details-btn {
  display: block;
  width: 100%;
  height: 58px;
  margin-top: 46px;
  border: 0;
  border-radius: 999px;
  background: #42f68b;
  color: #07100b;
  font-size: 19px;
  font-weight: 760;
}

.tx-details-view {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  justify-content: center;
  background: #1b1b1c;
  color: #f3f4f6;
}

.tx-details-view.hidden {
  display: none !important;
}

.tx-details-screen {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  padding: 20px 22px calc(22px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.tx-detail-header {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  margin-bottom: 30px;
}

.tx-detail-header h2 {
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 740;
}

.tx-back,
.tx-share {
  display: none;
}

.tx-summary {
  text-align: center;
  margin-bottom: 28px;
}

.tx-fiat {
  font-size: 24px;
  font-weight: 760;
  letter-spacing: 0.2px;
}

.tx-token {
  margin-top: 6px;
  color: #a6a8ae;
  font-size: 14px;
  font-weight: 540;
}

.tx-card {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 14px;
  border-radius: 12px;
  background: #2a2a2d;
}

.tx-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.tx-label {
  color: #a8a9af;
  font-size: 13px;
  font-weight: 600;
}

.tx-value {
  max-width: 180px;
  text-align: right;
  color: #f0f1f4;
  font-size: 13px;
  font-weight: 640;
  overflow-wrap: anywhere;
}

.tx-subvalue {
  display: block;
  margin-top: 4px;
  color: #a6a8ae;
  font-size: 12px;
  font-weight: 520;
}

.tx-status.pending {
  color: #b8b9be;
}

.tx-status.complete {
  color: #42f68b;
}

.tx-explorer {
  width: 100%;
  height: 48px;
  margin-top: auto;
  border: 1px dashed #34363a;
  border-radius: 12px;
  background: transparent;
  color: #42f68b;
  font-size: 14px;
  font-weight: 650;
}

.tx-details-btn {
  touch-action: manipulation;
}

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

@media (max-width: 430px) {
  .sheet-inner {
    padding: 16px 14px 0;
  }

  .header {
    padding-bottom: 26px;
  }

  .address-field {
    grid-template-columns: minmax(0, 1fr) auto 28px 28px;
    gap: 8px;
    padding: 0 12px;
  }

  .addr-input {
    font-size: 15px;
  }

  .paste-btn {
    font-size: 16px;
  }

  .field-icon {
    width: 28px;
    height: 28px;
  }

  .tx-details-screen {
    padding-left: 20px;
    padding-right: 20px;
  }

  .tx-detail-header {
    margin-bottom: 28px;
  }

  .tx-summary {
    margin-bottom: 26px;
  }

  .tx-fiat {
    font-size: 23px;
  }

  .tx-card {
    padding: 13px 13px;
  }

  .tx-label,
  .tx-value {
    font-size: 13px;
  }
}

:root {
  color-scheme: light dark;
  --app-bg: #ffffff;
  --app-panel: #ffffff;
  --app-card: #ffffff;
  --app-card-border: #e4e7ec;
  --app-field: #ffffff;
  --app-text: #171a1f;
  --app-muted: #727984;
  --app-label: #444b55;
  --app-details-bg: #ffffff;
  --app-details-card: #f4f5f7;
  --app-details-border: #e1e4e8;
}

body,
.phone,
.sheet,
.wallet-overlay.sent,
.wallet-overlay.sent .wallet-modal {
  background: var(--app-bg) !important;
  color: var(--app-text) !important;
}

.address-field,
.amount-field {
  background: var(--app-field) !important;
}

.header h1,
.amount-input,
.token-name,
.wallet-overlay.sent .wallet-modal h2 {
  color: var(--app-text) !important;
}

.label {
  color: var(--app-label) !important;
}

.addr-input,
.approx,
.wallet-overlay.sent .wallet-modal p {
  color: var(--app-muted) !important;
}

.tx-details-view {
  background: var(--app-details-bg) !important;
  color: var(--app-text) !important;
}

.tx-card {
  background: var(--app-details-card) !important;
  border: 1px solid var(--app-details-border);
}

.tx-detail-header h2,
.tx-fiat,
.tx-value {
  color: var(--app-text) !important;
}

.tx-label,
.tx-token,
.tx-subvalue {
  color: var(--app-muted) !important;
}

.tx-explorer {
  border-color: var(--app-details-border) !important;
}

@media (prefers-color-scheme: dark) {
  :root {
    --app-bg: #1b1b1c;
    --app-panel: #1b1b1c;
    --app-card: #2a2a2d;
    --app-card-border: #34363a;
    --app-field: #2a2a2d;
    --app-text: #f3f4f6;
    --app-muted: #a6a8ae;
    --app-label: #c7c9ce;
    --app-details-bg: #1b1b1c;
    --app-details-card: #2a2a2d;
    --app-details-border: #34363a;
    --field-border: #42444a;
    --shadow: none;
  }

  .sheet {
    box-shadow: none !important;
  }

  .address-field,
  .amount-field {
    border-color: #34363a !important;
  }

  .address-field {
    border-color: var(--green) !important;
  }

  .wallet-overlay {
    background: rgba(27, 27, 28, 0.9) !important;
  }

  .wallet-modal {
    background: #2a2a2d !important;
    border-color: #34363a !important;
  }

  .wallet-modal h2 {
    color: var(--app-text) !important;
  }

  .wallet-modal p {
    color: var(--app-muted) !important;
  }
}
