:root {
  color-scheme: dark;
  --bg: #07110c;
  --bg-raise: #0c1812;
  --card: #101c16;
  --card-2: #15241c;
  --ink: #e7f3ea;
  --muted: #8ea497;
  --line: rgba(186, 220, 190, 0.16);
  --line-strong: rgba(214, 242, 92, 0.45);
  --accent: #d6f25c;
  --accent-ink: #14210c;
  --accent-deep: #3dd68c;
  --warn: #f0b429;
  --working: #8ee7b0;
  --idle: #b7c4b8;
  --danger: #e85d5d;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --sans: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: Outfit, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-family: var(--sans);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(880px 420px at 0% -8%, rgba(214, 242, 92, 0.1), transparent 58%),
    radial-gradient(720px 380px at 100% 0%, rgba(61, 214, 140, 0.08), transparent 52%),
    var(--bg);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(214, 242, 92, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 242, 92, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 70%);
}

button, input, select, textarea { font: inherit; color: inherit; }

button {
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
}

button:hover:not(:disabled) { filter: brightness(1.05); }

button:active:not(:disabled) { transform: translateY(1px); }

button:disabled {
  opacity: 0.42;
  cursor: default;
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

button.ghost:hover:not(:disabled) {
  border-color: rgba(214, 242, 92, 0.4);
  background: rgba(214, 242, 92, 0.06);
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff8f6;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, h3, p { margin: 0; }

h1 {
  font-family: var(--display);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

h2 {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 { font-size: 13px; font-weight: 600; }

code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--accent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #10261b;
  border: 1px solid rgba(214, 242, 92, 0.25);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.mark svg { display: block; }

.brand-kicker {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.brand-name {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.login-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-stage {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 36px;
  align-items: center;
}

.login-brand {
  display: grid;
  gap: 18px;
  padding-right: 12px;
}

.login-brand .sub { max-width: 42ch; }

.login-points {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.login-points li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.login-points li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(214, 242, 92, 0.12);
  flex-shrink: 0;
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 26px 22px 22px;
  background: linear-gradient(180deg, rgba(22, 40, 30, 0.92), rgba(12, 24, 18, 0.96));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.card-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 600;
}

.login-card h2 { font-size: 28px; }

.login-card .sub { font-size: 13px; }

.login-card button[type="submit"] {
  width: 100%;
  margin-top: 4px;
  padding: 12px 14px;
  font-size: 15px;
}

.login-error {
  margin: 0;
  color: #ffb4b4;
  font-size: 13px;
  background: rgba(232, 93, 93, 0.12);
  border: 1px solid rgba(232, 93, 93, 0.35);
  border-radius: 10px;
  padding: 8px 10px;
}

/* 钱包登录 —— 当前唯一的登录入口 */
.wallet-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  background: transparent;
  border: 1px solid rgba(214, 242, 92, 0.45);
  color: var(--accent, #d6f25c);
}

.wallet-btn-lg {
  margin-top: 4px;
  padding: 12px 14px;
  font-size: 15px;
}

.wallet-btn:hover:not(:disabled) {
  background: rgba(214, 242, 92, 0.1);
}

.wallet-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.14);
  color: inherit;
}

.login-hint {
  margin: 0;
  color: var(--muted, #8ea497);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.app-view { position: relative; z-index: 1; }

.top-bar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px 16px;
  flex-wrap: nowrap;
  padding: 10px 14px;
  background: rgba(12, 24, 18, 0.78);
  border: 1px solid var(--line);
  border-radius: 16px;
  backdrop-filter: blur(16px);
}

.uid-line {
  margin: 0 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  flex-shrink: 0;
  text-transform: uppercase;
  color: var(--muted);
}

.uid-line span {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(214, 242, 92, 0.08);
  border: 1px solid rgba(214, 242, 92, 0.18);
}

.main-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  margin: 0;
  border-radius: 10px;
  background: #0b1510;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.main-tab {
  flex: 0 0 auto;
  margin: 0;
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.main-tab:hover {
  color: var(--ink);
  background: rgba(214, 242, 92, 0.05);
}

.main-tab.active {
  color: var(--accent-ink);
  background: var(--accent);
}

.zone {
  width: min(1440px, calc(100% - 32px));
  margin: 14px auto 40px;
}

.zone[hidden] { display: none !important; }

.zone-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.zone-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.zone-head h2 {
  font-size: 22px;
  margin: 0;
}

.zone-desc {
  margin: 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.zone-desc-inline {
  max-width: none;
  margin: 0 0 12px;
}

.public-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.public-top {
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(280px, 0.95fr);
  gap: 14px;
  align-items: stretch;
}

.global-stats-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.global-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1;
  align-content: stretch;
}

.global-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
}

.global-stat-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.global-stat-value {
  font-family: var(--mono);
  font-size: clamp(26px, 3.2vw, 40px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  word-break: break-word;
}

.global-stat-suffix {
  margin-left: 4px;
  font-size: 0.45em;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--accent);
  vertical-align: 0.15em;
}

.public-split {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.25fr);
  gap: 14px;
  align-items: stretch;
}

.agent-split {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.balance-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.balance-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.balance-card.accent {
  border-color: rgba(214, 242, 92, 0.28);
  background:
    linear-gradient(180deg, rgba(214, 242, 92, 0.08), transparent 42%),
    var(--card);
}

.balance-card h2 { font-size: 15px; }

.balance-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 2px;
}

.balance-card-head .card-desc { margin-bottom: 0; }

.balance-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.balance-card-actions button {
  padding: 7px 12px;
  font-size: 13px;
}

.card-desc {
  margin: 4px 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.balance-grid {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.balance-grid .full { grid-column: 1 / -1; }

.balance-grid div { min-width: 0; }

.balance-grid dt {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.balance-grid dd {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  word-break: break-word;
  line-height: 1.45;
}

.balance-grid .total {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
}

.balance-card.accent .balance-grid .total {
  background: rgba(214, 242, 92, 0.06);
  border-color: rgba(214, 242, 92, 0.18);
}

.balance-grid .total dt {
  font-size: 11px;
  color: var(--muted);
}

.balance-grid .total dd {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.total-num { color: var(--ink); }

.total-change {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.total-change:empty { display: none; }

.total-change.up { color: #3dd68c; }
.total-change.down { color: #ff7a7a; }
.total-change.flat { color: var(--muted); }

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.top {
  display: block;
  width: min(1440px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
  padding: 18px 0 4px;
}

.sub, .hint, .muted { color: var(--muted); }

.sub, .hint { font-size: 13px; line-height: 1.55; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

input, select, textarea {
  border: 1px solid var(--line);
  background: #0b1510;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(214, 242, 92, 0.55);
  outline: none;
  box-shadow: 0 0 0 3px rgba(214, 242, 92, 0.12);
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.panel-head h2 { font-size: 18px; }

.rank-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 340px;
}

.rank-panel .card-desc {
  margin: 0 0 8px;
  font-size: 12px;
  flex-shrink: 0;
}

.rank-panel .panel-head {
  margin-bottom: 6px;
  flex-shrink: 0;
}

.model-rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: auto;
}

.model-rank-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: center;
  padding: 2px 0;
  border: 0;
  background: transparent;
}

.model-rank-item.top {
  background: transparent;
}

.model-rank-place {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.model-rank-item.top .model-rank-place { color: var(--accent); }

.model-rank-body { min-width: 0; }

.model-rank-row {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-bottom: 3px;
  min-width: 0;
}

.model-rank-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.model-rank-rate {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-deep);
  flex-shrink: 0;
}

.model-rank-bar {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.model-rank-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3dd68c, #d6f25c);
  min-width: 2px;
}

.nft-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.selected-block { flex-shrink: 0; }

.detail-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--card-2);
}

.block-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.block-head .block-title { margin: 0; }

.nft-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 40vh;
  overflow: auto;
  padding-right: 2px;
}

.history-workspace .history-block {
  display: flex;
  flex-direction: column;
  min-height: 280px;
  border: 0;
  padding: 0;
  background: transparent;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  order: 2;
  max-height: 48vh;
  overflow: auto;
  padding-right: 2px;
}

.history-block > .hint {
  order: 1;
  margin: 0 0 8px;
}

.history-item {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  background: #0d1813;
  min-height: 72px;
  flex-shrink: 0;
  overflow: hidden;
}

.history-item-main {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 10px 12px;
  background: transparent;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  line-height: 1.45;
  font-weight: 400;
}

.history-item-main:hover { background: rgba(214, 242, 92, 0.05); }

.history-item .row1 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.history-item .row2,
.history-item .row3 {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.history-item .row3 { color: #d5e6da; }

.history-item .mono { font-family: var(--mono); }

.history-replay-btn {
  flex-shrink: 0;
  align-self: center;
  margin-right: 10px;
  padding: 6px 12px;
  font-size: 12px;
}

.history-replay-pending {
  flex-shrink: 0;
  align-self: center;
  margin-right: 12px;
  font-size: 12px;
  color: var(--muted);
}

.history-detail-dialog { width: min(560px, 100%); }

.history-detail-body {
  padding: 0 16px 16px;
  display: grid;
  gap: 0;
  max-height: min(70vh, 560px);
  overflow: auto;
}

.history-detail-body .kv-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.history-detail-body .kv-row dt {
  margin: 0;
  color: var(--muted);
}

.history-detail-body .kv-row dd {
  margin: 0;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 12px;
}

.nft-card, .empty {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #0d1813;
  text-align: left;
  width: 100%;
}

.nft-card {
  color: var(--ink);
  cursor: pointer;
  font-weight: 400;
  border-radius: 12px;
}

.nft-card:hover:not(:disabled) {
  border-color: rgba(214, 242, 92, 0.35);
  background: #122119;
}

.nft-card.selected {
  border-color: rgba(214, 242, 92, 0.7);
  background: rgba(214, 242, 92, 0.07);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nft-card .id {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}

.nft-meta, .kv {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 8px 3px 7px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.04);
  color: var(--idle);
  border: 1px solid var(--line);
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: currentColor;
}

.badge.working {
  background: rgba(61, 214, 140, 0.12);
  color: var(--working);
  border-color: rgba(61, 214, 140, 0.28);
}

.badge.pool-only {
  background: rgba(240, 180, 41, 0.12);
  color: var(--warn);
  border-color: rgba(240, 180, 41, 0.28);
}

.agent-panel { font-size: 14px; line-height: 1.6; }

.agent-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.ai-config-panel {
  margin-bottom: 16px;
}

.ai-config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.ai-config-dialog {
  width: min(880px, 100%);
}

.rent-dialog {
  width: min(560px, 100%);
}

.rent-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rent-config-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(360px, 50vh);
  overflow: auto;
}

.rent-config-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1510;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
}

.rent-config-item:hover {
  border-color: rgba(214, 242, 92, 0.35);
  background: rgba(214, 242, 92, 0.05);
}

.rent-config-item.selected {
  border-color: rgba(214, 242, 92, 0.55);
  background: rgba(214, 242, 92, 0.1);
}

.rent-config-item input {
  width: auto;
  margin: 3px 0 0;
  accent-color: #b6d64a;
}

.rent-config-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.rent-config-name {
  font-size: 14px;
  font-weight: 600;
}

.rent-config-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-deep);
}

.rent-config-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 4px;
}

.rent-config-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
}

.rent-config-stat-label {
  color: var(--muted);
}

.rent-config-stat-value {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink);
}

.rent-config-stat-change {
  font-family: var(--mono);
  font-weight: 600;
}

.rent-config-stat-change.up { color: #3dd68c; }
.rent-config-stat-change.down { color: #ff7a7a; }
.rent-config-stat-change.flat { color: var(--muted); }

.rent-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.rent-fee {
  font-size: 13px;
  font-family: var(--mono);
}

.ai-config-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 140px);
  overflow: auto;
}

.ai-config-modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-config-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ai-config-col .block-title {
  margin-bottom: 8px;
}

@media (max-width: 900px) {
  .ai-config-split { grid-template-columns: 1fr; }
}

.lib-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(360px, 48vh);
  overflow: auto;
}

.lib-item {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.lib-item-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid rgba(214, 242, 92, 0.14);
  border-radius: 10px;
  background: rgba(7, 17, 12, 0.35);
  color: var(--ink);
  font-weight: 400;
  cursor: pointer;
}

.lib-item-open:hover:not(:disabled) {
  border-color: rgba(214, 242, 92, 0.4);
  background: rgba(214, 242, 92, 0.06);
}

.lib-item-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lib-item-del {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
  align-self: center;
}
.nft-bind-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 10px 0;
}
.nft-bind-row label {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.strategy-dialog { width: min(560px, 100%); }

.scripts-dialog { width: min(760px, 100%); }

.train-dialog { width: min(760px, 100%); }

.float-modal.train-modal-full {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.float-modal-dialog.train-dialog-full {
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0c1611;
}

.train-bar-compact {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.train-bar-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.train-bar-compact h2 {
  margin: 0;
  font-size: 15px;
}

.train-token-inline {
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.llm-config-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #0b1510;
}

.llm-config-panel summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--ink);
}

.llm-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.llm-config-actions { margin-top: 6px; }

@media (max-width: 720px) {
  .llm-config-grid { grid-template-columns: 1fr; }
}

.train-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.train-form-full {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  gap: 8px;
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
}

.train-form select { width: 100%; }

.train-toolbar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.train-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px 8px;
}

.train-toolbar-history {
  align-items: center;
}

.train-toolbar-history .train-field-history {
  flex: 1 1 220px;
  max-width: min(420px, 100%);
}

.train-toolbar-history > button {
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.train-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  min-width: 0;
  flex: 1 1 120px;
  max-width: 200px;
}

.train-field select {
  font-size: 13px;
  padding: 6px 8px;
}

.train-replay-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding-bottom: 1px;
}

.train-replay-trigger button {
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.train-actions-inline {
  margin-left: auto;
  justify-content: flex-end;
}

.train-actions-inline button {
  padding: 6px 12px;
  font-size: 13px;
}

.train-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
  gap: 8px;
}

.train-chat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  min-width: 0;
}

.train-chat-log {
  flex: 1;
  min-height: 0;
  height: auto;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0a120e;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.train-proposals {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b1510;
  padding: 8px;
}

.train-proposals .train-replay-head {
  margin-bottom: 4px;
}

.train-replay-picker[hidden] { display: none !important; }

.train-replay-picker {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.train-replay-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 7, 0.65);
}

.train-replay-picker-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: #122018;
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.train-replay-picker-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.train-replay-picker-bar h3 {
  margin: 0;
  font-size: 14px;
}

.train-replay-picker-hint {
  margin: 0;
  padding: 8px 14px 0;
  font-size: 12px;
}

.train-replay-picker-foot {
  display: flex;
  justify-content: center;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.train-replay-picker-foot button[hidden] {
  display: none !important;
}

.train-replay-picker .train-replay-list {
  max-height: none;
  flex: 1;
  min-height: 0;
  border: 0;
  border-radius: 0;
}

@media (max-width: 800px) {
  .train-main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(120px, 28%);
  }

  .train-field {
    flex: 1 1 calc(50% - 8px);
    max-width: none;
  }

  .train-actions-inline {
    margin-left: 0;
    width: 100%;
  }
}

.train-chat-empty {
  margin: auto;
  color: var(--muted);
  font-size: 13px;
}

.train-chat-bubble {
  max-width: 88%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.train-chat-bubble.user {
  align-self: flex-end;
  align-items: flex-end;
}

.train-chat-bubble.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.train-chat-role {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.train-chat-text {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.train-chat-bubble.user .train-chat-text {
  background: var(--accent);
  color: var(--accent-ink);
  border-bottom-right-radius: 4px;
}

.train-chat-bubble.assistant .train-chat-text {
  background: #15241c;
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

.train-chat-bubble.pending .train-chat-text {
  color: var(--muted);
  font-style: italic;
}

.train-chat-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.train-chat-composer input {
  min-width: 0;
  padding: 8px 10px;
  font-size: 13px;
}

.train-chat-composer button {
  padding: 8px 14px;
  font-size: 13px;
}

.train-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.train-proposal-list {
  display: grid;
  gap: 8px;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.train-proposal-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #0b1510;
}

.train-proposal-card h4 {
  margin: 0 0 6px;
  font-size: 13px;
}

.train-proposal-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.train-proposal-diff {
  margin: 0 0 8px;
  padding: 8px;
  max-height: 140px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre-wrap;
  background: #07110c;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: #c8e6a0;
}

.train-proposal-errors {
  margin: 0.4rem 0 0;
  padding: 0.45rem 0.55rem;
  font-size: 0.75rem;
  line-height: 1.35;
  white-space: pre-wrap;
  color: #b42318;
  background: rgba(180, 35, 24, 0.08);
  border-radius: 4px;
  max-height: 8rem;
  overflow: auto;
}

.train-proposal-hint {
  font-size: 0.72rem;
  opacity: 0.75;
  align-self: center;
}

.train-proposal-actions {
  display: flex;
  gap: 8px;
}

.train-replay-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.train-replay-list {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1510;
}

.train-replay-picker .train-replay-list {
  max-height: none;
}

.train-replay-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
}

.train-replay-item:last-child { border-bottom: 0; }

.train-replay-item:hover { background: rgba(214, 242, 92, 0.05); }

.train-replay-item.checked {
  background: rgba(214, 242, 92, 0.1);
}

.train-replay-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.train-replay-item input {
  width: auto;
  margin: 2px 0 0;
  accent-color: #b6d64a;
}

.train-replay-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.train-replay-play-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 12px;
}

.train-replay-main .mono {
  font-family: var(--mono);
  font-weight: 600;
}

.train-replay-empty {
  padding: 14px 12px;
  color: var(--muted);
  font-size: 13px;
}

.scripts-tabs { display: flex; gap: 6px; }

.scripts-tabs button {
  flex: 1;
  background: #0b1510;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 10px;
}

.scripts-tabs button.active {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent);
}

.scripts-status {
  margin: 0;
  font-size: 12px;
}

.scripts-editor {
  width: 100%;
  min-height: 340px;
  max-height: 55vh;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
  tab-size: 2;
  color: #d7f5c8;
  background: #0a120e;
}

.scripts-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.scripts-upload {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
}

.strategy-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.strategy-token {
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #0b1510;
  border: 1px solid var(--line);
}

.check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
}

.check-row input { width: auto; margin: 0; accent-color: #8fb83a; }

.strategy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pool-pair-block {
  display: grid;
  gap: 8px;
}

.pool-pair-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.pool-pair-list {
  max-height: 160px;
  overflow: auto;
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1510;
}

.pool-pair-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--ink);
  cursor: pointer;
}

.pool-pair-item input {
  width: auto;
  margin: 0;
  accent-color: #8fb83a;
}

.pool-pair-item.checked {
  color: #c8e6a0;
}

.dex-list {
  margin: 8px 0 0;
  padding: 8px 8px 8px 26px;
  border-radius: 10px;
  background: #0b1510;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.row { display: flex; gap: 8px; }

.transfer-form { display: grid; gap: 10px; }

.float-transfer-form { padding: 0 16px 16px; }

.empty {
  color: var(--muted);
  cursor: default;
  border-style: dashed;
}

body.float-modal-open { overflow: hidden; }

.float-modal[hidden] { display: none !important; }

.float-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.float-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 7, 0.72);
  backdrop-filter: blur(6px);
}

.float-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  border-radius: 18px;
  background: #122018;
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.float-modal-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 10px;
}

.float-modal-bar h2 { font-size: 18px; }

.kline-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: #090f16;
  border-color: #1d2a3a;
  color: #e8eef7;
}

.kline-full {
  width: 100%;
  height: auto;
}

.kline-full .kline-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.kline-side .panel-head h2 { color: #e8eef7; }

.kline-side .panel-head .ghost,
.kline-panel .ghost {
  color: #e8eef7;
  border-color: #2a3545;
}

.kline-panel {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  color: #e8eef7;
}

.kline-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.kline-pair {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.kline-pool-label {
  color: #9aa4b2;
  min-width: 180px;
}

.kline-pool-label select {
  margin-top: 6px;
  width: 100%;
  border: 1px solid #2a3545;
  background: #0f1419;
  color: #e8eef7;
}

.kline-price-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kline-last {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.kline-change {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}

.kline-change.up { color: #3dd68c; }
.kline-change.down { color: #ff7a7a; }
.kline-change.flat { color: #9aa4b2; }

.kline-intervals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.kline-intervals button {
  background: #141c28;
  border-color: #2a3545;
  color: #c5d0de;
  padding: 4px 9px;
  font-size: 11px;
}

.kline-intervals button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.kline-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.kline-stat {
  background: #0f1419;
  border: 1px solid #1e2836;
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kline-stat span {
  font-size: 9px;
  color: #8b97a8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kline-stat strong {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kline-chart {
  margin-top: 8px;
  height: 120px;
  border-radius: 10px;
  overflow: hidden;
  background: #0f1419;
  border: 1px solid #1e2836;
  flex: 0 0 auto;
}

.kline-full .kline-chart {
  height: min(420px, 48vh);
  min-height: 260px;
  flex: 1 1 auto;
}

.kline-hint {
  margin-top: 6px;
  margin-bottom: 0;
  font-size: 12px;
  color: #8b97a8 !important;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100% - 32px));
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.toasts:empty { display: none; }

.toasts li {
  pointer-events: auto;
  background: #14241c;
  border: 1px solid rgba(214, 242, 92, 0.22);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toasts li.leaving {
  opacity: 0;
  transform: translateY(6px);
}

.toasts li.err {
  border-color: rgba(232, 93, 93, 0.5);
  background: #2a1616;
  color: #ffd4d4;
}

.nft-list::-webkit-scrollbar,
.history-list::-webkit-scrollbar,
.history-detail-body::-webkit-scrollbar,
.train-chat-log::-webkit-scrollbar,
.scripts-editor::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.nft-list::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb,
.history-detail-body::-webkit-scrollbar-thumb,
.train-chat-log::-webkit-scrollbar-thumb,
.scripts-editor::-webkit-scrollbar-thumb {
  background: rgba(214, 242, 92, 0.25);
  border-radius: 99px;
}

@media (max-width: 560px) {
  .strategy-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .login-stage { grid-template-columns: 1fr; gap: 22px; }
  .login-brand { padding-right: 0; }
  .login-brand h1 { font-size: 32px; }
}

@media (max-width: 980px) {
  .public-top,
  .public-split,
  .agent-split { grid-template-columns: 1fr; }
  .rank-panel,
  .kline-side { height: auto; max-height: none; }
  .model-rank-list {
    flex: none;
    min-height: 120px;
    max-height: 200px;
  }
  .global-stats-grid { grid-template-columns: 1fr 1fr; }
  .global-stat-value { font-size: 28px; }
  .nft-list { max-height: 36vh; }
  .history-list { max-height: 40vh; }
  .kline-chart { height: 120px; }
  .kline-full .kline-chart {
    height: min(320px, 42vh);
    min-height: 200px;
  }
  .balance-compare { grid-template-columns: 1fr; }
  .kline-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kline-last { font-size: 20px; }
  .zone-head { align-items: flex-start; }
  .top-bar {
    gap: 8px;
    padding: 8px 10px;
  }
  .brand-kicker { display: none; }
  .brand-name { font-size: 14px; }
  .main-tab {
    padding: 6px 8px;
    font-size: 12px;
  }
  .uid-line { display: none; }
}
