/* --- Design tokens --- */
:root {
  --bg: #07080d;
  --panel: rgba(16, 18, 27, 0.88);
  --line: rgba(255, 255, 255, 0.08);
  --text: #eceef4;
  --muted: #8d93a6;
  --accent: #5ee9b5;
  --accent-dim: rgba(94, 233, 181, 0.12);
  --danger: #ff8fa3;
  --sans: "Space Grotesk", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --content-max: 72rem;
  --gutter: clamp(1rem, 3vw, 1.5rem);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
}

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

html {
  color-scheme: dark;
  accent-color: var(--accent);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  font-size: clamp(0.94rem, 0.9rem + 0.15vw, 1rem);
  line-height: 1.5;
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(94, 233, 181, 0.09), transparent 55%),
    radial-gradient(720px 380px at 100% 0%, rgba(96, 140, 255, 0.08), transparent 50%),
    var(--bg);
}

::selection {
  background: rgba(94, 233, 181, 0.28);
}

a {
  color: var(--accent);
}

/* --- Layout shell --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
  background: rgba(7, 8, 13, 0.78);
  border-bottom: 1px solid var(--line);
}

.site-bar {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.875rem var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 1.75rem) var(--gutter) clamp(3rem, 8vw, 4.5rem);
}

/* --- Header / nav --- */
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
  flex-shrink: 0;
}

.brand img,
.logo {
  height: 52px;
  width: auto;
  display: block;
}

.logo {
  height: auto;
  width: min(100%, 360px);
  margin-bottom: 4px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.site-nav a.active {
  color: #062117;
  background: var(--accent);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.92rem;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-dropdown.active .nav-dropdown-toggle {
  color: #062117;
  background: var(--accent);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 12rem;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  z-index: 20;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-dropdown-menu a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.tool-disclaimer {
  max-width: 52rem;
  margin-bottom: 1.25rem;
}

.volume-track-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.volume-track-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 28rem);
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.volume-track-label {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.volume-track-meta .volume-track-ca {
  margin: 0 0 0.35rem;
}

.volume-track-since {
  margin: 0;
  font-size: 0.85rem;
}

.volume-spark-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--accent);
}

.volume-sparkline {
  width: 100%;
  height: 3rem;
  color: var(--accent);
}

.volume-spark-legend {
  font-size: 0.75rem;
}

@media (max-width: 720px) {
  .volume-track-row {
    grid-template-columns: 1fr;
  }
}

.site-nav a.quiet {
  color: #6d7384;
}

/* --- Typography --- */
.page-title {
  font-size: clamp(1.45rem, 1.2rem + 1.2vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  margin: 0.25rem 0 0.5rem;
}

.section-title {
  margin: 2rem 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  color: var(--muted);
  max-width: 68ch;
  line-height: 1.55;
  margin: 0 0 1.25rem;
}

.count {
  margin-left: 0.5rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  vertical-align: 2px;
}

.count[hidden] {
  display: none;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.65rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(94, 233, 181, 0.35);
  background: var(--accent-dim);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  vertical-align: middle;
}

.live-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(94, 233, 181, 0.55);
  animation: live-pulse 2s ease infinite;
}

@keyframes live-pulse {
  70% {
    box-shadow: 0 0 0 6px rgba(94, 233, 181, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(94, 233, 181, 0);
  }
}

.mentions-table tr.row-new td {
  animation: row-highlight 2.4s ease;
}

@keyframes row-highlight {
  0% {
    background: rgba(94, 233, 181, 0.16);
  }
  100% {
    background: transparent;
  }
}

[hidden] {
  display: none !important;
}

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

code,
.mono {
  font-family: var(--mono);
  font-size: 0.78rem;
}

/* --- Panels & forms --- */
.panel,
form.filters,
form.chat-form,
.answer,
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

form.filters,
form.chat-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1.125rem;
  padding: 0.875rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

label.check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.625rem;
  letter-spacing: 0;
  font-size: 0.92rem;
  color: var(--text);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  color: var(--text);
  background: #0b0d14;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.75rem;
  min-width: 0;
}

textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(94, 233, 181, 0.55);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

::placeholder {
  color: #6a7082;
}

button {
  background: var(--accent);
  color: #062117;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.06);
}

.field-grow {
  flex: 1 1 17.5rem;
}

.field-wide {
  flex: 1 1 100%;
}

/* --- Tables --- */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

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

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

th {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.mentions-table {
  table-layout: fixed;
  font-size: 0.78rem;
}

.mentions-table th,
.mentions-table td {
  padding: 12px 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
}

.mentions-table col.col-time {
  width: 8.25rem;
}

.mentions-table col.col-chat {
  width: 16%;
}

.mentions-table col.col-token {
  width: 36%;
}

.mentions-table col.col-sender {
  width: 14%;
}

.mentions-table.feed-table col.col-chat {
  width: 18%;
}

.mentions-table.feed-table col.col-sender {
  width: 16%;
}

.mentions-table.feed-table col.col-text {
  width: 66%;
}

.feed-table .col-sender .sender-label {
  word-break: break-word;
}

.mentions-table col.col-text {
  width: auto;
}

.summaries-table col.col-meta {
  width: 14%;
}

.summary-extractions {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.summary-extractions-label {
  font-weight: 500;
  color: var(--text);
}

.summaries-table .model-tag {
  font-size: 0.72rem;
  word-break: break-word;
}

.mentions-table .col-chat,
.mentions-table .col-token,
.mentions-table .col-text {
  font-size: inherit;
}

.table-wrap td code {
  white-space: normal;
  word-break: break-all;
}

.contract-row {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.contract-row:last-child {
  margin-bottom: 0;
}

.contract-row .contract-link {
  flex: 1;
  min-width: 0;
}

.copy-contract {
  flex-shrink: 0;
  margin-top: 1px;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.copy-contract:hover {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(94, 233, 181, 0.35);
  filter: none;
}

.copy-contract.copied {
  color: var(--accent);
  border-color: rgba(94, 233, 181, 0.45);
}

.copy-icon {
  display: block;
}

.addr-hero .contract-row {
  margin-bottom: 0;
  align-items: center;
}

.mentions-table .col-token .contract-ca {
  display: block;
  font-family: var(--mono);
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.mentions-table .col-token code:not(.contract-ca) {
  white-space: normal;
  word-break: break-all;
}

td a {
  color: #9cf6d2;
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

.mentions-table td.col-time,
.mentions-table th.col-time {
  width: 8.25rem;
  max-width: 8.25rem;
  min-width: 8.25rem;
  padding: 10px 6px 10px 8px;
  font-size: 0.68rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
  color: var(--muted);
  vertical-align: top;
}

.mentions-table .col-text {
  color: #c6cad6;
  width: 100%;
}

/* --- Snippet expand --- */

.snippet-box {
  margin: 0;
}

.snippet-head {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.snippet-preview {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.snippet-toggle {
  flex-shrink: 0;
  margin-top: 2px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.snippet-toggle:hover {
  background: var(--accent-dim);
  border-color: rgba(94, 233, 181, 0.35);
  filter: none;
}

.snippet-chevron {
  display: block;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  margin-top: -3px;
  transition: transform 0.15s ease;
}

.snippet-toggle[aria-expanded="true"] .snippet-chevron {
  transform: rotate(45deg);
  margin-top: 3px;
}

.snippet-full {
  margin-top: 0.625rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
}

/* --- Tags & token column --- */
.user-count {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.user-names {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.users-single .user-count {
  color: var(--danger);
  font-weight: 600;
}

.users-single .user-names {
  color: #ffb3c0;
}

.ticker {
  display: inline-block;
  margin-top: 0.375rem;
  font-family: var(--mono);
  font-size: inherit;
  color: var(--accent);
}

.mentions-table code {
  font-size: inherit;
}

.ticker-chat {
  color: var(--muted);
}

.market-line {
  display: inline-block;
  margin-top: 0.25rem;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.market-line.is-stale {
  opacity: 0.7;
}

.market-links {
  display: inline-flex;
  gap: 0.5rem;
  margin-left: 0.5rem;
  font-size: 0.82rem;
}

.ext-link {
  color: var(--accent);
  text-decoration: none;
}

.ext-link:hover {
  text-decoration: underline;
}

.market-title {
  margin: 0 0 0.5rem;
  word-break: normal;
}

.market-title .ticker {
  margin-top: 0;
  font-size: 1.15rem;
}

.market-name {
  margin-left: 0.25rem;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.5rem 1rem;
  margin: 0.75rem 0 0.5rem;
  word-break: normal;
}

.market-grid dt {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.market-grid dd {
  margin: 0.125rem 0 0;
  font-family: var(--mono);
}

.addr-hero .market-links {
  margin-left: 0;
}

.tag {
  display: inline-block;
  margin-top: 0.375rem;
  margin-right: 0.25rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- Feedback & empty states --- */
.empty {
  padding: 2.25rem 1.25rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
}

.error {
  color: var(--danger);
  background: rgba(255, 93, 115, 0.08);
  border: 1px solid rgba(255, 93, 115, 0.28);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
}

.answer {
  white-space: pre-wrap;
  padding: 1.125rem 1.25rem;
  line-height: 1.6;
}

.addr-hero {
  margin: 0 0 1.125rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-md);
  background: var(--accent-dim);
  border: 1px solid rgba(94, 233, 181, 0.22);
  word-break: break-all;
}

.addr-hero code {
  color: #b8ffe4;
}

/* --- Auth --- */
body.auth .site-main {
  min-height: 100vh;
  max-width: none;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(420px, 100%);
  padding: 1.75rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.auth-card .page-title {
  margin-top: 0.5rem;
}

.auth-card input,
.auth-card button {
  width: 100%;
}

.auth-card button {
  margin-top: 0.875rem;
}

/* --- Responsive --- */
@media (max-width: 720px) {
  .site-bar {
    flex-wrap: wrap;
  }

  .site-nav {
    width: 100%;
    margin-left: -0.5rem;
  }

  .mentions-table col.col-time {
    width: 7.5rem;
  }

  .mentions-table td.col-time,
  .mentions-table th.col-time {
    width: 7.5rem;
    max-width: 7.5rem;
    min-width: 7.5rem;
  }

  .mentions-table col.col-chat {
    width: 14%;
  }

  .mentions-table col.col-token {
    width: 36%;
  }

  .mentions-table col.col-text {
    width: 26%;
  }

  .mentions-table.feed-table col.col-chat {
    width: 17%;
  }

  .mentions-table.feed-table col.col-sender {
    width: 15%;
  }

  .mentions-table.feed-table col.col-text {
    width: 64%;
  }
}
