:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #2a2f3a;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --bid: #3dd68c;
  --ask: #f07178;
  --last: #f0c14b;
  --bid-fill: rgba(61, 214, 140, 0.28);
  --ask-fill: rgba(240, 113, 120, 0.28);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1.45;
}
a { color: var(--last); }
.wrap { max-width: 56rem; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; }
header { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: baseline; margin-bottom: 1rem; }
.back {
  display: inline-block; margin-right: .25rem; padding: .2rem .55rem;
  border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: .9rem;
}
.back:hover { background: var(--panel); color: var(--last); }
h1 { font-size: 1.35rem; margin: 0; font-weight: 650; }
.pair { color: var(--muted); font-size: .95rem; }
.hero-px { margin: 0 0 1rem; }
.hero-usd {
  display: block;
  font-size: clamp(2.1rem, 6vw, 3.2rem);
  font-weight: 750;
  letter-spacing: -.03em;
  line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hero-usd.up { color: var(--bid); }
.hero-usd.down { color: var(--ask); }
.px-spin {
  display: inline-block;
  width: 0.72em;
  height: 0.72em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: px-spin .65s linear infinite;
  vertical-align: -0.08em;
  opacity: .75;
}
@keyframes px-spin { to { transform: rotate(360deg); } }
.hero-usd.is-loading,
.stat.last-stat .val.is-loading {
  color: var(--muted);
  font-weight: 500;
}
.hero-pair { display: block; color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; margin-top: .15rem; }
body.mini .hero-px { display: none; }
.ticker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.2rem, 1fr));
  gap: .6rem;
  margin: 0 0 1rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .65rem .8rem;
}
.stat .lbl { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .val { display: block; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.stat .sub { display: block; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.stat .val.up { color: var(--bid); }
.stat .val.down { color: var(--ask); }
.stat.last-stat .val { color: var(--text); font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.stat.last-stat .val.up { color: var(--bid); }
.stat.last-stat .val.down { color: var(--ask); }
.chart-wrap, .depth-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 1rem;
  overflow: hidden;
}
.chart-head, .depth-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  padding: .5rem .8rem; border-bottom: 1px solid var(--line);
}
.chart-head h2, .depth-head h2 {
  margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600;
}
.chart-head .hover, .depth-head .hover { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.2em; }
.bins { display: flex; gap: .25rem; }
.bins button {
  appearance: none; border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 5px; padding: .15rem .5rem; font: inherit; font-size: .8rem; cursor: pointer;
}
.bins button.on, .bins button:hover { color: var(--text); border-color: var(--last); }
#price { display: block; width: 100%; height: 220px; cursor: crosshair; }
#depth { display: block; width: 100%; height: 240px; cursor: crosshair; }
.book {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
@media (max-width: 720px) { .book { grid-template-columns: 1fr; } #depth { height: 200px; } #price { height: 180px; } }
.col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.col h2 {
  margin: 0;
  padding: .5rem .8rem;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
.col.asks h2 { color: var(--ask); }
.col.bids h2 { color: var(--bid); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .86rem; }
th, td { padding: .28rem .65rem; text-align: right; }
th { color: var(--muted); font-weight: 500; font-size: .7rem; text-transform: uppercase; }
td.rate { position: relative; width: 42%; overflow: hidden; }
td.rate .txt { position: relative; z-index: 1; }
td.usd { color: var(--muted); width: 22%; }
td.rate .dcr { display: block; color: var(--muted); font-size: .72rem; font-weight: 400; }
.bar {
  position: absolute; top: 0; bottom: 0; opacity: .22; pointer-events: none;
}
.asks .bar { right: 0; background: var(--ask); }
.bids .bar { left: 0; background: var(--bid); }
.asks td.rate .txt { color: var(--ask); }
.bids td.rate .txt { color: var(--bid); }
.empty, .err { color: var(--muted); padding: 1rem .8rem; margin: 0; }
.err { color: var(--ask); }
.foot { margin-top: 1rem; color: var(--muted); font-size: .88rem; }
.foot a { color: inherit; }
.status { font-size: .8rem; color: var(--muted); }

body.mini { overflow: hidden; cursor: pointer; }
body.mini .wrap { max-width: none; padding: .55rem .65rem .45rem; }
body.mini header { margin-bottom: .45rem; gap: .4rem .8rem; }
body.mini h1 { font-size: 1rem; }
body.mini .pair { font-size: .8rem; }
body.mini .ticker { gap: .35rem; margin-bottom: .45rem; }
body.mini .stat { padding: .35rem .5rem; }
body.mini .stat .lbl { font-size: .65rem; }
body.mini .stat .val { font-size: .88rem; }
body.mini .stat.last-stat .val { font-size: 1.2rem; }
body.mini .stat .sub { font-size: .72rem; }
body.mini .depth-wrap { margin: 0; }
body.mini .depth-head { padding: .3rem .55rem; }
body.mini .depth-head h2 { font-size: .7rem; }
body.mini #depth { height: 132px; }
