/* News ticker only */
#chessNewsTicker{
  width:100%!important;
  min-width:0!important;
  position:relative!important;
  top:auto!important;
  right:auto!important;
  left:auto!important;
  z-index:8!important;
}
#chessNewsTicker .chess-news-label{
  color:inherit;
  text-decoration:none;
  white-space:nowrap;
}
#chessNewsTicker .chess-news-item{
  color:inherit;
  text-decoration:none;
  cursor:pointer;
}
#chessNewsTicker .chess-news-item:hover,
#chessNewsTicker .chess-news-item:focus-visible,
#chessNewsTicker .chess-news-label:hover,
#chessNewsTicker .chess-news-label:focus-visible{
  color:var(--hero-gold-2,#efcf7c);
  outline:none;
}
#chessNewsTicker .chess-news-fallback{
  color:inherit;
  text-decoration:none;
}

/* Hide all other tickers: news only */
html body #welcomeTicker,
html body #tournamentResultsTicker{
  display:none!important;
}

/* Slow and readable */
#chessNewsTicker .welcome-ticker-track{
  animation-duration:140s!important;
}

@media(min-width:901px){
  /* Desktop news ticker text only; mobile type remains unchanged. */
  html body #chessNewsTicker .chess-news-label,
  html body #chessNewsTicker .chess-news-item,
  html body #chessNewsTicker .chess-news-fallback,
  html body #chessNewsTicker .welcome-ticker-loading{
    font-size:14px!important;
  }
  html body{
    grid-template-rows:auto 34px auto auto auto auto!important;
  }

  html body .home-header{
    grid-row:1!important;
  }

  html body #chessNewsTicker{
    display:flex!important;
    grid-column:1/-1!important;
    grid-row:2!important;
    height:34px!important;
    min-height:34px!important;
    max-height:34px!important;
    margin:0!important;
  }

  html body .home-hero{
    grid-row:3!important;
  }
  html body #ranking{
    grid-row:3!important;
  }
  html body .home-features{
    grid-row:4!important;
  }
  html body #register{
    grid-row:5!important;
  }
  html body footer{
    grid-row:6!important;
  }

  html body.home-signed-in{
    grid-template-rows:64px 34px minmax(0,1fr)!important;
  }
  html body.home-signed-in .home-header{
    grid-row:1!important;
  }
  html body.home-signed-in #chessNewsTicker{
    grid-row:2!important;
  }
  html body.home-signed-in .home-hero,
  html body.home-signed-in #ranking{
    grid-row:3!important;
  }
}

@media(max-width:900px){
  body #chessNewsTicker{
    order:2!important;
    display:flex!important;
    width:100%!important;
    height:30px!important;
    min-height:30px!important;
    max-height:30px!important;
    flex:none!important;
    margin:0!important;
    border-top:0!important;
    border-bottom:1px solid rgba(224,181,103,.38)!important;
  }

  body .home-hero{order:3!important}
  body #ranking{order:4!important}
  body .home-features{order:5!important}
  body #register{order:6!important}
  body footer{order:7!important}

  #chessNewsTicker .welcome-ticker-track{
    animation-duration:150s!important;
  }
}

/* Desktop board workspace: reserve a real top lane for news, never overlay the board */
@media(min-width:901px){
  html body.desktop-board-workspace #chessNewsTicker{
    display:flex!important;
    position:fixed!important;
    top:0!important;
    left:0!important;
    right:var(--desktop-board-sidebar)!important;
    width:auto!important;
    height:34px!important;
    min-height:34px!important;
    max-height:34px!important;
    margin:0!important;
    z-index:90!important;
  }

  html body.desktop-board-workspace .desktop-board-stage{
    top:38px!important;
    bottom:4px!important;
  }

  html body.desktop-board-workspace .desktop-dashboard-column{
    top:38px!important;
    bottom:4px!important;
  }

  html body.desktop-board-workspace #homeBoardPreview.desktop-board-preview{
    width:min(
      calc(100vw - var(--desktop-board-sidebar) - var(--desktop-dashboard-width) - 40px),
      calc(100dvh - 42px)
    )!important;
    height:min(
      calc(100vw - var(--desktop-board-sidebar) - var(--desktop-dashboard-width) - 40px),
      calc(100dvh - 42px)
    )!important;
  }
}


/* Pause news movement while the pointer is over the ticker */
@media (hover:hover) and (pointer:fine){
  #chessNewsTicker:hover .welcome-ticker-track{
    animation-play-state:paused!important;
  }
}


/* board frame color override: higher specificity than the desktop shell */
@media(min-width:901px){
  html body.desktop-board-workspace #homeBoardPreview.desktop-board-preview{
    border:1px solid #5c8f92!important;
  }
}
