:root {
  --bg: #0a1120;
  --bg-soft: #0d1526;
  --bg-panel: #0f1a2e;
  --bg-elev: #13203a;
  --line: #1c2b47;
  --text: #dbe4f5;
  --text-dim: #8ea0bf;
  --text-faint: #5a6b8c;
  --accent: #ff8a1e;
  --accent-soft: rgba(255, 138, 30, 0.14);
  --green: #22c39a;
  --red: #ef5b6a;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.hidden { display: none !important; }

/* ---------------- topbar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 28px;
  background: rgba(10, 17, 32, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: flex; flex-direction: column; gap: 3px; width: 22px; }
.bm { height: 4px; border-radius: 2px; background: var(--accent); }
.bm.b2 { width: 70%; }
.bm.b3 { width: 40%; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: 0.3px; }

.mainnav { display: flex; gap: 24px; font-size: 15px; }
.navlink { color: var(--text-dim); transition: color 0.15s; }
.navlink:hover, .navlink.active { color: var(--text); }
.caret { font-size: 10px; }

.searchwrap {
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  width: 380px;
  gap: 8px;
}
.search-icon { color: var(--text-faint); font-size: 16px; }
#search { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 14px; }
#search::placeholder { color: var(--text-faint); }
.kbd {
  font-size: 11px;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  max-height: 420px;
  overflow-y: auto;
}
.sr-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(28, 43, 71, 0.5);
}
.sr-item:hover { background: var(--bg-panel); }
.sr-logo { width: 24px; height: 24px; border-radius: 50%; background: var(--line); }
.sr-name { font-weight: 600; }
.sr-sym { color: var(--text-dim); font-size: 12px; }
.sr-liq { margin-left: auto; color: var(--text-dim); font-family: var(--mono); font-size: 12px; }
.sr-empty { padding: 14px; color: var(--text-faint); text-align: center; }

/* ---------------- page ---------------- */
.page { max-width: 1440px; margin: 0 auto; padding: 20px 28px 80px; }

.banner {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(255, 138, 30, 0.06), rgba(255, 138, 30, 0.01));
  margin-bottom: 18px;
}
.banner-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
}
.banner-title { font-size: 16px; font-weight: 700; }
.banner-sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.banner-right {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* ---------------- token header ---------------- */
.token-head {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.tk-id { display: flex; align-items: center; gap: 12px; }
.tk-logo { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-elev); object-fit: cover; }
.tk-name-row { display: flex; align-items: baseline; gap: 8px; }
.tk-name { font-size: 20px; font-weight: 700; }
.tk-symbol { color: var(--text-dim); font-size: 14px; }
.tk-addr {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  cursor: pointer;
}
.tk-addr:hover { color: var(--accent); }

.tk-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-left: auto; }
.stat-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.6px; }
.stat-val { font-family: var(--mono); font-size: 15px; margin-top: 3px; }
.stat-val.up { color: var(--green); }
.stat-val.down { color: var(--red); }

/* ---------------- toolbar ---------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.tool-group {
  display: flex;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.tbtn {
  padding: 6px 12px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 13px;
  white-space: nowrap;
  transition: all 0.12s;
}
.tbtn:hover { color: var(--text); }
.tbtn.active { background: var(--bg-elev); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
#tf-group .tbtn.active { color: var(--accent); }
.tselect {
  background: var(--bg-soft);
  color: var(--text-dim);
  border: none;
  outline: none;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
}
.sep { width: 1px; height: 22px; background: var(--line); }
.tool-spacer { flex: 1; }
.depth-legend { display: flex; align-items: center; gap: 8px; color: var(--text-faint); font-size: 12px; }
.dl-swatch { width: 14px; height: 8px; border-radius: 2px; display: inline-block; }
.dl-swatch.ask { background: var(--accent); }
.dl-swatch.bid { background: #64748b; }

/* ---------------- chart ---------------- */
.chart-shell {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  overflow: hidden;
  height: 560px;
  margin-bottom: 22px;
}
.chart { position: absolute; inset: 0; }
.depth-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.watermark {
  position: absolute;
  top: 50%; left: 40%;
  transform: translate(-50%, -50%);
  font-size: 72px;
  font-weight: 800;
  color: rgba(142, 160, 191, 0.05);
  pointer-events: none;
  z-index: 1;
  letter-spacing: 2px;
}
.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  z-index: 5;
  background: rgba(13, 21, 38, 0.6);
}

/* ---------------- tabs ---------------- */
.tabs-shell {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  overflow: hidden;
}
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  padding: 14px 22px;
  color: var(--text-dim);
  font-size: 14px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.12s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-panels { min-height: 260px; }
.panel { display: none; padding: 18px 22px 26px; }
.panel.active { display: block; }
.panel-desc { color: var(--text-dim); font-size: 13px; margin-bottom: 14px; }

.dtable { width: 100%; border-collapse: collapse; }
.dtable th {
  text-align: left;
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.dtable td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(28, 43, 71, 0.45);
  font-family: var(--mono);
  font-size: 13px;
}
.dtable tr:hover td { background: rgba(19, 32, 58, 0.5); }
.dtable .cell-main { font-family: inherit; font-weight: 600; }
.dtable .empty { text-align: center; color: var(--text-faint); padding: 30px; font-family: inherit; }
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-family: -apple-system, sans-serif;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.pill.cl { border-color: rgba(255, 138, 30, 0.5); color: var(--accent); }
.side-buy { color: var(--green); }
.side-sell { color: var(--red); }
.txlink { color: var(--text-dim); }
.txlink:hover { color: var(--accent); }
.sharebar {
  display: inline-block;
  height: 6px;
  border-radius: 3px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 8px;
  opacity: 0.8;
}
.ratio-good { color: var(--green); }
.ratio-bad { color: var(--red); }

.empty-state { text-align: center; padding: 48px 20px; }
.es-icon { font-size: 34px; color: var(--text-faint); margin-bottom: 10px; }
.es-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.es-sub { color: var(--text-dim); font-size: 13px; max-width: 480px; margin: 0 auto; }

/* ---------------- LP sim ---------------- */
.lpsim { display: flex; gap: 40px; flex-wrap: wrap; }
.lp-form { display: flex; flex-direction: column; gap: 14px; min-width: 260px; }
.lp-form label { display: flex; flex-direction: column; gap: 6px; color: var(--text-dim); font-size: 12px; }
.lp-form input, .lp-form select {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
}
.lp-form input:focus, .lp-form select:focus { border-color: var(--accent); }
.lp-out { flex: 1; min-width: 300px; display: grid; grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 14px; align-content: start; }
.lp-metric {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.lp-metric .lm-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.6px; }
.lp-metric .lm-val { font-family: var(--mono); font-size: 18px; margin-top: 6px; }
.lp-metric .lm-val.accent { color: var(--accent); }

/* ---------------- wallet / stream / discover ---------------- */
.wallet-btn {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
  font-size: 13px;
}
.wallet-btn.connected { background: rgba(34, 195, 154, 0.12); border-color: var(--green); color: var(--green); font-family: var(--mono); }

.ws-pill {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}
.ws-pill.live { color: var(--green); border-color: rgba(34, 195, 154, 0.5); }
.ws-pill.poll { color: var(--accent); border-color: rgba(255, 138, 30, 0.5); }

.disc-head h1 { font-size: 24px; margin-bottom: 8px; }
.disc-head { margin-bottom: 20px; }
.disc-table tbody tr { cursor: pointer; }
.truth-badge {
  display: inline-block;
  min-width: 64px;
  text-align: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-family: var(--mono);
  font-weight: 700;
}
.truth-a { background: rgba(34, 195, 154, 0.15); color: var(--green); border: 1px solid rgba(34, 195, 154, 0.5); }
.truth-b { background: rgba(34, 195, 154, 0.08); color: #7ad9bd; border: 1px solid rgba(34, 195, 154, 0.3); }
.truth-c { background: rgba(255, 138, 30, 0.1); color: var(--accent); border: 1px solid rgba(255, 138, 30, 0.4); }
.truth-d, .truth-f { background: rgba(239, 91, 106, 0.1); color: var(--red); border: 1px solid rgba(239, 91, 106, 0.4); }
.disc-token { display: flex; align-items: center; gap: 10px; }
.disc-token img { width: 26px; height: 26px; border-radius: 50%; background: var(--line); }

/* ---------------- zap layer ---------------- */
.dl-zaphint { color: var(--accent); font-size: 12px; margin-left: 10px; }

.bin-tip {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  background: var(--bg-elev);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.bin-tip .bt-zap { color: var(--accent); }

.tab-zap { color: var(--accent); }

.zap-btn {
  background: var(--accent);
  color: #14100a;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 8px;
  transition: filter 0.12s;
}
.zap-btn:hover { filter: brightness(1.1); }
.zap-btn.wide { width: 100%; }
.zap-btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

.zap-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 360px;
  background: var(--bg-panel);
  border-left: 1px solid var(--accent);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.55);
  z-index: 100;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.zd-head { display: flex; align-items: center; justify-content: space-between; }
.zd-title { font-size: 17px; font-weight: 700; }
.zd-close { color: var(--text-dim); font-size: 16px; }
.zd-close:hover { color: var(--text); }

.zd-bin {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.zd-bin-side { font-size: 11px; letter-spacing: 1.2px; color: var(--accent); font-weight: 700; }
.zd-bin-side.bid { color: #94a3b8; }
.zd-bin-range { font-family: var(--mono); font-size: 16px; margin-top: 6px; }
.zd-bin-meta { color: var(--text-dim); font-size: 12px; margin-top: 6px; font-family: var(--mono); }

.zd-modes { display: flex; gap: 6px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.zd-modes .tbtn { flex: 1; font-size: 12px; }

.zd-amount { display: flex; flex-direction: column; gap: 6px; color: var(--text-dim); font-size: 12px; }
.zd-amount input,
.zd-amount select {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  outline: none;
}
.zd-amount select { cursor: pointer; -webkit-appearance: none; appearance: none; }
.zd-holding { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-dim); margin-top: -2px; }
.zd-holding.hidden { display: none; }
.zd-holding .k { font-family: var(--mono); }
.zd-max {
  background: transparent; border: 1px solid var(--accent); color: var(--accent);
  border-radius: 6px; padding: 2px 10px; font-size: 11px; font-weight: 700; cursor: pointer;
}
.zd-max:hover { background: var(--accent); color: #0a1120; }
.zd-pos-head { font-size: 12px; color: var(--text-dim); font-weight: 700; margin-bottom: 2px; }
.zd-pos { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: pointer; font-size: 12px; }
.zd-pos:hover { border-color: var(--accent); }
.zd-pos.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.zd-pos .zp-venue { font-weight: 700; color: var(--text); }
.zd-pos .zp-val { font-family: var(--mono); color: var(--accent); font-weight: 700; text-align: right; }
.zd-pos .zp-amt { grid-column: 1 / -1; font-family: var(--mono); color: var(--text-dim); }
.zd-pos-note { font-size: 11px; color: var(--text-dim); font-style: italic; margin-top: 2px; }
.zd-amount input:focus,
.zd-amount select:focus { border-color: var(--accent); }

.zd-result { display: flex; flex-direction: column; gap: 8px; }
.zd-row {
  display: flex; justify-content: space-between;
  font-size: 13px; padding: 8px 10px;
  background: var(--bg-elev); border-radius: 8px;
}
.zd-row .k { color: var(--text-dim); }
.zd-row .v { font-family: var(--mono); }
.zd-row .v.accent { color: var(--accent); }
.zd-router {
  font-size: 11px; color: var(--text-faint);
  font-family: var(--mono);
  padding: 6px 2px;
}
.zd-router.live { color: var(--green); }
.zd-foot { margin-top: auto; color: var(--text-faint); font-size: 11px; text-align: center; }

/* x-ray */
.xray-controls { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; }
.xray-controls label { display: flex; flex-direction: column; gap: 6px; color: var(--text-dim); font-size: 12px; }
.xray-controls input {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; color: var(--text); font-family: var(--mono); font-size: 14px; outline: none;
  width: 180px;
}
.xray-summary { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.xray-card {
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px; min-width: 190px;
}
.xray-card.danger { border-color: rgba(239, 91, 106, 0.6); }
.xray-card.good { border-color: rgba(34, 195, 154, 0.6); }
.xray-card .xc-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.6px; }
.xray-card .xc-val { font-family: var(--mono); font-size: 20px; margin-top: 6px; }
.xray-card .xc-val.red { color: var(--red); }
.xray-card .xc-val.green { color: var(--green); }
.xray-card .xc-val.accent { color: var(--accent); }

/* rules */
.rule-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.rule-form select, .rule-form input {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; color: var(--text); font-size: 13px; outline: none;
}
.rule-form input { font-family: var(--mono); width: 160px; }
.rule-status-armed { color: var(--green); }
.rule-status-tripped { color: var(--red); font-weight: 700; }
.rule-alert {
  margin-top: 16px;
  border: 1px solid var(--red);
  background: rgba(239, 91, 106, 0.08);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.rule-alert .ra-msg { flex: 1; font-size: 13px; }
.rule-del { color: var(--text-faint); }
.rule-del:hover { color: var(--red); }

@media (max-width: 1000px) {
  .mainnav { display: none; }
  .searchwrap { width: auto; flex: 1; }
  .tk-stats { margin-left: 0; }
  .zap-drawer { width: 100%; }
}
