.balance-modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background: rgba(0, 0, 0, .76);
  backdrop-filter: blur(5px);
}

.balance-modal-backdrop[hidden] { display: none; }
body.balance-modal-open { overflow: hidden; }

.balance-modal {
  position: relative;
  display: flex;
  width: min(100%, 460px);
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  padding: max(35px, calc(env(safe-area-inset-top) + 22px)) 16px max(27px, calc(env(safe-area-inset-bottom) + 20px));
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 50% 35%, #17181b 0%, #0d0e10 50%, #050506 100%);
  color: #f7f7f8;
  outline: none;
}

.balance-modal-header {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 39px;
  align-items: center;
  justify-content: flex-start;
}

.balance-modal-close {
  position: absolute;
  top: 50%;
  right: 0;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: #d8d9df;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.balance-modal-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 20px;
}

.balance-modal-total {
  margin: 0;
  color: #f7f7f8;
  font-size: clamp(32px, 8vw, 42px);
  font-weight: 800;
  letter-spacing: -1.5px;
}

.balance-wallet-status {
  margin: 14px 0 0;
  color: #b7bbc5;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.balance-wallet-address {
  max-width: 100%;
  margin: 12px 0 0;
  padding: 10px 14px;
  overflow-wrap: anywhere;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: #d8d9df;
  font-family: monospace;
  font-size: 13px;
}

.balance-wallet-funds {
  margin: 8px 0 0;
  color: #9da0aa;
  font-size: 12px;
}

.balance-wallet-funds strong { color: #f7f7f8; font-variant-numeric: tabular-nums; }
.balance-wallet-funds[hidden], .balance-deposit-field[hidden], .balance-deposit-presets[hidden] { display: none; }

.balance-deposit-field {
  display: flex;
  width: min(100%, 340px);
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
  color: #b7bbc5;
  font-size: 12px;
  font-weight: 700;
}

.balance-deposit-input-wrap {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 13px;
  background: rgba(255,255,255,.06);
  color: #aaaeb7;
  font-size: 14px;
}

.balance-deposit-input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.balance-deposit-input-wrap input::-webkit-inner-spin-button,
.balance-deposit-input-wrap input::-webkit-outer-spin-button { margin: 0; appearance: none; }

.balance-deposit-presets {
  display: grid;
  width: min(100%, 340px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.balance-deposit-presets button {
  min-height: 38px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 11px;
  background: #22242b;
  color: #f5f5f7;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.balance-deposit-presets button:disabled { opacity: .42; cursor: not-allowed; }

.balance-wallet-address[hidden] { display: none; }

.balance-modal-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.balance-modal-notice {
  margin: 0;
  color: #b7bbc5;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.balance-modal-notice[hidden] { display: none; }

.balance-wallet-disclaimer {
  margin: 0;
  color: #8a8c93;
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

.balance-modal-actions { display: flex; flex-direction: column; gap: 8px; }

.balance-disconnect-button {
  min-height: 42px;
  border: 1px solid rgba(255, 107, 107, .3);
  border-radius: 14px;
  background: rgba(255, 107, 107, .08);
  color: #ff9a9a;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.balance-disconnect-button:active { background: rgba(255, 107, 107, .16); }
.balance-disconnect-button:focus-visible { outline: 2px solid #ff9a9a; outline-offset: 2px; }
.balance-disconnect-button[hidden] { display: none; }

.balance-connect-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #2ea9f5, #087acb);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.balance-connect-button:active { filter: brightness(.92); }
.balance-connect-button:focus-visible, .balance-provider:focus-visible, .balance-modal-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

@media (max-width: 360px) {
  .balance-modal { padding-right: 12px; padding-left: 12px; }
  .balance-modal-close { width: 25px; height: 25px; }
}
