:root {
  --black: #06100f;
  --ink: #0a1817;
  --mat: #0d2422;
  --teal: #14d9c5;
  --teal-soft: #6ef5e8;
  --yellow: #f7c948;
  --chrome: #c8d2d8;
  --line: rgba(110, 245, 232, 0.28);
  --glass: rgba(6, 16, 15, 0.78);
  --shadow: rgba(0, 0, 0, 0.48);
  --bg: var(--black);
  --text: #e8fffb;
  --muted: rgba(232, 255, 251, 0.58);
  --line-soft: rgba(110, 245, 232, 0.13);
  --cyan-2: #22d3ee;
  --teal-3: #2dd4bf;
  --amber-4: #fbbf24;
  --magenta-5: #e879f9;
  --green: #8aff95;
  --red: #ff9a9a;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  color-scheme: dark;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(rgba(110, 245, 232, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 245, 232, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 217, 197, 0.12), rgba(6, 16, 15, 0) 420px),
    var(--bg);
  background-size: 42px 42px, 42px 42px, auto, auto;
  font-family: "Nunito", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

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

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: rgba(110, 245, 232, 0.2);
  touch-action: manipulation;
}

.stats-page,
.flow-page,
.trade-page {
  width: min(1360px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 44px;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-block: 16px;
  border-bottom: 1px solid var(--line);
}

.app-nav .brand {
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  text-shadow: 0 0 16px rgba(247, 201, 72, 0.45);
  text-transform: uppercase;
}

.app-nav .brand:hover,
.app-nav .brand:focus-visible {
  color: #fff1a0;
}

.app-nav .nav-pills {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.app-nav .nav-pills a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid rgba(110, 245, 232, 0.32);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--teal-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 1000;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
}

.app-nav .nav-pills a:hover,
.app-nav .nav-pills a:focus-visible {
  border-color: rgba(110, 245, 232, 0.62);
  outline: 0;
}

.app-nav .nav-pills a.is-active {
  border-color: transparent;
  color: #031312;
  background: var(--teal-soft);
}

.page-header {
  margin-bottom: 28px;
}

.page-kicker,
.panel-kicker,
.kicker {
  margin: 0 0 6px;
  color: var(--teal-soft);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-kicker {
  margin-top: 22px;
}

.page-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1,
h2 {
  color: #fff;
  font-family: "Bungee", sans-serif;
  font-weight: 400;
}

h1.page-title {
  min-width: 0;
  font-size: clamp(36px, 4.4vw, 52px);
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 0 24px rgba(20, 217, 197, 0.48), 0 0 34px rgba(232, 121, 249, 0.18);
}

h2,
h2.section-title {
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.05;
}

h2.section-title {
  white-space: nowrap;
}

h3 {
  color: var(--yellow);
  font-family: "Nunito", sans-serif;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.load-status {
  align-self: center;
  justify-self: end;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--teal-soft);
  background: rgba(13, 36, 34, 0.78);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1.2;
  text-align: right;
}

.load-status.is-refreshing {
  opacity: 0.72;
}

.load-status.is-refreshing::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 8px;
  border: 2px solid rgba(110, 245, 232, 0.28);
  border-top-color: var(--teal-soft);
  border-radius: 999px;
  vertical-align: -0.12em;
  animation: statusSpin 0.8s linear infinite;
}

.load-status.is-error {
  color: #ffd6d6;
  border-color: rgba(255, 96, 96, 0.6);
}

.load-status.is-stale {
  color: #ffcc66;
  border-color: rgba(255, 204, 102, 0.58);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 34px;
}

.metric {
  display: grid;
  align-content: space-between;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(13, 36, 34, 0.92), rgba(6, 16, 15, 0.78));
  box-shadow: 0 18px 38px var(--shadow);
}

.metric span,
.metric small {
  color: var(--chrome);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #fff;
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 1000;
  line-height: 1;
  text-shadow: 0 0 16px rgba(20, 217, 197, 0.38);
}

.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(280px, 1.4fr);
  align-items: stretch;
  gap: 22px;
}

.page-layout > section,
.page-layout > aside {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.chart-panel,
.flow-card,
.table-panel,
.trade-card,
.top-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(13, 36, 34, 0.9), rgba(6, 16, 15, 0.78));
  box-shadow: 0 18px 42px var(--shadow);
}

.flow-sidebar,
.trade-sidebar {
  gap: 12px;
}

.flow-card,
.trade-card {
  padding: 14px;
}

.flow-card h2.section-title,
.trade-card h2.section-title {
  margin-bottom: 12px;
  font-size: 20px;
}

.flow-card:last-child,
.trade-card:last-child {
  flex: 1;
}

.direction-control {
  display: inline-flex;
  gap: 3px;
  margin: 2px 0 14px;
  padding: 3px;
  border: 1px solid rgba(110, 245, 232, 0.26);
  border-radius: 999px;
  background: rgba(6, 16, 15, 0.72);
}

.direction-control button,
.leverage-chip,
.volume-chip {
  border: 0;
  border-radius: 999px;
  color: var(--teal-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 1000;
  text-transform: uppercase;
}

.direction-control button {
  min-width: 72px;
  padding: 7px 12px;
}

.direction-control button:hover,
.direction-control button:focus-visible,
.leverage-chip:hover,
.leverage-chip:focus-visible,
.volume-chip:hover,
.volume-chip:focus-visible,
.pair-control select:hover,
.pair-control select:focus-visible,
.search-control input:focus-visible {
  color: #fff;
  background: rgba(20, 217, 197, 0.18);
}

.direction-control button:focus-visible,
.leverage-chip:focus-visible,
.volume-chip:focus-visible,
.pair-control select:focus-visible,
.search-control input:focus-visible,
.trade-table button:focus-visible,
.meme-link:focus-visible,
.more-link:focus-visible,
.token-link:focus-visible {
  outline: 2px solid rgba(247, 201, 72, 0.9);
  outline-offset: 3px;
}

.direction-control button.is-active {
  color: #06100f;
  background: var(--teal);
  box-shadow: 0 0 18px rgba(20, 217, 197, 0.26);
}

.control-block,
.pair-control,
.search-control {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.control-label {
  color: var(--chrome);
  font-size: 12px;
  font-weight: 1000;
  text-transform: uppercase;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.leverage-chip,
.volume-chip {
  min-width: 50px;
  border: 1px solid rgba(110, 245, 232, 0.22);
  padding: 7px 11px;
}

.volume-chip {
  min-width: 58px;
}

.volume-chip.is-active {
  color: #06100f;
  background: var(--teal-soft);
  box-shadow: 0 0 18px rgba(110, 245, 232, 0.2);
}

.leverage-chip.is-active[data-leverage="2"] {
  color: #001519;
  background: var(--cyan-2);
}

.leverage-chip.is-active[data-leverage="3"] {
  color: #001510;
  background: var(--teal-3);
}

.leverage-chip.is-active[data-leverage="4"] {
  color: #190f00;
  background: var(--amber-4);
}

.leverage-chip.is-active[data-leverage="5"] {
  color: #170019;
  background: var(--magenta-5);
}

.pair-control select,
.search-control input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(110, 245, 232, 0.28);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--bg);
  font-weight: 900;
}

.search-control input::placeholder {
  color: rgba(232, 255, 251, 0.36);
}

.live-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 13px 0 0;
  color: var(--green);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 1000;
  text-transform: uppercase;
}

.live-state span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0 rgba(138, 255, 149, 0.6);
  animation: livePulse 1.6s ease-out infinite;
}

.live-state.is-stale {
  color: #ffcc66;
}

.live-state.is-stale span {
  animation: none;
}

.pos {
  color: var(--green);
}

.neg {
  color: var(--red);
}

@keyframes statusSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes livePulse {
  100% {
    box-shadow: 0 0 0 12px rgba(138, 255, 149, 0);
  }
}

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

  .live-state span {
    animation: none;
  }
}

@media (max-width: 1099px) {
  .stats-page,
  .flow-page,
  .trade-page {
    width: min(100% - 28px, 900px);
  }

  .page-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .stats-page,
  .flow-page,
  .trade-page {
    width: min(100% - 18px, 520px);
    padding-top: 22px;
  }

  .app-nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .app-nav .nav-pills {
    width: 100%;
    justify-content: flex-start;
  }

  .app-nav .nav-pills a {
    flex: 1 1 0;
    min-width: 0;
  }

  .page-title-row {
    grid-template-columns: 1fr;
  }

  h1.page-title,
  h2.section-title {
    white-space: normal;
  }

  .load-status {
    width: 100%;
    justify-self: stretch;
    text-align: left;
  }

  .hero-stats {
    gap: 12px;
  }

  .metric {
    min-height: 108px;
  }

  .direction-control {
    width: 100%;
  }

  .direction-control button {
    flex: 1 1 0;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .stats-page,
  .flow-page,
  .trade-page {
    width: min(100% - 14px, 390px);
  }
}
