/* Wallet selection is grouped by network. QR is an alternate Solana connection. */
#wallet-dialog {
  --sheet-base: #19191a;
  --sheet-well: #272729;
  --sheet-well-hover: #303032;
  --sheet-text: #f6f3ee;
  --sheet-sub: #c0beb9;
  --sheet-stroke: #424244;
  width: min(530px, calc(100% - 24px));
  border: 1px solid var(--sheet-stroke);
  border-radius: 22px;
  background: var(--sheet-base);
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
[data-theme=light] #wallet-dialog {
  --sheet-base: #faf9f6;
  --sheet-well: #eeede9;
  --sheet-well-hover: #e6e5df;
  --sheet-text: #20201e;
  --sheet-sub: #585852;
  --sheet-stroke: #cdcbc5;
}
#wallet-dialog::backdrop { background: rgb(12 12 12 / .68); backdrop-filter: blur(7px); }
.wallet-sheet { color: var(--sheet-text); }
.wallet-sheet-heading {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 32px clamp(20px, 5vw, 32px) 30px;
  color: var(--poster-ink);
  background: var(--poster-ground);
}
.wallet-sheet-heading::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
  width: min(38%, 190px);
  aspect-ratio: 1;
  right: -2%;
  bottom: -35px;
  background: url("./media/route-print-small.svg") center / contain no-repeat;
  mask-image: linear-gradient(105deg, transparent 6%, #0009 33%, #000 56%);
}
#wallet-dialog #wallet-heading {
  padding: 0 50px 0 0;
  margin: 0;
  color: inherit;
  font: 550 clamp(30px, 4vw, 44px)/1.05 var(--display);
  letter-spacing: -.047em;
}
#wallet-instructions {
  margin: 12px 0 0;
  max-width: min(32ch, 70%);
  font: 480 15px/1.45 var(--sans);
}
#wallet-dialog #wallet-close {
  position: absolute;
  inset: 17px 16px auto auto;
  width: 37px;
  height: 37px;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 10px;
  background: rgb(42 14 9 / .1);
  color: #271412;
}
#wallet-dialog #wallet-close svg { width: 18px; height: 18px; }
.wallet-choice-area { padding: 24px clamp(16px, 4.3vw, 26px) 22px; }
.wallet-choice-heading {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.wallet-choice-heading h3 {
  margin: 0;
  font: 560 17px/1.25 var(--display);
  color: var(--sheet-text);
  letter-spacing: -.025em;
}
.wallet-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--sheet-sub);
  font: 460 12px/1.4 var(--sans);
  font-variant-numeric: tabular-nums;
}
.wallet-progress::before {
  content: "";
  width: 12px;
  height: 6px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--meter-sol, var(--sheet-stroke)) 42%, transparent 42% 58%, var(--meter-ton, var(--sheet-stroke)) 58%);
}
#wallet-dialog:has(#wallet-stub.is-active) { --meter-sol: var(--trade-accent-text); }
#wallet-dialog:has(#wallet-ton.is-active) { --meter-ton: var(--trade-accent-text); }
.wallet-paths { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wallet-path {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--sheet-well);
  border-radius: 14px;
}
.wallet-pick {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 25px;
  padding: 16px;
  color: var(--sheet-text);
  background: transparent;
  border: 0;
  border-radius: inherit;
  text-align: start;
}
.wallet-pick::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at 110% -5%, rgb(255 79 54 / .22), transparent 73%), var(--sheet-well-hover);
}
.wallet-path-head { display: flex; align-items: start; justify-content: space-between; }
.wallet-path-glyph {
  display: block;
  width: 35px;
  height: 35px;
  color: var(--sheet-text);
  --color-bg-surface: var(--sheet-well);
}
.wallet-path-glyph { border-radius: 50%; overflow: hidden; }
.wallet-path-arrow {
  width: 20px;
  height: 20px;
  padding: 1px;
  transform: rotate(-45deg);
  color: var(--sheet-sub);
}
.wallet-path-text { display: grid; gap: 3px; }
.wallet-network-name { color: var(--sheet-sub); font: 500 13px/1.25 var(--sans); }
.wallet-provider-name {
  font: 560 clamp(20px, 2.6vw, 28px)/1.1 var(--display);
  letter-spacing: -.043em;
  overflow-wrap: anywhere;
}
.wallet-connected-address { color: var(--sheet-sub); font: 460 12px/1.35 var(--mono); padding-top: 4px; }
#wallet-dialog .wallet-disconnect {
  width: fit-content;
  min-height: 30px;
  max-width: 100%;
  color: var(--trade-accent-text);
  margin: 0 12px 9px;
  padding: 3px 5px;
  font: 530 13px/1.3 var(--sans);
  background: transparent;
}
#wallet-dialog .wallet-pick:focus-visible, #wallet-dialog .wallet-qr-choice:focus-visible { outline: 2px solid var(--trade-accent-text); outline-offset: 2px; }
#wallet-dialog #wallet-close:focus-visible { outline: 2px solid #231311; outline-offset: 2px; }
#wallet-dialog[data-preferred-chain=sol] #wallet-stub,
#wallet-dialog[data-preferred-chain=ton] #wallet-ton { box-shadow: inset 0 0 0 1px var(--trade-accent-text); }
.wallet-pick:is(:focus-visible,.is-active)::before { opacity: 1; }
#wallet-dialog #phantom-menu {
  position: relative !important;
  padding: 9px !important;
  margin: 0 8px 8px;
  inset: auto;
}
#wallet-dialog #phantom-menu .btn { white-space: normal; }
.wallet-qr-choice {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 36px minmax(0,1fr) 22px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 17px;
  border-radius: 12px;
  border: 1px solid var(--sheet-stroke);
  color: var(--sheet-text);
  background: transparent;
  text-align: start;
}
.wallet-qr-mark { display: grid; place-items: center; }
.wallet-qr-mark svg { width: 31px; height: 31px; }
.wallet-qr-choice strong { display: block; font: 560 16px/1.25 var(--display); letter-spacing: -.015em; }
.wallet-qr-choice small { display: block; margin-top: 2px; color: var(--sheet-sub); font: 460 13px/1.35 var(--sans); }
.wallet-qr-indicator { width: 20px; height: 20px; color: var(--sheet-sub); }
#walletconnect-qr-wrap {
  margin: 10px 0 0; padding: 18px; gap: 14px; justify-items: stretch;
  color: var(--sheet-text); border: 0; border-radius: 12px; background: var(--sheet-well);
}
#walletconnect-qr-wrap img {
  justify-self: center; box-sizing: border-box; inline-size: min(100%, 208px);
  block-size: auto; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated;
}
#walletconnect-qr-wrap .caption {
  margin: 0; color: var(--sheet-sub); font: 470 13px/1.45 var(--sans);
  text-align: start; overflow-wrap: anywhere;
}
.wallet-handoff-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; }
.wallet-handoff-actions :is(a, button) {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 9px 13px; border: 1px solid transparent; border-radius: 8px;
  font: 550 13px/1.3 var(--sans); text-align: center; text-decoration: none; cursor: pointer;
}
#walletconnect-open { color: var(--sheet-base); background: var(--sheet-text); }
#walletconnect-copy { color: var(--sheet-text); background: var(--sheet-base); }
.wallet-handoff-actions :focus-visible { outline: 2px solid var(--trade-accent-text); outline-offset: 2px; }
#walletconnect-qr-wrap [hidden] { display: none; }
@media (min-width: 600px) {
  #walletconnect-qr-wrap:has(img:not([hidden])) {
    grid-template-columns: minmax(0, .95fr) minmax(0, 1fr);
    align-content: center; align-items: center; column-gap: 18px;
  }
  #walletconnect-qr-wrap img { grid-area: 1 / 1 / span 2; align-self: center; }
  #walletconnect-qr-wrap:has(img:not([hidden])) .caption { grid-column: 2; }
  #walletconnect-qr-wrap:has(img:not([hidden])) .wallet-handoff-actions { grid-column: 2; }
}
.wallet-sheet-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 clamp(16px, 4.3vw, 26px) 23px;
}
#wallet-dialog .wallet-sheet-foot .mode-note {
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  font: 450 12px/1.5 var(--sans);
  color: var(--sheet-sub);
}
.wallet-sheet-foot .mode-note strong { display: block; font-weight: 560; color: var(--sheet-text); }
#wallet-dialog #wallet-done {
  margin: 0;
  width: auto;
  min-height: 40px;
  padding: 10px 22px;
  background: var(--sheet-text);
  color: var(--sheet-base);
  font: 580 14px/1.25 var(--sans);
  border-radius: 9px;
  border: 0;
}
@media (hover:hover) {
  .wallet-handoff-actions :is(a, button):hover { box-shadow: inset 0 0 0 1px currentColor; }
  .wallet-pick:hover::before { opacity: 1; }
  .wallet-qr-choice:hover { background: var(--sheet-well); }
  #wallet-dialog #wallet-close:hover { background: rgb(42 14 9 / .17); }
}
@media (prefers-reduced-motion:no-preference) {
  #wallet-dialog[open] { animation: wallet-arrive 230ms var(--motion-settle) backwards; }
  #wallet-dialog[open] .wallet-path, #wallet-dialog[open] .wallet-qr-choice {
    animation: wallet-choice-arrive 180ms var(--motion-settle) 25ms backwards;
  }
  #wallet-dialog[open] .wallet-path + .wallet-path { animation-delay: 45ms; }
  #wallet-dialog[open] .wallet-qr-choice { animation-delay: 65ms; }
  .wallet-path-arrow, .wallet-path-glyph, .wallet-qr-indicator { transition: transform .25s cubic-bezier(.16,.85,.24,1); }
  .wallet-pick::before { transition: opacity .22s ease-out; }
  .wallet-pick:is(:hover,:focus-visible) .wallet-path-arrow { transform: translate(2px,-2px) rotate(-45deg); }
  .wallet-pick:is(:hover,:focus-visible) .wallet-path-glyph { transform: translateY(-2px); }
  .wallet-qr-choice:is(:hover,:focus-visible) .wallet-qr-indicator { transform: scale(1.1); }
  @keyframes wallet-arrive { from { opacity: .55; transform: translateY(7px); } }
  @keyframes wallet-choice-arrive { from { opacity: .68; } }
}
@media (max-width: 420px) {
  .wallet-sheet-heading { padding: 26px 19px 22px; }
  .wallet-sheet-heading::after { width: 36%; bottom: -30px; }
  .wallet-choice-area { padding-top: 18px; padding-bottom: 17px; }
  .wallet-pick { padding: 12px; gap: 20px; }
  .wallet-paths { gap: 8px; }
  .wallet-path-glyph { width: 30px; height: 30px; }
  #wallet-dialog #wallet-done { padding-inline: 14px; }
}
@media (max-width: 335px) {
  .wallet-sheet-heading::after { width: 31%; bottom: -8px; }
  .wallet-paths { grid-template-columns: 1fr; }
  .wallet-pick { min-height: 60px; flex-direction: row; align-items: center; gap: 12px; padding-right: 34px; }
  .wallet-path-arrow { position: absolute; right: 10px; top: 50%; margin-top: -9px; width: 18px; height: 18px; }
  .wallet-pick .wallet-provider-name { font-size: 19px; }
  .wallet-qr-choice { grid-template-columns: 28px minmax(0,1fr) 17px; gap: 8px; padding: 10px; }
  .wallet-qr-mark svg { width: 25px; height: 25px; }
  .wallet-qr-choice strong { font-size: 14px; }
  #wallet-dialog #wallet-done { width: 100%; }
}
@media (forced-colors: active) {
  #wallet-dialog .wallet-path, #wallet-dialog #wallet-close, #wallet-dialog #wallet-done { border: 1px solid ButtonText; }
}
.evm-wallet-choice summary { list-style: none; cursor: pointer; }
.evm-wallet-choice summary::-webkit-details-marker { display: none; }
.evm-wallet-choice[open] .wallet-qr-indicator { rotate: 180deg; }
.evm-wallet-settings { display: grid; gap: 10px; padding: 14px; background: var(--sheet-well); border-radius: 12px; }
.evm-wallet-settings [hidden] { display: none; }
.evm-wallet-settings [role=status]:empty { display: none; }
