:root {
  color-scheme: light;
  --paper: #fbfbf8;
  --ink: #15130f;
  --muted: #696760;
  --hair: #d6d2c8;
  --soft: #f0eee8;
  --white: #ffffff;
  --accent: #101010;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

main {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.masthead {
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: start;
  gap: 28px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--ink);
}

.mono,
.meta,
th,
.stats span,
.token-none,
.token-issued span {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

.mono {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.author-link {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.author-link img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--hair);
}

.author-link strong {
  color: var(--ink);
  font-weight: 800;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 2.8vw, 38px);
  line-height: 0.96;
  letter-spacing: 0;
  font-weight: 500;
}

.meta {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--ink);
}

.chart-panel {
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--ink);
}

.chart-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.chart-tabs button {
  height: 24px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.chart-tabs button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.bar-chart {
  --bar-count: 20;
  height: 256px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--bar-count), minmax(0, 1fr));
  align-items: end;
  gap: 3px;
  padding: 5px 0 0;
  overflow: visible;
  background: transparent;
}

.bar-item {
  position: relative;
  z-index: 2;
  height: 248px;
  min-width: 0;
  display: grid;
  grid-template-rows: 14px 1fr 70px;
  gap: 4px;
  align-items: end;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.bar-value {
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  text-align: center;
  white-space: nowrap;
}

.bar-track {
  height: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
}

.bar-fill {
  width: min(28px, 62%);
  display: block;
  border-radius: 2px 2px 0 0;
  background: var(--bar-color, var(--ink));
  box-shadow: inset 0 0 0 1px rgba(21, 19, 15, 0.1);
  transition: height 220ms ease;
}

.bar-label {
  width: 86px;
  align-self: start;
  justify-self: start;
  margin-left: 9px;
  margin-top: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  transform: rotate(-42deg);
  transform-origin: left top;
  color: #4e4b44;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.05;
  text-align: left;
}

.bar-label span {
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-label img {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex: 0 0 auto;
  object-fit: cover;
}

.stats article {
  min-height: 54px;
  padding: 9px 14px 8px 0;
  border-right: 1px solid var(--hair);
}

.stats article:last-child {
  border-right: 0;
  padding-right: 0;
  padding-left: 14px;
}

.stats article + article {
  padding-left: 14px;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.stats strong {
  display: block;
  margin-top: 6px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(20px, 1.9vw, 28px);
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.board {
  padding-top: 10px;
}

.board-head {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 500;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--ink);
  background: transparent;
}

.segmented button {
  width: 72px;
  height: 34px;
  border: 0;
  border-left: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.segmented button:first-child {
  border-left: 0;
}

.segmented button.active {
  background: var(--ink);
  color: var(--paper);
}

.table-wrap {
  margin-top: 4px;
  overflow-x: auto;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
  border-collapse: collapse;
}

.ranking-table .col-rank {
  width: 4%;
}

.ranking-table .col-dex {
  width: 17%;
}

.ranking-table .col-metric {
  width: 17%;
}

.ranking-table .col-pairs {
  width: 8%;
}

.ranking-table .col-token {
  width: 20%;
}

th,
td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--hair);
  text-align: left;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

th {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

td {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.46);
}

tbody tr:hover td {
  background: #f5fff9;
}

tbody tr {
  cursor: pointer;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.rank {
  color: var(--muted);
}

th:nth-child(1),
td:nth-child(1) {
  width: 4%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 17%;
}

th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5) {
  width: 17%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 8%;
}

th:nth-child(7),
td:nth-child(7) {
  width: 20%;
}

.dex {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dex img {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 5px;
  background: var(--soft);
  box-shadow:
    inset 0 0 0 1px var(--hair),
    0 1px 3px rgba(21, 19, 15, 0.08);
  object-fit: cover;
}

.dex > span {
  display: grid;
  min-width: 0;
}

.dex strong {
  display: block;
  max-width: 174px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.token-issued {
  display: inline-grid;
  gap: 2px;
}

.token-issued strong {
  font-size: 11px;
}

.token-issued span,
.token-none {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-panel {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end;
  background: rgba(21, 19, 15, 0.3);
}

.detail-panel[hidden] {
  display: none;
}

.detail-card {
  width: min(820px, 100%);
  max-height: 100vh;
  overflow: auto;
  padding: 28px;
  border-left: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: -18px 0 48px rgba(21, 19, 15, 0.16);
}

.site-notes {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  line-height: 1.55;
}

.site-notes p {
  margin: 0;
}

.site-notes a {
  color: var(--ink);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.community-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.community-line strong {
  color: var(--ink);
  font-weight: 800;
}

.tg-badge {
  width: 15px;
  height: 15px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #24a1de;
  color: #ffffff;
  flex: 0 0 auto;
}

.tg-badge svg {
  width: 10px;
  height: 10px;
  display: block;
  fill: currentColor;
}

.detail-close {
  float: right;
  width: 36px;
  height: 36px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  clear: both;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ink);
}

.detail-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.detail-title img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--soft);
  object-fit: cover;
}

.detail-title h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 44px;
  line-height: 1;
  font-weight: 500;
}

.detail-token {
  margin-top: 28px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  text-align: right;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--ink);
}

.detail-stats article {
  padding: 16px 14px 16px 0;
  border-right: 1px solid var(--hair);
}

.detail-stats article + article {
  padding-left: 14px;
}

.detail-stats article:last-child {
  border-right: 0;
}

.detail-stats span {
  display: block;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.detail-stats strong {
  display: block;
  margin-top: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.detail-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.detail-chart-head .mono {
  margin: 0;
}

.mini-segmented {
  display: inline-flex;
  border: 1px solid var(--ink);
}

.mini-segmented button {
  width: 48px;
  height: 26px;
  border: 0;
  border-left: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.mini-segmented button:first-child {
  border-left: 0;
}

.mini-segmented button.active {
  background: var(--ink);
  color: var(--paper);
}

.detail-performance {
  margin-top: 12px;
  border-top: 1px solid var(--ink);
  padding-top: 12px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend i {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 2px;
}

.performance-chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.performance-chart line {
  stroke: rgba(21, 19, 15, 0.18);
  stroke-width: 1;
}

.performance-chart .axis {
  stroke: var(--ink);
}

.performance-chart path {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.performance-chart text {
  fill: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.performance-chart .date-end {
  text-anchor: end;
}

.empty-chart {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.history-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  line-height: 1.45;
}

.detail-snapshots {
  margin-top: 12px;
  border-top: 1px solid var(--hair);
  padding-top: 10px;
}

.snapshot-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.snapshot-table {
  min-width: 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

.snapshot-table th,
.snapshot-table td {
  padding: 5px 6px;
  font-size: 9px;
}

.snapshot-table th:first-child,
.snapshot-table td:first-child {
  text-align: left;
}

@media (max-width: 760px) {
  main {
    width: calc(100% - 24px);
    padding-top: 18px;
  }

  .masthead {
    min-height: 140px;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  h1 {
    font-size: 42px;
  }

  .meta {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .chart-tabs {
    overflow-x: auto;
  }

  .chart-panel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .bar-chart {
    height: 240px;
    min-width: 910px;
    gap: 2px;
    padding-left: 0;
  }

  .bar-item {
    height: 232px;
    grid-template-rows: 13px 1fr 68px;
  }

  .bar-value {
    font-size: 7px;
  }

  .bar-label {
    width: 78px;
    margin-left: 6px;
    margin-top: 38px;
    font-size: 8px;
    transform: rotate(-42deg);
  }

  .bar-label span {
    max-width: 60px;
  }

  .bar-fill {
    width: min(18px, 58%);
  }

  .stats article,
  .stats article:last-child,
  .stats article + article {
    min-height: 84px;
    padding: 14px 12px 12px 0;
    border-right: 0;
    border-bottom: 1px solid var(--hair);
  }

  .stats article:nth-child(2n) {
    padding-left: 14px;
    border-left: 1px solid var(--hair);
  }

  .stats strong {
    margin-top: 12px;
    font-size: 30px;
  }

  .board-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-card {
    padding: 20px 12px;
    border-left: 0;
    border-top: 1px solid var(--ink);
  }

  .detail-top,
  .detail-stats {
    grid-template-columns: 1fr;
  }

  .detail-top {
    display: grid;
  }

  .detail-token {
    margin-top: 0;
    text-align: left;
  }

  .detail-stats {
    grid-template-columns: 1fr 1fr;
  }

  .detail-stats article:nth-child(2n) {
    border-right: 0;
  }

  .detail-chart-head {
    align-items: flex-start;
    flex-direction: column;
  }

  table {
    min-width: 860px;
  }

  th,
  td {
    padding: 6px 7px;
  }

  th:nth-child(2),
  td:nth-child(2) {
    width: 17%;
  }

  th:nth-child(3),
  td:nth-child(3),
  th:nth-child(4),
  td:nth-child(4),
  th:nth-child(5),
  td:nth-child(5) {
    width: 17%;
  }
}
