:root {
  --ink: #09110f;
  --panel: #101a17;
  --line: rgba(225, 239, 228, .13);
  --muted: #91a69e;
  --paper: #e6eee8;
  --lime: #b7f34b;
  --amber: #f5c45e;
  --red: #ff7a66;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 78% -12%, rgba(183, 243, 75, .11), transparent 32%),
    var(--ink);
  color: var(--paper);
  font-family: Inter, Arial, Helvetica, sans-serif;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1360px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(9, 17, 15, .9);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 13px; letter-spacing: .16em; }
.brand b { color: var(--lime); font-weight: 800; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--lime);
  color: var(--ink);
  font-weight: 900;
  transform: rotate(-4deg);
}
.topbar-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font: 12px/1.2 var(--mono); }
.live-pill {
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 8px 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.live-pill i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--amber); }
.live-pill.online i { background: var(--lime); box-shadow: 0 0 0 4px rgba(183, 243, 75, .1); }
.live-pill.error i { background: var(--red); }
.refresh-button {
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 8px;
}
.refresh-button:hover, .refresh-button:focus-visible { color: var(--lime); outline: none; }
.refresh-button:disabled { cursor: wait; opacity: .5; }

.dashboard { width: min(1360px, calc(100% - 48px)); margin: 0 auto; }
.intro { padding: 70px 0 54px; display: grid; grid-template-columns: 1.3fr .7fr; align-items: end; gap: 64px; }
.kicker { margin: 0 0 14px; color: var(--lime); font: 700 12px/1 var(--mono); letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(48px, 6.3vw, 92px); letter-spacing: -.065em; line-height: .88; font-weight: 750; }
h1 em { color: var(--lime); font-style: normal; }
.intro-copy { max-width: 510px; margin: 0; color: #b9c7c0; font-size: 17px; line-height: 1.65; }

.metrics { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: rgba(16, 26, 23, .72); }
.metric { padding: 24px 26px; min-height: 134px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric p { margin: 0 0 18px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .09em; }
.metric strong { display: block; margin-bottom: 10px; font: 500 clamp(26px, 2.2vw, 36px)/1 var(--mono); letter-spacing: -.04em; }
.metric span { color: var(--muted); font-size: 12px; }
.metric.primary { background: var(--lime); color: var(--ink); }
.metric.primary p, .metric.primary span { color: var(--ink); }
.metric.spread strong { color: var(--amber); }
.change-up { color: #235418 !important; }
.change-down { color: #7c1f15 !important; }

.market-overview { margin-top: 18px; display: grid; grid-template-columns: 1.6fr .7fr; gap: 18px; }
.spot-card, .explanation, .market-table { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.spot-card { padding: 26px 28px 0; overflow: hidden; }
.card-label { display: flex; justify-content: space-between; color: var(--muted); font: 11px/1 var(--mono); letter-spacing: .12em; }
.spot-main { min-height: 230px; display: grid; grid-template-columns: .75fr 1.25fr; align-items: center; gap: 54px; }
.spot-main p { color: var(--muted); margin: 0 0 12px; }
.spot-main strong { font: 500 clamp(42px, 4.4vw, 68px)/.9 var(--mono); letter-spacing: -.07em; }
.spot-main small { font-size: 15px; color: var(--muted); letter-spacing: 0; }
.range-visual { width: 100%; padding-top: 38px; }
.range-caption, .range-values { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.range-caption { color: #70827a; font: 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.range-caption span:nth-child(2), .range-values b:nth-child(2) { text-align: center; }
.range-caption span:last-child, .range-values b:last-child { text-align: right; }
.range-track { position: relative; height: 9px; margin: 20px 4px 16px; border-radius: 99px; background: linear-gradient(90deg, rgba(245,196,94,.35), var(--lime)); }
.range-track::before, .range-track::after { content: ""; position: absolute; top: -4px; width: 1px; height: 17px; background: var(--line); }
.range-track::before { left: 0; }
.range-track::after { right: 0; }
.range-track i { position: absolute; left: 50%; top: 50%; width: 19px; height: 19px; transform: translate(-50%, -50%); border: 4px solid var(--paper); background: var(--ink); border-radius: 50%; transition: left .5s ease; }
.range-values { font: 500 13px/1 var(--mono); }
.range-values b:nth-child(2) { color: var(--lime); }
.spot-stats { margin: 20px -28px 0; padding: 20px 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; border-top: 1px solid var(--line); background: rgba(255,255,255,.02); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.spot-stats b { color: var(--paper); display: block; margin-bottom: 7px; font: 500 15px/1 var(--mono); letter-spacing: 0; }
.explanation { padding: 30px; display: flex; flex-direction: column; }
.eyebrow { color: var(--amber); font: 700 11px/1 var(--mono); letter-spacing: .14em; }
.explanation h2 { margin: 22px 0 14px; font-size: 30px; letter-spacing: -.045em; line-height: 1.02; }
.explanation p { margin: 0 0 26px; color: #a6b7af; font-size: 14px; line-height: 1.65; }
.legend-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 9px; align-items: center; margin-top: 13px; color: var(--muted); font-size: 12px; }
.legend-row b { color: var(--paper); font-weight: 500; }
.legend { width: 22px; height: 7px; border-radius: 9px; }
.legend.spot { background: var(--lime); }
.legend.p2p { background: repeating-linear-gradient(90deg, var(--amber) 0 3px, transparent 3px 6px); }
.binance-link { margin-top: auto; padding-top: 28px; color: var(--lime); font-size: 12px; }
.binance-link:hover { text-decoration: underline; }

.p2p-section { padding: 76px 0 30px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 26px; }
.section-heading h2 { margin: 0; font-size: 42px; letter-spacing: -.05em; }
.inventory-total { text-align: right; }
.inventory-total span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.inventory-total strong { color: var(--amber); font: 500 24px/1 var(--mono); }
.tables-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.market-table { overflow: hidden; }
.table-heading { display: flex; align-items: start; justify-content: space-between; padding: 25px 26px 19px; }
.table-heading > div { position: relative; padding-left: 18px; }
.side-dot { position: absolute; left: 0; top: 4px; width: 8px; height: 8px; border-radius: 50%; }
.side-dot.buy { background: var(--lime); }
.side-dot.sell { background: var(--red); }
.table-heading p { margin: 0 0 5px; color: var(--muted); font-size: 11px; }
.table-heading h3 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.table-count { color: var(--muted); font: 11px/1 var(--mono); border: 1px solid var(--line); padding: 7px 9px; border-radius: 7px; }
.table-scroll { overflow: auto; max-height: 530px; }
table { width: 100%; border-collapse: collapse; min-width: 590px; }
thead { position: sticky; top: 0; z-index: 2; background: var(--panel); }
th, td { padding: 15px 20px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; font-size: 12px; }
th { color: #70827a; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
th:first-child, td:first-child { text-align: left; }
td { color: #c6d1cc; font-family: var(--mono); }
.rank { color: #566760; display: inline-block; width: 28px; }
.price { font-weight: 700; }
.price.buy { color: var(--lime); }
.price.sell { color: var(--red); }
.limits { color: var(--muted); }
.merchant { color: var(--paper); }
.loading-cell { text-align: center !important; color: var(--muted); padding: 42px 20px; }
.method-note { margin: 18px 4px 0; color: #61726a; font-size: 11px; line-height: 1.55; }

footer { padding: 30px 0 42px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: #61726a; font-size: 11px; }
.error-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 50; background: #361a17; border: 1px solid rgba(255,122,102,.4); color: #ffd5cf; padding: 12px 16px; border-radius: 10px; font-size: 12px; transition: .2s ease; }
.error-toast.visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 980px) {
  .intro { grid-template-columns: 1fr; gap: 28px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .market-overview, .tables-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .timestamp, .refresh-button { display: none; }
  .dashboard { width: min(100% - 24px, 1360px); }
  .intro { padding: 48px 4px 34px; }
  .metrics { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .spot-main { grid-template-columns: 1fr; padding: 48px 0 28px; gap: 20px; }
  .spot-stats { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; gap: 22px; }
  .inventory-total { text-align: left; }
  footer { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
