:root {
  --bg: #151a1e;
  --panel: #232b32;
  --border: #323e48;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.18);
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
}

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font: 14px/1.4 "Bahnschrift", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header {
  padding: 16px 24px;
  background: var(--bg);
}

header h1 {
  margin: -29.5px 0;
  font-size: 84px;
  line-height: 1;
  font-weight: 1000;
  font-variation-settings: "wght" 1000;
  font-style: italic;
  text-transform: uppercase;
  color: rgba(76, 102, 116, 0.7);
  transform: translateY(0.06em);
  text-shadow: 0 0 16px rgba(76, 102, 116, 0.18);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0.4) 100%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0.4) 100%);
}

.toolbar {
  padding: 14px 24px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

button {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  font: inherit;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

button:hover {
  border-color: var(--accent);
}

button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.range-buttons {
  display: inline-flex;
  gap: 4px;
}

.range-buttons button {
  color: #496e8b;
  background: #283138;
  border-color: #496e8b;
  padding: 8px 6px 6px;
  min-width: 36px;
}

.range-buttons button:hover {
  border-color: #6e96b4;
  color: #6e96b4;
}

.range-buttons button.active {
  background: #875f22;
  border-color: #ebc94d;
  color: #ebc94d;
}

main {
  padding: 16px 24px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.stats > div {
  background: #21343e;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px 4px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.stat-main {
  display: flex;
  flex-direction: column;
}

.stat-minmax {
  display: flex;
  flex-direction: column;
  font-variant-numeric: tabular-nums;
}

.mm-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
}

.mm-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stats .label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stats .label-sell { color: #29d6ff; }
.stats .label-buy  { color: #f9d49c; }

.stat-main > span:not(.label) {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 600;
  font-style: italic;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.stat-minmax .hi,
.stat-minmax .lo {
  font-size: 16px;
  font-weight: 500;
  font-style: italic;
}

.stat-minmax .hi { color: #58a6ff; }
.stat-minmax .lo { color: #f85149; }

#chart-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  position: relative;
}

#chart {
  min-height: 420px;
}

.status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.status.error { color: #f85149; }

.chart-note {
  position: absolute;
  bottom: 2px;
  right: 4px;
  color: var(--muted);
  font-size: 9px;
  font-style: italic;
  pointer-events: none;
  user-select: none;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.fade-in {
  animation: fade-in 0.25s ease-out 0.1s both;
}

.fade-out {
  animation: fade-out 0.15s ease-out both;
}

.loading-placeholder {
  visibility: hidden;
}

.beta-bg {
  position: fixed;
  bottom: -10px;
  right: 90px;
  z-index: -1;
  font-size: 83px;
  line-height: 1;
  font-weight: 900;
  font-style: italic;
  font-family: "Bahnschrift", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-transform: uppercase;
  color: rgba(95, 102, 108, 0.35);
  pointer-events: none;
  user-select: none;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 45%, rgba(0, 0, 0, 0.1) 100%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 45%, rgba(0, 0, 0, 0.1) 100%);
}

.robot-bg {
  position: fixed;
  bottom: 0;
  right: 24px;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  transform: scale(0.375);
  transform-origin: bottom right;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.6));
}

.brand {
  position: fixed;
  bottom: 0;
  right: 88px;
  z-index: 10000;
  color: #ffffff;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

.disclaimer {
  position: fixed;
  bottom: 12px;
  left: 24px;
  max-width: 800px;
  z-index: -1;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  pointer-events: none;
  user-select: none;
}

.disclaimer p {
  margin: 0 0 3px;
}

.disclaimer p:last-child {
  margin-bottom: 0;
}

/* uPlot dark-theme tweaks */
.u-legend { color: var(--text); pointer-events: none; }
.u-legend .u-label { color: var(--muted); }
.u-legend .u-series.u-legend-hidden { display: none; }
.u-axis { color: var(--muted); }
