.TrailStop {
  padding: 3.5rem 2rem;
  margin-bottom: 4rem;
  position: relative;
  transition: all 0.3s ease;
  scroll-margin-top: 140px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: transparent;
  isolation: isolate;
}

.TrailStop::after {
  content: "";
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: calc(4rem - 1rem);
  background: var(--border-subtle);
  opacity: 0.6;
}

.TrailStop:last-child::after {
  display: none;
}

.TrailStop--completed .TrailStop-content {
  opacity: 0.35;
}

.TrailStop--visited .TrailStop-content {
  opacity: 0.5;
}

.TrailStop--visited {
  cursor: pointer;
}

.TrailStop--visited:hover .TrailStop-content {
  opacity: 0.7;
}

.TrailStop--current {
  border: 2px solid var(--accent-color);
}

/* Accent color glow effect - filtered as a unit */
.TrailStop--current::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 12px;
  border: 2px solid var(--accent-color);
  filter: var(--user-content-filter);
  opacity: 0;
  animation: stopPulse 3s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes stopPulse {
  0%,
  100% {
    opacity: 0.5;
    box-shadow: 0 0 0 0 var(--accent-color-transparent);
  }
  50% {
    opacity: 0.8;
    box-shadow: 0 0 0 8px transparent;
  }
}

/* Subtle background tint for current stop */
.TrailStop--current::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent-color);
  opacity: 0.03;
  border-radius: 12px;
  z-index: -2;
  filter: var(--user-content-filter);
}

/* Edit mode */
.TrailStop--editing {
  opacity: 1 !important;
  cursor: default;
  background: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
  .TrailStop--editing {
    background: rgba(255, 255, 255, 0.02);
  }
}

.TrailStop--editing.TrailStop--current {
  background: transparent;
}

.TrailStop-actions {
  text-align: center;
}

/* Edit controls */
.TrailStop-reorderControls {
  position: absolute;
  left: -52px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
  opacity: 0.3;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.TrailStop--reorderActive .TrailStop-reorderControls {
  opacity: 1;
}

.TrailStop-reorderControls:hover {
  opacity: 1;
}

.TrailStop-reorderControls > * {
  pointer-events: auto;
}

.TrailStop-deleteButton {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
}

.TrailStop-insertButton {
  position: absolute;
  top: calc(100% + 2rem);
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
}

/* Between-stops buttons are subtle by default, show fully on hover */
.TrailStop-insertButton--between {
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

/* Extend hover zone below the stop to include the gap area */
.TrailStop-insertButton--between::before {
  content: "";
  position: absolute;
  top: -2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: calc(4rem + 2rem);
  z-index: -1;
}

.TrailStop-insertButton--between:hover {
  opacity: 1;
}

/* Final button stays always visible - never dimmed */
.TrailStop-insertButton--final {
  opacity: 1;
}

/* Opaque background matching page */
.TrailStop-bg {
  position: absolute;
  inset: 0;
  background-color: var(--bg-color);
  filter: var(--user-content-filter);
  border-radius: 12px;
  z-index: -1;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .TrailStop {
    padding: 2.5rem 1.5rem;
    margin-left: 20px;
    margin-right: 20px;
  }

  /* Hide connector line on mobile */
  .TrailStop::after {
    display: none;
  }

  /* Hide reorder controls on mobile - they're positioned outside viewport */
  .TrailStop-reorderControls {
    display: none;
  }

  /* Make continue button responsive */
  .TrailStop-continueButton {
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
    min-width: 160px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
