#wm-root,
#wm-root * {
  box-sizing: border-box;
}

#wm-root .wm-toggle,
#wm-root .wm-pick {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

#wm-root .wm-catch {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: block;
  margin: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
}

#wm-root .wm-toggle:checked ~ .wm-catch {
  display: none;
}

#wm-root .wm-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#wm-root .wm-toggle:checked ~ .wm-overlay {
  display: flex;
}

html:has(#wm-open:checked),
html:has(#wm-open:checked) body {
  overflow: hidden;
}

#wm-root .wm-backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  background: rgba(6, 8, 12, 0.72);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

#wm-root .wm-modal {
  position: relative;
  width: min(400px, 100%);
  margin: 0;
  padding: 18px 16px 14px;
  color: #1a1d24;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.16);
  animation: wm-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes wm-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#wm-root .wm-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 14px;
}

#wm-root .wm-head-copy {
  min-width: 0;
}

#wm-root .wm-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #111318;
}

#wm-root .wm-title-connecting,
#wm-root .wm-title-failed,
#wm-root .wm-subtitle {
  display: none !important;
}

#wm-root.is-connecting .wm-title-default {
  display: none !important;
}

#wm-root.is-connecting .wm-title-connecting,
#wm-root.is-connecting .wm-subtitle {
  display: block !important;
}

#wm-root.is-failed .wm-title-connecting {
  display: none !important;
}

#wm-root.is-failed .wm-title-failed {
  display: block !important;
  color: #ff4d4f;
  animation: wm-fail-in 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

#wm-root .wm-subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: #667085;
}

#wm-root.is-connecting .wm-list,
#wm-root.is-connecting .wm-note {
  display: none !important;
}

#wm-root .wm-connecting {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 180px;
  padding: 18px 8px 8px;
}

#wm-root.is-connecting .wm-connecting {
  display: flex !important;
}

#wm-root .wm-connecting-logo {
  width: 72px;
  height: 72px;
  max-width: none;
  object-fit: contain;
  border-radius: 18px;
}

#wm-root .wm-connecting-logo.is-fox {
  border-radius: 0;
}

#wm-root .wm-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: #111318;
  border-radius: 50%;
  animation: wm-spin 0.7s linear infinite;
}

#wm-root .wm-fail-mark {
  display: none;
  width: 36px;
  height: 36px;
  color: #ff4d4f;
}

#wm-root .wm-fail-mark svg {
  width: 22px;
  height: 22px;
}

#wm-root.is-failed .wm-connecting-logo {
  animation: wm-fail-shake 0.5s ease;
}

#wm-root.is-failed .wm-spinner {
  display: none !important;
}

#wm-root.is-failed .wm-fail-mark {
  display: grid;
  place-items: center;
  border: 2px solid #ff4d4f;
  border-radius: 50%;
  animation: wm-fail-pop 0.4s cubic-bezier(0.22, 1.4, 0.36, 1);
}

#wm-root .wm-wallet-pop {
  display: none;
  position: fixed;
  top: 10px;
  right: 14px;
  left: auto;
  z-index: 2147483647;
  width: 360px;
  height: min(600px, calc(100vh - 24px));
  flex-direction: column;
  overflow: hidden;
  color-scheme: light dark;
  background: light-dark(#ffffff, #1c1c1e);
  border: 1px solid light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.14));
  border-radius: 12px;
  box-shadow: 0 18px 50px light-dark(rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.5));
}

#wm-root.is-wallet-open .wm-wallet-pop {
  display: flex !important;
}

#wm-root .wm-wallet-pop-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 40px;
  height: 40px;
  padding: 0 8px 0 14px;
  color: light-dark(#111318, #f2f2f5);
  background: light-dark(#ffffff, #1c1c1e);
  border-bottom: 1px solid light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.1));
  border-radius: 12px 12px 0 0;
  font-size: 13px;
  font-weight: 650;
}

@media (min-width: 641px) {
  #wm-root .wm-wallet-pop-bar {
    cursor: grab;
    user-select: none;
    touch-action: none;
  }

  #wm-root .wm-wallet-pop.is-dragging .wm-wallet-pop-bar {
    cursor: grabbing;
  }
}

#wm-root .wm-wallet-pop-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: light-dark(#667085, #c2c6cc);
  background: transparent;
  cursor: pointer;
}

#wm-root .wm-wallet-pop-close:hover {
  color: light-dark(#111318, #ffffff);
  background: light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.08));
}

#wm-root .wm-wallet-pop-close svg {
  width: 14px;
  height: 14px;
  display: block;
}

#wm-root .wm-wallet-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0 0 12px 12px;
  background: light-dark(#ffffff, #1c1c1e);
  color-scheme: light dark;
}

@media (max-width: 640px) {
  #wm-root .wm-wallet-pop {
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  #wm-root.is-wallet-open .wm-wallet-pop {
    animation: wm-app-in 0.52s cubic-bezier(0.22, 1, 0.36, 1);
  }

  #wm-root .wm-wallet-pop-bar {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top));
    right: 10px;
    z-index: 2;
    width: auto;
    height: auto;
    padding: 0;
    background: transparent;
    border: 0;
  }

  #wm-root .wm-wallet-pop-title {
    display: none;
  }

  #wm-root .wm-wallet-pop-close {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    color: light-dark(#111318, #f2f2f5);
    background: light-dark(#f3f4f6, #2c2c2e);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  }

  #wm-root .wm-wallet-frame {
    border-radius: 0;
  }
}

@keyframes wm-app-in {
  0% {
    opacity: 0.6;
    transform: translateY(110%) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

#wm-root .wm-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  border-radius: 999px;
  color: #4b5563;
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#wm-root .wm-close:hover {
  color: #111318;
  background: rgba(0, 0, 0, 0.08);
}

#wm-root .wm-close svg {
  width: 16px;
  height: 16px;
  display: block;
}

#wm-root .wm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
}

#wm-root .wm-wallet {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border-radius: 16px;
  color: #1a1d24;
  background: rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

#wm-root .wm-wallet:hover {
  background: rgba(0, 0, 0, 0.06);
}

#wm-root .wm-pick:checked + .wm-wallet,
#wm-root .wm-pick:focus-visible + .wm-wallet {
  background: rgba(171, 159, 242, 0.16);
  outline: 1px solid rgba(171, 159, 242, 0.45);
}

#wm-root .wm-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  overflow: hidden;
  border-radius: 12px;
  background: transparent;
}

#wm-root .wm-icon img {
  width: 42px;
  height: 42px;
  max-width: none;
  display: block;
  object-fit: cover;
  border-radius: 12px;
}

#wm-root .wm-icon-fox,
#wm-root .wm-icon-fox img {
  border-radius: 0;
}

#wm-root .wm-icon-fox img {
  object-fit: contain;
}

#wm-root .wm-icon-plain,
#wm-root .wm-icon-plain img {
  border-radius: 0;
}

#wm-root .wm-icon-plain img {
  object-fit: contain;
}

#wm-root .wm-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

#wm-root .wm-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  color: #111318;
}

#wm-root .wm-chain {
  font-size: 12px;
  line-height: 1.2;
  color: #667085;
}

#wm-root .wm-chevron {
  margin-left: auto;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #98a2b3;
}

#wm-root .wm-note {
  margin: 12px 6px 2px;
  font-size: 12px;
  line-height: 1.45;
  color: #667085;
  text-align: center;
}

@media (max-width: 640px) {
  #wm-root .wm-overlay {
    align-items: flex-end;
    padding: 0;
  }

  #wm-root .wm-modal {
    width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    animation-name: wm-up;
  }

  #wm-root .wm-head {
    justify-content: center;
  }

  #wm-root .wm-head-copy {
    width: 100%;
    text-align: center;
  }

  #wm-root .wm-close {
    position: absolute;
    top: 16px;
    right: 16px;
  }
}

@keyframes wm-fail-in {
  0% {
    opacity: 0;
    transform: translateY(-6px);
  }
  35% {
    opacity: 1;
    transform: translateX(-4px);
  }
  55% {
    transform: translateX(4px);
  }
  75% {
    transform: translateX(-2px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes wm-fail-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}

@keyframes wm-fail-pop {
  0% {
    opacity: 0;
    transform: scale(0.35);
  }
  70% {
    opacity: 1;
    transform: scale(1.12);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes wm-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #wm-root .wm-modal,
  #wm-root .wm-spinner,
  #wm-root .wm-title-failed,
  #wm-root .wm-connecting-logo,
  #wm-root .wm-fail-mark,
  #wm-root.is-wallet-open .wm-wallet-pop {
    animation: none;
  }
}
