:root {
  color-scheme: dark;
  --gold: #bb9645;
  --gold-bright: #d4b566;
  --gold-muted: #8d733b;
  --black: #000;
  --panel: #090a0a;
  --panel-raised: #0e0f0f;
  --line: #292929;
  --line-gold: rgba(187, 150, 69, 0.48);
  --white: #fff;
  --muted: #a7a7a7;
  --dim: #858585;
  --danger: #e2b9a9;
  --max-width: 1480px;
  font-family: Roboto, Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--black);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--black);
  color: var(--white);
  font-size: 1rem;
  line-height: 1.5;
}

.demo-notice[hidden],
.market-message[hidden],
.chart-empty[hidden],
.search-results[hidden] {
  display: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.75rem 1rem;
  transform: translateY(-180%);
  background: var(--gold);
  color: var(--black);
  font-weight: 700;
}

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

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

.noscript {
  position: fixed;
  z-index: 90;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  border: 1px solid var(--gold);
  margin: 0;
  padding: 1rem;
  background: var(--black);
  color: var(--white);
  text-align: center;
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.96);
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(180px, 0.6fr) minmax(300px, 1.25fr) minmax(170px, 0.55fr);
  align-items: center;
  gap: 2rem;
  width: min(calc(100% - 3rem), var(--max-width));
  min-height: 76px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand img {
  width: 25px;
  height: 28px;
  margin-right: 0.7rem;
}

.brand-name {
  font-size: 1.18rem;
  font-weight: 700;
}

.brand-domain {
  margin-left: 0.12rem;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
}

.pair-search {
  position: relative;
  display: flex;
  align-items: center;
  height: 44px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.pair-search:focus-within {
  border-color: var(--gold);
}

.pair-search input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 3rem 0 2.75rem;
  background: transparent;
  color: var(--white);
  font-size: 0.94rem;
}

.pair-search input::placeholder {
  color: #777;
}

.search-icon {
  position: absolute;
  left: 0.95rem;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.7;
}

kbd {
  position: absolute;
  right: 0.75rem;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: "Roboto Mono", monospace;
  font-size: 0.74rem;
}

.search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: -1px;
  width: calc(100% + 2px);
  max-height: 330px;
  overflow-y: auto;
  border: 1px solid var(--line-gold);
  background: #080909;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.search-result {
  display: grid;
  grid-template-columns: 1fr auto;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 1rem;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.search-result:hover,
.search-result:focus-visible {
  background: #14130f;
}

.search-result strong {
  font-family: "Roboto Mono", monospace;
  font-size: 0.88rem;
}

.search-result span {
  color: var(--muted);
  font-size: 0.8rem;
}

.search-empty {
  margin: 0;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.network-state {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 0.7rem;
}

.network-state span:last-child {
  display: flex;
  flex-direction: column;
}

.network-state strong,
.network-state small {
  font-family: "Roboto Mono", monospace;
}

.network-state strong {
  font-size: 0.79rem;
  letter-spacing: 0.04em;
}

.network-state small {
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: transparent;
}

.status-dot.live {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(187, 150, 69, 0.12);
}

.status-dot.error {
  border-color: var(--danger);
  background: var(--danger);
}

main {
  width: min(calc(100% - 3rem), var(--max-width));
  margin: 0 auto;
}

.intro-band {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  align-items: end;
  gap: 3rem;
  min-height: 180px;
  border-bottom: 1px solid var(--line-gold);
  padding: 2.8rem 0 2rem;
}

.eyebrow,
.section-index {
  margin: 0 0 0.55rem;
  color: var(--gold);
  font-family: "Roboto Mono", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 850px;
  margin-bottom: 0;
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.intro-copy {
  max-width: 440px;
  margin: 0 0 0.2rem auto;
  color: #c7c7c7;
  font-size: 1rem;
}

.demo-notice {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--gold-muted);
  padding: 0.7rem 0;
  color: #d7d0c1;
  font-size: 0.84rem;
}

.demo-notice strong {
  color: var(--gold-bright);
  font-family: "Roboto Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
}

.market-overview,
.market-view {
  padding: 2.2rem 0 3.2rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.35rem;
}

.section-heading h2,
.panel-heading h3,
.liquidity-panel h3 {
  margin: 0;
  letter-spacing: -0.025em;
}

.section-heading h2 {
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.snapshot-time {
  margin: 0;
  color: var(--muted);
  font-family: "Roboto Mono", monospace;
  font-size: 0.74rem;
}

.headline-metrics {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric {
  display: flex;
  flex-direction: column;
  min-height: 116px;
  border-left: 1px solid var(--line);
  padding: 1.15rem 1.3rem;
}

.metric:first-child {
  border-left: 0;
}

.metric-primary {
  box-shadow: inset 3px 0 0 var(--gold);
}

.metric-label,
.quote-strip span,
.depth-bands span {
  color: var(--muted);
  font-size: 0.78rem;
}

.metric strong {
  margin: 0.25rem 0 0.05rem;
  font-family: "Roboto Mono", monospace;
  font-size: clamp(1.45rem, 2.7vw, 2.15rem);
  font-weight: 500;
  letter-spacing: -0.04em;
}

.metric-note {
  color: var(--dim);
  font-size: 0.72rem;
}

.featured-markets {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.market-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 130px;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 1rem;
  background: var(--black);
  text-align: left;
  cursor: pointer;
}

.market-card:first-child {
  border-left: 0;
}

.market-card::before {
  position: absolute;
  top: -1px;
  right: 0;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
}

.market-card:hover,
.market-card[aria-current="true"] {
  background: var(--panel);
}

.market-card[aria-current="true"]::before {
  background: var(--gold);
}

.market-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.market-card-pair {
  font-family: "Roboto Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
}

.market-card-quality {
  color: var(--dim);
  font-family: "Roboto Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.market-card-price {
  margin-top: auto;
  font-family: "Roboto Mono", monospace;
  font-size: clamp(1rem, 1.45vw, 1.3rem);
  font-weight: 500;
}

.market-card-meta {
  color: var(--dim);
  font-size: 0.68rem;
}

.skeleton {
  min-height: 130px;
  animation: pulse 1.6s ease-in-out infinite;
  background: var(--panel);
}

@keyframes pulse {
  50% { opacity: 0.45; }
}

.market-view {
  border-top: 1px solid var(--line-gold);
}

.market-heading h2 {
  display: flex;
  gap: 0.42rem;
  align-items: baseline;
  font-family: "Roboto Mono", monospace;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 500;
  letter-spacing: -0.055em;
}

.market-heading h2 span:last-child {
  color: var(--gold-bright);
}

.pair-slash {
  color: var(--dim);
  font-weight: 300;
}

.quality-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--gold);
  padding: 0.25rem 0.55rem;
  color: var(--gold-bright);
  font-family: "Roboto Mono", monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.badge-outline {
  border-color: var(--line);
  color: var(--muted);
}

.badge.alert {
  border-color: var(--danger);
  color: var(--danger);
}

.market-message {
  border-left: 3px solid var(--gold);
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
  background: #11100d;
  color: #d8d0c0;
  font-size: 0.88rem;
}

.quote-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  margin-bottom: 1rem;
}

.quote-strip > div {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  padding: 1rem 1.2rem;
}

.quote-strip > div:first-child {
  border-left: 0;
}

.quote-strip strong {
  margin-top: 0.25rem;
  font-family: "Roboto Mono", monospace;
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-weight: 500;
}

.quote-center {
  background: var(--panel);
}

.quote-center strong {
  color: var(--gold-bright);
}

.market-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(260px, 0.8fr);
  border: 1px solid var(--line);
}

.depth-panel {
  min-width: 0;
  padding: 1.2rem;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.panel-heading h3,
.liquidity-panel h3 {
  font-size: 1.05rem;
}

.chart-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.chart-key span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-key i {
  width: 18px;
  height: 2px;
  background: var(--gold);
}

.chart-key .key-ask {
  height: 1px;
  background: var(--white);
}

.chart-wrap {
  position: relative;
  min-height: 260px;
  margin-top: 0.8rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

#depth-chart {
  display: block;
  width: 100%;
  height: 260px;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.depth-bands {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 0.9rem;
}

.depth-bands div {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  padding-left: 1rem;
}

.depth-bands div:first-child {
  border-left: 0;
  padding-left: 0;
}

.depth-bands strong {
  margin-top: 0.12rem;
  font-family: "Roboto Mono", monospace;
  font-size: 0.92rem;
}

.liquidity-panel {
  border-left: 1px solid var(--line);
  padding: 1.2rem;
  background: var(--panel);
}

.balance-figure {
  display: flex;
  height: 8px;
  margin: 2rem 0 1.2rem;
  background: #222;
}

.balance-figure span:first-child {
  background: var(--gold);
}

.balance-figure span:last-child {
  border-left: 2px solid var(--black);
  background: #dedede;
}

.liquidity-list {
  margin: 0;
}

.liquidity-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding: 0.75rem 0;
}

.liquidity-list dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.liquidity-list dd {
  margin: 0;
  font-family: "Roboto Mono", monospace;
  font-size: 0.82rem;
}

.panel-footnote {
  margin: 1.1rem 0 0;
  color: var(--dim);
  font-size: 0.7rem;
  line-height: 1.45;
}

.book-panel {
  border: 1px solid var(--line);
  border-top: 0;
  padding: 1.2rem;
}

.book-heading {
  margin-bottom: 1rem;
}

.level-count {
  margin: 0;
  color: var(--muted);
  font-family: "Roboto Mono", monospace;
  font-size: 0.72rem;
}

.book-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
}

.book-side {
  min-width: 0;
  background: var(--black);
}

.side-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  background: var(--panel);
}

.side-heading span {
  color: var(--gold-bright);
  font-family: "Roboto Mono", monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

#asks-panel .side-heading span {
  color: var(--white);
}

.side-heading small {
  color: var(--dim);
  font-size: 0.67rem;
}

.table-scroll {
  max-height: 430px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Roboto Mono", monospace;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

th,
td {
  border-bottom: 1px solid #191919;
  padding: 0.57rem 0.9rem;
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #080909;
  color: var(--dim);
  font-size: 0.66rem;
  font-weight: 500;
}

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

#bid-levels td:first-child {
  color: var(--gold-bright);
}

#ask-levels td:first-child {
  color: var(--white);
}

tbody tr:hover {
  background: #11110f;
}

.empty-row td {
  height: 100px;
  color: var(--dim) !important;
  text-align: center !important;
  white-space: normal;
}

.mobile-tabs {
  display: none;
}

footer {
  display: grid;
  grid-template-columns: 0.5fr 1.5fr 1fr;
  align-items: center;
  gap: 2rem;
  width: min(calc(100% - 3rem), var(--max-width));
  min-height: 120px;
  border-top: 1px solid var(--line-gold);
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--white);
}

.footer-brand img {
  width: 18px;
  height: 20px;
}

footer p {
  margin: 0;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.8rem;
  color: var(--gold);
  font-family: "Roboto Mono", monospace;
  font-size: 0.63rem;
  letter-spacing: 0.08em;
}

@media (max-width: 1040px) {
  .header-inner {
    grid-template-columns: auto minmax(280px, 1fr) auto;
    gap: 1rem;
  }

  .brand-domain {
    display: none;
  }

  .featured-markets {
    grid-template-columns: repeat(3, 1fr);
  }

  .market-card:nth-child(4) {
    border-left: 0;
  }

  .headline-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .metric:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .market-grid {
    grid-template-columns: minmax(0, 1fr) 260px;
  }
}

@media (max-width: 760px) {
  .site-header {
    position: relative;
  }

  .header-inner {
    grid-template-columns: 1fr auto;
    width: min(calc(100% - 2rem), var(--max-width));
    padding: 0.8rem 0;
  }

  .pair-search {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .network-state strong {
    font-size: 0.72rem;
  }

  main,
  footer {
    width: min(calc(100% - 2rem), var(--max-width));
  }

  .intro-band {
    grid-template-columns: 1fr;
    gap: 1.2rem;
    min-height: 0;
    padding: 2rem 0 1.5rem;
  }

  h1 {
    font-size: clamp(2.15rem, 11vw, 3.6rem);
  }

  .intro-copy {
    margin-left: 0;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.8rem;
  }

  .market-heading {
    flex-direction: row;
  }

  .quality-group {
    justify-content: start;
  }

  .headline-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .metric {
    min-height: 105px;
    padding: 1rem;
  }

  .metric strong {
    font-size: 1.35rem;
  }

  .featured-markets {
    grid-template-columns: repeat(2, 1fr);
  }

  .market-card:nth-child(odd) {
    border-left: 0;
  }

  .market-card:nth-child(4) {
    border-left: 1px solid var(--line);
  }

  .quote-strip {
    grid-template-columns: 1fr 1fr;
  }

  .quote-strip > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .quote-strip > div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

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

  .liquidity-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .book-columns {
    display: block;
    background: transparent;
  }

  .mobile-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--line);
    margin-bottom: 0.7rem;
  }

  .mobile-tabs button {
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-family: "Roboto Mono", monospace;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
  }

  .mobile-tabs button[aria-selected="true"] {
    background: var(--gold);
    color: var(--black);
  }

  .book-side[hidden] {
    display: none;
  }

  .side-heading {
    display: none;
  }

  footer {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1.5rem 0;
  }

  .footer-meta {
    justify-content: start;
  }
}

@media (max-width: 430px) {
  .header-inner,
  main,
  footer {
    width: min(calc(100% - 1.25rem), var(--max-width));
  }

  .network-state small {
    display: none;
  }

  .headline-metrics {
    grid-template-columns: 1fr;
  }

  .metric,
  .metric:nth-child(2),
  .metric:nth-child(4) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .metric:first-child {
    border-top: 0;
  }

  .market-heading {
    flex-direction: column;
  }

  .market-heading h2 {
    font-size: 1.75rem;
  }

  .depth-panel,
  .liquidity-panel,
  .book-panel {
    padding: 0.9rem;
  }

  .panel-heading {
    align-items: start;
    flex-direction: column;
  }

  .chart-key {
    justify-content: start;
  }

  .depth-bands strong {
    font-size: 0.78rem;
  }

  th,
  td {
    padding: 0.55rem 0.5rem;
    font-size: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .skeleton {
    animation: none;
  }
}
