*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 10px 16px 28px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

/* ── Header ── */
.header {
  flex-shrink: 0;
  text-align: center;
}

.header-row {
  display: flex;
  justify-content: center;
  gap: 24px;
}

h1, h2 {
  margin: 2px 0;
  font-size: 18px;
}

.divider {
  border: none;
  border-top: 2px solid black;
  width: 90%;
  margin: 4px auto 0;
}

/* ── Three-column coin panels ── */
.coins-row {
  display: flex;
}

.section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 20px 0;
}

.col-divider {
  width: 1px;
  background: #ddd;
  align-self: stretch;
  flex-shrink: 0;
  margin: 8px 0 0;
}

.section-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 8px;
}

.stats {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 16px;
  width: 100%;
}

.stat-label {
  font-weight: bold;
  font-size: 15px;
  white-space: nowrap;
}

.stats > div:not(.stat-label) {
  font-size: 15px;
}

/* ── Wallet balances row ── */
.wallets-row {
  display: flex;
  border-top: 1px solid #ddd;
  padding-top: 4px;
}

.wallet-address {
  text-align: center;
  font-size: 15px;
  color: #000000;
  word-break: break-all;
  margin-bottom: 4px;
  width: 100%;
}

.stats-group-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 4px;
}


/* ── Chain Activity ── */
.chain-activity-row {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.chain-activity-box {
  flex: 1;
  border: 1px solid #bbb;
  border-radius: 6px;
  padding: 6px 14px 8px;
}

.section-sublabel {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #bbb;
  font-size: 12px;
}

.chain-activity-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px 10px;
}

.chain-activity-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.chain-rank {
  font-size: 12px;
  color: #aaa;
  min-width: 12px;
}

.chain-name {
  font-weight: 600;
  flex: 1;
}

.chain-fees {
  font-size: 13px;
  color: #555;
}

/* ── WAU / TXNS row — same proportions as bottom-row ── */
.info-row {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ── WAU box & TXNS box ── */
.wau-box {
  flex: 1;
  border: 1px solid #bbb;
  border-radius: 6px;
  padding: 6px 14px 8px;
  min-width: 0;
}

.wau-table {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 13px;
}

.wau-header,
.wau-row {
  display: grid;
  grid-template-columns: 1fr 60px 54px 54px 54px;
  align-items: center;
  gap: 2px;
}

.wau-header {
  font-size: 12px;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 3px;
  border-bottom: 1px solid #eee;
  margin-bottom: 2px;
}

.wau-chain-col {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: capitalize;
}

.wau-val-col {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

.wau-chg-col {
  text-align: right;
  white-space: nowrap;
}

.wau-up   { color: #1a7a1a; }
.wau-down { color: #a00;    }
.wau-na   { color: #bbb;    }

/* ── Trending Narratives — full-width row below WAU/TXNS ── */
.narratives-box {
  border: 1px solid #bbb;
  border-radius: 6px;
  padding: 6px 14px 8px;
  flex-shrink: 0;
}

.narratives-box .section-label span {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #bbb;
  font-size: 12px;
}

/* Two-column grid to fill the wider space now that it's a full-width row */
.narratives-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px 24px;
}

.narrative-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.narrative-term {
  font-size: 14px;
  font-weight: 600;
  text-transform: capitalize;
}

.narrative-count {
  font-size: 12px;
  color: #999;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 0 5px;
}

/* ── Bottom row: TVL + Fear & Greed ── */
.bottom-row {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ── DeFi TVL box ── */
.tvl-box {
  flex: 1;
  border: 1px solid #bbb;
  border-radius: 6px;
  padding: 8px 14px 10px;
}

.tvl-chains-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.tvl-chain-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.tvl-chain-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.tvl-chain-item > div:nth-child(2) {
  font-size: 14px;
}

.tvl-change {
  font-size: 13px;
}

.tvl-up   { color: #1a7a1a; }
.tvl-down { color: #a00; }

/* ── USD values ── */
.usd-value {
  font-size: 13px;
  color: #888;
}

/* ── Fear & Greed widget ── */
.fg-box {
  flex: 1;
  border: 1px solid #bbb;
  border-radius: 6px;
  padding: 6px 12px 8px;
  display: flex;
  flex-direction: column;
}

.fg-top {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}

.fg-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
}

.fg-label {
  font-size: 14px;
  color: #555;
}

/* ── Sparkline ── */
.fg-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  width: 100%;
}

.fg-spark-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.fg-spark-bar {
  width: 100%;
  background: #ccc;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
}

.fg-spark-today .fg-spark-bar {
  background: #000;
}

.fg-spark-val {
  font-size: 10px;
  color: #888;
  line-height: 1;
}

.fg-spark-today .fg-spark-val {
  color: #000;
  font-weight: 700;
}

.fg-spark-day {
  font-size: 10px;
  color: #aaa;
  line-height: 1;
}

.fg-spark-today .fg-spark-day {
  color: #000;
  font-weight: 700;
}

/* ── AI Activity page (x402) ── */
.ai-row {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.ai-box {
  flex: 1;
  min-width: 0;
  border: 1px solid #bbb;
  border-radius: 6px;
  padding: 6px 14px 8px;
}

.ai-spacer {
  flex: 1;
  min-width: 0;
}

.dune-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.dune-table thead tr {
  border-bottom: 1px solid #eee;
}

.dune-table th {
  font-size: 12px;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 8px 4px;
  text-align: left;
  white-space: nowrap;
}

.dune-table th.num {
  text-align: right;
}

.dune-table td {
  padding: 2px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dune-table td.num {
  text-align: right;
  font-weight: 600;
}

.dune-table tbody tr:nth-child(even) {
  background: #f8f8f8;
}

.dune-table tr.val-others td {
  color: #999;
  font-style: italic;
  border-top: 1px solid #eee;
}

.dune-table tr.val-total td {
  border-top: 2px solid #bbb;
  font-weight: 700;
}

/* ── Refresh timer ── */
.timer {
  position: fixed;
  bottom: 6px;
  right: 10px;
  font-size: 13px;
  opacity: 0.5;
}
