:root {
  --bg: #0a0c12;
  --bg-2: #0e1019;
  --header: #12151f;
  --fill: #161922;
  --border: #1e2330;
  --line: #252a38;
  --text: #f3f4f6;
  --muted: #6b7280;
  --primary: #a3e635;
  --primary-dim: rgba(163, 230, 53, 0.15);
  --danger: #f87171;
  --ok: #34d399;
  --radius: 10px;
  --font: "Poppins", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 50% 40% at 90% 0%, rgba(88, 28, 135, 0.35), transparent 55%),
    radial-gradient(ellipse 40% 35% at 10% 80%, rgba(30, 58, 138, 0.25), transparent 50%),
    var(--bg);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(1200px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(10, 12, 18, 0.75);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--primary), #65a30d);
  box-shadow: 0 0 24px rgba(163, 230, 53, 0.25);
  display: grid;
  place-items: center;
  color: #0a0c12;
  font-weight: 700;
  font-size: 0.85rem;
}

.page {
  padding: 2rem 0 4rem;
}

.page-head {
  margin-bottom: 1.25rem;
  text-align: center;
}

.page-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--muted);
}

.page-head p {
  display: none;
}

.panel {
  background: rgba(14, 16, 25, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.panel-pad {
  padding: 1.15rem 1.25rem;
}

.panel-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.field label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.input,
.select {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--fill);
  padding: 0 0.85rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.select:focus {
  border-color: rgba(163, 230, 53, 0.55);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap .input {
  padding-left: 2.6rem;
}

.input-icon-wrap .ico {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 44px;
  padding: 0 1.1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: filter 0.15s, opacity 0.15s, transform 0.1s;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #0a0c12;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-sm {
  height: 32px;
  padding: 0 0.65rem;
  font-size: 0.8rem;
}

.btn-add {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #0a0c12;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.btn-add:hover {
  filter: brightness(1.08);
}

.btn-add:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Main broker layout — match GIF */
.broker {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(14, 16, 25, 0.85);
  backdrop-filter: blur(12px);
}

@media (max-width: 900px) {
  .broker {
    grid-template-columns: 1fr;
  }
}

.broker-left,
.broker-right {
  padding: 1.15rem 1.2rem;
  min-height: 520px;
}

.broker-left {
  border-right: 1px solid var(--border);
}

.broker-right {
  background: rgba(10, 12, 18, 0.35);
}

.section-label {
  margin: 1rem 0 0.55rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.collection-list {
  max-height: 280px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.collection-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--fill);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s, background 0.15s;
}

.collection-item:hover,
.collection-item.active {
  border-color: rgba(163, 230, 53, 0.45);
  background: var(--primary-dim);
}

.collection-item .thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #1f2937;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  color: var(--muted);
}

.collection-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collection-item .meta {
  flex: 1;
  min-width: 0;
}

.collection-item .meta strong {
  display: block;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-item .meta span {
  font-size: 0.72rem;
  color: var(--muted);
}

.collection-item .count {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.token-box {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.token-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.token-row .unit {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0 0.35rem;
  min-width: 2.5rem;
}

/* Token dropdown + spoof buttons */
.token-picker {
  position: relative;
}

.token-picker-btn {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--fill);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.85rem;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.token-picker-btn img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: #1f2937;
}

.token-picker-btn .chev {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.75rem;
}

.token-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #12151f;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 0.4rem;
  max-height: 260px;
  overflow: auto;
}

.token-dropdown[hidden] {
  display: none !important;
}

.token-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.55rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.token-option:hover {
  background: rgba(163, 230, 53, 0.08);
}

.token-option img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: #1f2937;
}

.token-option .sym {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 3.2rem;
}

.token-option .spoof-btn {
  margin-left: auto;
  height: 30px;
  padding: 0 0.65rem;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #1a1d28;
  color: #d1d5db;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.token-option .spoof-btn.on {
  border-color: rgba(163, 230, 53, 0.45);
  color: #a3e635;
  background: rgba(163, 230, 53, 0.1);
}

.token-option .spoof-btn:hover {
  border-color: #a3e635;
  color: #a3e635;
}

.collection-item {
  position: relative;
}

.collection-item .spoof-col-btn {
  flex-shrink: 0;
  height: 28px;
  padding: 0 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #1a1d28;
  color: #9ca3af;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.collection-item .spoof-col-btn.on {
  border-color: rgba(163, 230, 53, 0.45);
  color: #a3e635;
  background: rgba(163, 230, 53, 0.1);
}

.collection-item .spoof-col-btn:hover {
  border-color: #a3e635;
  color: #a3e635;
}

/* Manual spoof collection contract panel */
.spoof-contract-box {
  margin-top: 1rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(163, 230, 53, 0.22);
  background: linear-gradient(180deg, rgba(163, 230, 53, 0.06), transparent 70%);
}

.spoof-contract-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.spoof-contract-row .input {
  flex: 1;
  min-width: 0;
}

.spoof-add-btn {
  width: auto !important;
  flex-shrink: 0;
  padding: 0 1rem;
  white-space: nowrap;
}

.spoof-contract-list {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.spoof-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(163, 230, 53, 0.35);
  background: rgba(163, 230, 53, 0.08);
  font-size: 0.78rem;
}

.spoof-chip .addr {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #d9f99d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spoof-chip .tag {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #a3e635;
  text-transform: uppercase;
}

.spoof-chip .rm {
  flex-shrink: 0;
  height: 26px;
  padding: 0 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #1a1d28;
  color: #9ca3af;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.spoof-chip .rm:hover {
  border-color: #f87171;
  color: #fca5a5;
}

.right-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.right-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.table-head,
.nft-row {
  display: grid;
  grid-template-columns: 2.4fr 0.7fr 0.9fr 0.7fr;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.8rem;
}

.table-head {
  color: var(--muted);
  padding: 0.4rem 0.2rem 0.65rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.25rem;
}

.nft-row {
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid rgba(37, 42, 56, 0.65);
}

.nft-row .asset {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.asset-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #1f2937;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  color: var(--muted);
}

.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-meta {
  min-width: 0;
}

.asset-meta strong {
  display: block;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-meta span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.center {
  text-align: center;
  color: var(--muted);
}

.side-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.side-tab {
  flex: 1;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--fill);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
}

.side-tab.active {
  border-color: rgba(163, 230, 53, 0.55);
  background: var(--primary-dim);
  color: var(--primary);
}

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  margin-top: 0.75rem;
}

.preview-panel {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(14, 16, 25, 0.85);
  padding: 1.15rem 1.25rem;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 700px) {
  .preview-grid {
    grid-template-columns: 1fr;
  }
}

.preview-col h3 {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.preview-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.preview-item .rm {
  margin-left: auto;
}

.footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
  align-items: center;
}

.footer-actions .btn-primary {
  width: auto;
  min-width: 200px;
}

.status-line {
  margin-top: 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.status-line.err {
  color: var(--danger);
}

.status-line.ok {
  color: var(--ok);
}

.toast {
  position: fixed;
  right: 1rem;
  top: 5rem;
  z-index: 60;
  min-width: 220px;
  max-width: 360px;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--header);
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-size: 0.88rem;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.ok {
  border-color: rgba(52, 211, 153, 0.4);
}

.toast.err {
  border-color: rgba(248, 113, 113, 0.4);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.trade-code-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--primary-dim);
  color: var(--primary);
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
  font-weight: 600;
}

.result-box {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid rgba(163, 230, 53, 0.35);
  background: rgba(163, 230, 53, 0.06);
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.input-row .input {
  flex: 1;
}

.w-full {
  width: 100%;
}

.mt-2 {
  margin-top: 0.75rem;
}

.wallet-stack .field {
  margin-bottom: 0.55rem;
}

.loading-overlay {
  opacity: 0.55;
  pointer-events: none;
}
