:root {
  --bg: #0b0e17;
  --bg-soft: #121726;
  --card: #161c2d;
  --card-2: #1d2438;
  --line: #263049;
  --text: #e6ebf5;
  --muted: #8b97b1;
  --accent: #9945ff;
  --accent-2: #14f195;
  --danger: #ff6b6b;
  --warn: #ffb020;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Cascadia Mono", monospace; }

.shell {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 14px 0;
  background: rgba(11, 14, 23, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 20px;
  color: #0b0e17;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.brand-title { font-size: 16px; font-weight: 600; }
.brand-sub { font-size: 12px; color: var(--muted); }

.wallet-area { position: relative; display: flex; align-items: center; gap: 10px; }

.wallet-net {
  padding: 5px 10px;
  font-size: 12px;
  color: var(--accent-2);
  border: 1px solid rgba(20, 241, 149, .3);
  border-radius: 999px;
  background: rgba(20, 241, 149, .08);
}

.wallet-button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  transition: border-color .15s, background .15s;
}

.wallet-button:hover { border-color: var(--accent); background: #232b42; }

.wallet-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5b6478;
}

.wallet-dot.online { background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }

.caret { color: var(--muted); font-size: 11px; }

.wallet-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
}

.wallet-menu-title { font-size: 13px; font-weight: 600; }
.wallet-menu-hint { margin-top: 2px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.wallet-menu-head { margin-bottom: 10px; }

.wallet-list { display: flex; flex-direction: column; gap: 6px; }

.wallet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--card-2);
  transition: border-color .15s, background .15s;
}

.wallet-item:hover { border-color: var(--accent); background: #242c44; }
.wallet-item.current { border-color: var(--accent-2); }

.wallet-item-left { display: flex; align-items: center; gap: 10px; }

.wallet-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 13px;
  font-weight: 700;
  color: #0b0e17;
  border-radius: 8px;
  background: linear-gradient(135deg, #b7a3ff, #7f5bff);
}

.wallet-icon.phantom { background: linear-gradient(135deg, #ab9ff2, #4e44ce); color: #fff; }
.wallet-icon.solflare { background: #fc7227; color: #fff; }
.wallet-icon.backpack { background: #e33e3f; color: #fff; }
.wallet-icon.okx { background: #fff; color: #111; }

.wallet-tag { font-size: 11px; color: var(--muted); }
.wallet-tag.ok { color: var(--accent-2); }

.wallet-account {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.wallet-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12px;
}

.wallet-account-row .mono { font-size: 11px; word-break: break-all; text-align: right; }

.wallet-account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.wallet-account-actions .btn-ghost { padding: 7px 6px; font-size: 12px; }

.tabs {
  padding: 14px 0 0;
}

.tabs-inner {
  display: flex;
  gap: 6px;
}

.tab {
  padding: 9px 18px;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px 10px 0 0;
  background: transparent;
  transition: color .15s, background .15s;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--text);
  border-color: var(--line);
  border-bottom-color: transparent;
  background: var(--card);
}

.content {
  flex: 1;
  padding: 16px 0 24px;
  overflow-y: auto;
}

.panel { display: none; }
.panel.active { display: block; }

.card {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.card-title {
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-2);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.span2 { grid-column: span 2; }
.field > span { font-size: 12px; color: var(--muted); }
.field small { font-size: 11px; color: #6b7690; }

input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-soft);
  outline: none;
  transition: border-color .15s;
}

input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
textarea { resize: vertical; }

.inline-row { display: flex; gap: 10px; margin-bottom: 8px; }
.inline-row input { flex: 1; }

.logo-row { display: flex; align-items: flex-start; gap: 16px; margin-top: 16px; }

.logo-drop {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 104px;
  height: 104px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  transition: border-color .15s, background .15s;
}

.logo-drop:hover,
.logo-drop.dragover { border-color: var(--accent); background: #1a2236; }
.logo-drop img { width: 100%; height: 100%; object-fit: contain; }

.logo-info { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.logo-info small { font-size: 11px; color: #6b7690; }

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  font-size: 13px;
  cursor: pointer;
}

.check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

.actions { display: flex; gap: 10px; margin-top: 4px; }

.btn-primary, .btn-ghost {
  padding: 10px 22px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: 10px;
  transition: opacity .15s, border-color .15s, background .15s;
}

.btn-primary {
  color: #0b0e17;
  font-weight: 600;
  border: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.btn-primary:hover { opacity: .88; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.btn-ghost {
  color: var(--text);
  border: 1px solid var(--line);
  background: transparent;
}

.btn-ghost:hover { border-color: var(--accent); background: var(--card-2); }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover { border-color: var(--danger); }

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.status-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 10px;
}

.status-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}

.status-item .k { font-size: 11px; color: var(--muted); }
.status-item .v { margin-top: 4px; font-size: 12px; word-break: break-all; }
.status-item .v.ok { color: var(--accent-2); }
.status-item .v.bad { color: var(--danger); }

.tip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tip-btn {
  padding: 8px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

.tip-btn.active {
  border-color: var(--accent);
  background: rgba(153, 69, 255, .16);
}

.tip-custom {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.tip-custom input { width: 96px; padding: 8px 10px; }
.tip-custom span { font-size: 12px; color: var(--muted); }

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--warn);
  border: 1px solid rgba(255, 176, 32, .3);
  border-radius: 10px;
  background: rgba(255, 176, 32, .08);
}

.card > .notice {
  margin-top: 12px;
  margin-bottom: 0;
}

.log-panel {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 12px;
  color: var(--muted);
}

.log-head .btn-ghost { padding: 4px 12px; font-size: 11px; }

.log-body {
  height: 168px;
  padding: 0 0 12px;
  overflow-y: auto;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
  line-height: 1.7;
}

.log-line { white-space: pre-wrap; word-break: break-all; }
.log-line .ts { color: #5b6478; }
.log-line.error { color: var(--danger); }
.log-line.success { color: var(--accent-2); }
.log-line.warn { color: var(--warn); }
.log-line a { color: var(--accent-2); }

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 80;
  padding: 11px 20px;
  font-size: 13px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .5);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  background: rgba(7, 9, 15, .72);
  backdrop-filter: blur(3px);
}

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--line);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 9, 15, .72);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(420px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .55);
}

.modal.success-modal {
  width: min(560px, 100%);
}

.modal-title { font-size: 15px; font-weight: 600; }
.modal-body {
  margin: 12px 0 18px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  white-space: pre-wrap;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; }
.copy-row .btn-ghost { flex-shrink: 0; padding: 10px 14px; }

.mint-copy {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  text-align: left;
  word-break: break-all;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.mint-copy:hover {
  border-color: var(--accent);
}

.mint-copy-btn {
  width: 100%;
  margin-top: 8px;
}

.success-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.success-links a { color: var(--accent-2); }

.progress-modal {
  width: min(380px, 100%);
  padding: 18px 18px 16px;
  border-radius: 14px;
  background: #fff;
  color: #2b2f36;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.progress-title {
  font-size: 16px;
  font-weight: 700;
  color: #2b2f36;
}

.progress-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #9aa0a8;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.progress-close:hover { color: #5b616a; }
.progress-close:disabled {
  opacity: .35;
  cursor: default;
}

.progress-list { display: flex; flex-direction: column; gap: 8px; }

.progress-step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 8px;
  background: #ececec;
  color: #9aa0a8;
}

.progress-step.is-active,
.progress-step.is-done {
  color: #2b2f36;
}

.progress-step.is-error {
  color: #c0392b;
  background: #f8eaea;
}

.progress-num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.progress-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}

.progress-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.progress-step.is-done .progress-icon {
  border-radius: 50%;
  background: #22c55e;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5 10 16.5 18 8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px;
}

.progress-step.is-active .progress-icon {
  border-radius: 50%;
  border: 2px solid transparent;
  background:
    linear-gradient(#ececec, #ececec) padding-box,
    conic-gradient(from 0deg, #f5a524, #f97316, #f5a524) border-box;
  animation: spin .8s linear infinite;
}

.progress-step.is-error .progress-icon {
  border-radius: 50%;
  background: #e74c3c;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7 7 17'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}

.progress-error {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.55;
  color: #c0392b;
  white-space: pre-wrap;
  word-break: break-all;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .grid, .status-grid, .status-grid-4 { grid-template-columns: 1fr; }
  .field.span2 { grid-column: span 1; }
  .topbar-inner { flex-wrap: wrap; }
  .wallet-menu { width: min(340px, calc(100vw - 24px)); }
  .tabs-inner { flex-wrap: wrap; }
  .tip-custom { margin-left: 0; }
}
