/* Bopwire explorer — dark, mint-lit, no framework.
 * Shares the player's design tokens (styles.css) but NOT its layout: the
 * player pins body to the viewport (overflow:hidden) for its panes; the
 * explorer is a normal scrolling document, so it carries its own sheet. */
:root {
  --bg:        #0c0d10;
  --bg-elev:   #15171c;
  --bg-elev2:  #1c1f26;
  --line:      #262a33;
  --text:      #e7e9ee;
  --text-dim:  #9aa0ab;
  --accent:    #6ee7b7;   /* mint — UI chrome, links, highlights          */
  --accent-2:  #38bdf8;   /* sky  — secondary chrome                      */
  --danger:    #f87171;
  --chip:      #20242c;
  --radius:    10px;
  /* Chart SERIES colors are darker steps of the brand hues — validated
   * (lightness band, chroma, CVD separation, contrast) against --bg-elev.
   * The bright accents above stay on text/chrome, never on data marks. */
  --s1:        #10a274;   /* series 1 (plays / primary magnitude)         */
  --s2:        #3086d6;   /* series 2 (mints)                             */
  --good:      #34d399;
  --warn:      #fbbf24;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex; flex-direction: column;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* ───────── Topbar (mirrors the player's) ───────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: var(--bg-elev); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .3px;
  color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-name { font-size: 16px; }
.brand-sub  { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }

.viewnav { display: inline-flex; background: var(--bg-elev2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; }
.vn-btn {
  border: 0; background: transparent; color: var(--text-dim);
  padding: 6px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 600;
  white-space: nowrap;
}
.vn-btn:hover { color: var(--text); text-decoration: none; }
.vn-btn[aria-selected="true"] { background: var(--accent); color: #06231a; }

.search { flex: 1 1 auto; max-width: 560px; position: relative; }
.search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; fill: var(--text-dim); pointer-events: none; }
.search input {
  width: 100%; padding: 8px 58px 8px 33px;   /* right gap clears the CMDS toggle */
  background: var(--bg-elev2); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px; outline: none; font: inherit;
}
.search input:focus { border-color: var(--accent-2); }

.player-link { color: var(--text-dim); font-size: 12px; font-weight: 700; letter-spacing: .04em;
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 9px; white-space: nowrap; }
.player-link:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ───────── Command help (under the search bar) ───────── */
.cmdhelp {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
  padding: 12px 14px; max-height: min(70vh, 560px); overflow-y: auto;
}
.cmdhelp[hidden] { display: none; }
.cmdhelp-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.cmdhelp-title { font-size: 11.5px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); }
.cmdhelp-hint { color: var(--text-dim); font-size: 12px; flex: 1 1 auto; }
.cmdhelp-close { background: none; border: 0; color: var(--text-dim); cursor: pointer;
  font: inherit; font-size: 12px; padding: 2px 6px; }
.cmdhelp-close:hover { color: var(--text); }
.cmd-group { margin: 10px 0 4px; }
.cmd-group-title { font-size: 12px; font-weight: 800; color: var(--text); margin-bottom: 5px;
  letter-spacing: .02em; }
.cmd-row { display: flex; gap: 12px; padding: 3px 0; align-items: baseline; cursor: pointer;
  border-radius: 6px; }
.cmd-row:hover { background: var(--bg-elev); }
.cmd-row code { color: var(--accent); white-space: nowrap; flex: 0 0 auto; min-width: 220px; }
.cmd-row .cmd-desc { color: var(--text-dim); font-size: 12.5px; }
.cmdhelp-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--text-dim); cursor: pointer;
  font: inherit; font-size: 11px; font-weight: 800; letter-spacing: .06em;
  padding: 3px 6px; border-radius: 6px;
}
.cmdhelp-toggle:hover { color: var(--accent); }

/* ───────── Main / cards ───────── */
.ex-main { flex: 1 1 auto; width: 100%; max-width: 1180px; margin: 0 auto;
  padding: 18px 18px 40px; }
.ex-loading { color: var(--text-dim); text-align: center; padding: 60px 0; }

.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }
.page-title { font-size: 21px; font-weight: 800; letter-spacing: .2px; }
.page-sub { color: var(--text-dim); font-size: 13px; }
.page-head .spacer { flex: 1 1 auto; }

.panel {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 16px;
}
.panel-title { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 10px; }
.panel-title .pt-note { text-transform: none; letter-spacing: 0; font-weight: 400; }

.note  { color: var(--text-dim); font-size: 12.5px; }
.mini  { font-size: 11.5px; color: var(--text-dim); }

/* "endpoint not live yet" and error panels */
.stub {
  border: 1px dashed var(--line); border-radius: 12px; padding: 18px;
  color: var(--text-dim); margin-bottom: 16px;
}
.stub b { color: var(--text); }
.stub code { color: var(--accent-2); }
.err-panel { border-color: rgba(248,113,113,.4); }
.err-panel b { color: var(--danger); }

/* ───────── Stat tiles ───────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px; margin-bottom: 16px; }
.tile { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; }
.tile .t-label { color: var(--text-dim); font-size: 11.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.tile .t-value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .t-sub { color: var(--text-dim); font-size: 11.5px; margin-top: 2px; }

/* ───────── Tables ───────── */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-elev); margin-bottom: 14px; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 560px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--bg-elev2); }
.tbl .num { text-align: right; }
.tbl .dim { color: var(--text-dim); }

/* ───────── Key/value grids (detail pages) ───────── */
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 0; }
.kv > div { padding: 7px 10px; border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.kv .k { color: var(--text-dim); font-size: 12.5px; padding-top: 9px; }
.kv .v { font-variant-numeric: tabular-nums; }

/* hash / address links with copy affordance */
.h-link { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.copy-btn { background: none; border: 0; padding: 1px 4px; margin-left: 4px; cursor: pointer;
  color: var(--text-dim); vertical-align: middle; border-radius: 4px; }
.copy-btn:hover { color: var(--accent); }
.copy-btn svg { width: 12px; height: 12px; fill: currentColor; display: block; }

/* ───────── Chips (tx types, roles) ───────── */
.chip {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; border-radius: 999px; padding: 2px 9px;
  background: var(--chip); color: var(--text-dim); border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.t-mint       { color: var(--accent);   border-color: rgba(110,231,183,.35); }
.chip.t-transfer   { color: var(--accent-2); border-color: rgba(56,189,248,.35); }
.chip.t-song       { color: #d8b4fe;         border-color: rgba(216,180,254,.35); }
.chip.t-nodeauth   { color: var(--warn);     border-color: rgba(251,191,36,.35); }
.chip.t-mod        { color: var(--danger);   border-color: rgba(248,113,113,.35); }
.chip.r-listener   { color: var(--accent); }
.chip.r-artist     { color: #d8b4fe; }
.chip.r-seeder     { color: var(--accent-2); }
.chip.r-relay      { color: var(--warn); }
.chip.r-sender, .chip.r-recipient { color: var(--text); }

/* ───────── Tx cards inside a block ───────── */
.txcard { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elev);
  margin-bottom: 12px; overflow: hidden; }
.txcard-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--bg-elev2); }
.txcard-head .h-link { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.txcard-body { padding: 4px 14px 10px; }
.txcard details { margin-top: 8px; }
.txcard summary, details.raw summary {
  cursor: pointer; color: var(--text-dim); font-size: 12px; font-weight: 700;
  letter-spacing: .04em; user-select: none; padding: 4px 0;
}
.txcard summary:hover, details.raw summary:hover { color: var(--accent); }
details.raw pre {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; overflow-x: auto; font-size: 11.5px; line-height: 1.5;
  color: var(--text-dim); margin: 6px 0 2px;
}
.outputs-list { margin: 4px 0 0; padding: 0; list-style: none; }
.outputs-list li { display: flex; gap: 10px; align-items: baseline; padding: 3px 0;
  flex-wrap: wrap; }

/* ───────── Pager ───────── */
.pager { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 6px 0 2px; }
.pager .pg-info { color: var(--text-dim); font-size: 12.5px; }
.btn {
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px; cursor: pointer;
  background: transparent; color: var(--text); font: inherit; font-weight: 600;
}
.btn:hover { border-color: var(--accent-2); color: var(--accent-2); text-decoration: none; }
.btn[disabled] { opacity: .4; cursor: default; }
.btn[disabled]:hover { border-color: var(--line); color: var(--text); }
.btn-solid { background: var(--accent); color: #06231a; border-color: var(--accent); font-weight: 800; }
.btn-solid:hover { color: #06231a; border-color: var(--accent); filter: brightness(1.08); }
.btn svg { width: 13px; height: 13px; fill: currentColor; vertical-align: -2px; margin-right: 5px; }

/* ───────── Charts ───────── */
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-wrap .grid line { stroke: var(--line); stroke-width: 1; }
.chart-wrap .axis text { fill: var(--text-dim); font-size: 10.5px; }
.chart-wrap .serie { fill: none; stroke-width: 2; }
.chart-wrap .dlabel { font-size: 11px; font-weight: 700; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
  white-space: nowrap; display: none;
}
.chart-tip .tt-date { color: var(--text-dim); font-size: 11px; margin-bottom: 2px; }
.chart-tip .tt-row { display: flex; align-items: center; gap: 6px; }
.chart-tip .tt-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend { display: flex; gap: 16px; align-items: center; margin: 2px 0 8px; flex-wrap: wrap; }
.legend .lg-item { display: flex; gap: 6px; align-items: center; color: var(--text-dim); font-size: 12px; }
.legend .lg-dot { width: 9px; height: 9px; border-radius: 50%; }

/* horizontal bar list */
.hbars { display: grid; grid-template-columns: minmax(90px, max-content) 1fr max-content;
  gap: 6px 12px; align-items: center; }
.hbars .hb-label { font-size: 12.5px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 220px; }
.hbars .hb-bar { height: 10px; border-radius: 4px; background: var(--s1); min-width: 2px; }
.hbars .hb-val { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.charts-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .charts-2col { grid-template-columns: 1fr; } }

/* ───────── Fingerprint / verify panel ───────── */
.verify-panel { border-color: rgba(110,231,183,.35); }
.verify-panel ol { margin: 8px 0 0; padding-left: 20px; color: var(--text-dim); }
.verify-panel li { margin: 4px 0; }
.hash-big {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; margin: 6px 0 10px;
  color: var(--accent);
}

/* ───────── Footer / toast ───────── */
.ex-foot { border-top: 1px solid var(--line); color: var(--text-dim); font-size: 12px;
  padding: 14px 18px 18px; text-align: center; }
.ex-foot code { color: var(--accent-2); }
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: var(--bg-elev2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); z-index: 50; max-width: 80vw;
}

/* focus rings: keyboard only */
.btn, .vn-btn, .copy-btn, .cmdhelp-toggle, .cmdhelp-close { -webkit-tap-highlight-color: transparent; }
:is(.btn, .vn-btn, .copy-btn, .cmdhelp-toggle, .cmdhelp-close):focus { outline: none; }
:is(.btn, .vn-btn, .copy-btn, .cmdhelp-toggle, .cmdhelp-close):focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 2px;
}

/* ───────── Responsive ───────── */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; }
  .search { order: 10; flex-basis: 100%; max-width: none; }
  .viewnav { order: 5; overflow-x: auto; max-width: 100%; }
}
@media (max-width: 640px) {
  .ex-main { padding: 12px 10px 32px; }
  .kv { grid-template-columns: 1fr; }
  .kv .k { border-bottom: 0; padding-bottom: 0; }
  .kv > div { padding: 6px 8px; }
  .cmd-row { flex-direction: column; gap: 1px; }
  .cmd-row code { min-width: 0; }
  .page-title { font-size: 18px; }
  .brand-sub { display: none; }
}
