.cj-reown-chip {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-radius: 999px;
  background: rgb(16 18 20 / 0.92);
  border: 1px solid rgb(151 190 48 / 0.35);
  box-shadow:
    0 12px 30px -14px rgb(0 0 0 / 0.8),
    0 0 0 1px rgb(255 255 255 / 0.03) inset;
  color: #e9ece8;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 12px;
  backdrop-filter: blur(10px);
  animation: cj-chip-in 0.35s ease both;
}

.cj-reown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #97be30;
  box-shadow: 0 0 0 0 rgb(151 190 48 / 0.7);
  animation: cj-chip-pulse 2.4s ease-out infinite;
}

.cj-reown-addr {
  letter-spacing: 0.02em;
}

.cj-reown-portfolio {
  border: 1px solid rgb(151 190 48 / 0.4);
  cursor: pointer;
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 11px;
  color: #d9f2a1;
  background: rgb(151 190 48 / 0.14);
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.cj-reown-portfolio:hover {
  background: rgb(151 190 48 / 0.26);
}

.cj-reown-portfolio:active {
  transform: scale(0.96);
}

.cj-reown-disconnect {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 11px;
  color: #0d0f10;
  background: #97be30;
  transition:
    filter 0.15s ease,
    transform 0.15s ease;
}

.cj-reown-disconnect:hover {
  filter: brightness(1.08);
}

.cj-reown-disconnect:active {
  transform: scale(0.96);
}

@keyframes cj-chip-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes cj-chip-pulse {
  0% {
    box-shadow: 0 0 0 0 rgb(151 190 48 / 0.55);
  }
  70% {
    box-shadow: 0 0 0 8px rgb(151 190 48 / 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgb(151 190 48 / 0);
  }
}

/* ------------------------------------------------------------------ */
/* Portfolio sheet — the connected wallet is the account               */
/* ------------------------------------------------------------------ */

:root.cj-pf-open .cj-reown-chip {
  display: none;
}

/* The app's hosted account dialog is replaced by Reown (see reown-connect.js);
 * the attribute keeps it shut even if React re-renders its inline styles. */
#privy-dialog[data-cj-swapped] {
  display: none !important;
}

.cj-pf {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 80% 0%, rgb(151 190 48 / 0.16), transparent 60%), rgb(4 6 3 / 0.82);
  backdrop-filter: blur(14px);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: #eef5df;
}

.cj-pf-sheet {
  width: min(880px, 100%);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  border: 1px solid rgb(151 190 48 / 0.24);
  background:
    linear-gradient(180deg, rgb(151 190 48 / 0.08), transparent 26%),
    linear-gradient(180deg, #0d1207, #070905);
  box-shadow:
    0 40px 90px -30px rgb(0 0 0 / 0.9),
    inset 0 1px 0 rgb(255 255 255 / 0.04);
  overflow: hidden;
  animation: cj-pf-in 0.28s ease both;
}

@keyframes cj-pf-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.cj-pf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid rgb(151 190 48 / 0.14);
  background: rgb(8 11 5 / 0.7);
}

.cj-pf-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #e7f7c4;
}

.cj-pf-slash {
  color: rgb(151 190 48 / 0.5);
  font-weight: 400;
}

.cj-pf-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b6dc3f;
  box-shadow: 0 0 0 3px rgb(151 190 48 / 0.18);
}

.cj-pf-close {
  border: 1px solid rgb(151 190 48 / 0.22);
  background: transparent;
  color: #cfd9bd;
  font: inherit;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.cj-pf-close:hover {
  background: rgb(151 190 48 / 0.14);
  color: #f1f8e2;
}

.cj-pf-scroll {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.cj-pf-wallet {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgb(151 190 48 / 0.16);
  background: linear-gradient(120deg, rgb(151 190 48 / 0.09), rgb(255 90 31 / 0.04) 70%, transparent);
}

.cj-pf-id svg {
  display: block;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  box-shadow: 0 10px 22px -12px rgb(151 190 48 / 0.7);
}

.cj-pf-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8fa376;
  font-weight: 600;
}

.cj-pf-addrrow {
  margin-top: 6px;
}

.cj-pf-addr {
  font-family: "DM Mono", ui-monospace, SFMono-Regular, monospace;
  font-size: 13px;
  color: #eaf7cd;
  word-break: break-all;
}

.cj-pf-links {
  display: flex;
  gap: 14px;
  margin-top: 8px;
}

.cj-pf-copy,
.cj-pf-refresh,
.cj-pf-net,
.cj-pf-disconnect {
  font: inherit;
  cursor: pointer;
}

.cj-pf-copy,
.cj-pf-refresh {
  border: 0;
  padding: 0;
  background: none;
  color: #b6dc3f;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cj-pf-explorer {
  font-size: 12px;
  font-weight: 600;
  color: #ffa27a;
  text-decoration: none;
}

.cj-pf-explorer:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cj-pf-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgb(151 190 48 / 0.14);
  background: rgb(12 16 8 / 0.8);
}

.cj-pf-cardtop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cj-pf-amount {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 10px 0 16px;
  font-variant-numeric: tabular-nums;
}

.cj-pf-val {
  font-size: 40px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f4fbe6;
}

.cj-pf-val.cj-pf-err {
  color: #ffa27a;
}

.cj-pf-sym {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #97be30;
  text-transform: uppercase;
}

.cj-pf-nets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cj-pf-net {
  border-radius: 999px;
  border: 1px solid rgb(151 190 48 / 0.2);
  background: transparent;
  color: #b9c9a3;
  font-size: 12px;
  padding: 6px 12px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cj-pf-net:hover {
  background: rgb(151 190 48 / 0.12);
  color: #eaf7cd;
}

.cj-pf-net.is-active {
  background: linear-gradient(96deg, #b6dc3f, #8dbb28);
  border-color: transparent;
  color: #0b0e05;
  font-weight: 600;
}

.cj-pf-empty h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #e7f7c4;
}

.cj-pf-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #93a37c;
  max-width: 62ch;
}

.cj-pf-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}

.cj-pf-disconnect {
  border-radius: 999px;
  border: 1px solid rgb(255 90 31 / 0.4);
  background: rgb(255 90 31 / 0.1);
  color: #ffb08f;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 16px;
  transition: background 0.15s ease;
}

.cj-pf-disconnect:hover {
  background: rgb(255 90 31 / 0.2);
}

.cj-pf-note {
  font-size: 11px;
  color: #7d8b68;
}

@media (max-width: 640px) {
  .cj-pf {
    padding: 0;
    align-items: flex-end;
  }

  .cj-pf-sheet {
    width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
  }

  .cj-pf-scroll {
    padding: 16px;
  }

  .cj-pf-val {
    font-size: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cj-reown-chip,
  .cj-reown-dot,
  .cj-pf-sheet {
    animation: none;
  }
}
