:root {
  color-scheme: dark;
  --bg: #080807;
  --panel: #11100d;
  --panel-soft: #19170f;
  --line: #342d17;
  --ink: #fff6d6;
  --muted: #b7aa7c;
  --accent: #f2c94c;
  --accent-strong: #ffd866;
  --good: #56d68a;
  --bad: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at 20% 0%, #201a0b 0, transparent 32rem), var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid #6d571b;
  background: var(--accent);
  color: #171104;
  border-radius: 7px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

input,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #0b0b09;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.05;
}

h2 {
  font-size: 21px;
  margin-bottom: 7px;
}

h3 {
  font-size: 15px;
  color: var(--accent);
  margin-bottom: 10px;
}

.network-pill {
  min-width: 170px;
  max-width: 360px;
  text-align: center;
  border: 1px solid var(--line);
  background: #0d0c09;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab {
  background: #0d0c09;
  color: var(--muted);
  border-color: var(--line);
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #171104;
}

.panel {
  display: none;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), #0b0b09);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

.panel.active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.section-head p {
  color: var(--muted);
  line-height: 1.55;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metrics div,
.wallet-status,
.book-list,
.link-card {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 8px;
}

.metrics div {
  padding: 14px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.metrics strong {
  display: block;
  overflow-wrap: anywhere;
}

.query-row {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 180px) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.output {
  margin: 0;
  min-height: 180px;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #050504;
  color: #f8e9a1;
  border-radius: 8px;
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.wallet-status {
  padding: 12px 14px;
  margin-bottom: 12px;
  color: var(--muted);
}

.wallet-status.connected {
  color: var(--good);
}

.wallet-list,
.link-grid,
.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.wallet-card,
.order-row {
  border: 1px solid var(--line);
  background: #0b0a08;
  border-radius: 8px;
  padding: 12px;
}

.wallet-card strong,
.wallet-card span,
.link-card strong,
.link-card span {
  display: block;
  overflow-wrap: anywhere;
}

.wallet-card span,
.link-card span {
  color: var(--muted);
  font-size: 12px;
  margin: 6px 0 10px;
}

.book-list {
  min-height: 150px;
  padding: 10px;
}

.order-row {
  display: grid;
  grid-template-columns: 64px 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.bid {
  color: var(--good);
}

.ask {
  color: var(--bad);
}

.link-card {
  display: block;
  padding: 13px;
  color: var(--ink);
  text-decoration: none;
}

.status-ok {
  color: var(--good);
}

.status-bad {
  color: var(--bad);
}

@media (max-width: 760px) {
  .topbar,
  .section-head {
    display: block;
  }

  .network-pill,
  .section-head button {
    margin-top: 12px;
  }

  .metrics,
  .wallet-list,
  .link-grid,
  .book-grid,
  .query-row {
    grid-template-columns: 1fr;
  }
}
