/* DeepSeek-style message timeline rail — one tick per message, click to jump. */
.chat-timeline {
  position: fixed;
  right: max(8px, var(--sar, 0px));
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  width: 28px;
  max-height: min(620px, calc(100dvh - 120px));
  display: flex;
  justify-content: center;
  pointer-events: none;
  font-family: var(--font, "Inter Tight", -apple-system, BlinkMacSystemFont, sans-serif);
}
.chat-timeline[hidden] { display: none !important; }

/* The rail replaces the native chat scrollbar. */
.has-chat-timeline {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.has-chat-timeline::-webkit-scrollbar { width: 0; height: 0; display: none; }
#chatMessages.has-chat-timeline { padding-right: 48px; }
#messages.has-chat-timeline { padding-right: 44px; }

.chat-timeline-track {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  max-height: inherit;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  pointer-events: auto;
}
.chat-timeline-track::-webkit-scrollbar { width: 0; height: 0; display: none; }
.chat-timeline-track::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 50%;
  width: 1px;
  transform: translateX(-.5px);
  background: rgba(255, 255, 255, .09);
  pointer-events: none;
}
html[data-theme="light"] .chat-timeline-track::before { background: rgba(0, 0, 0, .1); }

.chat-timeline-tick {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 10px;
  height: 1px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  cursor: pointer;
  transition: width .16s ease, height .16s ease, background .16s ease;
}
html[data-theme="light"] .chat-timeline-tick { background: rgba(0, 0, 0, .22); }
.chat-timeline-tick:hover,
.chat-timeline-tick:focus-visible { width: 15px; background: rgba(255, 255, 255, .55); outline: none; }
html[data-theme="light"] .chat-timeline-tick:hover,
html[data-theme="light"] .chat-timeline-tick:focus-visible { background: rgba(0, 0, 0, .48); }
.chat-timeline-tick.is-active { width: 17px; height: 2px; background: #fff; }
html[data-theme="light"] .chat-timeline-tick.is-active { background: #0a0a0a; }

.chat-timeline-preview {
  position: fixed;
  z-index: 61;
  width: min(340px, 32vw);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: #17181c;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  color: #f5f6f8;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50%) translateX(6px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
.chat-timeline-preview.is-visible { opacity: 1; visibility: visible; transform: translateY(-50%) translateX(0); }
html[data-theme="light"] .chat-timeline-preview {
  background: #fff;
  color: #0a0a0a;
  border-color: rgba(0, 0, 0, .1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
}
.chat-timeline-preview-title {
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #8e8e93;
}
.chat-timeline-preview-user {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  color: #f5f6f8;
}
html[data-theme="light"] .chat-timeline-preview-user { color: #0a0a0a; }
.chat-timeline-preview-reply {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: #a1a1a6;
}
html[data-theme="light"] .chat-timeline-preview-reply {
  border-top-color: rgba(0, 0, 0, .08);
  color: #5b5f66;
}
.chat-timeline-preview-reply:empty { display: none; }

.chat-timeline-target {
  outline: 2px solid rgba(255, 255, 255, .38) !important;
  outline-offset: 4px;
  border-radius: 14px;
  transition: outline-color .2s ease;
}

@media (hover: none) {
  .chat-timeline-preview { display: none !important; }
}
