/* ============================================================
   TICKER-FIX v6 — Triple content, never stops scrolling
   ============================================================ */

:root {
  --ticker-h: 22px;
  --header-inner-h: 54px;
  --header-h: calc(var(--header-inner-h) + var(--ticker-h));
}

header {
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
  background: rgba(0,0,0,0.97) !important;
  border-bottom: none !important;
}

.header-container {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 10px 36px !important;
  border-bottom: 1px solid #ff0000 !important;
  min-height: var(--header-inner-h) !important;
  box-sizing: border-box !important;
}

#news-ticker-wrap {
  position: static !important;
  width: 100% !important;
  height: var(--ticker-h) !important;
  background: #050000 !important;
  border-bottom: 1px solid #2a0000 !important;
  display: flex !important;
  align-items: center !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  pointer-events: none;
}

.ticker-label {
  flex-shrink: 0 !important;
  background: #cc0000 !important;
  color: #000 !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 0.48rem !important;
  font-weight: bold !important;
  padding: 0 9px !important;
  letter-spacing: 1.5px !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  white-space: nowrap !important;
}

.ticker-track {
  flex: 1 !important;
  overflow: hidden !important;
  height: 100% !important;
}

/*
  CRITICAL: ticker-inner contains TRIPLE the items.
  We animate from 0 to -33.333% which = exactly 1 copy width.
  This gives infinite seamless scroll. Duration = items * time per item.
  35 items × ~4s each ≈ 140s feels natural and readable.
*/
.ticker-inner {
  display: inline-flex !important;
  align-items: center !important;
  height: 100% !important;
  white-space: nowrap !important;
  /* Use translate3d for GPU acceleration, -33.333% = 1 copy out of 3 */
  animation: tickerScrollFull 160s linear infinite !important;
  will-change: transform !important;
  /* Ensure animation runs even when tab is in background */
  animation-play-state: running !important;
}

/* Pause on hover only if you want — disabled by default */
/* .ticker-track:hover .ticker-inner { animation-play-state: paused !important; } */

.ticker-item {
  font-family: 'Space Mono', monospace !important;
  font-size: 0.52rem !important;
  color: #bb2222 !important;
  padding: 0 28px !important;
  letter-spacing: 0.3px !important;
  line-height: 1 !important;
  display: inline-block !important;
  white-space: nowrap !important;
}

.ticker-sep {
  color: #440000 !important;
  font-size: 0.5rem !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

@keyframes tickerScrollFull {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-33.3333%, 0, 0); }
}

/* body */
body { padding-top: 0 !important; }
#hero        { padding-top: 40px !important; }
#login-screen{ padding-top: 0 !important; }
#archive-select { padding-top: 40px !important; }
#stories { padding-top: 28px !important; }
#archive { padding-top: 28px !important; }
#chapter-sidebar { top: var(--header-h) !important; height: calc(100vh - var(--header-h)) !important; }
#sidebar { top: var(--header-h) !important; height: calc(100vh - var(--header-h)) !important; }

/* Mobile */
@media (max-width: 600px) {
  :root {
    --ticker-h: 20px;
    --header-inner-h: 46px;
  }
  .header-container {
    padding: 8px 14px !important;
    min-height: var(--header-inner-h) !important;
  }
  .ticker-label {
    font-size: 0.38rem !important;
    padding: 0 6px !important;
    letter-spacing: 1px !important;
  }
  .ticker-item {
    font-size: 0.44rem !important;
    padding: 0 16px !important;
  }
  /* Faster on mobile so more text is visible */
  .ticker-inner { animation-duration: 100s !important; }
}
