/* ============================================================
   NEWS TICKER - TV-style dual-banner above bottom nav
   ============================================================ */

/* Container - sticky above bottom nav (overlap 1px to eliminate border gap) */
.news-ticker {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--bottom-sai) - 1px);
  left: 0;
  right: 0;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  font-family: var(--font-mono);
}

html.pwa-standalone.game-active .news-ticker {
  position: absolute;
}

/* Hide ticker when overlays are open (same rule as bottom-nav) */
body:has(
  .collection-detail-overlay:not([hidden]),
  .balance-ledger-overlay:not([hidden]),
  .card-zoom-backdrop.visible,
  .confirm-overlay:not([hidden]),
  .fleet-dispatch-overlay,
  .prereq-overlay,
  .battle-report-overlay,
  .cinematic-overlay,
  #player-profile-modal
) .news-ticker {
  display: none;
}

/* ── BREAKING row (top) ────────────────────────────────── */
.ticker-breaking {
  display: none; /* hidden by default, shown via JS */
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 10px;
  /* Default (neutral) - cyan/blue tint */
  background: linear-gradient(90deg,
    rgba(56, 189, 248, 0.13) 0%,
    rgba(6, 6, 15, 0.92) 20%,
    rgba(6, 6, 15, 0.92) 80%,
    rgba(56, 189, 248, 0.13) 100%);
  border-top: 1px solid rgba(56, 189, 248, 0.30);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.08);
  gap: 6px;
  overflow: hidden;
  pointer-events: none;
}

/* Negative events - red/amber tint */
.ticker-breaking[data-mood="negative"] {
  background: linear-gradient(90deg,
    rgba(239, 68, 68, 0.15) 0%,
    rgba(6, 6, 15, 0.92) 20%,
    rgba(6, 6, 15, 0.92) 80%,
    rgba(239, 68, 68, 0.15) 100%);
  border-top: 1px solid rgba(239, 68, 68, 0.35);
}

/* Positive events - green/emerald tint */
.ticker-breaking[data-mood="positive"] {
  background: linear-gradient(90deg,
    rgba(52, 211, 153, 0.13) 0%,
    rgba(6, 6, 15, 0.92) 20%,
    rgba(6, 6, 15, 0.92) 80%,
    rgba(52, 211, 153, 0.13) 100%);
  border-top: 1px solid rgba(52, 211, 153, 0.30);
}

.ticker-breaking.active {
  display: flex;
}

.ticker-breaking-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 32px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  /* Default (neutral) - cyan */
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
  animation: ticker-pulse 2s ease-in-out infinite;
}

.ticker-breaking[data-mood="negative"] .ticker-breaking-label {
  color: var(--red);
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.ticker-breaking[data-mood="positive"] .ticker-breaking-label {
  color: #34d399;
  text-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}

@keyframes ticker-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.ticker-breaking-planet-img {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  display: none;
}

.ticker-breaking-planet-img.visible {
  display: block;
}

.ticker-breaking-planet-name {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 32px;
  color: var(--cyan);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: none;
}

.ticker-breaking-planet-name.visible {
  display: inline;
}

.ticker-breaking-text-wrap {
  /* shrink-to-fit so the whole breaking group centers in the band;
     still shrinkable so long headlines overflow-scroll */
  flex: 0 1 auto;
  overflow: hidden;
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
}

.ticker-breaking-text {
  display: inline-block;
  font-size: 12px;
  line-height: 32px;
  color: var(--text-primary);
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ticker-breaking-text-wrap.overflowing .ticker-breaking-text {
  animation: ticker-breaking-scroll var(--breaking-scroll-duration, 10s) linear infinite;
}

@keyframes ticker-breaking-scroll {
  0%, 30% { transform: translateX(0); }
  60%, 75% { transform: translateX(var(--breaking-scroll-offset, -100px)); }
  100% { transform: translateX(0); }
}

.ticker-breaking-countdown {
  flex-shrink: 0;
  font-size: 11px;
  line-height: 32px;
  color: #fbbf24;
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.5);
  letter-spacing: 0.06em;
  font-weight: 700;
}

/* ── Scroller row (bottom) ─────────────────────────────── */
.ticker-scroller {
  display: flex;
  align-items: center;
  height: 32px;
  background: rgba(6, 6, 15, 0.94);
  border-top: 1px solid rgba(var(--accent-rgb), 0.1);
  overflow: hidden;
  pointer-events: auto;
}

/* F2a: one line only - a live BREAKING item replaces the GNN scroller
   instead of stacking a second band over the content */
.news-ticker.breaking-on .ticker-scroller {
  display: none;
}

.ticker-scroller-label {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg-void);
  background: var(--cyan);
}

.ticker-scroller-track {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  mask-image: linear-gradient(90deg, transparent 0%, black 3%, black 97%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 3%, black 97%, transparent 100%);
}

.ticker-scroller-content {
  display: flex;
  white-space: nowrap;
  animation: ticker-scroll var(--ticker-duration, 60s) linear infinite;
  animation-play-state: var(--anim-state, running);
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-scroller-content span {
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  padding: 0 24px;
  text-transform: uppercase;
}

.ticker-separator {
  color: var(--cyan);
  opacity: 0.5;
  font-size: 8px;
  padding: 0 4px;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 480px) {
  .ticker-breaking {
    height: 28px;
    padding: 0 6px;
  }
  .ticker-breaking-label {
    font-size: 10px;
  }
  .ticker-breaking-planet-img {
    width: 18px;
    height: 18px;
  }
  .ticker-breaking-planet-name {
    font-size: 10px;
  }
  .ticker-breaking-text {
    font-size: 11px;
  }
  .ticker-breaking-countdown {
    font-size: 10px;
  }
  .ticker-scroller {
    height: 28px;
  }
  .ticker-scroller-label {
    padding: 0 8px;
    font-size: 10px;
  }
  .ticker-scroller-content span {
    font-size: 12px;
    padding: 0 16px;
  }
}

@media (min-width: 1024px) {
  .ticker-breaking {
    height: 34px;
  }
  .ticker-breaking-text {
    font-size: 13px;
  }
  .ticker-scroller {
    height: 30px;
  }
  .ticker-scroller-content span {
    font-size: 13px;
  }
}
