:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0d1117;
  color: #e6edf3;
  line-height: 1.6;
}
.wrap { max-width: 900px; margin: 0 auto; padding: 24px 16px 56px; }
h1 { font-size: 22px; margin: 0; }
h2 { margin: 0; font-size: 17px; }
h3 { margin: 0; font-size: 15px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small { font-size: 12px; }
.muted { color: #8b949e; font-size: 13px; }
a { color: #58a6ff; }

/* 头部 */
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo img { width: 40px; height: 40px; border-radius: 8px; display: block; }
.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.lang-btn, .wallet-btn, .ghost {
  background: #21262d; color: #e6edf3; border: 1px solid #30363d;
  border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.lang-btn:hover, .wallet-btn:hover, .ghost:hover { background: #30363d; }
.wallet-btn.on { border-color: #2ea043; color: #2ea043; }
.addr-line { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: #8b949e; }

/* 网络状态 */
.netline { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; color: #8b949e; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #8b949e; }
.dot.ok { background: #2ea043; }
.dot.bad { background: #f85149; }

.banner {
  margin-top: 14px; padding: 10px 14px; border-radius: 8px; font-size: 13px;
  background: rgba(210, 153, 34, 0.12); border: 1px solid rgba(210, 153, 34, 0.4); color: #d29922;
}
.banner.bad { background: rgba(248, 81, 73, 0.1); border-color: rgba(248, 81, 73, 0.4); color: #f85149; }

/* ===== 选项卡（发射台同款：主选项卡 pills + 详情子选项卡） ===== */
.tabs {
  display: flex; gap: 6px; margin-top: 16px;
  background: #161b22; border: 1px solid #30363d; border-radius: 10px; padding: 5px;
}
.tab {
  flex: 1; background: transparent; color: #8b949e; border: none; border-radius: 7px;
  padding: 10px 14px; cursor: pointer; font-size: 15px; font-weight: 600; white-space: nowrap;
}
.tab:hover { background: #21262d; color: #e6edf3; }
.tab.active { background: #238636; color: #fff; }
.subtabs { margin-top: 0; margin-bottom: 12px; }
.subtabs .tab { font-size: 14px; padding: 8px 12px; }

/* ===== 探索代币：搜索/排序 + 卡片网格 ===== */
.listctl { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.listctl input {
  flex: 1; min-width: 0; background: #0d1117; border: 1px solid #30363d; color: #e6edf3;
  border-radius: 8px; padding: 9px 12px; font-size: 14px;
}
.listctl input:focus { outline: none; border-color: #58a6ff; }
.listctl select { height: 38px; }
.listctl button { height: 38px; }
.token-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.grid-empty { grid-column: 1 / -1; text-align: center; color: #8b949e; font-size: 13px; padding: 16px; }
.token-card {
  display: flex; flex-direction: column; gap: 4px; align-items: center;
  background: #0d1117; border: 1px solid #30363d; border-radius: 10px; padding: 12px 10px;
  cursor: pointer; transition: border-color .15s, transform .15s; text-align: center;
}
.token-card:hover { border-color: #58a6ff; transform: translateY(-2px); }
.token-card.on { border-color: #58a6ff; background: rgba(88, 166, 255, 0.08); }
.tc-icon {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f6feb, #238636); color: #fff; font-weight: 700; font-size: 18px;
}
.tc-name { font-weight: 600; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-id { font-size: 11px; color: #8b949e; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-status { font-size: 11px; color: #d29922; }
.tc-status.live { color: #2ea043; }
.tc-live { font-size: 11px; color: #8b949e; display: flex; gap: 6px; justify-content: center; }
.tc-live b { color: #58a6ff; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* 卡片 */
.card {
  margin-top: 16px; background: #161b22; border: 1px solid #30363d;
  border-radius: 10px; padding: 16px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.pill {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: #21262d; border: 1px solid #30363d; color: #8b949e;
}
.pill.live { color: #2ea043; border-color: rgba(46, 160, 67, 0.5); }

.pool-id { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.pool-id .label { font-size: 12px; color: #8b949e; }
.pool-id b { display: block; word-break: break-all; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stats.two { grid-template-columns: repeat(2, 1fr); }
.stat {
  background: #0d1117; border: 1px solid #30363d; border-radius: 8px;
  padding: 10px; text-align: center; overflow: hidden;
}
.stat .label { display: block; font-size: 12px; color: #8b949e; margin-bottom: 2px; }
.stat b { font-size: 16px; color: #58a6ff; }

/* 图表（canvas 平滑面积图，发射台同款） */
.chart-wrap { margin-top: 16px; }
.chart-title { font-size: 12px; color: #8b949e; margin-bottom: 6px; }
.chart-relative { position: relative; }
#curve, #priceHist, #tierHist { width: 100%; display: block; cursor: crosshair; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 9; white-space: nowrap;
  background: rgba(20, 24, 30, 0.92); border: 1px solid #484f58; border-radius: 6px;
  padding: 5px 8px; font-size: 11px; line-height: 1.5; box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.chart-legend { display: flex; gap: 16px; align-items: center; font-size: 12px; color: #8b949e; margin-top: 4px; flex-wrap: wrap; }
.chart-legend .sw { display: inline-block; width: 14px; height: 2px; background: #58a6ff; vertical-align: middle; margin-right: 5px; }
.chart-legend .sw.now { background: #d29922; height: 8px; width: 8px; border-radius: 50%; }
.chart-legend .sw.hist { background: #3fb950; }

/* 交易面板 */
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.side {
  padding: 10px; border-radius: 8px; border: 1px solid #30363d; background: #0d1117;
  color: #8b949e; cursor: pointer; font-size: 15px;
}
.side.buy.active { color: #2ea043; border-color: rgba(46, 160, 67, 0.6); background: rgba(46, 160, 67, 0.08); }
.side.sell.active { color: #f85149; border-color: rgba(248, 81, 73, 0.6); background: rgba(248, 81, 73, 0.08); }

.amtrow { margin-bottom: 12px; }
.klabel { font-size: 12px; color: #8b949e; margin-bottom: 6px; }
.amtctl { display: flex; gap: 8px; align-items: center; }
#amtInput {
  flex: 1; height: 42px; background: #0d1117; border: 1px solid #30363d; color: #e6edf3;
  border-radius: 6px; font-size: 20px; text-align: right; padding: 0 12px;
}
#amtInput:focus { outline: none; border-color: #58a6ff; }
.unit { color: #8b949e; font-size: 14px; min-width: 3.5em; }
.kquick { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.kquick button {
  background: #21262d; border: 1px solid #30363d; color: #8b949e;
  border-radius: 6px; padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.advanced { margin: 10px 0; }
.advanced summary { cursor: pointer; color: #8b949e; font-size: 12px; }
.advopt { display: flex; gap: 6px; align-items: center; color: #8b949e; font-size: 12px; margin: 8px 0; cursor: pointer; }

.quote { background: #0d1117; border: 1px solid #30363d; border-radius: 8px; padding: 10px 12px; margin: 12px 0; }
.qrow { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 13px; }
.qrow span { color: #8b949e; }
.qrow b { font-weight: 600; text-align: right; word-break: break-all; }

.walletbox { margin: 12px 0; }
.utxo-label { display: block; font-size: 12px; color: #8b949e; margin: 10px 0 4px; }
#utxoSel {
  width: 100%; background: #0d1117; border: 1px solid #30363d; color: #e6edf3;
  border-radius: 6px; padding: 8px; font-size: 13px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.primary {
  width: 100%; margin-top: 12px; padding: 12px; border-radius: 8px; cursor: pointer;
  background: #238636; border: 1px solid #2ea043; color: #fff; font-size: 15px;
}
.primary:hover { background: #2ea043; }
.primary:disabled { background: #21262d; border-color: #30363d; color: #8b949e; cursor: not-allowed; }
.btnrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.btnrow .primary { margin-top: 0; }
.btnrow .ghost { height: 42px; }

.prepared { margin-top: 16px; border-top: 1px solid #30363d; padding-top: 14px; }
.outs { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12px; }
.outs th, .outs td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #21262d; }
.outs th { color: #8b949e; font-weight: 500; }
.outs td.mono { word-break: break-all; }
.sig-ok { font-size: 13px; color: #2ea043; margin-bottom: 6px; }
/* 提取出的最终交易：给人核对的，用略不同的底色区分于未签名交易 */
.finalbox { margin-top: 10px; padding: 10px; border: 1px dashed #30363d; border-radius: 8px; background: #0d1117; }
.finalbox .primary { margin-top: 8px; }

/* 预拆 UTXO */
.splitrow { margin-top: 12px; }
.splitrow .utxo-label { margin-top: 0; }
.splitctl { display: grid; grid-template-columns: 76px 1fr; gap: 8px; align-items: center; }
#splitK { height: 34px; background: #0d1117; border: 1px solid #30363d; color: #e6edf3; border-radius: 6px; text-align: center; font-size: 15px; }
.splitctl .ghost { height: 34px; }

/* 钱包持仓（B4）：全部符文列表 + 有池则给「交易」快捷入口 */
.holdings { margin-top: 12px; }
.holdings .utxo-label { margin-top: 0; }
#holdings { display: flex; flex-direction: column; gap: 6px; }
.holding {
  display: flex; align-items: center; gap: 10px;
  background: #0d1117; border: 1px solid #30363d; border-radius: 8px; padding: 8px 10px;
}
.holding .hname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.holding .hname b { font-weight: 600; }
.holding .hamt { flex: 0 0 auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: #58a6ff; }
.holding .ghost { flex: 0 0 auto; padding: 4px 12px; font-size: 12px; }
.holding .ghost:disabled { color: #8b949e; cursor: not-allowed; }

.facts ul { margin: 8px 0; padding-left: 20px; }
.facts li { margin: 6px 0; font-size: 13px; color: #c9d1d9; }
.err { color: #f85149; font-size: 13px; margin-top: 10px; }
.note { color: #d29922; font-size: 12px; margin-top: 8px; }
.foot { margin-top: 24px; text-align: center; font-size: 13px; }
.foot p { margin: 0; }

/* ===== 池子详情（发射台同款：图标 + 名称 + 进度条） ===== */
.backbtn { margin-top: 16px; margin-bottom: 2px; }
.detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.dicon {
  width: 52px; height: 52px; border-radius: 12px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f6feb, #238636); color: #fff; font-weight: 700; font-size: 22px;
}
.dmeta { min-width: 0; }
.dname { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; }
.dmeta #poolAddr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-wrap { margin-top: 14px; background: #0d1117; border: 1px solid #30363d; border-radius: 8px; padding: 10px 12px; }
.progress-top { display: flex; justify-content: space-between; font-size: 12px; color: #8b949e; margin-bottom: 6px; }
.progress { background: #21262d; border-radius: 6px; height: 8px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, #1f6feb, #58a6ff); width: 0; transition: width .3s; }

/* ===== 交易记录表 ===== */
.swaps { display: flex; flex-direction: column; gap: 2px; }
.swrow { display: grid; grid-template-columns: 64px 52px 1fr 1fr 48px; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid #1c2129; font-size: 13px; }
.swrow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swhead { color: #8b949e; font-size: 12px; border-bottom: 1px solid #30363d; }

/* ===== 内嵌的建池向导 ===== */
.create-frame { width: 100%; border: 0; min-height: 720px; display: block; background: transparent; }

@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .listctl { flex-wrap: wrap; }
  .swrow { grid-template-columns: 56px 44px 1fr 1fr 40px; font-size: 12px; }
}
