:root {
  --bg: #0f1115;
  --surface: #171a21;
  --text: #eef1f5;
  --muted: #8a92a2;
  --border: #262b35;
  --accent: #2E86AB;
  --up: #3ecf6a;
  --down: #e05555;
  --radius: 10px;
  --max: 900px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 32px 20px 60px; }

header { text-align: center; margin-bottom: 32px; }
header h1 { font-size: 15px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.total {
  font-size: 64px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 8px 0 4px;
  transition: color .3s;
  display: inline-block;
}
.sub { color: var(--muted); font-size: 14px; }
.freshness { color: var(--muted); font-size: 12px; margin-top: 2px; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}
.live-badge.live-connected { color: var(--up); }
.live-badge.live-connected .live-dot {
  background: var(--up);
  animation: live-pulse 1.8s ease-in-out infinite;
}
.live-badge.live-reconnecting { color: var(--muted); }
.live-badge.live-reconnecting .live-dot {
  background: var(--muted);
  animation: live-pulse-slow 2.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(1.2); }
}
@keyframes live-pulse-slow {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}

/* Odometer digit-roll reels for #total */
.odometer { display: inline-flex; }
.odo-digit {
  display: inline-block;
  overflow: hidden;
  height: 1em;
  line-height: 1;
  vertical-align: bottom;
  font-variant-numeric: tabular-nums;
}
.odo-track {
  display: flex;
  flex-direction: column;
  transition: transform .5s cubic-bezier(0.22, 1, 0.36, 1);
}
.odo-digit-char {
  height: 1em;
  line-height: 1;
  display: block;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  position: relative;
}
.card-icon-wrap { position: relative; display: inline-block; }
.card-emoji { font-size: 26px; }
.card-name { font-size: 13px; color: var(--muted); margin: 6px 0 4px; }
.card-count {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
a.card-link, a.card-link:link, a.card-link:visited {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a.card-link:hover, a.card-link:focus-visible {
  color: var(--text);
  border-bottom-color: currentColor;
}
.card-delta {
  position: absolute;
  top: -6px;
  right: -14px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 8px;
  color: #fff;
  opacity: 1;
}
.card-delta.up { background: var(--up); }
.card-delta.down { background: var(--down); }
.card-delta.flat { background: var(--muted, #555); opacity: .55; }

@keyframes chip-pop {
  0% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.card-delta.pop { animation: chip-pop .5s ease-out; }

.chart-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.chart-controls { display: flex; gap: 8px; margin-bottom: 14px; justify-content: flex-end; }
.chart-controls button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.chart-controls button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.chart-empty {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 0 20px;
}
.chart-empty[hidden] { display: none; }
#chart[hidden] { display: none !important; }

@keyframes flash-up { 0% { color: var(--up); } 100% { color: var(--text); } }
@keyframes flash-down { 0% { color: var(--down); } 100% { color: var(--text); } }
.flash-up { animation: flash-up 1.2s ease-out; }
.flash-down { animation: flash-down 1.2s ease-out; }

/* Total number gets a slightly stronger pulse (color + scale) on top of the base flash. */
@keyframes total-flash-up { 0% { color: var(--up); transform: scale(1.06); } 100% { color: var(--text); transform: scale(1); } }
@keyframes total-flash-down { 0% { color: var(--down); transform: scale(1.06); } 100% { color: var(--text); transform: scale(1); } }
.total.flash-up { animation: total-flash-up .5s ease-out; }
.total.flash-down { animation: total-flash-down .5s ease-out; }
