:root {
  --background: #ffffff;
  --surface: #f7f7f8;
  --text: #16181d;
  --muted: #666b75;
  --border: #d9dce1;
  --accent: #1769e0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: var(--accent); }

:focus-visible {
  outline: 3px solid rgb(23 105 224 / 30%);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.header {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 28px;
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.15;
  text-wrap: balance;
}

.header p, .table-header p, footer p { margin: 0; color: var(--muted); text-wrap: pretty; }
.updated { flex: none; padding-top: 8px; font-size: 12px; }

.filters {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(140px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.filters label { display: grid; gap: 5px; min-width: 0; }
.filters label span { color: var(--muted); font-size: 12px; font-weight: 600; }

input, select, .filters button, .empty button {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: white;
  color: var(--text);
}

input, select { width: 100%; padding: 8px 10px; }
.filters button, .empty button { padding: 8px 16px; }
.filters button:hover, .empty button:hover { border-color: var(--accent); color: var(--accent); }

.table-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0 10px;
  font-size: 12px;
}

.table-header strong { color: var(--text); font-variant-numeric: tabular-nums; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
}

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

th:nth-child(1) { width: 40px; }
th:nth-child(2) { width: 150px; }
th:nth-child(3) { width: 90px; }
th:nth-child(4) { width: 110px; }
th:nth-child(5) { width: 170px; }
th:nth-child(6) { width: 105px; }
th:nth-child(7) { width: 300px; }
th:nth-child(8) { width: 72px; }

th, td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.loading-row { padding: 28px 12px; color: var(--muted); text-align: center; }

.rank, .volume { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank { color: var(--muted); }
.token-symbol { display: block; font-weight: 700; }
.token-name { display: block; max-width: 180px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.chain { white-space: nowrap; }
.meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.launchpad-link { color: var(--text); text-decoration-color: var(--border); text-underline-offset: 3px; }
.contract-link { display: block; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }

.copy-button {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: white;
  color: var(--text);
}

.copy-button:hover { border-color: var(--accent); color: var(--accent); }

.empty { padding: 48px 16px; text-align: center; }
.empty p { margin: 0 0 12px; color: var(--muted); }

footer { padding: 18px 0 0; font-size: 12px; }

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 10;
  margin: 0;
  padding: 10px 12px;
  border-radius: 5px;
  background: var(--text);
  color: white;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
}

.toast.visible { opacity: 1; }
.copy-proxy { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@media (max-width: 820px) {
  .page { width: min(100% - 24px, 1180px); padding-top: 28px; }
  .header { display: block; margin-bottom: 20px; }
  .updated { margin-top: 8px !important; padding: 0; }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .filters button { grid-column: 1 / -1; }
  .table-header { display: block; }
  .table-header p + p { margin-top: 4px; }
}

@media (max-width: 480px) {
  .filters { grid-template-columns: 1fr; }
  .search-field, .filters button { grid-column: auto; }
  table { min-width: 0; }
  th:nth-child(1), td:nth-child(1),
  th:nth-child(3), td:nth-child(3),
  th:nth-child(5), td:nth-child(5),
  th:nth-child(6), td:nth-child(6) { display: none; }
  th:nth-child(2) { width: 92px; }
  th:nth-child(4) { width: 76px; }
  th:nth-child(7) { width: 142px; }
  th:nth-child(8) { width: 58px; }
  th { font-size: 11px; }
  th, td { padding: 10px 8px; }
  .contract-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .copy-button { width: 100%; padding-inline: 4px; }
}
