:root {
  --bg: 9 10 12;
  --surface: 18 19 23;
  --border: 255 255 255;
  --ink: 237 237 240;
  --muted: 140 140 150;
  --up: 34 197 94;
  --down: 239 68 68;

  --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

body {
  background: rgb(var(--bg));
  color: rgb(var(--ink));
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
}

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ---------- Ticker tape ---------- */
.tape-wrap {
  position: relative;
  display: flex;
  width: 100%;
  overflow: hidden;
  background: rgb(var(--surface));
  border-bottom: 1px solid rgb(var(--border) / 0.08);
  padding: 0.6rem 0;
}

.tape {
  display: flex;
  gap: 2rem;
  padding-right: 2rem;
  white-space: nowrap;
  animation: scroll-tape 22s linear infinite;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.82rem;
}

.tape span.up {
  color: rgb(var(--up));
}

.tape span.down {
  color: rgb(var(--down));
}

.tape .sym {
  color: rgb(var(--muted));
  margin-right: 0.4rem;
}

@keyframes scroll-tape {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tape {
    animation: none;
  }
  #tape-dup {
    display: none;
  }
}

/* ---------- Page ---------- */
.page {
  max-width: 620px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.page-header {
  margin-bottom: 2rem;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgb(var(--muted));
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.lede {
  color: rgb(var(--muted));
  font-size: 0.95rem;
}

.coins {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.coin {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.9rem;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border) / 0.08);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  transition: border-color 200ms ease;
}

.coin:hover {
  border-color: rgb(var(--border) / 0.18);
}

.coin-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.coin-icon img {
  display: block;
  width: 100%;
  height: 100%;
}

.coin-info {
  min-width: 0;
}

.coin-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
}

.coin-symbol {
  font-size: 0.78rem;
  color: rgb(var(--muted));
}

.sparkline {
  width: 76px;
  height: 30px;
  display: block;
  flex-shrink: 0;
}

.sparkline path {
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline.up path {
  stroke: rgb(var(--up));
}

.sparkline.down path {
  stroke: rgb(var(--down));
}

.coin-right {
  text-align: right;
}

.coin-price {
  font-size: 0.98rem;
  font-weight: 600;
  border-radius: 6px;
  padding: 0.15rem 0.35rem;
  margin: -0.15rem -0.35rem 0.1rem auto;
  width: fit-content;
}

.coin-price.flash-up {
  animation: flash-up 700ms ease-out;
}

.coin-price.flash-down {
  animation: flash-down 700ms ease-out;
}

@keyframes flash-up {
  0% {
    background: rgb(var(--up) / 0.35);
  }
  100% {
    background: rgb(var(--up) / 0);
  }
}

@keyframes flash-down {
  0% {
    background: rgb(var(--down) / 0.35);
  }
  100% {
    background: rgb(var(--down) / 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .coin-price.flash-up,
  .coin-price.flash-down {
    animation: none;
  }
}

.coin-change {
  font-size: 0.8rem;
  font-weight: 600;
}

.coin-change.up {
  color: rgb(var(--up));
}

.coin-change.down {
  color: rgb(var(--down));
}

.footnote {
  text-align: center;
  font-size: 0.78rem;
  color: rgb(var(--muted));
  margin-top: 1.75rem;
}

@media (max-width: 480px) {
  .sparkline {
    display: none;
  }
}
