/* finesse · register=product · shell=wallet-matrix+fixed-mobile-tabbar · A=mono+muted-phosphor · B=mono-forward · C=bottom-fixed-50-50-tabs · D=instant-view-transition · E=low-glare-crt · SOUL=7 SPECTACLE=2 DENSITY=10 */
:root {
  --page: #060a08;
  --page-raised: #090e0b;
  --panel: #0c130e;
  --panel-strong: #111b14;
  --accent: #86ad6a;
  --accent-strong: #accb99;
  --text: #c2d1bb;
  --text-soft: #8fa488;
  --text-faint: #748a70;
  --danger: #d58b7e;
  --accent-rgb: 134 173 106;
  --page-rgb: 6 10 8;
  --danger-rgb: 213 139 126;
  --transparent: rgb(var(--page-rgb) / 0);
  --border: rgb(var(--accent-rgb) / 0.12);
  --border-strong: rgb(var(--accent-rgb) / 0.24);
  --surface-hover: rgb(var(--accent-rgb) / 0.045);
  --surface-active: rgb(var(--accent-rgb) / 0.085);
  --focus-ring: rgb(var(--accent-rgb) / 0.68);
  --scanline: rgb(var(--accent-rgb) / 0.009);
  --shadow: rgb(var(--page-rgb) / 0.62);
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --max-width: 1880px;
  --radius: 2px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: clip;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, rgb(var(--accent-rgb) / 0.018), var(--transparent) 42rem),
    var(--page);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(
    to bottom,
    var(--transparent) 0,
    var(--transparent) 3px,
    var(--scanline) 3px,
    var(--scanline) 4px
  );
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--page);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  width: min(100%, var(--max-width));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 16px 16px;
}

main {
  padding-top: 10px;
}

.mobile-view-switch,
.mobile-pagination {
  display: none;
}

h2,
p {
  margin-top: 0;
}

.aggregate-panel,
.feed-panel {
  border: 1px solid var(--border-strong);
  background: var(--panel);
  box-shadow: 0 20px 60px var(--shadow);
}

.aggregate-panel {
  margin-bottom: 10px;
}

.aggregate-toolbar,
.feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  gap: 12px;
  padding: 4px 10px 4px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-strong);
}

.aggregate-toolbar {
  min-height: 52px;
}

.feed-heading {
  display: flex;
  align-items: baseline;
  min-width: max-content;
  gap: 9px;
}

.prompt {
  color: var(--accent);
  font-weight: 800;
}

.feed-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.toolbar-note {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.06em;
}

a:focus-visible,
.table-wrap:focus-visible,
.aggregate-table-wrap:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.aggregate-meta,
.feed-meta,
.feed-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-faint);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.aggregate-meta,
.feed-meta {
  min-height: 28px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}

.aggregate-table-wrap {
  overflow: auto;
  scrollbar-color: var(--border-strong) var(--page-raised);
  scrollbar-width: thin;
}

.table-wrap {
  max-height: calc(100vh - 250px);
  min-height: 320px;
  overflow: auto;
  scrollbar-color: var(--border-strong) var(--page-raised);
  scrollbar-width: thin;
}

table {
  width: 100%;
  min-width: 1260px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.aggregate-table {
  min-width: 1120px;
  table-layout: fixed;
}

.aggregate-table th:first-child,
.aggregate-table td:first-child {
  width: 160px;
}

#aggregate-summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

thead {
  background: var(--page-raised);
}

th,
td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  height: 34px;
  background: var(--page-raised);
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.09em;
}

th.numeric,
td.numeric {
  text-align: right;
}

tbody tr {
  background: var(--panel);
  transition: background 160ms ease;
}

tbody tr:hover {
  background: var(--surface-hover);
}

tbody tr.is-new {
  animation: row-receive 1.4s ease-out;
}

.time-value,
.tx-link,
.wallet-link,
.slot-link,
.size-value,
.profit-native {
  color: var(--text);
}

.time-value,
.tx-link,
.wallet-link,
.slot-link {
  font-size: 11px;
}

.tx-link,
.wallet-link,
.slot-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.tx-link:hover,
.wallet-link:hover,
.slot-link:hover {
  color: var(--accent);
}

.size-value {
  font-size: 11px;
  font-weight: 600;
}

.size-arrow {
  margin: 0 5px;
  color: var(--accent);
}

.base-badge,
.mint-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--accent-strong);
  font-size: 9px;
  line-height: 1;
}

.base-badge {
  min-width: 44px;
  padding: 0 5px;
  background: var(--surface-active);
  font-weight: 700;
}

.mints-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.mint-chip {
  padding: 0 5px;
  color: var(--text-soft);
}

.mints-empty {
  color: var(--text-faint);
  font-size: 10px;
}

.profit-native {
  display: block;
  font-size: 11px;
  font-weight: 600;
}

.profit-usd {
  display: block;
  margin-top: 0;
  color: var(--text-faint);
  font-size: 9px;
}

.mobile-tx-summary {
  display: none;
}

.metric-primary,
.metric-secondary {
  display: block;
}

.metric-primary {
  color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.metric-secondary {
  margin-top: 0;
  color: var(--text-faint);
  font-size: 8px;
}

.aggregate-metric.positive .metric-primary,
.aggregate-metric.positive .metric-secondary {
  color: var(--accent);
}

.aggregate-metric.negative .metric-primary,
.aggregate-metric.negative .metric-secondary {
  color: var(--danger);
}

.aggregate-total {
  background: var(--surface-active);
}

.aggregate-total td {
  border-top: 1px solid var(--border-strong);
  border-bottom: 0;
}

.aggregate-total:hover {
  background: var(--surface-active);
}

.total-label {
  color: var(--accent);
  font-weight: 750;
}

.total-scope {
  color: var(--text-soft);
  font-size: 10px;
}

.aggregate-table .loading-row td,
.aggregate-table .empty-row td {
  height: 90px;
}

.profit.positive .profit-native,
.profit.positive .profit-usd {
  color: var(--accent);
}

.profit.negative .profit-native,
.profit.negative .profit-usd {
  color: var(--danger);
}

.loading-row td,
.empty-row td {
  height: 140px;
  color: var(--text-faint);
  text-align: center;
}

.loading-row span:first-child {
  color: var(--accent);
}

.loading-dots {
  display: inline-block;
  width: 28px;
  overflow: hidden;
  vertical-align: bottom;
  animation: load-dots 1.1s steps(4, end) infinite;
}

.feed-footer {
  min-height: 32px;
  padding: 0 12px;
  border-top: 1px solid var(--border);
  background: var(--page-raised);
}

.feed-footer strong {
  color: var(--text-soft);
  font-weight: 600;
}

@keyframes row-receive {
  0% { background: var(--surface-active); box-shadow: inset 3px 0 var(--accent); }
  100% { background: var(--panel); box-shadow: inset 3px 0 var(--transparent); }
}

@keyframes load-dots {
  from { width: 0; }
  to { width: 28px; }
}

@media (max-width: 1120px) {
  .table-wrap {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .shell {
    padding-inline: 10px;
  }

  main {
    padding-top: 10px;
  }

  .aggregate-toolbar,
  .feed-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding-block: 8px;
  }

  .aggregate-meta,
  .feed-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
    padding-block: 6px;
  }

  .aggregate-table-wrap,
  .table-wrap {
    min-height: 0;
    overflow: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  table {
    min-width: 0;
  }

  .aggregate-table {
    min-width: 0;
  }

  thead {
    position: static;
  }

  thead tr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  tbody {
    display: grid;
    gap: 6px;
    padding: 6px;
  }

  tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--border);
    background: var(--page-raised);
  }

  td,
  td.numeric {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: center;
    min-height: 44px;
    padding: 6px 8px;
    border-right: 1px solid var(--border);
    text-align: left;
    white-space: normal;
  }

  td:nth-child(even) {
    border-right: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--text-faint);
    font-size: 9px;
    letter-spacing: 0.06em;
  }

  td > .profit-usd,
  td > .metric-secondary {
    grid-column: 2;
  }

  td[data-label="TX"],
  td[data-label="TIME"],
  td[data-label="SIZE"],
  td[data-label="MINTS"] {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .loading-row,
  .empty-row {
    display: block;
  }

  .loading-row td,
  .empty-row td {
    display: block;
    height: auto;
    min-height: 120px;
    padding-top: 48px;
    border-right: 0;
  }

  .loading-row td::before,
  .empty-row td::before {
    content: none;
  }

  .feed-footer {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    min-height: 32px;
    padding-block: 0;
  }

  .feed-hint {
    display: none;
  }
}

@media (max-width: 768px) {
  .shell {
    padding: 0 8px calc(56px + env(safe-area-inset-bottom));
  }

  main {
    padding-top: 6px;
  }

  .mobile-view-switch {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: auto;
    gap: 0;
    margin: 0;
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-strong);
    background: var(--page);
    box-shadow: 0 -12px 30px var(--shadow);
  }

  .mobile-view {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0 5px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--page-raised);
    color: var(--text-faint);
    cursor: pointer;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }

  .mobile-view.is-active {
    border-color: var(--accent);
    background: var(--surface-active);
    color: var(--accent-strong);
  }

  .mobile-view:focus-visible,
  .mobile-pagination button:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
  }

  .aggregate-panel,
  .feed-panel {
    display: none;
  }

  body[data-mobile-view="breakdown"] .aggregate-panel,
  body[data-mobile-view="live"] .feed-panel {
    display: block;
  }

  .aggregate-panel,
  .feed-panel {
    margin: 0;
    box-shadow: none;
  }

  .aggregate-toolbar,
  .feed-toolbar {
    align-items: center;
    flex-direction: row;
    min-height: 44px;
    gap: 6px;
    padding: 3px 7px;
  }

  .feed-heading {
    min-width: 0;
  }

  .feed-heading h2 {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .toolbar-note,
  .aggregate-meta span:last-child,
  #last-update {
    display: none;
  }

  .aggregate-meta,
  .feed-meta {
    align-items: center;
    flex-direction: row;
    min-height: 28px;
    padding: 0 7px;
  }

  .aggregate-table-wrap,
  .table-wrap {
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  table,
  .aggregate-table {
    min-width: 0;
  }

  tbody {
    gap: 4px;
    padding: 4px;
  }

  tbody tr,
  .aggregate-table tbody tr,
  #arb-table tbody tr {
    border: 1px solid var(--border);
    background: var(--page-raised);
  }

  .aggregate-table tbody tr {
    grid-template-areas:
      "wallet wallet wallet wallet"
      "today-hits today-net prev-hits prev-net"
      "hits-1h net-1h hits-24h net-24h";
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #arb-table tbody {
    gap: 4px;
    padding: 4px;
  }

  #arb-table tbody tr:not(.loading-row):not(.empty-row) {
    display: block;
    border-color: var(--border-strong);
    background: var(--panel);
  }

  td,
  td.numeric,
  td[data-label="TX"],
  td[data-label="TIME"],
  td[data-label="SIZE"],
  td[data-label="MINTS"] {
    display: block;
    min-width: 0;
    min-height: 44px;
    padding: 4px 6px;
    overflow: hidden;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  td::before {
    display: block;
    margin-bottom: 1px;
    font-size: 7px;
    line-height: 1.1;
    letter-spacing: 0.06em;
  }

  td > .profit-usd,
  td > .metric-secondary {
    grid-column: auto;
  }

  .aggregate-table td[data-label="WALLET"] { grid-area: wallet; }
  .aggregate-table td[data-label="TODAY HITS"] { grid-area: today-hits; }
  .aggregate-table td[data-label="TODAY NET"] { grid-area: today-net; }
  .aggregate-table td[data-label="PREV HITS"] { grid-area: prev-hits; }
  .aggregate-table td[data-label="PREV NET"] { grid-area: prev-net; }
  .aggregate-table td[data-label="HITS 1H"] { grid-area: hits-1h; }
  .aggregate-table td[data-label="NET 1H"] { grid-area: net-1h; }
  .aggregate-table td[data-label="HITS 24H"] { grid-area: hits-24h; }
  .aggregate-table td[data-label="NET 24H"] { grid-area: net-24h; }

  .aggregate-table td[data-label="HITS 1H"],
  .aggregate-table td[data-label="NET 1H"],
  .aggregate-table td[data-label="HITS 24H"],
  .aggregate-table td[data-label="NET 24H"] {
    border-bottom: 0;
  }

  .aggregate-table td[data-label="WALLET"],
  .aggregate-table td[data-label="PREV NET"],
  .aggregate-table td[data-label="NET 24H"] {
    border-right: 0;
  }

  .aggregate-table td[data-label="TODAY NET"],
  .aggregate-table td[data-label="PREV NET"],
  .aggregate-table td[data-label="NET 1H"],
  .aggregate-table td[data-label="NET 24H"] {
    background: var(--surface-active);
  }

  .aggregate-table td.numeric {
    text-align: right;
  }

  .aggregate-table td.numeric::before {
    text-align: left;
  }

  .metric-primary {
    max-width: 100%;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .aggregate-table .wallet-link {
    display: flex;
    min-height: 44px;
    padding-top: 10px;
  }

  .aggregate-table td[data-label="WALLET"] {
    position: relative;
    padding-block: 0;
  }

  .aggregate-table td[data-label="WALLET"]::before {
    position: absolute;
    top: 4px;
    left: 6px;
  }

  .profit-usd,
  .metric-secondary {
    overflow: hidden;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #arb-table tbody tr:not(.loading-row):not(.empty-row) > td:not(.mobile-tx-summary) {
    display: none;
  }

  #arb-table td.mobile-tx-summary {
    display: block;
    min-height: 0;
    padding: 4px 6px;
    overflow: hidden;
    border: 0;
    white-space: nowrap;
  }

  #arb-table td.mobile-tx-summary::before {
    content: none;
  }

  .mobile-tx-line {
    display: grid;
    align-items: center;
    min-width: 0;
    gap: 8px;
    font-size: clamp(8px, 2.4vw, 9px);
    line-height: 1.35;
  }

  .mobile-tx-primary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .mobile-tx-secondary {
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: 3px;
    padding-top: 3px;
    border-top: 1px solid var(--border);
  }

  .mobile-tx-line > * {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-tx-time,
  .mobile-tx-size,
  .mobile-tx-metric {
    color: var(--text);
    font-variant-numeric: tabular-nums;
  }

  .mobile-tx-link {
    color: var(--text-soft);
    text-decoration-color: var(--border-strong);
    text-underline-offset: 2px;
  }

  .mobile-tx-link:hover,
  .mobile-tx-link:focus-visible {
    color: var(--accent-strong);
  }

  .mobile-tx-base {
    color: var(--accent-strong);
    font-weight: 750;
  }

  .mobile-tx-size {
    font-weight: 650;
  }

  .mobile-tx-metric {
    text-align: right;
  }

  .mobile-tx-financials {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    min-width: 0;
  }

  .mobile-tx-key {
    margin-right: 0;
    color: var(--text-faint);
  }

  .mobile-tx-metric.positive,
  .mobile-tx-metric.positive .mobile-tx-key {
    color: var(--accent);
  }

  .mobile-tx-metric.negative,
  .mobile-tx-metric.negative .mobile-tx-key {
    color: var(--danger);
  }

  .mobile-tx-route {
    color: var(--text-faint);
    text-align: right;
  }

  .loading-row td,
  .empty-row td {
    min-height: 100px;
    padding-top: 40px;
    border: 0;
  }

  .feed-footer {
    display: grid;
    grid-template-columns: auto auto;
    min-height: 0;
    gap: 2px 10px;
    padding: 4px 7px 6px;
  }

  .mobile-pagination {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 5px;
    margin-top: 2px;
  }

  .mobile-pagination button {
    min-width: 0;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--page-raised);
    color: var(--text-soft);
    cursor: pointer;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
  }

  .mobile-pagination button:disabled {
    opacity: 0.38;
    cursor: not-allowed;
  }

  #mobile-page {
    min-width: 48px;
    color: var(--text-soft);
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
