/* <market-ticker>: reusable live market ticker. Self-contained; override the custom properties to theme. */
market-ticker {
  --mt-bg: rgba(6, 10, 22, 0.86);
  --mt-border: rgba(255, 255, 255, 0.12);
  --mt-text: #eef3ff;
  --mt-muted: #9aa6c4;
  --mt-accent: #46e3b7;
  --mt-up: #3ee08f;
  --mt-down: #ff6b7d;
  --mt-seg: #ffc857;
  --mt-height: 42px;
  display: block;
  position: relative;
  z-index: 40;
  color: var(--mt-text);
  font: 500 13px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
market-ticker[sticky] { position: sticky; top: 0; }

market-ticker .mt {
  display: flex;
  align-items: center;
  height: var(--mt-height);
  background: var(--mt-bg);
  border-block: 1px solid var(--mt-border);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

market-ticker .mt__live {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 100%;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--mt-accent);
  border-right: 1px solid var(--mt-border);
}
market-ticker .mt__live i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--mt-accent);
  box-shadow: 0 0 0 0 var(--mt-accent);
  animation: mt-pulse 1.8s ease-out infinite;
}
market-ticker[data-status="stale"] .mt__live,
market-ticker[data-status="offline"] .mt__live { color: var(--mt-muted); }
market-ticker[data-status="stale"] .mt__live i,
market-ticker[data-status="offline"] .mt__live i { background: var(--mt-muted); animation: none; }

market-ticker .mt__viewport {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
market-ticker .mt__track,
market-ticker .mt__dup ul {
  display: flex;
  align-items: center;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
  width: max-content;
  will-change: transform;
}
market-ticker .mt__dup { height: 100%; }

market-ticker .mt__seg span {
  display: inline-block;
  margin: 0 6px 0 14px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #120c00;
  background: var(--mt-seg);
}
market-ticker .mt__seg--local span { background: var(--mt-accent); }

market-ticker .mt__item a {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 6px 14px;
  color: inherit;
  text-decoration: none;
  border-right: 1px solid var(--mt-border);
}
market-ticker .mt__item a:hover .mt__title,
market-ticker .mt__item a:focus-visible .mt__title { text-decoration: underline; }
market-ticker .mt__item a:focus-visible { outline: 2px solid var(--mt-accent); outline-offset: -2px; border-radius: 6px; }
market-ticker .mt__title { color: var(--mt-text); }
market-ticker .mt__lead { color: var(--mt-accent); font-weight: 700; font-variant-numeric: tabular-nums; }
market-ticker .mt__vol { color: var(--mt-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
market-ticker .mt__move { font-size: 11px; }
market-ticker .mt__move--up { color: var(--mt-up); }
market-ticker .mt__move--down { color: var(--mt-down); }
market-ticker .mt__sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

market-ticker .mt__pause {
  flex: none;
  width: 34px;
  height: 100%;
  border: 0;
  border-left: 1px solid var(--mt-border);
  background: transparent;
  color: var(--mt-muted);
  font-size: 11px;
  cursor: pointer;
}
market-ticker .mt__pause:hover,
market-ticker .mt__pause:focus-visible { color: var(--mt-text); }
market-ticker .mt__source {
  flex: none;
  padding: 0 12px;
  font-size: 10.5px;
  color: var(--mt-muted);
  text-decoration: none;
  border-left: 1px solid var(--mt-border);
  line-height: var(--mt-height);
}
market-ticker .mt__source:hover { color: var(--mt-text); }

/* Reduced motion: static, swipeable list instead of an auto-scrolling tape. */
market-ticker.is-static .mt__viewport {
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-mask-image: none;
  mask-image: none;
}
market-ticker.is-static .mt__track { will-change: auto; }

@media (max-width: 640px) {
  market-ticker { --mt-height: 38px; font-size: 12px; }
  market-ticker .mt__live { padding: 0 8px; }
  market-ticker .mt__source { font-size: 9.5px; padding: 0 8px; max-width: 74px; line-height: 1.15; white-space: normal; }
  market-ticker .mt__vol { display: none; }
}

@keyframes mt-pulse {
  0% { box-shadow: 0 0 0 0 rgba(70, 227, 183, 0.6); }
  100% { box-shadow: 0 0 0 8px rgba(70, 227, 183, 0); }
}
@media (prefers-reduced-motion: reduce) {
  market-ticker .mt__live i { animation: none; }
}
