: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;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

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

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);
  white-space: nowrap;
  -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;
}

.visitor-counter {
  position: absolute;
  top: 6px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  user-select: none;
  opacity: 0.45;
}

.visitor-counter .vc-count {
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  font-style: italic;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-top: -1px;
}

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;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.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;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

#chart {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.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;
  top: 3px;
  right: 5px;
  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;
}

.page-footer {
  position: relative;
  flex: 0 0 auto;
  transition: opacity 0.2s ease-out;
}

.beta-bg {
  position: absolute;
  bottom: -10px;
  right: 83px;
  z-index: 1;
  font-size: 75px;
  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: absolute;
  bottom: 0;
  right: 16px;
  width: 72px;
  height: auto;
  z-index: 10;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.6));
}

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

.disclaimer {
  padding: 0 16px 16px;
  max-width: 800px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  user-select: none;
  max-height: 300px;
  overflow: hidden;
  transition: max-height 0.2s ease-out, padding 0.2s ease-out;
}

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

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

.force-hide-footer .page-footer {
  opacity: 0;
  pointer-events: none;
}
.force-hide-footer .disclaimer {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.footer-toggle-zone {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 22px;
  z-index: 100;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 3px;
}

.footer-toggle {
  pointer-events: auto;
  width: 72px;
  height: 5px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(139, 148, 158, 0.45);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease-out, height 0.12s ease-out, background 0.12s ease-out;
}

.footer-toggle-zone:hover .footer-toggle,
.page-footer:hover ~ .footer-toggle-zone .footer-toggle {
  opacity: 0.8;
}

.footer-toggle:hover {
  opacity: 1;
  height: 7px;
  background: rgba(180, 195, 210, 0.7);
}

.footer-toggle:focus-visible {
  opacity: 1;
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

@media (max-height: 725px) and (min-width: 641px) {
  .page-footer {
    opacity: 0;
    pointer-events: none;
  }
  .disclaimer {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  .footer-toggle-zone {
    display: none;
  }
}

@media (max-width: 640px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  header {
    padding: 12px 16px 8px;
  }

  header h1 {
    margin: 0;
    font-size: 36px;
    transform: none;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .visitor-counter {
    top: 8px;
    right: 10px;
  }

  .toolbar {
    padding: 10px 12px;
    justify-content: center;
  }

  .range-buttons {
    flex-wrap: wrap;
    width: 100%;
  }

  .range-buttons button {
    flex: 1 1 calc(20% - 4px);
    min-width: 0;
    padding: 8px 4px 6px;
  }

  main {
    padding: 12px;
    flex: 0 0 auto;
  }

  .stats {
    gap: 8px;
    margin-bottom: 12px;
  }

  .stats > div {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 12px 6px;
  }

  .stat-main > span:not(.label) {
    font-size: 24px;
  }

  #chart-wrap {
    min-height: 0;
    height: 55vh;
    flex: 0 0 auto;
    padding: 8px;
  }

  .chart-note {
    font-size: 8px;
  }

  .page-footer {
    flex: 0 0 auto;
  }

  .beta-bg,
  .robot-bg,
  .brand,
  .footer-toggle-zone {
    display: none;
  }

  .disclaimer {
    max-width: none;
    padding: 4px 16px 16px;
  }
}

/* uPlot dark-theme tweaks */
.u-axis { color: var(--muted); }

.chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  background: rgba(35, 43, 50, 0.95);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  font-family: "Bahnschrift", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  opacity: 0;
  transition: opacity 0.1s ease-out;
  z-index: 10;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.4;
}

.chart-tooltip .tt-time {
  color: var(--muted);
  margin-bottom: 3px;
  font-size: 13px;
}

.chart-tooltip .tt-sell { color: #29d6ff; margin-right: 4px; font-weight: 700; }
.chart-tooltip .tt-buy { color: #f9d49c; margin-right: 4px; font-weight: 700; }
