/* Scoped to the wallet dialog; deposit, reset, and copy dialogs retain their styles. */
dialog.wallet-dialog {
  --tw-wallet-fg: #f4f4f5;
  --tw-wallet-muted: #afb0b5;
  --tw-wallet-accent: #c1a450;
  box-sizing: border-box;
  width: min(720px, calc(100vw - 32px));
  height: 504px;
  max-width: 720px;
  max-height: calc(100svh - 32px);
  padding: 0;
  margin: auto;
  overflow: hidden;
  border: 1px solid #ffffff12;
  border-radius: 8px;
  background: rgba(26, 27, 31, .92);
  color: var(--tw-wallet-fg);
  font: 14px/1.3 var(--sans, system-ui, sans-serif);
  box-shadow: 0 8px 32px #0005, 0 24px 96px #0006;
}

dialog.wallet-dialog[open] { animation: tw-wallet-enter 130ms ease-out both; }
dialog.wallet-dialog::backdrop {
  background: rgba(0, 0, 0, .62);
  backdrop-filter: none;
  animation: tw-wallet-backdrop 130ms ease-out both;
}
dialog.wallet-dialog #dialog-body { height: 100%; }
dialog.wallet-dialog .dialog-close {
  z-index: 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  top: 16px;
  right: 16px;
  padding: 0 0 2px;
  border-radius: 50%;
  background: #ffffff0b;
  color: #93959f;
  font: 25px/1 system-ui, sans-serif;
}
dialog.wallet-dialog .dialog-close:hover { color: #fff; background: #ffffff17; }
dialog.wallet-dialog :is(button, a):focus-visible { outline: 2px solid var(--tw-wallet-accent); outline-offset: 3px; }
dialog.wallet-dialog button { font-family: inherit; }

.wallet-dialog .tw-wallet { display: grid; grid-template-columns: 40% 60%; height: 100%; min-height: 0; }
.wallet-dialog .tw-wallet-connect { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 21px 24px 22px; border-right: 1px solid #ffffff0b; }
.wallet-dialog .tw-wallet-title,
.wallet-dialog .tw-wallet-info-title { margin: 0; color: var(--tw-wallet-fg); font: 700 18px/24px var(--sans, system-ui, sans-serif); letter-spacing: -.015em; }
.wallet-dialog .tw-wallet-provider-list { flex: 1; min-height: 0; margin-top: 23px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #ffffff24 transparent; }
.wallet-dialog .tw-wallet-provider { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--tw-wallet-fg); text-align: left; font-size: 15px; font-weight: 600; transition: background 130ms ease; }
.wallet-dialog .tw-wallet-provider:hover { background: #ffffff09; }
.wallet-dialog .tw-wallet-provider-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border: 1px solid #ffffff16; border-radius: 9px; background: #33343c; color: #d8c78e; font-size: 16px; }
.wallet-dialog .tw-wallet-status { margin: 12px 0 0; color: var(--tw-wallet-accent); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.wallet-dialog .tw-wallet-status:empty { display: none; }
.wallet-dialog .tw-wallet-account-label { margin: 0 0 10px; color: var(--tw-wallet-muted); font-size: 12px; }
.wallet-dialog .tw-wallet-address { display: block; color: var(--tw-wallet-fg); font: 12px/1.7 var(--mono, monospace); overflow-wrap: anywhere; }
.wallet-dialog .tw-wallet-account-actions,
.wallet-dialog .tw-wallet-demo-actions { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 13px; }
.wallet-dialog .tw-wallet-account-actions button,
.wallet-dialog .tw-wallet-demo-actions button { padding: 0; border: 0; background: none; color: var(--tw-wallet-accent); font-size: 12px; line-height: 1.6; }
.wallet-dialog .tw-wallet-demo-entry { flex: none; margin-top: 20px; }
.wallet-dialog .tw-wallet-demo-link { display: flex; align-items: center; gap: 8px; padding: 0; background: none; color: #a9a9ae; font-size: 11px; line-height: 1.6; text-align: left; }
.wallet-dialog .tw-wallet-demo-link:hover { color: #d7c287; }
.wallet-dialog .tw-wallet-demo-link span { color: #85858d; }
.wallet-dialog .tw-wallet-demo-caption { display: block; margin-top: 2px; color: #74757e; font-size: 10px; }
.wallet-dialog .tw-wallet-demo { margin-top: 20px; }
.wallet-dialog .tw-wallet-demo-label { margin: 0 0 10px; color: #96979e; font-size: 11px; }
.wallet-dialog .tw-wallet-balances { display: grid; gap: 5px; margin: 0; font: 11px/1.5 var(--mono, monospace); }
.wallet-dialog .tw-wallet-balances div { display: flex; justify-content: space-between; gap: 12px; }
.wallet-dialog .tw-wallet-balances dt { color: #999aa3; }
.wallet-dialog .tw-wallet-balances dd { margin: 0; color: #ceced4; }
.wallet-dialog .tw-wallet-mobile-about { display: none; }

.wallet-dialog .tw-wallet-info { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wallet-dialog .tw-wallet-info-title { flex: none; margin: 76px 44px 0; text-align: center; }
.wallet-dialog .tw-wallet-features { display: grid; gap: 28px; margin: 69px 49px 0 59px; }
.wallet-dialog .tw-wallet-feature { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 16px; }
.wallet-dialog .tw-wallet-illustration { display: block; width: 48px; height: 48px; overflow: visible; }
.wallet-dialog .tw-wallet-feature h3 { margin: 0 0 4px; color: #f1f1f3; font: 700 14px/18px var(--sans, system-ui, sans-serif); letter-spacing: 0; }
.wallet-dialog .tw-wallet-feature p { margin: 0; color: var(--tw-wallet-muted); font-size: 13px; line-height: 18px; }
.wallet-dialog .tw-wallet-info-actions { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: auto 30px 48px; padding-top: 24px; }
.wallet-dialog .tw-wallet-get-button { padding: 5px 13px; min-height: 28px; border-radius: 4px; background: var(--tw-wallet-accent); color: #12110c; font-size: 13px; line-height: 18px; font-weight: 700; }
.wallet-dialog .tw-wallet-get-button:hover { background: #d0b565; }
.wallet-dialog .tw-wallet-learn { color: var(--tw-wallet-accent); font-size: 13px; line-height: 18px; font-weight: 600; }
.wallet-dialog .tw-wallet-learn:hover { text-decoration: underline; text-underline-offset: 3px; }
.wallet-dialog .tw-wallet-back { position: absolute; z-index: 2; top: 16px; left: 16px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border-radius: 50%; background: none; color: var(--tw-wallet-accent); }
.wallet-dialog .tw-wallet-back:hover { background: #ffffff0a; }
.wallet-dialog .tw-wallet-get-title { margin-top: 20px; }
.wallet-dialog .tw-wallet-get-empty { margin: auto 64px 27px; text-align: center; }
.wallet-dialog .tw-wallet-get-empty h3 { margin: 0 0 8px; color: var(--tw-wallet-fg); font: 700 13px/18px var(--sans, system-ui, sans-serif); letter-spacing: 0; }
.wallet-dialog .tw-wallet-get-empty p { margin: 0; color: var(--tw-wallet-muted); font-size: 13px; line-height: 18px; }

/* The existing app can show its cancellable wallet prompt without changing layout. */
dialog.wallet-dialog #dialog-body > :is(.dialog-title, .wallet-status, .wallet-note, .button) { margin-left: 24px; margin-right: 24px; }
dialog.wallet-dialog #dialog-body > .dialog-title { padding-top: 24px; font: 700 18px/24px var(--sans, system-ui, sans-serif); }

@media (max-width: 640px) {
  dialog.wallet-dialog { width: min(360px, calc(100vw - 32px)); height: 504px; }
  .wallet-dialog .tw-wallet { grid-template-columns: minmax(0, 1fr); }
  .wallet-dialog .tw-wallet-connect { padding: 22px 24px 0; border-right: 0; }
  .wallet-dialog .tw-wallet-title { padding-right: 26px; }
  .wallet-dialog .tw-wallet-provider-list { margin-top: 24px; }
  .wallet-dialog .tw-wallet-demo-entry,
  .wallet-dialog .tw-wallet-demo { margin-bottom: 20px; }
  .wallet-dialog .tw-wallet-mobile-about { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 58px; flex: none; margin: 0 -24px; padding: 16px 24px; border-top: 1px solid #ffffff0b; background: #ffffff03; color: var(--tw-wallet-fg); font-size: 13px; font-weight: 600; }
  .wallet-dialog .tw-wallet-info-icon { display: grid; place-items: center; width: 16px; height: 16px; border: 1.5px solid #9899a1; border-radius: 50%; color: #b6b6be; font: 700 11px/1 system-ui, sans-serif; }
  .wallet-dialog .tw-wallet[data-screen="connect"] .tw-wallet-info { display: none; }
  .wallet-dialog .tw-wallet:is([data-screen="about"], [data-screen="get"]) .tw-wallet-connect { display: none; }
  .wallet-dialog .tw-wallet-info-title { margin: 22px 46px 0; font-size: 17px; }
  .wallet-dialog .tw-wallet-features { gap: 30px; margin: 69px 24px 0; }
  .wallet-dialog .tw-wallet-feature { gap: 14px; }
  .wallet-dialog .tw-wallet-feature h3 { font-size: 13px; }
  .wallet-dialog .tw-wallet-feature p { font-size: 12px; }
  .wallet-dialog .tw-wallet-info-actions { margin-bottom: 46px; }
  .wallet-dialog .tw-wallet-get-empty { margin-right: 42px; margin-left: 42px; }
}

@media (max-height: 560px) {
  dialog.wallet-dialog { overflow-y: auto; }
  .wallet-dialog .tw-wallet { min-height: 470px; }
  .wallet-dialog .tw-wallet-info-title { margin-top: 35px; }
  .wallet-dialog .tw-wallet-get-title { margin-top: 20px; }
  .wallet-dialog .tw-wallet-features { margin-top: 45px; }
  .wallet-dialog .tw-wallet-info-actions { margin-bottom: 30px; }
}

@keyframes tw-wallet-enter { from { opacity: 0; transform: translateY(5px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes tw-wallet-backdrop { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  dialog.wallet-dialog[open], dialog.wallet-dialog::backdrop { animation: none; }
}
